@iankibetsh/shframework 1.4.6 → 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.
@@ -79,8 +79,8 @@
79
79
  position: relative;
80
80
  top: 0;
81
81
  left: 0;
82
- background: white;
83
- border-radius: 10px 0 0 10px;
82
+ background: #88b3b370;
83
+ border-radius: 10px;
84
84
  }
85
85
  .permissions-main div#permissions-nav ul li {
86
86
  list-style: none;
@@ -95,6 +95,21 @@
95
95
  flex-grow: 1;
96
96
  }
97
97
 
98
+ .sh-selected-item{
99
+ line-height: unset!important;
100
+ }
101
+ .sh-suggestion-input{
102
+ padding: 0.375rem 0.75rem;
103
+ }
104
+ .sh-suggest{
105
+ margin-bottom: 1rem;
106
+ }
107
+ .sh-suggest-control::after{
108
+ margin-top: auto;
109
+ margin-bottom: auto;
110
+ margin-right: 0.255em;
111
+ }
112
+
98
113
  :root {
99
114
  --ck-z-default: 10555 !important;
100
115
  --ck-z-modal: calc(var(--ck-z-default) + 999) !important;
@@ -116,21 +131,6 @@
116
131
  }
117
132
  }
118
133
 
119
- .sh-selected-item{
120
- line-height: unset!important;
121
- }
122
- .sh-suggestion-input{
123
- padding: 0.375rem 0.75rem;
124
- }
125
- .sh-suggest{
126
- margin-bottom: 1rem;
127
- }
128
- .sh-suggest-control::after{
129
- margin-top: auto;
130
- margin-bottom: auto;
131
- margin-right: 0.255em;
132
- }
133
-
134
134
  .sh-forgot-link, .sh-register-link{
135
135
  cursor: pointer;
136
136
  }
package/dist/library.js CHANGED
@@ -2559,7 +2559,7 @@ const _hoisted_11$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:mo
2559
2559
  const _hoisted_12$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2560
2560
  const _hoisted_13$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2561
2561
  const _hoisted_14$3 = ["data-cy", "name", "onFocus", "onUpdate:modelValue"];
2562
- const _hoisted_15$2 = ["disabled", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2562
+ const _hoisted_15$3 = ["disabled", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2563
2563
  const _hoisted_16$2 = ["name", "onFocus", "onUpdate:modelValue"];
2564
2564
  const _hoisted_17$2 = ["name", "onFocus", "onUpdate:modelValue"];
2565
2565
  const _hoisted_18$2 = ["value"];
@@ -2753,7 +2753,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2753
2753
  class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2754
2754
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2755
2755
  type: "text"
2756
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_15$2)), [
2756
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_15$3)), [
2757
2757
  [vue.vModelText, _ctx.form_elements[field]]
2758
2758
  ])
2759
2759
  : vue.createCommentVNode("v-if", true),
@@ -3629,7 +3629,7 @@ const _hoisted_14$2 = {
3629
3629
  key: 1,
3630
3630
  class: "page-link"
3631
3631
  };
3632
- const _hoisted_15$1 = ["onClick"];
3632
+ const _hoisted_15$2 = ["onClick"];
3633
3633
  const _hoisted_16$1 = { key: 1 };
3634
3634
  const _hoisted_17$1 = {
3635
3635
  key: 0,
@@ -3691,7 +3691,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
3691
3691
  key: 2,
3692
3692
  onClick: $event => ($options.changeTableKey('page',page)),
3693
3693
  class: "page-link"
3694
- }, vue.toDisplayString(page), 9 /* TEXT, PROPS */, _hoisted_15$1))
3694
+ }, vue.toDisplayString(page), 9 /* TEXT, PROPS */, _hoisted_15$2))
3695
3695
  ], 2 /* CLASS */))
3696
3696
  }), 128 /* KEYED_FRAGMENT */)),
