@iankibetsh/shframework 5.5.3 → 5.5.4

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 +1011 -972
  2. package/dist/library.mjs +1012 -972
  3. package/package.json +5 -5
package/dist/library.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import Axios from 'axios';
2
- import moment from 'moment';
2
+ import { DateTime } from 'luxon';
3
3
  import Swal from 'sweetalert2';
4
4
  import { Modal, Offcanvas } from 'bootstrap';
5
5
  import NProgress from 'nprogress';
6
- import { openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, ref, onMounted, watch, unref, normalizeClass, createBlock, resolveDynamicComponent, resolveComponent, inject, mergeProps, renderSlot, normalizeStyle, computed, Teleport, createVNode, withCtx, vModelCheckbox, resolveDirective, shallowRef, normalizeProps, markRaw, isRef } from 'vue';
6
+ import { openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, ref, onMounted, watch, unref, normalizeClass, createBlock, resolveDynamicComponent, resolveComponent, inject, useTemplateRef, mergeProps, renderSlot, normalizeStyle, computed, Teleport, createVNode, withCtx, useSlots, onBeforeUnmount, reactive, vModelCheckbox, resolveDirective, shallowRef, normalizeProps, markRaw, isRef } from 'vue';
7
7
  import _ from 'lodash';
8
8
  import { defineStore, storeToRefs } from 'pinia';
9
9
  import { useRoute, useRouter } from 'vue-router';
@@ -192,7 +192,6 @@ function showToast(message, toastType, config){
192
192
  Toast.fire({
193
193
  icon: toastType,
194
194
  title: message,
195
- postion: 'bottom'
196
195
  });
197
196
  }
198
197
 
@@ -248,7 +247,39 @@ function formatDate(date, format){
248
247
  if (!format) {
249
248
  format = 'lll';
250
249
  }
251
- return moment(date).format(format)
250
+ const formatMap = {
251
+ 'lll': "MMM d, yyyy, h:mm a",
252
+ 'LLL': "MMMM d, yyyy, h:mm a",
253
+ 'LL': "MMMM d, yyyy",
254
+ 'L': "MM/dd/yyyy",
255
+ 'YYYY-MM-DD': 'yyyy-MM-dd',
256
+ 'YYYY/MM/DD': 'yyyy/MM/dd',
257
+ 'YYYY': 'yyyy',
258
+ 'MM': 'MM',
259
+ 'DD': 'dd',
260
+ 'HH:mm': 'HH:mm',
261
+ 'hh:mm A': 'hh:mm a',
262
+ 'MMM D, YYYY': 'MMM d, yyyy',
263
+ 'MMMM D, YYYY': 'MMMM d, yyyy',
264
+ 'MMM D, YYYY h:mm A': 'MMM d, yyyy h:mm a',
265
+ 'MMMM D, YYYY h:mm A': 'MMMM d, yyyy h:mm a',
266
+ // Add more as needed
267
+ };
268
+ const luxonFormat = formatMap[format] || format;
269
+ // Accepts ISO string, JS Date, or Luxon DateTime
270
+ let dt;
271
+ if (typeof date === 'string' || date instanceof String) {
272
+ dt = DateTime.fromISO(date);
273
+ if (!dt.isValid) dt = DateTime.fromRFC2822(date);
274
+ if (!dt.isValid) dt = DateTime.fromFormat(date, 'yyyy-MM-dd');
275
+ } else if (date instanceof Date) {
276
+ dt = DateTime.fromJSDate(date);
277
+ } else if (date && typeof date === 'object' && date.isValid !== undefined) {
278
+ dt = date;
279
+ } else {
280
+ return ''
281
+ }
282
+ return dt.isValid ? dt.toFormat(luxonFormat) : ''
252
283
  }
253
284
 
