@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.js CHANGED
@@ -9,6 +9,7 @@ var NProgress = require('nprogress');
9
9
  var Editor = require('@tinymce/tinymce-vue');
10
10
  var Swal = require('sweetalert2');
11
11
  var pinia = require('pinia');
12
+ var vueRouter = require('vue-router');
12
13
 
13
14
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
15
 
@@ -99,7 +100,7 @@ function doPost (endPoint, data) {
99
100
  )
100
101
  }
101
102
 
102
- var apis = {
103
+ var shApis$1 = {
103
104
  doGet,
104
105
  doPost
105
106
  };
@@ -1577,7 +1578,7 @@ const countries = [
1577
1578
  }
1578
1579
  ];
1579
1580
 
1580
- var script$9 = {
1581
+ var script$b = {
1581
1582
  name: 'ShPhone',
1582
1583
  props: ['modelValue', 'country_code'],
1583
1584
  data () {
@@ -1639,19 +1640,19 @@ var script$9 = {
1639
1640
  }
1640
1641
  };
1641
1642
 
1642
- const _hoisted_1$9 = { class: "sh-phone mb-3" };
1643
- const _hoisted_2$8 = {
1643
+ const _hoisted_1$b = { class: "sh-phone mb-3" };
1644
+ const _hoisted_2$a = {
1644
1645
  key: 0,
1645
1646
  style: {"display":"contents"}
1646
1647
  };
1647
- const _hoisted_3$8 = ["src"];
1648
- const _hoisted_4$8 = ["value"];
1648
+ const _hoisted_3$a = ["src"];
1649
+ const _hoisted_4$a = ["value"];
1649
1650
 
1650
1651
  function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1651
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
1652
+ return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
1652
1653
  ($data.selectedCountry)
1653
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$8, [
1654
- vue.createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$8),
1654
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$a, [
1655
+ vue.createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$a),
1655
1656
  vue.createTextVNode(" " + vue.toDisplayString($data.selectedCountry.dialCode), 1 /* TEXT */)
1656
1657
  ]))
1657
1658
  : vue.createCommentVNode("v-if", true),
@@ -1664,7 +1665,7 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1664
1665
  return (vue.openBlock(), vue.createElementBlock("option", {
1665
1666
  value: country,
1666
1667
  key: country.dialCode
1667
- }, vue.toDisplayString(country.name + '(' + country.dialCode + ')'), 9 /* TEXT, PROPS */, _hoisted_4$8))
1668
+ }, vue.toDisplayString(country.name + '(' + country.dialCode + ')'), 9 /* TEXT, PROPS */, _hoisted_4$a))
1668
1669
  }), 128 /* KEYED_FRAGMENT */))
1669
1670
  ], 544 /* HYDRATE_EVENTS, NEED_PATCH */), [
1670
1671
  [vue.vModelSelect, $data.selectedCountry]
@@ -1682,10 +1683,10 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1682
1683
  ]))
1683
1684
  }
1684
1685
 
1685
- script$9.render = render$7;
1686
- script$9.__file = "src/lib/components/ShPhone.vue";
1686
+ script$b.render = render$7;
1687
+ script$b.__file = "src/lib/components/ShPhone.vue";
1687
1688
 
