@iankibetsh/shframework 2.0.4 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/library.mjs CHANGED
@@ -1981,7 +1981,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
1981
1981
  [vModelSelect, $data.selectedCountry]
1982
1982
  ]),
1983
1983
  withDirectives(createElementVNode("input", {
1984
- type: "text",
1984
+ type: "number",
1985
1985
  class: "phone-number",
1986
1986
  "data-cy": "phone_input",
1987
1987
  onInput: _cache[2] || (_cache[2] = (...args) => ($options.updateValue && $options.updateValue(...args))),
@@ -2505,7 +2505,7 @@ const _hoisted_7$6 = { class: "row" };
2505
2505
  const _hoisted_8$5 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
2506
2506
  const _hoisted_9$5 = { class: "col-md-12" };
2507
2507
  const _hoisted_10$4 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
2508
- const _hoisted_11$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2508
+ const _hoisted_11$4 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2509
2509
  const _hoisted_12$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2510
2510
  const _hoisted_13$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2511
2511
  const _hoisted_14$3 = ["data-cy", "name", "onFocus", "onUpdate:modelValue"];
@@ -2612,7 +2612,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2612
2612
  class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2613
2613
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2614
2614
  type: "number"
2615
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11$3)), [
2615
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11$4)), [
2616
2616
  [vModelText, _ctx.form_elements[field]]
2617
2617
  ])
2618
2618
  : createCommentVNode("v-if", true),
@@ -3070,7 +3070,7 @@ var script$l = {
3070
3070
  'emails',
3071
3071
  'phones','numbers','selects','dates','gqlMutation'
3072
3072
  ],
