@iankibetsh/shframework 0.5.9 → 0.6.1

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.
Files changed (3) hide show
  1. package/dist/library.js +443 -151
  2. package/dist/library.mjs +437 -145
  3. package/package.json +1 -1
package/dist/library.mjs CHANGED
@@ -1,10 +1,11 @@
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 } 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';
7
- import { defineStore } from 'pinia';
7
+ import { defineStore, storeToRefs } from 'pinia';
8
+ import { useRoute } from 'vue-router';
8
9
 
9
10
  function setItem (key, value) {
10
11
  let toStore = value;
@@ -87,7 +88,7 @@ function doPost (endPoint, data) {
87
88
  )
88
89
  }
89
90
 
90
- var apis = {
91
+ var shApis$1 = {
91
92
  doGet,
92
93
  doPost
93
94
  };
@@ -1565,7 +1566,7 @@ const countries = [
1565
1566
  }
1566
1567
  ];
1567
1568
 
1568
- var script$9 = {
1569
+ var script$b = {
1569
1570
  name: 'ShPhone',
1570
1571
  props: ['modelValue', 'country_code'],
1571
1572
  data () {
@@ -1627,19 +1628,19 @@ var script$9 = {
1627
1628
  }
1628
1629
  };
1629
1630
 
1630
- const _hoisted_1$9 = { class: "sh-phone mb-3" };
1631
- const _hoisted_2$8 = {
1631
+ const _hoisted_1$b = { class: "sh-phone mb-3" };
1632
+ const _hoisted_2$a = {
1632
1633
  key: 0,
1633
1634
  style: {"display":"contents"}
1634
1635
  };
1635
- const _hoisted_3$8 = ["src"];
1636
- const _hoisted_4$8 = ["value"];
1636
+ const _hoisted_3$a = ["src"];
1637
+ const _hoisted_4$a = ["value"];
1637
1638
 
1638
1639
  function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1639
- return (openBlock(), createElementBlock("div", _hoisted_1$9, [
1640
+ return (openBlock(), createElementBlock("div", _hoisted_1$b, [
1640
1641
  ($data.selectedCountry)
1641
- ? (openBlock(), createElementBlock("div", _hoisted_2$8, [
1642
- createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$8),
1642
+ ? (openBlock(), createElementBlock("div", _hoisted_2$a, [
1643
+ createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$a),
1643
1644
  createTextVNode(" " + toDisplayString($data.selectedCountry.dialCode), 1 /* TEXT */)
1644
1645
  ]))
1645
1646
  : createCommentVNode("v-if", true),
@@ -1652,7 +1653,7 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1652
1653
  return (openBlock(), createElementBlock("option", {
1653
1654
  value: country,
1654
1655
  key: country.dialCode
1655
- }, toDisplayString(country.name + '(' + country.dialCode + ')'), 9 /* TEXT, PROPS */, _hoisted_4$8))
1656
+ }, toDisplayString(country.name + '(' + country.dialCode + ')'), 9 /* TEXT, PROPS */, _hoisted_4$a))
1656
1657
  }), 128 /* KEYED_FRAGMENT */))
1657
1658
  ], 544 /* HYDRATE_EVENTS, NEED_PATCH */), [
1658
1659
  [vModelSelect, $data.selectedCountry]
@@ -1670,10 +1671,10 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1670
1671
  ]))
1671
1672
  }
1672
1673
 
1673
- script$9.render = render$7;
1674
- script$9.__file = "src/lib/components/ShPhone.vue";
1674
+ script$b.render = render$7;
1675
+ script$b.__file = "src/lib/components/ShPhone.vue";
1675
1676
 
