@iankibetsh/shframework 0.6.0 → 0.6.2

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.
@@ -31,21 +31,6 @@
31
31
  opacity: 0.5;
32
32
  }
33
33
 
34
- .sh-selected-item{
35
- line-height: unset!important;
36
- }
37
- .sh-suggestion-input{
38
- padding: 0.375rem 0.75rem;
39
- }
40
- .sh-suggest{
41
- margin-bottom: 1rem;
42
- }
43
- .sh-suggest-control::after{
44
- margin-top: auto;
45
- margin-bottom: auto;
46
- margin-right: 0.255em;
47
- }
48
-
49
34
  :root {
50
35
  --ck-z-default: 10555 !important;
51
36
  --ck-z-modal: calc(var(--ck-z-default) + 999) !important;
@@ -66,3 +51,18 @@
66
51
  width: 100% !important;
67
52
  }
68
53
  }
54
+
55
+ .sh-selected-item{
56
+ line-height: unset!important;
57
+ }
58
+ .sh-suggestion-input{
59
+ padding: 0.375rem 0.75rem;
60
+ }
61
+ .sh-suggest{
62
+ margin-bottom: 1rem;
63
+ }
64
+ .sh-suggest-control::after{
65
+ margin-top: auto;
66
+ margin-bottom: auto;
67
+ margin-right: 0.255em;
68
+ }
package/dist/library.js CHANGED
@@ -1771,14 +1771,14 @@ const _hoisted_2$9 = ["id"];
1771
1771
  const _hoisted_3$9 = { class: "badge bg-secondary m-1 sh-selected-item" };
1772
1772
  const _hoisted_4$9 = ["onClick"];
1773
1773
  const _hoisted_5$7 = ["id"];
1774
- const _hoisted_6$5 = ["id", "aria-labelledby"];
1775
- const _hoisted_7$4 = { key: 0 };
1776
- const _hoisted_8$3 = ["onClick"];
1777
- const _hoisted_9$3 = {
1774
+ const _hoisted_6$4 = ["id", "aria-labelledby"];
1775
+ const _hoisted_7$3 = { key: 0 };
1776
+ const _hoisted_8$2 = ["onClick"];
1777
+ const _hoisted_9$2 = {
1778
1778
  key: 1,
1779
1779
  class: "dropdown-item sh-suggest-no-results"
1780
1780
  };
1781
- const _hoisted_10$4 = {
1781
+ const _hoisted_10$3 = {
1782
1782
  key: 2,
1783
1783
  class: "dropdown-item sh-suggest-no-input"
1784
1784
  };
@@ -1903,20 +1903,20 @@ return (_ctx, _cache) => {
1903
1903
  key: suggestion.id
1904
1904
  }, [
1905
1905
  (suggestion.name)
1906
- ? (vue.openBlock(), vue.createElementBlock("li", _hoisted_7$4, [
1906
+ ? (vue.openBlock(), vue.createElementBlock("li", _hoisted_7$3, [
1907
1907
  vue.createElementVNode("a", {
1908
1908
  onClick: $event => (addSuggestion(suggestion)),
1909
1909
  class: vue.normalizeClass(["dropdown-item", vue.unref(selectedSuggestions).includes(suggestion) ? 'active':'']),
1910
1910
  href: "#"
1911
- }, vue.toDisplayString(suggestion.name ?? suggestion.text), 11 /* TEXT, CLASS, PROPS */, _hoisted_8$3)
1911
+ }, vue.toDisplayString(suggestion.name ?? suggestion.text), 11 /* TEXT, CLASS, PROPS */, _hoisted_8$2)
1912
1912
  ]))
1913
1913
  : vue.createCommentVNode("v-if", true)
1914
1914
  ], 64 /* STABLE_FRAGMENT */))
1915
1915
  }), 128 /* KEYED_FRAGMENT */))
1916
1916
  : (vue.unref(searchText))
1917
- ? (vue.openBlock(), vue.createElementBlock("li", _hoisted_9$3, " No results found "))
1918
- : (vue.openBlock(), vue.createElementBlock("li", _hoisted_10$4, " Type to search... "))
1919
- ], 8 /* PROPS */, _hoisted_6$5)
1917
+ ? (vue.openBlock(), vue.createElementBlock("li", _hoisted_9$2, " No results found "))
1918
+ : (vue.openBlock(), vue.createElementBlock("li", _hoisted_10$3, " Type to search... "))
1919
+ ], 8 /* PROPS */, _hoisted_6$4)
1920
1920
  ]))
1921
1921
  : vue.createCommentVNode("v-if", true)
1922
1922
  }
@@ -2251,15 +2251,15 @@ const _hoisted_2$8 = {
2251
2251
  const _hoisted_3$8 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-exclamation-triangle-fill me-1" }, null, -1 /* HOISTED */);
2252
2252
  const _hoisted_4$8 = { key: 0 };
2253
2253
  const _hoisted_5$6 = { key: 1 };
2254
- const _hoisted_6$4 = { class: "row" };
2255
- const _hoisted_7$3 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
2256
- const _hoisted_8$2 = { class: "col-md-12" };
2257
- const _hoisted_9$2 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
2258
- const _hoisted_10$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2259
- const _hoisted_11$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2260
- const _hoisted_12$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2261
- const _hoisted_13$3 = ["data-cy", "name", "onFocus", "onUpdate:modelValue"];
2262
- const _hoisted_14$3 = ["disabled", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2254
+ const _hoisted_6$3 = { class: "row" };
2255
+ const _hoisted_7$2 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
2256
+ const _hoisted_8$1 = { class: "col-md-12" };
2257
+ const _hoisted_9$1 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
2258
+ const _hoisted_10$2 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2259
+ const _hoisted_11$2 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2260
+ const _hoisted_12$2 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2261
+ const _hoisted_13$2 = ["data-cy", "name", "onFocus", "onUpdate:modelValue"];
2262
+ const _hoisted_14$2 = ["disabled", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2263
2263
  const _hoisted_15$2 = ["name", "onFocus", "onUpdate:modelValue"];
2264
2264
  const _hoisted_16$2 = ["name", "onFocus", "onUpdate:modelValue"];
2265
2265
  const _hoisted_17$2 = ["value"];
@@ -2327,14 +2327,14 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2327
2327
  }, null, 512 /* NEED_PATCH */), [
2328
2328
  [vue.vModelText, _ctx.form_elements['id']]
2329
2329
  ]),
