@iankibetsh/shframework 1.4.5 → 1.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist/library.mjs.css +61 -29
- package/dist/library.js +254 -176
- package/dist/library.mjs +255 -178
- package/package.json +1 -1
package/dist/library.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import Axios from 'axios';
|
|
|
2
2
|
import moment from 'moment';
|
|
3
3
|
import Swal from 'sweetalert2';
|
|
4
4
|
import NProgress from 'nprogress';
|
|
5
|
-
import { openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, resolveComponent, withModifiers, createVNode, ref, onMounted, unref, normalizeClass, createBlock, resolveDynamicComponent, inject, mergeProps, normalizeStyle, renderSlot, normalizeProps, guardReactiveProps, withCtx, createStaticVNode, shallowRef,
|
|
5
|
+
import { openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, resolveComponent, withModifiers, createVNode, ref, onMounted, unref, normalizeClass, createBlock, resolveDynamicComponent, inject, mergeProps, normalizeStyle, renderSlot, normalizeProps, guardReactiveProps, withCtx, createStaticVNode, shallowRef, vModelCheckbox, pushScopeId, popScopeId, computed, isRef, watch } from 'vue';
|
|
6
6
|
import Editor from '@tinymce/tinymce-vue';
|
|
7
7
|
import _ from 'lodash';
|
|
8
|
-
import { defineStore, storeToRefs } from 'pinia';
|
|
9
8
|
import { useRoute, useRouter } from 'vue-router';
|
|
9
|
+
import { defineStore, storeToRefs } from 'pinia';
|
|
10
10
|
|
|
11
11
|
function setItem (key, value) {
|
|
12
12
|
let toStore = value;
|
|
@@ -2542,11 +2542,11 @@ const _hoisted_7$5 = { class: "row" };
|
|
|
2542
2542
|
const _hoisted_8$3 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
|
|
2543
2543
|
const _hoisted_9$4 = { class: "col-md-12" };
|
|
2544
2544
|
const _hoisted_10$3 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
|
|
2545
|
-
const _hoisted_11$
|
|
2546
|
-
const _hoisted_12$
|
|
2547
|
-
const _hoisted_13$
|
|
2548
|
-
const _hoisted_14$
|
|
2549
|
-
const _hoisted_15$
|
|
2545
|
+
const _hoisted_11$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
|
|
2546
|
+
const _hoisted_12$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
|
|
2547
|
+
const _hoisted_13$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
|
|
2548
|
+
const _hoisted_14$3 = ["data-cy", "name", "onFocus", "onUpdate:modelValue"];
|
|
2549
|
+
const _hoisted_15$3 = ["disabled", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
|
|
2550
2550
|
const _hoisted_16$2 = ["name", "onFocus", "onUpdate:modelValue"];
|
|
2551
2551
|
const _hoisted_17$2 = ["name", "onFocus", "onUpdate:modelValue"];
|
|
2552
2552
|
const _hoisted_18$2 = ["value"];
|
|
@@ -2650,7 +2650,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2650
2650
|
class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
|
|
2651
2651
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
|
|
2652
2652
|
type: "number"
|
|
2653
|
-
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11$
|
|
2653
|
+
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11$3)), [
|
|
2654
2654
|
[vModelText, _ctx.form_elements[field]]
|
|
2655
2655
|
])
|
|
2656
2656
|
: createCommentVNode("v-if", true),
|
|
@@ -2664,7 +2664,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2664
2664
|
class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
|
|
2665
2665
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
|
|
2666
2666
|
type: "password"
|
|
2667
|
-
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_12$
|
|
2667
|
+
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_12$3)), [
|
|
2668
2668
|
[vModelText, _ctx.form_elements[field]]
|
|
2669
2669
|
])
|
|
2670
2670
|
: createCommentVNode("v-if", true),
|
|
@@ -2679,7 +2679,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2679
2679
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
|
|
2680
2680
|
type: "email",
|
|
2681
2681
|
required: ""
|
|
2682
|
-
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_13$
|
|
2682
|
+
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_13$3)), [
|
|
2683
2683
|
[vModelText, _ctx.form_elements[field]]
|
|
2684
2684
|
])
|
|
2685
2685
|
: createCommentVNode("v-if", true),
|
|
@@ -2692,7 +2692,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2692
2692
|
onFocus: $event => ($options.removeErrors(field)),
|
|
2693
2693
|
class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control active"]),
|
|
2694
2694
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
|
|
2695
|
-
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_14$
|
|
2695
|
+
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_14$3)), [
|
|
2696
2696
|
[vModelText, _ctx.form_elements[field]]
|
|
2697
2697
|
])
|
|
2698
2698
|
: createCommentVNode("v-if", true),
|
|
@@ -2740,7 +2740,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2740
2740
|
class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
|
|
2741
2741
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
|
|
2742
2742
|
type: "text"
|
|
2743
|
-
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_15$
|
|
2743
|
+
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_15$3)), [
|
|
2744
2744
|
[vModelText, _ctx.form_elements[field]]
|
|
2745
2745
|
])
|
|
2746
2746
|
: createCommentVNode("v-if", true),
|
|
@@ -3603,20 +3603,20 @@ const _hoisted_9$3 = [
|
|
|
3603
3603
|
_hoisted_4$6
|
|
3604
3604
|
];
|
|
3605
3605
|
const _hoisted_10$2 = { class: "record_counts" };
|
|
3606
|
-
const _hoisted_11$
|
|
3606
|
+
const _hoisted_11$2 = {
|
|
3607
3607
|
key: 0,
|
|
3608
3608
|
"aria-label": "Page navigation"
|
|
3609
3609
|
};
|
|
3610
|
-
const _hoisted_12$
|
|
3611
|
-
const _hoisted_13$
|
|
3610
|
+
const _hoisted_12$2 = { class: "pagination" };
|
|
3611
|
+
const _hoisted_13$2 = {
|
|
3612
3612
|
key: 0,
|
|
3613
3613
|
class: "page-link"
|
|
3614
3614
|
};
|
|
3615
|
-
const _hoisted_14$
|
|
3615
|
+
const _hoisted_14$2 = {
|
|
3616
3616
|
key: 1,
|
|
3617
3617
|
class: "page-link"
|
|
3618
3618
|
};
|
|
3619
|
-
const _hoisted_15$
|
|
3619
|
+
const _hoisted_15$2 = ["onClick"];
|
|
3620
3620
|
const _hoisted_16$1 = { key: 1 };
|
|
3621
3621
|
const _hoisted_17$1 = {
|
|
3622
3622
|
key: 0,
|
|
@@ -3655,8 +3655,8 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3655
3655
|
createElementVNode("span", _hoisted_10$2, " of " + toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
|
|
3656
3656
|
]),
|
|
3657
3657
|
($props.pagination_data != null)
|
|
3658
|
-
? (openBlock(), createElementBlock("nav", _hoisted_11$
|
|
3659
|
-
createElementVNode("ul", _hoisted_12$
|
|
3658
|
+
? (openBlock(), createElementBlock("nav", _hoisted_11$2, [
|
|
3659
|
+
createElementVNode("ul", _hoisted_12$2, [
|
|
3660
3660
|
createElementVNode("li", {
|
|
3661
3661
|
class: normalizeClass([$options.getActivePage === 1 ? 'disabled' : '' , "page-item"])
|
|
3662
3662
|
}, [
|
|
@@ -3671,14 +3671,14 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3671
3671
|
key: page
|
|
3672
3672
|
}, [
|
|
3673
3673
|
($options.getActivePage === page)
|
|
3674
|
-
? (openBlock(), createElementBlock("a", _hoisted_13$
|
|
3674
|
+
? (openBlock(), createElementBlock("a", _hoisted_13$2, toDisplayString(page), 1 /* TEXT */))
|
|
3675
3675
|
: (['..','...'].includes(page))
|
|
3676
|
-
? (openBlock(), createElementBlock("a", _hoisted_14$
|
|
3676
|
+
? (openBlock(), createElementBlock("a", _hoisted_14$2, toDisplayString(page), 1 /* TEXT */))
|
|
3677
3677
|
: (openBlock(), createElementBlock("a", {
|
|
3678
3678
|
key: 2,
|
|
3679
3679
|
onClick: $event => ($options.changeTableKey('page',page)),
|
|
3680
3680
|
class: "page-link"
|
|
3681
|
-
}, toDisplayString(page), 9 /* TEXT, PROPS */, _hoisted_15$
|
|
3681
|
+
}, toDisplayString(page), 9 /* TEXT, PROPS */, _hoisted_15$2))
|
|
3682
3682
|
], 2 /* CLASS */))
|
|
3683
3683
|
}), 128 /* KEYED_FRAGMENT */)),
|
|
3684
3684
|
createElementVNode("li", {
|
|
@@ -4180,24 +4180,24 @@ const _hoisted_7$2 = {
|
|
|
4180
4180
|
const _hoisted_8$2 = { class: "col-12 mb-3" };
|
|
4181
4181
|
const _hoisted_9$2 = { class: "sh-search-bar" };
|
|
4182
4182
|
const _hoisted_10$1 = ["placeholder"];
|
|
4183
|
-
const _hoisted_11 = {
|
|
4183
|
+
const _hoisted_11$1 = {
|
|
4184
4184
|
key: 0,
|
|
4185
4185
|
class: "text-center"
|
|
4186
4186
|
};
|
|
4187
|
-
const _hoisted_12 = /*#__PURE__*/createElementVNode("div", {
|
|
4187
|
+
const _hoisted_12$1 = /*#__PURE__*/createElementVNode("div", {
|
|
4188
4188
|
class: "spinner-border",
|
|
4189
4189
|
role: "status"
|
|
4190
4190
|
}, [
|
|
4191
4191
|
/*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...")
|
|
4192
4192
|
], -1 /* HOISTED */);
|
|
4193
|
-
const _hoisted_13 = [
|
|
4194
|
-
_hoisted_12
|
|
4193
|
+
const _hoisted_13$1 = [
|
|
4194
|
+
_hoisted_12$1
|
|
4195
4195
|
];
|
|
4196
|
-
const _hoisted_14 = {
|
|
4196
|
+
const _hoisted_14$1 = {
|
|
4197
4197
|
key: 1,
|
|
4198
4198
|
class: "alert alert-danger"
|
|
4199
4199
|
};
|
|
4200
|
-
const _hoisted_15 = { colspan: 2 };
|
|
4200
|
+
const _hoisted_15$1 = { colspan: 2 };
|
|
4201
4201
|
const _hoisted_16 = {
|
|
4202
4202
|
key: 0,
|
|
4203
4203
|
class: "text-center"
|
|
@@ -4363,10 +4363,10 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4363
4363
|
($options.hasDefaultSlot)
|
|
4364
4364
|
? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
4365
4365
|
($data.loading === 'loading')
|
|
4366
|
-
? (openBlock(), createElementBlock("div", _hoisted_11, _hoisted_13))
|
|
4366
|
+
? (openBlock(), createElementBlock("div", _hoisted_11$1, _hoisted_13$1))
|
|
4367
4367
|
: ($data.loading === 'error')
|
|
4368
|
-
? (openBlock(), createElementBlock("div", _hoisted_14, [
|
|
4369
|
-
createElementVNode("span", _hoisted_15, toDisplayString($data.loading_error), 1 /* TEXT */)
|
|
4368
|
+
? (openBlock(), createElementBlock("div", _hoisted_14$1, [
|
|
4369
|
+
createElementVNode("span", _hoisted_15$1, toDisplayString($data.loading_error), 1 /* TEXT */)
|
|
4370
4370
|
]))
|
|
4371
4371
|
: createCommentVNode("v-if", true),
|
|
4372
4372
|
($data.loading === 'done')
|
|
@@ -4971,6 +4971,199 @@ return (_ctx, _cache) => {
|
|
|
4971
4971
|
|
|
4972
4972
|
script$4.__file = "src/lib/components/ShDynamicTabs.vue";
|
|
4973
4973
|
|
|
4974
|
+
const _withScopeId$1 = n => (pushScopeId("data-v-0d4fa0ac"),n=n(),popScopeId(),n);
|
|
4975
|
+
const _hoisted_1$3 = { class: "row permissions-main d-flex" };
|
|
4976
|
+
const _hoisted_2$3 = {
|
|
4977
|
+
id: "permissions-nav",
|
|
4978
|
+
class: "col-md-3 d-flex align-items-center py-4"
|
|
4979
|
+
};
|
|
4980
|
+
const _hoisted_3$3 = { class: "d-flex flex-column w-100 px-2" };
|
|
4981
|
+
const _hoisted_4$3 = ["checked", "disabled"];
|
|
4982
|
+
const _hoisted_5$3 = ["onClick"];
|
|
4983
|
+
const _hoisted_6$2 = {
|
|
4984
|
+
id: "permissions-content",
|
|
4985
|
+
class: "col-md-9 py-4 px-4"
|
|
4986
|
+
};
|
|
4987
|
+
const _hoisted_7$1 = { class: "p-2 rounded-2 bg-white h-100" };
|
|
4988
|
+
const _hoisted_8$1 = {
|
|
4989
|
+
key: 0,
|
|
4990
|
+
class: "alert alert-info"
|
|
4991
|
+
};
|
|
4992
|
+
const _hoisted_9$1 = { key: 1 };
|
|
4993
|
+
const _hoisted_10 = { class: "row row-cols-3" };
|
|
4994
|
+
const _hoisted_11 = { class: "col" };
|
|
4995
|
+
const _hoisted_12 = ["value"];
|
|
4996
|
+
const _hoisted_13 = {
|
|
4997
|
+
key: 0,
|
|
4998
|
+
class: "w-100 row"
|
|
4999
|
+
};
|
|
5000
|
+
const _hoisted_14 = { class: "col-md-3" };
|
|
5001
|
+
const _hoisted_15 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
|
|
5002
|
+
|
|
5003
|
+
var script$3 = {
|
|
5004
|
+
__name: 'ManagePermissions',
|
|
5005
|
+
setup(__props) {
|
|
5006
|
+
|
|
5007
|
+
const route = useRoute();
|
|
5008
|
+
const modules = ref([]);
|
|
5009
|
+
const selectedModule = ref('tasks');
|
|
5010
|
+
const modulePermissions = ref(null);
|
|
5011
|
+
|
|
5012
|
+
const selectedPermissions = ref([]);
|
|
5013
|
+
const permissionsChanged = ref(false);
|
|
5014
|
+
const departmentId = route.params.id;
|
|
5015
|
+
const department = ref(null);
|
|
5016
|
+
const departmentModules = ref([]);
|
|
5017
|
+
const setModule = module=>{
|
|
5018
|
+
(selectedModule.value !== module) && (selectedModule.value = module) && getModulePermissions();
|
|
5019
|
+
};
|
|
5020
|
+
onMounted(() => {
|
|
5021
|
+
getDepartmentModules();
|
|
5022
|
+
});
|
|
5023
|
+
const getDepartmentModules = ()=>{
|
|
5024
|
+
shApis.doGet(`admin/departments/department/list-all-modules/admin/${departmentId}`).then(res=>{
|
|
5025
|
+
modules.value = res.data.modules;
|
|
5026
|
+
department.value = res.data.department;
|
|
5027
|
+
departmentModules.value = res.data.departmentModules;
|
|
5028
|
+
selectedModule.value = res.data.modules[0];
|
|
5029
|
+
getModulePermissions();
|
|
5030
|
+
});
|
|
5031
|
+
};
|
|
5032
|
+
const loading = ref(false);
|
|
5033
|
+
const getModulePermissions = () => {
|
|
5034
|
+
loading.value = true;
|
|
5035
|
+
modulePermissions.value = null;
|
|
5036
|
+
shApis.doGet(`admin/departments/department/get-module-permissions/${selectedModule.value}?department_id=${departmentId}`).then(res=>{
|
|
5037
|
+
loading.value = false;
|
|
5038
|
+
modulePermissions.value = reformatModulePermissions(res.data.permissions);
|
|
5039
|
+
selectedPermissions.value = res.data.selectedPermissions ?? [];
|
|
5040
|
+
permissionsChanged.value = false;
|
|
5041
|
+
});
|
|
5042
|
+
};
|
|
5043
|
+
const permissionsUpdated = (res)=>{
|
|
5044
|
+
departmentModules.value = res.data.departmentModules;
|
|
5045
|
+
};
|
|
5046
|
+
function reformatModulePermissions(mPs){
|
|
5047
|
+
let mpModules = {};
|
|
5048
|
+
mPs.map(mp=>{
|
|
5049
|
+
const arr = mp.split('.');
|
|
5050
|
+
const key = arr[0];
|
|
5051
|
+
if(typeof mpModules[key] == 'undefined'){
|
|
5052
|
+
mpModules[key]=[];
|
|
5053
|
+
}
|
|
5054
|
+
mpModules[key].push(mp);
|
|
5055
|
+
});
|
|
5056
|
+
return mpModules
|
|
5057
|
+
}
|
|
5058
|
+
const setPermissionsChanged = ()=>{
|
|
5059
|
+
permissionsChanged.value = true;
|
|
5060
|
+
return true
|
|
5061
|
+
};
|
|
5062
|
+
const checkAllPermissions = ()=>{
|
|
5063
|
+
if(selectedPermissions.value.length > 0) {
|
|
5064
|
+
selectedPermissions.value = [];
|
|
5065
|
+
} else {
|
|
5066
|
+
departmentModules.value.push(selectedModule);
|
|
5067
|
+
console.log(modulePermissions.value);
|
|
5068
|
+
const all = modulePermissions.value;
|
|
5069
|
+
Object.keys(all).map(key=>{
|
|
5070
|
+
all[key].map(permission=>{
|
|
5071
|
+
selectedPermissions.value.push(permission);
|
|
5072
|
+
});
|
|
5073
|
+
});
|
|
5074
|
+
}
|
|
5075
|
+
permissionsChanged.value = true;
|
|
5076
|
+
};
|
|
5077
|
+
const getLabel = permission => {
|
|
5078
|
+
const arr = permission.split('.');
|
|
5079
|
+
return arr[arr.length - 1].replaceAll('_',' ')
|
|
5080
|
+
};
|
|
5081
|
+
const getPermissionStyle = permission => {
|
|
5082
|
+
return {
|
|
5083
|
+
paddingLeft: `${(permission.split('.').length-1) * 20}px`
|
|
5084
|
+
}
|
|
5085
|
+
};
|
|
5086
|
+
|
|
5087
|
+
return (_ctx, _cache) => {
|
|
5088
|
+
return (openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
5089
|
+
createElementVNode("div", _hoisted_2$3, [
|
|
5090
|
+
createElementVNode("ul", _hoisted_3$3, [
|
|
5091
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(modules.value, (module) => {
|
|
5092
|
+
return (openBlock(), createElementBlock("li", {
|
|
5093
|
+
class: normalizeClass(selectedModule.value === module && 'active'),
|
|
5094
|
+
key: selectedModule.value
|
|
5095
|
+
}, [
|
|
5096
|
+
createElementVNode("input", {
|
|
5097
|
+
checked: departmentModules.value.includes(module),
|
|
5098
|
+
onClick: checkAllPermissions,
|
|
5099
|
+
disabled: selectedModule.value !== module,
|
|
5100
|
+
type: "checkbox"
|
|
5101
|
+
}, null, 8 /* PROPS */, _hoisted_4$3),
|
|
5102
|
+
createElementVNode("label", {
|
|
5103
|
+
class: "text-capitalize",
|
|
5104
|
+
onClick: $event => (setModule(module))
|
|
5105
|
+
}, toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_5$3)
|
|
5106
|
+
], 2 /* CLASS */))
|
|
5107
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
5108
|
+
])
|
|
5109
|
+
]),
|
|
5110
|
+
createElementVNode("div", _hoisted_6$2, [
|
|
5111
|
+
createElementVNode("div", _hoisted_7$1, [
|
|
5112
|
+
(loading.value)
|
|
5113
|
+
? (openBlock(), createElementBlock("div", _hoisted_8$1, " loading ... "))
|
|
5114
|
+
: (openBlock(), createElementBlock("div", _hoisted_9$1, [
|
|
5115
|
+
createElementVNode("div", _hoisted_10, [
|
|
5116
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(modulePermissions.value, (permissions) => {
|
|
5117
|
+
return (openBlock(), createElementBlock("div", _hoisted_11, [
|
|
5118
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(permissions, (permission) => {
|
|
5119
|
+
return (openBlock(), createElementBlock("label", {
|
|
5120
|
+
onClick: setPermissionsChanged,
|
|
5121
|
+
class: "text-capitalize list-group-item pb-1 text-capitalize",
|
|
5122
|
+
style: normalizeStyle(getPermissionStyle(permission))
|
|
5123
|
+
}, [
|
|
5124
|
+
withDirectives(createElementVNode("input", {
|
|
5125
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((selectedPermissions).value = $event)),
|
|
5126
|
+
value: permission,
|
|
5127
|
+
type: "checkbox"
|
|
5128
|
+
}, null, 8 /* PROPS */, _hoisted_12), [
|
|
5129
|
+
[vModelCheckbox, selectedPermissions.value]
|
|
5130
|
+
]),
|
|
5131
|
+
createTextVNode(" " + toDisplayString(getLabel(permission)), 1 /* TEXT */)
|
|
5132
|
+
], 4 /* STYLE */))
|
|
5133
|
+
}), 256 /* UNKEYED_FRAGMENT */))
|
|
5134
|
+
]))
|
|
5135
|
+
}), 256 /* UNKEYED_FRAGMENT */))
|
|
5136
|
+
]),
|
|
5137
|
+
(permissionsChanged.value)
|
|
5138
|
+
? (openBlock(), createElementBlock("div", _hoisted_13, [
|
|
5139
|
+
createElementVNode("div", _hoisted_14, [
|
|
5140
|
+
createVNode(script$7, {
|
|
5141
|
+
onSuccess: permissionsUpdated,
|
|
5142
|
+
url: `admin/departments/department/permissions/${unref(departmentId)}/${selectedModule.value}`,
|
|
5143
|
+
data: {permissions: selectedPermissions.value},
|
|
5144
|
+
class: "btn btn-primary d-block"
|
|
5145
|
+
}, {
|
|
5146
|
+
default: withCtx(() => [
|
|
5147
|
+
_hoisted_15,
|
|
5148
|
+
createTextVNode(" Save")
|
|
5149
|
+
]),
|
|
5150
|
+
_: 1 /* STABLE */
|
|
5151
|
+
}, 8 /* PROPS */, ["url", "data"])
|
|
5152
|
+
])
|
|
5153
|
+
]))
|
|
5154
|
+
: createCommentVNode("v-if", true)
|
|
5155
|
+
]))
|
|
5156
|
+
])
|
|
5157
|
+
])
|
|
5158
|
+
]))
|
|
5159
|
+
}
|
|
5160
|
+
}
|
|
5161
|
+
|
|
5162
|
+
};
|
|
5163
|
+
|
|
5164
|
+
script$3.__scopeId = "data-v-0d4fa0ac";
|
|
5165
|
+
script$3.__file = "src/lib/components/core/Departments/department/ManagePermissions.vue";
|
|
5166
|
+
|
|
4974
5167
|
const useUserStore = defineStore('user-store', {
|
|
4975
5168
|
state: () => ({
|
|
4976
5169
|
user: null,
|
|
@@ -5067,19 +5260,19 @@ const useUserStore = defineStore('user-store', {
|
|
|
5067
5260
|
}
|
|
5068
5261
|
});
|
|
5069
5262
|
|
|
5070
|
-
const _hoisted_1$
|
|
5071
|
-
const _hoisted_2$
|
|
5072
|
-
const _hoisted_3$
|
|
5073
|
-
const _hoisted_4$
|
|
5263
|
+
const _hoisted_1$2 = /*#__PURE__*/createElementVNode("h5", null, "Departments", -1 /* HOISTED */);
|
|
5264
|
+
const _hoisted_2$2 = { class: "card sh-departments-card shadow" };
|
|
5265
|
+
const _hoisted_3$2 = { class: "card-body" };
|
|
5266
|
+
const _hoisted_4$2 = {
|
|
5074
5267
|
"data-bs-toggle": "modal",
|
|
5075
5268
|
ref: "addDeptBtn",
|
|
5076
5269
|
href: "#sh-department_modal",
|
|
5077
5270
|
class: "btn btn-info btn-sm"
|
|
5078
5271
|
};
|
|
5079
|
-
const _hoisted_5$
|
|
5272
|
+
const _hoisted_5$2 = /*#__PURE__*/createElementVNode("i", { class: "fa fa-plus" }, null, -1 /* HOISTED */);
|
|
5080
5273
|
|
|
5081
5274
|
|
|
5082
|
-
var script$
|
|
5275
|
+
var script$2 = {
|
|
5083
5276
|
__name: 'Departments',
|
|
5084
5277
|
setup(__props) {
|
|
5085
5278
|
|
|
@@ -5102,11 +5295,11 @@ function departmentAdded (response) {
|
|
|
5102
5295
|
|
|
5103
5296
|
return (_ctx, _cache) => {
|
|
5104
5297
|
return (openBlock(), createElementBlock(Fragment, null, [
|
|
5105
|
-
_hoisted_1$
|
|
5106
|
-
createElementVNode("div", _hoisted_2$
|
|
5107
|
-
createElementVNode("div", _hoisted_3$
|
|
5108
|
-
createElementVNode("a", _hoisted_4$
|
|
5109
|
-
_hoisted_5$
|
|
5298
|
+
_hoisted_1$2,
|
|
5299
|
+
createElementVNode("div", _hoisted_2$2, [
|
|
5300
|
+
createElementVNode("div", _hoisted_3$2, [
|
|
5301
|
+
createElementVNode("a", _hoisted_4$2, [
|
|
5302
|
+
_hoisted_5$2,
|
|
5110
5303
|
createTextVNode(" ADD DEPARTMENT")
|
|
5111
5304
|
], 512 /* NEED_PATCH */),
|
|
5112
5305
|
createVNode(script$6, {
|
|
@@ -5117,7 +5310,7 @@ return (_ctx, _cache) => {
|
|
|
5117
5310
|
actions: [
|
|
5118
5311
|
{
|
|
5119
5312
|
label: 'Permissions',
|
|
5120
|
-
path: '/sh-departments/permissions/{id}',
|
|
5313
|
+
path: '/sh-departments/manage-permissions/{id}',
|
|
5121
5314
|
class: 'btn btn-info bi-lock btn-sm'
|
|
5122
5315
|
}
|
|
5123
5316
|
]
|
|
@@ -5145,14 +5338,14 @@ return (_ctx, _cache) => {
|
|
|
5145
5338
|
|
|
5146
5339
|
};
|
|
5147
5340
|
|
|
5148
|
-
script$
|
|
5341
|
+
script$2.__file = "src/lib/components/core/Departments/Departments.vue";
|
|
5149
5342
|
|
|
5150
|
-
const _hoisted_1$
|
|
5343
|
+
const _hoisted_1$1 = {
|
|
5151
5344
|
key: 0,
|
|
5152
5345
|
class: "card sh-department-view shadow"
|
|
5153
5346
|
};
|
|
5154
|
-
const _hoisted_2$
|
|
5155
|
-
const _hoisted_3$
|
|
5347
|
+
const _hoisted_2$1 = { class: "card-body" };
|
|
5348
|
+
const _hoisted_3$1 = /*#__PURE__*/createElementVNode("a", {
|
|
5156
5349
|
href: "#addModule",
|
|
5157
5350
|
class: "btn btn-info btn-sm",
|
|
5158
5351
|
"data-bs-toggle": "modal"
|
|
@@ -5160,11 +5353,11 @@ const _hoisted_3$2 = /*#__PURE__*/createElementVNode("a", {
|
|
|
5160
5353
|
/*#__PURE__*/createElementVNode("i", { class: "bi-plus" }),
|
|
5161
5354
|
/*#__PURE__*/createTextVNode(" ADD Module")
|
|
5162
5355
|
], -1 /* HOISTED */);
|
|
5163
|
-
const _hoisted_4$
|
|
5164
|
-
const _hoisted_5$
|
|
5165
|
-
const _hoisted_6$
|
|
5356
|
+
const _hoisted_4$1 = { class: "text-primary text-capitalize" };
|
|
5357
|
+
const _hoisted_5$1 = ["value"];
|
|
5358
|
+
const _hoisted_6$1 = /*#__PURE__*/createElementVNode("i", { class: "fa fa-save" }, null, -1 /* HOISTED */);
|
|
5166
5359
|
|
|
5167
|
-
var script$
|
|
5360
|
+
var script$1 = {
|
|
5168
5361
|
__name: 'Department',
|
|
5169
5362
|
setup(__props) {
|
|
5170
5363
|
|
|
@@ -5258,9 +5451,9 @@ function submitPermissions() {
|
|
|
5258
5451
|
|
|
5259
5452
|
return (_ctx, _cache) => {
|
|
5260
5453
|
return (unref(department))
|
|
5261
|
-
? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5262
|
-
createElementVNode("div", _hoisted_2$
|
|
5263
|
-
_hoisted_3$
|
|
5454
|
+
? (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
5455
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
5456
|
+
_hoisted_3$1,
|
|
5264
5457
|
createElementVNode("h5", null, "Department #" + toDisplayString(unref(department).id) + " - " + toDisplayString(unref(department).name) + " Allowed Modules", 1 /* TEXT */),
|
|
5265
5458
|
createVNode(script$6, {
|
|
5266
5459
|
actions: {
|
|
@@ -5317,7 +5510,7 @@ return (_ctx, _cache) => {
|
|
|
5317
5510
|
default: withCtx(() => [
|
|
5318
5511
|
(unref(getModule))
|
|
5319
5512
|
? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
5320
|
-
createElementVNode("h5", _hoisted_4$
|
|
5513
|
+
createElementVNode("h5", _hoisted_4$1, "Permissions for " + toDisplayString(unref(getModule).module), 1 /* TEXT */),
|
|
5321
5514
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(modulePermissions), (permission) => {
|
|
5322
5515
|
return (openBlock(), createElementBlock("div", {
|
|
5323
5516
|
key: permission,
|
|
@@ -5330,7 +5523,7 @@ return (_ctx, _cache) => {
|
|
|
5330
5523
|
type: "checkbox",
|
|
5331
5524
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (isRef(selectedPermissions) ? (selectedPermissions).value = $event : selectedPermissions = $event)),
|
|
5332
5525
|
value: permission
|
|
5333
|
-
}, null, 8 /* PROPS */, _hoisted_5$
|
|
5526
|
+
}, null, 8 /* PROPS */, _hoisted_5$1), [
|
|
5334
5527
|
[vModelCheckbox, unref(selectedPermissions)]
|
|
5335
5528
|
]),
|
|
5336
5529
|
createTextVNode(" " + toDisplayString(getPermissionLabel(permission)), 1 /* TEXT */)
|
|
@@ -5341,7 +5534,7 @@ return (_ctx, _cache) => {
|
|
|
5341
5534
|
onClick: submitPermissions,
|
|
5342
5535
|
class: "btn btn-info"
|
|
5343
5536
|
}, [
|
|
5344
|
-
_hoisted_6$
|
|
5537
|
+
_hoisted_6$1,
|
|
5345
5538
|
createTextVNode(" Submit")
|
|
5346
5539
|
])
|
|
5347
5540
|
], 64 /* STABLE_FRAGMENT */))
|
|
@@ -5357,123 +5550,7 @@ return (_ctx, _cache) => {
|
|
|
5357
5550
|
|
|
5358
5551
|
};
|
|
5359
5552
|
|
|
5360
|
-
script$
|
|
5361
|
-
|
|
5362
|
-
const _hoisted_1$1 = { class: "row permissions-main d-flex" };
|
|
5363
|
-
const _hoisted_2$1 = {
|
|
5364
|
-
id: "permissions-nav",
|
|
5365
|
-
class: "col-md-2 shadow d-flex align-items-center"
|
|
5366
|
-
};
|
|
5367
|
-
const _hoisted_3$1 = /*#__PURE__*/createElementVNode("input", { type: "checkbox" }, null, -1 /* HOISTED */);
|
|
5368
|
-
const _hoisted_4$1 = ["onClick"];
|
|
5369
|
-
const _hoisted_5$1 = {
|
|
5370
|
-
id: "permissions-content",
|
|
5371
|
-
class: "col-md-10"
|
|
5372
|
-
};
|
|
5373
|
-
const _hoisted_6$1 = {
|
|
5374
|
-
key: 0,
|
|
5375
|
-
class: "alert alert-info"
|
|
5376
|
-
};
|
|
5377
|
-
const _hoisted_7$1 = {
|
|
5378
|
-
key: 1,
|
|
5379
|
-
class: "d-flex justify-content-evenly"
|
|
5380
|
-
};
|
|
5381
|
-
const _hoisted_8$1 = { class: "col-md-3 list-group" };
|
|
5382
|
-
const _hoisted_9$1 = { class: "p-2 text-capitalize list-group-item pb-0 text-capitalize" };
|
|
5383
|
-
const _hoisted_10 = /*#__PURE__*/createElementVNode("input", { type: "checkbox" }, null, -1 /* HOISTED */);
|
|
5384
|
-
|
|
5385
|
-
var script$1 = {
|
|
5386
|
-
__name: 'ManagePermissions',
|
|
5387
|
-
setup(__props) {
|
|
5388
|
-
|
|
5389
|
-
const route = useRoute();
|
|
5390
|
-
const tabs = ref(null);
|
|
5391
|
-
ref(0);
|
|
5392
|
-
const modules = ref([]);
|
|
5393
|
-
const selectedModule = ref('tasks');
|
|
5394
|
-
const modulePermissions = ref(null);
|
|
5395
|
-
const setModule = module=>{
|
|
5396
|
-
selectedModule.value = module;
|
|
5397
|
-
getModulePermissions();
|
|
5398
|
-
};
|
|
5399
|
-
onMounted(() => {
|
|
5400
|
-
console.log(tabs.value.querySelectorAll('li'));
|
|
5401
|
-
getDepartmentModules();
|
|
5402
|
-
});
|
|
5403
|
-
const getDepartmentModules = ()=>{
|
|
5404
|
-
shApis.doGet(`admin/departments/department/list-modules/${route.params.id}?all=1`).then(res=>{
|
|
5405
|
-
modules.value = res.data.data;
|
|
5406
|
-
selectedModule.value = res.data.data[0];
|
|
5407
|
-
getModulePermissions();
|
|
5408
|
-
});
|
|
5409
|
-
};
|
|
5410
|
-
const loading = ref(false);
|
|
5411
|
-
const getModulePermissions = () => {
|
|
5412
|
-
loading.value = true;
|
|
5413
|
-
modulePermissions.value = null;
|
|
5414
|
-
shApis.doGet(`admin/departments/department/get-module-permissions/${selectedModule.value.module}`).then(res=>{
|
|
5415
|
-
loading.value = false;
|
|
5416
|
-
modulePermissions.value = reformatModulePermissions(res.data.permissions);
|
|
5417
|
-
});
|
|
5418
|
-
};
|
|
5419
|
-
function reformatModulePermissions(mPs){
|
|
5420
|
-
let mpModules = {};
|
|
5421
|
-
mPs.map(mp=>{
|
|
5422
|
-
const arr = mp.split('.');
|
|
5423
|
-
const key = arr[0];
|
|
5424
|
-
if(typeof mpModules[key] == 'undefined'){
|
|
5425
|
-
mpModules[key]=[];
|
|
5426
|
-
}
|
|
5427
|
-
mpModules[key].push(mp);
|
|
5428
|
-
});
|
|
5429
|
-
return mpModules
|
|
5430
|
-
}
|
|
5431
|
-
|
|
5432
|
-
return (_ctx, _cache) => {
|
|
5433
|
-
return (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
5434
|
-
createElementVNode("div", _hoisted_2$1, [
|
|
5435
|
-
createElementVNode("ul", {
|
|
5436
|
-
ref_key: "tabs",
|
|
5437
|
-
ref: tabs,
|
|
5438
|
-
class: "d-flex flex-column w-100"
|
|
5439
|
-
}, [
|
|
5440
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(modules.value, (module) => {
|
|
5441
|
-
return (openBlock(), createElementBlock("li", {
|
|
5442
|
-
class: normalizeClass(selectedModule.value.id === module.id && 'active'),
|
|
5443
|
-
key: module.id
|
|
5444
|
-
}, [
|
|
5445
|
-
_hoisted_3$1,
|
|
5446
|
-
createElementVNode("label", {
|
|
5447
|
-
class: "text-capitalize",
|
|
5448
|
-
onClick: $event => (setModule(module))
|
|
5449
|
-
}, toDisplayString(module.module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_4$1)
|
|
5450
|
-
], 2 /* CLASS */))
|
|
5451
|
-
}), 128 /* KEYED_FRAGMENT */))
|
|
5452
|
-
], 512 /* NEED_PATCH */)
|
|
5453
|
-
]),
|
|
5454
|
-
createElementVNode("div", _hoisted_5$1, [
|
|
5455
|
-
(loading.value)
|
|
5456
|
-
? (openBlock(), createElementBlock("div", _hoisted_6$1, " loading ... "))
|
|
5457
|
-
: (openBlock(), createElementBlock("div", _hoisted_7$1, [
|
|
5458
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(modulePermissions.value, (permissions) => {
|
|
5459
|
-
return (openBlock(), createElementBlock("div", _hoisted_8$1, [
|
|
5460
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(permissions, (permission) => {
|
|
5461
|
-
return (openBlock(), createElementBlock("label", _hoisted_9$1, [
|
|
5462
|
-
_hoisted_10,
|
|
5463
|
-
createTextVNode(" " + toDisplayString(permission), 1 /* TEXT */)
|
|
5464
|
-
]))
|
|
5465
|
-
}), 256 /* UNKEYED_FRAGMENT */))
|
|
5466
|
-
]))
|
|
5467
|
-
}), 256 /* UNKEYED_FRAGMENT */))
|
|
5468
|
-
]))
|
|
5469
|
-
])
|
|
5470
|
-
]))
|
|
5471
|
-
}
|
|
5472
|
-
}
|
|
5473
|
-
|
|
5474
|
-
};
|
|
5475
|
-
|
|
5476
|
-
script$1.__file = "src/lib/components/core/Departments/department/ManagePermissions.vue";
|
|
5553
|
+
script$1.__file = "src/lib/components/core/Departments/department/Department.vue";
|
|
5477
5554
|
|
|
5478
5555
|
const _withScopeId = n => (pushScopeId("data-v-2911509a"),n=n(),popScopeId(),n);
|
|
5479
5556
|
const _hoisted_1 = {
|
|
@@ -5637,15 +5714,15 @@ const ShFrontend = {
|
|
|
5637
5714
|
});
|
|
5638
5715
|
options.router.addRoute({
|
|
5639
5716
|
path: '/sh-departments',
|
|
5640
|
-
component: script$
|
|
5717
|
+
component: script$2
|
|
5641
5718
|
});
|
|
5642
5719
|
options.router.addRoute({
|
|
5643
5720
|
path: '/sh-departments/permissions/:id',
|
|
5644
|
-
component: script$
|
|
5721
|
+
component: script$1
|
|
5645
5722
|
});
|
|
5646
5723
|
options.router.addRoute({
|
|
5647
5724
|
path: '/sh-departments/manage-permissions/:id',
|
|
5648
|
-
component: script$
|
|
5725
|
+
component: script$3
|
|
5649
5726
|
});
|
|
5650
5727
|
}
|
|
5651
5728
|
//filter unwanted config items from options to be put in local storage
|
|
@@ -5657,4 +5734,4 @@ const ShFrontend = {
|
|
|
5657
5734
|
}
|
|
5658
5735
|
};
|
|
5659
5736
|
|
|
5660
|
-
export { countries as Countries, script$e as ShAutoForm, script$a as ShCanvas, script$8 as ShConfirmAction, script$d as ShDropDownForm, script$4 as ShDynamicTabs, script$l as ShForm, ShFrontend, script$c as ShModal, script$b as ShModalForm, script$o as ShPhone, script$7 as ShSilentAction, script$6 as ShTable, script$5 as ShTabs, shApis, shRepo, ShStorage as shStorage, useUserStore };
|
|
5737
|
+
export { countries as Countries, script$3 as ManagePermissions, script$e as ShAutoForm, script$a as ShCanvas, script$8 as ShConfirmAction, script$d as ShDropDownForm, script$4 as ShDynamicTabs, script$l as ShForm, ShFrontend, script$c as ShModal, script$b as ShModalForm, script$o as ShPhone, script$7 as ShSilentAction, script$6 as ShTable, script$5 as ShTabs, shApis, shRepo, ShStorage as shStorage, useUserStore };
|