Commit 7f6011b6 authored by ZeMKI's avatar ZeMKI
Browse files

small javascript code optimization

parent b6f441f3
......@@ -110,6 +110,7 @@ table {
color: #046cbe;
display: block;
line-height: 1.5;
font-size: 16px;
}
 
/* BACKGROUND
......
......@@ -110,6 +110,7 @@ table {
color: #046cbe;
display: block;
line-height: 1.5;
font-size: 16px;
}
/* BACKGROUND
......
......@@ -141,10 +141,10 @@ $(window).bind('mousewheel DOMMouseScroll', function (event) {
 
/***/ }),
 
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/newedituser.vue?vue&type=script&lang=js&":
/*!**********************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/newedituser.vue?vue&type=script&lang=js& ***!
\**********************************************************************************************************************************************************************/
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modalnewedituser.vue?vue&type=script&lang=js&":
/*!***************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/modalnewedituser.vue?vue&type=script&lang=js& ***!
\***************************************************************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
 
......@@ -289,11 +289,6 @@ __webpack_require__.r(__webpack_exports__);
studiesselected: [],
supervisorselected: [],
allpermissions: [],
permissions: {
onlyconsult: false,
caneditstudy: false,
canassignusers: false
},
globalpermissions: {
cancreateusers: false,
cancreatestudy: false
......@@ -421,53 +416,8 @@ __webpack_require__.r(__webpack_exports__);
 
this.inputs.supervisors = [];
window.axios.post('getinputdata').then(function (response) {
_this2.inputs.userroles = response.data.allroles; // this.inputs.studies = response.data.relatedstudies;
// if(!_.isEmpty(response.data.supervisors)) this.inputs.supervisors = response.data.supervisors;
// show the placeholder
_this2.inputs.userroles = response.data.allroles;
_this2.userroleselected = 3;
/*
UPDATE FUNCTION FOR USERS
if(this.update){
window.axios.get('user/'+this.edituser,{data: this.edituser}).then(response =>{
this.usertoedit = response.data;
this.email = this.usertoedit.email;
for (var i = 0; i < this.usertoedit.roles.length; i++) {
this.userroleselected = this.usertoedit.roles[i].id;
}
// for (var i = 0; i < this.usertoedit.studies.length; i++) {
// this.studiesselected.push(this.usertoedit.studies[i].id);
// }
let permissions = [];
for (var i = 0; i < this.usertoedit.studies.length; i++) {
let id = this.usertoedit.studies[i].id;
if(_.isUndefined(this.studiesselected[id])){
this.studiesselected[id] = {}
for (var i = 0; i < this.usertoedit.studies[i].pivot.permission_id.length; i++) {
this.studiesselected[id][this.fromidtoname.permissionsNames[this.usertoedit.studies[i].pivot.permission_id[i]]] = true
}
}else{
for (var i = 0; i < this.usertoedit.studies[i].pivot.permission_id.length; i++) {
this.studiesselected[id][this.fromidtoname.permissionsNames[this.usertoedit.studies[i].pivot.permission_id[i]]] = true
}
}
}
this.studiesselected = this.allpermissions;
if(this.inputs.supervisors) this.supervisorselected = this.usertoedit.supervised_by;
}).catch(error =>{
});
}*/
}).catch(function (error) {
console.log("error " + error);
});
......@@ -478,9 +428,6 @@ __webpack_require__.r(__webpack_exports__);
saveuser: function saveuser() {
var _this3 = this;
 
// let gpermissions = [];
// if(this.globalpermissions.cancreatestudy)gpermissions.push(4);
// if(this.globalpermissions.cancreateusers)gpermissions.push(5);
var activeStudies = this.study;
 
if (this.validate()) {
......@@ -551,7 +498,6 @@ __webpack_require__.r(__webpack_exports__);
this.emailexistmessage = "";
this.userroleselected = [];
this.studiesselected = [];
this.resetspecificpermissions();
},
sendresetpassworddialog: function sendresetpassworddialog() {
var _this5 = this;
......@@ -578,20 +524,8 @@ __webpack_require__.r(__webpack_exports__);
});
},
resetallpermissions: function resetallpermissions() {
this.permissions.onlyconsult = false;
this.permissions.caneditstudy = false;
this.permissions.canassignusers = false;
this.globalpermissions.cancreateusers = false;
this.globalpermissions.cancreatestudy = false;
},
resetspecificpermissions: function resetspecificpermissions() {
this.permissions.onlyconsult = false;
this.permissions.caneditstudy = false;
this.permissions.canassignusers = false;
},
loadpermissions: function loadpermissions(id) {
this.createStudyPermissionArray(id);
this.studyradio = id;
}
}
});
......@@ -2626,13 +2560,8 @@ __webpack_require__.r(__webpack_exports__);
}).indexOf(13) > -1 ? true : false;
}
},
event: {
reloadusers: function reloadusers() {
window.axios.get('study' + this.study + 'users').then(function (response) {}).catch(function (error) {});
}
},
methods: {
confirmdeleteuser: function confirmdeleteuser(user) {
confirmDeleteUser: function confirmDeleteUser(user) {
var _this = this;
 
window.app.$dialog.confirm({
......@@ -2642,11 +2571,11 @@ __webpack_require__.r(__webpack_exports__);
type: 'is-danger',
hasIcon: true,
onConfirm: function onConfirm() {
return _this.deleteuser(user);
return _this.deleteUser(user);
}
});
},
confirmsendconfirmation: function confirmsendconfirmation(user) {
confirmSendConfirmationEmail: function confirmSendConfirmationEmail(user) {
var _this2 = this;
 
window.app.$dialog.confirm({
......@@ -2656,16 +2585,16 @@ __webpack_require__.r(__webpack_exports__);
type: 'is-warning',
hasIcon: true,
onConfirm: function onConfirm() {
return _this2.confirmuser(user);
return _this2.confirmUser(user);
}
});
},
confirmuser: function confirmuser(user) {
confirmUser: function confirmUser(user) {
window.axios.patch('usersconfirm/' + user.id).then(function (response) {
window.app.$snackbar.open("User needs to create a new password");
}).catch(function (error) {});
},
deleteuser: function deleteuser(user) {
deleteUser: function deleteUser(user) {
var _this3 = this;
 
window.axios.post('users/' + user.id + '/' + this.study).then(function (response) {
......@@ -2675,7 +2604,7 @@ __webpack_require__.r(__webpack_exports__);
}).catch(function (error) {});
}).catch(function (error) {});
},
changeeditpermission: function changeeditpermission(value, user) {
changeEditPermission: function changeEditPermission(value, user) {
var valueToSend = {
'value': value
};
......@@ -12995,10 +12924,10 @@ render._withStripped = true
 
/***/ }),
 
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/newedituser.vue?vue&type=template&id=41644efa&":
/*!**************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/newedituser.vue?vue&type=template&id=41644efa& ***!
\**************************************************************************************************************************************************************************************************************/
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modalnewedituser.vue?vue&type=template&id=bf51c01a&":
/*!*******************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/modalnewedituser.vue?vue&type=template&id=bf51c01a& ***!
\*******************************************************************************************************************************************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
 
......@@ -15929,7 +15858,7 @@ var render = function() {
staticClass: "level-left",
on: {
click: function($event) {
return _vm.confirmdeleteuser(user)
return _vm.confirmDeleteUser(user)
}
}
},
......@@ -15961,7 +15890,7 @@ var render = function() {
staticClass: "level-left",
on: {
click: function($event) {
return _vm.confirmsendconfirmation(user)
return _vm.confirmSendConfirmationEmail(user)
}
}
},
......@@ -16003,7 +15932,7 @@ var render = function() {
attrs: { disabled: _vm.studyeditable == false },
on: {
change: function($event) {
return _vm.changeeditpermission(
return _vm.changeEditPermission(
_vm.caneditthisstudy[user["id"]],
user["id"]
)
......@@ -16896,7 +16825,7 @@ Vue.component('v-select', vue_select__WEBPACK_IMPORTED_MODULE_7___default.a);
*/
 
Vue.component('new-study', __webpack_require__(/*! ./components/newstudy.vue */ "./resources/js/components/newstudy.vue").default);
Vue.component('new-edit-user', __webpack_require__(/*! ./components/newedituser.vue */ "./resources/js/components/newedituser.vue").default);
Vue.component('new-edit-user', __webpack_require__(/*! ./components/modalnewedituser.vue */ "./resources/js/components/modalnewedituser.vue").default);
Vue.component('user-overview', __webpack_require__(/*! ./components/overviewuser.vue */ "./resources/js/components/overviewuser.vue").default);
Vue.component('new-interview', __webpack_require__(/*! ./components/newinterview.vue */ "./resources/js/components/newinterview.vue").default);
Vue.component('sorting', __webpack_require__(/*! ./components/sorting.vue */ "./resources/js/components/sorting.vue").default);
......@@ -16909,28 +16838,6 @@ Vue.use(buefy__WEBPACK_IMPORTED_MODULE_0___default.a);
var bus = new Vue(); // Assign globally functions for getCookies and setCookies in JS
 
Vue.mixin({
data: function data() {
return {
fromidtoname: {
permissionsNames: {
1: "Only consult data",
2: "Can edit study",
3: "Can assign users to study",
4: "Can edit and create users",
5: "Can edit and create studies",
6: "Creator of the study"
},
permissionsVariables: {
onlyconsult: 1,
caneditstudy: 2,
canassignusers: 3,
cancreateusers: 4,
cancreatestudy: 5,
creator: 6
}
}
};
},
computed: {
url: function url() {
return document.URL.split('/').pop();
......@@ -17212,17 +17119,17 @@ __webpack_require__.r(__webpack_exports__);
 
/***/ }),
 
/***/ "./resources/js/components/newedituser.vue":
/*!*************************************************!*\
!*** ./resources/js/components/newedituser.vue ***!
\*************************************************/
/***/ "./resources/js/components/modalnewedituser.vue":
/*!******************************************************!*\
!*** ./resources/js/components/modalnewedituser.vue ***!
\******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
 
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _newedituser_vue_vue_type_template_id_41644efa___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./newedituser.vue?vue&type=template&id=41644efa& */ "./resources/js/components/newedituser.vue?vue&type=template&id=41644efa&");
/* harmony import */ var _newedituser_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./newedituser.vue?vue&type=script&lang=js& */ "./resources/js/components/newedituser.vue?vue&type=script&lang=js&");
/* harmony import */ var _modalnewedituser_vue_vue_type_template_id_bf51c01a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modalnewedituser.vue?vue&type=template&id=bf51c01a& */ "./resources/js/components/modalnewedituser.vue?vue&type=template&id=bf51c01a&");
/* harmony import */ var _modalnewedituser_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modalnewedituser.vue?vue&type=script&lang=js& */ "./resources/js/components/modalnewedituser.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
 
 
......@@ -17232,9 +17139,9 @@ __webpack_require__.r(__webpack_exports__);
/* normalize component */
 
var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
_newedituser_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
_newedituser_vue_vue_type_template_id_41644efa___WEBPACK_IMPORTED_MODULE_0__["render"],
_newedituser_vue_vue_type_template_id_41644efa___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
_modalnewedituser_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
_modalnewedituser_vue_vue_type_template_id_bf51c01a___WEBPACK_IMPORTED_MODULE_0__["render"],
_modalnewedituser_vue_vue_type_template_id_bf51c01a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
false,
null,
null,
......@@ -17244,38 +17151,38 @@ var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_
 
/* hot reload */
if (false) { var api; }
component.options.__file = "resources/js/components/newedituser.vue"
component.options.__file = "resources/js/components/modalnewedituser.vue"
/* harmony default export */ __webpack_exports__["default"] = (component.exports);
 
/***/ }),
 