254
285
  function formatNumber(amount, decimalPoints = 0){
@@ -330,7 +361,7 @@ function logoutUser(){
330
361
  function sessionRestored(){
331
362
  const timeout = shStorage.getItem('sessionTimeout') * 60;
332
363
  const last_activity = shStorage.getItem('last_activity');
333
- const pastSeconds = moment().diff(last_activity, 'seconds');
364
+ const pastSeconds = DateTime.now().diff(DateTime.fromISO(last_activity), 'seconds').seconds;
334
365
  if(!shStorage.getItem('access_token'))
335
366
  return false
336
367
  return pastSeconds < timeout
@@ -339,8 +370,8 @@ const checkSession = function (isCheking) {
339
370
  const timeout = shStorage.getItem('sessionTimeout');
340
371
  const last_activity = shStorage.getItem('last_activity');
341
372
  if (shStorage.getItem('access_token')) {
342
- const pastMinutes = moment().diff(last_activity, 'minutes');
343
- const pastSeconds = moment().diff(last_activity, 'seconds');
373
+ const pastMinutes = DateTime.now().diff(DateTime.fromISO(last_activity), 'minutes').minutes;
374
+ const pastSeconds = DateTime.now().diff(DateTime.fromISO(last_activity), 'seconds').seconds;
344
375
  if(pastMinutes >= timeout) {
345
376
  const gracePeriod = pastSeconds - (timeout * 60);
346
377
  if (gracePeriod >= 60 ) {
@@ -395,14 +426,14 @@ async function shSwalLogout (seconds = 30) {
395
426
  } else {
396
427
  window.ShConfirmation = null;
397
428
  clearInterval(window.shInterval);
398
- const timeNow = moment().toISOString();
429
+ const timeNow = DateTime.now().toISO();
399
430
  shStorage.setItem('last_activity', timeNow);
400
431
  startSession();
401
432
  }
402
433
  })
403
434
  }
404
435
  function startSession () {
405
- const timeNow = moment().toISOString();
436
+ const timeNow = DateTime.now().toISO();
406
437
  const accessToken = shStorage.getItem('access_token');
407
438
  if (accessToken) {
408
439
  shStorage.setItem('last_activity', timeNow);
@@ -417,7 +448,7 @@ const updateSession = () =>{
417
448
  if(!window.shInterval) {
418
449
  startSession();
419
450
  }
420
- const timeNow = moment().toISOString();
451
+ const timeNow = DateTime.now().toISO();
421
452
  shStorage.setItem('last_activity', timeNow);
422
453
  };
423
454
 
@@ -2102,19 +2133,19 @@ const _hoisted_1$r = {
2102
2133
  class: "sh-phone mb-3",
2103
2134
  style: {"display":"flex"}
2104
2135
  };
2105
- const _hoisted_2$j = {
2136
+ const _hoisted_2$i = {
2106
2137
  key: 0,
2107
2138
  style: {"display":"contents"}
2108
2139
  };
2109
- const _hoisted_3$g = ["src"];
2140
+ const _hoisted_3$f = ["src"];
2110
2141
  const _hoisted_4$f = ["value"];
2111
2142
  const _hoisted_5$c = ["disabled"];
2112
2143
 
2113
2144
  function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2114
2145
  return (openBlock(), createElementBlock("div", _hoisted_1$r, [
2115
2146
  ($data.selectedCountry)
2116
- ? (openBlock(), createElementBlock("div", _hoisted_2$j, [
2117
- createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$g),
2147
+ ? (openBlock(), createElementBlock("div", _hoisted_2$i, [
2148
+ createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$f),
2118
2149
  createTextVNode(" " + toDisplayString($data.selectedCountry.dialCode), 1 /* TEXT */)
2119
2150
  ]))
2120
2151
  : createCommentVNode("v-if", true),
@@ -2153,8 +2184,8 @@ const _hoisted_1$q = {
2153
2184
  key: 0,
2154
2185
  class: "dropdown sh-suggest"
2155
2186
  };
2156
- const _hoisted_2$i = ["id"];
2157
- const _hoisted_3$f = { class: "sh-suggestions-holder" };
2187
+ const _hoisted_2$h = ["id"];
2188
+ const _hoisted_3$e = { class: "sh-suggestions-holder" };
2158
2189
  const _hoisted_4$e = { class: "badge bg-secondary m-1 sh-selected-item" };
2159
2190
  const _hoisted_5$b = ["onClick"];
2160
2191
  const _hoisted_6$9 = ["id"];
@@ -2322,7 +2353,7 @@ return (_ctx, _cache) => {
2322
2353
  class: "p-0 d-flex sh-suggest-control dropdown-toggle",
2323
2354
  "aria-expanded": "false"
2324
2355
  }, [
2325
- createElementVNode("div", _hoisted_3$f, [
2356
+ createElementVNode("div", _hoisted_3$e, [
2326
2357
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(selectedSuggestions), (sgt) => {
2327
2358
  return (openBlock(), createElementBlock("h5", _hoisted_4$e, [
2328
2359
  createTextVNode(toDisplayString(sgt.name) + " ", 1 /* TEXT */),
@@ -2342,7 +2373,7 @@ return (_ctx, _cache) => {
2342
2373
  onChange: filterData,
2343
2374
  class: "flex-fill h-100 sh-suggestion-input"
2344
2375
  }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_6$9)
2345
- ], 8 /* PROPS */, _hoisted_2$i),
2376
+ ], 8 /* PROPS */, _hoisted_2$h),
2346
2377
  createElementVNode("ul", {
2347
2378
  class: normalizeClass([(!unref(suggestions) || unref(suggestions).length === 0) ? 'no-sh-suggestions':'sh-found-suggestions', "dropdown-menu w-100"]),
2348
2379
  id: 'dropwdown_section' + unref(id),
@@ -2745,12 +2776,12 @@ const _hoisted_1$p = {
2745
2776
  ref: "ShAutoForm",
2746
2777
  class: "sh-form"
2747
2778
  };
2748
- const _hoisted_2$h = {
2779
+ const _hoisted_2$g = {
2749
2780
  key: 0,
2750
2781
  class: "alert alert-danger alert-dismissible fade show sh-form-submission-error",
2751
2782
  role: "alert"
2752
2783
  };
2753
- const _hoisted_3$e = { key: 0 };
2784
+ const _hoisted_3$d = { key: 0 };
2754
2785
  const _hoisted_4$d = { key: 1 };
2755
2786
  const _hoisted_5$a = { class: "row" };
2756
2787
  const _hoisted_6$8 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
@@ -2784,15 +2815,15 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2784
2815
  const _component_ShSuggest = resolveComponent("ShSuggest");
2785
2816
 
2786
2817
  return (openBlock(), createElementBlock(Fragment, null, [
2787
- _cache[5] || (_cache[5] = createElementVNode("h5", { class: "d-none" }, null, -1 /* HOISTED */)),
2818
+ _cache[5] || (_cache[5] = createElementVNode("h5", { class: "d-none" }, null, -1 /* CACHED */)),
2788
2819
  createElementVNode("form", _hoisted_1$p, [
2789
2820
  createCommentVNode(" <div v-if=\"form_status == 1\" class=\"alert alert-info\">Processing...</div>"),
2790
2821
  createCommentVNode(" <div v-if=\"form_status == 2\" class=\"alert alert-success\">Success</div>"),
2791
2822
  (_ctx.form_status == 3)
2792
- ? (openBlock(), createElementBlock("div", _hoisted_2$h, [
2793
- _cache[2] || (_cache[2] = createElementVNode("i", { class: "bi-exclamation-triangle-fill me-1" }, null, -1 /* HOISTED */)),
2823
+ ? (openBlock(), createElementBlock("div", _hoisted_2$g, [
2824
+ _cache[2] || (_cache[2] = createElementVNode("i", { class: "bi-exclamation-triangle-fill me-1" }, null, -1 /* CACHED */)),
2794
2825
  (_ctx.errorText)
2795
- ? (openBlock(), createElementBlock("span", _hoisted_3$e, toDisplayString(_ctx.errorText), 1 /* TEXT */))
2826
+ ? (openBlock(), createElementBlock("span", _hoisted_3$d, toDisplayString(_ctx.errorText), 1 /* TEXT */))
2796
2827
  : (openBlock(), createElementBlock("span", _hoisted_4$d, "Unexpected Error Occurred")),
2797
2828
  createCommentVNode(" <button @click=\"hideError\" type=\"button\" class=\"btn-close\" aria-label=\"Close\"></button>")
2798
2829
  ]))
@@ -3000,8 +3031,8 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
3000
3031
  }), 128 /* KEYED_FRAGMENT */))
3001
3032
  ]),
3002
3033
  ($props.hasTerms)
3003
- ? (openBlock(), createElementBlock("div", _hoisted_24$1, _cache[3] || (_cache[3] = [
3004
- createElementVNode("h5", null, "Confirm and Submit", -1 /* HOISTED */),
3034
+ ? (openBlock(), createElementBlock("div", _hoisted_24$1, [...(_cache[3] || (_cache[3] = [
3035
+ createElementVNode("h5", null, "Confirm and Submit", -1 /* CACHED */),
3005
3036
  createElementVNode("p", null, [
3006
3037
  createTextVNode("By clicking submit, you agree to our "),
3007
3038
  createElementVNode("a", {
@@ -3013,8 +3044,8 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
3013
3044
  target: "_blank",
3014
3045
  href: "https://hauzisha.co.ke/privacy-policy"
3015
3046
  }, "privacy policy")
3016
- ], -1 /* HOISTED */)
3017
- ])))
3047
+ ], -1 /* CACHED */)
3048
+ ]))]))
3018
3049
  : createCommentVNode("v-if", true),
3019
3050
  (_ctx.form_status == 1)
3020
3051
  ? (openBlock(), createElementBlock("button", {
@@ -3022,14 +3053,14 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
3022
3053
  class: normalizeClass(["btn btn-primary", $options.getSubmitBtnClass()]),
3023
3054
  type: "button",
3024
3055
  disabled: ""
3025
- }, _cache[4] || (_cache[4] = [
3056
+ }, [...(_cache[4] || (_cache[4] = [
3026
3057
  createElementVNode("span", {
3027
3058
  class: "spinner-border spinner-border-sm",
3028
3059
  role: "status",
3029
3060
  "aria-hidden": "true"
3030
- }, null, -1 /* HOISTED */),
3031
- createTextVNode(" Processing... ")
3032
- ]), 2 /* CLASS */))
3061
+ }, null, -1 /* CACHED */),
3062
+ createTextVNode(" Processing... ", -1 /* CACHED */)
3063
+ ]))], 2 /* CLASS */))
3033
3064
  : (openBlock(), createElementBlock("button", {
3034
3065
  key: 3,
3035
3066
  "data-cy": "sh_form_submit",
@@ -3359,8 +3390,8 @@ return (_ctx, _cache) => {
3359
3390
  script$r.__file = "src/lib/components/form-components/DateInput.vue";
3360
3391
 
3361
3392
  const _hoisted_1$m = ["name", "onUpdate:modelValue"];
3362
- const _hoisted_2$g = ["innerHTML"];
3363
- const _hoisted_3$d = {
3393
+ const _hoisted_2$f = ["innerHTML"];
3394
+ const _hoisted_3$c = {
3364
3395
  key: 0,
3365
3396
  class: "text-danger sh-required"
3366
3397
  };
@@ -3464,7 +3495,7 @@ const getFieldComponent = (fieldObj) => {
3464
3495
  };
3465
3496
  const shFormElementClasses = ref(null);
3466
3497
  shFormElementClasses.value = inject('shFormElementClasses');
3467
- const shAutoForm = ref(null);
3498
+ const shAutoForm = useTemplateRef('shAutoForm');
3468
3499
  const closeModal = e => {
3469
3500
  setTimeout(() => {
3470
3501
  if(!shAutoForm.value){
@@ -3626,101 +3657,98 @@ onMounted((ev) => {
3626
3657
 
3627
3658
 
3628
3659
  return (_ctx, _cache) => {
3629
- return (openBlock(), createElementBlock(Fragment, null, [
3630
- _cache[2] || (_cache[2] = createElementVNode("div", null, null, -1 /* HOISTED */)),
3631
- createElementVNode("form", {
3632
- class: normalizeClass([__props.formClass, "sh-auto-form"]),
3633
- ref_key: "shAutoForm",
3634
- ref: shAutoForm,
3635
- onSubmit: _cache[0] || (_cache[0] = e => submitForm(e))
3660
+ return (openBlock(), createElementBlock("form", {
3661
+ class: normalizeClass([__props.formClass, "sh-auto-form"]),
3662
+ ref_key: "shAutoForm",
3663
+ ref: shAutoForm,
3664
+ onSubmit: _cache[0] || (_cache[0] = e => submitForm(e))
3665
+ }, [
3666
+ (openBlock(true), createElementBlock(Fragment, null, renderList(formFields.value, (field, index) => {
3667
+ return (openBlock(), createElementBlock("div", {
3668
+ key: field,
3669
+ class: normalizeClass(getElementClass('formGroup') + ' sh-field' + field.field)
3670
+ }, [
3671
+ (field.type === 'hidden')
3672
+ ? withDirectives((openBlock(), createElementBlock("input", {
3673
+ key: 0,
3674
+ type: "hidden",
3675
+ name: field.field,
3676
+ "onUpdate:modelValue": $event => ((formFields.value[index].value) = $event)
3677
+ }, null, 8 /* PROPS */, _hoisted_1$m)), [
3678
+ [vModelText, formFields.value[index].value]
3679
+ ])
3680
+ : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3681
+ (!unref(isFloating) && field.label)
3682
+ ? (openBlock(), createElementBlock("label", {
3683
+ key: 0,
3684
+ class: normalizeClass(getElementClass('formLabel'))
3685
+ }, [
3686
+ createElementVNode("span", {
3687
+ innerHTML: field.label,
3688
+ class: "sh-label"
3689
+ }, null, 8 /* PROPS */, _hoisted_2$f),
3690
+ (field.required)
3691
+ ? (openBlock(), createElementBlock("span", _hoisted_3$c, "*"))
3692
+ : createCommentVNode("v-if", true)
3693
+ ], 2 /* CLASS */))
3694
+ : createCommentVNode("v-if", true),
3695
+ (openBlock(), createBlock(resolveDynamicComponent(getFieldComponent(field)), mergeProps({ ref_for: true }, getComponentProps(field), {
3696
+ isInvalid: typeof validationErrors.value[field.field] !== 'undefined',
3697
+ onClick: $event => (fieldChanged(field.field)),
3698
+ "onUpdate:modelValue": [$event => (fieldChanged(field.field)), $event => ((formFields.value[index].value) = $event)],
3699
+ modelValue: formFields.value[index].value,
3700
+ class: getComponentClass(field.field)
3701
+ }), null, 16 /* FULL_PROPS */, ["isInvalid", "onClick", "onUpdate:modelValue", "modelValue", "class"])),
3702
+ (unref(isFloating) && field.label)
3703
+ ? (openBlock(), createElementBlock("label", {
3704
+ key: 1,
3705
+ class: normalizeClass(getElementClass('formLabel')),
3706
+ innerHTML: field.label
3707
+ }, null, 10 /* CLASS, PROPS */, _hoisted_4$c))
3708
+ : createCommentVNode("v-if", true),
3709
+ (unref(isFloating))
3710
+ ? (openBlock(), createElementBlock("div", _hoisted_5$9, [...(_cache[1] || (_cache[1] = [
3711
+ createElementVNode("div", { class: "form-notch-leading" }, null, -1 /* CACHED */),
3712
+ createElementVNode("div", { class: "form-notch-middle" }, null, -1 /* CACHED */),
3713
+ createElementVNode("div", { class: "form-notch-trailing" }, null, -1 /* CACHED */)
3714
+ ]))]))
3715
+ : createCommentVNode("v-if", true),
3716
+ (field.helper)
3717
+ ? (openBlock(), createElementBlock("div", {
3718
+ key: 3,
3719
+ class: normalizeClass(getElementClass('helperText')),
3720
+ innerHTML: field.helper
3721
+ }, null, 10 /* CLASS, PROPS */, _hoisted_6$7))
3722
+ : createCommentVNode("v-if", true),
3723
+ (validationErrors.value[field.field])
3724
+ ? (openBlock(), createElementBlock("div", {
3725
+ key: 4,
3726
+ class: normalizeClass(getElementClass('invalidFeedback'))
3727
+ }, toDisplayString(validationErrors.value[field.field]), 3 /* TEXT, CLASS */))
3728
+ : createCommentVNode("v-if", true)
3729
+ ], 64 /* STABLE_FRAGMENT */))
3730
+ ], 2 /* CLASS */))
3731
+ }), 128 /* KEYED_FRAGMENT */)),
3732
+ renderSlot(_ctx.$slots, "default"),
3733
+ createElementVNode("div", {
3734
+ class: normalizeClass(getElementClass('formGroup'))
3636
3735
  }, [
3637
- (openBlock(true), createElementBlock(Fragment, null, renderList(formFields.value, (field, index) => {
3638
- return (openBlock(), createElementBlock("div", {
3639
- key: field,
3640
- class: normalizeClass(getElementClass('formGroup') + ' sh-field' + field.field)
3641
- }, [
3642
- (field.type === 'hidden')
3643
- ? withDirectives((openBlock(), createElementBlock("input", {
3644
- key: 0,
3645
- type: "hidden",
3646
- name: field.field,
3647
- "onUpdate:modelValue": $event => ((formFields.value[index].value) = $event)
3648
- }, null, 8 /* PROPS */, _hoisted_1$m)), [
3649
- [vModelText, formFields.value[index].value]
3650
- ])
3651
- : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3652
- (!unref(isFloating) && field.label)
3653
- ? (openBlock(), createElementBlock("label", {
3654
- key: 0,
3655
- class: normalizeClass(getElementClass('formLabel'))
3656
- }, [
3657
- createElementVNode("span", {
3658
- innerHTML: field.label,
3659
- class: "sh-label"
3660
- }, null, 8 /* PROPS */, _hoisted_2$g),
3661
- (field.required)
3662
- ? (openBlock(), createElementBlock("span", _hoisted_3$d, "*"))
3663
- : createCommentVNode("v-if", true)
3664
- ], 2 /* CLASS */))
3665
- : createCommentVNode("v-if", true),
3666
- (openBlock(), createBlock(resolveDynamicComponent(getFieldComponent(field)), mergeProps({ ref_for: true }, getComponentProps(field), {
3667
- isInvalid: typeof validationErrors.value[field.field] !== 'undefined',
3668
- onClick: $event => (fieldChanged(field.field)),
3669
- "onUpdate:modelValue": [$event => (fieldChanged(field.field)), $event => ((formFields.value[index].value) = $event)],
3670
- modelValue: formFields.value[index].value,
3671
- class: getComponentClass(field.field)
3672
- }), null, 16 /* FULL_PROPS */, ["isInvalid", "onClick", "onUpdate:modelValue", "modelValue", "class"])),
3673
- (unref(isFloating) && field.label)
3674
- ? (openBlock(), createElementBlock("label", {
3675
- key: 1,
3676
- class: normalizeClass(getElementClass('formLabel')),
3677
- innerHTML: field.label
3678
- }, null, 10 /* CLASS, PROPS */, _hoisted_4$c))
3679
- : createCommentVNode("v-if", true),
3680
- (unref(isFloating))
3681
- ? (openBlock(), createElementBlock("div", _hoisted_5$9, [...(_cache[1] || (_cache[1] = [
3682
- createElementVNode("div", { class: "form-notch-leading" }, null, -1 /* HOISTED */),
3683
- createElementVNode("div", { class: "form-notch-middle" }, null, -1 /* HOISTED */),
3684
- createElementVNode("div", { class: "form-notch-trailing" }, null, -1 /* HOISTED */)
3685
- ]))]))
3686
- : createCommentVNode("v-if", true),
3687
- (field.helper)
3688
- ? (openBlock(), createElementBlock("div", {
3689
- key: 3,
3690
- class: normalizeClass(getElementClass('helperText')),
3691
- innerHTML: field.helper
3692
- }, null, 10 /* CLASS, PROPS */, _hoisted_6$7))
3693
- : createCommentVNode("v-if", true),
3694
- (validationErrors.value[field.field])
3695
- ? (openBlock(), createElementBlock("div", {
3696
- key: 4,
3697
- class: normalizeClass(getElementClass('invalidFeedback'))
3698
- }, toDisplayString(validationErrors.value[field.field]), 3 /* TEXT, CLASS */))
3699
- : createCommentVNode("v-if", true)
3700
- ], 64 /* STABLE_FRAGMENT */))
3701
- ], 2 /* CLASS */))
3702
- }), 128 /* KEYED_FRAGMENT */)),
3703
- renderSlot(_ctx.$slots, "default"),
3704
- createElementVNode("div", {
3705
- class: normalizeClass(getElementClass('formGroup'))
3736
+ createElementVNode("button", {
3737
+ style: normalizeStyle({width: submitBtnWidth.value}),
3738
+ ref_key: "submitBtn",
3739
+ ref: submitBtn,
3740
+ disabled: loading.value,
3741
+ class: normalizeClass(getElementClass('actionBtn'))
3706
3742
  }, [
3707
- createElementVNode("button", {
3708
- style: normalizeStyle({width: submitBtnWidth.value}),
3709
- ref_key: "submitBtn",
3710
- ref: submitBtn,
3711
- disabled: loading.value,
3712
- class: normalizeClass(getElementClass('actionBtn'))
3713
- }, [
3714
- (loading.value)
3715
- ? (openBlock(), createElementBlock("span", _hoisted_8$5))
3716
- : createCommentVNode("v-if", true),
3717
- (!loading.value)
3718
- ? (openBlock(), createElementBlock("span", _hoisted_9$5, "Submit"))
3719
- : createCommentVNode("v-if", true)
3720
- ], 14 /* CLASS, STYLE, PROPS */, _hoisted_7$6)
3721
- ], 2 /* CLASS */)
3722
- ], 34 /* CLASS, NEED_HYDRATION */)
3723
- ], 64 /* STABLE_FRAGMENT */))
3743
+ (loading.value)
3744
+ ? (openBlock(), createElementBlock("span", _hoisted_8$5))
3745
+ : createCommentVNode("v-if", true),
3746
+ (!loading.value)
3747
+ ? (openBlock(), createElementBlock("span", _hoisted_9$5, "Submit"))
3748
+ : createCommentVNode("v-if", true)
3749
+ ], 14 /* CLASS, STYLE, PROPS */, _hoisted_7$6)
3750
+ ], 2 /* CLASS */)
3751
+ ], 34 /* CLASS, NEED_HYDRATION */))
3724
3752
  }
3725
3753
  }
3726
3754
 
@@ -3729,8 +3757,8 @@ return (_ctx, _cache) => {
3729
3757
  script$q.__file = "src/lib/components/ShAutoForm.vue";
3730
3758
 
3731
3759
  const _hoisted_1$l = ["id", "data-bs-backdrop"];
3732
- const _hoisted_2$f = { class: "modal-content" };
3733
- const _hoisted_3$c = { class: "modal-header" };
3760
+ const _hoisted_2$e = { class: "modal-content" };
3761
+ const _hoisted_3$b = { class: "modal-header" };
3734
3762
  const _hoisted_4$b = { class: "modal-title flex-fill" };
3735
3763
  const _hoisted_5$8 = { class: "modal-body" };
3736
3764
  const _hoisted_6$6 = { class: "section" };
@@ -3794,15 +3822,15 @@ return (_ctx, _cache) => {
3794
3822
  createElementVNode("div", {
3795
3823
  class: normalizeClass(["modal-dialog", modalClasses.value])
3796
3824
  }, [
3797
- createElementVNode("div", _hoisted_2$f, [
3798
- createElementVNode("div", _hoisted_3$c, [
3825
+ createElementVNode("div", _hoisted_2$e, [
3826
+ createElementVNode("div", _hoisted_3$b, [
3799
3827
  createElementVNode("h3", _hoisted_4$b, toDisplayString(__props.modalTitle), 1 /* TEXT */),
3800
3828
  _cache[0] || (_cache[0] = createElementVNode("button", {
3801
3829
  type: "button",
3802
3830
  class: "btn-close sh-modal-close",
3803
3831
  "data-bs-dismiss": "modal",
3804
3832
  "aria-label": "Close"
3805
- }, null, -1 /* HOISTED */))
3833
+ }, null, -1 /* CACHED */))
3806
3834
  ]),
3807
3835
  createElementVNode("div", _hoisted_5$8, [
3808
3836
  createElementVNode("div", _hoisted_6$6, [
@@ -3820,8 +3848,6 @@ return (_ctx, _cache) => {
3820
3848
  script$p.__file = "src/lib/components/ShModal.vue";
3821
3849
 
3822
3850
  const _hoisted_1$k = { class: "dropdown sh-dropdown-form" };
3823
- const _hoisted_2$e = ["id"];
3824
- const _hoisted_3$b = ["aria-labelledby"];
3825
3851
 
3826
3852
  var script$o = {
3827
3853
  __name: 'ShDropDownForm',
@@ -3868,25 +3894,26 @@ const formSubmitted = (res)=>{
3868
3894
  const formError = (res)=>{
3869
3895
  emit('formError',res);
3870
3896
  };
3897
+ const dropdownId = 'dropdown' + (Math.random() + 1).toString(36).substring(2);
3871
3898
 
3872
3899
  return (_ctx, _cache) => {
3873
3900
  return (openBlock(), createElementBlock(Fragment, null, [
3874
- _cache[0] || (_cache[0] = createElementVNode("h5", { class: "d-none" }, "To prevent default class", -1 /* HOISTED */)),
3901
+ _cache[0] || (_cache[0] = createElementVNode("h5", { class: "d-none" }, "To prevent default class", -1 /* CACHED */)),
3875
3902
  createElementVNode("div", _hoisted_1$k, [
3876
3903
  createElementVNode("a", {
3877
3904
  class: normalizeClass(unref(btnClass)),
3878
3905
  href: "#",
3879
3906
  role: "button",
3880
- id: _ctx.dropdownId,
3907
+ id: dropdownId,
3881
3908
  "data-bs-toggle": "dropdown",
3882
3909
  "data-bs-auto-close": "outside",
3883
3910
  "aria-expanded": "false"
3884
3911
  }, [
3885
3912
  renderSlot(_ctx.$slots, "default")
3886
- ], 10 /* CLASS, PROPS */, _hoisted_2$e),
3913
+ ], 2 /* CLASS */),
3887
3914
  createElementVNode("div", {
3888
3915
  class: "dropdown-menu px-2 py-1",
3889
- "aria-labelledby": _ctx.dropdownId
3916
+ "aria-labelledby": dropdownId
3890
3917
  }, [
3891
3918
  (openBlock(), createBlock(script$q, mergeProps({
3892
3919
  onSuccess: success,
@@ -3895,7 +3922,7 @@ return (_ctx, _cache) => {
3895
3922
  onFormError: formError,
3896
3923
  key: JSON.stringify(__props.currentData ?? {})
3897
3924
  }, props), null, 16 /* FULL_PROPS */))
3898
- ], 8 /* PROPS */, _hoisted_3$b)
3925
+ ])
3899
3926
  ])
3900
3927
  ], 64 /* STABLE_FRAGMENT */))
3901
3928
  }
@@ -3958,6 +3985,18 @@ const emitClick = ()=>{
3958
3985
  emit('click');
3959
3986
  };
3960
3987
 
3988
+
3989
+ const allProps = ref({});
3990
+
3991
+ // make cleaned props computed
3992
+
3993
+ const cleanedProp = computed(()=>{
3994
+ const p = {...props};
3995
+ delete p.class;
3996
+ delete p.modalId;
3997
+ return p
3998
+ });
3999
+
3961
4000
  return (_ctx, _cache) => {
3962
4001
  return (openBlock(), createElementBlock(Fragment, null, [
3963
4002
  createElementVNode("a", {
@@ -3975,13 +4014,15 @@ return (_ctx, _cache) => {
3975
4014
  "modal-title": __props.modalTitle
3976
4015
  }, {
3977
4016
  default: withCtx(() => [
3978
- (openBlock(), createBlock(script$q, mergeProps({
3979
- onSuccess: success,
3980
- onFieldChanged: fieldChanged,
3981
- onFormSubmitted: formSubmitted,
3982
- onFormError: formError,
3983
- key: JSON.stringify(__props.currentData ?? {})
3984
- }, props), null, 16 /* FULL_PROPS */))
4017
+ (allProps.value)
4018
+ ? (openBlock(), createBlock(script$q, mergeProps({
4019
+ onSuccess: success,
4020
+ onFieldChanged: fieldChanged,
4021
+ onFormSubmitted: formSubmitted,
4022
+ onFormError: formError,
4023
+ key: JSON.stringify(__props.currentData ?? {})
4024
+ }, cleanedProp.value), null, 16 /* FULL_PROPS */))
4025
+ : createCommentVNode("v-if", true)
3985
4026
  ]),
3986
4027
  _: 1 /* STABLE */
3987
4028
  }, 8 /* PROPS */, ["modal-size", "modal-id", "modal-title"])
@@ -4135,7 +4176,7 @@ const _hoisted_1$g = { class: "callout callout-info" };
4135
4176
  function render$2(_ctx, _cache) {
4136
4177
  return (openBlock(), createElementBlock("div", _hoisted_1$g, [
4137
4178
  renderSlot(_ctx.$slots, "default", {}, () => [
4138
- _cache[0] || (_cache[0] = createTextVNode(" No records found "))
4179
+ _cache[0] || (_cache[0] = createTextVNode(" No records found ", -1 /* CACHED */))
4139
4180
  ])
4140
4181
  ]))
4141
4182
  }
@@ -4146,108 +4187,6 @@ script$k.render = render$2;
4146
4187
  script$k.__scopeId = "data-v-55cf77fb";
4147
4188
  script$k.__file = "src/lib/components/others/NoRecords.vue";
4148
4189
 
4149
- const useUserStore = defineStore('user-store', {
4150
- state: () => ({
4151
- user: null,
4152
- role: null,
4153
- permissions: null,
4154
- menus: [],
4155
- loggedOut: false
4156
- }),
4157
- actions: {
4158
- setUser (defaultEndpoint) {
4159
- let user = null;
4160
- try {
4161
- user = shStorage.getItem('user') ? shStorage.getItem('user') : null;
4162
- } catch (error) {
4163
- user= null;
4164
- }
4165
- if(typeof user !== 'object'){
4166
- user = null;
4167
- }
4168
- if (user ) {
4169
- user.isAllowedTo = function (slug) {
4170
- if (this.permissions) {
4171
- let permissions = [];
4172
- if (typeof this.permissions === 'string') {
4173
- permissions = this.permissions;
4174
- } else {
4175
- permissions = this.permissions;
4176
- }
4177
- return permissions.includes(slug)
4178
- }
4179
- return false
4180
- };
4181
- }
4182
- this.user = user;
4183
- const userEndpoint = defaultEndpoint ?? inject('userEndpoint','auth/user') ?? 'auth/user?defaults=1';
4184
-
4185
- shApis.doGet(userEndpoint).then(res => {
4186
- let user = res.data.user;
4187
- if (typeof(user) === 'undefined') {
4188
- user = res.data;
4189
- }
4190
- shStorage.setItem('user',user);
4191
- user.signOut = this.signOut;
4192
- user.logout = this.signOut;
4193
- user.logOut = this.signOut;
4194
- user.isAllowedTo = function (slug) {
4195
- if(!slug){
4196
- return true
4197
- }
4198
- if (this.permissions) {
4199
- let permissions = [];
4200
- if (typeof this.permissions === 'string') {
4201
- permissions = this.permissions;
4202
- } else {
4203
- permissions = this.permissions;
4204
- }
4205
- return permissions.includes(slug)
4206
- }
4207
- return false
4208
- };
4209
- user.can = user.isAllowedTo;
4210
- this.user = user;
4211
- }).catch((reason) => {
4212
- if (reason.response && reason.response.status) {
4213
- if(reason.response.status === 401) {
4214
- shStorage.setItem('user',null);
4215
- this.user = null;
4216
- }
4217
- this.loggedOut = true;
4218
- }
4219
- });
4220
- if (this.user) {
4221
- if (typeof this.user.permissions === 'string') {
4222
- this.permissions = this.user.permissions;
4223
- } else {
4224
- this.permissions = this.user.permissions;
4225
- }
4226
- }
4227
- const timeNow = moment().toISOString();
4228
- shStorage.setItem('session_start',timeNow);
4229
- },
4230
- signOut () {
4231
- shRepo.signOutUser();
4232
- },
4233
- logOut () {
4234
- this.signOut();
4235
- },
4236
- getUser () {
4237
- this.setUser();
4238
- },
4239
- setAccessToken (accessToken) {
4240
- shStorage.setItem('access_token', accessToken);
4241
- this.setUser();
4242
- }
4243
- },
4244
- getters: {
4245
- userId (state) {
4246
- return state.user === null ? null:state.user.id
4247
- }
4248
- }
4249
- });
4250
-
4251
4190
  var script$j = {
4252
4191
  __name: 'ShConfirmAction',
4253
4192
  props: {
@@ -4328,7 +4267,7 @@ return (_ctx, _cache) => {
4328
4267
  class: "spinner-border spinner-border-sm me-1",
4329
4268
  role: "status",
4330
4269
  "aria-hidden": "true"
4331
- }, null, -1 /* HOISTED */)),
4270
+ }, null, -1 /* CACHED */)),
4332
4271
  createElementVNode("span", null, toDisplayString(__props.loadingMessage), 1 /* TEXT */)
4333
4272
  ], 64 /* STABLE_FRAGMENT */))
4334
4273
  : createCommentVNode("v-if", true),
@@ -4425,7 +4364,7 @@ return (_ctx, _cache) => {
4425
4364
  class: "spinner-border spinner-border-sm me-1",
4426
4365
  role: "status",
4427
4366
  "aria-hidden": "true"
4428
- }, null, -1 /* HOISTED */)),
4367
+ }, null, -1 /* CACHED */)),
4429
4368
  createElementVNode("span", null, toDisplayString(__props.loadingMessage), 1 /* TEXT */)
4430
4369
  ], 64 /* STABLE_FRAGMENT */))
4431
4370
  : createCommentVNode("v-if", true),
@@ -4440,6 +4379,108 @@ return (_ctx, _cache) => {
4440
4379
 
4441
4380
  script$i.__file = "src/lib/components/ShSilentAction.vue";
4442
4381
 
4382
+ const useUserStore = defineStore('user-store', {
4383
+ state: () => ({
4384
+ user: null,
4385
+ role: null,
4386
+ permissions: null,
4387
+ menus: [],
4388
+ loggedOut: false
4389
+ }),
4390
+ actions: {
4391
+ setUser (defaultEndpoint) {
4392
+ let user = null;
4393
+ try {
4394
+ user = shStorage.getItem('user') ? shStorage.getItem('user') : null;
4395
+ } catch (error) {
4396
+ user= null;
4397
+ }
4398
+ if(typeof user !== 'object'){
4399
+ user = null;
4400
+ }
4401
+ if (user ) {
4402
+ user.isAllowedTo = function (slug) {
4403
+ if (this.permissions) {
4404
+ let permissions = [];
4405
+ if (typeof this.permissions === 'string') {
4406
+ permissions = this.permissions;
4407
+ } else {
4408
+ permissions = this.permissions;
4409
+ }
4410
+ return permissions.includes(slug)
4411
+ }
4412
+ return false
4413
+ };
4414
+ }
4415
+ this.user = user;
4416
+ const userEndpoint = defaultEndpoint ?? inject('userEndpoint','auth/user') ?? 'auth/user?defaults=1';
4417
+
4418
+ shApis.doGet(userEndpoint).then(res => {
4419
+ let user = res.data.user;
4420
+ if (typeof(user) === 'undefined') {
4421
+ user = res.data;
4422
+ }
4423
+ shStorage.setItem('user',user);
4424
+ user.signOut = this.signOut;
4425
+ user.logout = this.signOut;
4426
+ user.logOut = this.signOut;
4427
+ user.isAllowedTo = function (slug) {
4428
+ if(!slug){
4429
+ return true
4430
+ }
4431
+ if (this.permissions) {
4432
+ let permissions = [];
4433
+ if (typeof this.permissions === 'string') {
4434
+ permissions = this.permissions;
4435
+ } else {
4436
+ permissions = this.permissions;
4437
+ }
4438
+ return permissions.includes(slug)
4439
+ }
4440
+ return false
4441
+ };
4442
+ user.can = user.isAllowedTo;
4443
+ this.user = user;
4444
+ }).catch((reason) => {
4445
+ if (reason.response && reason.response.status) {
4446
+ if(reason.response.status === 401) {
4447
+ shStorage.setItem('user',null);
4448
+ this.user = null;
4449
+ }
4450
+ this.loggedOut = true;
4451
+ }
4452
+ });
4453
+ if (this.user) {
4454
+ if (typeof this.user.permissions === 'string') {
4455
+ this.permissions = this.user.permissions;
4456
+ } else {
4457
+ this.permissions = this.user.permissions;
4458
+ }
4459
+ }
4460
+ const timeNow = DateTime.now().toISO();
4461
+ shStorage.setItem('session_start',timeNow);
4462
+ },
4463
+ signOut () {
4464
+ shRepo.signOutUser();
4465
+ },
4466
+ logOut () {
4467
+ this.signOut();
4468
+ },
4469
+ getUser () {
4470
+ this.setUser();
4471
+ },
4472
+ setAccessToken (accessToken) {
4473
+ shStorage.setItem('access_token', accessToken);
4474
+ this.setUser();
4475
+ }
4476
+ },
4477
+ getters: {
4478
+ userId (state) {
4479
+ return state.user === null ? null:state.user.id
4480
+ }
4481
+ }
4482
+ });
4483
+
4443
4484
  const _hoisted_1$f = ["href"];
4444
4485
  const _hoisted_2$c = ["title"];
4445
4486
 
@@ -4678,18 +4719,222 @@ return (_ctx, _cache) => {
4678
4719
 
4679
4720
  script$g.__file = "src/lib/components/table/TableActions.vue";
4680
4721
 
4681
- var script$f = {
4682
- name: 'Pagination',
4683
- props: ['pagination_data', 'loadMore', 'hideCount', 'hideLoadMore', 'paginationStyle','perPage'],
4684
- data () {
4685
- return {
4686
- current_page: this.pagination_data.current,
4687
- per_page: this.pagination_data.per_page,
4688
- loadingMore: 0,
4689
- pageOptions: [10,25,50,100,200,400]
4690
- }
4691
- },
4692
- mounted(){
4722
+ const _hoisted_1$d = { class: "sh-range" };
4723
+ const _hoisted_2$a = { class: "dropdown" };
4724
+ const _hoisted_3$8 = {
4725
+ class: "form-control dropdown-toggle",
4726
+ href: "#",
4727
+ role: "button",
4728
+ id: "dropdownMenuLink",
4729
+ "data-bs-toggle": "dropdown",
4730
+ "aria-expanded": "false"
4731
+ };
4732
+ const _hoisted_4$8 = ["innerHTML"];
4733
+ const _hoisted_5$5 = {
4734
+ class: "dropdown-menu sh-range-dropdown",
4735
+ "aria-labelledby": "dropdownMenuLink"
4736
+ };
4737
+ const _hoisted_6$5 = { class: "sh-range-preset" };
4738
+ const _hoisted_7$5 = ["onClick"];
4739
+ const _hoisted_8$4 = { class: "border-top" };
4740
+ const _hoisted_9$4 = { class: "dropdown-item d-flex flex-column" };
4741
+
4742
+
4743
+
4744
+ var script$f = {
4745
+ __name: 'ShRange',
4746
+ props: {
4747
+ start: {
4748
+ type: Number,
4749
+ default: 2021
4750
+ },
4751
+ selected: {
4752
+ type: String,
4753
+ default: shRepo.getShConfig('defaultRange', 'This Month')
4754
+ }
4755
+ },
4756
+ emits: ['rangeSelected'],
4757
+ setup(__props, { emit: __emit }) {
4758
+
4759
+ const props = __props;
4760
+
4761
+ const emit = __emit;
4762
+
4763
+ const selectedDate = ref(null);
4764
+ const rangeLabel = ref(null);
4765
+ const customFrom = ref(null);
4766
+ const customTo = ref(null);
4767
+
4768
+ const applyCustom = () => {
4769
+ const date = [
4770
+ customFrom.value ? DateTime.fromISO(customFrom.value) : DateTime.now(),
4771
+ customTo.value ? DateTime.fromISO(customTo.value) : DateTime.now()
4772
+ ];
4773
+ setDate(date, 'Custom');
4774
+ };
4775
+
4776
+ const dates = ref([
4777
+ {
4778
+ label: 'Today',
4779
+ value: [DateTime.now().startOf('day'), DateTime.now().endOf('day')]
4780
+ },
4781
+ {
4782
+ label: 'Yesterday',
4783
+ value: [
4784
+ DateTime.now().minus({ days: 1 }).startOf('day'),
4785
+ DateTime.now().minus({ days: 1 }).endOf('day')
4786
+ ]
4787
+ },
4788
+ {
4789
+ label: '7 Days',
4790
+ value: [DateTime.now().minus({ days: 7 }).startOf('day'), DateTime.now().endOf('day')]
4791
+ },
4792
+ {
4793
+ label: 'This week',
4794
+ value: [
4795
+ DateTime.now().startOf('week'),
4796
+ DateTime.now().endOf('week')
4797
+ ]
4798
+ },
4799
+ {
4800
+ label: 'This Month',
4801
+ value: [DateTime.now().startOf('month'), DateTime.now().endOf('day')]
4802
+ },
4803
+ {
4804
+ label: 'Last Month',
4805
+ value: [
4806
+ DateTime.now().minus({ months: 1 }).startOf('month'),
4807
+ DateTime.now().minus({ months: 1 }).endOf('month')
4808
+ ]
4809
+ },
4810
+ {
4811
+ label: 'Last 30 days',
4812
+ value: [DateTime.now().minus({ days: 30 }).startOf('day'), DateTime.now().endOf('day')]
4813
+ },
4814
+ {
4815
+ label: 'Last 60 days',
4816
+ value: [DateTime.now().minus({ days: 60 }).startOf('day'), DateTime.now().endOf('day')]
4817
+ },
4818
+ {
4819
+ label: 'Last 90 days',
4820
+ value: [DateTime.now().minus({ days: 90 }).startOf('day'), DateTime.now().endOf('day')]
4821
+ },
4822
+ {
4823
+ label: 'This Year',
4824
+ value: [DateTime.now().startOf('year'), DateTime.now().endOf('day')]
4825
+ },
4826
+ {
4827
+ label: '1 Year',
4828
+ value: [DateTime.now().minus({ months: 12 }).startOf('day'), DateTime.now().endOf('day')]
4829
+ },
4830
+ {
4831
+ label: 'All Time',
4832
+ value: [DateTime.fromObject({ year: 2021 }).startOf('year'), DateTime.now().endOf('day')]
4833
+ }
4834
+ ]);
4835
+ const setDate = (date, label) => {
4836
+ selectedDate.value = date;
4837
+ rangeLabel.value = '<strong>' + label + '</strong><small>(' + date[0].toFormat('MMMM d, yyyy') + ' - ' + date[1].toFormat('MMMM d, yyyy') + ')</small>';
4838
+ const from = date[0];
4839
+ const to = date[1];
4840
+ const period = label.toString().toLowerCase().replaceAll(' ','_');
4841
+ emit('rangeSelected', {
4842
+ from: from,
4843
+ to: to,
4844
+ period: period,
4845
+ query: `from=${from.toFormat('MM/dd/yyyy')}&to=${to.toFormat('MM/dd/yyyy')}&period=${period}`
4846
+ });
4847
+ };
4848
+ onMounted(() => {
4849
+ let end = parseInt(DateTime.now().toFormat('yyyy'));
4850
+ while (end >= props.start) {
4851
+ dates.value.push({
4852
+ label: end,
4853
+ value: [
4854
+ DateTime.fromObject({ year: end }).startOf('year'),
4855
+ DateTime.fromObject({ year: end }).endOf('year')
4856
+ ]
4857
+ });
4858
+ end--;
4859
+ }
4860
+
4861
+ dates.value.map(date=>{
4862
+ (`${date.label}`.toLowerCase() === props.selected.toLowerCase()) && setDate(date.value, date.label);
4863
+ });
4864
+ });
4865
+
4866
+ return (_ctx, _cache) => {
4867
+ return (openBlock(), createElementBlock("div", _hoisted_1$d, [
4868
+ createElementVNode("div", _hoisted_2$a, [
4869
+ createElementVNode("div", _hoisted_3$8, [
4870
+ _cache[2] || (_cache[2] = createElementVNode("i", { class: "bi-calendar text-dark" }, null, -1 /* CACHED */)),
4871
+ _cache[3] || (_cache[3] = createTextVNode()),
4872
+ createElementVNode("span", { innerHTML: rangeLabel.value }, null, 8 /* PROPS */, _hoisted_4$8)
4873
+ ]),
4874
+ createElementVNode("div", _hoisted_5$5, [
4875
+ createElementVNode("ul", _hoisted_6$5, [
4876
+ (openBlock(true), createElementBlock(Fragment, null, renderList(dates.value, (date) => {
4877
+ return (openBlock(), createElementBlock("li", {
4878
+ key: date.label,
4879
+ onClick: $event => (setDate(date.value, date.label))
4880
+ }, [
4881
+ createElementVNode("a", {
4882
+ class: normalizeClass(["dropdown-item", date.value === selectedDate.value ? 'active' : '']),
4883
+ href: "#"
4884
+ }, toDisplayString(date.label), 3 /* TEXT, CLASS */)
4885
+ ], 8 /* PROPS */, _hoisted_7$5))
4886
+ }), 128 /* KEYED_FRAGMENT */))
4887
+ ]),
4888
+ createElementVNode("ul", null, [
4889
+ createElementVNode("li", _hoisted_8$4, [
4890
+ createElementVNode("div", _hoisted_9$4, [
4891
+ _cache[4] || (_cache[4] = createElementVNode("span", null, "Custom", -1 /* CACHED */)),
4892
+ createElementVNode("div", null, [
4893
+ withDirectives(createElementVNode("input", {
4894
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((customFrom).value = $event)),
4895
+ type: "date"
4896
+ }, null, 512 /* NEED_PATCH */), [
4897
+ [vModelText, customFrom.value]
4898
+ ]),
4899
+ withDirectives(createElementVNode("input", {
4900
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((customTo).value = $event)),
4901
+ type: "date"
4902
+ }, null, 512 /* NEED_PATCH */), [
4903
+ [vModelText, customTo.value]
4904
+ ])
4905
+ ]),
4906
+ (customFrom.value && customTo.value)
4907
+ ? (openBlock(), createElementBlock("button", {
4908
+ key: 0,
4909
+ class: "btn btn-sm btn-info mt-1",
4910
+ onClick: applyCustom
4911
+ }, "Apply"))
4912
+ : createCommentVNode("v-if", true)
4913
+ ])
4914
+ ])
4915
+ ])
4916
+ ])
4917
+ ])
4918
+ ]))
4919
+ }
4920
+ }
4921
+
4922
+ };
4923
+
4924
+ script$f.__file = "src/lib/components/ShRange.vue";
4925
+
4926
+ var script$e = {
4927
+ name: 'Pagination',
4928
+ props: ['pagination_data', 'loadMore', 'hideCount', 'hideLoadMore', 'paginationStyle','perPage'],
4929
+ data () {
4930
+ return {
4931
+ current_page: this.pagination_data.current,
4932
+ per_page: this.pagination_data.per_page,
4933
+ loadingMore: 0,
4934
+ pageOptions: [10,25,50,100,200,400]
4935
+ }
4936
+ },
4937
+ mounted(){
4693
4938
  if(!this.pageOptions.includes(this.perPage)){
4694
4939
  const recordCount = this.pagination_data.record_count;
4695
4940
  recordCount > 0 && recordCount < this.perPage && this.pageOptions.push(recordCount);
@@ -4757,24 +5002,24 @@ var script$f = {
4757
5002
  }
4758
5003
  };
4759
5004
 
4760
- const _hoisted_1$d = { key: 0 };
4761
- const _hoisted_2$a = { class: "record_count_body mb-3" };
4762
- const _hoisted_3$8 = ["value"];
4763
- const _hoisted_4$8 = { class: "record_counts" };
4764
- const _hoisted_5$5 = {
5005
+ const _hoisted_1$c = { key: 0 };
5006
+ const _hoisted_2$9 = { class: "record_count_body mb-3" };
5007
+ const _hoisted_3$7 = ["value"];
5008
+ const _hoisted_4$7 = { class: "record_counts" };
5009
+ const _hoisted_5$4 = {
4765
5010
  key: 0,
4766
5011
  "aria-label": "Page navigation"
4767
5012
  };
4768
- const _hoisted_6$5 = { class: "pagination" };
4769
- const _hoisted_7$5 = {
5013
+ const _hoisted_6$4 = { class: "pagination" };
5014
+ const _hoisted_7$4 = {
4770
5015
  key: 0,
4771
5016
  class: "page-link"
4772
5017
  };
4773
- const _hoisted_8$4 = {
5018
+ const _hoisted_8$3 = {
4774
5019
  key: 1,
4775
5020
  class: "page-link"
4776
5021
  };
4777
- const _hoisted_9$4 = ["onClick"];
5022
+ const _hoisted_9$3 = ["onClick"];
4778
5023
  const _hoisted_10$3 = { key: 1 };
4779
5024
  const _hoisted_11$2 = {
4780
5025
  key: 0,
@@ -4796,26 +5041,26 @@ const _hoisted_15$2 = {
4796
5041
 
4797
5042
  function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4798
5043
  return ($props.paginationStyle !== 'loadMore')
4799
- ? (openBlock(), createElementBlock("div", _hoisted_1$d, [
4800
- createElementVNode("div", _hoisted_2$a, [
4801
- _cache[5] || (_cache[5] = createElementVNode("span", { class: "per_page_show" }, "Showing", -1 /* HOISTED */)),
4802
- _cache[6] || (_cache[6] = createTextVNode("  ")),
5044
+ ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
5045
+ createElementVNode("div", _hoisted_2$9, [
5046
+ _cache[5] || (_cache[5] = createElementVNode("span", { class: "per_page_show" }, "Showing", -1 /* CACHED */)),
5047
+ _cache[6] || (_cache[6] = createTextVNode("  ", -1 /* CACHED */)),
4803
5048
  withDirectives(createElementVNode("select", {
4804
5049
  class: "select_per_page",
4805
5050
  onChange: _cache[0] || (_cache[0] = (...args) => ($options.changePerPage && $options.changePerPage(...args))),
4806
5051
  "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.per_page) = $event))
4807
5052
  }, [
4808
5053
  (openBlock(true), createElementBlock(Fragment, null, renderList($data.pageOptions, (option) => {
4809
- return (openBlock(), createElementBlock("option", { value: option }, toDisplayString(option), 9 /* TEXT, PROPS */, _hoisted_3$8))
5054
+ return (openBlock(), createElementBlock("option", { value: option }, toDisplayString(option), 9 /* TEXT, PROPS */, _hoisted_3$7))
4810
5055
  }), 256 /* UNKEYED_FRAGMENT */))
4811
5056
  ], 544 /* NEED_HYDRATION, NEED_PATCH */), [
4812
5057
  [vModelSelect, $data.per_page]
4813
5058
  ]),
4814
- createElementVNode("span", _hoisted_4$8, " of " + toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
5059
+ createElementVNode("span", _hoisted_4$7, " of " + toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
4815
5060
  ]),
4816
5061
  ($props.pagination_data != null)
4817
- ? (openBlock(), createElementBlock("nav", _hoisted_5$5, [
4818
- createElementVNode("ul", _hoisted_6$5, [
5062
+ ? (openBlock(), createElementBlock("nav", _hoisted_5$4, [
5063
+ createElementVNode("ul", _hoisted_6$4, [
4819
5064
  createElementVNode("li", {
4820
5065
  class: normalizeClass([$options.getActivePage === 1 ? 'disabled' : '' , "page-item"])
4821
5066
  }, [
@@ -4830,14 +5075,14 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4830
5075
  key: page
4831
5076
  }, [
4832
5077
  ($options.getActivePage === page)
4833
- ? (openBlock(), createElementBlock("a", _hoisted_7$5, toDisplayString(page), 1 /* TEXT */))
5078
+ ? (openBlock(), createElementBlock("a", _hoisted_7$4, toDisplayString(page), 1 /* TEXT */))
4834
5079
  : (['..','...'].includes(page))
4835
- ? (openBlock(), createElementBlock("a", _hoisted_8$4, toDisplayString(page), 1 /* TEXT */))
5080
+ ? (openBlock(), createElementBlock("a", _hoisted_8$3, toDisplayString(page), 1 /* TEXT */))
4836
5081
  : (openBlock(), createElementBlock("a", {
4837
5082
  key: 2,
4838
5083
  onClick: $event => ($options.changeTableKey('page',page)),
4839
5084
  class: "page-link"
4840
- }, toDisplayString(page), 9 /* TEXT, PROPS */, _hoisted_9$4))
5085
+ }, toDisplayString(page), 9 /* TEXT, PROPS */, _hoisted_9$3))
4841
5086
  ], 2 /* CLASS */))
4842
5087
  }), 128 /* KEYED_FRAGMENT */)),
4843
5088
  createElementVNode("li", {
@@ -4854,12 +5099,12 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4854
5099
  ]))
4855
5100
  : (openBlock(), createElementBlock("div", _hoisted_10$3, [
4856
5101
  (this.pagination_data.loading === 1 && $props.loadMore && $props.hideLoadMore)
4857
- ? (openBlock(), createElementBlock("div", _hoisted_11$2, _cache[7] || (_cache[7] = [
5102
+ ? (openBlock(), createElementBlock("div", _hoisted_11$2, [...(_cache[7] || (_cache[7] = [
4858
5103
  createElementVNode("div", {
4859
5104
  class: "spinner-border",
4860
5105
  role: "status"
4861
- }, null, -1 /* HOISTED */)
4862
- ])))
5106
+ }, null, -1 /* CACHED */)
5107
+ ]))]))
4863
5108
  : createCommentVNode("v-if", true),
4864
5109
  (!$props.hideCount)
4865
5110
  ? (openBlock(), createElementBlock("div", _hoisted_12$2, [
@@ -4880,198 +5125,8 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4880
5125
  ]))
4881
5126
  }
4882
5127
 
4883
- script$f.render = render$1;
4884
- script$f.__file = "src/lib/components/list_templates/Pagination.vue";
4885
-
4886
- const _hoisted_1$c = { class: "sh-range" };
4887
- const _hoisted_2$9 = { class: "dropdown" };
4888
- const _hoisted_3$7 = {
4889
- class: "form-control dropdown-toggle",
4890
- href: "#",
4891
- role: "button",
4892
- id: "dropdownMenuLink",
4893
- "data-bs-toggle": "dropdown",
4894
- "aria-expanded": "false"
4895
- };
4896
- const _hoisted_4$7 = ["innerHTML"];
4897
- const _hoisted_5$4 = {
4898
- class: "dropdown-menu sh-range-dropdown",
4899
- "aria-labelledby": "dropdownMenuLink"
4900
- };
4901
- const _hoisted_6$4 = { class: "sh-range-preset" };
4902
- const _hoisted_7$4 = ["onClick"];
4903
- const _hoisted_8$3 = { class: "border-top" };
4904
- const _hoisted_9$3 = { class: "dropdown-item d-flex flex-column" };
4905
-
4906
-
4907
-
4908
- var script$e = {
4909
- __name: 'ShRange',
4910
- props: {
4911
- start: {
4912
- type: Number,
4913
- default: 2021
4914
- },
4915
- selected: {
4916
- type: String,
4917
- default: shRepo.getShConfig('defaultRange', 'This Month')
4918
- }
4919
- },
4920
- emits: ['rangeSelected'],
4921
- setup(__props, { emit: __emit }) {
4922
-
4923
- const props = __props;
4924
-
4925
- const emit = __emit;
4926
-
4927
- const selectedDate = ref(null);
4928
- const rangeLabel = ref(null);
4929
- ref(false);
4930
- const customFrom = ref(null);
4931
- const customTo = ref(null);
4932
-
4933
- const applyCustom = ()=>{
4934
- const date = [moment(customFrom.value),moment(customTo.value)];
4935
- setDate(date,'Custom');
4936
- };
4937
-
4938
- const dates = ref([
4939
- {
4940
- label: 'Today',
4941
- value: [moment(), moment()]
4942
- },
4943
- {
4944
- label: 'Yesterday',
4945
- value: [moment().subtract(1, 'days'), moment()]
4946
- },
4947
- {
4948
- label: '7 Days',
4949
- value: [moment().subtract(7, 'days'), moment()]
4950
- },
4951
- {
4952
- label: 'This week',
4953
- value: [moment().subtract(1, 'week').startOf('week'), moment().subtract(1, 'week').endOf('week')]
4954
- },
4955
- {
4956
- label: 'This Month',
4957
- value: [moment().startOf('month'), moment()]
4958
- },
4959
- {
4960
- label: 'Last Month',
4961
- value: [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
4962
- },
4963
- {
4964
- label: 'Last 30 days',
4965
- value: [moment().subtract(30, 'days'), moment()]
4966
- },
4967
- {
4968
- label: 'Last 60 days',
4969
- value: [moment().subtract(60, 'days'), moment()]
4970
- },
4971
- {
4972
- label: 'Last 90 days',
4973
- value: [moment().subtract(90, 'days'), moment()]
4974
- },
4975
- {
4976
- label: 'This Year',
4977
- value: [moment().startOf('year'), moment()]
4978
- },
4979
- {
4980
- label: '1 Year',
4981
- value: [moment().subtract(12, 'months'), moment()]
4982
- },
4983
- {
4984
- label: 'All Time',
4985
- value: [moment('@/2021').startOf('year'), moment()]
4986
- }
4987
- ]);
4988
- const setDate = (date, label) => {
4989
- selectedDate.value = date;
4990
- rangeLabel.value = '<strong>' + label + '</strong><small>(' + date[0].format('MMMM D, YYYY') + ' - ' + date[1].format('MMMM D, YYYY') + ')</small>';
4991
- const from = date[0];
4992
- const to = date[1];
4993
- const period = label.toString().toLowerCase().replaceAll(' ','_');
4994
- emit('rangeSelected', {
4995
- from: from,
4996
- to: to,
4997
- period: period,
4998
- query: `from=${from.format('L')}&to=${to.format('L')}&period=${period}`
4999
- });
5000
- };
5001
- onMounted(() => {
5002
- let end = parseInt(moment().format('Y'));
5003
- while (end >= props.start) {
5004
- dates.value.push({
5005
- label: end,
5006
- value: [moment('@/' + end).startOf('year'), moment('@/' + end).endOf('year')]
5007
- });
5008
- end--;
5009
- }
5010
-
5011
- dates.value.map(date=>{
5012
- (`${date.label}`.toLowerCase() === props.selected.toLowerCase()) && setDate(date.value, date.label);
5013
- });
5014
- });
5015
-
5016
- return (_ctx, _cache) => {
5017
- return (openBlock(), createElementBlock("div", _hoisted_1$c, [
5018
- createElementVNode("div", _hoisted_2$9, [
5019
- createElementVNode("div", _hoisted_3$7, [
5020
- _cache[2] || (_cache[2] = createElementVNode("i", { class: "bi-calendar text-dark" }, null, -1 /* HOISTED */)),
5021
- _cache[3] || (_cache[3] = createTextVNode()),
5022
- createElementVNode("span", { innerHTML: rangeLabel.value }, null, 8 /* PROPS */, _hoisted_4$7)
5023
- ]),
5024
- createElementVNode("div", _hoisted_5$4, [
5025
- createElementVNode("ul", _hoisted_6$4, [
5026
- (openBlock(true), createElementBlock(Fragment, null, renderList(dates.value, (date) => {
5027
- return (openBlock(), createElementBlock("li", {
5028
- key: date.label,
5029
- onClick: $event => (setDate(date.value, date.label))
5030
- }, [
5031
- createElementVNode("a", {
5032
- class: normalizeClass(["dropdown-item", date.value === selectedDate.value ? 'active' : '']),
5033
- href: "#"
5034
- }, toDisplayString(date.label), 3 /* TEXT, CLASS */)
5035
- ], 8 /* PROPS */, _hoisted_7$4))
5036
- }), 128 /* KEYED_FRAGMENT */))
5037
- ]),
5038
- createElementVNode("ul", null, [
5039
- createElementVNode("li", _hoisted_8$3, [
5040
- createElementVNode("div", _hoisted_9$3, [
5041
- _cache[4] || (_cache[4] = createElementVNode("span", null, "Custom", -1 /* HOISTED */)),
5042
- createElementVNode("div", null, [
5043
- withDirectives(createElementVNode("input", {
5044
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((customFrom).value = $event)),
5045
- type: "date"
5046
- }, null, 512 /* NEED_PATCH */), [
5047
- [vModelText, customFrom.value]
5048
- ]),
5049
- withDirectives(createElementVNode("input", {
5050
- "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((customTo).value = $event)),
5051
- type: "date"
5052
- }, null, 512 /* NEED_PATCH */), [
5053
- [vModelText, customTo.value]
5054
- ])
5055
- ]),
5056
- (customFrom.value && customTo.value)
5057
- ? (openBlock(), createElementBlock("button", {
5058
- key: 0,
5059
- class: "btn btn-sm btn-info mt-1",
5060
- onClick: applyCustom
5061
- }, "Apply"))
5062
- : createCommentVNode("v-if", true)
5063
- ])
5064
- ])
5065
- ])
5066
- ])
5067
- ])
5068
- ]))
5069
- }
5070
- }
5071
-
5072
- };
5073
-
5074
- script$e.__file = "src/lib/components/ShRange.vue";
5128
+ script$e.render = render$1;
5129
+ script$e.__file = "src/lib/components/list_templates/Pagination.vue";
5075
5130
 
5076
5131
  const _hoisted_1$b = { class: "auto-table mt-2" };
5077
5132
  const _hoisted_2$8 = {
@@ -5194,364 +5249,352 @@ const _hoisted_55 = ["innerHTML"];
5194
5249
  const _hoisted_56 = ["innerHTML"];
5195
5250
  const _hoisted_57 = { key: 0 };
5196
5251
 
5197
- const __default__ = {
5198
- name: 'sh-table',
5199
- props: ['endPoint','orderBy','orderMethod', 'headers','disableMobileResponsive', 'cacheKey', 'query', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover', 'hideIds', 'paginationStyle', 'hasRange','selectedRange','noRecordsMessage'],
5200
- data(){
5201
- return {
5202
- order_by: this.orderBy,
5203
- order_method: this.orderMethod,
5204
- per_page: this.pageCount ?? shRepo.getShConfig('tablePerPage', 10),
5205
- page: 1,
5206
- exactMatch: false,
5207
- filter_value: '',
5208
- loading: 'loading',
5209
- loading_error: '',
5210
- records: null,
5211
- total: 0,
5212
- pagination_data: null,
5213
- moreDetailsId: null,
5214
- moreDetailsModel: null,
5215
- downloading: false,
5216
- appUrl: window.VITE_APP_API_URL,
5217
- hasCanvas: 0,
5218
- selectedRecord: null,
5219
- timeOut: null,
5220
- tableHeaders: [],
5221
- pageStyle: this.paginationStyle ?? shRepo.getShConfig('tablePaginationStyle', 'loadMore'),
5222
- range: null,
5223
- from: null,
5224
- to: null,
5225
- period: null,
5226
- lastId: null
5227
- }
5228
- },
5229
- mounted(){
5230
- if (this.headers) {
5231
- this.tableHeaders = this.headers;
5232
- }
5252
+ // --- Props / Emits
5233
5253
 
5234
- if (this.actions && this.actions.actions) {
5235
- this.actions.actions.forEach(action => {
5236
- if (action.canvasComponent) {
5237
- this.hasCanvas = true;
5238
- }
5239
- });
5240
- }
5241
- if (this.cacheKey) {
5242
- this.setCachedData();
5243
- }
5244
- this.reloadData();
5245
- },
5246
- methods: {
5247
- rangeChanged: function (newRange){
5248
- this.range = newRange;
5249
- this.from = newRange.from.format('L');
5250
- this.to = newRange.to.format('L');
5251
- this.period = newRange.period;
5252
- this.reloadData();
5253
- },
5254
- userTyping: function (){
5255
- if (this.timeOut) {
5256
- clearTimeout(this.timeOut);
5257
- }
5258
- const self = this;
5259
- this.timeOut = setTimeout(() => {
5260
- self.reloadData(1);
5261
- }, 800);
5262
- },
5263
- cleanCanvasProps: function (actions){
5264
- let replaced = actions;
5265
- replaced.class = null;
5266
- return replaced
5267
- },
5268
- newRecordAdded: function (ev){
5269
- const record = ev.log;
5270
- if (record.user) {
5271
- record.user = record.user.name;
5272
- }
5273
- this.records.unshift(record);
5274
- },
5275
- canvasClosed: function (){
5276
- this.selectedRecord = null;
5277
- },
5278
- rowSelected: function (row){
5279
- this.selectedRecord = null;
5280
- setTimeout(() => {
5281
- this.selectedRecord = row;
5282
- this.$emit('rowSelected', row);
5283
- }, 100);
5284
- },
5285
- changeKey: function (key, value){
5286
- this[key] = value;
5287
- if (key === 'order_by') {
5288
- this.order_method = (this.order_method === 'desc') ? 'asc' : 'desc';
5289
- }
5290
- if (key === 'per_page') {
5291
- this.page = 1;
5292
- }
5293
- this.reloadData();
5294
- },
5295
- getLinkClass: function (config){
5296
- if (typeof config === 'object') {
5297
- return config.class
5298
- }
5299
- return ''
5300
- },
5301
- reloadNotifications: function (){
5302
- this.reloadData();
5303
- },
5304
- replaceActionUrl: function (path, obj){
5305
- if (path) {
5306
- var matches = path.match(/\{(.*?)\}/g);
5307
- try {
5308
- matches.forEach(key => {
5309
- key = key.replace('{', '');
5310
- key = key.replace('}', '');
5311
- path = path.replace(`{${key}}`, obj[key]);
5312
- });
5313
- return path
5314
- } catch (e) {
5315
- return path
5316
- }
5317
- }
5318
- return ''
5319
- },
5320
- doEmitAction: function (action, data){
5321
- if (typeof action === 'function') {
5322
- action(data);
5323
- } else {
5324
- this.$emit(action, data);
5325
- }
5326
- },
5327
- getFieldType: function (field){
5328
- const numbers = ['age', 'interest_rate_pa'];
5329
- const moneys = ['amount', 'paid_amount', 'total_paid', 'total', 'monthly_fee', 'share_cost', 'min_contribution', 'min_membership_contribution'];
5330
- const dates = ['invoice_date', 'free_tier_days', 'updated_at', 'created_at', 'end_time'];
5331
- if (numbers.includes(field)) {
5332
- return 'numeric'
5333
- }
5334
- if (moneys.includes(field)) {
5335
- return 'money'
5336
- }
5337
- if (dates.includes(field)) {
5338
- return 'date'
5339
- }
5340
- return 'string'
5341
- },
5342
- replaceLinkUrl: function (path, obj){
5343
- if (typeof path === 'object') {
5344
- // check path,link or url
5345
- if (path.link) {
5346
- path = path.link;
5347
- } else if (path.url) {
5348
- path = path.url;
5349
- } else if(path.path){
5350
- path = path.path;
5351
- } else {
5352
- path = '';
5353
- }
5354
- }
5355
- var matches = path.match(/\{(.*?)\}/g);
5356
- matches && matches.forEach(key => {
5357
- key = key.replace('{', '');
5358
- key = key.replace('}', '');
5359
- path = path.replace(`{${key}}`, obj[key]);
5360
- });
5361
- return path
5362
- },
5363
- formatDate: function (date){
5364
- return moment(date).format('lll')
5365
- },
5366
- setMoreDetailsModel: function (row){
5367
- this.moreDetailsModel = null;
5368
- this.moreDetailsModel = row;
5369
- },
5370
- loadMoreRecords: function (){
5371
- this.reloadData(this.page + 1, 1);
5372
- },
5373
- exportData: function (template){
5374
- this.downloading = true;
5375
- const headers = [];
5376
- const fields = this.downloadFields ? this.downloadFields : this.headers;
5377
- fields.forEach(header => {
5378
- if (typeof header === 'string') {
5379
- headers.push(header);
5380
- }
5381
- });
5254
+ var script$d = {
5255
+ __name: 'ShTable',
5256
+ props: {
5257
+ endPoint: [String, null],
5258
+ orderBy: String,
5259
+ orderMethod: {type: String, default: 'desc'},
5260
+ headers: [Array, null],
5261
+ disableMobileResponsive: {type: Boolean, default: false},
5262
+ cacheKey: [String, null],
5263
+ query: [String, null],
5264
+ pageCount: [Number, null],
5265
+ actions: [Object, null],
5266
+ hideCount: {type: Boolean, default: false},
5267
+ hideLoadMore: {type: Boolean, default: false},
5268
+ links: [Object, null],
5269
+ reload: [Number, Boolean, String, null],
5270
+ hideSearch: {type: Boolean, default: false},
5271
+ sharedData: [Object, null],
5272
+ searchPlaceholder: [String, null],
5273
+ event: [String, null],
5274
+ displayMore: [Boolean, null],
5275
+ displayMoreBtnClass: [String, null],
5276
+ moreDetailsColumns: [Array, null],
5277
+ moreDetailsFields: [Array, null],
5278
+ hasDownload: {type: Boolean, default: false},
5279
+ downloadFields: [Array, null],
5280
+ tableHover: {type: Boolean, default: false},
5281
+ hideIds: {type: Array, default: () => []},
5282
+ paginationStyle: [String, null],
5283
+ hasRange: {type: Boolean, default: false},
5284
+ selectedRange: [Object, null],
5285
+ noRecordsMessage: [String, null]
5286
+ },
5287
+ emits: ['rowSelected', 'dataReloaded', 'dataLoaded'],
5288
+ setup(__props, { emit: __emit }) {
5382
5289
 
5383
- const data = {
5384
- titles: headers,
5385
- export: 1,
5386
- order_by: this.order_by,
5387
- order_method: this.order_method,
5388
- filter_value: this.filter_value,
5389
- from: this.from,
5390
- to: this.to,
5391
- period: this.period,
5392
- lastId: this.lastId,
5393
- };
5394
- shApis.doPost(this.endPoint, data).then(res => {
5395
- this.downloading = false;
5396
- if (res.data.file) {
5397
- const url = this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name;
5398
- window.location.href = url;
5399
- // window.open('https://facebook.com')
5400
- // window.open(this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name, '_blank').focus()
5401
- }
5402
- }).catch(reason => {
5403
- this.downloading = false;
5404
- const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText}`;
5405
- shRepo.swalError('Error', error);
5406
- });
5407
- },
5408
- setCachedData: function (){
5409
- if (this.cacheKey) {
5410
- this.records = shStorage.getItem('sh_table_cache_' + this.cacheKey, null);
5411
- }
5412
- },
5413
- reloadData: function (page, append){
5414
- if (typeof page !== 'undefined') {
5415
- this.page = page;
5416
- }
5417
- if (this.cacheKey && this.records !== null) {
5418
- this.loading = 'done';
5419
- } else if (!append) {
5420
- this.loading = 'loading';
5421
- }
5422
- let data = {
5423
- order_by: this.order_by,
5424
- order_method: this.order_method,
5425
- per_page: this.per_page,
5426
- page: this.page,
5427
- filter_value: this.filter_value,
5428
- paginated: true,
5429
- from: this.from,
5430
- to: this.to,
5431
- period: this.period,
5432
- exact: this.exactMatch,
5433
- lastId: this.lastId
5434
- };
5435
- // remove empty values
5436
- Object.keys(data).forEach(key => {
5437
- if (data[key] === null || data[key] === '') {
5438
- delete data[key];
5439
- }
5440
- });
5441
- if (this.pagination_data) {
5442
- this.pagination_data.loading = 1;
5443
- }
5444
- let endPoint = this.endPoint;
5445
- if (!this.endPoint && this.query) {
5446
- //send ql query
5447
- endPoint = 'sh-ql';
5448
- data.query = this.query;
5449
- }
5450
- shApis.doGet(endPoint, data).then(req => {
5451
- this.$emit('dataReloaded', this.pagination_data);
5452
- this.loading = 'done';
5453
- const response = req.data.data;
5454
- this.$emit('dataLoaded', response);
5455
- if (this.page < 2 && this.cacheKey) {
5456
- shStorage.setItem('sh_table_cache_' + this.cacheKey, response.data);
5457
- }
5290
+ const props = __props;
5458
5291
 
5459
- this.pagination_data = {
5460
- current: response.current_page,
5461
- start: response.from,
5462
- end: response.last_page,
5463
- record_count: response.total,
5464
- per_page: response.per_page,
5465
- loading: 0,
5466
- displayCount: response.total > response.per_page ? response.per_page : response.total
5467
- };
5468
- if (!this.headers && response.total > 0) {
5469
- this.tableHeaders = Object.keys(response.data[0]);
5470
- }
5471
- // get id value of the last record
5472
- this.lastId = response.data.length > 0 ? response.data[response.data.length - 1].id : null;
5473
- if (append) {
5474
- this.records.push(...response.data);
5475
- let totalShown = response.total > response.per_page ? response.per_page * response.current_page : response.total;
5476
- if (totalShown > response.total) {
5477
- totalShown = response.total;
5478
- }
5479
- this.pagination_data.displayCount = totalShown;
5480
- const scrollingElement = (document.scrollingElement || document.body);
5481
- scrollingElement.scrollTop = scrollingElement.scrollHeight;
5482
- } else {
5483
- this.records = response.data;
5484
- }
5485
- }).catch(reason => {
5486
- const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText} (${this.endPoint})`;
5487
- this.loading_error = error;
5488
- this.loading = 'error';
5489
- });
5490
- }
5491
- },
5492
- watch: {
5493
- hideIds: {
5494
- handler(newValue){
5495
- this.records = this.records.filter(record => !newValue.includes(record.id) && record);
5496
- },
5497
- deep: true
5498
- },
5499
- reload(){
5500
- this.reloadData();
5501
- },
5502
- endPoint(){
5503
- this.reloadData();
5504
- }
5505
- },
5506
- components: {
5507
- ShRange: script$e,
5508
- ShSilentAction: script$i,
5509
- ShConfirmAction: script$j,
5510
- ShCanvas: script$l,
5511
- pagination: script$f
5512
- },
5513
- computed: {
5514
- windowWidth: function (){
5515
- return window.innerWidth
5516
- },
5517
- user(){
5518
- return null
5519
- },
5520
- hasDefaultSlot(){
5521
- return !!this.$slots.default
5522
- },
5523
- hasRecordsSlot(){
5524
- return !!this.$slots.records
5525
- }
5292
+ const emit = __emit;
5293
+
5294
+ // --- Injection
5295
+ const noRecordsComponent = inject('noRecordsComponent', script$k);
5296
+
5297
+ // --- Local State
5298
+ const order_by = ref(props.orderBy);
5299
+ const order_method = ref(props.orderMethod);
5300
+ const per_page = ref(props.pageCount ?? shRepo.getShConfig('tablePerPage', 10));
5301
+ const page = ref(1);
5302
+ const exactMatch = ref(false);
5303
+ const filter_value = ref('');
5304
+ const loading = ref('loading'); // 'loading' | 'done' | 'error'
5305
+ const loading_error = ref('');
5306
+ const records = ref([]);
5307
+ ref(0);
5308
+ const pagination_data = ref(null);
5309
+ ref(null);
5310
+ ref(null);
5311
+ const downloading = ref(false);
5312
+ const appUrl = window?.VITE_APP_API_URL ?? import.meta?.env?.VITE_APP_API_URL ?? '';
5313
+ const hasCanvas = ref(0);
5314
+ const selectedRecord = ref(null);
5315
+ const timeOut = ref(null);
5316
+ const tableHeaders = ref([]);
5317
+ const pageStyle = ref(props.paginationStyle ?? shRepo.getShConfig('tablePaginationStyle', 'loadMore'));
5318
+ const range = ref(null);
5319
+ const from = ref(null);
5320
+ const to = ref(null);
5321
+ const period = ref(null);
5322
+ const lastId = ref(null);
5323
+
5324
+ // Responsive width
5325
+ const windowWidth = ref(typeof window !== 'undefined' ? window.innerWidth : 1024);
5326
+ const handleResize = () => (windowWidth.value = window.innerWidth);
5327
+
5328
+ // --- Slots helpers
5329
+ const slots = useSlots();
5330
+ const hasDefaultSlot = computed(() => !!slots.default);
5331
+ const hasRecordsSlot = computed(() => !!slots.records);
5332
+
5333
+ // --- Lifecycle
5334
+ onMounted(() => {
5335
+ if (props.headers) tableHeaders.value = props.headers;
5336
+
5337
+ if (props.actions?.actions) {
5338
+ props.actions.actions.forEach(a => {
5339
+ if (a.canvasComponent) hasCanvas.value = 1;
5340
+ });
5526
5341
  }
5527
- };
5528
5342
 
5343
+ if (props.cacheKey) setCachedData();
5529
5344
 
5530
- var script$d = /*@__PURE__*/Object.assign(__default__, {
5531
- setup(__props) {
5345
+ reloadData();
5532
5346
 
5533
- const noRecordsComponent = inject('noRecordsComponent', script$k);
5347
+ window.addEventListener('resize', handleResize);
5348
+ });
5534
5349
 
5535
- storeToRefs(useUserStore());
5350
+ onBeforeUnmount(() => {
5351
+ window.removeEventListener('resize', handleResize);
5352
+ if (timeOut.value) clearTimeout(timeOut.value);
5353
+ });
5536
5354
 
5537
- const cleanColumn = col=>{
5538
- // remove col.component
5355
+ // --- Utils used in template
5356
+ const cleanColumn = (col) => {
5539
5357
  const newCol = {...col};
5540
5358
  delete newCol.component;
5541
5359
  delete newCol.key;
5542
5360
  return newCol
5543
5361
  };
5544
5362
 
5545
- const showColumn = header=>{
5546
- if(typeof header === 'string'){
5547
- return true
5363
+ const showColumn = (header) => {
5364
+ if (typeof header === 'string') return true
5365
+ if (typeof header === 'object' && header.validator) return header.validator()
5366
+ return true
5367
+ };
5368
+
5369
+ const cleanCanvasProps = (actions) => {
5370
+ const replaced = {...actions};
5371
+ replaced.class = null;
5372
+ return replaced
5373
+ };
5374
+
5375
+ const canvasClosed = () => {
5376
+ selectedRecord.value = null;
5377
+ };
5378
+
5379
+ const rowSelected = (row) => {
5380
+ selectedRecord.value = null;
5381
+ setTimeout(() => {
5382
+ selectedRecord.value = row;
5383
+ emit('rowSelected', row);
5384
+ }, 100);
5385
+ };
5386
+
5387
+ const changeKey = (key, value) => {
5388
+ if (key === 'order_by') {
5389
+ order_by.value = value;
5390
+ order_method.value = (order_method.value === 'desc') ? 'asc' : 'desc';
5391
+ } else if (key === 'per_page') {
5392
+ per_page.value = value;
5393
+ page.value = 1;
5394
+ } else {
5395
+ // generic
5396
+ // support pagination component passing keys like 'page'
5397
+ if (key in stateProxy) {
5398
+ stateProxy[key] = value;
5399
+ } else {
5400
+ // fallback direct
5401
+ if (key === 'page') page.value = value;
5402
+ }
5548
5403
  }
5549
- if(typeof header === 'object' && header.validator) {
5550
- return header.validator()
5404
+ reloadData();
5405
+ };
5406
+
5407
+ const getLinkClass = (config) => (typeof config === 'object' ? (config.class || '') : '');
5408
+
5409
+ const doEmitAction = (action, data) => {
5410
+ if (typeof action === 'function') action(data);
5411
+ else emit(action, data);
5412
+ };
5413
+
5414
+ const getFieldType = (field) => {
5415
+ const numbers = ['age', 'interest_rate_pa'];
5416
+ const moneys = ['amount', 'paid_amount', 'total_paid', 'total', 'monthly_fee', 'share_cost', 'min_contribution', 'min_membership_contribution'];
5417
+ const dates = ['invoice_date', 'free_tier_days', 'updated_at', 'created_at', 'end_time'];
5418
+ if (typeof field === 'string' && numbers.includes(field)) return 'numeric'
5419
+ if (typeof field === 'string' && moneys.includes(field)) return 'money'
5420
+ if (typeof field === 'string' && dates.includes(field)) return 'date'
5421
+ return 'string'
5422
+ };
5423
+
5424
+ const replaceLinkUrl = (p, obj) => {
5425
+ let path = p;
5426
+ if (typeof path === 'object') {
5427
+ if (path.link) path = path.link;
5428
+ else if (path.url) path = path.url;
5429
+ else if (path.path) path = path.path;
5430
+ else path = '';
5551
5431
  }
5552
- return true
5432
+ const matches = path.match(/\{(.*?)\}/g);
5433
+ matches?.forEach(k => {
5434
+ const key = k.replace('{', '').replace('}', '');
5435
+ path = path.replace(`{${key}}`, obj[key]);
5436
+ });
5437
+ return path
5438
+ };
5439
+
5440
+ const formatDate = (date) => DateTime.fromISO(date).toLocaleString(DateTime.DATETIME_MED);
5441
+
5442
+ const loadMoreRecords = () => reloadData(page.value + 1, 1);
5443
+
5444
+ const rangeChanged = (newRange) => {
5445
+ range.value = newRange;
5446
+ from.value = newRange.from.format('L');
5447
+ to.value = newRange.to.format('L');
5448
+ period.value = newRange.period;
5449
+ reloadData();
5450
+ };
5451
+
5452
+ const userTyping = () => {
5453
+ if (timeOut.value) clearTimeout(timeOut.value);
5454
+ timeOut.value = setTimeout(() => reloadData(1), 800);
5455
+ };
5456
+
5457
+ const exportData = () => {
5458
+ downloading.value = true;
5459
+ const headers = [];
5460
+ const fields = props.downloadFields ? props.downloadFields : props.headers;
5461
+ fields?.forEach(header => {
5462
+ if (typeof header === 'string') headers.push(header);
5463
+ });
5464
+
5465
+ const data = {
5466
+ titles: headers,
5467
+ export: 1,
5468
+ order_by: order_by.value,
5469
+ order_method: order_method.value,
5470
+ filter_value: filter_value.value,
5471
+ from: from.value,
5472
+ to: to.value,
5473
+ period: period.value,
5474
+ lastId: lastId.value
5475
+ };
5476
+
5477
+ shApis.doPost(props.endPoint, data).then(res => {
5478
+ downloading.value = false;
5479
+ if (res.data.file) {
5480
+ const url = appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name;
5481
+ window.location.href = url;
5482
+ }
5483
+ }).catch(reason => {
5484
+ downloading.value = false;
5485
+ const error = (typeof reason.response === 'undefined')
5486
+ ? 'Error getting data from backend'
5487
+ : `${reason.response.status}:${reason.response.statusText}`;
5488
+ shRepo.swalError('Error', error);
5489
+ });
5490
+ };
5491
+
5492
+ const setCachedData = () => {
5493
+ if (props.cacheKey) {
5494
+ records.value = shStorage.getItem('sh_table_cache_' + props.cacheKey, null);
5495
+ }
5496
+ };
5497
+
5498
+ // Main loader
5499
+ const reloadData = (newPage, append) => {
5500
+ if (typeof newPage !== 'undefined') page.value = newPage;
5501
+
5502
+ if (props.cacheKey && records.value !== null) {
5503
+ loading.value = 'done';
5504
+ } else if (!append) {
5505
+ loading.value = 'loading';
5506
+ }
5507
+
5508
+ let data = {
5509
+ order_by: order_by.value,
5510
+ order_method: order_method.value,
5511
+ per_page: per_page.value,
5512
+ page: page.value,
5513
+ filter_value: filter_value.value,
5514
+ paginated: true,
5515
+ from: from.value,
5516
+ to: to.value,
5517
+ period: period.value,
5518
+ exact: exactMatch.value,
5519
+ lastId: lastId.value
5520
+ };
5521
+
5522
+ // strip empty
5523
+ Object.keys(data).forEach(k => {
5524
+ if (data[k] === null || data[k] === '') delete data[k];
5525
+ });
5526
+
5527
+ if (pagination_data.value) pagination_data.value.loading = 1;
5528
+
5529
+ let endPoint = props.endPoint;
5530
+ if (!props.endPoint && props.query) {
5531
+ endPoint = 'sh-ql';
5532
+ data.query = props.query;
5533
+ }
5534
+
5535
+ shApis.doGet(endPoint, data).then(req => {
5536
+ emit('dataReloaded', pagination_data.value);
5537
+ loading.value = 'done';
5538
+
5539
+ const response = req.data.data;
5540
+ emit('dataLoaded', response);
5541
+
5542
+ if (page.value < 2 && props.cacheKey) {
5543
+ shStorage.setItem('sh_table_cache_' + props.cacheKey, response.data);
5544
+ }
5545
+
5546
+ pagination_data.value = {
5547
+ current: response.current_page,
5548
+ start: response.from,
5549
+ end: response.last_page,
5550
+ record_count: response.total,
5551
+ per_page: response.per_page,
5552
+ loading: 0,
5553
+ displayCount: response.total > response.per_page ? response.per_page : response.total
5554
+ };
5555
+
5556
+ if (!props.headers && response.total > 0) {
5557
+ tableHeaders.value = Object.keys(response.data[0]);
5558
+ }
5559
+
5560
+ lastId.value = response.data.length > 0 ? response.data[response.data.length - 1].id : null;
5561
+
5562
+ if (append) {
5563
+ records.value.push(...response.data);
5564
+ let totalShown = response.total > response.per_page
5565
+ ? response.per_page * response.current_page
5566
+ : response.total;
5567
+ if (totalShown > response.total) totalShown = response.total;
5568
+ pagination_data.value.displayCount = totalShown;
5569
+
5570
+ const scrollingElement = (document.scrollingElement || document.body);
5571
+ scrollingElement.scrollTop = scrollingElement.scrollHeight;
5572
+ } else {
5573
+ records.value = response.data;
5574
+ }
5575
+ }).catch(reason => {
5576
+ const error = (typeof reason.response === 'undefined')
5577
+ ? 'Error getting data from backend'
5578
+ : `${reason.response.status}:${reason.response.statusText} (${props.endPoint})`;
5579
+ loading_error.value = error;
5580
+ loading.value = 'error';
5581
+ });
5553
5582
  };
5554
5583
 
5584
+ // --- Watches
5585
+ watch(() => props.hideIds, (newVal) => {
5586
+ if (Array.isArray(newVal) && Array.isArray(records.value)) {
5587
+ records.value = records.value.filter(r => !newVal.includes(r.id) && r);
5588
+ }
5589
+ }, {deep: true});
5590
+
5591
+ watch(() => props.reload, () => reloadData());
5592
+ watch(() => props.endPoint, () => reloadData());
5593
+
5594
+ // optional proxy (for changeKey generic setter)
5595
+ const stateProxy = reactive({
5596
+ page, per_page, order_by, order_method
5597
+ });
5555
5598
 
5556
5599
  return (_ctx, _cache) => {
5557
5600
  const _component_router_link = resolveComponent("router-link");
@@ -5560,22 +5603,22 @@ return (_ctx, _cache) => {
5560
5603
  (__props.hasDownload)
5561
5604
  ? (openBlock(), createElementBlock("div", _hoisted_2$8, [
5562
5605
  createElementVNode("button", {
5563
- disabled: _ctx.downloading,
5606
+ disabled: downloading.value,
5564
5607
  class: "btn btn-warning btn-sm",
5565
- onClick: _cache[0] || (_cache[0] = $event => (_ctx.exportData()))
5608
+ onClick: _cache[0] || (_cache[0] = $event => (exportData()))
5566
5609
  }, [
5567
- (!_ctx.downloading)
5610
+ (!downloading.value)
5568
5611
  ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
5569
- _cache[7] || (_cache[7] = createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */)),
5570
- _cache[8] || (_cache[8] = createTextVNode(" Export "))
5612
+ _cache[4] || (_cache[4] = createElementVNode("i", { class: "bi-download" }, null, -1 /* CACHED */)),
5613
+ _cache[5] || (_cache[5] = createTextVNode(" Export ", -1 /* CACHED */))
5571
5614
  ], 64 /* STABLE_FRAGMENT */))
5572
5615
  : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
5573
- _cache[9] || (_cache[9] = createElementVNode("span", {
5616
+ _cache[6] || (_cache[6] = createElementVNode("span", {
5574
5617
  class: "spinner-border spinner-border-sm",
5575
5618
  role: "status",
5576
5619
  "aria-hidden": "true"
5577
- }, null, -1 /* HOISTED */)),
5578
- _cache[10] || (_cache[10] = createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* HOISTED */))
5620
+ }, null, -1 /* CACHED */)),
5621
+ _cache[7] || (_cache[7] = createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* CACHED */))
5579
5622
  ], 64 /* STABLE_FRAGMENT */))
5580
5623
  ], 8 /* PROPS */, _hoisted_3$6)
5581
5624
  ]))
@@ -5587,59 +5630,59 @@ return (_ctx, _cache) => {
5587
5630
  class: normalizeClass(["sh-search-bar input-group", __props.hasRange ? 'me-2':''])
5588
5631
  }, [
5589
5632
  withDirectives(createElementVNode("input", {
5590
- onKeydown: _cache[1] || (_cache[1] = (...args) => (_ctx.userTyping && _ctx.userTyping(...args))),
5591
- onKeyup: _cache[2] || (_cache[2] = (...args) => (_ctx.userTyping && _ctx.userTyping(...args))),
5633
+ onKeydown: userTyping,
5634
+ onKeyup: userTyping,
5592
5635
  type: "search",
5593
- onChange: _cache[3] || (_cache[3] = $event => (_ctx.reloadData(1))),
5594
- "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => ((_ctx.filter_value) = $event)),
5636
+ onChange: _cache[1] || (_cache[1] = $event => (reloadData(1))),
5637
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => ((filter_value).value = $event)),
5595
5638
  placeholder: __props.searchPlaceholder ? __props.searchPlaceholder : 'Search',
5596
5639
  class: "form-control sh-search-input"
5597
5640
  }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_6$3), [
5598
- [vModelText, _ctx.filter_value]
5641
+ [vModelText, filter_value.value]
5599
5642
  ]),
5600
- (_ctx.filter_value.length > 1)
5643
+ (filter_value.value.length > 1)
5601
5644
  ? (openBlock(), createElementBlock("span", _hoisted_7$3, [
5602
5645
  withDirectives(createElementVNode("input", {
5603
- onChange: _cache[5] || (_cache[5] = (...args) => (_ctx.reloadData && _ctx.reloadData(...args))),
5646
+ onChange: reloadData,
5604
5647
  value: true,
5605
- "onUpdate:modelValue": _cache[6] || (_cache[6] = $event => ((_ctx.exactMatch) = $event)),
5648
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = $event => ((exactMatch).value = $event)),
5606
5649
  type: "checkbox"
5607
5650
  }, null, 544 /* NEED_HYDRATION, NEED_PATCH */), [
5608
- [vModelCheckbox, _ctx.exactMatch]
5651
+ [vModelCheckbox, exactMatch.value]
5609
5652
  ]),
5610
- _cache[11] || (_cache[11] = createElementVNode("span", { class: "ms-1" }, "Exact", -1 /* HOISTED */))
5653
+ _cache[8] || (_cache[8] = createElementVNode("span", { class: "ms-1" }, "Exact", -1 /* CACHED */))
5611
5654
  ]))
5612
5655
  : createCommentVNode("v-if", true)
5613
5656
  ], 2 /* CLASS */),
5614
5657
  (__props.hasRange)
5615
5658
  ? (openBlock(), createElementBlock("div", _hoisted_8$2, [
5616
- createVNode(script$e, {
5617
- onRangeSelected: _ctx.rangeChanged,
5659
+ createVNode(script$f, {
5660
+ onRangeSelected: rangeChanged,
5618
5661
  selected: __props.selectedRange
5619
- }, null, 8 /* PROPS */, ["onRangeSelected", "selected"])
5662
+ }, null, 8 /* PROPS */, ["selected"])
5620
5663
  ]))
5621
5664
  : createCommentVNode("v-if", true)
5622
5665
  ])
5623
5666
  ]))
5624
5667
  : createCommentVNode("v-if", true),
5625
- (_ctx.hasDefaultSlot)
5668
+ (hasDefaultSlot.value)
5626
5669
  ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
5627
- (_ctx.loading === 'loading')
5628
- ? (openBlock(), createElementBlock("div", _hoisted_9$2, _cache[12] || (_cache[12] = [
5670
+ (loading.value === 'loading')
5671
+ ? (openBlock(), createElementBlock("div", _hoisted_9$2, [...(_cache[9] || (_cache[9] = [
5629
5672
  createElementVNode("div", {
5630
5673
  class: "spinner-border",
5631
5674
  role: "status"
5632
5675
  }, [
5633
5676
  createElementVNode("span", { class: "visually-hidden" }, "Loading...")
5634
- ], -1 /* HOISTED */)
5635
- ])))
5636
- : (_ctx.loading === 'error')
5677
+ ], -1 /* CACHED */)
5678
+ ]))]))
5679
+ : (loading.value === 'error')
5637
5680
  ? (openBlock(), createElementBlock("div", _hoisted_10$2, [
5638
- createElementVNode("span", null, toDisplayString(_ctx.loading_error), 1 /* TEXT */)
5681
+ createElementVNode("span", null, toDisplayString(loading_error.value), 1 /* TEXT */)
5639
5682
  ]))
5640
5683
  : createCommentVNode("v-if", true),
5641
- (_ctx.loading === 'done')
5642
- ? (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(_ctx.records, (record) => {
5684
+ (loading.value === 'done')
5685
+ ? (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(records.value, (record) => {
5643
5686
  return renderSlot(_ctx.$slots, "default", {
5644
5687
  key: record.id,
5645
5688
  record: record
@@ -5647,45 +5690,45 @@ return (_ctx, _cache) => {
5647
5690
  }), 128 /* KEYED_FRAGMENT */))
5648
5691
  : createCommentVNode("v-if", true)
5649
5692
  ], 64 /* STABLE_FRAGMENT */))
5650
- : (_ctx.hasRecordsSlot)
5693
+ : (hasRecordsSlot.value)
5651
5694
  ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
5652
- (_ctx.loading === 'loading' && !__props.cacheKey)
5653
- ? (openBlock(), createElementBlock("div", _hoisted_11$1, _cache[13] || (_cache[13] = [
5695
+ (loading.value === 'loading' && !__props.cacheKey)
5696
+ ? (openBlock(), createElementBlock("div", _hoisted_11$1, [...(_cache[10] || (_cache[10] = [
5654
5697
  createElementVNode("div", {
5655
5698
  class: "spinner-border",
5656
5699
  role: "status"
5657
5700
  }, [
5658
5701
  createElementVNode("span", { class: "visually-hidden" }, "Loading...")
5659
- ], -1 /* HOISTED */)
5660
- ])))
5661
- : (_ctx.loading === 'error' && !__props.cacheKey)
5702
+ ], -1 /* CACHED */)
5703
+ ]))]))
5704
+ : (loading.value === 'error' && !__props.cacheKey)
5662
5705
  ? (openBlock(), createElementBlock("div", _hoisted_12$1, [
5663
- createElementVNode("span", null, toDisplayString(_ctx.loading_error), 1 /* TEXT */)
5706
+ createElementVNode("span", null, toDisplayString(loading_error.value), 1 /* TEXT */)
5664
5707
  ]))
5665
5708
  : createCommentVNode("v-if", true),
5666
- (_ctx.loading === 'done' || __props.cacheKey)
5709
+ (loading.value === 'done' || __props.cacheKey)
5667
5710
  ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
5668
- (!_ctx.records || _ctx.records.length === 0)
5711
+ (!records.value || records.value.length === 0)
5669
5712
  ? (openBlock(), createBlock(resolveDynamicComponent(unref(noRecordsComponent)), { key: 0 }, {
5670
5713
  default: withCtx(() => [
5671
- _cache[14] || (_cache[14] = createElementVNode("i", { class: "bi-info-circle" }, null, -1 /* HOISTED */)),
5714
+ _cache[11] || (_cache[11] = createElementVNode("i", { class: "bi-info-circle" }, null, -1 /* CACHED */)),
5672
5715
  createTextVNode(" " + toDisplayString(__props.noRecordsMessage ?? 'No records found'), 1 /* TEXT */)
5673
5716
  ]),
5674
5717
  _: 1 /* STABLE */
5675
5718
  }))
5676
5719
  : createCommentVNode("v-if", true),
5677
- renderSlot(_ctx.$slots, "records", { records: _ctx.records })
5720
+ renderSlot(_ctx.$slots, "records", { records: records.value })
5678
5721
  ], 64 /* STABLE_FRAGMENT */))
5679
5722
  : createCommentVNode("v-if", true)
5680
5723
  ], 64 /* STABLE_FRAGMENT */))
5681
- : (_ctx.windowWidth > 700 || __props.disableMobileResponsive)
5724
+ : (windowWidth.value > 700 || __props.disableMobileResponsive)
5682
5725
  ? (openBlock(), createElementBlock("table", {
5683
5726
  key: 4,
5684
5727
  class: normalizeClass(["table sh-table", __props.tableHover ? 'table-hover':''])
5685
5728
  }, [
5686
5729
  createElementVNode("thead", _hoisted_13$1, [
5687
5730
  createElementVNode("tr", null, [
5688
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.tableHeaders, (title) => {
5731
+ (openBlock(true), createElementBlock(Fragment, null, renderList(tableHeaders.value, (title) => {
5689
5732
  return (openBlock(), createElementBlock(Fragment, { key: title }, [
5690
5733
  (showColumn(title))
5691
5734
  ? (openBlock(), createElementBlock("th", _hoisted_14$1, [
@@ -5693,26 +5736,26 @@ return (_ctx, _cache) => {
5693
5736
  ? (openBlock(), createElementBlock("a", {
5694
5737
  key: 0,
5695
5738
  class: "text-capitalize",
5696
- onClick: $event => (_ctx.changeKey('order_by',title))
5739
+ onClick: $event => (changeKey('order_by', title))
5697
5740
  }, toDisplayString(title.replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_15$1))
5698
5741
  : (typeof title === 'object')
5699
5742
  ? (openBlock(), createElementBlock("a", {
5700
5743
  key: 1,
5701
5744
  class: "text-capitalize",
5702
- onClick: $event => (_ctx.changeKey('order_by',title.key))
5745
+ onClick: $event => (changeKey('order_by', title.key))
5703
5746
  }, toDisplayString(title.label ?? title.key.replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_16))
5704
5747
  : (typeof title === 'function')
5705
5748
  ? (openBlock(), createElementBlock("a", {
5706
5749
  key: 2,
5707
5750
  class: "text-capitalize",
5708
- onClick: $event => (_ctx.changeKey('order_by',title(null)))
5751
+ onClick: $event => (changeKey('order_by', title(null)))
5709
5752
  }, toDisplayString(title(null).replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_17))
5710
5753
  : (typeof title !== 'undefined')
5711
5754
  ? (openBlock(), createElementBlock("a", {
5712
5755
  key: 3,
5713
5756
  class: "text-capitalize",
5714
- onClick: $event => (_ctx.changeKey('order_by',title))
5715
- }, toDisplayString(title.replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_18))
5757
+ onClick: $event => (changeKey('order_by', title))
5758
+ }, toDisplayString(String(title).replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_18))
5716
5759
  : createCommentVNode("v-if", true)
5717
5760
  ]))
5718
5761
  : createCommentVNode("v-if", true)
@@ -5724,11 +5767,11 @@ return (_ctx, _cache) => {
5724
5767
  ])
5725
5768
  ]),
5726
5769
  createElementVNode("tbody", _hoisted_20, [
5727
- (_ctx.loading === 'loading')
5770
+ (loading.value === 'loading')
5728
5771
  ? (openBlock(), createElementBlock("tr", _hoisted_21, [
5729
5772
  createElementVNode("td", {
5730
- colspan: _ctx.tableHeaders.length
5731
- }, _cache[15] || (_cache[15] = [
5773
+ colspan: tableHeaders.value.length
5774
+ }, [...(_cache[12] || (_cache[12] = [
5732
5775
  createElementVNode("div", { class: "text-center" }, [
5733
5776
  createElementVNode("div", {
5734
5777
  class: "spinner-border",
@@ -5736,34 +5779,34 @@ return (_ctx, _cache) => {
5736
5779
  }, [
5737
5780
  createElementVNode("span", { class: "visually-hidden" }, "Loading...")
5738
5781
  ])
5739
- ], -1 /* HOISTED */)
5740
- ]), 8 /* PROPS */, _hoisted_22)
5782
+ ], -1 /* CACHED */)
5783
+ ]))], 8 /* PROPS */, _hoisted_22)
5741
5784
  ]))
5742
- : (_ctx.loading === 'error')
5785
+ : (loading.value === 'error')
5743
5786
  ? (openBlock(), createElementBlock("tr", _hoisted_23, [
5744
5787
  createElementVNode("td", {
5745
- colspan: _ctx.tableHeaders.length
5746
- }, toDisplayString(_ctx.loading_error), 9 /* TEXT, PROPS */, _hoisted_24)
5788
+ colspan: tableHeaders.value.length
5789
+ }, toDisplayString(loading_error.value), 9 /* TEXT, PROPS */, _hoisted_24)
5747
5790
  ]))
5748
- : (_ctx.records.length === 0)
5791
+ : (records.value.length === 0)
5749
5792
  ? (openBlock(), createElementBlock("tr", _hoisted_25, [
5750
5793
  createElementVNode("td", {
5751
- colspan: __props.actions ? _ctx.tableHeaders.length + 1 : _ctx.tableHeaders.length
5752
- }, _cache[16] || (_cache[16] = [
5794
+ colspan: __props.actions ? tableHeaders.value.length + 1 : tableHeaders.value.length
5795
+ }, [...(_cache[13] || (_cache[13] = [
5753
5796
  createElementVNode("div", { class: "text-center bg-primary-light px-2 py-1 rounded no_records_div" }, [
5754
5797
  createElementVNode("i", { class: "bi-info-circle" }),
5755
5798
  createTextVNode(" No records found ")
5756
- ], -1 /* HOISTED */)
5757
- ]), 8 /* PROPS */, _hoisted_26)
5799
+ ], -1 /* CACHED */)
5800
+ ]))], 8 /* PROPS */, _hoisted_26)
5758
5801
  ]))
5759
- : (_ctx.loading === 'done')
5760
- ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(_ctx.records, (record, index) => {
5802
+ : (loading.value === 'done')
5803
+ ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(records.value, (record, index) => {
5761
5804
  return (openBlock(), createElementBlock("tr", {
5762
5805
  key: record.id,
5763
5806
  class: normalizeClass(record.class),
5764
- onClick: $event => (_ctx.rowSelected(record))
5807
+ onClick: $event => (rowSelected(record))
5765
5808
  }, [
5766
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.tableHeaders, (key) => {
5809
+ (openBlock(true), createElementBlock(Fragment, null, renderList(tableHeaders.value, (key) => {
5767
5810
  return (openBlock(), createElementBlock(Fragment, { key: key }, [
5768
5811
  (showColumn(key))
5769
5812
  ? (openBlock(), createElementBlock("td", _hoisted_28, [
@@ -5771,16 +5814,16 @@ return (_ctx, _cache) => {
5771
5814
  ? (openBlock(), createBlock(_component_router_link, {
5772
5815
  key: 0,
5773
5816
  target: __props.links[key].target ? '_blank':'',
5774
- to: _ctx.replaceLinkUrl(__props.links[key],record),
5775
- class: normalizeClass(_ctx.getLinkClass(__props.links[key])),
5817
+ to: replaceLinkUrl(__props.links[key], record),
5818
+ class: normalizeClass(getLinkClass(__props.links[key])),
5776
5819
  innerHTML: record[key]
5777
5820
  }, null, 8 /* PROPS */, ["target", "to", "class", "innerHTML"]))
5778
- : (_ctx.getFieldType(key) === 'numeric')
5821
+ : (getFieldType(key) === 'numeric')
5779
5822
  ? (openBlock(), createElementBlock("span", _hoisted_29, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
5780
- : (_ctx.getFieldType(key) === 'money')
5823
+ : (getFieldType(key) === 'money')
5781
5824
  ? (openBlock(), createElementBlock("span", _hoisted_30, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
5782
- : (_ctx.getFieldType(key) === 'date')
5783
- ? (openBlock(), createElementBlock("span", _hoisted_31, toDisplayString(_ctx.formatDate(record[key])), 1 /* TEXT */))
5825
+ : (getFieldType(key) === 'date')
5826
+ ? (openBlock(), createElementBlock("span", _hoisted_31, toDisplayString(formatDate(record[key])), 1 /* TEXT */))
5784
5827
  : (typeof key === 'string')
5785
5828
  ? (openBlock(), createElementBlock("span", {
5786
5829
  key: 4,
@@ -5804,9 +5847,8 @@ return (_ctx, _cache) => {
5804
5847
  : (typeof key === 'object' && key.component)
5805
5848
  ? (openBlock(), createBlock(resolveDynamicComponent(key.component), mergeProps({
5806
5849
  key: 8,
5807
- item: record,
5808
- ref_for: true
5809
- }, cleanColumn(key)), null, 16 /* FULL_PROPS */, ["item"]))
5850
+ item: record
5851
+ }, { ref_for: true }, cleanColumn(key)), null, 16 /* FULL_PROPS */, ["item"]))
5810
5852
  : (typeof key === 'object')
5811
5853
  ? (openBlock(), createElementBlock("span", {
5812
5854
  key: 9,
@@ -5823,10 +5865,10 @@ return (_ctx, _cache) => {
5823
5865
  (__props.actions)
5824
5866
  ? (openBlock(), createElementBlock("td", _hoisted_38, [
5825
5867
  createVNode(script$g, {
5826
- emitAction: _ctx.doEmitAction,
5868
+ emitAction: doEmitAction,
5827
5869
  actions: __props.actions,
5828
5870
  record: record
5829
- }, null, 8 /* PROPS */, ["emitAction", "actions", "record"])
5871
+ }, null, 8 /* PROPS */, ["actions", "record"])
5830
5872
  ]))
5831
5873
  : createCommentVNode("v-if", true)
5832
5874
  ], 10 /* CLASS, PROPS */, _hoisted_27))
@@ -5835,8 +5877,8 @@ return (_ctx, _cache) => {
5835
5877
  ])
5836
5878
  ], 2 /* CLASS */))
5837
5879
  : (openBlock(), createElementBlock("div", _hoisted_39, [
5838
- (_ctx.loading === 'loading')
5839
- ? (openBlock(), createElementBlock("div", _hoisted_40, _cache[17] || (_cache[17] = [
5880
+ (loading.value === 'loading')
5881
+ ? (openBlock(), createElementBlock("div", _hoisted_40, [...(_cache[14] || (_cache[14] = [
5840
5882
  createElementVNode("div", { class: "text-center" }, [
5841
5883
  createElementVNode("div", {
5842
5884
  class: "spinner-border",
@@ -5844,21 +5886,21 @@ return (_ctx, _cache) => {
5844
5886
  }, [
5845
5887
  createElementVNode("span", { class: "visually-hidden" }, "Loading...")
5846
5888
  ])
5847
- ], -1 /* HOISTED */)
5848
- ])))
5849
- : (_ctx.loading === 'error')
5889
+ ], -1 /* CACHED */)
5890
+ ]))]))
5891
+ : (loading.value === 'error')
5850
5892
  ? (openBlock(), createElementBlock("div", _hoisted_41, [
5851
- createElementVNode("span", null, toDisplayString(_ctx.loading_error), 1 /* TEXT */)
5893
+ createElementVNode("span", null, toDisplayString(loading_error.value), 1 /* TEXT */)
5852
5894
  ]))
5853
- : (_ctx.loading === 'done')
5895
+ : (loading.value === 'done')
5854
5896
  ? (openBlock(), createElementBlock("div", _hoisted_42, [
5855
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.records, (record, index) => {
5897
+ (openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (record, index) => {
5856
5898
  return (openBlock(), createElementBlock("div", {
5857
5899
  key: record.id,
5858
5900
  class: "single-mobile-req bg-light p-3",
5859
- onClick: $event => (_ctx.rowSelected(record))
5901
+ onClick: $event => (rowSelected(record))
5860
5902
  }, [
5861
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.tableHeaders, (key) => {
5903
+ (openBlock(true), createElementBlock(Fragment, null, renderList(tableHeaders.value, (key) => {
5862
5904
  return (openBlock(), createElementBlock(Fragment, {
5863
5905
  key: key[0]
5864
5906
  }, [
@@ -5875,17 +5917,17 @@ return (_ctx, _cache) => {
5875
5917
  (typeof key === 'string' && __props.links && __props.links[key])
5876
5918
  ? (openBlock(), createBlock(_component_router_link, {
5877
5919
  key: 0,
5878
- to: _ctx.replaceLinkUrl(__props.links[key],record),
5879
- class: normalizeClass(_ctx.getLinkClass(__props.links[key])),
5920
+ to: replaceLinkUrl(__props.links[key],record),
5921
+ class: normalizeClass(getLinkClass(__props.links[key])),
5880
5922
  innerHTML: record[key]
5881
5923
  }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
5882
- : (_ctx.getFieldType(key) === 'numeric')
5924
+ : (getFieldType(key) === 'numeric')
5883
5925
  ? (openBlock(), createElementBlock("span", _hoisted_48, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
5884
- : (_ctx.getFieldType(key) === 'money')
5926
+ : (getFieldType(key) === 'money')
5885
5927
  ? (openBlock(), createElementBlock("span", _hoisted_49, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
5886
- : (_ctx.getFieldType(key) === 'date')
5887
- ? (openBlock(), createElementBlock("span", _hoisted_50, toDisplayString(_ctx.formatDate(record[key])), 1 /* TEXT */))
5888
- : (typeof key === 'string')
5928
+ : (getFieldType(key) === 'date')
5929
+ ? (openBlock(), createElementBlock("span", _hoisted_50, toDisplayString(formatDate(record[key])), 1 /* TEXT */))
5930
+ : (typeof key === 'string')
5889
5931
  ? (openBlock(), createElementBlock("span", {
5890
5932
  key: 4,
5891
5933
  innerHTML: record[key]
@@ -5903,10 +5945,9 @@ return (_ctx, _cache) => {
5903
5945
  : (typeof key === 'object' && key.component)
5904
5946
  ? (openBlock(), createBlock(resolveDynamicComponent(key.component), mergeProps({
5905
5947
  key: 7,
5906
- item: record,
5907
- ref_for: true
5908
- }, cleanColumn(key)), null, 16 /* FULL_PROPS */, ["item"]))
5909
- : (typeof key === 'object')
5948
+ item: record
5949
+ }, { ref_for: true }, cleanColumn(key)), null, 16 /* FULL_PROPS */, ["item"]))
5950
+ : (typeof key === 'object')
5910
5951
  ? (openBlock(), createElementBlock("span", {
5911
5952
  key: 8,
5912
5953
  innerHTML: record[key.key ?? key.field]
@@ -5914,7 +5955,7 @@ return (_ctx, _cache) => {
5914
5955
  : (typeof key === 'function')
5915
5956
  ? (openBlock(), createElementBlock("span", {
5916
5957
  key: 9,
5917
- innerHTML: key(record, index )
5958
+ innerHTML: key(record, index)
5918
5959
  }, null, 8 /* PROPS */, _hoisted_55))
5919
5960
  : (openBlock(), createElementBlock("span", {
5920
5961
  key: 10,
@@ -5923,16 +5964,16 @@ return (_ctx, _cache) => {
5923
5964
  ])
5924
5965
  ], 64 /* STABLE_FRAGMENT */))
5925
5966
  : createCommentVNode("v-if", true),
5926
- _cache[18] || (_cache[18] = createElementVNode("hr", { class: "my-2" }, null, -1 /* HOISTED */))
5967
+ _cache[15] || (_cache[15] = createElementVNode("hr", { class: "my-2" }, null, -1 /* CACHED */))
5927
5968
  ], 64 /* STABLE_FRAGMENT */))
5928
5969
  }), 128 /* KEYED_FRAGMENT */)),
5929
5970
  (__props.actions)
5930
5971
  ? (openBlock(), createElementBlock("div", _hoisted_57, [
5931
5972
  createVNode(script$g, {
5932
- emitAction: _ctx.doEmitAction,
5973
+ emitAction: doEmitAction,
5933
5974
  actions: __props.actions,
5934
5975
  record: record
5935
- }, null, 8 /* PROPS */, ["emitAction", "actions", "record"])
5976
+ }, null, 8 /* PROPS */, ["actions", "record"])
5936
5977
  ]))
5937
5978
  : createCommentVNode("v-if", true)
5938
5979
  ], 8 /* PROPS */, _hoisted_43))
@@ -5940,17 +5981,17 @@ return (_ctx, _cache) => {
5940
5981
  ]))
5941
5982
  : createCommentVNode("v-if", true)
5942
5983
  ])),
5943
- (_ctx.pagination_data)
5944
- ? (openBlock(), createBlock(script$f, {
5984
+ (pagination_data.value)
5985
+ ? (openBlock(), createBlock(script$e, {
5945
5986
  key: 6,
5946
- onLoadMoreRecords: _ctx.loadMoreRecords,
5987
+ onLoadMoreRecords: loadMoreRecords,
5947
5988
  "hide-load-more": __props.hideLoadMore,
5948
- "per-page": _ctx.per_page,
5989
+ "per-page": per_page.value,
5949
5990
  "hide-count": __props.hideCount,
5950
- pagination_data: _ctx.pagination_data,
5951
- onChangeKey: _ctx.changeKey,
5952
- "pagination-style": _ctx.pageStyle
5953
- }, null, 8 /* PROPS */, ["onLoadMoreRecords", "hide-load-more", "per-page", "hide-count", "pagination_data", "onChangeKey", "pagination-style"]))
5991
+ pagination_data: pagination_data.value,
5992
+ onChangeKey: changeKey,
5993
+ "pagination-style": pageStyle.value
5994
+ }, null, 8 /* PROPS */, ["hide-load-more", "per-page", "hide-count", "pagination_data", "pagination-style"]))
5954
5995
  : createCommentVNode("v-if", true),
5955
5996
  (__props.actions)
5956
5997
  ? (openBlock(true), createElementBlock(Fragment, { key: 7 }, renderList(__props.actions.actions, (action) => {
@@ -5960,23 +6001,22 @@ return (_ctx, _cache) => {
5960
6001
  (action.canvasId)
5961
6002
  ? (openBlock(), createBlock(script$l, {
5962
6003
  key: 0,
5963
- onOffcanvasClosed: _ctx.canvasClosed,
6004
+ onOffcanvasClosed: canvasClosed,
5964
6005
  position: action.canvasPosition,
5965
6006
  "canvas-size": action.canvasSize,
5966
6007
  "canvas-title": action.canvasTitle,
5967
6008
  "canvas-id": action.canvasId
5968
6009
  }, {
5969
6010
  default: withCtx(() => [
5970
- (_ctx.selectedRecord)
6011
+ (selectedRecord.value)
5971
6012
  ? (openBlock(), createBlock(resolveDynamicComponent(action.canvasComponent), mergeProps({
5972
6013
  key: 0,
5973
- onRecordUpdated: _ctx.reloadData,
5974
- ref_for: true
5975
- }, _ctx.cleanCanvasProps(action), { record: _ctx.selectedRecord }), null, 16 /* FULL_PROPS */, ["onRecordUpdated", "record"]))
6014
+ onRecordUpdated: reloadData
6015
+ }, { ref_for: true }, cleanCanvasProps(action), { record: selectedRecord.value }), null, 16 /* FULL_PROPS */, ["record"]))
5976
6016
  : createCommentVNode("v-if", true)
5977
6017
  ]),
5978
6018
  _: 2 /* DYNAMIC */
5979
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onOffcanvasClosed", "position", "canvas-size", "canvas-title", "canvas-id"]))
6019
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["position", "canvas-size", "canvas-title", "canvas-id"]))
5980
6020
  : createCommentVNode("v-if", true)
5981
6021
  ], 64 /* STABLE_FRAGMENT */))
5982
6022
  }), 128 /* KEYED_FRAGMENT */))
@@ -5985,7 +6025,7 @@ return (_ctx, _cache) => {
5985
6025
  }
5986
6026
  }
5987
6027
 
5988
- });
6028
+ };
5989
6029
 
5990
6030
  script$d.__file = "src/lib/components/ShTable.vue";
5991
6031
 
@@ -6259,7 +6299,7 @@ return (_ctx, _cache) => {
6259
6299
  createTextVNode(toDisplayString(tab.label) + " ", 1 /* TEXT */),
6260
6300
  (tab.count || tab.tabCount)
6261
6301
  ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
6262
- _cache[0] || (_cache[0] = createElementVNode("i", { class: "d-none" }, null, -1 /* HOISTED */)),
6302
+ _cache[0] || (_cache[0] = createElementVNode("i", { class: "d-none" }, null, -1 /* CACHED */)),
6263
6303
  createElementVNode("sup", _hoisted_3$4, toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
6264
6304
  ], 64 /* STABLE_FRAGMENT */))
6265
6305
  : createCommentVNode("v-if", true)
@@ -6475,9 +6515,9 @@ return (_ctx, _cache) => {
6475
6515
  return (openBlock(), createElementBlock("div", _hoisted_1$6, [
6476
6516
  createElementVNode("div", _hoisted_2$5, [
6477
6517
  (loadingModules.value)
6478
- ? (openBlock(), createElementBlock("div", _hoisted_3$3, _cache[1] || (_cache[1] = [
6479
- createElementVNode("span", { class: "spinner-grow mx-auto" }, null, -1 /* HOISTED */)
6480
- ])))
6518
+ ? (openBlock(), createElementBlock("div", _hoisted_3$3, [...(_cache[1] || (_cache[1] = [
6519
+ createElementVNode("span", { class: "spinner-grow mx-auto" }, null, -1 /* CACHED */)
6520
+ ]))]))
6481
6521
  : (openBlock(), createElementBlock("ul", _hoisted_4$3, [
6482
6522
  (openBlock(true), createElementBlock(Fragment, null, renderList(modules.value, (module) => {
6483
6523
  return (openBlock(), createElementBlock("li", {
@@ -6534,10 +6574,10 @@ return (_ctx, _cache) => {
6534
6574
  data: {permissions: selectedPermissions.value},
6535
6575
  class: "btn btn-primary d-block"
6536
6576
  }, {
6537
- default: withCtx(() => _cache[2] || (_cache[2] = [
6538
- createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */),
6539
- createTextVNode(" Save")
6540
- ])),
6577
+ default: withCtx(() => [...(_cache[2] || (_cache[2] = [
6578
+ createElementVNode("i", { class: "bi-check" }, null, -1 /* CACHED */),
6579
+ createTextVNode(" Save", -1 /* CACHED */)
6580
+ ]))]),
6541
6581
  _: 1 /* STABLE */
6542
6582
  }, 8 /* PROPS */, ["url", "data"])
6543
6583
  ])
@@ -6923,7 +6963,7 @@ return (_ctx, _cache) => {
6923
6963
  ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
6924
6964
  createVNode(script$4, null, {
6925
6965
  default: withCtx(() => [
6926
- _cache[5] || (_cache[5] = createElementVNode("h5", { class: "card-title" }, "Details", -1 /* HOISTED */)),
6966
+ _cache[5] || (_cache[5] = createElementVNode("h5", { class: "card-title" }, "Details", -1 /* CACHED */)),
6927
6967
  createElementVNode("table", _hoisted_4$2, [
6928
6968
  createElementVNode("tbody", null, [
6929
6969
  (openBlock(), createElementBlock(Fragment, null, renderList(UserdetailsColumns, (column) => {
@@ -6947,10 +6987,10 @@ return (_ctx, _cache) => {
6947
6987
  onSuccess: _cache[0] || (_cache[0] = $event => (detailsUpdated('details'))),
6948
6988
  fields: ['name','email','phone']
6949
6989
  }, {
6950
- default: withCtx(() => _cache[3] || (_cache[3] = [
6951
- createElementVNode("i", { class: "bi-pen" }, null, -1 /* HOISTED */),
6952
- createTextVNode(" Edit Details")
6953
- ])),
6990
+ default: withCtx(() => [...(_cache[3] || (_cache[3] = [
6991
+ createElementVNode("i", { class: "bi-pen" }, null, -1 /* CACHED */),
6992
+ createTextVNode(" Edit Details", -1 /* CACHED */)
6993
+ ]))]),
6954
6994
  _: 1 /* STABLE */
6955
6995
  }, 8 /* PROPS */, ["current-data"]))
6956
6996
  : createCommentVNode("v-if", true),
@@ -6976,10 +7016,10 @@ return (_ctx, _cache) => {
6976
7016
  }
6977
7017
  ]
6978
7018
  }, {
6979
- default: withCtx(() => _cache[4] || (_cache[4] = [
6980
- createElementVNode("i", { class: "bi-key" }, null, -1 /* HOISTED */),
6981
- createTextVNode(" Change Password")
6982
- ])),
7019
+ default: withCtx(() => [...(_cache[4] || (_cache[4] = [
7020
+ createElementVNode("i", { class: "bi-key" }, null, -1 /* CACHED */),
7021
+ createTextVNode(" Change Password", -1 /* CACHED */)
7022
+ ]))]),
6983
7023
  _: 1 /* STABLE */
6984
7024
  }))
6985
7025
  : createCommentVNode("v-if", true)
@@ -7003,13 +7043,13 @@ return (_ctx, _cache) => {
7003
7043
  type: 'file',
7004
7044
  }]
7005
7045
  }, {
7006
- default: withCtx(() => _cache[6] || (_cache[6] = [
7007
- createElementVNode("i", { class: "bi-pen" }, null, -1 /* HOISTED */)
7008
- ])),
7046
+ default: withCtx(() => [...(_cache[6] || (_cache[6] = [
7047
+ createElementVNode("i", { class: "bi-pen" }, null, -1 /* CACHED */)
7048
+ ]))]),
7009
7049
  _: 1 /* STABLE */
7010
7050
  }),
7011
7051
  createElementVNode("div", null, [
7012
- _cache[7] || (_cache[7] = createElementVNode("h5", { class: "card-title" }, "Profile Picture", -1 /* HOISTED */)),
7052
+ _cache[7] || (_cache[7] = createElementVNode("h5", { class: "card-title" }, "Profile Picture", -1 /* CACHED */)),
7013
7053
  createElementVNode("img", {
7014
7054
  src: showProfilePicture(unref(user)?.profile_picture),
7015
7055
  class: "img-fluid",
@@ -7059,7 +7099,7 @@ department.value = dept;
7059
7099
 
7060
7100
  return (_ctx, _cache) => {
7061
7101
  return (openBlock(), createElementBlock(Fragment, null, [
7062
- _cache[2] || (_cache[2] = createElementVNode("h5", null, "Departments", -1 /* HOISTED */)),
7102
+ _cache[2] || (_cache[2] = createElementVNode("h5", null, "Departments", -1 /* CACHED */)),
7063
7103
  createElementVNode("div", _hoisted_1$2, [
7064
7104
  createElementVNode("div", _hoisted_2$2, [
7065
7105
  createElementVNode("a", {
@@ -7068,10 +7108,10 @@ return (_ctx, _cache) => {
7068
7108
  ref: "addDeptBtn",
7069
7109
  href: "#sh_department_modal",
7070
7110
  class: "btn btn-info btn-sm"
7071
- }, _cache[1] || (_cache[1] = [
7072
- createElementVNode("i", { class: "fa fa-plus" }, null, -1 /* HOISTED */),
7073
- createTextVNode(" ADD DEPARTMENT")
7074
- ]), 512 /* NEED_PATCH */),
7111
+ }, [...(_cache[1] || (_cache[1] = [
7112
+ createElementVNode("i", { class: "fa fa-plus" }, null, -1 /* CACHED */),
7113
+ createTextVNode(" ADD DEPARTMENT", -1 /* CACHED */)
7114
+ ]))], 512 /* NEED_PATCH */),
7075
7115
  createVNode(script$d, {
7076
7116
  reload: unref(reload),
7077
7117
  headers: ['id','name','description', 'created_at'],
@@ -7228,7 +7268,7 @@ return (_ctx, _cache) => {
7228
7268
  }, [
7229
7269
  createElementVNode("i", { class: "bi-plus" }),
7230
7270
  createTextVNode(" ADD Module")
7231
- ], -1 /* HOISTED */)),
7271
+ ], -1 /* CACHED */)),
7232
7272
  createElementVNode("h5", null, "Department #" + toDisplayString(unref(department).id) + " - " + toDisplayString(unref(department).name) + " Allowed Modules", 1 /* TEXT */),
7233
7273
  createVNode(script$d, {
7234
7274
  actions: {
@@ -7308,10 +7348,10 @@ return (_ctx, _cache) => {
7308
7348
  createElementVNode("button", {
7309
7349
  onClick: submitPermissions,
7310
7350
  class: "btn btn-info"
7311
- }, _cache[1] || (_cache[1] = [
7312
- createElementVNode("i", { class: "fa fa-save" }, null, -1 /* HOISTED */),
7313
- createTextVNode(" Submit")
7314
- ]))
7351
+ }, [...(_cache[1] || (_cache[1] = [
7352
+ createElementVNode("i", { class: "fa fa-save" }, null, -1 /* CACHED */),
7353
+ createTextVNode(" Submit", -1 /* CACHED */)
7354
+ ]))])
7315
7355
  ], 64 /* STABLE_FRAGMENT */))
7316
7356
  : createCommentVNode("v-if", true)
7317
7357
  ]),
@@ -7404,7 +7444,7 @@ const forgotSuccessful = ()=>{
7404
7444
  return (_ctx, _cache) => {
7405
7445
  return (unref(user))
7406
7446
  ? (openBlock(), createElementBlock("div", _hoisted_1, [
7407
- _cache[4] || (_cache[4] = createTextVNode("You are signed is as ")),
7447
+ _cache[4] || (_cache[4] = createTextVNode("You are signed is as ", -1 /* CACHED */)),
7408
7448
  createElementVNode("strong", null, toDisplayString(unref(user).name), 1 /* TEXT */)
7409
7449
  ]))
7410
7450
  : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
@@ -7421,10 +7461,10 @@ return (_ctx, _cache) => {
7421
7461
  createElementVNode("strong", {
7422
7462
  onClick: _cache[0] || (_cache[0] = $event => (goToSection('login'))),
7423
7463
  class: "sh-register-link text-primary"
7424
- }, _cache[5] || (_cache[5] = [
7425
- createElementVNode("i", { class: "bi bi-arrow-left" }, null, -1 /* HOISTED */),
7426
- createTextVNode(" Back to Login ")
7427
- ]))
7464
+ }, [...(_cache[5] || (_cache[5] = [
7465
+ createElementVNode("i", { class: "bi bi-arrow-left" }, null, -1 /* CACHED */),
7466
+ createTextVNode(" Back to Login ", -1 /* CACHED */)
7467
+ ]))])
7428
7468
  ])
7429
7469
  ]))
7430
7470
  : createCommentVNode("v-if", true),
@@ -7445,7 +7485,7 @@ return (_ctx, _cache) => {
7445
7485
  class: "sh-forgot-link text-primary",
7446
7486
  onClick: _cache[1] || (_cache[1] = $event => (goToSection('forgot')))
7447
7487
  }, "Forgotten password?"),
7448
- _cache[6] || (_cache[6] = createElementVNode("strong", { class: "bi-dot" }, null, -1 /* HOISTED */)),
7488
+ _cache[6] || (_cache[6] = createElementVNode("strong", { class: "bi-dot" }, null, -1 /* CACHED */)),
7449
7489
  createElementVNode("strong", {
7450
7490
  onClick: _cache[2] || (_cache[2] = $event => (goToSection('register'))),
7451
7491
  class: "sh-register-link text-primary"
@@ -7687,4 +7727,4 @@ const useShFetch = (url, path, cacheKey) => {
7687
7727
  }
7688
7728
  };
7689
7729
 
7690
- export { countries as Countries, script$8 as ManagePermissions, script$q as ShAutoForm, script$l as ShCanvas, script$9 as ShCanvasBtn, script$4 as ShCardLayout, script$j as ShConfirmAction, script$o as ShDropDownForm, script$b as ShDynamicTabs, script$y as ShForm, ShFrontend, script$p as ShModal, script$a as ShModalBtn, script$n as ShModalForm, script$m as ShModalFormAuto, script$A as ShPhone, script$5 as ShQueryPopups, script$e as ShRange, script$7 as ShRoutePopups, script$i as ShSilentAction, script$z as ShSuggest, script$d as ShTable, script$c as ShTabs, shApis, shGql, shRepo, shStorage, useAppStore, useShFetch, useUserStore };
7730
+ export { countries as Countries, script$8 as ManagePermissions, script$q as ShAutoForm, script$l as ShCanvas, script$9 as ShCanvasBtn, script$4 as ShCardLayout, script$j as ShConfirmAction, script$o as ShDropDownForm, script$b as ShDynamicTabs, script$y as ShForm, ShFrontend, script$p as ShModal, script$a as ShModalBtn, script$n as ShModalForm, script$m as ShModalFormAuto, script$A as ShPhone, script$5 as ShQueryPopups, script$f as ShRange, script$7 as ShRoutePopups, script$i as ShSilentAction, script$z as ShSuggest, script$d as ShTable, script$c as ShTabs, shApis, shGql, shRepo, shStorage, useAppStore, useShFetch, useUserStore };