@iankibetsh/shframework 2.0.3 → 2.0.5

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),
@@ -3751,7 +3751,7 @@ const _hoisted_9$4 = [
3751
3751
  _hoisted_4$7
3752
3752
  ];
3753
3753
  const _hoisted_10$3 = { class: "record_counts" };
3754
- const _hoisted_11$2 = {
3754
+ const _hoisted_11$3 = {
3755
3755
  key: 0,
3756
3756
  "aria-label": "Page navigation"
3757
3757
  };
@@ -3807,7 +3807,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3807
3807
  createElementVNode("span", _hoisted_10$3, " of " + toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
3808
3808
  ]),
3809
3809
  ($props.pagination_data != null)
3810
- ? (openBlock(), createElementBlock("nav", _hoisted_11$2, [
3810
+ ? (openBlock(), createElementBlock("nav", _hoisted_11$3, [
3811
3811
  createElementVNode("ul", _hoisted_12$2, [
3812
3812
  createElementVNode("li", {
3813
3813
  class: normalizeClass([$options.getActivePage === 1 ? 'disabled' : '' , "page-item"])
@@ -4067,302 +4067,515 @@ return (_ctx, _cache) => {
4067
4067
 
4068
4068
  script$d.__file = "src/lib/components/ShSilentAction.vue";
4069
4069
 
4070
+ const _hoisted_1$9 = { class: "sh-range" };
4071
+ const _hoisted_2$6 = { class: "dropdown" };
4072
+ const _hoisted_3$6 = {
4073
+ class: "form-control dropdown-toggle",
4074
+ href: "#",
4075
+ role: "button",
4076
+ id: "dropdownMenuLink",
4077
+ "data-bs-toggle": "dropdown",
4078
+ "aria-expanded": "false"
4079
+ };
4080
+ const _hoisted_4$6 = /*#__PURE__*/createElementVNode("i", { class: "bi-calendar text-dark" }, null, -1 /* HOISTED */);
4081
+ const _hoisted_5$5 = ["innerHTML"];
4082
+ const _hoisted_6$4 = {
4083
+ class: "dropdown-menu sh-range-dropdown",
4084
+ "aria-labelledby": "dropdownMenuLink"
4085
+ };
4086
+ const _hoisted_7$3 = { class: "sh-range-preset" };
4087
+ const _hoisted_8$3 = ["onClick"];
4088
+ const _hoisted_9$3 = { class: "border-top" };
4089
+ const _hoisted_10$2 = { class: "dropdown-item d-flex flex-column" };
4090
+ const _hoisted_11$2 = /*#__PURE__*/createElementVNode("span", null, "Custom", -1 /* HOISTED */);
4091
+
4092
+
4093
+
4070
4094
  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
- }
4095
+ __name: 'ShRange',
4096
+ props: {
4097
+ start: {
4098
+ type: Number,
4099
+ default: 2021
4096
4100
  },
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
- }
4101
+ selected: {
4102
+ type: String,
4103
+ default: shRepo.getShConfig('defaultRange', 'This Month')
4104
+ }
4105
+ },
4106
+ emits: ['rangeSelected'],
4107
+ setup(__props, { emit }) {
4108
+
4109
+ const props = __props;
4110
+
4111
+
4112
+
4113
+
4114
+
4115
+ const selectedDate = ref(null);
4116
+ const rangeLabel = ref(null);
4117
+ ref(false);
4118
+ const customFrom = ref(null);
4119
+ const customTo = ref(null);
4120
+
4121
+ const applyCustom = ()=>{
4122
+ const date = [moment(customFrom.value),moment(customTo.value)];
4123
+ setDate(date,'Custom');
4124
+ };
4125
+
4126
+ const dates = ref([
4127
+ {
4128
+ label: 'Today',
4129
+ value: [moment(), moment()]
4109
4130
  },
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();
4131
+ {
4132
+ label: 'Yesterday',
4133
+ value: [moment().subtract(1, 'days'), moment()]
4134
+ },
4135
+ {
4136
+ label: '7 Days',
4137
+ value: [moment().subtract(7, 'days'), moment()]
4138
+ },
4139
+ {
4140
+ label: 'This week',
4141
+ value: [moment().subtract(1, 'week').startOf('week'), moment().subtract(1, 'week').endOf('week')]
4142
+ },
4143
+ {
4144
+ label: 'This Month',
4145
+ value: [moment().startOf('month'), moment()]
4146
+ },
4147
+ {
4148
+ label: 'Last Month',
4149
+ value: [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
4150
+ },
4151
+ {
4152
+ label: 'Last 30 days',
4153
+ value: [moment().subtract(30, 'days'), moment()]
4154
+ },
4155
+ {
4156
+ label: 'Last 60 days',
4157
+ value: [moment().subtract(60, 'days'), moment()]
4158
+ },
4159
+ {
4160
+ label: 'Last 90 days',
4161
+ value: [moment().subtract(90, 'days'), moment()]
4162
+ },
4163
+ {
4164
+ label: 'This Year',
4165
+ value: [moment().startOf('year'), moment()]
4160
4166
  },
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
4167
+ {
4168
+ label: '1 Year',
4169
+ value: [moment().subtract(12, 'months'), moment()]
4170
+ },
4171
+ {
4172
+ label: 'All Time',
4173
+ value: [moment('@/2021').startOf('year'), moment()]
4174
+ }
4175
+ ]);
4176
+ const setDate = (date, label) => {
4177
+ selectedDate.value = date;
4178
+ rangeLabel.value = '<strong>' + label + '</strong><small>(' + date[0].format('MMMM D, YYYY') + ' - ' + date[1].format('MMMM D, YYYY') + ')</small>';
4179
+ const from = date[0];
4180
+ const to = date[1];
4181
+ const period = label.toString().toLowerCase().replaceAll(' ','_');
4182
+ emit('rangeSelected', {
4183
+ from: from,
4184
+ to: to,
4185
+ period: period,
4186
+ query: `from=${from.format('L')}&to=${to.format('L')}&period=${period}`
4187
+ });
4188
+ };
4189
+ onMounted(() => {
4190
+ let end = parseInt(moment().format('Y'));
4191
+ while (end >= props.start) {
4192
+ dates.value.push({
4193
+ label: end,
4194
+ value: [moment('@/' + end).startOf('year'), moment('@/' + end).endOf('year')]
4195
+ });
4196
+ end--;
4197
+ }
4198
+
4199
+ dates.value.map(date=>{
4200
+ (`${date.label}`.toLowerCase() === props.selected.toLowerCase()) && setDate(date.value, date.label);
4201
+ });
4202
+ });
4203
+
4204
+ return (_ctx, _cache) => {
4205
+ return (openBlock(), createElementBlock("div", _hoisted_1$9, [
4206
+ createElementVNode("div", _hoisted_2$6, [
4207
+ createElementVNode("div", _hoisted_3$6, [
4208
+ _hoisted_4$6,
4209
+ createTextVNode(),
4210
+ createElementVNode("span", { innerHTML: rangeLabel.value }, null, 8 /* PROPS */, _hoisted_5$5)
4211
+ ]),
4212
+ createElementVNode("div", _hoisted_6$4, [
4213
+ createElementVNode("ul", _hoisted_7$3, [
4214
+ (openBlock(true), createElementBlock(Fragment, null, renderList(dates.value, (date) => {
4215
+ return (openBlock(), createElementBlock("li", {
4216
+ key: date.label,
4217
+ onClick: $event => (setDate(date.value, date.label))
4218
+ }, [
4219
+ createElementVNode("a", {
4220
+ class: normalizeClass(["dropdown-item", date.value === selectedDate.value ? 'active' : '']),
4221
+ href: "#"
4222
+ }, toDisplayString(date.label), 3 /* TEXT, CLASS */)
4223
+ ], 8 /* PROPS */, _hoisted_8$3))
4224
+ }), 128 /* KEYED_FRAGMENT */))
4225
+ ]),
4226
+ createElementVNode("ul", null, [
4227
+ createElementVNode("li", _hoisted_9$3, [
4228
+ createElementVNode("div", _hoisted_10$2, [
4229
+ _hoisted_11$2,
4230
+ createElementVNode("div", null, [
4231
+ withDirectives(createElementVNode("input", {
4232
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((customFrom).value = $event)),
4233
+ type: "date"
4234
+ }, null, 512 /* NEED_PATCH */), [
4235
+ [vModelText, customFrom.value]
4236
+ ]),
4237
+ withDirectives(createElementVNode("input", {
4238
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((customTo).value = $event)),
4239
+ type: "date"
4240
+ }, null, 512 /* NEED_PATCH */), [
4241
+ [vModelText, customTo.value]
4242
+ ])
4243
+ ]),
4244
+ (customFrom.value && customTo.value)
4245
+ ? (openBlock(), createElementBlock("button", {
4246
+ key: 0,
4247
+ class: "btn btn-sm btn-info mt-1",
4248
+ onClick: applyCustom
4249
+ }, "Apply"))
4250
+ : createCommentVNode("v-if", true)
4251
+ ])
4252
+ ])
4253
+ ])
4254
+ ])
4255
+ ])
4256
+ ]))
4257
+ }
4258
+ }
4259
+
4260
+ };
4261
+
4262
+ script$c.__file = "src/lib/components/ShRange.vue";
4263
+
4264
+ var script$b = {
4265
+ name: 'sh-table',
4266
+ props: ['endPoint', 'headers', 'query', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover', 'hideIds', 'paginationStyle', 'hasRange'],
4267
+ inject: ['channel'],
4268
+ data() {
4269
+ return {
4270
+ order_by: '',
4271
+ order_method: '',
4272
+ per_page: shRepo.getShConfig('tablePerPage', 10),
4273
+ page: 1,
4274
+ filter_value: '',
4275
+ loading: 'loading',
4276
+ loading_error: '',
4277
+ records: [],
4278
+ total: 0,
4279
+ pagination_data: null,
4280
+ moreDetailsId: null,
4281
+ moreDetailsModel: null,
4282
+ downloading: false,
4283
+ appUrl: window.VITE_APP_API_URL,
4284
+ hasCanvas: 0,
4285
+ selectedRecord: null,
4286
+ timeOut: null,
4287
+ tableHeaders: [],
4288
+ pageStyle: this.paginationStyle ?? shRepo.getShConfig('tablePaginationStyle', 'loadMore'),
4289
+ range: null,
4290
+ from: null,
4291
+ to: null,
4292
+ period: null
4173
4293
  }
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
- },
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
4294
  },
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);
4295
+ mounted() {
4296
+ if (this.headers) {
4297
+ this.tableHeaders = this.headers;
4228
4298
  }
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()
4299
+ if (this.event) ;
4300
+ if (this.actions && this.actions.actions) {
4301
+ this.actions.actions.forEach(action => {
4302
+ if (action.canvasComponent) {
4303
+ this.hasCanvas = true;
4304
+ }
4305
+ });
4241
4306
  }
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
4307
  },
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;
4308
+ methods: {
4309
+ rangeChanged: function (newRange) {
4310
+ this.range = newRange;
4311
+ this.from = newRange.from.format('L');
4312
+ this.to = newRange.to.format('L');
4313
+ this.period = newRange.period;
4314
+ this.reloadData();
4315
+ },
4316
+ userTyping: function () {
4317
+ if (this.timeOut) {
4318
+ clearTimeout(this.timeOut);
4319
+ }
4320
+ const self = this;
4321
+ this.timeOut = setTimeout(() => {
4322
+ self.reloadData(1);
4323
+ }, 800);
4324
+ },
4325
+ cleanCanvasProps: function (actions) {
4326
+ let replaced = actions;
4327
+ replaced.class = null;
4328
+ return replaced
4329
+ },
4330
+ newRecordAdded: function (ev) {
4331
+ const record = ev.log;
4332
+ if (record.user) {
4333
+ record.user = record.user.name;
4334
+ }
4335
+ this.records.unshift(record);
4336
+ },
4337
+ canvasClosed: function () {
4338
+ this.selectedRecord = null;
4339
+ },
4340
+ rowSelected: function (row) {
4341
+ this.selectedRecord = null;
4342
+ setTimeout(() => {
4343
+ this.selectedRecord = row;
4344
+ this.$emit('rowSelected', row);
4345
+ }, 100);
4346
+ },
4347
+ changeKey: function (key, value) {
4348
+ this[key] = value;
4349
+ if (key === 'order_by') {
4350
+ this.order_method = (this.order_method === 'desc') ? 'asc' : 'desc';
4351
+ }
4352
+ if (key === 'per_page') {
4353
+ this.page = 1;
4354
+ }
4355
+ this.reloadData();
4356
+ },
4357
+ getLinkClass: function (config) {
4358
+ if (typeof config === 'object') {
4359
+ return config.class
4360
+ }
4361
+ return ''
4362
+ },
4363
+ reloadNotifications: function () {
4364
+ this.reloadData();
4365
+ },
4366
+ replaceActionUrl: function (path, obj) {
4367
+ if (path) {
4368
+ var matches = path.match(/\{(.*?)\}/g);
4369
+ try {
4370
+ matches.forEach(key => {
4371
+ key = key.replace('{', '');
4372
+ key = key.replace('}', '');
4373
+ path = path.replace(`{${key}}`, obj[key]);
4374
+ });
4375
+ return path
4376
+ } catch (e) {
4377
+ return path
4378
+ }
4379
+ }
4380
+ return ''
4381
+ },
4382
+ doEmitAction: function (action, data) {
4383
+ if (typeof action === 'function') {
4384
+ action(data);
4385
+ } else {
4386
+ this.$emit(action, data);
4387
+ }
4388
+ },
4389
+ getFieldType: function (field) {
4390
+ const numbers = ['age', 'interest_rate_pa'];
4391
+ const moneys = ['amount', 'paid_amount', 'total_paid', 'total', 'monthly_fee', 'share_cost', 'min_contribution', 'min_membership_contribution'];
4392
+ const dates = ['invoice_date', 'free_tier_days', 'updated_at', 'created_at', 'end_time'];
4393
+ if (numbers.includes(field)) {
4394
+ return 'numeric'
4395
+ }
4396
+ if (moneys.includes(field)) {
4397
+ return 'money'
4398
+ }
4399
+ if (dates.includes(field)) {
4400
+ return 'date'
4401
+ }
4402
+ return 'string'
4403
+ },
4404
+ replaceLinkUrl: function (path, obj) {
4405
+ if (typeof path === 'object') {
4406
+ path = path.link ?? path.url;
4407
+ }
4408
+ var matches = path.match(/\{(.*?)\}/g);
4409
+ matches && matches.forEach(key => {
4410
+ key = key.replace('{', '');
4411
+ key = key.replace('}', '');
4412
+ path = path.replace(`{${key}}`, obj[key]);
4413
+ });
4414
+ return path
4415
+ },
4416
+ formatDate: function (date) {
4417
+ return moment(date).format('lll')
4418
+ },
4419
+ setMoreDetailsModel: function (row) {
4420
+ this.moreDetailsModel = null;
4421
+ this.moreDetailsModel = row;
4422
+ },
4423
+ loadMoreRecords: function () {
4424
+ this.reloadData(this.page + 1, 1);
4425
+ },
4426
+ exportData: function (template) {
4427
+ this.downloading = true;
4428
+ const headers = [];
4429
+ const fields = this.downloadFields ? this.downloadFields : this.headers;
4430
+ fields.forEach(header => {
4431
+ if (typeof header === 'string') {
4432
+ headers.push(header);
4433
+ }
4434
+ });
4435
+ const data = {
4436
+ titles: headers,
4437
+ export: 1
4438
+ };
4439
+ shApis.doPost(this.endPoint, data).then(res => {
4440
+ this.downloading = false;
4441
+ if (res.data.file) {
4442
+ const url = this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name;
4443
+ window.location.href = url;
4444
+ // window.open('https://facebook.com')
4445
+ // window.open(this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name, '_blank').focus()
4446
+ }
4447
+ }).catch(reason => {
4448
+ this.downloading = false;
4449
+ const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText}`;
4450
+ shRepo.swalError('Error', error);
4451
+ });
4452
+ },
4453
+ reloadData: function (page, append) {
4454
+ if (typeof page !== 'undefined') {
4455
+ this.page = page;
4456
+ }
4457
+ if (!append) {
4458
+ this.loading = 'loading';
4459
+ }
4460
+ const data = {
4461
+ order_by: this.order_by,
4462
+ order_method: this.order_method,
4463
+ per_page: this.per_page,
4464
+ page: this.page,
4465
+ filter_value: this.filter_value,
4466
+ paginated: true,
4467
+ from: this.from,
4468
+ to: this.to,
4469
+ period: this.period
4470
+ };
4471
+ if (this.pagination_data) {
4472
+ this.pagination_data.loading = 1;
4473
+ }
4474
+ let endPoint = this.endPoint;
4475
+ if (!this.endPoint && this.query) {
4476
+ //send ql query
4477
+ endPoint = 'sh-ql';
4478
+ data.query = this.query;
4479
+ }
4480
+ console.log(endPoint, this.range);
4481
+ shApis.doGet(endPoint, data).then(req => {
4482
+ this.$emit('dataReloaded', this.pagination_data);
4483
+ this.loading = 'done';
4484
+ const response = req.data.data;
4485
+ this.pagination_data = {
4486
+ current: response.current_page,
4487
+ start: response.from,
4488
+ end: response.last_page,
4489
+ record_count: response.total,
4490
+ per_page: response.per_page,
4491
+ loading: 0,
4492
+ displayCount: response.total > response.per_page ? response.per_page : response.total
4493
+ };
4494
+ if (!this.headers && response.total > 0) {
4495
+ this.tableHeaders = Object.keys(response.data[0]);
4496
+ }
4497
+ if (append) {
4498
+ this.records.push(...response.data);
4499
+ let totalShown = response.total > response.per_page ? response.per_page * response.current_page : response.total;
4500
+ if (totalShown > response.total) {
4501
+ totalShown = response.total;
4502
+ }
4503
+ this.pagination_data.displayCount = totalShown;
4504
+ const scrollingElement = (document.scrollingElement || document.body);
4505
+ scrollingElement.scrollTop = scrollingElement.scrollHeight;
4506
+ } else {
4507
+ this.records = response.data;
4508
+ }
4509
+ }).catch(reason => {
4510
+ const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText} (${this.endPoint})`;
4511
+ this.loading_error = error;
4512
+ this.loading = 'error';
4513
+ });
4299
4514
  }
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
- },
4314
- reload () {
4315
- this.reloadData();
4316
4515
  },
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
4516
+ watch: {
4517
+ hideIds: {
4518
+ handler(newValue) {
4519
+ this.records = this.records.filter(record => !newValue.includes(record.id) && record);
4520
+ },
4521
+ deep: true
4522
+ },
4523
+ reload() {
4524
+ this.reloadData();
4525
+ },
4526
+ endPoint() {
4527
+ this.reloadData();
4528
+ }
4333
4529
  },
4334
- user () {
4335
- return null
4530
+ created() {
4531
+ this.reloadData();
4336
4532
  },
4337
- hasDefaultSlot () {
4338
- return !!this.$slots.default
4533
+ components: {
4534
+ ShRange: script$c,
4535
+ ShSilentAction: script$d,
4536
+ ShConfirmAction: script$e,
4537
+ ShCanvas: script$g,
4538
+ pagination: script$f
4339
4539
  },
4340
- hasRecordsSlot () {
4341
- return !!this.$slots.records
4540
+ computed: {
4541
+ windowWidth: function () {
4542
+ return window.innerWidth
4543
+ },
4544
+ user() {
4545
+ return null
4546
+ },
4547
+ hasDefaultSlot() {
4548
+ return !!this.$slots.default
4549
+ },
4550
+ hasRecordsSlot() {
4551
+ return !!this.$slots.records
4552
+ }
4342
4553
  }
4343
- }
4344
4554
  };
4345
4555
 
4346
- const _hoisted_1$9 = { class: "auto-table mt-2" };
4347
- const _hoisted_2$6 = {
4556
+ const _hoisted_1$8 = { class: "auto-table mt-2" };
4557
+ const _hoisted_2$5 = {
4348
4558
  key: 0,
4349
4559
  class: "col-md-4 mb-2"
4350
4560
  };
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", {
4561
+ const _hoisted_3$5 = ["disabled"];
4562
+ const _hoisted_4$5 = /*#__PURE__*/createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */);
4563
+ const _hoisted_5$4 = /*#__PURE__*/createElementVNode("span", {
4354
4564
  class: "spinner-border spinner-border-sm",
4355
4565
  role: "status",
4356
4566
  "aria-hidden": "true"
4357
4567
  }, null, -1 /* HOISTED */);
4358
- const _hoisted_6$4 = /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* HOISTED */);
4359
- const _hoisted_7$3 = {
4568
+ const _hoisted_6$3 = /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* HOISTED */);
4569
+ const _hoisted_7$2 = {
4360
4570
  key: 1,
4361
4571
  class: "row"
4362
4572
  };
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"];
4573
+ const _hoisted_8$2 = { class: "col-12 mb-3 d-flex justify-content-start" };
4574
+ const _hoisted_9$2 = {
4575
+ key: 0,
4576
+ class: "sh-range-selector"
4577
+ };
4578
+ const _hoisted_10$1 = ["placeholder"];
4366
4579
  const _hoisted_11$1 = {
4367
4580
  key: 0,
4368
4581
  class: "text-center"
@@ -4500,15 +4713,16 @@ const _hoisted_64 = ["href"];
4500
4713
  const _hoisted_65 = ["title", "onClick"];
4501
4714
 
4502
4715
  function render(_ctx, _cache, $props, $setup, $data, $options) {
4716
+ const _component_sh_range = resolveComponent("sh-range");
4503
4717
  const _component_router_link = resolveComponent("router-link");
4504
4718
  const _component_sh_confirm_action = resolveComponent("sh-confirm-action");
4505
4719
  const _component_sh_silent_action = resolveComponent("sh-silent-action");
4506
4720
  const _component_pagination = resolveComponent("pagination");
4507
4721
  const _component_sh_canvas = resolveComponent("sh-canvas");
4508
4722
 
4509
- return (openBlock(), createElementBlock("div", _hoisted_1$9, [
4723
+ return (openBlock(), createElementBlock("div", _hoisted_1$8, [
4510
4724
  ($props.hasDownload)
4511
- ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
4725
+ ? (openBlock(), createElementBlock("div", _hoisted_2$5, [
4512
4726
  createElementVNode("button", {
4513
4727
  disabled: $data.downloading,
4514
4728
  class: "btn btn-warning btn-sm",
@@ -4516,20 +4730,27 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
4516
4730
  }, [
4517
4731
  (!$data.downloading)
4518
4732
  ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4519
- _hoisted_4$6,
4733
+ _hoisted_4$5,
4520
4734
  createTextVNode(" Export ")
4521
4735
  ], 64 /* STABLE_FRAGMENT */))
4522
4736
  : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
4523
- _hoisted_5$5,
4524
- _hoisted_6$4
4737
+ _hoisted_5$4,
4738
+ _hoisted_6$3
4525
4739
  ], 64 /* STABLE_FRAGMENT */))
4526
- ], 8 /* PROPS */, _hoisted_3$6)
4740
+ ], 8 /* PROPS */, _hoisted_3$5)
4527
4741
  ]))
4528
4742
  : createCommentVNode("v-if", true),
4529
4743
  (!$props.hideSearch)
4530
- ? (openBlock(), createElementBlock("div", _hoisted_7$3, [
4531
- createElementVNode("div", _hoisted_8$3, [
4532
- createElementVNode("div", _hoisted_9$3, [
4744
+ ? (openBlock(), createElementBlock("div", _hoisted_7$2, [
4745
+ createElementVNode("div", _hoisted_8$2, [
4746
+ ($props.hasRange)
4747
+ ? (openBlock(), createElementBlock("div", _hoisted_9$2, [
4748
+ createVNode(_component_sh_range, { onRangeSelected: $options.rangeChanged }, null, 8 /* PROPS */, ["onRangeSelected"])
4749
+ ]))
4750
+ : createCommentVNode("v-if", true),
4751
+ createElementVNode("div", {
4752
+ class: normalizeClass(["sh-search-bar", $props.hasRange ? 'ms-2':''])
4753
+ }, [
4533
4754
  withDirectives(createElementVNode("input", {
4534
4755
  onKeydown: _cache[1] || (_cache[1] = (...args) => ($options.userTyping && $options.userTyping(...args))),
4535
4756
  onKeyup: _cache[2] || (_cache[2] = (...args) => ($options.userTyping && $options.userTyping(...args))),
@@ -4538,10 +4759,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
4538
4759
  "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => (($data.filter_value) = $event)),
4539
4760
  placeholder: $props.searchPlaceholder ? $props.searchPlaceholder : 'Search',
4540
4761
  class: "form-control sh-search-input"
4541
- }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_10$2), [
4762
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_10$1), [
4542
4763
  [vModelText, $data.filter_value]
4543
4764
  ])
4544
- ])
4765
+ ], 2 /* CLASS */)
4545
4766
  ])
4546
4767
  ]))
4547
4768
  : createCommentVNode("v-if", true),
@@ -4959,10 +5180,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
4959
5180
  ]))
4960
5181
  }
4961
5182
 
4962
- script$c.render = render;
4963
- script$c.__file = "src/lib/components/ShTable.vue";
5183
+ script$b.render = render;
5184
+ script$b.__file = "src/lib/components/ShTable.vue";
4964
5185
 
4965
- var script$b = {
5186
+ var script$a = {
4966
5187
  __name: 'ShTabs',
4967
5188
  props: {
4968
5189
  tabs: {
@@ -5107,20 +5328,20 @@ return (_ctx, _cache) => {
5107
5328
 
5108
5329
  };
5109
5330
 
5110
- script$b.__file = "src/lib/components/ShTabs.vue";
5331
+ script$a.__file = "src/lib/components/ShTabs.vue";
5111
5332
 
5112
- const _hoisted_1$8 = {
5333
+ const _hoisted_1$7 = {
5113
5334
  class: "nav-item",
5114
5335
  role: "presentation"
5115
5336
  };
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" };
5337
+ const _hoisted_2$4 = ["onClick"];
5338
+ const _hoisted_3$4 = /*#__PURE__*/createElementVNode("i", { class: "d-none" }, null, -1 /* HOISTED */);
5339
+ const _hoisted_4$4 = { class: "sh_tab_count" };
5340
+ const _hoisted_5$3 = { class: "tab-content" };
5120
5341
 
5121
- var script$a = {
5342
+ var script$9 = {
5122
5343
  __name: 'ShDynamicTabs',
5123
- props: ['tabs','data'],
5344
+ props: ['tabs','data','classes'],
5124
5345
  setup(__props) {
5125
5346
 
5126
5347
  const props = __props;
@@ -5144,11 +5365,11 @@ function setTab(tab){
5144
5365
  return (_ctx, _cache) => {
5145
5366
  return (openBlock(), createElementBlock(Fragment, null, [
5146
5367
  createElementVNode("ul", {
5147
- class: normalizeClass(["nav nav-tabs", unref(shRepo).getShConfig('tabsClass','sh-tabs nav-tabs-bordered')]),
5368
+ class: normalizeClass(["nav nav-tabs", unref(shRepo).getShConfig('tabsClass','sh-tabs nav-tabs-bordered') + __props.classes]),
5148
5369
  role: "tablist"
5149
5370
  }, [
5150
5371
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(tabs), (tab) => {
5151
- return (openBlock(), createElementBlock("li", _hoisted_1$8, [
5372
+ return (openBlock(), createElementBlock("li", _hoisted_1$7, [
5152
5373
  createElementVNode("button", {
5153
5374
  onClick: $event => (setTab(tab)),
5154
5375
  class: normalizeClass(["nav-link", unref(currentTab) === tab ? 'active':''])
@@ -5156,15 +5377,15 @@ return (_ctx, _cache) => {
5156
5377
  createTextVNode(toDisplayString(tab.label) + " ", 1 /* TEXT */),
5157
5378
  (tab.count || tab.tabCount)
5158
5379
  ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
5159
- _hoisted_3$5,
5160
- createElementVNode("sup", _hoisted_4$5, toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
5380
+ _hoisted_3$4,
5381
+ createElementVNode("sup", _hoisted_4$4, toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
5161
5382
  ], 64 /* STABLE_FRAGMENT */))
5162
5383
  : createCommentVNode("v-if", true)
5163
- ], 10 /* CLASS, PROPS */, _hoisted_2$5)
5384
+ ], 10 /* CLASS, PROPS */, _hoisted_2$4)
5164
5385
  ]))
5165
5386
  }), 256 /* UNKEYED_FRAGMENT */))
5166
5387
  ], 2 /* CLASS */),
5167
- createElementVNode("div", _hoisted_5$4, [
5388
+ createElementVNode("div", _hoisted_5$3, [
5168
5389
  (unref(currentTab))
5169
5390
  ? (openBlock(), createBlock(resolveDynamicComponent(unref(currentTab).component), normalizeProps(mergeProps({ key: 0 }, unref(currentTab))), null, 16 /* FULL_PROPS */))
5170
5391
  : createCommentVNode("v-if", true)
@@ -5175,12 +5396,12 @@ return (_ctx, _cache) => {
5175
5396
 
5176
5397
  };
5177
5398
 
5178
- script$a.__file = "src/lib/components/ShDynamicTabs.vue";
5399
+ script$9.__file = "src/lib/components/ShDynamicTabs.vue";
5179
5400
 
5180
- const _hoisted_1$7 = ["href"];
5401
+ const _hoisted_1$6 = ["href"];
5181
5402
 
5182
5403
 
5183
- var script$9 = {
5404
+ var script$8 = {
5184
5405
  __name: 'ShModalBtn',
5185
5406
  props: {
5186
5407
  modalId: {
@@ -5197,18 +5418,18 @@ return (_ctx, _cache) => {
5197
5418
  "data-bs-toggle": "modal"
5198
5419
  }, [
5199
5420
  renderSlot(_ctx.$slots, "default")
5200
- ], 8 /* PROPS */, _hoisted_1$7))
5421
+ ], 8 /* PROPS */, _hoisted_1$6))
5201
5422
  }
5202
5423
  }
5203
5424
 
5204
5425
  };
5205
5426
 
5206
- script$9.__file = "src/lib/components/ShModalBtn.vue";
5427
+ script$8.__file = "src/lib/components/ShModalBtn.vue";
5207
5428
 
5208
- const _hoisted_1$6 = ["href"];
5429
+ const _hoisted_1$5 = ["href"];
5209
5430
 
5210
5431
 
5211
- var script$8 = {
5432
+ var script$7 = {
5212
5433
  __name: 'ShCanvasBtn',
5213
5434
  props: {
5214
5435
  canvasId: {
@@ -5226,13 +5447,13 @@ return (_ctx, _cache) => {
5226
5447
  "data-bs-toggle": "offcanvas"
5227
5448
  }, [
5228
5449
  renderSlot(_ctx.$slots, "default")
5229
- ], 8 /* PROPS */, _hoisted_1$6))
5450
+ ], 8 /* PROPS */, _hoisted_1$5))
5230
5451
  }
5231
5452
  }
5232
5453
 
5233
5454
  };
5234
5455
 
5235
- script$8.__file = "src/lib/components/ShCanvasBtn.vue";
5456
+ script$7.__file = "src/lib/components/ShCanvasBtn.vue";
5236
5457
 
5237
5458
  const useUserStore = defineStore('user-store', {
5238
5459
  state: () => ({
@@ -5331,30 +5552,30 @@ const useUserStore = defineStore('user-store', {
5331
5552
  });
5332
5553
 
5333
5554
  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 = {
5555
+ const _hoisted_1$4 = { class: "row permissions-main d-flex" };
5556
+ const _hoisted_2$3 = {
5336
5557
  id: "permissions-nav",
5337
5558
  class: "col-md-3 d-flex align-items-center py-4"
5338
5559
  };
5339
- const _hoisted_3$4 = {
5560
+ const _hoisted_3$3 = {
5340
5561
  key: 0,
5341
5562
  class: "mx-auto"
5342
5563
  };
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
5564
+ const _hoisted_4$3 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/createElementVNode("span", { class: "spinner-grow mx-auto" }, null, -1 /* HOISTED */));
5565
+ const _hoisted_5$2 = [
5566
+ _hoisted_4$3
5346
5567
  ];
5347
- const _hoisted_6$3 = {
5568
+ const _hoisted_6$2 = {
5348
5569
  key: 1,
5349
5570
  class: "d-flex flex-column w-100 px-2"
5350
5571
  };
5351
- const _hoisted_7$2 = ["checked", "onClick", "disabled"];
5352
- const _hoisted_8$2 = ["onClick"];
5353
- const _hoisted_9$2 = {
5572
+ const _hoisted_7$1 = ["checked", "onClick", "disabled"];
5573
+ const _hoisted_8$1 = ["onClick"];
5574
+ const _hoisted_9$1 = {
5354
5575
  id: "permissions-content",
5355
5576
  class: "col-md-9 py-4 px-4"
5356
5577
  };
5357
- const _hoisted_10$1 = { class: "p-2 rounded-2 bg-white h-100" };
5578
+ const _hoisted_10 = { class: "p-2 rounded-2 bg-white h-100" };
5358
5579
  const _hoisted_11 = {
5359
5580
  key: 0,
5360
5581
  class: "alert alert-info"
@@ -5371,7 +5592,7 @@ const _hoisted_17 = { class: "col-md-3" };
5371
5592
  const _hoisted_18 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5372
5593
 
5373
5594
 
5374
- var script$7 = {
5595
+ var script$6 = {
5375
5596
  __name: 'ManagePermissions',
5376
5597
  emits: ['success'],
5377
5598
  setup(__props, { emit }) {
@@ -5475,11 +5696,11 @@ const getPermissionStyle = permission => {
5475
5696
  };
5476
5697
 
5477
5698
  return (_ctx, _cache) => {
5478
- return (openBlock(), createElementBlock("div", _hoisted_1$5, [
5479
- createElementVNode("div", _hoisted_2$4, [
5699
+ return (openBlock(), createElementBlock("div", _hoisted_1$4, [
5700
+ createElementVNode("div", _hoisted_2$3, [
5480
5701
  (loadingModules.value)
5481
- ? (openBlock(), createElementBlock("div", _hoisted_3$4, _hoisted_5$3))
5482
- : (openBlock(), createElementBlock("ul", _hoisted_6$3, [
5702
+ ? (openBlock(), createElementBlock("div", _hoisted_3$3, _hoisted_5$2))
5703
+ : (openBlock(), createElementBlock("ul", _hoisted_6$2, [
5483
5704
  (openBlock(true), createElementBlock(Fragment, null, renderList(modules.value, (module) => {
5484
5705
  return (openBlock(), createElementBlock("li", {
5485
5706
  class: normalizeClass(selectedModule.value === module && 'active'),
@@ -5490,17 +5711,17 @@ return (_ctx, _cache) => {
5490
5711
  onClick: $event => (checkAllPermissions(module)),
5491
5712
  disabled: selectedModule.value !== module,
5492
5713
  type: "checkbox"
5493
- }, null, 8 /* PROPS */, _hoisted_7$2),
5714
+ }, null, 8 /* PROPS */, _hoisted_7$1),
5494
5715
  createElementVNode("label", {
5495
5716
  class: "text-capitalize",
5496
5717
  onClick: $event => (setModule(module))
5497
- }, toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_8$2)
5718
+ }, toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_8$1)
5498
5719
  ], 2 /* CLASS */))
5499
5720
  }), 128 /* KEYED_FRAGMENT */))
5500
5721
  ]))
5501
5722
  ]),
5502
- createElementVNode("div", _hoisted_9$2, [
5503
- createElementVNode("div", _hoisted_10$1, [
5723
+ createElementVNode("div", _hoisted_9$1, [
5724
+ createElementVNode("div", _hoisted_10, [
5504
5725
  (loading.value)
5505
5726
  ? (openBlock(), createElementBlock("div", _hoisted_11, " loading ... "))
5506
5727
  : (openBlock(), createElementBlock("div", _hoisted_12, [
@@ -5553,13 +5774,13 @@ return (_ctx, _cache) => {
5553
5774
 
5554
5775
  };
5555
5776
 
5556
- script$7.__scopeId = "data-v-0d4fa0ac";
5557
- script$7.__file = "src/lib/components/core/Departments/department/ManagePermissions.vue";
5777
+ script$6.__scopeId = "data-v-0d4fa0ac";
5778
+ script$6.__file = "src/lib/components/core/Departments/department/ManagePermissions.vue";
5558
5779
 
5559
- const _hoisted_1$4 = ["href"];
5780
+ const _hoisted_1$3 = ["href"];
5560
5781
 
5561
5782
 
5562
- var script$6 = {
5783
+ var script$5 = {
5563
5784
  __name: 'ShRoutePopups',
5564
5785
  setup(__props) {
5565
5786
 
@@ -5640,7 +5861,7 @@ return (_ctx, _cache) => {
5640
5861
  href: '#' + unref(canvasId),
5641
5862
  shallowRef: "canvasButton",
5642
5863
  class: "d-none"
5643
- }, "Open Modal", 8 /* PROPS */, _hoisted_1$4),
5864
+ }, "Open Modal", 8 /* PROPS */, _hoisted_1$3),
5644
5865
  (popUp.value === 'modal')
5645
5866
  ? (openBlock(), createBlock(script$j, {
5646
5867
  key: 0,
@@ -5674,9 +5895,9 @@ return (_ctx, _cache) => {
5674
5895
 
5675
5896
  };
5676
5897
 
5677
- script$6.__file = "src/lib/components/popups/ShRoutePopups.vue";
5898
+ script$5.__file = "src/lib/components/popups/ShRoutePopups.vue";
5678
5899
 
5679
- var script$5 = {
5900
+ var script$4 = {
5680
5901
  __name: 'ShQueryForm',
5681
5902
  setup(__props) {
5682
5903
 
@@ -5695,9 +5916,9 @@ return (_ctx, _cache) => {
5695
5916
 
5696
5917
  };
5697
5918
 
5698
- script$5.__file = "src/lib/components/ShQueryForm.vue";
5919
+ script$4.__file = "src/lib/components/ShQueryForm.vue";
5699
5920
 
5700
- var script$4 = {
5921
+ var script$3 = {
5701
5922
  __name: 'ShQueryPopups',
5702
5923
  setup(__props) {
5703
5924
 
@@ -5720,7 +5941,7 @@ watch(() => route.query.popup, pop => {
5720
5941
  title.value = route.query.title;
5721
5942
  let queryComponent = route.query.comp ?? route.query.component;
5722
5943
  if(queryComponent && ['shqueryform','queryform'].includes(queryComponent.toLowerCase())) {
5723
- queryComponent = script$5;
5944
+ queryComponent = script$4;
5724
5945
  }
5725
5946
  popupComponent.value = queryComponent;
5726
5947
  if (popUp.value) {
@@ -5770,9 +5991,17 @@ const initPopup = () => {
5770
5991
  const goBack = () => {
5771
5992
  if (route.matched.length) {
5772
5993
  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);
5994
+ const params = route.query;
5995
+ let query = '?';
5996
+ // console.log(params)
5997
+ Object.keys(params).map(key => {
5998
+ const removeKeys = ['popup','comp','component'];
5999
+ if(!removeKeys.includes(key)) {
6000
+ query += `${key}=${params[key]}&`;
6001
+ }
6002
+ });
6003
+ console.log(query);
6004
+ router.push(backUrl + query);
5776
6005
  }
5777
6006
  };
5778
6007
 
@@ -5811,188 +6040,7 @@ return (_ctx, _cache) => {
5811
6040
 
5812
6041
  };
5813
6042
 
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";
6043
+ script$3.__file = "src/lib/components/popups/ShQueryPopups.vue";
5996
6044
 
5997
6045
  const useAppStore = defineStore('sh-app',{
5998
6046
  state: ()=>{
@@ -6058,7 +6106,7 @@ return (_ctx, _cache) => {
6058
6106
  _hoisted_4$2,
6059
6107
  createTextVNode(" ADD DEPARTMENT")
6060
6108
  ], 512 /* NEED_PATCH */),
6061
- createVNode(script$c, {
6109
+ createVNode(script$b, {
6062
6110
  reload: unref(reload),
6063
6111
  headers: ['id','name','description', 'created_at'],
6064
6112
  "end-point": "sh-departments/list",
@@ -6218,7 +6266,7 @@ return (_ctx, _cache) => {
6218
6266
  createElementVNode("div", _hoisted_2$1, [
6219
6267
  _hoisted_3$1,
6220
6268
  createElementVNode("h5", null, "Department #" + toDisplayString(unref(department).id) + " - " + toDisplayString(unref(department).name) + " Allowed Modules", 1 /* TEXT */),
6221
- createVNode(script$c, {
6269
+ createVNode(script$b, {
6222
6270
  actions: {
6223
6271
  label: 'Actions',
6224
6272
  actions: [
@@ -6485,7 +6533,7 @@ const ShFrontend = {
6485
6533
  });
6486
6534
  options.router.addRoute({
6487
6535
  path: '/sh-departments/manage-permissions/:id',
6488
- component: script$7
6536
+ component: script$6
6489
6537
  });
6490
6538
  }
6491
6539
  //filter unwanted config items from options to be put in local storage
@@ -6510,4 +6558,4 @@ var shGql = {
6510
6558
  mutate
6511
6559
  };
6512
6560
 
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 };
6561
+ 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 };