/***/ "./resources/js/components/newedituser.vue?vue&type=script&lang=js&":
/*!**************************************************************************!*\
!*** ./resources/js/components/newedituser.vue?vue&type=script&lang=js& ***!
\**************************************************************************/
/***/ "./resources/js/components/modalnewedituser.vue?vue&type=script&lang=js&":
/*!*******************************************************************************!*\
!*** ./resources/js/components/modalnewedituser.vue?vue&type=script&lang=js& ***!
\*******************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
 
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_newedituser_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./newedituser.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/newedituser.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_newedituser_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_modalnewedituser_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./modalnewedituser.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modalnewedituser.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_modalnewedituser_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
 
/***/ }),
 
/***/ "./resources/js/components/newedituser.vue?vue&type=template&id=41644efa&":
/*!********************************************************************************!*\
!*** ./resources/js/components/newedituser.vue?vue&type=template&id=41644efa& ***!
\********************************************************************************/
/***/ "./resources/js/components/modalnewedituser.vue?vue&type=template&id=bf51c01a&":
/*!*************************************************************************************!*\
!*** ./resources/js/components/modalnewedituser.vue?vue&type=template&id=bf51c01a& ***!
\*************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
 
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_newedituser_vue_vue_type_template_id_41644efa___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./newedituser.vue?vue&type=template&id=41644efa& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/newedituser.vue?vue&type=template&id=41644efa&");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_newedituser_vue_vue_type_template_id_41644efa___WEBPACK_IMPORTED_MODULE_0__["render"]; });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_modalnewedituser_vue_vue_type_template_id_bf51c01a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./modalnewedituser.vue?vue&type=template&id=bf51c01a& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modalnewedituser.vue?vue&type=template&id=bf51c01a&");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_modalnewedituser_vue_vue_type_template_id_bf51c01a___WEBPACK_IMPORTED_MODULE_0__["render"]; });
 
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_newedituser_vue_vue_type_template_id_41644efa___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_modalnewedituser_vue_vue_type_template_id_bf51c01a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
 
 
 
{
"/js/app.js": "/js/app.js?id=8335407ff7be9f367e83",
"/css/app.css": "/css/app.css?id=1abf25588c73d17b8451",
"/css/app_dompdf.css": "/css/app_dompdf.css?id=06023e8a43967827a614",
"/js/app.js": "/js/app.js?id=877c470a605478b522ac",
"/css/app.css": "/css/app.css?id=e850b5c60370c59e1f2d",
"/css/app_dompdf.css": "/css/app_dompdf.css?id=473a4745658ee6ec7590",
"/js/manifest.js": "/js/manifest.js?id=844cdbfe9e6b6b56ae8f",
"/js/vendor.js": "/js/vendor.js?id=e803732b0abd596f50d8"
}
......@@ -25,7 +25,7 @@ Vue.component('v-select', vSelect)
*/
Vue.component('new-study', require('./components/newstudy.vue').default);
Vue.component('new-edit-user', require('./components/newedituser.vue').default);
Vue.component('new-edit-user', require('./components/modalnewedituser.vue').default);
Vue.component('user-overview', require('./components/overviewuser.vue').default);
Vue.component('new-interview', require('./components/newinterview.vue').default);
Vue.component('sorting', require('./components/sorting.vue').default);
......@@ -41,28 +41,6 @@ var bus = new Vue();
// Assign globally functions for getCookies and setCookies in JS
Vue.mixin({
data() {
return {
fromidtoname: {
permissionsNames: {
1: "Only consult data",
2: "Can edit study",
3: "Can assign users to study",
4: "Can edit and create users",
5: "Can edit and create studies",
6: "Creator of the study"
},
permissionsVariables: {
onlyconsult: 1,
caneditstudy: 2,
canassignusers: 3,
cancreateusers: 4,
cancreatestudy: 5,
creator: 6
}
}
}
},
computed: {
url: function () {
return document.URL.split('/').pop();
......
<template>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card card-default">
<div class="card-header">Example Component</div>
<div class="card-body">
I'm an example component.
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log('Component mounted.')
}
}
</script>
......@@ -138,11 +138,6 @@
studiesselected: [],
supervisorselected: [],
allpermissions: [],
permissions: {
onlyconsult: false,
caneditstudy: false,
canassignusers: false
},
globalpermissions:{
cancreateusers: false,
cancreatestudy: false
......@@ -211,7 +206,8 @@
4: "cancreateusers",
5: "cancreatestudy",
6: "creator"
}
};
for (var permission in val){
self.studiesselected[self.studyradio][permission] = val[permission];
}
......@@ -263,7 +259,7 @@
"onlyconsult",
"caneditstudy",
"canassignusers"
]
];
/// if the study doesn't exist, initialize with all false values
/// otherwise assign the values to the 3 permissions checkboxes
......@@ -289,53 +285,7 @@
window.axios.post('getinputdata').then(response =>{
this.inputs.userroles = response.data.allroles;
// this.inputs.studies = response.data.relatedstudies;
// if(!_.isEmpty(response.data.supervisors)) this.inputs.supervisors = response.data.supervisors;
// show the placeholder
this.userroleselected = 3;
/*
UPDATE FUNCTION FOR USERS
if(this.update){
window.axios.get('user/'+this.edituser,{data: this.edituser}).then(response =>{
this.usertoedit = response.data;
this.email = this.usertoedit.email;
for (var i = 0; i < this.usertoedit.roles.length; i++) {
this.userroleselected = this.usertoedit.roles[i].id;
}
// for (var i = 0; i < this.usertoedit.studies.length; i++) {
// this.studiesselected.push(this.usertoedit.studies[i].id);
// }
let permissions = [];
for (var i = 0; i < this.usertoedit.studies.length; i++) {
let id = this.usertoedit.studies[i].id;
if(_.isUndefined(this.studiesselected[id])){
this.studiesselected[id] = {}
for (var i = 0; i < this.usertoedit.studies[i].pivot.permission_id.length; i++) {
this.studiesselected[id][this.fromidtoname.permissionsNames[this.usertoedit.studies[i].pivot.permission_id[i]]] = true
}
}else{
for (var i = 0; i < this.usertoedit.studies[i].pivot.permission_id.length; i++) {
this.studiesselected[id][this.fromidtoname.permissionsNames[this.usertoedit.studies[i].pivot.permission_id[i]]] = true
}
}
}
this.studiesselected = this.allpermissions;
if(this.inputs.supervisors) this.supervisorselected = this.usertoedit.supervised_by;
}).catch(error =>{
});
}*/
}).catch(error =>{
console.log("error "+error);
......@@ -348,11 +298,6 @@
saveuser: function(){
// let gpermissions = [];
// if(this.globalpermissions.cancreatestudy)gpermissions.push(4);
// if(this.globalpermissions.cancreateusers)gpermissions.push(5);
let activeStudies = this.study;
if(this.validate()){
......@@ -413,7 +358,6 @@ emptyform: function() {
this.emailexistmessage ="";
this.userroleselected = [];
this.studiesselected = [];
this.resetspecificpermissions();
},
sendresetpassworddialog() {
......@@ -435,26 +379,11 @@ sendresetopassword() {
});
},
resetallpermissions: function(){
this.permissions.onlyconsult = false;
this.permissions.caneditstudy = false;
this.permissions.canassignusers = false;
this.globalpermissions.cancreateusers = false;
this.globalpermissions.cancreatestudy = false;
resetallpermissions: function(){
this.globalpermissions.cancreateusers = false;
this.globalpermissions.cancreatestudy = false;
},
resetspecificpermissions: function(){
this.permissions.onlyconsult = false;
this.permissions.caneditstudy = false;
this.permissions.canassignusers = false;
},
loadpermissions: function(id){
this.createStudyPermissionArray(id)
this.studyradio = id;
}
}
}
}
......
......@@ -4,18 +4,18 @@
<div class="column" v-for="user in usersinstudy" v-if="user['email'] != 'belli@uni-bremen.de' && user['email'] != auth['email'] ">
<div class="level has-background-light" style="padding: 3px">
<div class="level-left" @click="confirmdeleteuser(user)"><b-icon icon="delete-sweep" class="has-text-danger " ></b-icon></div>
<div class="level-left" @click="confirmDeleteUser(user)"><b-icon icon="delete-sweep" class="has-text-danger " ></b-icon></div>
<div class="level-right">{{user['email']}}</div>
</div>
<div class="level has-background-warning is-size-7" style="padding: 3px" >
<div class="level-left" @click="confirmsendconfirmation(user)"><b-icon icon="send" ></b-icon> Send</div>
<div class="level-left" @click="confirmSendConfirmationEmail(user)"><b-icon icon="send" ></b-icon> Send</div>
<div class="level-right" v-if="user['password_token']">This user needs to set a password</div>
<div class="level-right" v-if="!(user['password_token'])">Reset password for this user</div>
</div>
<div class="level" v-for="role in user['roles']">
<div class="level-left"><span class="tag is-primary">{{role['name']}}</span></div>
</div>
<label class="checkbox" @change="changeeditpermission(caneditthisstudy[user['id']],user['id'])" :disabled="studyeditable == false">
<label class="checkbox" @change="changeEditPermission(caneditthisstudy[user['id']],user['id'])" :disabled="studyeditable == false">
<input type="checkbox" v-model="caneditthisstudy[user['id']]" :disabled="studyeditable == false">
Can edit <strong>this</strong> study
</label>
......@@ -35,7 +35,7 @@
props: ['usersinstudy','study','auth','studyeditable'],
data() {
return {
caneditthisstudy: {},
caneditthisstudy: {},
cancreatestudies: {}
}
......@@ -53,44 +53,35 @@
}
},
event:{
reloadusers: function(){
window.axios.get('study'+this.study+'users').then(response =>{
}).catch(error =>{
});
}
},
methods:{
confirmdeleteuser: function(user) {
confirmDeleteUser: function(user) {
window.app.$dialog.confirm({
title: 'Delete User',
message: 'Do you want to delete this user? '+user.email,
confirmText: 'Delete',
type: 'is-danger',
hasIcon: true,
onConfirm: () => this.deleteuser(user)
onConfirm: () => this.deleteUser(user)
})
},
confirmsendconfirmation: function(user) {
confirmSendConfirmationEmail: function(user) {
window.app.$dialog.confirm({
title: 'Reset User Password',
message: 'Do you want to send again the confirmation email to this user? '+user.email,
confirmText: 'Resend',
type: 'is-warning',
hasIcon: true,
onConfirm: () => this.confirmuser(user)
onConfirm: () => this.confirmUser(user)
})
},
confirmuser: function(user){