@iankibetsh/shframework 1.5.5 → 1.5.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/library.js CHANGED
@@ -2563,9 +2563,9 @@ const _hoisted_12$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:mo
2563
2563
  const _hoisted_13$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2564
2564
  const _hoisted_14$3 = ["data-cy", "name", "onFocus", "onUpdate:modelValue"];
2565
2565
  const _hoisted_15$3 = ["disabled", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2566
- const _hoisted_16$2 = ["name", "onFocus", "onUpdate:modelValue"];
2567
- const _hoisted_17$2 = ["name", "onFocus", "onUpdate:modelValue"];
2568
- const _hoisted_18$2 = ["value"];
2566
+ const _hoisted_16$3 = ["name", "onFocus", "onUpdate:modelValue"];
2567
+ const _hoisted_17$3 = ["name", "onFocus", "onUpdate:modelValue"];
2568
+ const _hoisted_18$3 = ["value"];
2569
2569
  const _hoisted_19$2 = {
2570
2570
  key: 12,
2571
2571
  class: "invalid-feedback"
@@ -2767,7 +2767,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2767
2767
  onFocus: $event => ($options.removeErrors(field)),
2768
2768
  class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2769
2769
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
2770
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_16$2)), [
2770
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_16$3)), [
2771
2771
  [vue.vModelText, _ctx.form_elements[field]]
2772
2772
  ])
2773
2773
  : vue.createCommentVNode("v-if", true),
@@ -2783,9 +2783,9 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2783
2783
  return (vue.openBlock(), vue.createElementBlock("option", {
2784
2784
  key: item.id,
2785
2785
  value: item.id
2786
- }, vue.toDisplayString(item.name), 9 /* TEXT, PROPS */, _hoisted_18$2))
2786
+ }, vue.toDisplayString(item.name), 9 /* TEXT, PROPS */, _hoisted_18$3))
2787
2787
  }), 128 /* KEYED_FRAGMENT */))
2788
- ], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_17$2)), [
2788
+ ], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_17$3)), [
2789
2789
  [vue.vModelSelect, _ctx.form_elements[field]]
2790
2790
  ])
2791
2791
  : vue.createCommentVNode("v-if", true),
@@ -3120,6 +3120,9 @@ const props = __props;
3120
3120
 
3121
3121
  const formFields = vue.ref([]);
3122
3122
  const getFieldComponent = (fieldObj)=>{
3123
+ if(fieldObj.component){
3124
+ return fieldObj.component
3125
+ }
3123
3126
  const field = fieldObj.field;
3124
3127
  const defaultTextareas = ['message', 'meta_description', 'comment', 'call_response', 'comments', 'description'];
3125
3128
  const defaultNumbers = ['age'];
@@ -3655,17 +3658,17 @@ const _hoisted_14$2 = {
3655
3658
  class: "page-link"
3656
3659
  };
3657
3660
  const _hoisted_15$2 = ["onClick"];
3658
- const _hoisted_16$1 = { key: 1 };
3659
- const _hoisted_17$1 = {
3661
+ const _hoisted_16$2 = { key: 1 };
3662
+ const _hoisted_17$2 = {
3660
3663
  key: 0,
3661
3664
  class: "text-center"
3662
3665
  };
3663
- const _hoisted_18$1 = /*#__PURE__*/vue.createElementVNode("div", {
3666
+ const _hoisted_18$2 = /*#__PURE__*/vue.createElementVNode("div", {
3664
3667
  class: "spinner-border",
3665
3668
  role: "status"
3666
3669
  }, null, -1 /* HOISTED */);
3667
3670
  const _hoisted_19$1 = [
3668
- _hoisted_18$1
3671
+ _hoisted_18$2
3669
3672
  ];
3670
3673
  const _hoisted_20$1 = {
3671
3674
  key: 1,
@@ -3731,9 +3734,9 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
3731
3734
  ]))
3732
3735
  : vue.createCommentVNode("v-if", true)
3733
3736
  ]))