1676
- var script$8 = {
1677
+ var script$a = {
1677
1678
  name: 'ShEditor',
1678
1679
  props: ['modelValue'],
1679
1680
  components: {
@@ -1712,7 +1713,7 @@ var script$8 = {
1712
1713
  }
1713
1714
  };
1714
1715
 
1715
- const _hoisted_1$8 = /*#__PURE__*/createElementVNode("textarea", {
1716
+ const _hoisted_1$a = /*#__PURE__*/createElementVNode("textarea", {
1716
1717
  id: "tiny",
1717
1718
  style: {"display":"none"},
1718
1719
  "data-cy": "tinymce_editor"
@@ -1722,7 +1723,7 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
1722
1723
  const _component_editor = resolveComponent("editor");
1723
1724
 
1724
1725
  return (openBlock(), createElementBlock(Fragment, null, [
1725
- _hoisted_1$8,
1726
+ _hoisted_1$a,
1726
1727
  createElementVNode("div", {
1727
1728
  onFocusin: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"])),
1728
1729
  class: "sh-editor w-100"
@@ -1747,18 +1748,18 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
1747
1748
  ], 64 /* STABLE_FRAGMENT */))
1748
1749
  }
1749
1750
 
1750
- script$8.render = render$6;
1751
- script$8.__file = "src/lib/components/FormComponent/ShEditor.vue";
1751
+ script$a.render = render$6;
1752
+ script$a.__file = "src/lib/components/FormComponent/ShEditor.vue";
1752
1753
 
1753
- const _hoisted_1$7 = {
1754
+ const _hoisted_1$9 = {
1754
1755
  key: 0,
1755
1756
  class: "dropdown sh-suggest"
1756
1757
  };
1757
- const _hoisted_2$7 = ["id"];
1758
- const _hoisted_3$7 = { class: "badge bg-secondary m-1 sh-selected-item" };
1759
- const _hoisted_4$7 = ["onClick"];
1760
- const _hoisted_5$5 = ["id"];
1761
- const _hoisted_6$3 = ["id", "aria-labelledby"];
1758
+ const _hoisted_2$9 = ["id"];
1759
+ const _hoisted_3$9 = { class: "badge bg-secondary m-1 sh-selected-item" };
1760
+ const _hoisted_4$9 = ["onClick"];
1761
+ const _hoisted_5$7 = ["id"];
1762
+ const _hoisted_6$4 = ["id", "aria-labelledby"];
1762
1763
  const _hoisted_7$3 = { key: 0 };
1763
1764
  const _hoisted_8$2 = ["onClick"];
1764
1765
  const _hoisted_9$2 = {
@@ -1771,7 +1772,7 @@ const _hoisted_10$3 = {
1771
1772
  };
1772
1773
 
1773
1774
 
1774
- var script$7 = {
1775
+ var script$9 = {
1775
1776
  __name: 'ShSuggest',
1776
1777
  props: ['fillSelects','modelValue'],
1777
1778
  emits: ['update:modelValue'],
@@ -1842,7 +1843,7 @@ function filterData(e){
1842
1843
  }
1843
1844
  });
1844
1845
  } else {
1845
- apis.doGet(props.fillSelects.url, { all: 1,filter_value: filterValue }).then(res => {
1846
+ shApis$1.doGet(props.fillSelects.url, { all: 1,filter_value: filterValue }).then(res => {
1846
1847
  suggestions.value = res.data.data;
1847
1848
  }).catch(res => {
1848
1849
  console.log(res);
@@ -1852,7 +1853,7 @@ function filterData(e){
1852
1853
 
1853
1854
  return (_ctx, _cache) => {
1854
1855
  return (unref(id))
1855
- ? (openBlock(), createElementBlock("div", _hoisted_1$7, [
1856
+ ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
1856
1857
  createElementVNode("div", {
1857
1858
  id: unref(id),
1858
1859
  "data-bs-toggle": "dropdown",
@@ -1861,14 +1862,14 @@ return (_ctx, _cache) => {
1861
1862
  }, [
1862
1863
  createElementVNode("div", null, [
1863
1864
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(selectedSuggestions), (sgt) => {
1864
- return (openBlock(), createElementBlock("h5", _hoisted_3$7, [
1865
+ return (openBlock(), createElementBlock("h5", _hoisted_3$9, [
1865
1866
  createTextVNode(toDisplayString(sgt.name) + " ", 1 /* TEXT */),
1866
1867
  createElementVNode("button", {
1867
1868
  onClick: $event => (removeSuggestion(sgt.id)),
1868
1869
  type: "button",
1869
1870
  class: "btn-close border-start border-1 ms-1",
1870
1871
  "aria-label": "Close"
1871
- }, null, 8 /* PROPS */, _hoisted_4$7)
1872
+ }, null, 8 /* PROPS */, _hoisted_4$9)
1872
1873
  ]))
1873
1874
  }), 256 /* UNKEYED_FRAGMENT */))
1874
1875
  ]),
@@ -1877,8 +1878,8 @@ return (_ctx, _cache) => {
1877
1878
  contenteditable: "true",
1878
1879
  onInput: filterData,
1879
1880
  class: "flex-fill h-100 sh-suggestion-input"
1880
- }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_5$5)
1881
- ], 8 /* PROPS */, _hoisted_2$7),
1881
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_5$7)
1882
+ ], 8 /* PROPS */, _hoisted_2$9),
1882
1883
  createElementVNode("ul", {
1883
1884
  class: "dropdown-menu w-100",
1884
1885
  id: 'dropwdown_section' + unref(id),
@@ -1903,7 +1904,7 @@ return (_ctx, _cache) => {
1903
1904
  : (unref(searchText))
1904
1905
  ? (openBlock(), createElementBlock("li", _hoisted_9$2, " No results found "))
1905
1906
  : (openBlock(), createElementBlock("li", _hoisted_10$3, " Type to search... "))
1906
- ], 8 /* PROPS */, _hoisted_6$3)
1907
+ ], 8 /* PROPS */, _hoisted_6$4)
1907
1908
  ]))
1908
1909
  : createCommentVNode("v-if", true)
1909
1910
  }
@@ -1911,15 +1912,15 @@ return (_ctx, _cache) => {
1911
1912
 
1912
1913
  };
1913
1914
 
1914
- script$7.__scopeId = "data-v-5b767123";
1915
- script$7.__file = "src/lib/components/FormComponent/ShSuggest.vue";
1915
+ script$9.__scopeId = "data-v-5b767123";
1916
+ script$9.__file = "src/lib/components/FormComponent/ShSuggest.vue";
1916
1917
 
1917
- var script$6 = {
1918
+ var script$8 = {
1918
1919
  name: 'ShForm',
1919
1920
  components: {
1920
- ShSuggest: script$7,
1921
- ShEditor: script$8,
1922
- ShPhone: script$9
1921
+ ShSuggest: script$9,
1922
+ ShEditor: script$a,
1923
+ ShPhone: script$b
1923
1924
  },
1924
1925
  props: [
1925
1926
  'action',
@@ -2109,7 +2110,7 @@ var script$6 = {
2109
2110
  Object.keys(this.form_files).forEach(key => {
2110
2111
  data.append(key, this.form_files[key].value);
2111
2112
  });
2112
- apis.doPost(this.action, data).then(res => {
2113
+ shApis$1.doPost(this.action, data).then(res => {
2113
2114
  // console.log(res)
2114
2115
  this.form_status = 2;
2115
2116
  Object.keys(this.form_elements).forEach(key => {
@@ -2197,7 +2198,7 @@ var script$6 = {
2197
2198
  this.selectData = selectData;
2198
2199
  console.log(this.selectData);
2199
2200
  } else {
2200
- apis.doGet(this.fillSelects[key].url, { all: 1 }).then(res => {
2201
+ shApis$1.doGet(this.fillSelects[key].url, { all: 1 }).then(res => {
2201
2202
  // selectData[key] = res.data
2202
2203
  // console.log(res)
2203
2204
  this.selectData[key] = res.data.data;
@@ -2226,19 +2227,19 @@ var script$6 = {
2226
2227
  }
2227
2228
  };
2228
2229
 
2229
- const _hoisted_1$6 = {
2230
+ const _hoisted_1$8 = {
2230
2231
  ref: "ShAutoForm",
2231
2232
  class: "sh-form"
2232
2233
  };
2233
- const _hoisted_2$6 = {
2234
+ const _hoisted_2$8 = {
2234
2235
  key: 0,
2235
2236
  class: "alert alert-danger alert-dismissible fade show sh-form-submission-error",
2236
2237
  role: "alert"
2237
2238
  };
2238
- const _hoisted_3$6 = /*#__PURE__*/createElementVNode("i", { class: "bi-exclamation-triangle-fill me-1" }, null, -1 /* HOISTED */);
2239
- const _hoisted_4$6 = { key: 0 };
2240
- const _hoisted_5$4 = { key: 1 };
2241
- const _hoisted_6$2 = { class: "row" };
2239
+ const _hoisted_3$8 = /*#__PURE__*/createElementVNode("i", { class: "bi-exclamation-triangle-fill me-1" }, null, -1 /* HOISTED */);
2240
+ const _hoisted_4$8 = { key: 0 };
2241
+ const _hoisted_5$6 = { key: 1 };
2242
+ const _hoisted_6$3 = { class: "row" };
2242
2243
  const _hoisted_7$2 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
2243
2244
  const _hoisted_8$1 = { class: "col-md-12" };
2244
2245
  const _hoisted_9$1 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
@@ -2291,15 +2292,15 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2291
2292
  const _component_ShSuggest = resolveComponent("ShSuggest");
2292
2293
  const _component_ShEditor = resolveComponent("ShEditor");
2293
2294
 
2294
- return (openBlock(), createElementBlock("form", _hoisted_1$6, [
2295
+ return (openBlock(), createElementBlock("form", _hoisted_1$8, [
2295
2296
  createCommentVNode(" <div v-if=\"form_status == 1\" class=\"alert alert-info\">Processing...</div>"),
2296
2297
  createCommentVNode(" <div v-if=\"form_status == 2\" class=\"alert alert-success\">Success</div>"),
2297
2298
  (_ctx.form_status == 3)
2298
- ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
2299
- _hoisted_3$6,
2299
+ ? (openBlock(), createElementBlock("div", _hoisted_2$8, [
2300
+ _hoisted_3$8,
2300
2301
  (_ctx.errorText)
2301
- ? (openBlock(), createElementBlock("span", _hoisted_4$6, toDisplayString(_ctx.errorText), 1 /* TEXT */))
2302
- : (openBlock(), createElementBlock("span", _hoisted_5$4, "Unexpected Error Occurred")),
2302
+ ? (openBlock(), createElementBlock("span", _hoisted_4$8, toDisplayString(_ctx.errorText), 1 /* TEXT */))
2303
+ : (openBlock(), createElementBlock("span", _hoisted_5$6, "Unexpected Error Occurred")),
2303
2304
  createElementVNode("button", {
2304
2305
  onClick: _cache[0] || (_cache[0] = (...args) => ($options.hideError && $options.hideError(...args))),
2305
2306
  type: "button",
@@ -2314,7 +2315,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2314
2315
  }, null, 512 /* NEED_PATCH */), [
2315
2316
  [vModelText, _ctx.form_elements['id']]
2316
2317
  ]),
2317
- createElementVNode("div", _hoisted_6$2, [
2318
+ createElementVNode("div", _hoisted_6$3, [
2318
2319
  (openBlock(true), createElementBlock(Fragment, null, renderList($props.fields, (field) => {
2319
2320
  return (openBlock(), createElementBlock("div", {
2320
2321
  class: normalizeClass(["form-group", 'col-md-' + $options.getColumns()]),
@@ -2496,10 +2497,10 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2496
2497
  ], 512 /* NEED_PATCH */))
2497
2498
  }
2498
2499
 
2499
- script$6.render = render$5;
2500
- script$6.__file = "src/lib/components/ShForm.vue";
2500
+ script$8.render = render$5;
2501
+ script$8.__file = "src/lib/components/ShForm.vue";
2501
2502
 
2502
- var script$5 = {
2503
+ var script$7 = {
2503
2504
  name: 'ShCanvas',
2504
2505
  props: ['canvasTitle', 'canvasId', 'position'],
2505
2506
  components: {
@@ -2516,13 +2517,13 @@ var script$5 = {
2516
2517
  }
2517
2518
  };
2518
2519
 
2519
- const _hoisted_1$5 = ["id"];
2520
- const _hoisted_2$5 = { class: "offcanvas-header" };
2521
- const _hoisted_3$5 = {
2520
+ const _hoisted_1$7 = ["id"];
2521
+ const _hoisted_2$7 = { class: "offcanvas-header" };
2522
+ const _hoisted_3$7 = {
2522
2523
  class: "offcanvas-title",
2523
2524
  id: "offcanvasScrollingLabel"
2524
2525
  };
2525
- const _hoisted_4$5 = { class: "offcanvas-body" };
2526
+ const _hoisted_4$7 = { class: "offcanvas-body" };
2526
2527
 
2527
2528
  function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2528
2529
  return (openBlock(), createElementBlock("div", {
@@ -2532,8 +2533,8 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2532
2533
  id: $props.canvasId,
2533
2534
  "aria-labelledby": "offcanvasScrollingLabel"
2534
2535
  }, [
2535
- createElementVNode("div", _hoisted_2$5, [
2536
- createElementVNode("h5", _hoisted_3$5, toDisplayString($props.canvasTitle), 1 /* TEXT */),
2536
+ createElementVNode("div", _hoisted_2$7, [
2537
+ createElementVNode("h5", _hoisted_3$7, toDisplayString($props.canvasTitle), 1 /* TEXT */),
2537
2538
  createElementVNode("button", {
2538
2539
  type: "button",
2539
2540
  ref: "closecanvas",
@@ -2543,32 +2544,32 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2543
2544
  "aria-label": "Close"
2544
2545
  }, null, 512 /* NEED_PATCH */)
2545
2546
  ]),
2546
- createElementVNode("div", _hoisted_4$5, [
2547
+ createElementVNode("div", _hoisted_4$7, [
2547
2548
  renderSlot(_ctx.$slots, "default")
2548
2549
  ])
2549
- ], 10 /* CLASS, PROPS */, _hoisted_1$5))
2550
+ ], 10 /* CLASS, PROPS */, _hoisted_1$7))
2550
2551
  }
2551
2552
 
2552
- script$5.render = render$4;
2553
- script$5.__file = "src/lib/components/ShCanvas.vue";
2553
+ script$7.render = render$4;
2554
+ script$7.__file = "src/lib/components/ShCanvas.vue";
2554
2555
 
2555
- var script$4 = {
2556
+ var script$6 = {
2556
2557
  name: 'ShModal',
2557
2558
  props: ['modalTitle', 'modalId', 'modalSize'],
2558
2559
  components: {
2559
2560
  }
2560
2561
  };
2561
2562
 
2562
- const _hoisted_1$4 = ["id"];
2563
- const _hoisted_2$4 = { class: "modal-content" };
2564
- const _hoisted_3$4 = { class: "modal-header" };
2565
- const _hoisted_4$4 = { class: "modal-title" };
2566
- const _hoisted_5$3 = /*#__PURE__*/createElementVNode("button", {
2563
+ const _hoisted_1$6 = ["id"];
2564
+ const _hoisted_2$6 = { class: "modal-content" };
2565
+ const _hoisted_3$6 = { class: "modal-header" };
2566
+ const _hoisted_4$6 = { class: "modal-title" };
2567
+ const _hoisted_5$5 = /*#__PURE__*/createElementVNode("button", {
2567
2568
  class: "btn btn-danger btn-sm",
2568
2569
  "data-bs-dismiss": "modal",
2569
2570
  "data-dismiss": "modal"
2570
2571
  }, "×", -1 /* HOISTED */);
2571
- const _hoisted_6$1 = { class: "modal-body" };
2572
+ const _hoisted_6$2 = { class: "modal-body" };
2572
2573
  const _hoisted_7$1 = { class: "section" };
2573
2574
 
2574
2575
  function render$3(_ctx, _cache, $props, $setup, $data, $options) {
@@ -2582,25 +2583,25 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2582
2583
  createElementVNode("div", {
2583
2584
  class: normalizeClass(["modal-dialog", `modal-${$props.modalSize}`])
2584
2585
  }, [
2585
- createElementVNode("div", _hoisted_2$4, [
2586
- createElementVNode("div", _hoisted_3$4, [
2587
- createElementVNode("h3", _hoisted_4$4, toDisplayString($props.modalTitle), 1 /* TEXT */),
2588
- _hoisted_5$3
2586
+ createElementVNode("div", _hoisted_2$6, [
2587
+ createElementVNode("div", _hoisted_3$6, [
2588
+ createElementVNode("h3", _hoisted_4$6, toDisplayString($props.modalTitle), 1 /* TEXT */),
2589
+ _hoisted_5$5
2589
2590
  ]),
2590
- createElementVNode("div", _hoisted_6$1, [
2591
+ createElementVNode("div", _hoisted_6$2, [
2591
2592
  createElementVNode("div", _hoisted_7$1, [
2592
2593
  renderSlot(_ctx.$slots, "default")
2593
2594
  ])
2594
2595
  ])
2595
2596
  ])
2596
2597
  ], 2 /* CLASS */)
2597
- ], 8 /* PROPS */, _hoisted_1$4))
2598
+ ], 8 /* PROPS */, _hoisted_1$6))
2598
2599
  }
2599
2600
 
2600
- script$4.render = render$3;
2601
- script$4.__file = "src/lib/components/ShModal.vue";
2601
+ script$6.render = render$3;
2602
+ script$6.__file = "src/lib/components/ShModal.vue";
2602
2603
 
2603
- var script$3 = {
2604
+ var script$5 = {
2604
2605
  name: 'Pagination',
2605
2606
  props: ['pagination_data', 'loadMore', 'hideCount', 'hideLoadMore'],
2606
2607
  data () {
@@ -2671,13 +2672,13 @@ var script$3 = {
2671
2672
  }
2672
2673
  };
2673
2674
 
2674
- const _hoisted_1$3 = { key: 0 };
2675
- const _hoisted_2$3 = { class: "record_count_body mb-3" };
2676
- const _hoisted_3$3 = /*#__PURE__*/createElementVNode("span", { class: "per_page_show" }, "Showing", -1 /* HOISTED */);
2677
- const _hoisted_4$3 = /*#__PURE__*/createTextVNode("  ");
2678
- const _hoisted_5$2 = /*#__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);
2675
+ const _hoisted_1$5 = { key: 0 };
2676
+ const _hoisted_2$5 = { class: "record_count_body mb-3" };
2677
+ const _hoisted_3$5 = /*#__PURE__*/createElementVNode("span", { class: "per_page_show" }, "Showing", -1 /* HOISTED */);
2678
+ const _hoisted_4$5 = /*#__PURE__*/createTextVNode("  ");
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);
2679
2680
  const _hoisted_10$1 = [
2680
- _hoisted_5$2
2681
+ _hoisted_5$4
2681
2682
  ];
2682
2683
  const _hoisted_11$1 = { class: "record_counts" };
2683
2684
  const _hoisted_12$1 = {
@@ -2718,10 +2719,10 @@ const _hoisted_23$1 = {
2718
2719
 
2719
2720
  function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2720
2721
  return (!$props.loadMore)
2721
- ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
2722
- createElementVNode("div", _hoisted_2$3, [
2723
- _hoisted_3$3,
2724
- _hoisted_4$3,
2722
+ ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
2723
+ createElementVNode("div", _hoisted_2$5, [
2724
+ _hoisted_3$5,
2725
+ _hoisted_4$5,
2725
2726
  withDirectives(createElementVNode("select", {
2726
2727
  class: "select_per_page",
2727
2728
  onChange: _cache[0] || (_cache[0] = (...args) => ($options.changePerPage && $options.changePerPage(...args))),
@@ -2790,8 +2791,8 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2790
2791
  ]))
2791
2792
  }
2792
2793
 
2793
- script$3.render = render$2;
2794
- script$3.__file = "src/lib/components/list_templates/Pagination.vue";
2794
+ script$5.render = render$2;
2795
+ script$5.__file = "src/lib/components/list_templates/Pagination.vue";
2795
2796
 
2796
2797
  function swalSuccess (message) {
2797
2798
  Swal.fire('Success!', message, 'success');
@@ -2829,11 +2830,11 @@ function swalHttpError (reason) {
2829
2830
  }
2830
2831
 
2831
2832
  function runSilentRequest (url) {
2832
- return apis.doPost(url)
2833
+ return shApis$1.doPost(url)
2833
2834
  }
2834
2835
 
2835
2836
  function setTabCounts (url) {
2836
- apis.doGet(url).then(res => {
2837
+ shApis$1.doGet(url).then(res => {
2837
2838
  Object.keys(res.data).forEach(key => {
2838
2839
  const elem = document.getElementById(key);
2839
2840
  if (elem === null) {
@@ -2880,7 +2881,7 @@ function formatHttpCatchError (reason) {
2880
2881
  return error
2881
2882
  }
2882
2883
  function getMenuCount (url) {
2883
- apis.doGet(url).then(res => {
2884
+ shApis$1.doGet(url).then(res => {
2884
2885
  console.log(res);
2885
2886
  });
2886
2887
  }
@@ -2923,7 +2924,7 @@ async function runPlainRequest (url, message, title, data) {
2923
2924
  reverseButtons: true,
2924
2925
  showLoaderOnConfirm: true,
2925
2926
  preConfirm: () => {
2926
- return apis.doPost(url, data).then(function (response) {
2927
+ return shApis$1.doPost(url, data).then(function (response) {
2927
2928
  Swal.fire('Success!', 'Action completed successfully', 'success');
2928
2929
  return {
2929
2930
  response: response.data,
@@ -2952,7 +2953,7 @@ function formatDate(date, format) {
2952
2953
  return moment(date).format(format)
2953
2954
  }
2954
2955
 
2955
- var helpers = {
2956
+ var shRepo$1 = {
2956
2957
  swalSuccess,
2957
2958
  swalError,
2958
2959
  runPlainRequest,
@@ -2965,7 +2966,7 @@ var helpers = {
2965
2966
  formatDate
2966
2967
  };
2967
2968
 
2968
- var script$2 = {
2969
+ var script$4 = {
2969
2970
  name: 'sh-table',
2970
2971
  props: ['endPoint', 'headers', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover'],
2971
2972
  inject: ['channel', 'global'],
@@ -3091,7 +3092,7 @@ var script$2 = {
3091
3092
  titles: headers,
3092
3093
  export: 1
3093
3094
  };
3094
- apis.doPost(this.endPoint, data).then(res => {
3095
+ shApis$1.doPost(this.endPoint, data).then(res => {
3095
3096
  this.downloading = false;
3096
3097
  if (res.data.file) {
3097
3098
  const url = this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name;
@@ -3103,7 +3104,7 @@ var script$2 = {
3103
3104
  console.log(reason);
3104
3105
  this.downloading = false;
3105
3106
  const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText}`;
3106
- helpers.swalError('Error', error);
3107
+ shRepo$1.swalError('Error', error);
3107
3108
  });
3108
3109
  },
3109
3110
  reloadData: function (page, append) {
@@ -3121,7 +3122,7 @@ var script$2 = {
3121
3122
  if (this.pagination_data) {
3122
3123
  this.pagination_data.loading = 1;
3123
3124
  }
3124
- apis.doGet(this.endPoint, data).then(req => {
3125
+ shApis$1.doGet(this.endPoint, data).then(req => {
3125
3126
  this.loading = 'done';
3126
3127
  const response = req.data.data;
3127
3128
  this.pagination_data = {
@@ -3164,7 +3165,7 @@ var script$2 = {
3164
3165
  this.reloadData();
3165
3166
  },
3166
3167
  components: {
3167
- pagination: script$3
3168
+ pagination: script$5
3168
3169
  },
3169
3170
  computed: {
3170
3171
  windowWidth: function () {
@@ -3182,15 +3183,15 @@ var script$2 = {
3182
3183
  }
3183
3184
  };
3184
3185
 
3185
- const _hoisted_1$2 = { class: "auto-table" };
3186
- const _hoisted_2$2 = {
3186
+ const _hoisted_1$4 = { class: "auto-table" };
3187
+ const _hoisted_2$4 = {
3187
3188
  key: 0,
3188
3189
  class: "col-md-4 mb-2"
3189
3190
  };
3190
- const _hoisted_3$2 = ["disabled"];
3191
- const _hoisted_4$2 = /*#__PURE__*/createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */);
3192
- const _hoisted_5$1 = /*#__PURE__*/createTextVNode(" Export ");
3193
- const _hoisted_6 = /*#__PURE__*/createElementVNode("span", {
3191
+ const _hoisted_3$4 = ["disabled"];
3192
+ const _hoisted_4$4 = /*#__PURE__*/createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */);
3193
+ const _hoisted_5$3 = /*#__PURE__*/createTextVNode(" Export ");
3194
+ const _hoisted_6$1 = /*#__PURE__*/createElementVNode("span", {
3194
3195
  class: "spinner-border spinner-border-sm",
3195
3196
  role: "status",
3196
3197
  "aria-hidden": "true"
@@ -3345,9 +3346,9 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3345
3346
  const _component_router_link = resolveComponent("router-link");
3346
3347
  const _component_pagination = resolveComponent("pagination");
3347
3348
 
3348
- return (openBlock(), createElementBlock("div", _hoisted_1$2, [
3349
+ return (openBlock(), createElementBlock("div", _hoisted_1$4, [
3349
3350
  ($props.hasDownload)
3350
- ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
3351
+ ? (openBlock(), createElementBlock("div", _hoisted_2$4, [
3351
3352
  createElementVNode("button", {
3352
3353
  disabled: $data.downloading,
3353
3354
  class: "btn btn-warning btn-sm",
@@ -3355,14 +3356,14 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3355
3356
  }, [
3356
3357
  (!$data.downloading)
3357
3358
  ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3358
- _hoisted_4$2,
3359
- _hoisted_5$1
3359
+ _hoisted_4$4,
3360
+ _hoisted_5$3
3360
3361
  ], 64 /* STABLE_FRAGMENT */))
3361
3362
  : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3362
- _hoisted_6,
3363
+ _hoisted_6$1,
3363
3364
  _hoisted_7
3364
3365
  ], 64 /* STABLE_FRAGMENT */))
3365
- ], 8 /* PROPS */, _hoisted_3$2)
3366
+ ], 8 /* PROPS */, _hoisted_3$4)
3366
3367
  ]))
3367
3368
  : createCommentVNode("v-if", true),
3368
3369
  (!$props.hideSearch)
@@ -3671,10 +3672,10 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3671
3672
  ]))
3672
3673
  }
3673
3674
 
3674
- script$2.render = render$1;
3675
- script$2.__file = "src/lib/components/ShTable.vue";
3675
+ script$4.render = render$1;
3676
+ script$4.__file = "src/lib/components/ShTable.vue";
3676
3677
 
3677
- var script$1 = {
3678
+ var script$3 = {
3678
3679
  name: 'ShTabs',
3679
3680
  props: ['tabs', 'baseUrl', 'sharedData', 'tabCounts', 'responsive'],
3680
3681
  data () {
@@ -3715,7 +3716,7 @@ var script$1 = {
3715
3716
  if (typeof tabCounts === 'object') {
3716
3717
  this.setCounts(tabCounts);
3717
3718
  } else {
3718
- apis.doGet(tabCounts).then(res => {
3719
+ shApis$1.doGet(tabCounts).then(res => {
3719
3720
  this.setCounts(res.data);
3720
3721
  });
3721
3722
  }
@@ -3755,14 +3756,14 @@ var script$1 = {
3755
3756
  }
3756
3757
  };
3757
3758
 
3758
- const _hoisted_1$1 = {
3759
+ const _hoisted_1$3 = {
3759
3760
  key: 0,
3760
3761
  class: "navbar navbar-expand-lg sh-horizontal-tabs"
3761
3762
  };
3762
- const _hoisted_2$1 = ["data-bs-target"];
3763
- const _hoisted_3$1 = /*#__PURE__*/createElementVNode("i", { class: "bi-chevron-right float-end" }, null, -1 /* HOISTED */);
3764
- const _hoisted_4$1 = ["id"];
3765
- const _hoisted_5 = { class: "tab-content" };
3763
+ const _hoisted_2$3 = ["data-bs-target"];
3764
+ const _hoisted_3$3 = /*#__PURE__*/createElementVNode("i", { class: "bi-chevron-right float-end" }, null, -1 /* HOISTED */);
3765
+ const _hoisted_4$3 = ["id"];
3766
+ const _hoisted_5$2 = { class: "tab-content" };
3766
3767
 
3767
3768
  function render(_ctx, _cache, $props, $setup, $data, $options) {
3768
3769
  const _component_router_link = resolveComponent("router-link");
@@ -3770,7 +3771,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
3770
3771
 
3771
3772
  return (openBlock(), createElementBlock(Fragment, null, [
3772
3773
  ($data.generatedId)
3773
- ? (openBlock(), createElementBlock("nav", _hoisted_1$1, [
3774
+ ? (openBlock(), createElementBlock("nav", _hoisted_1$3, [
3774
3775
  ($data.isResponsive)
3775
3776
  ? (openBlock(), createElementBlock("a", {
3776
3777
  key: 0,
@@ -3783,8 +3784,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
3783
3784
  "aria-label": "Toggle navigation"
3784
3785
  }, [
3785
3786
  createTextVNode(toDisplayString($data.currentTab) + " ", 1 /* TEXT */),
3786
- _hoisted_3$1
3787
- ], 8 /* PROPS */, _hoisted_2$1))
3787
+ _hoisted_3$3
3788
+ ], 8 /* PROPS */, _hoisted_2$3))
3788
3789
  : createCommentVNode("v-if", true),
3789
3790
  createElementVNode("div", {
3790
3791
  class: normalizeClass($data.isResponsive ? 'collapse navbar-collapse':''),
@@ -3813,10 +3814,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
3813
3814
  ]))
3814
3815
  }), 128 /* KEYED_FRAGMENT */))
3815
3816
  ], 2 /* CLASS */)
3816
- ], 10 /* CLASS, PROPS */, _hoisted_4$1)
3817
+ ], 10 /* CLASS, PROPS */, _hoisted_4$3)
3817
3818
  ]))
3818
3819
  : createCommentVNode("v-if", true),
3819
- createElementVNode("div", _hoisted_5, [
3820
+ createElementVNode("div", _hoisted_5$2, [
3820
3821
  createVNode(_component_router_view, {
3821
3822
  currentTab: $data.currentTab,
3822
3823
  sharedData: $props.sharedData,
@@ -3826,21 +3827,21 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
3826
3827
  ], 64 /* STABLE_FRAGMENT */))
3827
3828
  }
3828
3829
 
3829
- script$1.render = render;
3830
- script$1.__file = "src/lib/components/ShTabs.vue";
3830
+ script$3.render = render;
3831
+ script$3.__file = "src/lib/components/ShTabs.vue";
3831
3832
 
3832
- const _hoisted_1 = {
3833
+ const _hoisted_1$2 = {
3833
3834
  class: "nav nav-tabs",
3834
3835
  role: "tablist"
3835
3836
  };
3836
- const _hoisted_2 = {
3837
+ const _hoisted_2$2 = {
3837
3838
  class: "nav-item",
3838
3839
  role: "presentation"
3839
3840
  };
3840
- const _hoisted_3 = ["onClick"];
3841
- const _hoisted_4 = { class: "tab-content" };
3841
+ const _hoisted_3$2 = ["onClick"];
3842
+ const _hoisted_4$2 = { class: "tab-content" };
3842
3843
 
3843
- var script = {
3844
+ var script$2 = {
3844
3845
  __name: 'ShDynamicTabs',
3845
3846
  props: ['tabs'],
3846
3847
  setup(__props) {
@@ -3865,17 +3866,17 @@ function setTab(tab){
3865
3866
 
3866
3867
  return (_ctx, _cache) => {
3867
3868
  return (openBlock(), createElementBlock(Fragment, null, [
3868
- createElementVNode("ul", _hoisted_1, [
3869
+ createElementVNode("ul", _hoisted_1$2, [
3869
3870
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(tabs), (tab) => {
3870
- return (openBlock(), createElementBlock("li", _hoisted_2, [
3871
+ return (openBlock(), createElementBlock("li", _hoisted_2$2, [
3871
3872
  createElementVNode("button", {
3872
3873
  onClick: $event => (setTab(tab)),
3873
3874
  class: normalizeClass(["nav-link", unref(currentTab) === tab ? 'active':''])
3874
- }, toDisplayString(tab.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_3)
3875
+ }, toDisplayString(tab.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_3$2)
3875
3876
  ]))
3876
3877
  }), 256 /* UNKEYED_FRAGMENT */))
3877
3878
  ]),
3878
- createElementVNode("div", _hoisted_4, [
3879
+ createElementVNode("div", _hoisted_4$2, [
3879
3880
  (unref(currentTab))
3880
3881
  ? (openBlock(), createBlock(resolveDynamicComponent(unref(currentTab).component), { key: 0 }))
3881
3882
  : createCommentVNode("v-if", true)
@@ -3886,7 +3887,7 @@ return (_ctx, _cache) => {
3886
3887
 
3887
3888
  };
3888
3889
 
3889
- script.__file = "src/lib/components/ShDynamicTabs.vue";
3890
+ script$2.__file = "src/lib/components/ShDynamicTabs.vue";
3890
3891
 
3891
3892
  const useUserStore = defineStore('user-store', {
3892
3893
  state: () => ({
@@ -3914,7 +3915,7 @@ const useUserStore = defineStore('user-store', {
3914
3915
  };
3915
3916
  }
3916
3917
  this.user = user;
3917
- apis.doGet('auth/user').then(res => {
3918
+ shApis$1.doGet('auth/user').then(res => {
3918
3919
  const user = res.data;
3919
3920
  ShStorage.setItem('user',res.data);
3920
3921
  user.isAllowedTo = function (slug) {
@@ -3968,13 +3969,304 @@ const useUserStore = defineStore('user-store', {
3968
3969
  }
3969
3970
  });
3970
3971
 
3971
- var ShFrontend = {
3972
+ const _hoisted_1$1 = /*#__PURE__*/createElementVNode("h5", null, "Departments (updated)", -1 /* HOISTED */);
3973
+ const _hoisted_2$1 = {
3974
+ "data-bs-toggle": "modal",
3975
+ ref: "addDeptBtn",
3976
+ href: "#department_modal",
3977
+ class: "btn btn-info btn-sm"
3978
+ };
3979
+ const _hoisted_3$1 = /*#__PURE__*/createElementVNode("i", { class: "fa fa-plus" }, null, -1 /* HOISTED */);
3980
+ const _hoisted_4$1 = /*#__PURE__*/createTextVNode(" ADD DEPARTMENT");
3981
+ const _hoisted_5$1 = [
3982
+ _hoisted_3$1,
3983
+ _hoisted_4$1
3984
+ ];
3985
+
3986
+
3987
+ var script$1 = {
3988
+ __name: 'Departments',
3989
+ setup(__props) {
3990
+
3991
+ ref(null);
3992
+ let allPermissions = ref([]);
3993
+ ref([]);
3994
+ let reload = ref(0);
3995
+ ref(null);
3996
+
3997
+ onMounted(() => {
3998
+ shApis$1.doGet('admin/departments/all-permissions').then(res => {
3999
+ allPermissions.value = res.data;
4000
+ });
4001
+ });
4002
+
4003
+ function departmentAdded (response) {
4004
+ this.reload += 1;
4005
+ }
4006
+
4007
+ return (_ctx, _cache) => {
4008
+ return (openBlock(), createElementBlock(Fragment, null, [
4009
+ _hoisted_1$1,
4010
+ createElementVNode("a", _hoisted_2$1, _hoisted_5$1, 512 /* NEED_PATCH */),
4011
+ createVNode(script$4, {
4012
+ reload: unref(reload),
4013
+ onRowSelected: _ctx.rowSelected,
4014
+ headers: ['id','name','description', 'created_at'],
4015
+ "end-point": "admin/departments/list",
4016
+ actions: {
4017
+ label: 'Action',
4018
+ actions: [
4019
+ {
4020
+ label: 'Permissions',
4021
+ path: '/admin/departments/permissions/{id}',
4022
+ class: 'btn btn-info bi-lock btn-sm'
4023
+ }
4024
+ ]
4025
+ }
4026
+ }, null, 8 /* PROPS */, ["reload", "onRowSelected"]),
4027
+ createVNode(script$6, {
4028
+ "modal-id": "department_modal",
4029
+ "modal-title": "Department Form"
4030
+ }, {
4031
+ default: withCtx(() => [
4032
+ createVNode(script$8, {
4033
+ "success-callback": "departmentAdded",
4034
+ onDepartmentAdded: departmentAdded,
4035
+ action: "admin/departments/store",
4036
+ fields: ['name','description']
4037
+ })
4038
+ ]),
4039
+ _: 1 /* STABLE */
4040
+ })
4041
+ ], 64 /* STABLE_FRAGMENT */))
4042
+ }
4043
+ }
4044
+
4045
+ };
4046
+
4047
+ script$1.__file = "src/lib/components/core/Departments/Departments.vue";
4048
+
4049
+ const _hoisted_1 = /*#__PURE__*/createElementVNode("a", {
4050
+ href: "#addModule",
4051
+ class: "btn btn-info btn-sm",
4052
+ "data-bs-toggle": "modal"
4053
+ }, [
4054
+ /*#__PURE__*/createElementVNode("i", { class: "bi-plus" }),
4055
+ /*#__PURE__*/createTextVNode(" ADD Module")
4056
+ ], -1 /* HOISTED */);
4057
+ const _hoisted_2 = { class: "text-primary text-capitalize" };
4058
+ const _hoisted_3 = ["value"];
4059
+ const _hoisted_4 = /*#__PURE__*/createElementVNode("i", { class: "fa fa-save" }, null, -1 /* HOISTED */);
4060
+ const _hoisted_5 = /*#__PURE__*/createTextVNode(" Submit");
4061
+ const _hoisted_6 = [
4062
+ _hoisted_4,
4063
+ _hoisted_5
4064
+ ];
4065
+
4066
+ var script = {
4067
+ __name: 'Department',
4068
+ setup(__props) {
4069
+
4070
+ const route = useRoute();
4071
+ const id = ref(route.params.id);
4072
+ let department = ref(null);
4073
+ let permissionCanvasBtn = ref(null);
4074
+ let reload = ref(1);
4075
+ let module = ref(null);
4076
+ let modulePermissions = ref(null);
4077
+ let selectedPermissions = ref([]);
4078
+ const userStore = useUserStore();
4079
+
4080
+ storeToRefs(userStore);
4081
+
4082
+ onMounted(() => {
4083
+ getDepartment();
4084
+ });
4085
+
4086
+ let getModule = computed(()=>{
4087
+ return module.value
4088
+ });
4089
+
4090
+
4091
+
4092
+ function moduleAdded () {
4093
+ shRepo.showToast('module added successfully', 'success');
4094
+ reload.value++;
4095
+ }
4096
+ function showModule (module) {
4097
+ if (module) {
4098
+ return '<span class="text-capitalize">' + module.module.replace('_', ' ') + '</span>'
4099
+ }
4100
+ return 'Module'
4101
+ }
4102
+ function deletePermission (module) {
4103
+ shRepo.runPlainRequest('admin/departments/department/delete-department/' + module.id).then((res) => {
4104
+ if (res.isConfirmed) {
4105
+ reload.value++;
4106
+ // shRepo.showToast('module removed successfully', 'success')
4107
+ }
4108
+ });
4109
+ }
4110
+ function viewPermissions(rModule) {
4111
+ module.value = null;
4112
+ permissionCanvasBtn.value.click();
4113
+ modulePermissions.value = null;
4114
+ selectedPermissions.value = [];
4115
+ shApis.doGet('admin/departments/department/get-module-permissions/' + rModule.module).then(res => {
4116
+ modulePermissions.value = res.data.permissions;
4117
+ module.value = rModule;
4118
+ if (rModule.permissions) {
4119
+ selectedPermissions.value = JSON.parse(rModule.permissions);
4120
+ }
4121
+ console.log(module.value);
4122
+ }).catch(ex => {
4123
+ console.log(ex);
4124
+ // helpers.showToast('An error occurred while fetching permissions')
4125
+ });
4126
+ }
4127
+ function getDepartment() {
4128
+ shApis.doGet('admin/departments/department/' + id.value).then(res => {
4129
+ department.value = res.data.department;
4130
+ }).catch(ex => {
4131
+ console.log(ex);
4132
+ });
4133
+ }
4134
+ function getPermissionLeft (menu) {
4135
+ const len = menu.split('.').length * 2;
4136
+ if (len > 5) {
4137
+ return 5
4138
+ }
4139
+ return len
4140
+ }
4141
+ function getPermissionLabel(menu) {
4142
+ const arr = menu.split('.');
4143
+ return arr[arr.length - 1].replace(/_/g, ' ')
4144
+ }
4145
+ function submitPermissions() {
4146
+ const data = {
4147
+ permissions: selectedPermissions.value
4148
+ };
4149
+ shApis.doPost('admin/departments/department/permissions/' + getModule.value.id, data)
4150
+ .then(res => {
4151
+ reload.value++;
4152
+ shRepo.showToast('Permissions updated', 'success');
4153
+ });
4154
+ }
4155
+
4156
+ return (_ctx, _cache) => {
4157
+ return (unref(department))
4158
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4159
+ _hoisted_1,
4160
+ createElementVNode("h5", null, "Department #" + toDisplayString(unref(department).id) + " - " + toDisplayString(unref(department).name) + " Allowed Modules", 1 /* TEXT */),
4161
+ createVNode(script$4, {
4162
+ actions: {
4163
+ label: 'Actions',
4164
+ actions: [
4165
+ {
4166
+ label: 'Permissions',
4167
+ emits: viewPermissions,
4168
+ class: 'btn btn-success btn-sm'
4169
+ },
4170
+ {
4171
+ label: 'Delete',
4172
+ emits: deletePermission,
4173
+ class: 'btn btn-danger mx-2 btn-sm'
4174
+ }
4175
+ ]
4176
+ },
4177
+ reload: unref(reload),
4178
+ headers: ['id',showModule,'created_at'],
4179
+ "end-point": 'admin/departments/department/list-modules/' + id.value
4180
+ }, null, 8 /* PROPS */, ["actions", "reload", "headers", "end-point"]),
4181
+ createVNode(script$6, {
4182
+ "modal-id": "addModule",
4183
+ "modal-title": "Add Module Department"
4184
+ }, {
4185
+ default: withCtx(() => [
4186
+ createVNode(script$8, {
4187
+ "reload-select-items": unref(reload),
4188
+ "success-callback": moduleAdded,
4189
+ "fill-selects": {
4190
+ permission_module: {
4191
+ url: 'admin/departments/department/list-pending-modules/' + id.value
4192
+ }
4193
+ },
4194
+ fields: ['permission_module'],
4195
+ action: 'admin/departments/department/add-module/' + id.value
4196
+ }, null, 8 /* PROPS */, ["reload-select-items", "fill-selects", "action"])
4197
+ ]),
4198
+ _: 1 /* STABLE */
4199
+ }),
4200
+ createElementVNode("a", {
4201
+ href: "#permissionsCanvas",
4202
+ class: "d-none",
4203
+ ref_key: "permissionCanvasBtn",
4204
+ ref: permissionCanvasBtn,
4205
+ "data-bs-toggle": "offcanvas"
4206
+ }, null, 512 /* NEED_PATCH */),
4207
+ createVNode(script$7, {
4208
+ "canvas-id": "permissionsCanvas",
4209
+ position: "end enlarged",
4210
+ "canvas-title": "Module Permissions"
4211
+ }, {
4212
+ default: withCtx(() => [
4213
+ (unref(getModule))
4214
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4215
+ createElementVNode("h5", _hoisted_2, "Permissions for " + toDisplayString(unref(getModule).module), 1 /* TEXT */),
4216
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(modulePermissions), (permission) => {
4217
+ return (openBlock(), createElementBlock("div", {
4218
+ key: permission,
4219
+ class: "list-group p-0"
4220
+ }, [
4221
+ createElementVNode("label", {
4222
+ class: normalizeClass(["list-group-item pb-0 text-capitalize", 'ms-' + getPermissionLeft(permission)])
4223
+ }, [
4224
+ withDirectives(createElementVNode("input", {
4225
+ type: "checkbox",
4226
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (isRef(selectedPermissions) ? (selectedPermissions).value = $event : selectedPermissions = $event)),
4227
+ value: permission
4228
+ }, null, 8 /* PROPS */, _hoisted_3), [
4229
+ [vModelCheckbox, unref(selectedPermissions)]
4230
+ ]),
4231
+ createTextVNode(" " + toDisplayString(getPermissionLabel(permission)), 1 /* TEXT */)
4232
+ ], 2 /* CLASS */)
4233
+ ]))
4234
+ }), 128 /* KEYED_FRAGMENT */)),
4235
+ createElementVNode("button", {
4236
+ onClick: submitPermissions,
4237
+ class: "btn btn-info"
4238
+ }, _hoisted_6)
4239
+ ], 64 /* STABLE_FRAGMENT */))
4240
+ : createCommentVNode("v-if", true)
4241
+ ]),
4242
+ _: 1 /* STABLE */
4243
+ })
4244
+ ], 64 /* STABLE_FRAGMENT */))
4245
+ : createCommentVNode("v-if", true)
4246
+ }
4247
+ }
4248
+
4249
+ };
4250
+
4251
+ script.__file = "src/lib/components/core/Departments/department/Department.vue";
4252
+
4253
+ const ShFrontend = {
3972
4254
  install: (app, options) => {
3973
4255
  if(options.sessionTimeout){
3974
4256
  app.provide('sessionTimeout',options.sessionTimeout);
3975
4257
  ShStorage.setItem('sessionTimeout',options.sessionTimeout);
3976
4258
  }
4259
+ if(options.router) {
4260
+ options.router.addRoute({
4261
+ path: '/sh-departments',
4262
+ component: script$1
4263
+ });
4264
+ options.router.addRoute({
4265
+ path: '/sh-departments/permissions/:id',
4266
+ component: script
4267
+ });
4268
+ }
3977
4269
  }
3978
4270
  };
3979
4271
 
3980
- export { script$5 as ShCanvas, script as ShDynamicTabs, script$6 as ShForm, ShFrontend, script$4 as ShModal, script$9 as ShPhone, script$2 as ShTable, script$1 as ShTabs, apis as shApis, helpers as shRepo, ShStorage as shStorage, useUserStore };
4272
+ 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 };