3073
- emits: ['success'],
3073
+ emits: ['success','fieldChanged','formSubmitted','formError'],
3074
3074
  setup(__props, { emit }) {
3075
3075
 
3076
3076
  const props = __props;
@@ -3144,7 +3144,10 @@ const getComponentClass = field => validationErrors.value[field] ? getElementCla
3144
3144
  const getHelperText = field => (props.helperTexts && props.helperTexts[field]) ? props.helperTexts[field]:false;
3145
3145
  const getElementClass = section => (props.formClasses && props.formClasses[section]) ? props.formClasses[section]:shFormElementClasses.value[section] ?? _.snakeCase(section).replace(/_/gi,'-');
3146
3146
  const getPlaceholder = field => (props.placeHolders && props.placeHolders[field]) && props.placeHolders[field];
3147
- const removeValidationError = field => delete validationErrors.value[field];
3147
+ const fieldChanged = field => {
3148
+ delete validationErrors.value[field];
3149
+ emit('fieldChanged', field, formFields.value.filter(f=>f.field === field)[0].value);
3150
+ };
3148
3151
  const getComponentProps = field => {
3149
3152
  const newField = {...field};
3150
3153
  delete newField.component;
@@ -3293,8 +3296,8 @@ return (_ctx, _cache) => {
3293
3296
  : createCommentVNode("v-if", true),
3294
3297
  (openBlock(), createBlock(resolveDynamicComponent(getFieldComponent(field)), mergeProps(getComponentProps(field), {
3295
3298
  isInvalid: typeof validationErrors.value[field.field] !== 'undefined',
3296
- onClick: $event => (removeValidationError(field.field)),
3297
- "onUpdate:modelValue": [$event => (removeValidationError(field.field)), $event => ((formFields.value[index].value) = $event)],
3299
+ onClick: $event => (fieldChanged(field.field)),
3300
+ "onUpdate:modelValue": [$event => (fieldChanged(field.field)), $event => ((formFields.value[index].value) = $event)],
3298
3301
  modelValue: formFields.value[index].value,
3299
3302
  class: getComponentClass(field.field)
3300
3303
  }), null, 16 /* FULL_PROPS */, ["isInvalid", "onClick", "onUpdate:modelValue", "modelValue", "class"])),
@@ -3421,19 +3424,28 @@ const _hoisted_5$6 = /*#__PURE__*/createElementVNode("button", {
3421
3424
  const _hoisted_6$5 = { class: "modal-body" };
3422
3425
  const _hoisted_7$4 = { class: "section" };
3423
3426
 
3427
+
3424
3428
  var script$j = {
3425
3429
  __name: 'ShModal',
3426
3430
  props: {
3427
- modalId: {
3428
- required: true,
3429
- type: String
3430
- },
3431
- modalTitle: {
3432
- type: String
3433
- },
3434
- modalSize: {
3435
- type: String
3436
- }
3431
+ modalId: {
3432
+ required: true,
3433
+ type: String
3434
+ },
3435
+ modalTitle: {
3436
+ type: String
3437
+ },
3438
+ modalSize: {
3439
+ type: String
3440
+ },
3441
+ Static: {
3442
+ type: Boolean,
3443
+ default: false
3444
+ },
3445
+ bsKeyboard: {
3446
+ type: Boolean,
3447
+ default: true
3448
+ }
3437
3449
  },
3438
3450
  emits: ['modalClosed'],
3439
3451
  setup(__props, { emit }) {
@@ -3442,11 +3454,11 @@ const props = __props;
3442
3454
 
3443
3455
 
3444
3456
 
3445
- onMounted(()=>{
3446
- const modal = document.getElementById(props.modalId);
3447
- modal.addEventListener('hidden.bs.modal', event => {
3448
- event.target.id == props.modalId && emit('modalClosed');
3449
- });
3457
+ onMounted(() => {
3458
+ const modal = document.getElementById(props.modalId);
3459
+ modal.addEventListener('hidden.bs.modal', event => {
3460
+ event.target.id == props.modalId && emit('modalClosed');
3461
+ });
3450
3462
  });
3451
3463
 
3452
3464
  return (_ctx, _cache) => {
@@ -3751,7 +3763,7 @@ const _hoisted_9$4 = [
3751
3763
  _hoisted_4$7
3752
3764
  ];
3753
3765
  const _hoisted_10$3 = { class: "record_counts" };
3754
- const _hoisted_11$2 = {
3766
+ const _hoisted_11$3 = {
3755
3767
  key: 0,
3756
3768
  "aria-label": "Page navigation"
3757
3769
  };
@@ -3807,7 +3819,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3807
3819
  createElementVNode("span", _hoisted_10$3, " of " + toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
3808
3820
  ]),
3809
3821
  ($props.pagination_data != null)
3810
- ? (openBlock(), createElementBlock("nav", _hoisted_11$2, [
3822
+ ? (openBlock(), createElementBlock("nav", _hoisted_11$3, [
3811
3823
  createElementVNode("ul", _hoisted_12$2, [
3812
3824
  createElementVNode("li", {
3813
3825
  class: normalizeClass([$options.getActivePage === 1 ? 'disabled' : '' , "page-item"])
@@ -4067,302 +4079,515 @@ return (_ctx, _cache) => {
4067
4079
 
4068
4080
  script$d.__file = "src/lib/components/ShSilentAction.vue";
4069
4081
 
4082
+ const _hoisted_1$9 = { class: "sh-range" };
4083
+ const _hoisted_2$6 = { class: "dropdown" };
4084
+ const _hoisted_3$6 = {
4085
+ class: "form-control dropdown-toggle",
4086
+ href: "#",
4087
+ role: "button",
4088
+ id: "dropdownMenuLink",
4089
+ "data-bs-toggle": "dropdown",
4090
+ "aria-expanded": "false"
4091
+ };
4092
+ const _hoisted_4$6 = /*#__PURE__*/createElementVNode("i", { class: "bi-calendar text-dark" }, null, -1 /* HOISTED */);
4093
+ const _hoisted_5$5 = ["innerHTML"];
4094
+ const _hoisted_6$4 = {
4095
+ class: "dropdown-menu sh-range-dropdown",
4096
+ "aria-labelledby": "dropdownMenuLink"
4097
+ };
4098
+ const _hoisted_7$3 = { class: "sh-range-preset" };
4099
+ const _hoisted_8$3 = ["onClick"];
4100
+ const _hoisted_9$3 = { class: "border-top" };
4101
+ const _hoisted_10$2 = { class: "dropdown-item d-flex flex-column" };
4102
+ const _hoisted_11$2 = /*#__PURE__*/createElementVNode("span", null, "Custom", -1 /* HOISTED */);
4103
+
4104
+
4105
+
4070
4106
  var script$c = {
4071
- name: 'sh-table',
4072
- props: ['endPoint', 'headers','query', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover', 'hideIds', 'paginationStyle'],
4073
- inject: ['channel'],
4074
- data () {
4075
- return {
4076
- order_by: '',
4077
- order_method: '',
4078
- per_page: shRepo.getShConfig('tablePerPage',10),
4079
- page: 1,
4080
- filter_value: '',
4081
- loading: 'loading',
4082
- loading_error: '',
4083
- records: [],
4084
- total: 0,
4085
- pagination_data: null,
4086
- moreDetailsId: null,
4087
- moreDetailsModel: null,
4088
- downloading: false,
4089
- appUrl: window.VITE_APP_API_URL,
4090
- hasCanvas: 0,
4091
- selectedRecord: null,
4092
- timeOut: null,
4093
- tableHeaders: [],
4094
- pageStyle: this.paginationStyle ?? shRepo.getShConfig('tablePaginationStyle','loadMore')
4095
- }
4107
+ __name: 'ShRange',
4108
+ props: {
4109
+ start: {
4110
+ type: Number,
4111
+ default: 2021
4096
4112
  },
4097
- mounted () {
4098
- if(this.headers){
4099
- this.tableHeaders = this.headers;
4100
- }
4101
- if (this.event) ;
4102
- if (this.actions && this.actions.actions) {
4103
- this.actions.actions.forEach(action => {
4104
- if (action.canvasComponent) {
4105
- this.hasCanvas = true;
4106
- }
4107
- });
4108
- }
4113
+ selected: {
4114
+ type: String,
4115
+ default: shRepo.getShConfig('defaultRange', 'This Month')
4116
+ }
4117
+ },
4118
+ emits: ['rangeSelected'],
4119
+ setup(__props, { emit }) {
4120
+
4121
+ const props = __props;
4122
+
4123
+
4124
+
4125
+
4126
+
4127
+ const selectedDate = ref(null);
4128
+ const rangeLabel = ref(null);
4129
+ ref(false);
4130
+ const customFrom = ref(null);
4131
+ const customTo = ref(null);
4132
+
4133
+ const applyCustom = ()=>{
4134
+ const date = [moment(customFrom.value),moment(customTo.value)];
4135
+ setDate(date,'Custom');
4136
+ };
4137
+
4138
+ const dates = ref([
4139
+ {
4140
+ label: 'Today',
4141
+ value: [moment(), moment()]
4109
4142
  },
4110
- methods: {
4111
- userTyping: function(){
4112
- if (this.timeOut){
4113
- clearTimeout(this.timeOut);
4114
- }
4115
- const self = this;
4116
- this.timeOut = setTimeout(()=>{
4117
- self.reloadData(1);
4118
- },800);
4119
- },
4120
- cleanCanvasProps: function (actions) {
4121
- let replaced = actions;
4122
- replaced.class = null;
4123
- return replaced
4124
- },
4125
- newRecordAdded: function (ev) {
4126
- const record = ev.log;
4127
- if (record.user) {
4128
- record.user = record.user.name;
4129
- }
4130
- this.records.unshift(record);
4131
- },
4132
- canvasClosed: function () {
4133
- this.selectedRecord = null;
4134
- },
4135
- rowSelected: function (row) {
4136
- this.selectedRecord = null;
4137
- setTimeout(() => {
4138
- this.selectedRecord = row;
4139
- this.$emit('rowSelected', row);
4140
- }, 100);
4141
- },
4142
- changeKey: function (key, value) {
4143
- this[key] = value;
4144
- if (key === 'order_by') {
4145
- this.order_method = (this.order_method === 'desc') ? 'asc' : 'desc';
4146
- }
4147
- if (key === 'per_page') {
4148
- this.page = 1;
4149
- }
4150
- this.reloadData();
4151
- },
4152
- getLinkClass: function (config) {
4153
- if (typeof config === 'object') {
4154
- return config.class
4155
- }
4156
- return ''
4157
- },
4158
- reloadNotifications: function () {
4159
- this.reloadData();
4143
+ {
4144
+ label: 'Yesterday',
4145
+ value: [moment().subtract(1, 'days'), moment()]
4146
+ },
4147
+ {
4148
+ label: '7 Days',
4149
+ value: [moment().subtract(7, 'days'), moment()]
4150
+ },
4151
+ {
4152
+ label: 'This week',
4153
+ value: [moment().subtract(1, 'week').startOf('week'), moment().subtract(1, 'week').endOf('week')]
4154
+ },
4155
+ {
4156
+ label: 'This Month',
4157
+ value: [moment().startOf('month'), moment()]
4158
+ },
4159
+ {
4160
+ label: 'Last Month',
4161
+ value: [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
4162
+ },
4163
+ {
4164
+ label: 'Last 30 days',
4165
+ value: [moment().subtract(30, 'days'), moment()]
4166
+ },
4167
+ {
4168
+ label: 'Last 60 days',
4169
+ value: [moment().subtract(60, 'days'), moment()]
4170
+ },
4171
+ {
4172
+ label: 'Last 90 days',
4173
+ value: [moment().subtract(90, 'days'), moment()]
4174
+ },
4175
+ {
4176
+ label: 'This Year',
4177
+ value: [moment().startOf('year'), moment()]
4160
4178
  },
4161
- replaceActionUrl: function (path, obj) {
4162
- if (path) {
4163
- var matches = path.match(/\{(.*?)\}/g);
4164
- try {
4165
- matches.forEach(key => {
4166
- key = key.replace('{', '');
4167
- key = key.replace('}', '');
4168
- path = path.replace(`{${key}}`, obj[key]);
4169
- });
4170
- return path
4171
- } catch (e) {
4172
- return path
4179
+ {
4180
+ label: '1 Year',
4181
+ value: [moment().subtract(12, 'months'), moment()]
4182
+ },
4183
+ {
4184
+ label: 'All Time',
4185
+ value: [moment('@/2021').startOf('year'), moment()]
4186
+ }
4187
+ ]);
4188
+ const setDate = (date, label) => {
4189
+ selectedDate.value = date;
4190
+ rangeLabel.value = '<strong>' + label + '</strong><small>(' + date[0].format('MMMM D, YYYY') + ' - ' + date[1].format('MMMM D, YYYY') + ')</small>';
4191
+ const from = date[0];
4192
+ const to = date[1];
4193
+ const period = label.toString().toLowerCase().replaceAll(' ','_');
4194
+ emit('rangeSelected', {
4195
+ from: from,
4196
+ to: to,
4197
+ period: period,
4198
+ query: `from=${from.format('L')}&to=${to.format('L')}&period=${period}`
4199
+ });
4200
+ };
4201
+ onMounted(() => {
4202
+ let end = parseInt(moment().format('Y'));
4203
+ while (end >= props.start) {
4204
+ dates.value.push({
4205
+ label: end,
4206
+ value: [moment('@/' + end).startOf('year'), moment('@/' + end).endOf('year')]
4207
+ });
4208
+ end--;
4209
+ }
4210
+
4211
+ dates.value.map(date=>{
4212
+ (`${date.label}`.toLowerCase() === props.selected.toLowerCase()) && setDate(date.value, date.label);
4213
+ });
4214
+ });
4215
+
4216
+ return (_ctx, _cache) => {
4217
+ return (openBlock(), createElementBlock("div", _hoisted_1$9, [
4218
+ createElementVNode("div", _hoisted_2$6, [
4219
+ createElementVNode("div", _hoisted_3$6, [
4220
+ _hoisted_4$6,
4221
+ createTextVNode(),
4222
+ createElementVNode("span", { innerHTML: rangeLabel.value }, null, 8 /* PROPS */, _hoisted_5$5)
4223
+ ]),
4224
+ createElementVNode("div", _hoisted_6$4, [
4225
+ createElementVNode("ul", _hoisted_7$3, [
4226
+ (openBlock(true), createElementBlock(Fragment, null, renderList(dates.value, (date) => {
4227
+ return (openBlock(), createElementBlock("li", {
4228
+ key: date.label,
4229
+ onClick: $event => (setDate(date.value, date.label))
4230
+ }, [
4231
+ createElementVNode("a", {
4232
+ class: normalizeClass(["dropdown-item", date.value === selectedDate.value ? 'active' : '']),
4233
+ href: "#"
4234
+ }, toDisplayString(date.label), 3 /* TEXT, CLASS */)
4235
+ ], 8 /* PROPS */, _hoisted_8$3))
4236
+ }), 128 /* KEYED_FRAGMENT */))
4237
+ ]),
4238
+ createElementVNode("ul", null, [
4239
+ createElementVNode("li", _hoisted_9$3, [
4240
+ createElementVNode("div", _hoisted_10$2, [
4241
+ _hoisted_11$2,
4242
+ createElementVNode("div", null, [
4243
+ withDirectives(createElementVNode("input", {
4244
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((customFrom).value = $event)),
4245
+ type: "date"
4246
+ }, null, 512 /* NEED_PATCH */), [
4247
+ [vModelText, customFrom.value]
4248
+ ]),
4249
+ withDirectives(createElementVNode("input", {
4250
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((customTo).value = $event)),
4251
+ type: "date"
4252
+ }, null, 512 /* NEED_PATCH */), [
4253
+ [vModelText, customTo.value]
4254
+ ])
4255
+ ]),
4256
+ (customFrom.value && customTo.value)
4257
+ ? (openBlock(), createElementBlock("button", {
4258
+ key: 0,
4259
+ class: "btn btn-sm btn-info mt-1",
4260
+ onClick: applyCustom
4261
+ }, "Apply"))
4262
+ : createCommentVNode("v-if", true)
4263
+ ])
4264
+ ])
4265
+ ])
4266
+ ])
4267
+ ])
4268
+ ]))
4269
+ }
4270
+ }
4271
+
4272
+ };
4273
+
4274
+ script$c.__file = "src/lib/components/ShRange.vue";
4275
+
4276
+ var script$b = {
4277
+ name: 'sh-table',
4278
+ props: ['endPoint', 'headers', 'query', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover', 'hideIds', 'paginationStyle', 'hasRange'],
4279
+ inject: ['channel'],
4280
+ data() {
4281
+ return {
4282
+ order_by: '',
4283
+ order_method: '',
4284
+ per_page: shRepo.getShConfig('tablePerPage', 10),
4285
+ page: 1,
4286
+ filter_value: '',
4287
+ loading: 'loading',
4288
+ loading_error: '',
4289
+ records: [],
4290
+ total: 0,
4291
+ pagination_data: null,
4292
+ moreDetailsId: null,
4293
+ moreDetailsModel: null,
4294
+ downloading: false,
4295
+ appUrl: window.VITE_APP_API_URL,
4296
+ hasCanvas: 0,
4297
+ selectedRecord: null,
4298
+ timeOut: null,
4299
+ tableHeaders: [],
4300
+ pageStyle: this.paginationStyle ?? shRepo.getShConfig('tablePaginationStyle', 'loadMore'),
4301
+ range: null,
4302
+ from: null,
4303
+ to: null,
4304
+ period: null
4173
4305
  }
4174
- }
4175
- return ''
4176
- },
4177
- doEmitAction: function (action, data) {
4178
- if (typeof action === 'function') {
4179
- action(data);
4180
- } else {
4181
- this.$emit(action, data);
4182
- }
4183
4306
  },
4184
- getFieldType: function (field) {
4185
- const numbers = ['age', 'interest_rate_pa'];
4186
- const moneys = ['amount', 'paid_amount', 'total_paid', 'total', 'monthly_fee', 'share_cost', 'min_contribution', 'min_membership_contribution'];
4187
- const dates = ['invoice_date', 'free_tier_days', 'updated_at', 'created_at', 'end_time'];
4188
- if (numbers.includes(field)) {
4189
- return 'numeric'
4190
- }
4191
- if (moneys.includes(field)) {
4192
- return 'money'
4193
- }
4194
- if (dates.includes(field)) {
4195
- return 'date'
4196
- }
4197
- return 'string'
4198
- },
4199
- replaceLinkUrl: function (path, obj) {
4200
- if (typeof path === 'object') {
4201
- path = path.link ?? path.url;
4202
- }
4203
- var matches = path.match(/\{(.*?)\}/g);
4204
- matches && matches.forEach(key => {
4205
- key = key.replace('{', '');
4206
- key = key.replace('}', '');
4207
- path = path.replace(`{${key}}`, obj[key]);
4208
- });
4209
- return path
4210
- },
4211
- formatDate: function (date) {
4212
- return moment(date).format('lll')
4213
- },
4214
- setMoreDetailsModel: function (row) {
4215
- this.moreDetailsModel = null;
4216
- this.moreDetailsModel = row;
4217
- },
4218
- loadMoreRecords: function () {
4219
- this.reloadData(this.page + 1, 1);
4220
- },
4221
- exportData: function (template) {
4222
- this.downloading = true;
4223
- const headers = [];
4224
- const fields = this.downloadFields ? this.downloadFields : this.headers;
4225
- fields.forEach(header => {
4226
- if (typeof header === 'string') {
4227
- headers.push(header);
4307
+ mounted() {
4308
+ if (this.headers) {
4309
+ this.tableHeaders = this.headers;
4228
4310
  }
4229
- });
4230
- const data = {
4231
- titles: headers,
4232
- export: 1
4233
- };
4234
- shApis.doPost(this.endPoint, data).then(res => {
4235
- this.downloading = false;
4236
- if (res.data.file) {
4237
- const url = this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name;
4238
- window.location.href = url;
4239
- // window.open('https://facebook.com')
4240
- // window.open(this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name, '_blank').focus()
4311
+ if (this.event) ;
4312
+ if (this.actions && this.actions.actions) {
4313
+ this.actions.actions.forEach(action => {
4314
+ if (action.canvasComponent) {
4315
+ this.hasCanvas = true;
4316
+ }
4317
+ });
4241
4318
  }
4242
- }).catch(reason => {
4243
- this.downloading = false;
4244
- const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText}`;
4245
- shRepo.swalError('Error', error);
4246
- });
4247
4319
  },
4248
- reloadData: function (page, append) {
4249
- if (typeof page !== 'undefined') {
4250
- this.page = page;
4251
- }
4252
- if (!append) {
4253
- this.loading = 'loading';
4254
- }
4255
- const data = {
4256
- order_by: this.order_by,
4257
- order_method: this.order_method,
4258
- per_page: this.per_page,
4259
- page: this.page,
4260
- filter_value: this.filter_value,
4261
- paginated: true
4262
- };
4263
- if (this.pagination_data) {
4264
- this.pagination_data.loading = 1;
4265
- }
4266
- let endPoint = this.endPoint;
4267
- if(!this.endPoint && this.query){
4268
- //send ql query
4269
- endPoint = 'sh-ql';
4270
- data.query = this.query;
4271
- }
4272
- shApis.doGet(endPoint, data).then(req => {
4273
- this.$emit('dataReloaded', this.pagination_data);
4274
- this.loading = 'done';
4275
- const response = req.data.data;
4276
- this.pagination_data = {
4277
- current: response.current_page,
4278
- start: response.from,
4279
- end: response.last_page,
4280
- record_count: response.total,
4281
- per_page: response.per_page,
4282
- loading: 0,
4283
- displayCount: response.total > response.per_page ? response.per_page : response.total
4284
- };
4285
- if(!this.headers && response.total > 0){
4286
- this.tableHeaders = Object.keys(response.data[0]);
4287
- }
4288
- if (append) {
4289
- this.records.push(...response.data);
4290
- let totalShown = response.total > response.per_page ? response.per_page * response.current_page : response.total;
4291
- if (totalShown > response.total) {
4292
- totalShown = response.total;
4293
- }
4294
- this.pagination_data.displayCount = totalShown;
4295
- const scrollingElement = (document.scrollingElement || document.body);
4296
- scrollingElement.scrollTop = scrollingElement.scrollHeight;
4297
- } else {
4298
- this.records = response.data;
4320
+ methods: {
4321
+ rangeChanged: function (newRange) {
4322
+ this.range = newRange;
4323
+ this.from = newRange.from.format('L');
4324
+ this.to = newRange.to.format('L');
4325
+ this.period = newRange.period;
4326
+ this.reloadData();
4327
+ },
4328
+ userTyping: function () {
4329
+ if (this.timeOut) {
4330
+ clearTimeout(this.timeOut);
4331
+ }
4332
+ const self = this;
4333
+ this.timeOut = setTimeout(() => {
4334
+ self.reloadData(1);
4335
+ }, 800);
4336
+ },
4337
+ cleanCanvasProps: function (actions) {
4338
+ let replaced = actions;
4339
+ replaced.class = null;
4340
+ return replaced
4341
+ },
4342
+ newRecordAdded: function (ev) {
4343
+ const record = ev.log;
4344
+ if (record.user) {
4345
+ record.user = record.user.name;
4346
+ }
4347
+ this.records.unshift(record);
4348
+ },
4349
+ canvasClosed: function () {
4350
+ this.selectedRecord = null;
4351
+ },
4352
+ rowSelected: function (row) {
4353
+ this.selectedRecord = null;
4354
+ setTimeout(() => {
4355
+ this.selectedRecord = row;
4356
+ this.$emit('rowSelected', row);
4357
+ }, 100);
4358
+ },
4359
+ changeKey: function (key, value) {
4360
+ this[key] = value;
4361
+ if (key === 'order_by') {
4362
+ this.order_method = (this.order_method === 'desc') ? 'asc' : 'desc';
4363
+ }
4364
+ if (key === 'per_page') {
4365
+ this.page = 1;
4366
+ }
4367
+ this.reloadData();
4368
+ },
4369
+ getLinkClass: function (config) {
4370
+ if (typeof config === 'object') {
4371
+ return config.class
4372
+ }
4373
+ return ''
4374
+ },
4375
+ reloadNotifications: function () {
4376
+ this.reloadData();
4377
+ },
4378
+ replaceActionUrl: function (path, obj) {
4379
+ if (path) {
4380
+ var matches = path.match(/\{(.*?)\}/g);
4381
+ try {
4382
+ matches.forEach(key => {
4383
+ key = key.replace('{', '');
4384
+ key = key.replace('}', '');
4385
+ path = path.replace(`{${key}}`, obj[key]);
4386
+ });
4387
+ return path
4388
+ } catch (e) {
4389
+ return path
4390
+ }
4391
+ }
4392
+ return ''
4393
+ },
4394
+ doEmitAction: function (action, data) {
4395
+ if (typeof action === 'function') {
4396
+ action(data);
4397
+ } else {
4398
+ this.$emit(action, data);
4399
+ }
4400
+ },
4401
+ getFieldType: function (field) {
4402
+ const numbers = ['age', 'interest_rate_pa'];
4403
+ const moneys = ['amount', 'paid_amount', 'total_paid', 'total', 'monthly_fee', 'share_cost', 'min_contribution', 'min_membership_contribution'];
4404
+ const dates = ['invoice_date', 'free_tier_days', 'updated_at', 'created_at', 'end_time'];
4405
+ if (numbers.includes(field)) {
4406
+ return 'numeric'
4407
+ }
4408
+ if (moneys.includes(field)) {
4409
+ return 'money'
4410
+ }
4411
+ if (dates.includes(field)) {
4412
+ return 'date'
4413
+ }
4414
+ return 'string'
4415
+ },
4416
+ replaceLinkUrl: function (path, obj) {
4417
+ if (typeof path === 'object') {
4418
+ path = path.link ?? path.url;
4419
+ }
4420
+ var matches = path.match(/\{(.*?)\}/g);
4421
+ matches && matches.forEach(key => {
4422
+ key = key.replace('{', '');
4423
+ key = key.replace('}', '');
4424
+ path = path.replace(`{${key}}`, obj[key]);
4425
+ });
4426
+ return path
4427
+ },
4428
+ formatDate: function (date) {
4429
+ return moment(date).format('lll')
4430
+ },
4431
+ setMoreDetailsModel: function (row) {
4432
+ this.moreDetailsModel = null;
4433
+ this.moreDetailsModel = row;
4434
+ },
4435
+ loadMoreRecords: function () {
4436
+ this.reloadData(this.page + 1, 1);
4437
+ },
4438
+ exportData: function (template) {
4439
+ this.downloading = true;
4440
+ const headers = [];
4441
+ const fields = this.downloadFields ? this.downloadFields : this.headers;
4442
+ fields.forEach(header => {
4443
+ if (typeof header === 'string') {
4444
+ headers.push(header);
4445
+ }
4446
+ });
4447
+ const data = {
4448
+ titles: headers,
4449
+ export: 1
4450
+ };
4451
+ shApis.doPost(this.endPoint, data).then(res => {
4452
+ this.downloading = false;
4453
+ if (res.data.file) {
4454
+ const url = this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name;
4455
+ window.location.href = url;
4456
+ // window.open('https://facebook.com')
4457
+ // window.open(this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name, '_blank').focus()
4458
+ }
4459
+ }).catch(reason => {
4460
+ this.downloading = false;
4461
+ const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText}`;
4462
+ shRepo.swalError('Error', error);
4463
+ });
4464
+ },
4465
+ reloadData: function (page, append) {
4466
+ if (typeof page !== 'undefined') {
4467
+ this.page = page;
4468
+ }
4469
+ if (!append) {
4470
+ this.loading = 'loading';
4471
+ }
4472
+ const data = {
4473
+ order_by: this.order_by,
4474
+ order_method: this.order_method,
4475
+ per_page: this.per_page,
4476
+ page: this.page,
4477
+ filter_value: this.filter_value,
4478
+ paginated: true,
4479
+ from: this.from,
4480
+ to: this.to,
4481
+ period: this.period
4482
+ };
4483
+ if (this.pagination_data) {
4484
+ this.pagination_data.loading = 1;
4485
+ }
4486
+ let endPoint = this.endPoint;
4487
+ if (!this.endPoint && this.query) {
4488
+ //send ql query
4489
+ endPoint = 'sh-ql';
4490
+ data.query = this.query;
4491
+ }
4492
+ console.log(endPoint, this.range);
4493
+ shApis.doGet(endPoint, data).then(req => {
4494
+ this.$emit('dataReloaded', this.pagination_data);
4495
+ this.loading = 'done';
4496
+ const response = req.data.data;
4497
+ this.pagination_data = {
4498
+ current: response.current_page,
4499
+ start: response.from,
4500
+ end: response.last_page,
4501
+ record_count: response.total,
4502
+ per_page: response.per_page,
4503
+ loading: 0,
4504
+ displayCount: response.total > response.per_page ? response.per_page : response.total
4505
+ };
4506
+ if (!this.headers && response.total > 0) {
4507
+ this.tableHeaders = Object.keys(response.data[0]);
4508
+ }
4509
+ if (append) {
4510
+ this.records.push(...response.data);
4511
+ let totalShown = response.total > response.per_page ? response.per_page * response.current_page : response.total;
4512
+ if (totalShown > response.total) {
4513
+ totalShown = response.total;
4514
+ }
4515
+ this.pagination_data.displayCount = totalShown;
4516
+ const scrollingElement = (document.scrollingElement || document.body);
4517
+ scrollingElement.scrollTop = scrollingElement.scrollHeight;
4518
+ } else {
4519
+ this.records = response.data;
4520
+ }
4521
+ }).catch(reason => {
4522
+ const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText} (${this.endPoint})`;
4523
+ this.loading_error = error;
4524
+ this.loading = 'error';
4525
+ });
4299
4526
  }
4300
- }).catch(reason => {
4301
- const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText} (${this.endPoint})`;
4302
- this.loading_error = error;
4303
- this.loading = 'error';
4304
- });
4305
- }
4306
- },
4307
- watch: {
4308
- hideIds: {
4309
- handler(newValue) {
4310
- this.records = this.records.filter(record => !newValue.includes(record.id) && record);
4311
- },
4312
- deep: true
4313
4527
  },
4314
- reload () {
4315
- this.reloadData();
4316
- },
4317
- endPoint() {
4318
- this.reloadData();
4319
- }
4320
- },
4321
- created () {
4322
- this.reloadData();
4323
- },
4324
- components: {
4325
- ShSilentAction: script$d,
4326
- ShConfirmAction: script$e,
4327
- ShCanvas: script$g,
4328
- pagination: script$f
4329
- },
4330
- computed: {
4331
- windowWidth: function () {
4332
- return window.innerWidth
4528
+ watch: {
4529
+ hideIds: {
4530
+ handler(newValue) {
4531
+ this.records = this.records.filter(record => !newValue.includes(record.id) && record);
4532
+ },
4533
+ deep: true
4534
+ },
4535
+ reload() {
4536
+ this.reloadData();
4537
+ },
4538
+ endPoint() {
4539
+ this.reloadData();
4540
+ }
4333
4541
  },
4334
- user () {
4335
- return null
4542
+ created() {
4543
+ this.reloadData();
4336
4544
  },
4337
- hasDefaultSlot () {
4338
- return !!this.$slots.default
4545
+ components: {
4546
+ ShRange: script$c,
4547
+ ShSilentAction: script$d,
4548
+ ShConfirmAction: script$e,
4549
+ ShCanvas: script$g,
4550
+ pagination: script$f
4339
4551
  },
4340
- hasRecordsSlot () {
4341
- return !!this.$slots.records
4552
+ computed: {
4553
+ windowWidth: function () {
4554
+ return window.innerWidth
4555
+ },
4556
+ user() {
4557
+ return null
4558
+ },
4559
+ hasDefaultSlot() {
4560
+ return !!this.$slots.default
4561
+ },
4562
+ hasRecordsSlot() {
4563
+ return !!this.$slots.records
4564
+ }
4342
4565
  }
4343
- }
4344
4566
  };
4345
4567
 
4346
- const _hoisted_1$9 = { class: "auto-table mt-2" };
4347
- const _hoisted_2$6 = {
4568
+ const _hoisted_1$8 = { class: "auto-table mt-2" };
4569
+ const _hoisted_2$5 = {
4348
4570
  key: 0,
4349
4571
  class: "col-md-4 mb-2"
4350
4572
  };
4351
- const _hoisted_3$6 = ["disabled"];
4352
- const _hoisted_4$6 = /*#__PURE__*/createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */);
4353
- const _hoisted_5$5 = /*#__PURE__*/createElementVNode("span", {
4573
+ const _hoisted_3$5 = ["disabled"];
4574
+ const _hoisted_4$5 = /*#__PURE__*/createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */);
4575
+ const _hoisted_5$4 = /*#__PURE__*/createElementVNode("span", {
4354
4576
  class: "spinner-border spinner-border-sm",
4355
4577
  role: "status",
4356
4578
  "aria-hidden": "true"
4357
4579
  }, null, -1 /* HOISTED */);
4358
- const _hoisted_6$4 = /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* HOISTED */);
4359
- const _hoisted_7$3 = {
4580
+ const _hoisted_6$3 = /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* HOISTED */);
4581
+ const _hoisted_7$2 = {
4360
4582
  key: 1,
4361
4583
  class: "row"
4362
4584
  };
4363
- const _hoisted_8$3 = { class: "col-12 mb-3" };
4364
- const _hoisted_9$3 = { class: "sh-search-bar" };
4365
- const _hoisted_10$2 = ["placeholder"];
4585
+ const _hoisted_8$2 = { class: "col-12 mb-3 d-flex justify-content-start" };
4586
+ const _hoisted_9$2 = {
4587
+ key: 0,
4588
+ class: "sh-range-selector"
4589
+ };
4590
+ const _hoisted_10$1 = ["placeholder"];
4366
4591
  const _hoisted_11$1 = {
4367
4592
  key: 0,
4368
4593
  class: "text-center"
@@ -4500,15 +4725,16 @@ const _hoisted_64 = ["href"];
4500
4725
  const _hoisted_65 = ["title", "onClick"];
4501
4726
 
4502
4727
  function render(_ctx, _cache, $props, $setup, $data, $options) {
4728
+ const _component_sh_range = resolveComponent("sh-range");
4503
4729
  const _component_router_link = resolveComponent("router-link");
4504
4730
  const _component_sh_confirm_action = resolveComponent("sh-confirm-action");
4505
4731
  const _component_sh_silent_action = resolveComponent("sh-silent-action");
4506
4732
  const _component_pagination = resolveComponent("pagination");
4507
4733
  const _component_sh_canvas = resolveComponent("sh-canvas");
4508
4734
 
4509
- return (openBlock(), createElementBlock("div", _hoisted_1$9, [
4735
+ return (openBlock(), createElementBlock("div", _hoisted_1$8, [
4510
4736
  ($props.hasDownload)
4511
- ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
4737
+ ? (openBlock(), createElementBlock("div", _hoisted_2$5, [
4512
4738
  createElementVNode("button", {
4513
4739
  disabled: $data.downloading,
4514
4740
  class: "btn btn-warning btn-sm",
@@ -4516,20 +4742,27 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
4516
4742
  }, [
4517
4743
  (!$data.downloading)
4518
4744
  ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4519
- _hoisted_4$6,
4745
+ _hoisted_4$5,
4520
4746
  createTextVNode(" Export ")
4521
4747
  ], 64 /* STABLE_FRAGMENT */))
4522
4748
  : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
4523
- _hoisted_5$5,
4524
- _hoisted_6$4
4749
+ _hoisted_5$4,
4750
+ _hoisted_6$3
4525
4751
  ], 64 /* STABLE_FRAGMENT */))
4526
- ], 8 /* PROPS */, _hoisted_3$6)
4752
+ ], 8 /* PROPS */, _hoisted_3$5)
4527
4753
  ]))
4528
4754
  : createCommentVNode("v-if", true),
4529
4755
  (!$props.hideSearch)
4530
- ? (openBlock(), createElementBlock("div", _hoisted_7$3, [
4531
- createElementVNode("div", _hoisted_8$3, [
4532
- createElementVNode("div", _hoisted_9$3, [
4756
+ ? (openBlock(), createElementBlock("div", _hoisted_7$2, [
4757
+ createElementVNode("div", _hoisted_8$2, [
4758
+ ($props.hasRange)
4759
+ ? (openBlock(), createElementBlock("div", _hoisted_9$2, [
4760
+ createVNode(_component_sh_range, { onRangeSelected: $options.rangeChanged }, null, 8 /* PROPS */, ["onRangeSelected"])
4761
+ ]))
4762
+ : createCommentVNode("v-if", true),
4763
+ createElementVNode("div", {
4764
+ class: normalizeClass(["sh-search-bar", $props.hasRange ? 'ms-2':''])
4765
+ }, [
4533
4766
  withDirectives(createElementVNode("input", {
4534
4767
  onKeydown: _cache[1] || (_cache[1] = (...args) => ($options.userTyping && $options.userTyping(...args))),
4535
4768
  onKeyup: _cache[2] || (_cache[2] = (...args) => ($options.userTyping && $options.userTyping(...args))),
@@ -4538,10 +4771,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
4538
4771
  "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => (($data.filter_value) = $event)),
4539
4772
  placeholder: $props.searchPlaceholder ? $props.searchPlaceholder : 'Search',
4540
4773
  class: "form-control sh-search-input"
4541
- }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_10$2), [
4774
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_10$1), [
4542
4775
  [vModelText, $data.filter_value]
4543
4776
  ])
4544
- ])
4777
+ ], 2 /* CLASS */)
4545
4778
  ])
4546
4779
  ]))
4547
4780
  : createCommentVNode("v-if", true),
@@ -4959,10 +5192,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
4959
5192
  ]))
4960
5193
  }
4961
5194
 
4962
- script$c.render = render;
4963
- script$c.__file = "src/lib/components/ShTable.vue";
5195
+ script$b.render = render;
5196
+ script$b.__file = "src/lib/components/ShTable.vue";
4964
5197
 
4965
- var script$b = {
5198
+ var script$a = {
4966
5199
  __name: 'ShTabs',
4967
5200
  props: {
4968
5201
  tabs: {
@@ -5107,18 +5340,18 @@ return (_ctx, _cache) => {
5107
5340
 
5108
5341
  };
5109
5342
 
5110
- script$b.__file = "src/lib/components/ShTabs.vue";
5343
+ script$a.__file = "src/lib/components/ShTabs.vue";
5111
5344
 
5112
- const _hoisted_1$8 = {
5345
+ const _hoisted_1$7 = {
5113
5346
  class: "nav-item",
5114
5347
  role: "presentation"
5115
5348
  };
5116
- const _hoisted_2$5 = ["onClick"];
5117
- const _hoisted_3$5 = /*#__PURE__*/createElementVNode("i", { class: "d-none" }, null, -1 /* HOISTED */);
5118
- const _hoisted_4$5 = { class: "sh_tab_count" };
5119
- const _hoisted_5$4 = { class: "tab-content" };
5349
+ const _hoisted_2$4 = ["onClick"];
5350
+ const _hoisted_3$4 = /*#__PURE__*/createElementVNode("i", { class: "d-none" }, null, -1 /* HOISTED */);
5351
+ const _hoisted_4$4 = { class: "sh_tab_count" };
5352
+ const _hoisted_5$3 = { class: "tab-content" };
5120
5353
 
5121
- var script$a = {
5354
+ var script$9 = {
5122
5355
  __name: 'ShDynamicTabs',
5123
5356
  props: ['tabs','data','classes'],
5124
5357
  setup(__props) {
@@ -5148,7 +5381,7 @@ return (_ctx, _cache) => {
5148
5381
  role: "tablist"
5149
5382
  }, [
5150
5383
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(tabs), (tab) => {
5151
- return (openBlock(), createElementBlock("li", _hoisted_1$8, [
5384
+ return (openBlock(), createElementBlock("li", _hoisted_1$7, [
5152
5385
  createElementVNode("button", {
5153
5386
  onClick: $event => (setTab(tab)),
5154
5387
  class: normalizeClass(["nav-link", unref(currentTab) === tab ? 'active':''])
@@ -5156,15 +5389,15 @@ return (_ctx, _cache) => {
5156
5389
  createTextVNode(toDisplayString(tab.label) + " ", 1 /* TEXT */),
5157
5390
  (tab.count || tab.tabCount)
5158
5391
  ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
5159
- _hoisted_3$5,
5160
- createElementVNode("sup", _hoisted_4$5, toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
5392
+ _hoisted_3$4,
5393
+ createElementVNode("sup", _hoisted_4$4, toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
5161
5394
  ], 64 /* STABLE_FRAGMENT */))
5162
5395
  : createCommentVNode("v-if", true)
5163
- ], 10 /* CLASS, PROPS */, _hoisted_2$5)
5396
+ ], 10 /* CLASS, PROPS */, _hoisted_2$4)
5164
5397
  ]))
5165
5398
  }), 256 /* UNKEYED_FRAGMENT */))
5166
5399
  ], 2 /* CLASS */),
5167
- createElementVNode("div", _hoisted_5$4, [
5400
+ createElementVNode("div", _hoisted_5$3, [
5168
5401
  (unref(currentTab))
5169
5402
  ? (openBlock(), createBlock(resolveDynamicComponent(unref(currentTab).component), normalizeProps(mergeProps({ key: 0 }, unref(currentTab))), null, 16 /* FULL_PROPS */))
5170
5403
  : createCommentVNode("v-if", true)
@@ -5175,12 +5408,12 @@ return (_ctx, _cache) => {
5175
5408
 
5176
5409
  };
5177
5410
 
5178
- script$a.__file = "src/lib/components/ShDynamicTabs.vue";
5411
+ script$9.__file = "src/lib/components/ShDynamicTabs.vue";
5179
5412
 
5180
- const _hoisted_1$7 = ["href"];
5413
+ const _hoisted_1$6 = ["href"];
5181
5414
 
5182
5415
 
5183
- var script$9 = {
5416
+ var script$8 = {
5184
5417
  __name: 'ShModalBtn',
5185
5418
  props: {
5186
5419
  modalId: {
@@ -5197,18 +5430,18 @@ return (_ctx, _cache) => {
5197
5430
  "data-bs-toggle": "modal"
5198
5431
  }, [
5199
5432
  renderSlot(_ctx.$slots, "default")
5200
- ], 8 /* PROPS */, _hoisted_1$7))
5433
+ ], 8 /* PROPS */, _hoisted_1$6))
5201
5434
  }
5202
5435
  }
5203
5436
 
5204
5437
  };
5205
5438
 
5206
- script$9.__file = "src/lib/components/ShModalBtn.vue";
5439
+ script$8.__file = "src/lib/components/ShModalBtn.vue";
5207
5440
 
5208
- const _hoisted_1$6 = ["href"];
5441
+ const _hoisted_1$5 = ["href"];
5209
5442
 
5210
5443
 
5211
- var script$8 = {
5444
+ var script$7 = {
5212
5445
  __name: 'ShCanvasBtn',
5213
5446
  props: {
5214
5447
  canvasId: {
@@ -5226,13 +5459,13 @@ return (_ctx, _cache) => {
5226
5459
  "data-bs-toggle": "offcanvas"
5227
5460
  }, [
5228
5461
  renderSlot(_ctx.$slots, "default")
5229
- ], 8 /* PROPS */, _hoisted_1$6))
5462
+ ], 8 /* PROPS */, _hoisted_1$5))
5230
5463
  }
5231
5464
  }
5232
5465
 
5233
5466
  };
5234
5467
 
5235
- script$8.__file = "src/lib/components/ShCanvasBtn.vue";
5468
+ script$7.__file = "src/lib/components/ShCanvasBtn.vue";
5236
5469
 
5237
5470
  const useUserStore = defineStore('user-store', {
5238
5471
  state: () => ({
@@ -5331,30 +5564,30 @@ const useUserStore = defineStore('user-store', {
5331
5564
  });
5332
5565
 
5333
5566
  const _withScopeId$1 = n => (pushScopeId("data-v-0d4fa0ac"),n=n(),popScopeId(),n);
5334
- const _hoisted_1$5 = { class: "row permissions-main d-flex" };
5335
- const _hoisted_2$4 = {
5567
+ const _hoisted_1$4 = { class: "row permissions-main d-flex" };
5568
+ const _hoisted_2$3 = {
5336
5569
  id: "permissions-nav",
5337
5570
  class: "col-md-3 d-flex align-items-center py-4"
5338
5571
  };
5339
- const _hoisted_3$4 = {
5572
+ const _hoisted_3$3 = {
5340
5573
  key: 0,
5341
5574
  class: "mx-auto"
5342
5575
  };
5343
- const _hoisted_4$4 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/createElementVNode("span", { class: "spinner-grow mx-auto" }, null, -1 /* HOISTED */));
5344
- const _hoisted_5$3 = [
5345
- _hoisted_4$4
5576
+ const _hoisted_4$3 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/createElementVNode("span", { class: "spinner-grow mx-auto" }, null, -1 /* HOISTED */));
5577
+ const _hoisted_5$2 = [
5578
+ _hoisted_4$3
5346
5579
  ];
5347
- const _hoisted_6$3 = {
5580
+ const _hoisted_6$2 = {
5348
5581
  key: 1,
5349
5582
  class: "d-flex flex-column w-100 px-2"
5350
5583
  };
5351
- const _hoisted_7$2 = ["checked", "onClick", "disabled"];
5352
- const _hoisted_8$2 = ["onClick"];
5353
- const _hoisted_9$2 = {
5584
+ const _hoisted_7$1 = ["checked", "onClick", "disabled"];
5585
+ const _hoisted_8$1 = ["onClick"];
5586
+ const _hoisted_9$1 = {
5354
5587
  id: "permissions-content",
5355
5588
  class: "col-md-9 py-4 px-4"
5356
5589
  };
5357
- const _hoisted_10$1 = { class: "p-2 rounded-2 bg-white h-100" };
5590
+ const _hoisted_10 = { class: "p-2 rounded-2 bg-white h-100" };
5358
5591
  const _hoisted_11 = {
5359
5592
  key: 0,
5360
5593
  class: "alert alert-info"
@@ -5371,7 +5604,7 @@ const _hoisted_17 = { class: "col-md-3" };
5371
5604
  const _hoisted_18 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5372
5605
 
5373
5606
 
5374
- var script$7 = {
5607
+ var script$6 = {
5375
5608
  __name: 'ManagePermissions',
5376
5609
  emits: ['success'],
5377
5610
  setup(__props, { emit }) {
@@ -5475,11 +5708,11 @@ const getPermissionStyle = permission => {
5475
5708
  };
5476
5709
 
5477
5710
  return (_ctx, _cache) => {
5478
- return (openBlock(), createElementBlock("div", _hoisted_1$5, [
5479
- createElementVNode("div", _hoisted_2$4, [
5711
+ return (openBlock(), createElementBlock("div", _hoisted_1$4, [
5712
+ createElementVNode("div", _hoisted_2$3, [
5480
5713
  (loadingModules.value)
5481
- ? (openBlock(), createElementBlock("div", _hoisted_3$4, _hoisted_5$3))
5482
- : (openBlock(), createElementBlock("ul", _hoisted_6$3, [
5714
+ ? (openBlock(), createElementBlock("div", _hoisted_3$3, _hoisted_5$2))
5715
+ : (openBlock(), createElementBlock("ul", _hoisted_6$2, [
5483
5716
  (openBlock(true), createElementBlock(Fragment, null, renderList(modules.value, (module) => {
5484
5717
  return (openBlock(), createElementBlock("li", {
5485
5718
  class: normalizeClass(selectedModule.value === module && 'active'),
@@ -5490,17 +5723,17 @@ return (_ctx, _cache) => {
5490
5723
  onClick: $event => (checkAllPermissions(module)),
5491
5724
  disabled: selectedModule.value !== module,
5492
5725
  type: "checkbox"
5493
- }, null, 8 /* PROPS */, _hoisted_7$2),
5726
+ }, null, 8 /* PROPS */, _hoisted_7$1),
5494
5727
  createElementVNode("label", {
5495
5728
  class: "text-capitalize",
5496
5729
  onClick: $event => (setModule(module))
5497
- }, toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_8$2)
5730
+ }, toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_8$1)
5498
5731
  ], 2 /* CLASS */))
5499
5732
  }), 128 /* KEYED_FRAGMENT */))
5500
5733
  ]))
5501
5734
  ]),
5502
- createElementVNode("div", _hoisted_9$2, [
5503
- createElementVNode("div", _hoisted_10$1, [
5735
+ createElementVNode("div", _hoisted_9$1, [
5736
+ createElementVNode("div", _hoisted_10, [
5504
5737
  (loading.value)
5505
5738
  ? (openBlock(), createElementBlock("div", _hoisted_11, " loading ... "))
5506
5739
  : (openBlock(), createElementBlock("div", _hoisted_12, [
@@ -5553,13 +5786,13 @@ return (_ctx, _cache) => {
5553
5786
 
5554
5787
  };
5555
5788
 
5556
- script$7.__scopeId = "data-v-0d4fa0ac";
5557
- script$7.__file = "src/lib/components/core/Departments/department/ManagePermissions.vue";
5789
+ script$6.__scopeId = "data-v-0d4fa0ac";
5790
+ script$6.__file = "src/lib/components/core/Departments/department/ManagePermissions.vue";
5558
5791
 
5559
- const _hoisted_1$4 = ["href"];
5792
+ const _hoisted_1$3 = ["href"];
5560
5793
 
5561
5794
 
5562
- var script$6 = {
5795
+ var script$5 = {
5563
5796
  __name: 'ShRoutePopups',
5564
5797
  setup(__props) {
5565
5798
 
@@ -5640,13 +5873,15 @@ return (_ctx, _cache) => {
5640
5873
  href: '#' + unref(canvasId),
5641
5874
  shallowRef: "canvasButton",
5642
5875
  class: "d-none"
5643
- }, "Open Modal", 8 /* PROPS */, _hoisted_1$4),
5876
+ }, "Open Modal", 8 /* PROPS */, _hoisted_1$3),
5644
5877
  (popUp.value === 'modal')
5645
5878
  ? (openBlock(), createBlock(script$j, {
5646
5879
  key: 0,
5647
5880
  "modal-title": title.value,
5648
5881
  "modal-id": unref(modalId),
5649
- "modal-size": size.value
5882
+ "modal-size": size.value,
5883
+ "data-bs-backdrop": "static",
5884
+ "data-bs-keyboard": "false"
5650
5885
  }, {
5651
5886
  default: withCtx(() => [
5652
5887
  (openBlock(), createBlock(resolveDynamicComponent(componentView.value)))
@@ -5674,9 +5909,9 @@ return (_ctx, _cache) => {
5674
5909
 
5675
5910
  };
5676
5911
 
5677
- script$6.__file = "src/lib/components/popups/ShRoutePopups.vue";
5912
+ script$5.__file = "src/lib/components/popups/ShRoutePopups.vue";
5678
5913
 
5679
- var script$5 = {
5914
+ var script$4 = {
5680
5915
  __name: 'ShQueryForm',
5681
5916
  setup(__props) {
5682
5917
 
@@ -5695,9 +5930,9 @@ return (_ctx, _cache) => {
5695
5930
 
5696
5931
  };
5697
5932
 
5698
- script$5.__file = "src/lib/components/ShQueryForm.vue";
5933
+ script$4.__file = "src/lib/components/ShQueryForm.vue";
5699
5934
 
5700
- var script$4 = {
5935
+ var script$3 = {
5701
5936
  __name: 'ShQueryPopups',
5702
5937
  setup(__props) {
5703
5938
 
@@ -5720,7 +5955,7 @@ watch(() => route.query.popup, pop => {
5720
5955
  title.value = route.query.title;
5721
5956
  let queryComponent = route.query.comp ?? route.query.component;
5722
5957
  if(queryComponent && ['shqueryform','queryform'].includes(queryComponent.toLowerCase())) {
5723
- queryComponent = script$5;
5958
+ queryComponent = script$4;
5724
5959
  }
5725
5960
  popupComponent.value = queryComponent;
5726
5961
  if (popUp.value) {
@@ -5770,9 +6005,17 @@ const initPopup = () => {
5770
6005
  const goBack = () => {
5771
6006
  if (route.matched.length) {
5772
6007
  let backUrl = route.path;
5773
- // const params = route.params
5774
- // Object.keys(params).map(key => backUrl = backUrl.replace(`:${key}`,params[key]))
5775
- router.push(backUrl);
6008
+ const params = route.query;
6009
+ let query = '?';
6010
+ // console.log(params)
6011
+ Object.keys(params).map(key => {
6012
+ const removeKeys = ['popup','comp','component'];
6013
+ if(!removeKeys.includes(key)) {
6014
+ query += `${key}=${params[key]}&`;
6015
+ }
6016
+ });
6017
+ console.log(query);
6018
+ router.push(backUrl + query);
5776
6019
  }
5777
6020
  };
5778
6021
 
@@ -5782,6 +6025,8 @@ return (_ctx, _cache) => {
5782
6025
  ? (openBlock(), createBlock(script$j, {
5783
6026
  key: 0,
5784
6027
  "modal-title": title.value,
6028
+ "data-bs-backdrop": "static",
6029
+ "data-bs-keyboard": "false",
5785
6030
  "modal-id": unref(modalId),
5786
6031
  "modal-size": size.value
5787
6032
  }, {
@@ -5811,188 +6056,7 @@ return (_ctx, _cache) => {
5811
6056
 
5812
6057
  };
5813
6058
 
5814
- script$4.__file = "src/lib/components/popups/ShQueryPopups.vue";
5815
-
5816
- const _hoisted_1$3 = { class: "sh-range" };
5817
- const _hoisted_2$3 = { class: "dropdown" };
5818
- const _hoisted_3$3 = {
5819
- class: "form-control dropdown-toggle",
5820
- href: "#",
5821
- role: "button",
5822
- id: "dropdownMenuLink",
5823
- "data-bs-toggle": "dropdown",
5824
- "aria-expanded": "false"
5825
- };
5826
- const _hoisted_4$3 = /*#__PURE__*/createElementVNode("i", { class: "bi-calendar text-dark" }, null, -1 /* HOISTED */);
5827
- const _hoisted_5$2 = ["innerHTML"];
5828
- const _hoisted_6$2 = {
5829
- class: "dropdown-menu",
5830
- "aria-labelledby": "dropdownMenuLink"
5831
- };
5832
- const _hoisted_7$1 = ["onClick"];
5833
- const _hoisted_8$1 = { class: "border-top" };
5834
- const _hoisted_9$1 = { class: "dropdown-item d-flex flex-column" };
5835
- const _hoisted_10 = /*#__PURE__*/createElementVNode("span", null, "Custom", -1 /* HOISTED */);
5836
-
5837
-
5838
-
5839
- var script$3 = {
5840
- __name: 'ShRange',
5841
- props: {
5842
- start: {
5843
- type: Number,
5844
- default: 2021
5845
- },
5846
- selected: {
5847
- type: String,
5848
- default: shRepo.getShConfig('defaultRange', 'This Month')
5849
- }
5850
- },
5851
- emits: ['rangeSelected'],
5852
- setup(__props, { emit }) {
5853
-
5854
- const props = __props;
5855
-
5856
-
5857
-
5858
-
5859
-
5860
- const selectedDate = ref(null);
5861
- const rangeLabel = ref(null);
5862
- ref(false);
5863
- const customFrom = ref(null);
5864
- const customTo = ref(null);
5865
-
5866
- const applyCustom = ()=>{
5867
- const date = [moment(customFrom.value),moment(customTo.value)];
5868
- setDate(date,'Custom');
5869
- };
5870
-
5871
- const dates = ref([
5872
- {
5873
- label: 'Today',
5874
- value: [moment(), moment()]
5875
- },
5876
- {
5877
- label: '7 Days',
5878
- value: [moment().subtract(7, 'days'), moment()]
5879
- },
5880
- {
5881
- label: 'This week',
5882
- value: [moment().subtract(1, 'week').startOf('week'), moment().subtract(1, 'week').endOf('week')]
5883
- },
5884
- {
5885
- label: 'This Month',
5886
- value: [moment().startOf('month'), moment()]
5887
- },
5888
- {
5889
- label: 'Last Month',
5890
- value: [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
5891
- },
5892
- {
5893
- label: 'Last 30 days',
5894
- value: [moment().subtract(30, 'days'), moment()]
5895
- },
5896
- {
5897
- label: 'Last 60 days',
5898
- value: [moment().subtract(60, 'days'), moment()]
5899
- },
5900
- {
5901
- label: 'Last 90 days',
5902
- value: [moment().subtract(90, 'days'), moment()]
5903
- },
5904
- {
5905
- label: '1 Year',
5906
- value: [moment().subtract(12, 'months'), moment()]
5907
- },
5908
- {
5909
- label: 'All Time',
5910
- value: [moment('@/2021').startOf('year'), moment()]
5911
- }
5912
- ]);
5913
- const setDate = (date, label) => {
5914
- selectedDate.value = date;
5915
- rangeLabel.value = '<strong>' + label + '</strong><small>(' + date[0].format('MMMM D, YYYY') + ' - ' + date[1].format('MMMM D, YYYY') + ')</small>';
5916
- const from = date[0];
5917
- const to = date[1];
5918
- const period = label.toString().toLowerCase().replaceAll(' ','_');
5919
- emit('rangeSelected', {
5920
- from: from,
5921
- to: to,
5922
- period: period,
5923
- query: `from=${from.format('L')}&to=${to.format('L')}&period=${period}`
5924
- });
5925
- };
5926
- onMounted(() => {
5927
- let end = parseInt(moment().format('Y'));
5928
- while (end >= props.start) {
5929
- dates.value.push({
5930
- label: end,
5931
- value: [moment('@/' + end).startOf('year'), moment('@/' + end).endOf('year')]
5932
- });
5933
- end--;
5934
- }
5935
-
5936
- dates.value.map(date=>{
5937
- (`${date.label}`.toLowerCase() === props.selected.toLowerCase()) && setDate(date.value, date.label);
5938
- });
5939
- });
5940
-
5941
- return (_ctx, _cache) => {
5942
- return (openBlock(), createElementBlock("div", _hoisted_1$3, [
5943
- createElementVNode("div", _hoisted_2$3, [
5944
- createElementVNode("div", _hoisted_3$3, [
5945
- _hoisted_4$3,
5946
- createTextVNode(),
5947
- createElementVNode("span", { innerHTML: rangeLabel.value }, null, 8 /* PROPS */, _hoisted_5$2)
5948
- ]),
5949
- createElementVNode("ul", _hoisted_6$2, [
5950
- (openBlock(true), createElementBlock(Fragment, null, renderList(dates.value, (date) => {
5951
- return (openBlock(), createElementBlock("li", {
5952
- key: date.label,
5953
- onClick: $event => (setDate(date.value, date.label))
5954
- }, [
5955
- createElementVNode("a", {
5956
- class: normalizeClass(["dropdown-item", date.value === selectedDate.value ? 'active' : '']),
5957
- href: "#"
5958
- }, toDisplayString(date.label), 3 /* TEXT, CLASS */)
5959
- ], 8 /* PROPS */, _hoisted_7$1))
5960
- }), 128 /* KEYED_FRAGMENT */)),
5961
- createElementVNode("li", _hoisted_8$1, [
5962
- createElementVNode("div", _hoisted_9$1, [
5963
- _hoisted_10,
5964
- createElementVNode("div", null, [
5965
- withDirectives(createElementVNode("input", {
5966
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((customFrom).value = $event)),
5967
- type: "date"
5968
- }, null, 512 /* NEED_PATCH */), [
5969
- [vModelText, customFrom.value]
5970
- ]),
5971
- withDirectives(createElementVNode("input", {
5972
- "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((customTo).value = $event)),
5973
- type: "date"
5974
- }, null, 512 /* NEED_PATCH */), [
5975
- [vModelText, customTo.value]
5976
- ])
5977
- ]),
5978
- (customFrom.value && customTo.value)
5979
- ? (openBlock(), createElementBlock("button", {
5980
- key: 0,
5981
- class: "btn btn-sm btn-info mt-1",
5982
- onClick: applyCustom
5983
- }, "Apply"))
5984
- : createCommentVNode("v-if", true)
5985
- ])
5986
- ])
5987
- ])
5988
- ])
5989
- ]))
5990
- }
5991
- }
5992
-
5993
- };
5994
-
5995
- script$3.__file = "src/lib/components/ShRange.vue";
6059
+ script$3.__file = "src/lib/components/popups/ShQueryPopups.vue";
5996
6060
 
5997
6061
  const useAppStore = defineStore('sh-app',{
5998
6062
  state: ()=>{
@@ -6058,7 +6122,7 @@ return (_ctx, _cache) => {
6058
6122
  _hoisted_4$2,
6059
6123
  createTextVNode(" ADD DEPARTMENT")
6060
6124
  ], 512 /* NEED_PATCH */),
6061
- createVNode(script$c, {
6125
+ createVNode(script$b, {
6062
6126
  reload: unref(reload),
6063
6127
  headers: ['id','name','description', 'created_at'],
6064
6128
  "end-point": "sh-departments/list",
@@ -6218,7 +6282,7 @@ return (_ctx, _cache) => {
6218
6282
  createElementVNode("div", _hoisted_2$1, [
6219
6283
  _hoisted_3$1,
6220
6284
  createElementVNode("h5", null, "Department #" + toDisplayString(unref(department).id) + " - " + toDisplayString(unref(department).name) + " Allowed Modules", 1 /* TEXT */),
6221
- createVNode(script$c, {
6285
+ createVNode(script$b, {
6222
6286
  actions: {
6223
6287
  label: 'Actions',
6224
6288
  actions: [
@@ -6485,7 +6549,7 @@ const ShFrontend = {
6485
6549
  });
6486
6550
  options.router.addRoute({
6487
6551
  path: '/sh-departments/manage-permissions/:id',
6488
- component: script$7
6552
+ component: script$6
6489
6553
  });
6490
6554
  }
6491
6555
  //filter unwanted config items from options to be put in local storage
@@ -6510,4 +6574,4 @@ var shGql = {
6510
6574
  mutate
6511
6575
  };
6512
6576
 
6513
- export { countries as Countries, script$7 as ManagePermissions, script$l as ShAutoForm, script$g as ShCanvas, script$8 as ShCanvasBtn, script$e as ShConfirmAction, script$k as ShDropDownForm, script$a as ShDynamicTabs, script$s as ShForm, ShFrontend, script$j as ShModal, script$9 as ShModalBtn, script$i as ShModalForm, script$h as ShModalFormAuto, script$u as ShPhone, script$4 as ShQueryPopups, script$3 as ShRange, script$6 as ShRoutePopups, script$d as ShSilentAction, script$c as ShTable, script$b as ShTabs, shApis, shGql, shRepo, ShStorage as shStorage, useAppStore, useUserStore };
6577
+ export { countries as Countries, script$6 as ManagePermissions, script$l as ShAutoForm, script$g as ShCanvas, script$7 as ShCanvasBtn, script$e as ShConfirmAction, script$k as ShDropDownForm, script$9 as ShDynamicTabs, script$s as ShForm, ShFrontend, script$j as ShModal, script$8 as ShModalBtn, script$i as ShModalForm, script$h as ShModalFormAuto, script$u as ShPhone, script$3 as ShQueryPopups, script$c as ShRange, script$5 as ShRoutePopups, script$d as ShSilentAction, script$b as ShTable, script$a as ShTabs, shApis, shGql, shRepo, ShStorage as shStorage, useAppStore, useUserStore };