3697
3697
  vue.createElementVNode("li", {
@@ -4210,7 +4210,7 @@ const _hoisted_14$1 = {
4210
4210
  key: 1,
4211
4211
  class: "alert alert-danger"
4212
4212
  };
4213
- const _hoisted_15 = { colspan: 2 };
4213
+ const _hoisted_15$1 = { colspan: 2 };
4214
4214
  const _hoisted_16 = {
4215
4215
  key: 0,
4216
4216
  class: "text-center"
@@ -4379,7 +4379,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4379
4379
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$1, _hoisted_13$1))
4380
4380
  : ($data.loading === 'error')
4381
4381
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$1, [
4382
- vue.createElementVNode("span", _hoisted_15, vue.toDisplayString($data.loading_error), 1 /* TEXT */)
4382
+ vue.createElementVNode("span", _hoisted_15$1, vue.toDisplayString($data.loading_error), 1 /* TEXT */)
4383
4383
  ]))
4384
4384
  : vue.createCommentVNode("v-if", true),
4385
4385
  ($data.loading === 'done')
@@ -4988,29 +4988,30 @@ const _withScopeId$1 = n => (vue.pushScopeId("data-v-0d4fa0ac"),n=n(),vue.popSco
4988
4988
  const _hoisted_1$3 = { class: "row permissions-main d-flex" };
4989
4989
  const _hoisted_2$3 = {
4990
4990
  id: "permissions-nav",
4991
- class: "col-md-2 d-flex align-items-center py-4"
4991
+ class: "col-md-3 d-flex align-items-center py-4"
4992
4992
  };
4993
- const _hoisted_3$3 = ["disabled", "checked"];
4994
- const _hoisted_4$3 = ["onClick"];
4995
- const _hoisted_5$3 = {
4993
+ const _hoisted_3$3 = { class: "d-flex flex-column w-100 px-2" };
4994
+ const _hoisted_4$3 = ["checked", "disabled"];
4995
+ const _hoisted_5$3 = ["onClick"];
4996
+ const _hoisted_6$2 = {
4996
4997
  id: "permissions-content",
4997
- class: "col-md-10 py-4 pe-4 ps-0"
4998
+ class: "col-md-9 py-4 px-4"
4998
4999
  };
4999
- const _hoisted_6$2 = { class: "p-2 rounded-2 bg-white h-100" };
5000
- const _hoisted_7$1 = {
5000
+ const _hoisted_7$1 = { class: "p-2 rounded-2 bg-white h-100" };
5001
+ const _hoisted_8$1 = {
5001
5002
  key: 0,
5002
5003
  class: "alert alert-info"
5003
5004
  };
5004
- const _hoisted_8$1 = { key: 1 };
5005
- const _hoisted_9$1 = { class: "row row-cols-4" };
5006
- const _hoisted_10 = { class: "col py-3" };
5007
- const _hoisted_11 = ["value"];
5008
- const _hoisted_12 = {
5005
+ const _hoisted_9$1 = { key: 1 };
5006
+ const _hoisted_10 = { class: "row row-cols-3" };
5007
+ const _hoisted_11 = { class: "col" };
5008
+ const _hoisted_12 = ["value"];
5009
+ const _hoisted_13 = {
5009
5010
  key: 0,
5010
5011
  class: "w-100 row"
5011
5012
  };
5012
- const _hoisted_13 = { class: "col-md-3" };
5013
- const _hoisted_14 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/vue.createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5013
+ const _hoisted_14 = { class: "col-md-3" };
5014
+ const _hoisted_15 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/vue.createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5014
5015
 
5015
5016
  var script$3 = {
5016
5017
  __name: 'ManagePermissions',
@@ -5024,6 +5025,8 @@ const modulePermissions = vue.ref(null);
5024
5025
  const selectedPermissions = vue.ref([]);
5025
5026
  const permissionsChanged = vue.ref(false);
5026
5027
  const departmentId = route.params.id;
5028
+ const department = vue.ref(null);
5029
+ const departmentModules = vue.ref([]);
5027
5030
  const setModule = module=>{
5028
5031
  (selectedModule.value !== module) && (selectedModule.value = module) && getModulePermissions();
5029
5032
  };
@@ -5031,8 +5034,10 @@ vue.onMounted(() => {
5031
5034
  getDepartmentModules();
5032
5035
  });
5033
5036
  const getDepartmentModules = ()=>{
5034
- shApis.doGet(`admin/departments/department/list-all-modules/admin`).then(res=>{
5037
+ shApis.doGet(`admin/departments/department/list-all-modules/admin/${departmentId}`).then(res=>{
5035
5038
  modules.value = res.data.modules;
5039
+ department.value = res.data.department;
5040
+ departmentModules.value = res.data.departmentModules;
5036
5041
  selectedModule.value = res.data.modules[0];
5037
5042
  getModulePermissions();
5038
5043
  });
@@ -5048,6 +5053,9 @@ const getModulePermissions = () => {
5048
5053
  permissionsChanged.value = false;
5049
5054
  });
5050
5055
  };
5056
+ const permissionsUpdated = (res)=>{
5057
+ departmentModules.value = res.data.departmentModules;
5058
+ };
5051
5059
  function reformatModulePermissions(mPs){
5052
5060
  let mpModules = {};
5053
5061
  mPs.map(mp=>{
@@ -5068,6 +5076,7 @@ const checkAllPermissions = ()=>{
5068
5076
  if(selectedPermissions.value.length > 0) {
5069
5077
  selectedPermissions.value = [];
5070
5078
  } else {
5079
+ departmentModules.value.push(selectedModule);
5071
5080
  console.log(modulePermissions.value);
5072
5081
  const all = modulePermissions.value;
5073
5082
  Object.keys(all).map(key=>{
@@ -5091,37 +5100,34 @@ const getPermissionStyle = permission => {
5091
5100
  return (_ctx, _cache) => {
5092
5101
  return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
5093
5102
  vue.createElementVNode("div", _hoisted_2$3, [
5094
- (vue.openBlock(), vue.createElementBlock("ul", {
5095
- class: "d-flex flex-column w-100 ps-2",
5096
- key: selectedModule.value ? selectedModule.value:0
5097
- }, [
5103
+ vue.createElementVNode("ul", _hoisted_3$3, [
5098
5104
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(modules.value, (module) => {
5099
5105
  return (vue.openBlock(), vue.createElementBlock("li", {
5100
5106
  class: vue.normalizeClass(selectedModule.value === module && 'active'),
5101
5107
  key: selectedModule.value
5102
5108
  }, [
5103
5109
  vue.createElementVNode("input", {
5104
- onClick: _cache[0] || (_cache[0] = $event => (checkAllPermissions())),
5110
+ checked: departmentModules.value.includes(module),
5111
+ onClick: checkAllPermissions,
5105
5112
  disabled: selectedModule.value !== module,
5106
- checked: selectedPermissions.value.length > 0 && selectedModule.value === module,
5107
5113
  type: "checkbox"
5108
- }, null, 8 /* PROPS */, _hoisted_3$3),
5114
+ }, null, 8 /* PROPS */, _hoisted_4$3),
5109
5115
  vue.createElementVNode("label", {
5110
5116
  class: "text-capitalize",
5111
5117
  onClick: $event => (setModule(module))
5112
- }, vue.toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_4$3)
5118
+ }, vue.toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_5$3)
5113
5119
  ], 2 /* CLASS */))
5114
5120
  }), 128 /* KEYED_FRAGMENT */))
5115
- ]))
5121
+ ])
5116
5122
  ]),
5117
- vue.createElementVNode("div", _hoisted_5$3, [
5118
- vue.createElementVNode("div", _hoisted_6$2, [
5123
+ vue.createElementVNode("div", _hoisted_6$2, [
5124
+ vue.createElementVNode("div", _hoisted_7$1, [
5119
5125
  (loading.value)
5120
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$1, " loading ... "))
5121
- : (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$1, [
5122
- vue.createElementVNode("div", _hoisted_9$1, [
5126
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$1, " loading ... "))
5127
+ : (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$1, [
5128
+ vue.createElementVNode("div", _hoisted_10, [
5123
5129
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(modulePermissions.value, (permissions) => {
5124
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
5130
+ return (vue.openBlock(), vue.createElementBlock("div", _hoisted_11, [
5125
5131
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(permissions, (permission) => {
5126
5132
  return (vue.openBlock(), vue.createElementBlock("label", {
5127
5133
  onClick: setPermissionsChanged,
@@ -5129,10 +5135,10 @@ return (_ctx, _cache) => {
5129
5135
  style: vue.normalizeStyle(getPermissionStyle(permission))
5130
5136
  }, [
5131
5137
  vue.withDirectives(vue.createElementVNode("input", {
5132
- "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((selectedPermissions).value = $event)),
5138
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((selectedPermissions).value = $event)),
5133
5139
  value: permission,
5134
5140
  type: "checkbox"
5135
- }, null, 8 /* PROPS */, _hoisted_11), [
5141
+ }, null, 8 /* PROPS */, _hoisted_12), [
5136
5142
  [vue.vModelCheckbox, selectedPermissions.value]
5137
5143
  ]),
5138
5144
  vue.createTextVNode(" " + vue.toDisplayString(getLabel(permission)), 1 /* TEXT */)
@@ -5142,15 +5148,16 @@ return (_ctx, _cache) => {
5142
5148
  }), 256 /* UNKEYED_FRAGMENT */))
5143
5149
  ]),
5144
5150
  (permissionsChanged.value)
5145
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12, [
5146
- vue.createElementVNode("div", _hoisted_13, [
5147
- vue.createVNode(script$8, {
5151
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13, [
5152
+ vue.createElementVNode("div", _hoisted_14, [
5153
+ vue.createVNode(script$7, {
5154
+ onSuccess: permissionsUpdated,
5148
5155
  url: `admin/departments/department/permissions/${vue.unref(departmentId)}/${selectedModule.value}`,
5149
5156
  data: {permissions: selectedPermissions.value},
5150
5157
  class: "btn btn-primary d-block"
5151
5158
  }, {
5152
5159
  default: vue.withCtx(() => [
5153
- _hoisted_14,
5160
+ _hoisted_15,
5154
5161
  vue.createTextVNode(" Save")
5155
5162
  ]),
5156
5163
  _: 1 /* STABLE */
@@ -5316,7 +5323,7 @@ return (_ctx, _cache) => {
5316
5323
  actions: [
5317
5324
  {
5318
5325
  label: 'Permissions',
5319
- path: '/sh-departments/permissions/{id}',
5326
+ path: '/sh-departments/manage-permissions/{id}',
5320
5327
  class: 'btn btn-info bi-lock btn-sm'
5321
5328
  }
5322
5329
  ]
package/dist/library.mjs CHANGED
@@ -2546,7 +2546,7 @@ const _hoisted_11$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:mo
2546
2546
  const _hoisted_12$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2547
2547
  const _hoisted_13$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2548
2548
  const _hoisted_14$3 = ["data-cy", "name", "onFocus", "onUpdate:modelValue"];
2549
- const _hoisted_15$2 = ["disabled", "placeholder", "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"];
@@ -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$2)), [
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),
@@ -3616,7 +3616,7 @@ const _hoisted_14$2 = {
3616
3616
  key: 1,
3617
3617
  class: "page-link"
3618
3618
  };
3619
- const _hoisted_15$1 = ["onClick"];
3619
+ const _hoisted_15$2 = ["onClick"];
3620
3620
  const _hoisted_16$1 = { key: 1 };
3621
3621
  const _hoisted_17$1 = {
3622
3622
  key: 0,
@@ -3678,7 +3678,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
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$1))
3681
+ }, toDisplayString(page), 9 /* TEXT, PROPS */, _hoisted_15$2))
3682
3682
  ], 2 /* CLASS */))
3683
3683
  }), 128 /* KEYED_FRAGMENT */)),
3684
3684
  createElementVNode("li", {
@@ -4197,7 +4197,7 @@ 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"
@@ -4366,7 +4366,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4366
4366
  ? (openBlock(), createElementBlock("div", _hoisted_11$1, _hoisted_13$1))
4367
4367
  : ($data.loading === 'error')
4368
4368
  ? (openBlock(), createElementBlock("div", _hoisted_14$1, [
4369
- createElementVNode("span", _hoisted_15, toDisplayString($data.loading_error), 1 /* TEXT */)
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')
@@ -4975,29 +4975,30 @@ const _withScopeId$1 = n => (pushScopeId("data-v-0d4fa0ac"),n=n(),popScopeId(),n
4975
4975
  const _hoisted_1$3 = { class: "row permissions-main d-flex" };
4976
4976
  const _hoisted_2$3 = {
4977
4977
  id: "permissions-nav",
4978
- class: "col-md-2 d-flex align-items-center py-4"
4978
+ class: "col-md-3 d-flex align-items-center py-4"
4979
4979
  };
4980
- const _hoisted_3$3 = ["disabled", "checked"];
4981
- const _hoisted_4$3 = ["onClick"];
4982
- const _hoisted_5$3 = {
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 = {
4983
4984
  id: "permissions-content",
4984
- class: "col-md-10 py-4 pe-4 ps-0"
4985
+ class: "col-md-9 py-4 px-4"
4985
4986
  };
4986
- const _hoisted_6$2 = { class: "p-2 rounded-2 bg-white h-100" };
4987
- const _hoisted_7$1 = {
4987
+ const _hoisted_7$1 = { class: "p-2 rounded-2 bg-white h-100" };
4988
+ const _hoisted_8$1 = {
4988
4989
  key: 0,
4989
4990
  class: "alert alert-info"
4990
4991
  };
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 = {
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 = {
4996
4997
  key: 0,
4997
4998
  class: "w-100 row"
4998
4999
  };
4999
- const _hoisted_13 = { class: "col-md-3" };
5000
- const _hoisted_14 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5000
+ const _hoisted_14 = { class: "col-md-3" };
5001
+ const _hoisted_15 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5001
5002
 
5002
5003
  var script$3 = {
5003
5004
  __name: 'ManagePermissions',
@@ -5011,6 +5012,8 @@ const modulePermissions = ref(null);
5011
5012
  const selectedPermissions = ref([]);
5012
5013
  const permissionsChanged = ref(false);
5013
5014
  const departmentId = route.params.id;
5015
+ const department = ref(null);
5016
+ const departmentModules = ref([]);
5014
5017
  const setModule = module=>{
5015
5018
  (selectedModule.value !== module) && (selectedModule.value = module) && getModulePermissions();
5016
5019
  };
@@ -5018,8 +5021,10 @@ onMounted(() => {
5018
5021
  getDepartmentModules();
5019
5022
  });
5020
5023
  const getDepartmentModules = ()=>{
5021
- shApis.doGet(`admin/departments/department/list-all-modules/admin`).then(res=>{
5024
+ shApis.doGet(`admin/departments/department/list-all-modules/admin/${departmentId}`).then(res=>{
5022
5025
  modules.value = res.data.modules;
5026
+ department.value = res.data.department;
5027
+ departmentModules.value = res.data.departmentModules;
5023
5028
  selectedModule.value = res.data.modules[0];
5024
5029
  getModulePermissions();
5025
5030
  });
@@ -5035,6 +5040,9 @@ const getModulePermissions = () => {
5035
5040
  permissionsChanged.value = false;
5036
5041
  });
5037
5042
  };
5043
+ const permissionsUpdated = (res)=>{
5044
+ departmentModules.value = res.data.departmentModules;
5045
+ };
5038
5046
  function reformatModulePermissions(mPs){
5039
5047
  let mpModules = {};
5040
5048
  mPs.map(mp=>{
@@ -5055,6 +5063,7 @@ const checkAllPermissions = ()=>{
5055
5063
  if(selectedPermissions.value.length > 0) {
5056
5064
  selectedPermissions.value = [];
5057
5065
  } else {
5066
+ departmentModules.value.push(selectedModule);
5058
5067
  console.log(modulePermissions.value);
5059
5068
  const all = modulePermissions.value;
5060
5069
  Object.keys(all).map(key=>{
@@ -5078,37 +5087,34 @@ const getPermissionStyle = permission => {
5078
5087
  return (_ctx, _cache) => {
5079
5088
  return (openBlock(), createElementBlock("div", _hoisted_1$3, [
5080
5089
  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
- }, [
5090
+ createElementVNode("ul", _hoisted_3$3, [
5085
5091
  (openBlock(true), createElementBlock(Fragment, null, renderList(modules.value, (module) => {
5086
5092
  return (openBlock(), createElementBlock("li", {
5087
5093
  class: normalizeClass(selectedModule.value === module && 'active'),
5088
5094
  key: selectedModule.value
5089
5095
  }, [
5090
5096
  createElementVNode("input", {
5091
- onClick: _cache[0] || (_cache[0] = $event => (checkAllPermissions())),
5097
+ checked: departmentModules.value.includes(module),
5098
+ onClick: checkAllPermissions,
5092
5099
  disabled: selectedModule.value !== module,
5093
- checked: selectedPermissions.value.length > 0 && selectedModule.value === module,
5094
5100
  type: "checkbox"
5095
- }, null, 8 /* PROPS */, _hoisted_3$3),
5101
+ }, null, 8 /* PROPS */, _hoisted_4$3),
5096
5102
  createElementVNode("label", {
5097
5103
  class: "text-capitalize",
5098
5104
  onClick: $event => (setModule(module))
5099
- }, toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_4$3)
5105
+ }, toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_5$3)
5100
5106
  ], 2 /* CLASS */))
5101
5107
  }), 128 /* KEYED_FRAGMENT */))
5102
- ]))
5108
+ ])
5103
5109
  ]),
5104
- createElementVNode("div", _hoisted_5$3, [
5105
- createElementVNode("div", _hoisted_6$2, [
5110
+ createElementVNode("div", _hoisted_6$2, [
5111
+ createElementVNode("div", _hoisted_7$1, [
5106
5112
  (loading.value)
5107
- ? (openBlock(), createElementBlock("div", _hoisted_7$1, " loading ... "))
5108
- : (openBlock(), createElementBlock("div", _hoisted_8$1, [
5109
- createElementVNode("div", _hoisted_9$1, [
5113
+ ? (openBlock(), createElementBlock("div", _hoisted_8$1, " loading ... "))
5114
+ : (openBlock(), createElementBlock("div", _hoisted_9$1, [
5115
+ createElementVNode("div", _hoisted_10, [
5110
5116
  (openBlock(true), createElementBlock(Fragment, null, renderList(modulePermissions.value, (permissions) => {
5111
- return (openBlock(), createElementBlock("div", _hoisted_10, [
5117
+ return (openBlock(), createElementBlock("div", _hoisted_11, [
5112
5118
  (openBlock(true), createElementBlock(Fragment, null, renderList(permissions, (permission) => {
5113
5119
  return (openBlock(), createElementBlock("label", {
5114
5120
  onClick: setPermissionsChanged,
@@ -5116,10 +5122,10 @@ return (_ctx, _cache) => {
5116
5122
  style: normalizeStyle(getPermissionStyle(permission))
5117
5123
  }, [
5118
5124
  withDirectives(createElementVNode("input", {
5119
- "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((selectedPermissions).value = $event)),
5125
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((selectedPermissions).value = $event)),
5120
5126
  value: permission,
5121
5127
  type: "checkbox"
5122
- }, null, 8 /* PROPS */, _hoisted_11), [
5128
+ }, null, 8 /* PROPS */, _hoisted_12), [
5123
5129
  [vModelCheckbox, selectedPermissions.value]
5124
5130
  ]),
5125
5131
  createTextVNode(" " + toDisplayString(getLabel(permission)), 1 /* TEXT */)
@@ -5129,15 +5135,16 @@ return (_ctx, _cache) => {
5129
5135
  }), 256 /* UNKEYED_FRAGMENT */))
5130
5136
  ]),
5131
5137
  (permissionsChanged.value)
5132
- ? (openBlock(), createElementBlock("div", _hoisted_12, [
5133
- createElementVNode("div", _hoisted_13, [
5134
- createVNode(script$8, {
5138
+ ? (openBlock(), createElementBlock("div", _hoisted_13, [
5139
+ createElementVNode("div", _hoisted_14, [
5140
+ createVNode(script$7, {
5141
+ onSuccess: permissionsUpdated,
5135
5142
  url: `admin/departments/department/permissions/${unref(departmentId)}/${selectedModule.value}`,
5136
5143
  data: {permissions: selectedPermissions.value},
5137
5144
  class: "btn btn-primary d-block"
5138
5145
  }, {
5139
5146
  default: withCtx(() => [
5140
- _hoisted_14,
5147
+ _hoisted_15,
5141
5148
  createTextVNode(" Save")
5142
5149
  ]),
5143
5150
  _: 1 /* STABLE */
@@ -5303,7 +5310,7 @@ return (_ctx, _cache) => {
5303
5310
  actions: [
5304
5311
  {
5305
5312
  label: 'Permissions',
5306
- path: '/sh-departments/permissions/{id}',
5313
+ path: '/sh-departments/manage-permissions/{id}',
5307
5314
  class: 'btn btn-info bi-lock btn-sm'
5308
5315
  }
5309
5316
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",