@iankibetsh/shframework 1.4.4 → 1.4.6
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 +74 -42
- package/dist/library.js +242 -181
- package/dist/library.mjs +243 -183
- 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;
|
|
@@ -2379,18 +2379,8 @@ var script$l = {
|
|
|
2379
2379
|
closeModal: function () {
|
|
2380
2380
|
document.body.style = '';
|
|
2381
2381
|
setTimeout(() => {
|
|
2382
|
-
const
|
|
2383
|
-
|
|
2384
|
-
const modal = form.closest('.modal.show');
|
|
2385
|
-
if (modal) {
|
|
2386
|
-
modal.click();
|
|
2387
|
-
}
|
|
2388
|
-
} else {
|
|
2389
|
-
const backdrops = document.getElementsByClassName('modal-backdrop fade show');
|
|
2390
|
-
if (backdrops.length > 0) {
|
|
2391
|
-
backdrops[0].remove();
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2382
|
+
const closeBtn = this.$refs.ShAutoForm.closest('.modal-dialog').querySelector('[data-bs-dismiss="modal"]');
|
|
2383
|
+
closeBtn && closeBtn.click();
|
|
2394
2384
|
this.form_status = 0;
|
|
2395
2385
|
}, 1500);
|
|
2396
2386
|
},
|
|
@@ -2552,10 +2542,10 @@ const _hoisted_7$5 = { class: "row" };
|
|
|
2552
2542
|
const _hoisted_8$3 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
|
|
2553
2543
|
const _hoisted_9$4 = { class: "col-md-12" };
|
|
2554
2544
|
const _hoisted_10$3 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
|
|
2555
|
-
const _hoisted_11$
|
|
2556
|
-
const _hoisted_12$
|
|
2557
|
-
const _hoisted_13$
|
|
2558
|
-
const _hoisted_14$
|
|
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"];
|
|
2559
2549
|
const _hoisted_15$2 = ["disabled", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
|
|
2560
2550
|
const _hoisted_16$2 = ["name", "onFocus", "onUpdate:modelValue"];
|
|
2561
2551
|
const _hoisted_17$2 = ["name", "onFocus", "onUpdate:modelValue"];
|
|
@@ -2660,7 +2650,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2660
2650
|
class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
|
|
2661
2651
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
|
|
2662
2652
|
type: "number"
|
|
2663
|
-
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11$
|
|
2653
|
+
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11$3)), [
|
|
2664
2654
|
[vModelText, _ctx.form_elements[field]]
|
|
2665
2655
|
])
|
|
2666
2656
|
: createCommentVNode("v-if", true),
|
|
@@ -2674,7 +2664,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2674
2664
|
class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
|
|
2675
2665
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
|
|
2676
2666
|
type: "password"
|
|
2677
|
-
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_12$
|
|
2667
|
+
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_12$3)), [
|
|
2678
2668
|
[vModelText, _ctx.form_elements[field]]
|
|
2679
2669
|
])
|
|
2680
2670
|
: createCommentVNode("v-if", true),
|
|
@@ -2689,7 +2679,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2689
2679
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
|
|
2690
2680
|
type: "email",
|
|
2691
2681
|
required: ""
|
|
2692
|
-
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_13$
|
|
2682
|
+
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_13$3)), [
|
|
2693
2683
|
[vModelText, _ctx.form_elements[field]]
|
|
2694
2684
|
])
|
|
2695
2685
|
: createCommentVNode("v-if", true),
|
|
@@ -2702,7 +2692,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2702
2692
|
onFocus: $event => ($options.removeErrors(field)),
|
|
2703
2693
|
class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control active"]),
|
|
2704
2694
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
|
|
2705
|
-
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_14$
|
|
2695
|
+
}, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_14$3)), [
|
|
2706
2696
|
[vModelText, _ctx.form_elements[field]]
|
|
2707
2697
|
])
|
|
2708
2698
|
: createCommentVNode("v-if", true),
|
|
@@ -3613,16 +3603,16 @@ const _hoisted_9$3 = [
|
|
|
3613
3603
|
_hoisted_4$6
|
|
3614
3604
|
];
|
|
3615
3605
|
const _hoisted_10$2 = { class: "record_counts" };
|
|
3616
|
-
const _hoisted_11$
|
|
3606
|
+
const _hoisted_11$2 = {
|
|
3617
3607
|
key: 0,
|
|
3618
3608
|
"aria-label": "Page navigation"
|
|
3619
3609
|
};
|
|
3620
|
-
const _hoisted_12$
|
|
3621
|
-
const _hoisted_13$
|
|
3610
|
+
const _hoisted_12$2 = { class: "pagination" };
|
|
3611
|
+
const _hoisted_13$2 = {
|
|
3622
3612
|
key: 0,
|
|
3623
3613
|
class: "page-link"
|
|
3624
3614
|
};
|
|
3625
|
-
const _hoisted_14$
|
|
3615
|
+
const _hoisted_14$2 = {
|
|
3626
3616
|
key: 1,
|
|
3627
3617
|
class: "page-link"
|
|
3628
3618
|
};
|
|
@@ -3665,8 +3655,8 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3665
3655
|
createElementVNode("span", _hoisted_10$2, " of " + toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
|
|
3666
3656
|
]),
|
|
3667
3657
|
($props.pagination_data != null)
|
|
3668
|
-
? (openBlock(), createElementBlock("nav", _hoisted_11$
|
|
3669
|
-
createElementVNode("ul", _hoisted_12$
|
|
3658
|
+
? (openBlock(), createElementBlock("nav", _hoisted_11$2, [
|
|
3659
|
+
createElementVNode("ul", _hoisted_12$2, [
|
|
3670
3660
|
createElementVNode("li", {
|
|
3671
3661
|
class: normalizeClass([$options.getActivePage === 1 ? 'disabled' : '' , "page-item"])
|
|
3672
3662
|
}, [
|
|
@@ -3681,9 +3671,9 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3681
3671
|
key: page
|
|
3682
3672
|
}, [
|
|
3683
3673
|
($options.getActivePage === page)
|
|
3684
|
-
? (openBlock(), createElementBlock("a", _hoisted_13$
|
|
3674
|
+
? (openBlock(), createElementBlock("a", _hoisted_13$2, toDisplayString(page), 1 /* TEXT */))
|
|
3685
3675
|
: (['..','...'].includes(page))
|
|
3686
|
-
? (openBlock(), createElementBlock("a", _hoisted_14$
|
|
3676
|
+
? (openBlock(), createElementBlock("a", _hoisted_14$2, toDisplayString(page), 1 /* TEXT */))
|
|
3687
3677
|
: (openBlock(), createElementBlock("a", {
|
|
3688
3678
|
key: 2,
|
|
3689
3679
|
onClick: $event => ($options.changeTableKey('page',page)),
|
|
@@ -4190,20 +4180,20 @@ const _hoisted_7$2 = {
|
|
|
4190
4180
|
const _hoisted_8$2 = { class: "col-12 mb-3" };
|
|
4191
4181
|
const _hoisted_9$2 = { class: "sh-search-bar" };
|
|
4192
4182
|
const _hoisted_10$1 = ["placeholder"];
|
|
4193
|
-
const _hoisted_11 = {
|
|
4183
|
+
const _hoisted_11$1 = {
|
|
4194
4184
|
key: 0,
|
|
4195
4185
|
class: "text-center"
|
|
4196
4186
|
};
|
|
4197
|
-
const _hoisted_12 = /*#__PURE__*/createElementVNode("div", {
|
|
4187
|
+
const _hoisted_12$1 = /*#__PURE__*/createElementVNode("div", {
|
|
4198
4188
|
class: "spinner-border",
|
|
4199
4189
|
role: "status"
|
|
4200
4190
|
}, [
|
|
4201
4191
|
/*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...")
|
|
4202
4192
|
], -1 /* HOISTED */);
|
|
4203
|
-
const _hoisted_13 = [
|
|
4204
|
-
_hoisted_12
|
|
4193
|
+
const _hoisted_13$1 = [
|
|
4194
|
+
_hoisted_12$1
|
|
4205
4195
|
];
|
|
4206
|
-
const _hoisted_14 = {
|
|
4196
|
+
const _hoisted_14$1 = {
|
|
4207
4197
|
key: 1,
|
|
4208
4198
|
class: "alert alert-danger"
|
|
4209
4199
|
};
|
|
@@ -4373,9 +4363,9 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4373
4363
|
($options.hasDefaultSlot)
|
|
4374
4364
|
? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
4375
4365
|
($data.loading === 'loading')
|
|
4376
|
-
? (openBlock(), createElementBlock("div", _hoisted_11, _hoisted_13))
|
|
4366
|
+
? (openBlock(), createElementBlock("div", _hoisted_11$1, _hoisted_13$1))
|
|
4377
4367
|
: ($data.loading === 'error')
|
|
4378
|
-
? (openBlock(), createElementBlock("div", _hoisted_14, [
|
|
4368
|
+
? (openBlock(), createElementBlock("div", _hoisted_14$1, [
|
|
4379
4369
|
createElementVNode("span", _hoisted_15, toDisplayString($data.loading_error), 1 /* TEXT */)
|
|
4380
4370
|
]))
|
|
4381
4371
|
: createCommentVNode("v-if", true),
|
|
@@ -4981,6 +4971,192 @@ return (_ctx, _cache) => {
|
|
|
4981
4971
|
|
|
4982
4972
|
script$4.__file = "src/lib/components/ShDynamicTabs.vue";
|
|
4983
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-2 d-flex align-items-center py-4"
|
|
4979
|
+
};
|
|
4980
|
+
const _hoisted_3$3 = ["disabled", "checked"];
|
|
4981
|
+
const _hoisted_4$3 = ["onClick"];
|
|
4982
|
+
const _hoisted_5$3 = {
|
|
4983
|
+
id: "permissions-content",
|
|
4984
|
+
class: "col-md-10 py-4 pe-4 ps-0"
|
|
4985
|
+
};
|
|
4986
|
+
const _hoisted_6$2 = { class: "p-2 rounded-2 bg-white h-100" };
|
|
4987
|
+
const _hoisted_7$1 = {
|
|
4988
|
+
key: 0,
|
|
4989
|
+
class: "alert alert-info"
|
|
4990
|
+
};
|
|
4991
|
+
const _hoisted_8$1 = { key: 1 };
|
|
4992
|
+
const _hoisted_9$1 = { class: "row row-cols-4" };
|
|
4993
|
+
const _hoisted_10 = { class: "col py-3" };
|
|
4994
|
+
const _hoisted_11 = ["value"];
|
|
4995
|
+
const _hoisted_12 = {
|
|
4996
|
+
key: 0,
|
|
4997
|
+
class: "w-100 row"
|
|
4998
|
+
};
|
|
4999
|
+
const _hoisted_13 = { class: "col-md-3" };
|
|
5000
|
+
const _hoisted_14 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
|
|
5001
|
+
|
|
5002
|
+
var script$3 = {
|
|
5003
|
+
__name: 'ManagePermissions',
|
|
5004
|
+
setup(__props) {
|
|
5005
|
+
|
|
5006
|
+
const route = useRoute();
|
|
5007
|
+
const modules = ref([]);
|
|
5008
|
+
const selectedModule = ref('tasks');
|
|
5009
|
+
const modulePermissions = ref(null);
|
|
5010
|
+
|
|
5011
|
+
const selectedPermissions = ref([]);
|
|
5012
|
+
const permissionsChanged = ref(false);
|
|
5013
|
+
const departmentId = route.params.id;
|
|
5014
|
+
const setModule = module=>{
|
|
5015
|
+
(selectedModule.value !== module) && (selectedModule.value = module) && getModulePermissions();
|
|
5016
|
+
};
|
|
5017
|
+
onMounted(() => {
|
|
5018
|
+
getDepartmentModules();
|
|
5019
|
+
});
|
|
5020
|
+
const getDepartmentModules = ()=>{
|
|
5021
|
+
shApis.doGet(`admin/departments/department/list-all-modules/admin`).then(res=>{
|
|
5022
|
+
modules.value = res.data.modules;
|
|
5023
|
+
selectedModule.value = res.data.modules[0];
|
|
5024
|
+
getModulePermissions();
|
|
5025
|
+
});
|
|
5026
|
+
};
|
|
5027
|
+
const loading = ref(false);
|
|
5028
|
+
const getModulePermissions = () => {
|
|
5029
|
+
loading.value = true;
|
|
5030
|
+
modulePermissions.value = null;
|
|
5031
|
+
shApis.doGet(`admin/departments/department/get-module-permissions/${selectedModule.value}?department_id=${departmentId}`).then(res=>{
|
|
5032
|
+
loading.value = false;
|
|
5033
|
+
modulePermissions.value = reformatModulePermissions(res.data.permissions);
|
|
5034
|
+
selectedPermissions.value = res.data.selectedPermissions ?? [];
|
|
5035
|
+
permissionsChanged.value = false;
|
|
5036
|
+
});
|
|
5037
|
+
};
|
|
5038
|
+
function reformatModulePermissions(mPs){
|
|
5039
|
+
let mpModules = {};
|
|
5040
|
+
mPs.map(mp=>{
|
|
5041
|
+
const arr = mp.split('.');
|
|
5042
|
+
const key = arr[0];
|
|
5043
|
+
if(typeof mpModules[key] == 'undefined'){
|
|
5044
|
+
mpModules[key]=[];
|
|
5045
|
+
}
|
|
5046
|
+
mpModules[key].push(mp);
|
|
5047
|
+
});
|
|
5048
|
+
return mpModules
|
|
5049
|
+
}
|
|
5050
|
+
const setPermissionsChanged = ()=>{
|
|
5051
|
+
permissionsChanged.value = true;
|
|
5052
|
+
return true
|
|
5053
|
+
};
|
|
5054
|
+
const checkAllPermissions = ()=>{
|
|
5055
|
+
if(selectedPermissions.value.length > 0) {
|
|
5056
|
+
selectedPermissions.value = [];
|
|
5057
|
+
} else {
|
|
5058
|
+
console.log(modulePermissions.value);
|
|
5059
|
+
const all = modulePermissions.value;
|
|
5060
|
+
Object.keys(all).map(key=>{
|
|
5061
|
+
all[key].map(permission=>{
|
|
5062
|
+
selectedPermissions.value.push(permission);
|
|
5063
|
+
});
|
|
5064
|
+
});
|
|
5065
|
+
}
|
|
5066
|
+
permissionsChanged.value = true;
|
|
5067
|
+
};
|
|
5068
|
+
const getLabel = permission => {
|
|
5069
|
+
const arr = permission.split('.');
|
|
5070
|
+
return arr[arr.length - 1].replaceAll('_',' ')
|
|
5071
|
+
};
|
|
5072
|
+
const getPermissionStyle = permission => {
|
|
5073
|
+
return {
|
|
5074
|
+
paddingLeft: `${(permission.split('.').length-1) * 20}px`
|
|
5075
|
+
}
|
|
5076
|
+
};
|
|
5077
|
+
|
|
5078
|
+
return (_ctx, _cache) => {
|
|
5079
|
+
return (openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
5080
|
+
createElementVNode("div", _hoisted_2$3, [
|
|
5081
|
+
(openBlock(), createElementBlock("ul", {
|
|
5082
|
+
class: "d-flex flex-column w-100 ps-2",
|
|
5083
|
+
key: selectedModule.value ? selectedModule.value:0
|
|
5084
|
+
}, [
|
|
5085
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(modules.value, (module) => {
|
|
5086
|
+
return (openBlock(), createElementBlock("li", {
|
|
5087
|
+
class: normalizeClass(selectedModule.value === module && 'active'),
|
|
5088
|
+
key: selectedModule.value
|
|
5089
|
+
}, [
|
|
5090
|
+
createElementVNode("input", {
|
|
5091
|
+
onClick: _cache[0] || (_cache[0] = $event => (checkAllPermissions())),
|
|
5092
|
+
disabled: selectedModule.value !== module,
|
|
5093
|
+
checked: selectedPermissions.value.length > 0 && selectedModule.value === module,
|
|
5094
|
+
type: "checkbox"
|
|
5095
|
+
}, null, 8 /* PROPS */, _hoisted_3$3),
|
|
5096
|
+
createElementVNode("label", {
|
|
5097
|
+
class: "text-capitalize",
|
|
5098
|
+
onClick: $event => (setModule(module))
|
|
5099
|
+
}, toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_4$3)
|
|
5100
|
+
], 2 /* CLASS */))
|
|
5101
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
5102
|
+
]))
|
|
5103
|
+
]),
|
|
5104
|
+
createElementVNode("div", _hoisted_5$3, [
|
|
5105
|
+
createElementVNode("div", _hoisted_6$2, [
|
|
5106
|
+
(loading.value)
|
|
5107
|
+
? (openBlock(), createElementBlock("div", _hoisted_7$1, " loading ... "))
|
|
5108
|
+
: (openBlock(), createElementBlock("div", _hoisted_8$1, [
|
|
5109
|
+
createElementVNode("div", _hoisted_9$1, [
|
|
5110
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(modulePermissions.value, (permissions) => {
|
|
5111
|
+
return (openBlock(), createElementBlock("div", _hoisted_10, [
|
|
5112
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(permissions, (permission) => {
|
|
5113
|
+
return (openBlock(), createElementBlock("label", {
|
|
5114
|
+
onClick: setPermissionsChanged,
|
|
5115
|
+
class: "text-capitalize list-group-item pb-1 text-capitalize",
|
|
5116
|
+
style: normalizeStyle(getPermissionStyle(permission))
|
|
5117
|
+
}, [
|
|
5118
|
+
withDirectives(createElementVNode("input", {
|
|
5119
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((selectedPermissions).value = $event)),
|
|
5120
|
+
value: permission,
|
|
5121
|
+
type: "checkbox"
|
|
5122
|
+
}, null, 8 /* PROPS */, _hoisted_11), [
|
|
5123
|
+
[vModelCheckbox, selectedPermissions.value]
|
|
5124
|
+
]),
|
|
5125
|
+
createTextVNode(" " + toDisplayString(getLabel(permission)), 1 /* TEXT */)
|
|
5126
|
+
], 4 /* STYLE */))
|
|
5127
|
+
}), 256 /* UNKEYED_FRAGMENT */))
|
|
5128
|
+
]))
|
|
5129
|
+
}), 256 /* UNKEYED_FRAGMENT */))
|
|
5130
|
+
]),
|
|
5131
|
+
(permissionsChanged.value)
|
|
5132
|
+
? (openBlock(), createElementBlock("div", _hoisted_12, [
|
|
5133
|
+
createElementVNode("div", _hoisted_13, [
|
|
5134
|
+
createVNode(script$8, {
|
|
5135
|
+
url: `admin/departments/department/permissions/${unref(departmentId)}/${selectedModule.value}`,
|
|
5136
|
+
data: {permissions: selectedPermissions.value},
|
|
5137
|
+
class: "btn btn-primary d-block"
|
|
5138
|
+
}, {
|
|
5139
|
+
default: withCtx(() => [
|
|
5140
|
+
_hoisted_14,
|
|
5141
|
+
createTextVNode(" Save")
|
|
5142
|
+
]),
|
|
5143
|
+
_: 1 /* STABLE */
|
|
5144
|
+
}, 8 /* PROPS */, ["url", "data"])
|
|
5145
|
+
])
|
|
5146
|
+
]))
|
|
5147
|
+
: createCommentVNode("v-if", true)
|
|
5148
|
+
]))
|
|
5149
|
+
])
|
|
5150
|
+
])
|
|
5151
|
+
]))
|
|
5152
|
+
}
|
|
5153
|
+
}
|
|
5154
|
+
|
|
5155
|
+
};
|
|
5156
|
+
|
|
5157
|
+
script$3.__scopeId = "data-v-0d4fa0ac";
|
|
5158
|
+
script$3.__file = "src/lib/components/core/Departments/department/ManagePermissions.vue";
|
|
5159
|
+
|
|
4984
5160
|
const useUserStore = defineStore('user-store', {
|
|
4985
5161
|
state: () => ({
|
|
4986
5162
|
user: null,
|
|
@@ -5077,19 +5253,19 @@ const useUserStore = defineStore('user-store', {
|
|
|
5077
5253
|
}
|
|
5078
5254
|
});
|
|
5079
5255
|
|
|
5080
|
-
const _hoisted_1$
|
|
5081
|
-
const _hoisted_2$
|
|
5082
|
-
const _hoisted_3$
|
|
5083
|
-
const _hoisted_4$
|
|
5256
|
+
const _hoisted_1$2 = /*#__PURE__*/createElementVNode("h5", null, "Departments", -1 /* HOISTED */);
|
|
5257
|
+
const _hoisted_2$2 = { class: "card sh-departments-card shadow" };
|
|
5258
|
+
const _hoisted_3$2 = { class: "card-body" };
|
|
5259
|
+
const _hoisted_4$2 = {
|
|
5084
5260
|
"data-bs-toggle": "modal",
|
|
5085
5261
|
ref: "addDeptBtn",
|
|
5086
5262
|
href: "#sh-department_modal",
|
|
5087
5263
|
class: "btn btn-info btn-sm"
|
|
5088
5264
|
};
|
|
5089
|
-
const _hoisted_5$
|
|
5265
|
+
const _hoisted_5$2 = /*#__PURE__*/createElementVNode("i", { class: "fa fa-plus" }, null, -1 /* HOISTED */);
|
|
5090
5266
|
|
|
5091
5267
|
|
|
5092
|
-
var script$
|
|
5268
|
+
var script$2 = {
|
|
5093
5269
|
__name: 'Departments',
|
|
5094
5270
|
setup(__props) {
|
|
5095
5271
|
|
|
@@ -5112,11 +5288,11 @@ function departmentAdded (response) {
|
|
|
5112
5288
|
|
|
5113
5289
|
return (_ctx, _cache) => {
|
|
5114
5290
|
return (openBlock(), createElementBlock(Fragment, null, [
|
|
5115
|
-
_hoisted_1$
|
|
5116
|
-
createElementVNode("div", _hoisted_2$
|
|
5117
|
-
createElementVNode("div", _hoisted_3$
|
|
5118
|
-
createElementVNode("a", _hoisted_4$
|
|
5119
|
-
_hoisted_5$
|
|
5291
|
+
_hoisted_1$2,
|
|
5292
|
+
createElementVNode("div", _hoisted_2$2, [
|
|
5293
|
+
createElementVNode("div", _hoisted_3$2, [
|
|
5294
|
+
createElementVNode("a", _hoisted_4$2, [
|
|
5295
|
+
_hoisted_5$2,
|
|
5120
5296
|
createTextVNode(" ADD DEPARTMENT")
|
|
5121
5297
|
], 512 /* NEED_PATCH */),
|
|
5122
5298
|
createVNode(script$6, {
|
|
@@ -5155,14 +5331,14 @@ return (_ctx, _cache) => {
|
|
|
5155
5331
|
|
|
5156
5332
|
};
|
|
5157
5333
|
|
|
5158
|
-
script$
|
|
5334
|
+
script$2.__file = "src/lib/components/core/Departments/Departments.vue";
|
|
5159
5335
|
|
|
5160
|
-
const _hoisted_1$
|
|
5336
|
+
const _hoisted_1$1 = {
|
|
5161
5337
|
key: 0,
|
|
5162
5338
|
class: "card sh-department-view shadow"
|
|
5163
5339
|
};
|
|
5164
|
-
const _hoisted_2$
|
|
5165
|
-
const _hoisted_3$
|
|
5340
|
+
const _hoisted_2$1 = { class: "card-body" };
|
|
5341
|
+
const _hoisted_3$1 = /*#__PURE__*/createElementVNode("a", {
|
|
5166
5342
|
href: "#addModule",
|
|
5167
5343
|
class: "btn btn-info btn-sm",
|
|
5168
5344
|
"data-bs-toggle": "modal"
|
|
@@ -5170,11 +5346,11 @@ const _hoisted_3$2 = /*#__PURE__*/createElementVNode("a", {
|
|
|
5170
5346
|
/*#__PURE__*/createElementVNode("i", { class: "bi-plus" }),
|
|
5171
5347
|
/*#__PURE__*/createTextVNode(" ADD Module")
|
|
5172
5348
|
], -1 /* HOISTED */);
|
|
5173
|
-
const _hoisted_4$
|
|
5174
|
-
const _hoisted_5$
|
|
5175
|
-
const _hoisted_6$
|
|
5349
|
+
const _hoisted_4$1 = { class: "text-primary text-capitalize" };
|
|
5350
|
+
const _hoisted_5$1 = ["value"];
|
|
5351
|
+
const _hoisted_6$1 = /*#__PURE__*/createElementVNode("i", { class: "fa fa-save" }, null, -1 /* HOISTED */);
|
|
5176
5352
|
|
|
5177
|
-
var script$
|
|
5353
|
+
var script$1 = {
|
|
5178
5354
|
__name: 'Department',
|
|
5179
5355
|
setup(__props) {
|
|
5180
5356
|
|
|
@@ -5268,9 +5444,9 @@ function submitPermissions() {
|
|
|
5268
5444
|
|
|
5269
5445
|
return (_ctx, _cache) => {
|
|
5270
5446
|
return (unref(department))
|
|
5271
|
-
? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5272
|
-
createElementVNode("div", _hoisted_2$
|
|
5273
|
-
_hoisted_3$
|
|
5447
|
+
? (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
5448
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
5449
|
+
_hoisted_3$1,
|
|
5274
5450
|
createElementVNode("h5", null, "Department #" + toDisplayString(unref(department).id) + " - " + toDisplayString(unref(department).name) + " Allowed Modules", 1 /* TEXT */),
|
|
5275
5451
|
createVNode(script$6, {
|
|
5276
5452
|
actions: {
|
|
@@ -5327,7 +5503,7 @@ return (_ctx, _cache) => {
|
|
|
5327
5503
|
default: withCtx(() => [
|
|
5328
5504
|
(unref(getModule))
|
|
5329
5505
|
? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
5330
|
-
createElementVNode("h5", _hoisted_4$
|
|
5506
|
+
createElementVNode("h5", _hoisted_4$1, "Permissions for " + toDisplayString(unref(getModule).module), 1 /* TEXT */),
|
|
5331
5507
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(modulePermissions), (permission) => {
|
|
5332
5508
|
return (openBlock(), createElementBlock("div", {
|
|
5333
5509
|
key: permission,
|
|
@@ -5340,7 +5516,7 @@ return (_ctx, _cache) => {
|
|
|
5340
5516
|
type: "checkbox",
|
|
5341
5517
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (isRef(selectedPermissions) ? (selectedPermissions).value = $event : selectedPermissions = $event)),
|
|
5342
5518
|
value: permission
|
|
5343
|
-
}, null, 8 /* PROPS */, _hoisted_5$
|
|
5519
|
+
}, null, 8 /* PROPS */, _hoisted_5$1), [
|
|
5344
5520
|
[vModelCheckbox, unref(selectedPermissions)]
|
|
5345
5521
|
]),
|
|
5346
5522
|
createTextVNode(" " + toDisplayString(getPermissionLabel(permission)), 1 /* TEXT */)
|
|
@@ -5351,7 +5527,7 @@ return (_ctx, _cache) => {
|
|
|
5351
5527
|
onClick: submitPermissions,
|
|
5352
5528
|
class: "btn btn-info"
|
|
5353
5529
|
}, [
|
|
5354
|
-
_hoisted_6$
|
|
5530
|
+
_hoisted_6$1,
|
|
5355
5531
|
createTextVNode(" Submit")
|
|
5356
5532
|
])
|
|
5357
5533
|
], 64 /* STABLE_FRAGMENT */))
|
|
@@ -5367,123 +5543,7 @@ return (_ctx, _cache) => {
|
|
|
5367
5543
|
|
|
5368
5544
|
};
|
|
5369
5545
|
|
|
5370
|
-
script$
|
|
5371
|
-
|
|
5372
|
-
const _hoisted_1$1 = { class: "row permissions-main d-flex" };
|
|
5373
|
-
const _hoisted_2$1 = {
|
|
5374
|
-
id: "permissions-nav",
|
|
5375
|
-
class: "col-md-2 shadow d-flex align-items-center"
|
|
5376
|
-
};
|
|
5377
|
-
const _hoisted_3$1 = /*#__PURE__*/createElementVNode("input", { type: "checkbox" }, null, -1 /* HOISTED */);
|
|
5378
|
-
const _hoisted_4$1 = ["onClick"];
|
|
5379
|
-
const _hoisted_5$1 = {
|
|
5380
|
-
id: "permissions-content",
|
|
5381
|
-
class: "col-md-10"
|
|
5382
|
-
};
|
|
5383
|
-
const _hoisted_6$1 = {
|
|
5384
|
-
key: 0,
|
|
5385
|
-
class: "alert alert-info"
|
|
5386
|
-
};
|
|
5387
|
-
const _hoisted_7$1 = {
|
|
5388
|
-
key: 1,
|
|
5389
|
-
class: "d-flex justify-content-evenly"
|
|
5390
|
-
};
|
|
5391
|
-
const _hoisted_8$1 = { class: "col-md-3 list-group" };
|
|
5392
|
-
const _hoisted_9$1 = { class: "p-2 text-capitalize list-group-item pb-0 text-capitalize" };
|
|
5393
|
-
const _hoisted_10 = /*#__PURE__*/createElementVNode("input", { type: "checkbox" }, null, -1 /* HOISTED */);
|
|
5394
|
-
|
|
5395
|
-
var script$1 = {
|
|
5396
|
-
__name: 'ManagePermissions',
|
|
5397
|
-
setup(__props) {
|
|
5398
|
-
|
|
5399
|
-
const route = useRoute();
|
|
5400
|
-
const tabs = ref(null);
|
|
5401
|
-
ref(0);
|
|
5402
|
-
const modules = ref([]);
|
|
5403
|
-
const selectedModule = ref('tasks');
|
|
5404
|
-
const modulePermissions = ref(null);
|
|
5405
|
-
const setModule = module=>{
|
|
5406
|
-
selectedModule.value = module;
|
|
5407
|
-
getModulePermissions();
|
|
5408
|
-
};
|
|
5409
|
-
onMounted(() => {
|
|
5410
|
-
console.log(tabs.value.querySelectorAll('li'));
|
|
5411
|
-
getDepartmentModules();
|
|
5412
|
-
});
|
|
5413
|
-
const getDepartmentModules = ()=>{
|
|
5414
|
-
shApis.doGet(`admin/departments/department/list-modules/${route.params.id}?all=1`).then(res=>{
|
|
5415
|
-
modules.value = res.data.data;
|
|
5416
|
-
selectedModule.value = res.data.data[0];
|
|
5417
|
-
getModulePermissions();
|
|
5418
|
-
});
|
|
5419
|
-
};
|
|
5420
|
-
const loading = ref(false);
|
|
5421
|
-
const getModulePermissions = () => {
|
|
5422
|
-
loading.value = true;
|
|
5423
|
-
modulePermissions.value = null;
|
|
5424
|
-
shApis.doGet(`admin/departments/department/get-module-permissions/${selectedModule.value.module}`).then(res=>{
|
|
5425
|
-
loading.value = false;
|
|
5426
|
-
modulePermissions.value = reformatModulePermissions(res.data.permissions);
|
|
5427
|
-
});
|
|
5428
|
-
};
|
|
5429
|
-
function reformatModulePermissions(mPs){
|
|
5430
|
-
let mpModules = {};
|
|
5431
|
-
mPs.map(mp=>{
|
|
5432
|
-
const arr = mp.split('.');
|
|
5433
|
-
const key = arr[0];
|
|
5434
|
-
if(typeof mpModules[key] == 'undefined'){
|
|
5435
|
-
mpModules[key]=[];
|
|
5436
|
-
}
|
|
5437
|
-
mpModules[key].push(mp);
|
|
5438
|
-
});
|
|
5439
|
-
return mpModules
|
|
5440
|
-
}
|
|
5441
|
-
|
|
5442
|
-
return (_ctx, _cache) => {
|
|
5443
|
-
return (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
5444
|
-
createElementVNode("div", _hoisted_2$1, [
|
|
5445
|
-
createElementVNode("ul", {
|
|
5446
|
-
ref_key: "tabs",
|
|
5447
|
-
ref: tabs,
|
|
5448
|
-
class: "d-flex flex-column w-100"
|
|
5449
|
-
}, [
|
|
5450
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(modules.value, (module) => {
|
|
5451
|
-
return (openBlock(), createElementBlock("li", {
|
|
5452
|
-
class: normalizeClass(selectedModule.value.id === module.id && 'active'),
|
|
5453
|
-
key: module.id
|
|
5454
|
-
}, [
|
|
5455
|
-
_hoisted_3$1,
|
|
5456
|
-
createElementVNode("label", {
|
|
5457
|
-
class: "text-capitalize",
|
|
5458
|
-
onClick: $event => (setModule(module))
|
|
5459
|
-
}, toDisplayString(module.module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_4$1)
|
|
5460
|
-
], 2 /* CLASS */))
|
|
5461
|
-
}), 128 /* KEYED_FRAGMENT */))
|
|
5462
|
-
], 512 /* NEED_PATCH */)
|
|
5463
|
-
]),
|
|
5464
|
-
createElementVNode("div", _hoisted_5$1, [
|
|
5465
|
-
(loading.value)
|
|
5466
|
-
? (openBlock(), createElementBlock("div", _hoisted_6$1, " loading ... "))
|
|
5467
|
-
: (openBlock(), createElementBlock("div", _hoisted_7$1, [
|
|
5468
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(modulePermissions.value, (permissions) => {
|
|
5469
|
-
return (openBlock(), createElementBlock("div", _hoisted_8$1, [
|
|
5470
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(permissions, (permission) => {
|
|
5471
|
-
return (openBlock(), createElementBlock("label", _hoisted_9$1, [
|
|
5472
|
-
_hoisted_10,
|
|
5473
|
-
createTextVNode(" " + toDisplayString(permission), 1 /* TEXT */)
|
|
5474
|
-
]))
|
|
5475
|
-
}), 256 /* UNKEYED_FRAGMENT */))
|
|
5476
|
-
]))
|
|
5477
|
-
}), 256 /* UNKEYED_FRAGMENT */))
|
|
5478
|
-
]))
|
|
5479
|
-
])
|
|
5480
|
-
]))
|
|
5481
|
-
}
|
|
5482
|
-
}
|
|
5483
|
-
|
|
5484
|
-
};
|
|
5485
|
-
|
|
5486
|
-
script$1.__file = "src/lib/components/core/Departments/department/ManagePermissions.vue";
|
|
5546
|
+
script$1.__file = "src/lib/components/core/Departments/department/Department.vue";
|
|
5487
5547
|
|
|
5488
5548
|
const _withScopeId = n => (pushScopeId("data-v-2911509a"),n=n(),popScopeId(),n);
|
|
5489
5549
|
const _hoisted_1 = {
|
|
@@ -5647,15 +5707,15 @@ const ShFrontend = {
|
|
|
5647
5707
|
});
|
|
5648
5708
|
options.router.addRoute({
|
|
5649
5709
|
path: '/sh-departments',
|
|
5650
|
-
component: script$
|
|
5710
|
+
component: script$2
|
|
5651
5711
|
});
|
|
5652
5712
|
options.router.addRoute({
|
|
5653
5713
|
path: '/sh-departments/permissions/:id',
|
|
5654
|
-
component: script$
|
|
5714
|
+
component: script$1
|
|
5655
5715
|
});
|
|
5656
5716
|
options.router.addRoute({
|
|
5657
5717
|
path: '/sh-departments/manage-permissions/:id',
|
|
5658
|
-
component: script$
|
|
5718
|
+
component: script$3
|
|
5659
5719
|
});
|
|
5660
5720
|
}
|
|
5661
5721
|
//filter unwanted config items from options to be put in local storage
|
|
@@ -5667,4 +5727,4 @@ const ShFrontend = {
|
|
|
5667
5727
|
}
|
|
5668
5728
|
};
|
|
5669
5729
|
|
|
5670
|
-
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 };
|
|
5730
|
+
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 };
|