3734
- : (vue.openBlock(), vue.createElementBlock("div", _hoisted_16$1, [
3737
+ : (vue.openBlock(), vue.createElementBlock("div", _hoisted_16$2, [
3735
3738
  (this.pagination_data.loading === 1 && $props.loadMore && $props.hideLoadMore)
3736
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17$1, _hoisted_19$1))
3739
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17$2, _hoisted_19$1))
3737
3740
  : vue.createCommentVNode("v-if", true),
3738
3741
  (!$props.hideCount)
3739
3742
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_20$1, [
@@ -4248,18 +4251,18 @@ const _hoisted_14$1 = {
4248
4251
  class: "alert alert-danger"
4249
4252
  };
4250
4253
  const _hoisted_15$1 = { colspan: 2 };
4251
- const _hoisted_16 = {
4254
+ const _hoisted_16$1 = {
4252
4255
  key: 0,
4253
4256
  class: "text-center"
4254
4257
  };
4255
- const _hoisted_17 = /*#__PURE__*/vue.createElementVNode("div", {
4258
+ const _hoisted_17$1 = /*#__PURE__*/vue.createElementVNode("div", {
4256
4259
  class: "spinner-border",
4257
4260
  role: "status"
4258
4261
  }, [
4259
4262
  /*#__PURE__*/vue.createElementVNode("span", { class: "visually-hidden" }, "Loading...")
4260
4263
  ], -1 /* HOISTED */);
4261
- const _hoisted_18 = [
4262
- _hoisted_17
4264
+ const _hoisted_18$1 = [
4265
+ _hoisted_17$1
4263
4266
  ];
4264
4267
  const _hoisted_19 = {
4265
4268
  key: 1,
@@ -4433,7 +4436,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4433
4436
  : ($options.hasRecordsSlot)
4434
4437
  ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
4435
4438
  ($data.loading === 'loading')
4436
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_16, _hoisted_18))
4439
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_16$1, _hoisted_18$1))
4437
4440
  : ($data.loading === 'error')
4438
4441
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_19, [
4439
4442
  vue.createElementVNode("span", _hoisted_20, vue.toDisplayString($data.loading_error), 1 /* TEXT */)
@@ -5125,28 +5128,39 @@ const _hoisted_2$3 = {
5125
5128
  id: "permissions-nav",
5126
5129
  class: "col-md-3 d-flex align-items-center py-4"
5127
5130
  };
5128
- const _hoisted_3$3 = { class: "d-flex flex-column w-100 px-2" };
5129
- const _hoisted_4$3 = ["checked", "disabled"];
5130
- const _hoisted_5$3 = ["onClick"];
5131
+ const _hoisted_3$3 = {
5132
+ key: 0,
5133
+ class: "mx-auto"
5134
+ };
5135
+ const _hoisted_4$3 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/vue.createElementVNode("span", { class: "spinner-grow mx-auto" }, null, -1 /* HOISTED */));
5136
+ const _hoisted_5$3 = [
5137
+ _hoisted_4$3
5138
+ ];
5131
5139
  const _hoisted_6$2 = {
5140
+ key: 1,
5141
+ class: "d-flex flex-column w-100 px-2"
5142
+ };
5143
+ const _hoisted_7$1 = ["checked", "disabled"];
5144
+ const _hoisted_8$1 = ["onClick"];
5145
+ const _hoisted_9$1 = {
5132
5146
  id: "permissions-content",
5133
5147
  class: "col-md-9 py-4 px-4"
5134
5148
  };
5135
- const _hoisted_7$1 = { class: "p-2 rounded-2 bg-white h-100" };
5136
- const _hoisted_8$1 = {
5149
+ const _hoisted_10 = { class: "p-2 rounded-2 bg-white h-100" };
5150
+ const _hoisted_11 = {
5137
5151
  key: 0,
5138
5152
  class: "alert alert-info"
5139
5153
  };
5140
- const _hoisted_9$1 = { key: 1 };
5141
- const _hoisted_10 = { class: "row row-cols-3" };
5142
- const _hoisted_11 = { class: "col" };
5143
- const _hoisted_12 = ["value"];
5144
- const _hoisted_13 = {
5154
+ const _hoisted_12 = { key: 1 };
5155
+ const _hoisted_13 = { class: "row row-cols-3" };
5156
+ const _hoisted_14 = { class: "col" };
5157
+ const _hoisted_15 = ["value"];
5158
+ const _hoisted_16 = {
5145
5159
  key: 0,
5146
5160
  class: "w-100 row"
5147
5161
  };
5148
- const _hoisted_14 = { class: "col-md-3" };
5149
- const _hoisted_15 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/vue.createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5162
+ const _hoisted_17 = { class: "col-md-3" };
5163
+ const _hoisted_18 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/vue.createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5150
5164
 
5151
5165
 
5152
5166
  var script$3 = {
@@ -5174,24 +5188,35 @@ const setModule = module=>{
5174
5188
  vue.onMounted(() => {
5175
5189
  getDepartmentModules();
5176
5190
  });
5191
+ const loadingModules = vue.ref(false);
5177
5192
  const getDepartmentModules = ()=>{
5178
- shApis.doGet(`admin/departments/department/list-all-modules/admin/${departmentId}`).then(res=>{
5193
+ loadingModules.value = true;
5194
+ shApis.doGet(`sh-departments/department/list-all-modules/sh-departments/${departmentId}`).then(res=>{
5195
+ loadingModules.value = false;
5179
5196
  modules.value = res.data.modules;
5180
5197
  department.value = res.data.department;
5181
5198
  departmentModules.value = res.data.departmentModules;
5182
5199
  selectedModule.value = res.data.modules[0];
5183
5200
  getModulePermissions();
5201
+ }).catch(ex=>{
5202
+ loadingModules.value = false;
5203
+ // console.log(ex)
5204
+ shRepo.showToast(ex.message, 'error');
5184
5205
  });
5185
5206
  };
5186
5207
  const loading = vue.ref(false);
5187
5208
  const getModulePermissions = () => {
5188
5209
  loading.value = true;
5189
5210
  modulePermissions.value = null;
5190
- shApis.doGet(`admin/departments/department/get-module-permissions/${selectedModule.value}?department_id=${departmentId}`).then(res=>{
5211
+ shApis.doGet(`sh-departments/department/get-module-permissions/${selectedModule.value}?department_id=${departmentId}`).then(res=>{
5191
5212
  loading.value = false;
5192
5213
  modulePermissions.value = reformatModulePermissions(res.data.permissions);
5193
5214
  selectedPermissions.value = res.data.selectedPermissions ?? [];
5194
5215
  permissionsChanged.value = false;
5216
+ }).catch(ex=>{
5217
+ console.log(ex);
5218
+ loading.value = false;
5219
+ shRepo.showToast(ex.message, 'error');
5195
5220
  });
5196
5221
  };
5197
5222
  const permissionsUpdated = (res)=>{
@@ -5243,34 +5268,36 @@ const getPermissionStyle = permission => {
5243
5268
  return (_ctx, _cache) => {
5244
5269
  return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
5245
5270
  vue.createElementVNode("div", _hoisted_2$3, [
5246
- vue.createElementVNode("ul", _hoisted_3$3, [
5247
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(modules.value, (module) => {
5248
- return (vue.openBlock(), vue.createElementBlock("li", {
5249
- class: vue.normalizeClass(selectedModule.value === module && 'active'),
5250
- key: selectedModule.value
5251
- }, [
5252
- vue.createElementVNode("input", {
5253
- checked: departmentModules.value.includes(module),
5254
- onClick: checkAllPermissions,
5255
- disabled: selectedModule.value !== module,
5256
- type: "checkbox"
5257
- }, null, 8 /* PROPS */, _hoisted_4$3),
5258
- vue.createElementVNode("label", {
5259
- class: "text-capitalize",
5260
- onClick: $event => (setModule(module))
5261
- }, vue.toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_5$3)
5262
- ], 2 /* CLASS */))
5263
- }), 128 /* KEYED_FRAGMENT */))
5264
- ])
5271
+ (loadingModules.value)
5272
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, _hoisted_5$3))
5273
+ : (vue.openBlock(), vue.createElementBlock("ul", _hoisted_6$2, [
5274
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(modules.value, (module) => {
5275
+ return (vue.openBlock(), vue.createElementBlock("li", {
5276
+ class: vue.normalizeClass(selectedModule.value === module && 'active'),
5277
+ key: selectedModule.value
5278
+ }, [
5279
+ vue.createElementVNode("input", {
5280
+ checked: departmentModules.value.includes(module),
5281
+ onClick: checkAllPermissions,
5282
+ disabled: selectedModule.value !== module,
5283
+ type: "checkbox"
5284
+ }, null, 8 /* PROPS */, _hoisted_7$1),
5285
+ vue.createElementVNode("label", {
5286
+ class: "text-capitalize",
5287
+ onClick: $event => (setModule(module))
5288
+ }, vue.toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_8$1)
5289
+ ], 2 /* CLASS */))
5290
+ }), 128 /* KEYED_FRAGMENT */))
5291
+ ]))
5265
5292
  ]),
5266
- vue.createElementVNode("div", _hoisted_6$2, [
5267
- vue.createElementVNode("div", _hoisted_7$1, [
5293
+ vue.createElementVNode("div", _hoisted_9$1, [
5294
+ vue.createElementVNode("div", _hoisted_10, [
5268
5295
  (loading.value)
5269
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$1, " loading ... "))
5270
- : (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$1, [
5271
- vue.createElementVNode("div", _hoisted_10, [
5296
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11, " loading ... "))
5297
+ : (vue.openBlock(), vue.createElementBlock("div", _hoisted_12, [
5298
+ vue.createElementVNode("div", _hoisted_13, [
5272
5299
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(modulePermissions.value, (permissions) => {
5273
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_11, [
5300
+ return (vue.openBlock(), vue.createElementBlock("div", _hoisted_14, [
5274
5301
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(permissions, (permission) => {
5275
5302
  return (vue.openBlock(), vue.createElementBlock("label", {
5276
5303
  onClick: setPermissionsChanged,
@@ -5281,7 +5308,7 @@ return (_ctx, _cache) => {
5281
5308
  "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((selectedPermissions).value = $event)),
5282
5309
  value: permission,
5283
5310
  type: "checkbox"
5284
- }, null, 8 /* PROPS */, _hoisted_12), [
5311
+ }, null, 8 /* PROPS */, _hoisted_15), [
5285
5312
  [vue.vModelCheckbox, selectedPermissions.value]
5286
5313
  ]),
5287
5314
  vue.createTextVNode(" " + vue.toDisplayString(getLabel(permission)), 1 /* TEXT */)
@@ -5291,16 +5318,16 @@ return (_ctx, _cache) => {
5291
5318
  }), 256 /* UNKEYED_FRAGMENT */))
5292
5319
  ]),
5293
5320
  (permissionsChanged.value)
5294
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13, [
5295
- vue.createElementVNode("div", _hoisted_14, [
5321
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_16, [
5322
+ vue.createElementVNode("div", _hoisted_17, [
5296
5323
  vue.createVNode(script$7, {
5297
5324
  onSuccess: permissionsUpdated,
5298
- url: `admin/departments/department/permissions/${vue.unref(departmentId)}/${selectedModule.value}`,
5325
+ url: `sh-departments/department/permissions/${vue.unref(departmentId)}/${selectedModule.value}`,
5299
5326
  data: {permissions: selectedPermissions.value},
5300
5327
  class: "btn btn-primary d-block"
5301
5328
  }, {
5302
5329
  default: vue.withCtx(() => [
5303
- _hoisted_15,
5330
+ _hoisted_18,
5304
5331
  vue.createTextVNode(" Save")
5305
5332
  ]),
5306
5333
  _: 1 /* STABLE */
@@ -5364,7 +5391,7 @@ return (_ctx, _cache) => {
5364
5391
  ], 512 /* NEED_PATCH */),
5365
5392
  vue.createVNode(script$6, {
5366
5393
  headers: ['id','name','description', 'created_at'],
5367
- "end-point": "admin/departments/list",
5394
+ "end-point": "sh-departments/list",
5368
5395
  actions: {
5369
5396
  label: 'Action',
5370
5397
  actions: [
package/dist/library.mjs CHANGED
@@ -2550,9 +2550,9 @@ const _hoisted_12$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:mo
2550
2550
  const _hoisted_13$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2551
2551
  const _hoisted_14$3 = ["data-cy", "name", "onFocus", "onUpdate:modelValue"];
2552
2552
  const _hoisted_15$3 = ["disabled", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2553
- const _hoisted_16$2 = ["name", "onFocus", "onUpdate:modelValue"];
2554
- const _hoisted_17$2 = ["name", "onFocus", "onUpdate:modelValue"];
2555
- const _hoisted_18$2 = ["value"];
2553
+ const _hoisted_16$3 = ["name", "onFocus", "onUpdate:modelValue"];
2554
+ const _hoisted_17$3 = ["name", "onFocus", "onUpdate:modelValue"];
2555
+ const _hoisted_18$3 = ["value"];
2556
2556
  const _hoisted_19$2 = {
2557
2557
  key: 12,
2558
2558
  class: "invalid-feedback"
@@ -2754,7 +2754,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2754
2754
  onFocus: $event => ($options.removeErrors(field)),
2755
2755
  class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2756
2756
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
2757
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_16$2)), [
2757
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_16$3)), [
2758
2758
  [vModelText, _ctx.form_elements[field]]
2759
2759
  ])
2760
2760
  : createCommentVNode("v-if", true),
@@ -2770,9 +2770,9 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2770
2770
  return (openBlock(), createElementBlock("option", {
2771
2771
  key: item.id,
2772
2772
  value: item.id
2773
- }, toDisplayString(item.name), 9 /* TEXT, PROPS */, _hoisted_18$2))
2773
+ }, toDisplayString(item.name), 9 /* TEXT, PROPS */, _hoisted_18$3))
2774
2774
  }), 128 /* KEYED_FRAGMENT */))
2775
- ], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_17$2)), [
2775
+ ], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_17$3)), [
2776
2776
  [vModelSelect, _ctx.form_elements[field]]
2777
2777
  ])
2778
2778
  : createCommentVNode("v-if", true),
@@ -3107,6 +3107,9 @@ const props = __props;
3107
3107
 
3108
3108
  const formFields = ref([]);
3109
3109
  const getFieldComponent = (fieldObj)=>{
3110
+ if(fieldObj.component){
3111
+ return fieldObj.component
3112
+ }
3110
3113
  const field = fieldObj.field;
3111
3114
  const defaultTextareas = ['message', 'meta_description', 'comment', 'call_response', 'comments', 'description'];
3112
3115
  const defaultNumbers = ['age'];
@@ -3642,17 +3645,17 @@ const _hoisted_14$2 = {
3642
3645
  class: "page-link"
3643
3646
  };
3644
3647
  const _hoisted_15$2 = ["onClick"];
3645
- const _hoisted_16$1 = { key: 1 };
3646
- const _hoisted_17$1 = {
3648
+ const _hoisted_16$2 = { key: 1 };
3649
+ const _hoisted_17$2 = {
3647
3650
  key: 0,
3648
3651
  class: "text-center"
3649
3652
  };
3650
- const _hoisted_18$1 = /*#__PURE__*/createElementVNode("div", {
3653
+ const _hoisted_18$2 = /*#__PURE__*/createElementVNode("div", {
3651
3654
  class: "spinner-border",
3652
3655
  role: "status"
3653
3656
  }, null, -1 /* HOISTED */);
3654
3657
  const _hoisted_19$1 = [
3655
- _hoisted_18$1
3658
+ _hoisted_18$2
3656
3659
  ];
3657
3660
  const _hoisted_20$1 = {
3658
3661
  key: 1,
@@ -3718,9 +3721,9 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
3718
3721
  ]))
3719
3722
  : createCommentVNode("v-if", true)
3720
3723
  ]))
3721
- : (openBlock(), createElementBlock("div", _hoisted_16$1, [
3724
+ : (openBlock(), createElementBlock("div", _hoisted_16$2, [
3722
3725
  (this.pagination_data.loading === 1 && $props.loadMore && $props.hideLoadMore)
3723
- ? (openBlock(), createElementBlock("div", _hoisted_17$1, _hoisted_19$1))
3726
+ ? (openBlock(), createElementBlock("div", _hoisted_17$2, _hoisted_19$1))
3724
3727
  : createCommentVNode("v-if", true),
3725
3728
  (!$props.hideCount)
3726
3729
  ? (openBlock(), createElementBlock("div", _hoisted_20$1, [
@@ -4235,18 +4238,18 @@ const _hoisted_14$1 = {
4235
4238
  class: "alert alert-danger"
4236
4239
  };
4237
4240
  const _hoisted_15$1 = { colspan: 2 };
4238
- const _hoisted_16 = {
4241
+ const _hoisted_16$1 = {
4239
4242
  key: 0,
4240
4243
  class: "text-center"
4241
4244
  };
4242
- const _hoisted_17 = /*#__PURE__*/createElementVNode("div", {
4245
+ const _hoisted_17$1 = /*#__PURE__*/createElementVNode("div", {
4243
4246
  class: "spinner-border",
4244
4247
  role: "status"
4245
4248
  }, [
4246
4249
  /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...")
4247
4250
  ], -1 /* HOISTED */);
4248
- const _hoisted_18 = [
4249
- _hoisted_17
4251
+ const _hoisted_18$1 = [
4252
+ _hoisted_17$1
4250
4253
  ];
4251
4254
  const _hoisted_19 = {
4252
4255
  key: 1,
@@ -4420,7 +4423,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4420
4423
  : ($options.hasRecordsSlot)
4421
4424
  ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
4422
4425
  ($data.loading === 'loading')
4423
- ? (openBlock(), createElementBlock("div", _hoisted_16, _hoisted_18))
4426
+ ? (openBlock(), createElementBlock("div", _hoisted_16$1, _hoisted_18$1))
4424
4427
  : ($data.loading === 'error')
4425
4428
  ? (openBlock(), createElementBlock("div", _hoisted_19, [
4426
4429
  createElementVNode("span", _hoisted_20, toDisplayString($data.loading_error), 1 /* TEXT */)
@@ -5112,28 +5115,39 @@ const _hoisted_2$3 = {
5112
5115
  id: "permissions-nav",
5113
5116
  class: "col-md-3 d-flex align-items-center py-4"
5114
5117
  };
5115
- const _hoisted_3$3 = { class: "d-flex flex-column w-100 px-2" };
5116
- const _hoisted_4$3 = ["checked", "disabled"];
5117
- const _hoisted_5$3 = ["onClick"];
5118
+ const _hoisted_3$3 = {
5119
+ key: 0,
5120
+ class: "mx-auto"
5121
+ };
5122
+ const _hoisted_4$3 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/createElementVNode("span", { class: "spinner-grow mx-auto" }, null, -1 /* HOISTED */));
5123
+ const _hoisted_5$3 = [
5124
+ _hoisted_4$3
5125
+ ];
5118
5126
  const _hoisted_6$2 = {
5127
+ key: 1,
5128
+ class: "d-flex flex-column w-100 px-2"
5129
+ };
5130
+ const _hoisted_7$1 = ["checked", "disabled"];
5131
+ const _hoisted_8$1 = ["onClick"];
5132
+ const _hoisted_9$1 = {
5119
5133
  id: "permissions-content",
5120
5134
  class: "col-md-9 py-4 px-4"
5121
5135
  };
5122
- const _hoisted_7$1 = { class: "p-2 rounded-2 bg-white h-100" };
5123
- const _hoisted_8$1 = {
5136
+ const _hoisted_10 = { class: "p-2 rounded-2 bg-white h-100" };
5137
+ const _hoisted_11 = {
5124
5138
  key: 0,
5125
5139
  class: "alert alert-info"
5126
5140
  };
5127
- const _hoisted_9$1 = { key: 1 };
5128
- const _hoisted_10 = { class: "row row-cols-3" };
5129
- const _hoisted_11 = { class: "col" };
5130
- const _hoisted_12 = ["value"];
5131
- const _hoisted_13 = {
5141
+ const _hoisted_12 = { key: 1 };
5142
+ const _hoisted_13 = { class: "row row-cols-3" };
5143
+ const _hoisted_14 = { class: "col" };
5144
+ const _hoisted_15 = ["value"];
5145
+ const _hoisted_16 = {
5132
5146
  key: 0,
5133
5147
  class: "w-100 row"
5134
5148
  };
5135
- const _hoisted_14 = { class: "col-md-3" };
5136
- const _hoisted_15 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5149
+ const _hoisted_17 = { class: "col-md-3" };
5150
+ const _hoisted_18 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5137
5151
 
5138
5152
 
5139
5153
  var script$3 = {
@@ -5161,24 +5175,35 @@ const setModule = module=>{
5161
5175
  onMounted(() => {
5162
5176
  getDepartmentModules();
5163
5177
  });
5178
+ const loadingModules = ref(false);
5164
5179
  const getDepartmentModules = ()=>{
5165
- shApis.doGet(`admin/departments/department/list-all-modules/admin/${departmentId}`).then(res=>{
5180
+ loadingModules.value = true;
5181
+ shApis.doGet(`sh-departments/department/list-all-modules/sh-departments/${departmentId}`).then(res=>{
5182
+ loadingModules.value = false;
5166
5183
  modules.value = res.data.modules;
5167
5184
  department.value = res.data.department;
5168
5185
  departmentModules.value = res.data.departmentModules;
5169
5186
  selectedModule.value = res.data.modules[0];
5170
5187
  getModulePermissions();
5188
+ }).catch(ex=>{
5189
+ loadingModules.value = false;
5190
+ // console.log(ex)
5191
+ shRepo.showToast(ex.message, 'error');
5171
5192
  });
5172
5193
  };
5173
5194
  const loading = ref(false);
5174
5195
  const getModulePermissions = () => {
5175
5196
  loading.value = true;
5176
5197
  modulePermissions.value = null;
5177
- shApis.doGet(`admin/departments/department/get-module-permissions/${selectedModule.value}?department_id=${departmentId}`).then(res=>{
5198
+ shApis.doGet(`sh-departments/department/get-module-permissions/${selectedModule.value}?department_id=${departmentId}`).then(res=>{
5178
5199
  loading.value = false;
5179
5200
  modulePermissions.value = reformatModulePermissions(res.data.permissions);
5180
5201
  selectedPermissions.value = res.data.selectedPermissions ?? [];
5181
5202
  permissionsChanged.value = false;
5203
+ }).catch(ex=>{
5204
+ console.log(ex);
5205
+ loading.value = false;
5206
+ shRepo.showToast(ex.message, 'error');
5182
5207
  });
5183
5208
  };
5184
5209
  const permissionsUpdated = (res)=>{
@@ -5230,34 +5255,36 @@ const getPermissionStyle = permission => {
5230
5255
  return (_ctx, _cache) => {
5231
5256
  return (openBlock(), createElementBlock("div", _hoisted_1$3, [
5232
5257
  createElementVNode("div", _hoisted_2$3, [
5233
- createElementVNode("ul", _hoisted_3$3, [
5234
- (openBlock(true), createElementBlock(Fragment, null, renderList(modules.value, (module) => {
5235
- return (openBlock(), createElementBlock("li", {
5236
- class: normalizeClass(selectedModule.value === module && 'active'),
5237
- key: selectedModule.value
5238
- }, [
5239
- createElementVNode("input", {
5240
- checked: departmentModules.value.includes(module),
5241
- onClick: checkAllPermissions,
5242
- disabled: selectedModule.value !== module,
5243
- type: "checkbox"
5244
- }, null, 8 /* PROPS */, _hoisted_4$3),
5245
- createElementVNode("label", {
5246
- class: "text-capitalize",
5247
- onClick: $event => (setModule(module))
5248
- }, toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_5$3)
5249
- ], 2 /* CLASS */))
5250
- }), 128 /* KEYED_FRAGMENT */))
5251
- ])
5258
+ (loadingModules.value)
5259
+ ? (openBlock(), createElementBlock("div", _hoisted_3$3, _hoisted_5$3))
5260
+ : (openBlock(), createElementBlock("ul", _hoisted_6$2, [
5261
+ (openBlock(true), createElementBlock(Fragment, null, renderList(modules.value, (module) => {
5262
+ return (openBlock(), createElementBlock("li", {
5263
+ class: normalizeClass(selectedModule.value === module && 'active'),
5264
+ key: selectedModule.value
5265
+ }, [
5266
+ createElementVNode("input", {
5267
+ checked: departmentModules.value.includes(module),
5268
+ onClick: checkAllPermissions,
5269
+ disabled: selectedModule.value !== module,
5270
+ type: "checkbox"
5271
+ }, null, 8 /* PROPS */, _hoisted_7$1),
5272
+ createElementVNode("label", {
5273
+ class: "text-capitalize",
5274
+ onClick: $event => (setModule(module))
5275
+ }, toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_8$1)
5276
+ ], 2 /* CLASS */))
5277
+ }), 128 /* KEYED_FRAGMENT */))
5278
+ ]))
5252
5279
  ]),
5253
- createElementVNode("div", _hoisted_6$2, [
5254
- createElementVNode("div", _hoisted_7$1, [
5280
+ createElementVNode("div", _hoisted_9$1, [
5281
+ createElementVNode("div", _hoisted_10, [
5255
5282
  (loading.value)
5256
- ? (openBlock(), createElementBlock("div", _hoisted_8$1, " loading ... "))
5257
- : (openBlock(), createElementBlock("div", _hoisted_9$1, [
5258
- createElementVNode("div", _hoisted_10, [
5283
+ ? (openBlock(), createElementBlock("div", _hoisted_11, " loading ... "))
5284
+ : (openBlock(), createElementBlock("div", _hoisted_12, [
5285
+ createElementVNode("div", _hoisted_13, [
5259
5286
  (openBlock(true), createElementBlock(Fragment, null, renderList(modulePermissions.value, (permissions) => {
5260
- return (openBlock(), createElementBlock("div", _hoisted_11, [
5287
+ return (openBlock(), createElementBlock("div", _hoisted_14, [
5261
5288
  (openBlock(true), createElementBlock(Fragment, null, renderList(permissions, (permission) => {
5262
5289
  return (openBlock(), createElementBlock("label", {
5263
5290
  onClick: setPermissionsChanged,
@@ -5268,7 +5295,7 @@ return (_ctx, _cache) => {
5268
5295
  "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((selectedPermissions).value = $event)),
5269
5296
  value: permission,
5270
5297
  type: "checkbox"
5271
- }, null, 8 /* PROPS */, _hoisted_12), [
5298
+ }, null, 8 /* PROPS */, _hoisted_15), [
5272
5299
  [vModelCheckbox, selectedPermissions.value]
5273
5300
  ]),
5274
5301
  createTextVNode(" " + toDisplayString(getLabel(permission)), 1 /* TEXT */)
@@ -5278,16 +5305,16 @@ return (_ctx, _cache) => {
5278
5305
  }), 256 /* UNKEYED_FRAGMENT */))
5279
5306
  ]),
5280
5307
  (permissionsChanged.value)
5281
- ? (openBlock(), createElementBlock("div", _hoisted_13, [
5282
- createElementVNode("div", _hoisted_14, [
5308
+ ? (openBlock(), createElementBlock("div", _hoisted_16, [
5309
+ createElementVNode("div", _hoisted_17, [
5283
5310
  createVNode(script$7, {
5284
5311
  onSuccess: permissionsUpdated,
5285
- url: `admin/departments/department/permissions/${unref(departmentId)}/${selectedModule.value}`,
5312
+ url: `sh-departments/department/permissions/${unref(departmentId)}/${selectedModule.value}`,
5286
5313
  data: {permissions: selectedPermissions.value},
5287
5314
  class: "btn btn-primary d-block"
5288
5315
  }, {
5289
5316
  default: withCtx(() => [
5290
- _hoisted_15,
5317
+ _hoisted_18,
5291
5318
  createTextVNode(" Save")
5292
5319
  ]),
5293
5320
  _: 1 /* STABLE */
@@ -5351,7 +5378,7 @@ return (_ctx, _cache) => {
5351
5378
  ], 512 /* NEED_PATCH */),
5352
5379
  createVNode(script$6, {
5353
5380
  headers: ['id','name','description', 'created_at'],
5354
- "end-point": "admin/departments/list",
5381
+ "end-point": "sh-departments/list",
5355
5382
  actions: {
5356
5383
  label: 'Action',
5357
5384
  actions: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",