1688
- var script$8 = {
1689
+ var script$a = {
1689
1690
  name: 'ShEditor',
1690
1691
  props: ['modelValue'],
1691
1692
  components: {
@@ -1724,7 +1725,7 @@ var script$8 = {
1724
1725
  }
1725
1726
  };
1726
1727
 
1727
- const _hoisted_1$8 = /*#__PURE__*/vue.createElementVNode("textarea", {
1728
+ const _hoisted_1$a = /*#__PURE__*/vue.createElementVNode("textarea", {
1728
1729
  id: "tiny",
1729
1730
  style: {"display":"none"},
1730
1731
  "data-cy": "tinymce_editor"
@@ -1734,7 +1735,7 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
1734
1735
  const _component_editor = vue.resolveComponent("editor");
1735
1736
 
1736
1737
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
1737
- _hoisted_1$8,
1738
+ _hoisted_1$a,
1738
1739
  vue.createElementVNode("div", {
1739
1740
  onFocusin: _cache[1] || (_cache[1] = vue.withModifiers(() => {}, ["stop"])),
1740
1741
  class: "sh-editor w-100"
@@ -1759,18 +1760,18 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
1759
1760
  ], 64 /* STABLE_FRAGMENT */))
1760
1761
  }
1761
1762
 
1762
- script$8.render = render$6;
1763
- script$8.__file = "src/lib/components/FormComponent/ShEditor.vue";
1763
+ script$a.render = render$6;
1764
+ script$a.__file = "src/lib/components/FormComponent/ShEditor.vue";
1764
1765
 
1765
- const _hoisted_1$7 = {
1766
+ const _hoisted_1$9 = {
1766
1767
  key: 0,
1767
1768
  class: "dropdown sh-suggest"
1768
1769
  };
1769
- const _hoisted_2$7 = ["id"];
1770
- const _hoisted_3$7 = { class: "badge bg-secondary m-1 sh-selected-item" };
1771
- const _hoisted_4$7 = ["onClick"];
1772
- const _hoisted_5$5 = ["id"];
1773
- const _hoisted_6$3 = ["id", "aria-labelledby"];
1770
+ const _hoisted_2$9 = ["id"];
1771
+ const _hoisted_3$9 = { class: "badge bg-secondary m-1 sh-selected-item" };
1772
+ const _hoisted_4$9 = ["onClick"];
1773
+ const _hoisted_5$7 = ["id"];
1774
+ const _hoisted_6$4 = ["id", "aria-labelledby"];
1774
1775
  const _hoisted_7$3 = { key: 0 };
1775
1776
  const _hoisted_8$2 = ["onClick"];
1776
1777
  const _hoisted_9$2 = {
@@ -1783,7 +1784,7 @@ const _hoisted_10$3 = {
1783
1784
  };
1784
1785
 
1785
1786
 
1786
- var script$7 = {
1787
+ var script$9 = {
1787
1788
  __name: 'ShSuggest',
1788
1789
  props: ['fillSelects','modelValue'],
1789
1790
  emits: ['update:modelValue'],
@@ -1854,7 +1855,7 @@ function filterData(e){
1854
1855
  }
1855
1856
  });
1856
1857
  } else {
1857
- apis.doGet(props.fillSelects.url, { all: 1,filter_value: filterValue }).then(res => {
1858
+ shApis$1.doGet(props.fillSelects.url, { all: 1,filter_value: filterValue }).then(res => {
1858
1859
  suggestions.value = res.data.data;
1859
1860
  }).catch(res => {
1860
1861
  console.log(res);
@@ -1864,7 +1865,7 @@ function filterData(e){
1864
1865
 
1865
1866
  return (_ctx, _cache) => {
1866
1867
  return (vue.unref(id))
1867
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
1868
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
1868
1869
  vue.createElementVNode("div", {
1869
1870
  id: vue.unref(id),
1870
1871
  "data-bs-toggle": "dropdown",
@@ -1873,14 +1874,14 @@ return (_ctx, _cache) => {
1873
1874
  }, [
1874
1875
  vue.createElementVNode("div", null, [
1875
1876
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(selectedSuggestions), (sgt) => {
1876
- return (vue.openBlock(), vue.createElementBlock("h5", _hoisted_3$7, [
1877
+ return (vue.openBlock(), vue.createElementBlock("h5", _hoisted_3$9, [
1877
1878
  vue.createTextVNode(vue.toDisplayString(sgt.name) + " ", 1 /* TEXT */),
1878
1879
  vue.createElementVNode("button", {
1879
1880
  onClick: $event => (removeSuggestion(sgt.id)),
1880
1881
  type: "button",
1881
1882
  class: "btn-close border-start border-1 ms-1",
1882
1883
  "aria-label": "Close"
1883
- }, null, 8 /* PROPS */, _hoisted_4$7)
1884
+ }, null, 8 /* PROPS */, _hoisted_4$9)
1884
1885
  ]))
1885
1886
  }), 256 /* UNKEYED_FRAGMENT */))
1886
1887
  ]),
@@ -1889,8 +1890,8 @@ return (_ctx, _cache) => {
1889
1890
  contenteditable: "true",
1890
1891
  onInput: filterData,
1891
1892
  class: "flex-fill h-100 sh-suggestion-input"
1892
- }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_5$5)
1893
- ], 8 /* PROPS */, _hoisted_2$7),
1893
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_5$7)
1894
+ ], 8 /* PROPS */, _hoisted_2$9),
1894
1895
  vue.createElementVNode("ul", {
1895
1896
  class: "dropdown-menu w-100",
1896
1897
  id: 'dropwdown_section' + vue.unref(id),
@@ -1915,7 +1916,7 @@ return (_ctx, _cache) => {
1915
1916
  : (vue.unref(searchText))
1916
1917
  ? (vue.openBlock(), vue.createElementBlock("li", _hoisted_9$2, " No results found "))
1917
1918
  : (vue.openBlock(), vue.createElementBlock("li", _hoisted_10$3, " Type to search... "))
1918
- ], 8 /* PROPS */, _hoisted_6$3)
1919
+ ], 8 /* PROPS */, _hoisted_6$4)
1919
1920
  ]))
1920
1921
  : vue.createCommentVNode("v-if", true)
1921
1922
  }
@@ -1923,15 +1924,15 @@ return (_ctx, _cache) => {
1923
1924
 
1924
1925
  };
1925
1926
 
1926
- script$7.__scopeId = "data-v-5b767123";
1927
- script$7.__file = "src/lib/components/FormComponent/ShSuggest.vue";
1927
+ script$9.__scopeId = "data-v-5b767123";
1928
+ script$9.__file = "src/lib/components/FormComponent/ShSuggest.vue";
1928
1929
 
1929
- var script$6 = {
1930
+ var script$8 = {
1930
1931
  name: 'ShForm',
1931
1932
  components: {
1932
- ShSuggest: script$7,
1933
- ShEditor: script$8,
1934
- ShPhone: script$9
1933
+ ShSuggest: script$9,
1934
+ ShEditor: script$a,
1935
+ ShPhone: script$b
1935
1936
  },
1936
1937
  props: [
1937
1938
  'action',
@@ -2121,7 +2122,7 @@ var script$6 = {
2121
2122
  Object.keys(this.form_files).forEach(key => {
2122
2123
  data.append(key, this.form_files[key].value);
2123
2124
  });
2124
- apis.doPost(this.action, data).then(res => {
2125
+ shApis$1.doPost(this.action, data).then(res => {
2125
2126
  // console.log(res)
2126
2127
  this.form_status = 2;
2127
2128
  Object.keys(this.form_elements).forEach(key => {
@@ -2209,7 +2210,7 @@ var script$6 = {
2209
2210
  this.selectData = selectData;
2210
2211
  console.log(this.selectData);
2211
2212
  } else {
2212
- apis.doGet(this.fillSelects[key].url, { all: 1 }).then(res => {
2213
+ shApis$1.doGet(this.fillSelects[key].url, { all: 1 }).then(res => {
2213
2214
  // selectData[key] = res.data
2214
2215
  // console.log(res)
2215
2216
  this.selectData[key] = res.data.data;
@@ -2238,19 +2239,19 @@ var script$6 = {
2238
2239
  }
2239
2240
  };
2240
2241
 
2241
- const _hoisted_1$6 = {
2242
+ const _hoisted_1$8 = {
2242
2243
  ref: "ShAutoForm",
2243
2244
  class: "sh-form"
2244
2245
  };
2245
- const _hoisted_2$6 = {
2246
+ const _hoisted_2$8 = {
2246
2247
  key: 0,
2247
2248
  class: "alert alert-danger alert-dismissible fade show sh-form-submission-error",
2248
2249
  role: "alert"
2249
2250
  };
2250
- const _hoisted_3$6 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-exclamation-triangle-fill me-1" }, null, -1 /* HOISTED */);
2251
- const _hoisted_4$6 = { key: 0 };
2252
- const _hoisted_5$4 = { key: 1 };
2253
- const _hoisted_6$2 = { class: "row" };
2251
+ const _hoisted_3$8 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-exclamation-triangle-fill me-1" }, null, -1 /* HOISTED */);
2252
+ const _hoisted_4$8 = { key: 0 };
2253
+ const _hoisted_5$6 = { key: 1 };
2254
+ const _hoisted_6$3 = { class: "row" };
2254
2255
  const _hoisted_7$2 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
2255
2256
  const _hoisted_8$1 = { class: "col-md-12" };
2256
2257
  const _hoisted_9$1 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
@@ -2303,15 +2304,15 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2303
2304
  const _component_ShSuggest = vue.resolveComponent("ShSuggest");
2304
2305
  const _component_ShEditor = vue.resolveComponent("ShEditor");
2305
2306
 
2306
- return (vue.openBlock(), vue.createElementBlock("form", _hoisted_1$6, [
2307
+ return (vue.openBlock(), vue.createElementBlock("form", _hoisted_1$8, [
2307
2308
  vue.createCommentVNode(" <div v-if=\"form_status == 1\" class=\"alert alert-info\">Processing...</div>"),
2308
2309
  vue.createCommentVNode(" <div v-if=\"form_status == 2\" class=\"alert alert-success\">Success</div>"),
2309
2310
  (_ctx.form_status == 3)
2310
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$6, [
2311
- _hoisted_3$6,
2311
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$8, [
2312
+ _hoisted_3$8,
2312
2313
  (_ctx.errorText)
2313
- ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$6, vue.toDisplayString(_ctx.errorText), 1 /* TEXT */))
2314
- : (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$4, "Unexpected Error Occurred")),
2314
+ ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$8, vue.toDisplayString(_ctx.errorText), 1 /* TEXT */))
2315
+ : (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$6, "Unexpected Error Occurred")),
2315
2316
  vue.createElementVNode("button", {
2316
2317
  onClick: _cache[0] || (_cache[0] = (...args) => ($options.hideError && $options.hideError(...args))),
2317
2318
  type: "button",
@@ -2326,7 +2327,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2326
2327
  }, null, 512 /* NEED_PATCH */), [
2327
2328
  [vue.vModelText, _ctx.form_elements['id']]
2328
2329
  ]),
2329
- vue.createElementVNode("div", _hoisted_6$2, [
2330
+ vue.createElementVNode("div", _hoisted_6$3, [
2330
2331
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.fields, (field) => {
2331
2332
  return (vue.openBlock(), vue.createElementBlock("div", {
2332
2333
  class: vue.normalizeClass(["form-group", 'col-md-' + $options.getColumns()]),
@@ -2508,10 +2509,10 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2508
2509
  ], 512 /* NEED_PATCH */))
2509
2510
  }
2510
2511
 
2511
- script$6.render = render$5;
2512
- script$6.__file = "src/lib/components/ShForm.vue";
2512
+ script$8.render = render$5;
2513
+ script$8.__file = "src/lib/components/ShForm.vue";
2513
2514
 
2514
- var script$5 = {
2515
+ var script$7 = {
2515
2516
  name: 'ShCanvas',
2516
2517
  props: ['canvasTitle', 'canvasId', 'position'],
2517
2518
  components: {
@@ -2528,13 +2529,13 @@ var script$5 = {
2528
2529
  }
2529
2530
  };
2530
2531
 
2531
- const _hoisted_1$5 = ["id"];
2532
- const _hoisted_2$5 = { class: "offcanvas-header" };
2533
- const _hoisted_3$5 = {
2532
+ const _hoisted_1$7 = ["id"];
2533
+ const _hoisted_2$7 = { class: "offcanvas-header" };
2534
+ const _hoisted_3$7 = {
2534
2535
  class: "offcanvas-title",
2535
2536
  id: "offcanvasScrollingLabel"
2536
2537
  };
2537
- const _hoisted_4$5 = { class: "offcanvas-body" };
2538
+ const _hoisted_4$7 = { class: "offcanvas-body" };
2538
2539
 
2539
2540
  function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2540
2541
  return (vue.openBlock(), vue.createElementBlock("div", {
@@ -2544,8 +2545,8 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2544
2545
  id: $props.canvasId,
2545
2546
  "aria-labelledby": "offcanvasScrollingLabel"
2546
2547
  }, [
2547
- vue.createElementVNode("div", _hoisted_2$5, [
2548
- vue.createElementVNode("h5", _hoisted_3$5, vue.toDisplayString($props.canvasTitle), 1 /* TEXT */),
2548
+ vue.createElementVNode("div", _hoisted_2$7, [
2549
+ vue.createElementVNode("h5", _hoisted_3$7, vue.toDisplayString($props.canvasTitle), 1 /* TEXT */),
2549
2550
  vue.createElementVNode("button", {
2550
2551
  type: "button",
2551
2552
  ref: "closecanvas",
@@ -2555,32 +2556,32 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2555
2556
  "aria-label": "Close"
2556
2557
  }, null, 512 /* NEED_PATCH */)
2557
2558
  ]),
2558
- vue.createElementVNode("div", _hoisted_4$5, [
2559
+ vue.createElementVNode("div", _hoisted_4$7, [
2559
2560
  vue.renderSlot(_ctx.$slots, "default")
2560
2561
  ])
2561
- ], 10 /* CLASS, PROPS */, _hoisted_1$5))
2562
+ ], 10 /* CLASS, PROPS */, _hoisted_1$7))
2562
2563
  }
2563
2564
 
2564
- script$5.render = render$4;
2565
- script$5.__file = "src/lib/components/ShCanvas.vue";
2565
+ script$7.render = render$4;
2566
+ script$7.__file = "src/lib/components/ShCanvas.vue";
2566
2567
 
2567
- var script$4 = {
2568
+ var script$6 = {
2568
2569
  name: 'ShModal',
2569
2570
  props: ['modalTitle', 'modalId', 'modalSize'],
2570
2571
  components: {
2571
2572
  }
2572
2573
  };
2573
2574
 
2574
- const _hoisted_1$4 = ["id"];
2575
- const _hoisted_2$4 = { class: "modal-content" };
2576
- const _hoisted_3$4 = { class: "modal-header" };
2577
- const _hoisted_4$4 = { class: "modal-title" };
2578
- const _hoisted_5$3 = /*#__PURE__*/vue.createElementVNode("button", {
2575
+ const _hoisted_1$6 = ["id"];
2576
+ const _hoisted_2$6 = { class: "modal-content" };
2577
+ const _hoisted_3$6 = { class: "modal-header" };
2578
+ const _hoisted_4$6 = { class: "modal-title" };
2579
+ const _hoisted_5$5 = /*#__PURE__*/vue.createElementVNode("button", {
2579
2580
  class: "btn btn-danger btn-sm",
2580
2581
  "data-bs-dismiss": "modal",
2581
2582
  "data-dismiss": "modal"
2582
2583
  }, "×", -1 /* HOISTED */);
2583
- const _hoisted_6$1 = { class: "modal-body" };
2584
+ const _hoisted_6$2 = { class: "modal-body" };
2584
2585
  const _hoisted_7$1 = { class: "section" };
2585
2586
 
2586
2587
  function render$3(_ctx, _cache, $props, $setup, $data, $options) {
@@ -2594,25 +2595,25 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2594
2595
  vue.createElementVNode("div", {
2595
2596
  class: vue.normalizeClass(["modal-dialog", `modal-${$props.modalSize}`])
2596
2597
  }, [
2597
- vue.createElementVNode("div", _hoisted_2$4, [
2598
- vue.createElementVNode("div", _hoisted_3$4, [
2599
- vue.createElementVNode("h3", _hoisted_4$4, vue.toDisplayString($props.modalTitle), 1 /* TEXT */),
2600
- _hoisted_5$3
2598
+ vue.createElementVNode("div", _hoisted_2$6, [
2599
+ vue.createElementVNode("div", _hoisted_3$6, [
2600
+ vue.createElementVNode("h3", _hoisted_4$6, vue.toDisplayString($props.modalTitle), 1 /* TEXT */),
2601
+ _hoisted_5$5
2601
2602
  ]),
2602
- vue.createElementVNode("div", _hoisted_6$1, [
2603
+ vue.createElementVNode("div", _hoisted_6$2, [
2603
2604
  vue.createElementVNode("div", _hoisted_7$1, [
2604
2605
  vue.renderSlot(_ctx.$slots, "default")
2605
2606
  ])
2606
2607
  ])
2607
2608
  ])
2608
2609
  ], 2 /* CLASS */)
2609
- ], 8 /* PROPS */, _hoisted_1$4))
2610
+ ], 8 /* PROPS */, _hoisted_1$6))
2610
2611
  }
2611
2612
 
2612
- script$4.render = render$3;
2613
- script$4.__file = "src/lib/components/ShModal.vue";
2613
+ script$6.render = render$3;
2614
+ script$6.__file = "src/lib/components/ShModal.vue";
2614
2615
 
2615
- var script$3 = {
2616
+ var script$5 = {
2616
2617
  name: 'Pagination',
2617
2618
  props: ['pagination_data', 'loadMore', 'hideCount', 'hideLoadMore'],
2618
2619
  data () {
@@ -2683,13 +2684,13 @@ var script$3 = {
2683
2684
  }
2684
2685
  };
2685
2686
 
2686
- const _hoisted_1$3 = { key: 0 };
2687
- const _hoisted_2$3 = { class: "record_count_body mb-3" };
2688
- const _hoisted_3$3 = /*#__PURE__*/vue.createElementVNode("span", { class: "per_page_show" }, "Showing", -1 /* HOISTED */);
2689
- const _hoisted_4$3 = /*#__PURE__*/vue.createTextVNode("  ");
2690
- const _hoisted_5$2 = /*#__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);
2687
+ const _hoisted_1$5 = { key: 0 };
2688
+ const _hoisted_2$5 = { class: "record_count_body mb-3" };
2689
+ const _hoisted_3$5 = /*#__PURE__*/vue.createElementVNode("span", { class: "per_page_show" }, "Showing", -1 /* HOISTED */);
2690
+ const _hoisted_4$5 = /*#__PURE__*/vue.createTextVNode("  ");
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);
2691
2692
  const _hoisted_10$1 = [
2692
- _hoisted_5$2
2693
+ _hoisted_5$4
2693
2694
  ];
2694
2695
  const _hoisted_11$1 = { class: "record_counts" };
2695
2696
  const _hoisted_12$1 = {
@@ -2730,10 +2731,10 @@ const _hoisted_23$1 = {
2730
2731
 
2731
2732
  function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2732
2733
  return (!$props.loadMore)
2733
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
2734
- vue.createElementVNode("div", _hoisted_2$3, [
2735
- _hoisted_3$3,
2736
- _hoisted_4$3,
2734
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
2735
+ vue.createElementVNode("div", _hoisted_2$5, [
2736
+ _hoisted_3$5,
2737
+ _hoisted_4$5,
2737
2738
  vue.withDirectives(vue.createElementVNode("select", {
2738
2739
  class: "select_per_page",
2739
2740
  onChange: _cache[0] || (_cache[0] = (...args) => ($options.changePerPage && $options.changePerPage(...args))),
@@ -2802,8 +2803,8 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2802
2803
  ]))
2803
2804
  }
2804
2805
 
2805
- script$3.render = render$2;
2806
- script$3.__file = "src/lib/components/list_templates/Pagination.vue";
2806
+ script$5.render = render$2;
2807
+ script$5.__file = "src/lib/components/list_templates/Pagination.vue";
2807
2808
 
2808
2809
  function swalSuccess (message) {
2809
2810
  Swal__default["default"].fire('Success!', message, 'success');
@@ -2841,11 +2842,11 @@ function swalHttpError (reason) {
2841
2842
  }
2842
2843
 
2843
2844
  function runSilentRequest (url) {
2844
- return apis.doPost(url)
2845
+ return shApis$1.doPost(url)
2845
2846
  }
2846
2847
 
2847
2848
  function setTabCounts (url) {
2848
- apis.doGet(url).then(res => {
2849
+ shApis$1.doGet(url).then(res => {
2849
2850
  Object.keys(res.data).forEach(key => {
2850
2851
  const elem = document.getElementById(key);
2851
2852
  if (elem === null) {
@@ -2892,7 +2893,7 @@ function formatHttpCatchError (reason) {
2892
2893
  return error
2893
2894
  }
2894
2895
  function getMenuCount (url) {
2895
- apis.doGet(url).then(res => {
2896
+ shApis$1.doGet(url).then(res => {
2896
2897
  console.log(res);
2897
2898
  });
2898
2899
  }
@@ -2935,7 +2936,7 @@ async function runPlainRequest (url, message, title, data) {
2935
2936
  reverseButtons: true,
2936
2937
  showLoaderOnConfirm: true,
2937
2938
  preConfirm: () => {
2938
- return apis.doPost(url, data).then(function (response) {
2939
+ return shApis$1.doPost(url, data).then(function (response) {
2939
2940
  Swal__default["default"].fire('Success!', 'Action completed successfully', 'success');
2940
2941
  return {
2941
2942
  response: response.data,
@@ -2964,7 +2965,7 @@ function formatDate(date, format) {
2964
2965
  return moment__default["default"](date).format(format)
2965
2966
  }
2966
2967
 
2967
- var helpers = {
2968
+ var shRepo$1 = {
2968
2969
  swalSuccess,
2969
2970
  swalError,
2970
2971
  runPlainRequest,
@@ -2977,7 +2978,7 @@ var helpers = {
2977
2978
  formatDate
2978
2979
  };
2979
2980
 
2980
- var script$2 = {
2981
+ var script$4 = {
2981
2982
  name: 'sh-table',
2982
2983
  props: ['endPoint', 'headers', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover'],
2983
2984
  inject: ['channel', 'global'],
@@ -3103,7 +3104,7 @@ var script$2 = {
3103
3104
  titles: headers,
3104
3105
  export: 1
3105
3106
  };
3106
- apis.doPost(this.endPoint, data).then(res => {
3107
+ shApis$1.doPost(this.endPoint, data).then(res => {
3107
3108
  this.downloading = false;
3108
3109
  if (res.data.file) {
3109
3110
  const url = this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name;
@@ -3115,7 +3116,7 @@ var script$2 = {
3115
3116
  console.log(reason);
3116
3117
  this.downloading = false;
3117
3118
  const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText}`;
3118
- helpers.swalError('Error', error);
3119
+ shRepo$1.swalError('Error', error);
3119
3120
  });
3120
3121
  },
3121
3122
  reloadData: function (page, append) {
@@ -3133,7 +3134,7 @@ var script$2 = {
3133
3134
  if (this.pagination_data) {
3134
3135
  this.pagination_data.loading = 1;
3135
3136
  }
3136
- apis.doGet(this.endPoint, data).then(req => {
3137
+ shApis$1.doGet(this.endPoint, data).then(req => {
3137
3138
  this.loading = 'done';
3138
3139
  const response = req.data.data;
3139
3140
  this.pagination_data = {
@@ -3176,7 +3177,7 @@ var script$2 = {
3176
3177
  this.reloadData();
3177
3178
  },
3178
3179
  components: {
3179
- pagination: script$3
3180
+ pagination: script$5
3180
3181
  },
3181
3182
  computed: {
3182
3183
  windowWidth: function () {
@@ -3194,15 +3195,15 @@ var script$2 = {
3194
3195
  }
3195
3196
  };
3196
3197
 
3197
- const _hoisted_1$2 = { class: "auto-table" };
3198
- const _hoisted_2$2 = {
3198
+ const _hoisted_1$4 = { class: "auto-table" };
3199
+ const _hoisted_2$4 = {
3199
3200
  key: 0,
3200
3201
  class: "col-md-4 mb-2"
3201
3202
  };
3202
- const _hoisted_3$2 = ["disabled"];
3203
- const _hoisted_4$2 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */);
3204
- const _hoisted_5$1 = /*#__PURE__*/vue.createTextVNode(" Export ");
3205
- const _hoisted_6 = /*#__PURE__*/vue.createElementVNode("span", {
3203
+ const _hoisted_3$4 = ["disabled"];
3204
+ const _hoisted_4$4 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */);
3205
+ const _hoisted_5$3 = /*#__PURE__*/vue.createTextVNode(" Export ");
3206
+ const _hoisted_6$1 = /*#__PURE__*/vue.createElementVNode("span", {
3206
3207
  class: "spinner-border spinner-border-sm",
3207
3208
  role: "status",
3208
3209
  "aria-hidden": "true"
@@ -3357,9 +3358,9 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3357
3358
  const _component_router_link = vue.resolveComponent("router-link");
3358
3359
  const _component_pagination = vue.resolveComponent("pagination");
3359
3360
 
3360
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
3361
+ return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
3361
3362
  ($props.hasDownload)
3362
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2, [
3363
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$4, [
3363
3364
  vue.createElementVNode("button", {
3364
3365
  disabled: $data.downloading,
3365
3366
  class: "btn btn-warning btn-sm",
@@ -3367,14 +3368,14 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3367
3368
  }, [
3368
3369
  (!$data.downloading)
3369
3370
  ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3370
- _hoisted_4$2,
3371
- _hoisted_5$1
3371
+ _hoisted_4$4,
3372
+ _hoisted_5$3
3372
3373
  ], 64 /* STABLE_FRAGMENT */))
3373
3374
  : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
3374
- _hoisted_6,
3375
+ _hoisted_6$1,
3375
3376
  _hoisted_7
3376
3377
  ], 64 /* STABLE_FRAGMENT */))
3377
- ], 8 /* PROPS */, _hoisted_3$2)
3378
+ ], 8 /* PROPS */, _hoisted_3$4)
3378
3379
  ]))
3379
3380
  : vue.createCommentVNode("v-if", true),
3380
3381
  (!$props.hideSearch)
@@ -3683,10 +3684,10 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3683
3684
  ]))
3684
3685
  }
3685
3686
 
3686
- script$2.render = render$1;
3687
- script$2.__file = "src/lib/components/ShTable.vue";
3687
+ script$4.render = render$1;
3688
+ script$4.__file = "src/lib/components/ShTable.vue";
3688
3689
 
3689
- var script$1 = {
3690
+ var script$3 = {
3690
3691
  name: 'ShTabs',
3691
3692
  props: ['tabs', 'baseUrl', 'sharedData', 'tabCounts', 'responsive'],
3692
3693
  data () {
@@ -3727,7 +3728,7 @@ var script$1 = {
3727
3728
  if (typeof tabCounts === 'object') {
3728
3729
  this.setCounts(tabCounts);
3729
3730
  } else {
3730
- apis.doGet(tabCounts).then(res => {
3731
+ shApis$1.doGet(tabCounts).then(res => {
3731
3732
  this.setCounts(res.data);
3732
3733
  });
3733
3734
  }
@@ -3767,14 +3768,14 @@ var script$1 = {
3767
3768
  }
3768
3769
  };
3769
3770
 
3770
- const _hoisted_1$1 = {
3771
+ const _hoisted_1$3 = {
3771
3772
  key: 0,
3772
3773
  class: "navbar navbar-expand-lg sh-horizontal-tabs"
3773
3774
  };
3774
- const _hoisted_2$1 = ["data-bs-target"];
3775
- const _hoisted_3$1 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-chevron-right float-end" }, null, -1 /* HOISTED */);
3776
- const _hoisted_4$1 = ["id"];
3777
- const _hoisted_5 = { class: "tab-content" };
3775
+ const _hoisted_2$3 = ["data-bs-target"];
3776
+ const _hoisted_3$3 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-chevron-right float-end" }, null, -1 /* HOISTED */);
3777
+ const _hoisted_4$3 = ["id"];
3778
+ const _hoisted_5$2 = { class: "tab-content" };
3778
3779
 
3779
3780
  function render(_ctx, _cache, $props, $setup, $data, $options) {
3780
3781
  const _component_router_link = vue.resolveComponent("router-link");
@@ -3782,7 +3783,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
3782
3783
 
3783
3784
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
3784
3785
  ($data.generatedId)
3785
- ? (vue.openBlock(), vue.createElementBlock("nav", _hoisted_1$1, [
3786
+ ? (vue.openBlock(), vue.createElementBlock("nav", _hoisted_1$3, [
3786
3787
  ($data.isResponsive)
3787
3788
  ? (vue.openBlock(), vue.createElementBlock("a", {
3788
3789
  key: 0,
@@ -3795,8 +3796,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
3795
3796
  "aria-label": "Toggle navigation"
3796
3797
  }, [
3797
3798
  vue.createTextVNode(vue.toDisplayString($data.currentTab) + " ", 1 /* TEXT */),
3798
- _hoisted_3$1
3799
- ], 8 /* PROPS */, _hoisted_2$1))
3799
+ _hoisted_3$3
3800
+ ], 8 /* PROPS */, _hoisted_2$3))
3800
3801
  : vue.createCommentVNode("v-if", true),
3801
3802
  vue.createElementVNode("div", {
3802
3803
  class: vue.normalizeClass($data.isResponsive ? 'collapse navbar-collapse':''),
@@ -3825,10 +3826,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
3825
3826
  ]))
3826
3827
  }), 128 /* KEYED_FRAGMENT */))
3827
3828
  ], 2 /* CLASS */)
3828
- ], 10 /* CLASS, PROPS */, _hoisted_4$1)
3829
+ ], 10 /* CLASS, PROPS */, _hoisted_4$3)
3829
3830
  ]))
3830
3831
  : vue.createCommentVNode("v-if", true),
3831
- vue.createElementVNode("div", _hoisted_5, [
3832
+ vue.createElementVNode("div", _hoisted_5$2, [
3832
3833
  vue.createVNode(_component_router_view, {
3833
3834
  currentTab: $data.currentTab,
3834
3835
  sharedData: $props.sharedData,
@@ -3838,21 +3839,21 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
3838
3839
  ], 64 /* STABLE_FRAGMENT */))
3839
3840
  }
3840
3841
 
3841
- script$1.render = render;
3842
- script$1.__file = "src/lib/components/ShTabs.vue";
3842
+ script$3.render = render;
3843
+ script$3.__file = "src/lib/components/ShTabs.vue";
3843
3844
 
3844
- const _hoisted_1 = {
3845
+ const _hoisted_1$2 = {
3845
3846
  class: "nav nav-tabs",
3846
3847
  role: "tablist"
3847
3848
  };
3848
- const _hoisted_2 = {
3849
+ const _hoisted_2$2 = {
3849
3850
  class: "nav-item",
3850
3851
  role: "presentation"
3851
3852
  };
3852
- const _hoisted_3 = ["onClick"];
3853
- const _hoisted_4 = { class: "tab-content" };
3853
+ const _hoisted_3$2 = ["onClick"];
3854
+ const _hoisted_4$2 = { class: "tab-content" };
3854
3855
 
3855
- var script = {
3856
+ var script$2 = {
3856
3857
  __name: 'ShDynamicTabs',
3857
3858
  props: ['tabs'],
3858
3859
  setup(__props) {
@@ -3877,17 +3878,17 @@ function setTab(tab){
3877
3878
 
3878
3879
  return (_ctx, _cache) => {
3879
3880
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
3880
- vue.createElementVNode("ul", _hoisted_1, [
3881
+ vue.createElementVNode("ul", _hoisted_1$2, [
3881
3882
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(tabs), (tab) => {
3882
- return (vue.openBlock(), vue.createElementBlock("li", _hoisted_2, [
3883
+ return (vue.openBlock(), vue.createElementBlock("li", _hoisted_2$2, [
3883
3884
  vue.createElementVNode("button", {
3884
3885
  onClick: $event => (setTab(tab)),
3885
3886
  class: vue.normalizeClass(["nav-link", vue.unref(currentTab) === tab ? 'active':''])
3886
- }, vue.toDisplayString(tab.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_3)
3887
+ }, vue.toDisplayString(tab.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_3$2)
3887
3888
  ]))
3888
3889
  }), 256 /* UNKEYED_FRAGMENT */))
3889
3890
  ]),
3890
- vue.createElementVNode("div", _hoisted_4, [
3891
+ vue.createElementVNode("div", _hoisted_4$2, [
3891
3892
  (vue.unref(currentTab))
3892
3893
  ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(currentTab).component), { key: 0 }))
3893
3894
  : vue.createCommentVNode("v-if", true)
@@ -3898,7 +3899,7 @@ return (_ctx, _cache) => {
3898
3899
 
3899
3900
  };
3900
3901
 
3901
- script.__file = "src/lib/components/ShDynamicTabs.vue";
3902
+ script$2.__file = "src/lib/components/ShDynamicTabs.vue";
3902
3903
 
3903
3904
  const useUserStore = pinia.defineStore('user-store', {
3904
3905
  state: () => ({
@@ -3926,7 +3927,7 @@ const useUserStore = pinia.defineStore('user-store', {
3926
3927
  };
3927
3928
  }
3928
3929
  this.user = user;
3929
- apis.doGet('auth/user').then(res => {
3930
+ shApis$1.doGet('auth/user').then(res => {
3930
3931
  const user = res.data;
3931
3932
  ShStorage.setItem('user',res.data);
3932
3933
  user.isAllowedTo = function (slug) {
@@ -3980,24 +3981,315 @@ const useUserStore = pinia.defineStore('user-store', {
3980
3981
  }
3981
3982
  });
3982
3983
 
3983
- var ShFrontend = {
3984
+ const _hoisted_1$1 = /*#__PURE__*/vue.createElementVNode("h5", null, "Departments (updated)", -1 /* HOISTED */);
3985
+ const _hoisted_2$1 = {
3986
+ "data-bs-toggle": "modal",
3987
+ ref: "addDeptBtn",
3988
+ href: "#department_modal",
3989
+ class: "btn btn-info btn-sm"
3990
+ };
3991
+ const _hoisted_3$1 = /*#__PURE__*/vue.createElementVNode("i", { class: "fa fa-plus" }, null, -1 /* HOISTED */);
3992
+ const _hoisted_4$1 = /*#__PURE__*/vue.createTextVNode(" ADD DEPARTMENT");
3993
+ const _hoisted_5$1 = [
3994
+ _hoisted_3$1,
3995
+ _hoisted_4$1
3996
+ ];
3997
+
3998
+
3999
+ var script$1 = {
4000
+ __name: 'Departments',
4001
+ setup(__props) {
4002
+
4003
+ vue.ref(null);
4004
+ let allPermissions = vue.ref([]);
4005
+ vue.ref([]);
4006
+ let reload = vue.ref(0);
4007
+ vue.ref(null);
4008
+
4009
+ vue.onMounted(() => {
4010
+ shApis$1.doGet('admin/departments/all-permissions').then(res => {
4011
+ allPermissions.value = res.data;
4012
+ });
4013
+ });
4014
+
4015
+ function departmentAdded (response) {
4016
+ this.reload += 1;
4017
+ }
4018
+
4019
+ return (_ctx, _cache) => {
4020
+ return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
4021
+ _hoisted_1$1,
4022
+ vue.createElementVNode("a", _hoisted_2$1, _hoisted_5$1, 512 /* NEED_PATCH */),
4023
+ vue.createVNode(script$4, {
4024
+ reload: vue.unref(reload),
4025
+ onRowSelected: _ctx.rowSelected,
4026
+ headers: ['id','name','description', 'created_at'],
4027
+ "end-point": "admin/departments/list",
4028
+ actions: {
4029
+ label: 'Action',
4030
+ actions: [
4031
+ {
4032
+ label: 'Permissions',
4033
+ path: '/admin/departments/permissions/{id}',
4034
+ class: 'btn btn-info bi-lock btn-sm'
4035
+ }
4036
+ ]
4037
+ }
4038
+ }, null, 8 /* PROPS */, ["reload", "onRowSelected"]),
4039
+ vue.createVNode(script$6, {
4040
+ "modal-id": "department_modal",
4041
+ "modal-title": "Department Form"
4042
+ }, {
4043
+ default: vue.withCtx(() => [
4044
+ vue.createVNode(script$8, {
4045
+ "success-callback": "departmentAdded",
4046
+ onDepartmentAdded: departmentAdded,
4047
+ action: "admin/departments/store",
4048
+ fields: ['name','description']
4049
+ })
4050
+ ]),
4051
+ _: 1 /* STABLE */
4052
+ })
4053
+ ], 64 /* STABLE_FRAGMENT */))
4054
+ }
4055
+ }
4056
+
4057
+ };
4058
+
4059
+ script$1.__file = "src/lib/components/core/Departments/Departments.vue";
4060
+
4061
+ const _hoisted_1 = /*#__PURE__*/vue.createElementVNode("a", {
4062
+ href: "#addModule",
4063
+ class: "btn btn-info btn-sm",
4064
+ "data-bs-toggle": "modal"
4065
+ }, [
4066
+ /*#__PURE__*/vue.createElementVNode("i", { class: "bi-plus" }),
4067
+ /*#__PURE__*/vue.createTextVNode(" ADD Module")
4068
+ ], -1 /* HOISTED */);
4069
+ const _hoisted_2 = { class: "text-primary text-capitalize" };
4070
+ const _hoisted_3 = ["value"];
4071
+ const _hoisted_4 = /*#__PURE__*/vue.createElementVNode("i", { class: "fa fa-save" }, null, -1 /* HOISTED */);
4072
+ const _hoisted_5 = /*#__PURE__*/vue.createTextVNode(" Submit");
4073
+ const _hoisted_6 = [
4074
+ _hoisted_4,
4075
+ _hoisted_5
4076
+ ];
4077
+
4078
+ var script = {
4079
+ __name: 'Department',
4080
+ setup(__props) {
4081
+
4082
+ const route = vueRouter.useRoute();
4083
+ const id = vue.ref(route.params.id);
4084
+ let department = vue.ref(null);
4085
+ let permissionCanvasBtn = vue.ref(null);
4086
+ let reload = vue.ref(1);
4087
+ let module = vue.ref(null);
4088
+ let modulePermissions = vue.ref(null);
4089
+ let selectedPermissions = vue.ref([]);
4090
+ const userStore = useUserStore();
4091
+
4092
+ pinia.storeToRefs(userStore);
4093
+
4094
+ vue.onMounted(() => {
4095
+ getDepartment();
4096
+ });
4097
+
4098
+ let getModule = vue.computed(()=>{
4099
+ return module.value
4100
+ });
4101
+
4102
+
4103
+
4104
+ function moduleAdded () {
4105
+ shRepo.showToast('module added successfully', 'success');
4106
+ reload.value++;
4107
+ }
4108
+ function showModule (module) {
4109
+ if (module) {
4110
+ return '<span class="text-capitalize">' + module.module.replace('_', ' ') + '</span>'
4111
+ }
4112
+ return 'Module'
4113
+ }
4114
+ function deletePermission (module) {
4115
+ shRepo.runPlainRequest('admin/departments/department/delete-department/' + module.id).then((res) => {
4116
+ if (res.isConfirmed) {
4117
+ reload.value++;
4118
+ // shRepo.showToast('module removed successfully', 'success')
4119
+ }
4120
+ });
4121
+ }
4122
+ function viewPermissions(rModule) {
4123
+ module.value = null;
4124
+ permissionCanvasBtn.value.click();
4125
+ modulePermissions.value = null;
4126
+ selectedPermissions.value = [];
4127
+ shApis.doGet('admin/departments/department/get-module-permissions/' + rModule.module).then(res => {
4128
+ modulePermissions.value = res.data.permissions;
4129
+ module.value = rModule;
4130
+ if (rModule.permissions) {
4131
+ selectedPermissions.value = JSON.parse(rModule.permissions);
4132
+ }
4133
+ console.log(module.value);
4134
+ }).catch(ex => {
4135
+ console.log(ex);
4136
+ // helpers.showToast('An error occurred while fetching permissions')
4137
+ });
4138
+ }
4139
+ function getDepartment() {
4140
+ shApis.doGet('admin/departments/department/' + id.value).then(res => {
4141
+ department.value = res.data.department;
4142
+ }).catch(ex => {
4143
+ console.log(ex);
4144
+ });
4145
+ }
4146
+ function getPermissionLeft (menu) {
4147
+ const len = menu.split('.').length * 2;
4148
+ if (len > 5) {
4149
+ return 5
4150
+ }
4151
+ return len
4152
+ }
4153
+ function getPermissionLabel(menu) {
4154
+ const arr = menu.split('.');
4155
+ return arr[arr.length - 1].replace(/_/g, ' ')
4156
+ }
4157
+ function submitPermissions() {
4158
+ const data = {
4159
+ permissions: selectedPermissions.value
4160
+ };
4161
+ shApis.doPost('admin/departments/department/permissions/' + getModule.value.id, data)
4162
+ .then(res => {
4163
+ reload.value++;
4164
+ shRepo.showToast('Permissions updated', 'success');
4165
+ });
4166
+ }
4167
+
4168
+ return (_ctx, _cache) => {
4169
+ return (vue.unref(department))
4170
+ ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
4171
+ _hoisted_1,
4172
+ vue.createElementVNode("h5", null, "Department #" + vue.toDisplayString(vue.unref(department).id) + " - " + vue.toDisplayString(vue.unref(department).name) + " Allowed Modules", 1 /* TEXT */),
4173
+ vue.createVNode(script$4, {
4174
+ actions: {
4175
+ label: 'Actions',
4176
+ actions: [
4177
+ {
4178
+ label: 'Permissions',
4179
+ emits: viewPermissions,
4180
+ class: 'btn btn-success btn-sm'
4181
+ },
4182
+ {
4183
+ label: 'Delete',
4184
+ emits: deletePermission,
4185
+ class: 'btn btn-danger mx-2 btn-sm'
4186
+ }
4187
+ ]
4188
+ },
4189
+ reload: vue.unref(reload),
4190
+ headers: ['id',showModule,'created_at'],
4191
+ "end-point": 'admin/departments/department/list-modules/' + id.value
4192
+ }, null, 8 /* PROPS */, ["actions", "reload", "headers", "end-point"]),
4193
+ vue.createVNode(script$6, {
4194
+ "modal-id": "addModule",
4195
+ "modal-title": "Add Module Department"
4196
+ }, {
4197
+ default: vue.withCtx(() => [
4198
+ vue.createVNode(script$8, {
4199
+ "reload-select-items": vue.unref(reload),
4200
+ "success-callback": moduleAdded,
4201
+ "fill-selects": {
4202
+ permission_module: {
4203
+ url: 'admin/departments/department/list-pending-modules/' + id.value
4204
+ }
4205
+ },
4206
+ fields: ['permission_module'],
4207
+ action: 'admin/departments/department/add-module/' + id.value
4208
+ }, null, 8 /* PROPS */, ["reload-select-items", "fill-selects", "action"])
4209
+ ]),
4210
+ _: 1 /* STABLE */
4211
+ }),
4212
+ vue.createElementVNode("a", {
4213
+ href: "#permissionsCanvas",
4214
+ class: "d-none",
4215
+ ref_key: "permissionCanvasBtn",
4216
+ ref: permissionCanvasBtn,
4217
+ "data-bs-toggle": "offcanvas"
4218
+ }, null, 512 /* NEED_PATCH */),
4219
+ vue.createVNode(script$7, {
4220
+ "canvas-id": "permissionsCanvas",
4221
+ position: "end enlarged",
4222
+ "canvas-title": "Module Permissions"
4223
+ }, {
4224
+ default: vue.withCtx(() => [
4225
+ (vue.unref(getModule))
4226
+ ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
4227
+ vue.createElementVNode("h5", _hoisted_2, "Permissions for " + vue.toDisplayString(vue.unref(getModule).module), 1 /* TEXT */),
4228
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(modulePermissions), (permission) => {
4229
+ return (vue.openBlock(), vue.createElementBlock("div", {
4230
+ key: permission,
4231
+ class: "list-group p-0"
4232
+ }, [
4233
+ vue.createElementVNode("label", {
4234
+ class: vue.normalizeClass(["list-group-item pb-0 text-capitalize", 'ms-' + getPermissionLeft(permission)])
4235
+ }, [
4236
+ vue.withDirectives(vue.createElementVNode("input", {
4237
+ type: "checkbox",
4238
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (vue.isRef(selectedPermissions) ? (selectedPermissions).value = $event : selectedPermissions = $event)),
4239
+ value: permission
4240
+ }, null, 8 /* PROPS */, _hoisted_3), [
4241
+ [vue.vModelCheckbox, vue.unref(selectedPermissions)]
4242
+ ]),
4243
+ vue.createTextVNode(" " + vue.toDisplayString(getPermissionLabel(permission)), 1 /* TEXT */)
4244
+ ], 2 /* CLASS */)
4245
+ ]))
4246
+ }), 128 /* KEYED_FRAGMENT */)),
4247
+ vue.createElementVNode("button", {
4248
+ onClick: submitPermissions,
4249
+ class: "btn btn-info"
4250
+ }, _hoisted_6)
4251
+ ], 64 /* STABLE_FRAGMENT */))
4252
+ : vue.createCommentVNode("v-if", true)
4253
+ ]),
4254
+ _: 1 /* STABLE */
4255
+ })
4256
+ ], 64 /* STABLE_FRAGMENT */))
4257
+ : vue.createCommentVNode("v-if", true)
4258
+ }
4259
+ }
4260
+
4261
+ };
4262
+
4263
+ script.__file = "src/lib/components/core/Departments/department/Department.vue";
4264
+
4265
+ const ShFrontend = {
3984
4266
  install: (app, options) => {
3985
4267
  if(options.sessionTimeout){
3986
4268
  app.provide('sessionTimeout',options.sessionTimeout);
3987
4269
  ShStorage.setItem('sessionTimeout',options.sessionTimeout);
3988
4270
  }
4271
+ if(options.router) {
4272
+ options.router.addRoute({
4273
+ path: '/sh-departments',
4274
+ component: script$1
4275
+ });
4276
+ options.router.addRoute({
4277
+ path: '/sh-departments/permissions/:id',
4278
+ component: script
4279
+ });
4280
+ }
3989
4281
  }
3990
4282
  };
3991
4283
 
3992
- exports.ShCanvas = script$5;
3993
- exports.ShDynamicTabs = script;
3994
- exports.ShForm = script$6;
4284
+ exports.ShCanvas = script$7;
4285
+ exports.ShDynamicTabs = script$2;
4286
+ exports.ShForm = script$8;
3995
4287
  exports.ShFrontend = ShFrontend;
3996
- exports.ShModal = script$4;
3997
- exports.ShPhone = script$9;
3998
- exports.ShTable = script$2;
3999
- exports.ShTabs = script$1;
4000
- exports.shApis = apis;
4001
- exports.shRepo = helpers;
4288
+ exports.ShModal = script$6;
4289
+ exports.ShPhone = script$b;
4290
+ exports.ShTable = script$4;
4291
+ exports.ShTabs = script$3;
4292
+ exports.shApis = shApis$1;
4293
+ exports.shRepo = shRepo$1;
4002
4294
  exports.shStorage = ShStorage;
4003
4295
  exports.useUserStore = useUserStore;