2330
- vue.createElementVNode("div", _hoisted_6$4, [
2330
+ vue.createElementVNode("div", _hoisted_6$3, [
2331
2331
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.fields, (field) => {
2332
2332
  return (vue.openBlock(), vue.createElementBlock("div", {
2333
2333
  class: vue.normalizeClass(["form-group", 'col-md-' + $options.getColumns()]),
2334
2334
  key: field
2335
2335
  }, [
2336
- vue.createElementVNode("label", _hoisted_7$3, vue.toDisplayString($options.getLabel(field)), 1 /* TEXT */),
2337
- vue.createElementVNode("div", _hoisted_8$2, [
2336
+ vue.createElementVNode("label", _hoisted_7$2, vue.toDisplayString($options.getLabel(field)), 1 /* TEXT */),
2337
+ vue.createElementVNode("div", _hoisted_8$1, [
2338
2338
  ($options.getFieldType(field) === 'file')
2339
2339
  ? (vue.openBlock(), vue.createElementBlock("input", {
2340
2340
  key: 0,
@@ -2347,7 +2347,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2347
2347
  ref: 'file_'+field,
2348
2348
  onChange: $event => ($options.handleFileUpload(field)),
2349
2349
  type: "file"
2350
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_9$2))
2350
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_9$1))
2351
2351
  : vue.createCommentVNode("v-if", true),
2352
2352
  ($options.getFieldType(field) === 'numeric')
2353
2353
  ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
@@ -2359,7 +2359,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2359
2359
  class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2360
2360
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2361
2361
  type: "number"
2362
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_10$3)), [
2362
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_10$2)), [
2363
2363
  [vue.vModelText, _ctx.form_elements[field]]
2364
2364
  ])
2365
2365
  : vue.createCommentVNode("v-if", true),
@@ -2373,7 +2373,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2373
2373
  class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2374
2374
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2375
2375
  type: "password"
2376
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11$3)), [
2376
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11$2)), [
2377
2377
  [vue.vModelText, _ctx.form_elements[field]]
2378
2378
  ])
2379
2379
  : vue.createCommentVNode("v-if", true),
@@ -2388,7 +2388,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2388
2388
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2389
2389
  type: "email",
2390
2390
  required: ""
2391
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_12$3)), [
2391
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_12$2)), [
2392
2392
  [vue.vModelText, _ctx.form_elements[field]]
2393
2393
  ])
2394
2394
  : vue.createCommentVNode("v-if", true),
@@ -2401,7 +2401,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2401
2401
  onFocus: $event => ($options.removeErrors(field)),
2402
2402
  class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control active"]),
2403
2403
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
2404
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_13$3)), [
2404
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_13$2)), [
2405
2405
  [vue.vModelText, _ctx.form_elements[field]]
2406
2406
  ])
2407
2407
  : vue.createCommentVNode("v-if", true),
@@ -2449,7 +2449,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2449
2449
  class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2450
2450
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2451
2451
  type: "text"
2452
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_14$3)), [
2452
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_14$2)), [
2453
2453
  [vue.vModelText, _ctx.form_elements[field]]
2454
2454
  ])
2455
2455
  : vue.createCommentVNode("v-if", true),
@@ -2581,8 +2581,8 @@ const _hoisted_5$5 = /*#__PURE__*/vue.createElementVNode("button", {
2581
2581
  "data-bs-dismiss": "modal",
2582
2582
  "data-dismiss": "modal"
2583
2583
  }, "×", -1 /* HOISTED */);
2584
- const _hoisted_6$3 = { class: "modal-body" };
2585
- const _hoisted_7$2 = { class: "section" };
2584
+ const _hoisted_6$2 = { class: "modal-body" };
2585
+ const _hoisted_7$1 = { class: "section" };
2586
2586
 
2587
2587
  function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2588
2588
  return (vue.openBlock(), vue.createElementBlock("div", {
@@ -2600,8 +2600,8 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2600
2600
  vue.createElementVNode("h3", _hoisted_4$6, vue.toDisplayString($props.modalTitle), 1 /* TEXT */),
2601
2601
  _hoisted_5$5
2602
2602
  ]),
2603
- vue.createElementVNode("div", _hoisted_6$3, [
2604
- vue.createElementVNode("div", _hoisted_7$2, [
2603
+ vue.createElementVNode("div", _hoisted_6$2, [
2604
+ vue.createElementVNode("div", _hoisted_7$1, [
2605
2605
  vue.renderSlot(_ctx.$slots, "default")
2606
2606
  ])
2607
2607
  ])
@@ -2689,16 +2689,16 @@ const _hoisted_2$5 = { class: "record_count_body mb-3" };
2689
2689
  const _hoisted_3$5 = /*#__PURE__*/vue.createElementVNode("span", { class: "per_page_show" }, "Showing", -1 /* HOISTED */);
2690
2690
  const _hoisted_4$5 = /*#__PURE__*/vue.createTextVNode("  ");
2691
2691
  const _hoisted_5$4 = /*#__PURE__*/vue.createStaticVNode("<option value=\"10\">10</option><option value=\"25\">25</option><option value=\"50\">50</option><option value=\"100\">100</option><option value=\"200\">200</option>", 5);
2692
- const _hoisted_10$2 = [
2692
+ const _hoisted_10$1 = [
2693
2693
  _hoisted_5$4
2694
2694
  ];
2695
- const _hoisted_11$2 = { class: "record_counts" };
2696
- const _hoisted_12$2 = {
2695
+ const _hoisted_11$1 = { class: "record_counts" };
2696
+ const _hoisted_12$1 = {
2697
2697
  key: 0,
2698
2698
  "aria-label": "Page navigation"
2699
2699
  };
2700
- const _hoisted_13$2 = { class: "pagination" };
2701
- const _hoisted_14$2 = {
2700
+ const _hoisted_13$1 = { class: "pagination" };
2701
+ const _hoisted_14$1 = {
2702
2702
  key: 0,
2703
2703
  class: "page-link"
2704
2704
  };
@@ -2739,14 +2739,14 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2739
2739
  class: "select_per_page",
2740
2740
  onChange: _cache[0] || (_cache[0] = (...args) => ($options.changePerPage && $options.changePerPage(...args))),
2741
2741
  "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.per_page) = $event))
2742
- }, _hoisted_10$2, 544 /* HYDRATE_EVENTS, NEED_PATCH */), [
2742
+ }, _hoisted_10$1, 544 /* HYDRATE_EVENTS, NEED_PATCH */), [
2743
2743
  [vue.vModelSelect, $data.per_page]
2744
2744
  ]),
2745
- vue.createElementVNode("span", _hoisted_11$2, " of " + vue.toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
2745
+ vue.createElementVNode("span", _hoisted_11$1, " of " + vue.toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
2746
2746
  ]),
2747
2747
  ($props.pagination_data != null)
2748
- ? (vue.openBlock(), vue.createElementBlock("nav", _hoisted_12$2, [
2749
- vue.createElementVNode("ul", _hoisted_13$2, [
2748
+ ? (vue.openBlock(), vue.createElementBlock("nav", _hoisted_12$1, [
2749
+ vue.createElementVNode("ul", _hoisted_13$1, [
2750
2750
  vue.createElementVNode("li", {
2751
2751
  class: vue.normalizeClass([$options.getActivePage === 1 ? 'disabled' : '' , "page-item"])
2752
2752
  }, [
@@ -2761,7 +2761,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2761
2761
  key: page
2762
2762
  }, [
2763
2763
  ($options.getActivePage === page)
2764
- ? (vue.openBlock(), vue.createElementBlock("a", _hoisted_14$2, vue.toDisplayString(page), 1 /* TEXT */))
2764
+ ? (vue.openBlock(), vue.createElementBlock("a", _hoisted_14$1, vue.toDisplayString(page), 1 /* TEXT */))
2765
2765
  : (['..','...'].includes(page))
2766
2766
  ? (vue.openBlock(), vue.createElementBlock("a", _hoisted_15$1, vue.toDisplayString(page), 1 /* TEXT */))
2767
2767
  : (vue.openBlock(), vue.createElementBlock("a", {
@@ -2965,7 +2965,7 @@ function formatDate(date, format) {
2965
2965
  return moment__default["default"](date).format(format)
2966
2966
  }
2967
2967
 
2968
- var helpers = {
2968
+ var shRepo$1 = {
2969
2969
  swalSuccess,
2970
2970
  swalError,
2971
2971
  runPlainRequest,
@@ -3116,7 +3116,7 @@ var script$4 = {
3116
3116
  console.log(reason);
3117
3117
  this.downloading = false;
3118
3118
  const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText}`;
3119
- helpers.swalError('Error', error);
3119
+ shRepo$1.swalError('Error', error);
3120
3120
  });
3121
3121
  },
3122
3122
  reloadData: function (page, append) {
@@ -3203,31 +3203,31 @@ const _hoisted_2$4 = {
3203
3203
  const _hoisted_3$4 = ["disabled"];
3204
3204
  const _hoisted_4$4 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */);
3205
3205
  const _hoisted_5$3 = /*#__PURE__*/vue.createTextVNode(" Export ");
3206
- const _hoisted_6$2 = /*#__PURE__*/vue.createElementVNode("span", {
3206
+ const _hoisted_6$1 = /*#__PURE__*/vue.createElementVNode("span", {
3207
3207
  class: "spinner-border spinner-border-sm",
3208
3208
  role: "status",
3209
3209
  "aria-hidden": "true"
3210
3210
  }, null, -1 /* HOISTED */);
3211
- const _hoisted_7$1 = /*#__PURE__*/vue.createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* HOISTED */);
3212
- const _hoisted_8$1 = {
3211
+ const _hoisted_7 = /*#__PURE__*/vue.createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* HOISTED */);
3212
+ const _hoisted_8 = {
3213
3213
  key: 1,
3214
3214
  class: "row"
3215
3215
  };
3216
- const _hoisted_9$1 = { class: "col-12 mb-3" };
3217
- const _hoisted_10$1 = { class: "sh-search-bar" };
3218
- const _hoisted_11$1 = ["placeholder"];
3219
- const _hoisted_12$1 = {
3216
+ const _hoisted_9 = { class: "col-12 mb-3" };
3217
+ const _hoisted_10 = { class: "sh-search-bar" };
3218
+ const _hoisted_11 = ["placeholder"];
3219
+ const _hoisted_12 = {
3220
3220
  key: 0,
3221
3221
  class: "text-center"
3222
3222
  };
3223
- const _hoisted_13$1 = /*#__PURE__*/vue.createElementVNode("div", {
3223
+ const _hoisted_13 = /*#__PURE__*/vue.createElementVNode("div", {
3224
3224
  class: "spinner-border",
3225
3225
  role: "status"
3226
3226
  }, [
3227
3227
  /*#__PURE__*/vue.createElementVNode("span", { class: "visually-hidden" }, "Loading...")
3228
3228
  ], -1 /* HOISTED */);
3229
- const _hoisted_14$1 = [
3230
- _hoisted_13$1
3229
+ const _hoisted_14 = [
3230
+ _hoisted_13
3231
3231
  ];
3232
3232
  const _hoisted_15 = {
3233
3233
  key: 1,
@@ -3372,23 +3372,23 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3372
3372
  _hoisted_5$3
3373
3373
  ], 64 /* STABLE_FRAGMENT */))
3374
3374
  : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
3375
- _hoisted_6$2,
3376
- _hoisted_7$1
3375
+ _hoisted_6$1,
3376
+ _hoisted_7
3377
3377
  ], 64 /* STABLE_FRAGMENT */))
3378
3378
  ], 8 /* PROPS */, _hoisted_3$4)
3379
3379
  ]))
3380
3380
  : vue.createCommentVNode("v-if", true),
3381
3381
  (!$props.hideSearch)
3382
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$1, [
3383
- vue.createElementVNode("div", _hoisted_9$1, [
3384
- vue.createElementVNode("div", _hoisted_10$1, [
3382
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
3383
+ vue.createElementVNode("div", _hoisted_9, [
3384
+ vue.createElementVNode("div", _hoisted_10, [
3385
3385
  vue.withDirectives(vue.createElementVNode("input", {
3386
3386
  type: "search",
3387
3387
  onChange: _cache[1] || (_cache[1] = $event => ($options.reloadData(1))),
3388
3388
  "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => (($data.filter_value) = $event)),
3389
3389
  placeholder: $props.searchPlaceholder ? $props.searchPlaceholder : 'Search',
3390
3390
  class: "form-control sh-search-input"
3391
- }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_11$1), [
3391
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_11), [
3392
3392
  [vue.vModelText, $data.filter_value]
3393
3393
  ])
3394
3394
  ])
@@ -3398,7 +3398,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3398
3398
  ($options.hasDefaultSlot)
3399
3399
  ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
3400
3400
  ($data.loading === 'loading')
3401
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$1, _hoisted_14$1))
3401
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12, _hoisted_14))
3402
3402
  : ($data.loading === 'error')
3403
3403
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_15, [
3404
3404
  vue.createElementVNode("span", _hoisted_16, vue.toDisplayString($data.loading_error), 1 /* TEXT */)
@@ -3986,7 +3986,7 @@ const _hoisted_2$1 = {
3986
3986
  "data-bs-toggle": "modal",
3987
3987
  ref: "addDeptBtn",
3988
3988
  href: "#department_modal",
3989
- class: "btn btn-info"
3989
+ class: "btn btn-info btn-sm"
3990
3990
  };
3991
3991
  const _hoisted_3$1 = /*#__PURE__*/vue.createElementVNode("i", { class: "fa fa-plus" }, null, -1 /* HOISTED */);
3992
3992
  const _hoisted_4$1 = /*#__PURE__*/vue.createTextVNode(" ADD DEPARTMENT");
@@ -3994,32 +3994,17 @@ const _hoisted_5$1 = [
3994
3994
  _hoisted_3$1,
3995
3995
  _hoisted_4$1
3996
3996
  ];
3997
- const _hoisted_6$1 = /*#__PURE__*/vue.createElementVNode("i", { class: "fa fa-plus" }, null, -1 /* HOISTED */);
3998
- const _hoisted_7 = /*#__PURE__*/vue.createTextVNode(" ADD DEPARTMENT");
3999
- const _hoisted_8 = [
4000
- _hoisted_6$1,
4001
- _hoisted_7
4002
- ];
4003
- const _hoisted_9 = /*#__PURE__*/vue.createTextVNode("Permissions for ");
4004
- const _hoisted_10 = { class: "text-primary" };
4005
- const _hoisted_11 = ["value"];
4006
- const _hoisted_12 = /*#__PURE__*/vue.createElementVNode("i", { class: "fa fa-save" }, null, -1 /* HOISTED */);
4007
- const _hoisted_13 = /*#__PURE__*/vue.createTextVNode(" Submit");
4008
- const _hoisted_14 = [
4009
- _hoisted_12,
4010
- _hoisted_13
4011
- ];
4012
3997
 
4013
3998
 
4014
3999
  var script$1 = {
4015
4000
  __name: 'Departments',
4016
4001
  setup(__props) {
4017
4002
 
4018
- let editingDepartment = vue.ref(null);
4003
+ vue.ref(null);
4019
4004
  let allPermissions = vue.ref([]);
4020
- let permissions = vue.ref([]);
4005
+ vue.ref([]);
4021
4006
  let reload = vue.ref(0);
4022
- let permissionsModalBtn = vue.ref(null);
4007
+ vue.ref(null);
4023
4008
 
4024
4009
  vue.onMounted(() => {
4025
4010
  shApis$1.doGet('admin/departments/all-permissions').then(res => {
@@ -4027,43 +4012,17 @@ vue.onMounted(() => {
4027
4012
  });
4028
4013
  });
4029
4014
 
4030
-
4031
- function getPermissionLeft (menu) {
4032
- const len = menu.split('.').length * 2;
4033
- if (len > 5) {
4034
- return 5
4035
- }
4036
- return len
4037
- }
4038
- function getPermissionLabel (menu) {
4039
- const arr = menu.split('.');
4040
- return arr[arr.length - 1].replace(/_/g, ' ')
4041
- }
4042
4015
  function departmentAdded (response) {
4043
4016
  this.reload += 1;
4044
4017
  }
4045
4018
 
4046
- function rowSelected(department) {
4047
- editingDepartment.value = department;
4048
- if (department.permissions) {
4049
- this.permissions = JSON.parse(department.permissions);
4050
- }
4051
- }
4052
-
4053
4019
  return (_ctx, _cache) => {
4054
4020
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
4055
4021
  _hoisted_1$1,
4056
4022
  vue.createElementVNode("a", _hoisted_2$1, _hoisted_5$1, 512 /* NEED_PATCH */),
4057
- vue.createElementVNode("a", {
4058
- "data-bs-toggle": "modal",
4059
- ref_key: "permissionsModalBtn",
4060
- ref: permissionsModalBtn,
4061
- href: "#permissions_modal",
4062
- class: "btn btn-info d-none"
4063
- }, _hoisted_8, 512 /* NEED_PATCH */),
4064
4023
  vue.createVNode(script$4, {
4065
4024
  reload: vue.unref(reload),
4066
- onRowSelected: rowSelected,
4025
+ onRowSelected: _ctx.rowSelected,
4067
4026
  headers: ['id','name','description', 'created_at'],
4068
4027
  "end-point": "admin/departments/list",
4069
4028
  actions: {
@@ -4071,15 +4030,15 @@ return (_ctx, _cache) => {
4071
4030
  actions: [
4072
4031
  {
4073
4032
  label: 'Permissions',
4074
- path: '/admin/departments/permissions/{id}',
4075
- class: 'btn btn-info bi-lock'
4033
+ path: '/sh-departments/permissions/{id}',
4034
+ class: 'btn btn-info bi-lock btn-sm'
4076
4035
  }
4077
4036
  ]
4078
4037
  }
4079
- }, null, 8 /* PROPS */, ["reload"]),
4038
+ }, null, 8 /* PROPS */, ["reload", "onRowSelected"]),
4080
4039
  vue.createVNode(script$6, {
4081
- modal_id: "department_modal",
4082
- modal_title: "Department Form"
4040
+ "modal-id": "department_modal",
4041
+ "modal-title": "Department Form"
4083
4042
  }, {
4084
4043
  default: vue.withCtx(() => [
4085
4044
  vue.createVNode(script$8, {
@@ -4090,45 +4049,6 @@ return (_ctx, _cache) => {
4090
4049
  })
4091
4050
  ]),
4092
4051
  _: 1 /* STABLE */
4093
- }),
4094
- vue.createVNode(script$6, {
4095
- modal_id: "permissions_modal",
4096
- modal_title: "Edit Department Permissions"
4097
- }, {
4098
- default: vue.withCtx(() => [
4099
- (vue.unref(allPermissions) && vue.unref(editingDepartment))
4100
- ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
4101
- vue.createElementVNode("h3", null, [
4102
- _hoisted_9,
4103
- vue.createElementVNode("span", _hoisted_10, vue.toDisplayString(vue.unref(editingDepartment).name), 1 /* TEXT */)
4104
- ]),
4105
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(allPermissions), (permission) => {
4106
- return (vue.openBlock(), vue.createElementBlock("div", {
4107
- key: permission,
4108
- class: "list-group p-0"
4109
- }, [
4110
- vue.createElementVNode("label", {
4111
- class: vue.normalizeClass(["list-group-item pb-0 text-capitalize", 'ms-' + getPermissionLeft(permission)])
4112
- }, [
4113
- vue.withDirectives(vue.createElementVNode("input", {
4114
- type: "checkbox",
4115
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (vue.isRef(permissions) ? (permissions).value = $event : permissions = $event)),
4116
- value: permission
4117
- }, null, 8 /* PROPS */, _hoisted_11), [
4118
- [vue.vModelCheckbox, vue.unref(permissions)]
4119
- ]),
4120
- vue.createTextVNode(" " + vue.toDisplayString(getPermissionLabel(permission)), 1 /* TEXT */)
4121
- ], 2 /* CLASS */)
4122
- ]))
4123
- }), 128 /* KEYED_FRAGMENT */)),
4124
- vue.createElementVNode("button", {
4125
- onClick: _cache[1] || (_cache[1] = (...args) => (_ctx.submitPermissions && _ctx.submitPermissions(...args))),
4126
- class: "btn btn-info"
4127
- }, _hoisted_14)
4128
- ], 64 /* STABLE_FRAGMENT */))
4129
- : vue.createCommentVNode("v-if", true)
4130
- ]),
4131
- _: 1 /* STABLE */
4132
4052
  })
4133
4053
  ], 64 /* STABLE_FRAGMENT */))
4134
4054
  }
@@ -4280,7 +4200,9 @@ return (_ctx, _cache) => {
4280
4200
  "success-callback": moduleAdded,
4281
4201
  "fill-selects": {
4282
4202
  permission_module: {
4283
- url: 'admin/departments/department/list-pending-modules/' + id.value
4203
+ url: 'admin/departments/department/list-pending-modules/' + id.value,
4204
+ suggests: true,
4205
+ allowMultiple: true
4284
4206
  }
4285
4207
  },
4286
4208
  fields: ['permission_module'],
@@ -4370,6 +4292,6 @@ exports.ShPhone = script$b;
4370
4292
  exports.ShTable = script$4;
4371
4293
  exports.ShTabs = script$3;
4372
4294
  exports.shApis = shApis$1;
4373
- exports.shRepo = helpers;
4295
+ exports.shRepo = shRepo$1;
4374
4296
  exports.shStorage = ShStorage;
4375
4297
  exports.useUserStore = useUserStore;
package/dist/library.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import Axios from 'axios';
2
2
  import moment from 'moment';
3
- import { inject, openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, resolveComponent, withModifiers, createVNode, ref, onMounted, unref, normalizeClass, createBlock, renderSlot, createStaticVNode, withCtx, shallowRef, resolveDynamicComponent, isRef, vModelCheckbox, computed } from 'vue';
3
+ import { inject, openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, resolveComponent, withModifiers, createVNode, ref, onMounted, unref, normalizeClass, createBlock, renderSlot, createStaticVNode, withCtx, shallowRef, resolveDynamicComponent, computed, isRef, vModelCheckbox } from 'vue';
4
4
  import NProgress from 'nprogress';
5
5
  import Editor from '@tinymce/tinymce-vue';
6
6
  import Swal from 'sweetalert2';
@@ -1759,14 +1759,14 @@ const _hoisted_2$9 = ["id"];
1759
1759
  const _hoisted_3$9 = { class: "badge bg-secondary m-1 sh-selected-item" };
1760
1760
  const _hoisted_4$9 = ["onClick"];
1761
1761
  const _hoisted_5$7 = ["id"];
1762
- const _hoisted_6$5 = ["id", "aria-labelledby"];
1763
- const _hoisted_7$4 = { key: 0 };
1764
- const _hoisted_8$3 = ["onClick"];
1765
- const _hoisted_9$3 = {
1762
+ const _hoisted_6$4 = ["id", "aria-labelledby"];
1763
+ const _hoisted_7$3 = { key: 0 };
1764
+ const _hoisted_8$2 = ["onClick"];
1765
+ const _hoisted_9$2 = {
1766
1766
  key: 1,
1767
1767
  class: "dropdown-item sh-suggest-no-results"
1768
1768
  };
1769
- const _hoisted_10$4 = {
1769
+ const _hoisted_10$3 = {
1770
1770
  key: 2,
1771
1771
  class: "dropdown-item sh-suggest-no-input"
1772
1772
  };
@@ -1891,20 +1891,20 @@ return (_ctx, _cache) => {
1891
1891
  key: suggestion.id
1892
1892
  }, [
1893
1893
  (suggestion.name)
1894
- ? (openBlock(), createElementBlock("li", _hoisted_7$4, [
1894
+ ? (openBlock(), createElementBlock("li", _hoisted_7$3, [
1895
1895
  createElementVNode("a", {
1896
1896
  onClick: $event => (addSuggestion(suggestion)),
1897
1897
  class: normalizeClass(["dropdown-item", unref(selectedSuggestions).includes(suggestion) ? 'active':'']),
1898
1898
  href: "#"
1899
- }, toDisplayString(suggestion.name ?? suggestion.text), 11 /* TEXT, CLASS, PROPS */, _hoisted_8$3)
1899
+ }, toDisplayString(suggestion.name ?? suggestion.text), 11 /* TEXT, CLASS, PROPS */, _hoisted_8$2)
1900
1900
  ]))
1901
1901
  : createCommentVNode("v-if", true)
1902
1902
  ], 64 /* STABLE_FRAGMENT */))
1903
1903
  }), 128 /* KEYED_FRAGMENT */))
1904
1904
  : (unref(searchText))
1905
- ? (openBlock(), createElementBlock("li", _hoisted_9$3, " No results found "))
1906
- : (openBlock(), createElementBlock("li", _hoisted_10$4, " Type to search... "))
1907
- ], 8 /* PROPS */, _hoisted_6$5)
1905
+ ? (openBlock(), createElementBlock("li", _hoisted_9$2, " No results found "))
1906
+ : (openBlock(), createElementBlock("li", _hoisted_10$3, " Type to search... "))
1907
+ ], 8 /* PROPS */, _hoisted_6$4)
1908
1908
  ]))
1909
1909
  : createCommentVNode("v-if", true)
1910
1910
  }
@@ -2239,15 +2239,15 @@ const _hoisted_2$8 = {
2239
2239
  const _hoisted_3$8 = /*#__PURE__*/createElementVNode("i", { class: "bi-exclamation-triangle-fill me-1" }, null, -1 /* HOISTED */);
2240
2240
  const _hoisted_4$8 = { key: 0 };
2241
2241
  const _hoisted_5$6 = { key: 1 };
2242
- const _hoisted_6$4 = { class: "row" };
2243
- const _hoisted_7$3 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
2244
- const _hoisted_8$2 = { class: "col-md-12" };
2245
- const _hoisted_9$2 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
2246
- const _hoisted_10$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2247
- const _hoisted_11$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2248
- const _hoisted_12$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2249
- const _hoisted_13$3 = ["data-cy", "name", "onFocus", "onUpdate:modelValue"];
2250
- const _hoisted_14$3 = ["disabled", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2242
+ const _hoisted_6$3 = { class: "row" };
2243
+ const _hoisted_7$2 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
2244
+ const _hoisted_8$1 = { class: "col-md-12" };
2245
+ const _hoisted_9$1 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
2246
+ const _hoisted_10$2 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2247
+ const _hoisted_11$2 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2248
+ const _hoisted_12$2 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2249
+ const _hoisted_13$2 = ["data-cy", "name", "onFocus", "onUpdate:modelValue"];
2250
+ const _hoisted_14$2 = ["disabled", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2251
2251
  const _hoisted_15$2 = ["name", "onFocus", "onUpdate:modelValue"];
2252
2252
  const _hoisted_16$2 = ["name", "onFocus", "onUpdate:modelValue"];
2253
2253
  const _hoisted_17$2 = ["value"];
@@ -2315,14 +2315,14 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2315
2315
  }, null, 512 /* NEED_PATCH */), [
2316
2316
  [vModelText, _ctx.form_elements['id']]
2317
2317
  ]),
2318
- createElementVNode("div", _hoisted_6$4, [
2318
+ createElementVNode("div", _hoisted_6$3, [
2319
2319
  (openBlock(true), createElementBlock(Fragment, null, renderList($props.fields, (field) => {
2320
2320
  return (openBlock(), createElementBlock("div", {
2321
2321
  class: normalizeClass(["form-group", 'col-md-' + $options.getColumns()]),
2322
2322
  key: field
2323
2323
  }, [
2324
- createElementVNode("label", _hoisted_7$3, toDisplayString($options.getLabel(field)), 1 /* TEXT */),
2325
- createElementVNode("div", _hoisted_8$2, [
2324
+ createElementVNode("label", _hoisted_7$2, toDisplayString($options.getLabel(field)), 1 /* TEXT */),
2325
+ createElementVNode("div", _hoisted_8$1, [
2326
2326
  ($options.getFieldType(field) === 'file')
2327
2327
  ? (openBlock(), createElementBlock("input", {
2328
2328
  key: 0,
@@ -2335,7 +2335,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2335
2335
  ref: 'file_'+field,
2336
2336
  onChange: $event => ($options.handleFileUpload(field)),
2337
2337
  type: "file"
2338
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_9$2))
2338
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_9$1))
2339
2339
  : createCommentVNode("v-if", true),
2340
2340
  ($options.getFieldType(field) === 'numeric')
2341
2341
  ? withDirectives((openBlock(), createElementBlock("input", {
@@ -2347,7 +2347,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2347
2347
  class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2348
2348
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2349
2349
  type: "number"
2350
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_10$3)), [
2350
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_10$2)), [
2351
2351
  [vModelText, _ctx.form_elements[field]]
2352
2352
  ])
2353
2353
  : createCommentVNode("v-if", true),
@@ -2361,7 +2361,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2361
2361
  class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2362
2362
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2363
2363
  type: "password"
2364
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11$3)), [
2364
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11$2)), [
2365
2365
  [vModelText, _ctx.form_elements[field]]
2366
2366
  ])
2367
2367
  : createCommentVNode("v-if", true),
@@ -2376,7 +2376,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2376
2376
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2377
2377
  type: "email",
2378
2378
  required: ""
2379
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_12$3)), [
2379
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_12$2)), [
2380
2380
  [vModelText, _ctx.form_elements[field]]
2381
2381
  ])
2382
2382
  : createCommentVNode("v-if", true),
@@ -2389,7 +2389,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2389
2389
  onFocus: $event => ($options.removeErrors(field)),
2390
2390
  class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control active"]),
2391
2391
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
2392
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_13$3)), [
2392
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_13$2)), [
2393
2393
  [vModelText, _ctx.form_elements[field]]
2394
2394
  ])
2395
2395
  : createCommentVNode("v-if", true),
@@ -2437,7 +2437,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2437
2437
  class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2438
2438
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2439
2439
  type: "text"
2440
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_14$3)), [
2440
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_14$2)), [
2441
2441
  [vModelText, _ctx.form_elements[field]]
2442
2442
  ])
2443
2443
  : createCommentVNode("v-if", true),
@@ -2569,8 +2569,8 @@ const _hoisted_5$5 = /*#__PURE__*/createElementVNode("button", {
2569
2569
  "data-bs-dismiss": "modal",
2570
2570
  "data-dismiss": "modal"
2571
2571
  }, "×", -1 /* HOISTED */);
2572
- const _hoisted_6$3 = { class: "modal-body" };
2573
- const _hoisted_7$2 = { class: "section" };
2572
+ const _hoisted_6$2 = { class: "modal-body" };
2573
+ const _hoisted_7$1 = { class: "section" };
2574
2574
 
2575
2575
  function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2576
2576
  return (openBlock(), createElementBlock("div", {
@@ -2588,8 +2588,8 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2588
2588
  createElementVNode("h3", _hoisted_4$6, toDisplayString($props.modalTitle), 1 /* TEXT */),
2589
2589
  _hoisted_5$5
2590
2590
  ]),
2591
- createElementVNode("div", _hoisted_6$3, [
2592
- createElementVNode("div", _hoisted_7$2, [
2591
+ createElementVNode("div", _hoisted_6$2, [
2592
+ createElementVNode("div", _hoisted_7$1, [
2593
2593
  renderSlot(_ctx.$slots, "default")
2594
2594
  ])
2595
2595
  ])
@@ -2677,16 +2677,16 @@ const _hoisted_2$5 = { class: "record_count_body mb-3" };
2677
2677
  const _hoisted_3$5 = /*#__PURE__*/createElementVNode("span", { class: "per_page_show" }, "Showing", -1 /* HOISTED */);
2678
2678
  const _hoisted_4$5 = /*#__PURE__*/createTextVNode("  ");
2679
2679
  const _hoisted_5$4 = /*#__PURE__*/createStaticVNode("<option value=\"10\">10</option><option value=\"25\">25</option><option value=\"50\">50</option><option value=\"100\">100</option><option value=\"200\">200</option>", 5);
2680
- const _hoisted_10$2 = [
2680
+ const _hoisted_10$1 = [
2681
2681
  _hoisted_5$4
2682
2682
  ];
2683
- const _hoisted_11$2 = { class: "record_counts" };
2684
- const _hoisted_12$2 = {
2683
+ const _hoisted_11$1 = { class: "record_counts" };
2684
+ const _hoisted_12$1 = {
2685
2685
  key: 0,
2686
2686
  "aria-label": "Page navigation"
2687
2687
  };
2688
- const _hoisted_13$2 = { class: "pagination" };
2689
- const _hoisted_14$2 = {
2688
+ const _hoisted_13$1 = { class: "pagination" };
2689
+ const _hoisted_14$1 = {
2690
2690
  key: 0,
2691
2691
  class: "page-link"
2692
2692
  };
@@ -2727,14 +2727,14 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2727
2727
  class: "select_per_page",
2728
2728
  onChange: _cache[0] || (_cache[0] = (...args) => ($options.changePerPage && $options.changePerPage(...args))),
2729
2729
  "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.per_page) = $event))
2730
- }, _hoisted_10$2, 544 /* HYDRATE_EVENTS, NEED_PATCH */), [
2730
+ }, _hoisted_10$1, 544 /* HYDRATE_EVENTS, NEED_PATCH */), [
2731
2731
  [vModelSelect, $data.per_page]
2732
2732
  ]),
2733
- createElementVNode("span", _hoisted_11$2, " of " + toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
2733
+ createElementVNode("span", _hoisted_11$1, " of " + toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
2734
2734
  ]),
2735
2735
  ($props.pagination_data != null)
2736
- ? (openBlock(), createElementBlock("nav", _hoisted_12$2, [
2737
- createElementVNode("ul", _hoisted_13$2, [
2736
+ ? (openBlock(), createElementBlock("nav", _hoisted_12$1, [
2737
+ createElementVNode("ul", _hoisted_13$1, [
2738
2738
  createElementVNode("li", {
2739
2739
  class: normalizeClass([$options.getActivePage === 1 ? 'disabled' : '' , "page-item"])
2740
2740
  }, [
@@ -2749,7 +2749,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2749
2749
  key: page
2750
2750
  }, [
2751
2751
  ($options.getActivePage === page)
2752
- ? (openBlock(), createElementBlock("a", _hoisted_14$2, toDisplayString(page), 1 /* TEXT */))
2752
+ ? (openBlock(), createElementBlock("a", _hoisted_14$1, toDisplayString(page), 1 /* TEXT */))
2753
2753
  : (['..','...'].includes(page))
2754
2754
  ? (openBlock(), createElementBlock("a", _hoisted_15$1, toDisplayString(page), 1 /* TEXT */))
2755
2755
  : (openBlock(), createElementBlock("a", {
@@ -2953,7 +2953,7 @@ function formatDate(date, format) {
2953
2953
  return moment(date).format(format)
2954
2954
  }
2955
2955
 
2956
- var helpers = {
2956
+ var shRepo$1 = {
2957
2957
  swalSuccess,
2958
2958
  swalError,
2959
2959
  runPlainRequest,
@@ -3104,7 +3104,7 @@ var script$4 = {
3104
3104
  console.log(reason);
3105
3105
  this.downloading = false;
3106
3106
  const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText}`;
3107
- helpers.swalError('Error', error);
3107
+ shRepo$1.swalError('Error', error);
3108
3108
  });
3109
3109
  },
3110
3110
  reloadData: function (page, append) {
@@ -3191,31 +3191,31 @@ const _hoisted_2$4 = {
3191
3191
  const _hoisted_3$4 = ["disabled"];
3192
3192
  const _hoisted_4$4 = /*#__PURE__*/createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */);
3193
3193
  const _hoisted_5$3 = /*#__PURE__*/createTextVNode(" Export ");
3194
- const _hoisted_6$2 = /*#__PURE__*/createElementVNode("span", {
3194
+ const _hoisted_6$1 = /*#__PURE__*/createElementVNode("span", {
3195
3195
  class: "spinner-border spinner-border-sm",
3196
3196
  role: "status",
3197
3197
  "aria-hidden": "true"
3198
3198
  }, null, -1 /* HOISTED */);
3199
- const _hoisted_7$1 = /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* HOISTED */);
3200
- const _hoisted_8$1 = {
3199
+ const _hoisted_7 = /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* HOISTED */);
3200
+ const _hoisted_8 = {
3201
3201
  key: 1,
3202
3202
  class: "row"
3203
3203
  };
3204
- const _hoisted_9$1 = { class: "col-12 mb-3" };
3205
- const _hoisted_10$1 = { class: "sh-search-bar" };
3206
- const _hoisted_11$1 = ["placeholder"];
3207
- const _hoisted_12$1 = {
3204
+ const _hoisted_9 = { class: "col-12 mb-3" };
3205
+ const _hoisted_10 = { class: "sh-search-bar" };
3206
+ const _hoisted_11 = ["placeholder"];
3207
+ const _hoisted_12 = {
3208
3208
  key: 0,
3209
3209
  class: "text-center"
3210
3210
  };
3211
- const _hoisted_13$1 = /*#__PURE__*/createElementVNode("div", {
3211
+ const _hoisted_13 = /*#__PURE__*/createElementVNode("div", {
3212
3212
  class: "spinner-border",
3213
3213
  role: "status"
3214
3214
  }, [
3215
3215
  /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...")
3216
3216
  ], -1 /* HOISTED */);
3217
- const _hoisted_14$1 = [
3218
- _hoisted_13$1
3217
+ const _hoisted_14 = [
3218
+ _hoisted_13
3219
3219
  ];
3220
3220
  const _hoisted_15 = {
3221
3221
  key: 1,
@@ -3360,23 +3360,23 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3360
3360
  _hoisted_5$3
3361
3361
  ], 64 /* STABLE_FRAGMENT */))
3362
3362
  : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3363
- _hoisted_6$2,
3364
- _hoisted_7$1
3363
+ _hoisted_6$1,
3364
+ _hoisted_7
3365
3365
  ], 64 /* STABLE_FRAGMENT */))
3366
3366
  ], 8 /* PROPS */, _hoisted_3$4)
3367
3367
  ]))
3368
3368
  : createCommentVNode("v-if", true),
3369
3369
  (!$props.hideSearch)
3370
- ? (openBlock(), createElementBlock("div", _hoisted_8$1, [
3371
- createElementVNode("div", _hoisted_9$1, [
3372
- createElementVNode("div", _hoisted_10$1, [
3370
+ ? (openBlock(), createElementBlock("div", _hoisted_8, [
3371
+ createElementVNode("div", _hoisted_9, [
3372
+ createElementVNode("div", _hoisted_10, [
3373
3373
  withDirectives(createElementVNode("input", {
3374
3374
  type: "search",
3375
3375
  onChange: _cache[1] || (_cache[1] = $event => ($options.reloadData(1))),
3376
3376
  "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => (($data.filter_value) = $event)),
3377
3377
  placeholder: $props.searchPlaceholder ? $props.searchPlaceholder : 'Search',
3378
3378
  class: "form-control sh-search-input"
3379
- }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_11$1), [
3379
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_11), [
3380
3380
  [vModelText, $data.filter_value]
3381
3381
  ])
3382
3382
  ])
@@ -3386,7 +3386,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3386
3386
  ($options.hasDefaultSlot)
3387
3387
  ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
3388
3388
  ($data.loading === 'loading')
3389
- ? (openBlock(), createElementBlock("div", _hoisted_12$1, _hoisted_14$1))
3389
+ ? (openBlock(), createElementBlock("div", _hoisted_12, _hoisted_14))
3390
3390
  : ($data.loading === 'error')
3391
3391
  ? (openBlock(), createElementBlock("div", _hoisted_15, [
3392
3392
  createElementVNode("span", _hoisted_16, toDisplayString($data.loading_error), 1 /* TEXT */)
@@ -3974,7 +3974,7 @@ const _hoisted_2$1 = {
3974
3974
  "data-bs-toggle": "modal",
3975
3975
  ref: "addDeptBtn",
3976
3976
  href: "#department_modal",
3977
- class: "btn btn-info"
3977
+ class: "btn btn-info btn-sm"
3978
3978
  };
3979
3979
  const _hoisted_3$1 = /*#__PURE__*/createElementVNode("i", { class: "fa fa-plus" }, null, -1 /* HOISTED */);
3980
3980
  const _hoisted_4$1 = /*#__PURE__*/createTextVNode(" ADD DEPARTMENT");
@@ -3982,32 +3982,17 @@ const _hoisted_5$1 = [
3982
3982
  _hoisted_3$1,
3983
3983
  _hoisted_4$1
3984
3984
  ];
3985
- const _hoisted_6$1 = /*#__PURE__*/createElementVNode("i", { class: "fa fa-plus" }, null, -1 /* HOISTED */);
3986
- const _hoisted_7 = /*#__PURE__*/createTextVNode(" ADD DEPARTMENT");
3987
- const _hoisted_8 = [
3988
- _hoisted_6$1,
3989
- _hoisted_7
3990
- ];
3991
- const _hoisted_9 = /*#__PURE__*/createTextVNode("Permissions for ");
3992
- const _hoisted_10 = { class: "text-primary" };
3993
- const _hoisted_11 = ["value"];
3994
- const _hoisted_12 = /*#__PURE__*/createElementVNode("i", { class: "fa fa-save" }, null, -1 /* HOISTED */);
3995
- const _hoisted_13 = /*#__PURE__*/createTextVNode(" Submit");
3996
- const _hoisted_14 = [
3997
- _hoisted_12,
3998
- _hoisted_13
3999
- ];
4000
3985
 
4001
3986
 
4002
3987
  var script$1 = {
4003
3988
  __name: 'Departments',
4004
3989
  setup(__props) {
4005
3990
 
4006
- let editingDepartment = ref(null);
3991
+ ref(null);
4007
3992
  let allPermissions = ref([]);
4008
- let permissions = ref([]);
3993
+ ref([]);
4009
3994
  let reload = ref(0);
4010
- let permissionsModalBtn = ref(null);
3995
+ ref(null);
4011
3996
 
4012
3997
  onMounted(() => {
4013
3998
  shApis$1.doGet('admin/departments/all-permissions').then(res => {
@@ -4015,43 +4000,17 @@ onMounted(() => {
4015
4000
  });
4016
4001
  });
4017
4002
 
4018
-
4019
- function getPermissionLeft (menu) {
4020
- const len = menu.split('.').length * 2;
4021
- if (len > 5) {
4022
- return 5
4023
- }
4024
- return len
4025
- }
4026
- function getPermissionLabel (menu) {
4027
- const arr = menu.split('.');
4028
- return arr[arr.length - 1].replace(/_/g, ' ')
4029
- }
4030
4003
  function departmentAdded (response) {
4031
4004
  this.reload += 1;
4032
4005
  }
4033
4006
 
4034
- function rowSelected(department) {
4035
- editingDepartment.value = department;
4036
- if (department.permissions) {
4037
- this.permissions = JSON.parse(department.permissions);
4038
- }
4039
- }
4040
-
4041
4007
  return (_ctx, _cache) => {
4042
4008
  return (openBlock(), createElementBlock(Fragment, null, [
4043
4009
  _hoisted_1$1,
4044
4010
  createElementVNode("a", _hoisted_2$1, _hoisted_5$1, 512 /* NEED_PATCH */),
4045
- createElementVNode("a", {
4046
- "data-bs-toggle": "modal",
4047
- ref_key: "permissionsModalBtn",
4048
- ref: permissionsModalBtn,
4049
- href: "#permissions_modal",
4050
- class: "btn btn-info d-none"
4051
- }, _hoisted_8, 512 /* NEED_PATCH */),
4052
4011
  createVNode(script$4, {
4053
4012
  reload: unref(reload),
4054
- onRowSelected: rowSelected,
4013
+ onRowSelected: _ctx.rowSelected,
4055
4014
  headers: ['id','name','description', 'created_at'],
4056
4015
  "end-point": "admin/departments/list",
4057
4016
  actions: {
@@ -4059,15 +4018,15 @@ return (_ctx, _cache) => {
4059
4018
  actions: [
4060
4019
  {
4061
4020
  label: 'Permissions',
4062
- path: '/admin/departments/permissions/{id}',
4063
- class: 'btn btn-info bi-lock'
4021
+ path: '/sh-departments/permissions/{id}',
4022
+ class: 'btn btn-info bi-lock btn-sm'
4064
4023
  }
4065
4024
  ]
4066
4025
  }
4067
- }, null, 8 /* PROPS */, ["reload"]),
4026
+ }, null, 8 /* PROPS */, ["reload", "onRowSelected"]),
4068
4027
  createVNode(script$6, {
4069
- modal_id: "department_modal",
4070
- modal_title: "Department Form"
4028
+ "modal-id": "department_modal",
4029
+ "modal-title": "Department Form"
4071
4030
  }, {
4072
4031
  default: withCtx(() => [
4073
4032
  createVNode(script$8, {
@@ -4078,45 +4037,6 @@ return (_ctx, _cache) => {
4078
4037
  })
4079
4038
  ]),
4080
4039
  _: 1 /* STABLE */
4081
- }),
4082
- createVNode(script$6, {
4083
- modal_id: "permissions_modal",
4084
- modal_title: "Edit Department Permissions"
4085
- }, {
4086
- default: withCtx(() => [
4087
- (unref(allPermissions) && unref(editingDepartment))
4088
- ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4089
- createElementVNode("h3", null, [
4090
- _hoisted_9,
4091
- createElementVNode("span", _hoisted_10, toDisplayString(unref(editingDepartment).name), 1 /* TEXT */)
4092
- ]),
4093
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(allPermissions), (permission) => {
4094
- return (openBlock(), createElementBlock("div", {
4095
- key: permission,
4096
- class: "list-group p-0"
4097
- }, [
4098
- createElementVNode("label", {
4099
- class: normalizeClass(["list-group-item pb-0 text-capitalize", 'ms-' + getPermissionLeft(permission)])
4100
- }, [
4101
- withDirectives(createElementVNode("input", {
4102
- type: "checkbox",
4103
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (isRef(permissions) ? (permissions).value = $event : permissions = $event)),
4104
- value: permission
4105
- }, null, 8 /* PROPS */, _hoisted_11), [
4106
- [vModelCheckbox, unref(permissions)]
4107
- ]),
4108
- createTextVNode(" " + toDisplayString(getPermissionLabel(permission)), 1 /* TEXT */)
4109
- ], 2 /* CLASS */)
4110
- ]))
4111
- }), 128 /* KEYED_FRAGMENT */)),
4112
- createElementVNode("button", {
4113
- onClick: _cache[1] || (_cache[1] = (...args) => (_ctx.submitPermissions && _ctx.submitPermissions(...args))),
4114
- class: "btn btn-info"
4115
- }, _hoisted_14)
4116
- ], 64 /* STABLE_FRAGMENT */))
4117
- : createCommentVNode("v-if", true)
4118
- ]),
4119
- _: 1 /* STABLE */
4120
4040
  })
4121
4041
  ], 64 /* STABLE_FRAGMENT */))
4122
4042
  }
@@ -4268,7 +4188,9 @@ return (_ctx, _cache) => {
4268
4188
  "success-callback": moduleAdded,
4269
4189
  "fill-selects": {
4270
4190
  permission_module: {
4271
- url: 'admin/departments/department/list-pending-modules/' + id.value
4191
+ url: 'admin/departments/department/list-pending-modules/' + id.value,
4192
+ suggests: true,
4193
+ allowMultiple: true
4272
4194
  }
4273
4195
  },
4274
4196
  fields: ['permission_module'],
@@ -4349,4 +4271,4 @@ const ShFrontend = {
4349
4271
  }
4350
4272
  };
4351
4273
 
4352
- export { script$7 as ShCanvas, script$2 as ShDynamicTabs, script$8 as ShForm, ShFrontend, script$6 as ShModal, script$b as ShPhone, script$4 as ShTable, script$3 as ShTabs, shApis$1 as shApis, helpers as shRepo, ShStorage as shStorage, useUserStore };
4274
+ export { script$7 as ShCanvas, script$2 as ShDynamicTabs, script$8 as ShForm, ShFrontend, script$6 as ShModal, script$b as ShPhone, script$4 as ShTable, script$3 as ShTabs, shApis$1 as shApis, shRepo$1 as shRepo, ShStorage as shStorage, useUserStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",