@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.js CHANGED
@@ -1993,7 +1993,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
1993
1993
  [vue.vModelSelect, $data.selectedCountry]
1994
1994
  ]),
1995
1995
  vue.withDirectives(vue.createElementVNode("input", {
1996
- type: "text",
1996
+ type: "number",
1997
1997
  class: "phone-number",
1998
1998
  "data-cy": "phone_input",
1999
1999
  onInput: _cache[2] || (_cache[2] = (...args) => ($options.updateValue && $options.updateValue(...args))),
@@ -2517,7 +2517,7 @@ const _hoisted_7$6 = { class: "row" };
2517
2517
  const _hoisted_8$5 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
2518
2518
  const _hoisted_9$5 = { class: "col-md-12" };
2519
2519
  const _hoisted_10$4 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
2520
- const _hoisted_11$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2520
+ const _hoisted_11$4 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2521
2521
  const _hoisted_12$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2522
2522
  const _hoisted_13$3 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
2523
2523
  const _hoisted_14$3 = ["data-cy", "name", "onFocus", "onUpdate:modelValue"];
@@ -2624,7 +2624,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2624
2624
  class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2625
2625
  "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2626
2626
  type: "number"
2627
- }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11$3)), [
2627
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11$4)), [
2628
2628
  [vue.vModelText, _ctx.form_elements[field]]
2629
2629
  ])
2630
2630
  : vue.createCommentVNode("v-if", true),
@@ -3763,7 +3763,7 @@ const _hoisted_9$4 = [
3763
3763
  _hoisted_4$7
3764
3764
  ];
3765
3765
  const _hoisted_10$3 = { class: "record_counts" };
3766
- const _hoisted_11$2 = {
3766
+ const _hoisted_11$3 = {
3767
3767
  key: 0,
3768
3768
  "aria-label": "Page navigation"
3769
3769
  };
@@ -3819,7 +3819,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3819
3819
  vue.createElementVNode("span", _hoisted_10$3, " of " + vue.toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
3820
3820
  ]),
3821
3821
  ($props.pagination_data != null)
3822
- ? (vue.openBlock(), vue.createElementBlock("nav", _hoisted_11$2, [
3822
+ ? (vue.openBlock(), vue.createElementBlock("nav", _hoisted_11$3, [
3823
3823
  vue.createElementVNode("ul", _hoisted_12$2, [
3824
3824
  vue.createElementVNode("li", {
3825
3825
  class: vue.normalizeClass([$options.getActivePage === 1 ? 'disabled' : '' , "page-item"])
@@ -4079,302 +4079,515 @@ return (_ctx, _cache) => {
4079
4079
 
4080
4080
  script$d.__file = "src/lib/components/ShSilentAction.vue";
4081
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__*/vue.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__*/vue.createElementVNode("span", null, "Custom", -1 /* HOISTED */);
4103
+
4104
+
4105
+
4082
4106
  var script$c = {
4083
- name: 'sh-table',
4084
- props: ['endPoint', 'headers','query', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover', 'hideIds', 'paginationStyle'],
4085
- inject: ['channel'],
4086
- data () {
4087
- return {
4088
- order_by: '',
4089
- order_method: '',
4090
- per_page: shRepo.getShConfig('tablePerPage',10),
4091
- page: 1,
4092
- filter_value: '',
4093
- loading: 'loading',
4094
- loading_error: '',
4095
- records: [],
4096
- total: 0,
4097
- pagination_data: null,
4098
- moreDetailsId: null,
4099
- moreDetailsModel: null,
4100
- downloading: false,
4101
- appUrl: window.VITE_APP_API_URL,
4102
- hasCanvas: 0,
4103
- selectedRecord: null,
4104
- timeOut: null,
4105
- tableHeaders: [],
4106
- pageStyle: this.paginationStyle ?? shRepo.getShConfig('tablePaginationStyle','loadMore')
4107
- }
4107
+ __name: 'ShRange',
4108
+ props: {
4109
+ start: {
4110
+ type: Number,
4111
+ default: 2021
4108
4112
  },
4109
- mounted () {
4110
- if(this.headers){
4111
- this.tableHeaders = this.headers;
4112
- }
4113
- if (this.event) ;
4114
- if (this.actions && this.actions.actions) {
4115
- this.actions.actions.forEach(action => {
4116
- if (action.canvasComponent) {
4117
- this.hasCanvas = true;
4118
- }
4119
- });
4120
- }
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 = vue.ref(null);
4128
+ const rangeLabel = vue.ref(null);
4129
+ vue.ref(false);
4130
+ const customFrom = vue.ref(null);
4131
+ const customTo = vue.ref(null);
4132
+
4133
+ const applyCustom = ()=>{
4134
+ const date = [moment__default["default"](customFrom.value),moment__default["default"](customTo.value)];
4135
+ setDate(date,'Custom');
4136
+ };
4137
+
4138
+ const dates = vue.ref([
4139
+ {
4140
+ label: 'Today',
4141
+ value: [moment__default["default"](), moment__default["default"]()]
4121
4142
  },
4122
- methods: {
4123
- userTyping: function(){
4124
- if (this.timeOut){
4125
- clearTimeout(this.timeOut);
4126
- }
4127
- const self = this;
4128
- this.timeOut = setTimeout(()=>{
4129
- self.reloadData(1);
4130
- },800);
4131
- },
4132
- cleanCanvasProps: function (actions) {
4133
- let replaced = actions;
4134
- replaced.class = null;
4135
- return replaced
4136
- },
4137
- newRecordAdded: function (ev) {
4138
- const record = ev.log;
4139
- if (record.user) {
4140
- record.user = record.user.name;
4141
- }
4142
- this.records.unshift(record);
4143
- },
4144
- canvasClosed: function () {
4145
- this.selectedRecord = null;
4146
- },
4147
- rowSelected: function (row) {
4148
- this.selectedRecord = null;
4149
- setTimeout(() => {
4150
- this.selectedRecord = row;
4151
- this.$emit('rowSelected', row);
4152
- }, 100);
4153
- },
4154
- changeKey: function (key, value) {
4155
- this[key] = value;
4156
- if (key === 'order_by') {
4157
- this.order_method = (this.order_method === 'desc') ? 'asc' : 'desc';
4158
- }
4159
- if (key === 'per_page') {
4160
- this.page = 1;
4161
- }
4162
- this.reloadData();
4163
- },
4164
- getLinkClass: function (config) {
4165
- if (typeof config === 'object') {
4166
- return config.class
4167
- }
4168
- return ''
4169
- },
4170
- reloadNotifications: function () {
4171
- this.reloadData();
4143
+ {
4144
+ label: 'Yesterday',
4145
+ value: [moment__default["default"]().subtract(1, 'days'), moment__default["default"]()]
4146
+ },
4147
+ {
4148
+ label: '7 Days',
4149
+ value: [moment__default["default"]().subtract(7, 'days'), moment__default["default"]()]
4150
+ },
4151
+ {
4152
+ label: 'This week',
4153
+ value: [moment__default["default"]().subtract(1, 'week').startOf('week'), moment__default["default"]().subtract(1, 'week').endOf('week')]
4154
+ },
4155
+ {
4156
+ label: 'This Month',
4157
+ value: [moment__default["default"]().startOf('month'), moment__default["default"]()]
4158
+ },
4159
+ {
4160
+ label: 'Last Month',
4161
+ value: [moment__default["default"]().subtract(1, 'month').startOf('month'), moment__default["default"]().subtract(1, 'month').endOf('month')]
4162
+ },
4163
+ {
4164
+ label: 'Last 30 days',
4165
+ value: [moment__default["default"]().subtract(30, 'days'), moment__default["default"]()]
4166
+ },
4167
+ {
4168
+ label: 'Last 60 days',
4169
+ value: [moment__default["default"]().subtract(60, 'days'), moment__default["default"]()]
4170
+ },
4171
+ {
4172
+ label: 'Last 90 days',
4173
+ value: [moment__default["default"]().subtract(90, 'days'), moment__default["default"]()]
4174
+ },
4175
+ {
4176
+ label: 'This Year',
4177
+ value: [moment__default["default"]().startOf('year'), moment__default["default"]()]
4172
4178
  },
4173
- replaceActionUrl: function (path, obj) {
4174
- if (path) {
4175
- var matches = path.match(/\{(.*?)\}/g);
4176
- try {
4177
- matches.forEach(key => {
4178
- key = key.replace('{', '');
4179
- key = key.replace('}', '');
4180
- path = path.replace(`{${key}}`, obj[key]);
4181
- });
4182
- return path
4183
- } catch (e) {
4184
- return path
4179
+ {
4180
+ label: '1 Year',
4181
+ value: [moment__default["default"]().subtract(12, 'months'), moment__default["default"]()]
4182
+ },
4183
+ {
4184
+ label: 'All Time',
4185
+ value: [moment__default["default"]('@/2021').startOf('year'), moment__default["default"]()]
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
+ vue.onMounted(() => {
4202
+ let end = parseInt(moment__default["default"]().format('Y'));
4203
+ while (end >= props.start) {
4204
+ dates.value.push({
4205
+ label: end,
4206
+ value: [moment__default["default"]('@/' + end).startOf('year'), moment__default["default"]('@/' + 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 (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
4218
+ vue.createElementVNode("div", _hoisted_2$6, [
4219
+ vue.createElementVNode("div", _hoisted_3$6, [
4220
+ _hoisted_4$6,
4221
+ vue.createTextVNode(),
4222
+ vue.createElementVNode("span", { innerHTML: rangeLabel.value }, null, 8 /* PROPS */, _hoisted_5$5)
4223
+ ]),
4224
+ vue.createElementVNode("div", _hoisted_6$4, [
4225
+ vue.createElementVNode("ul", _hoisted_7$3, [
4226
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(dates.value, (date) => {
4227
+ return (vue.openBlock(), vue.createElementBlock("li", {
4228
+ key: date.label,
4229
+ onClick: $event => (setDate(date.value, date.label))
4230
+ }, [
4231
+ vue.createElementVNode("a", {
4232
+ class: vue.normalizeClass(["dropdown-item", date.value === selectedDate.value ? 'active' : '']),
4233
+ href: "#"
4234
+ }, vue.toDisplayString(date.label), 3 /* TEXT, CLASS */)
4235
+ ], 8 /* PROPS */, _hoisted_8$3))
4236
+ }), 128 /* KEYED_FRAGMENT */))
4237
+ ]),
4238
+ vue.createElementVNode("ul", null, [
4239
+ vue.createElementVNode("li", _hoisted_9$3, [
4240
+ vue.createElementVNode("div", _hoisted_10$2, [
4241
+ _hoisted_11$2,
4242
+ vue.createElementVNode("div", null, [
4243
+ vue.withDirectives(vue.createElementVNode("input", {
4244
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((customFrom).value = $event)),
4245
+ type: "date"
4246
+ }, null, 512 /* NEED_PATCH */), [
4247
+ [vue.vModelText, customFrom.value]
4248
+ ]),
4249
+ vue.withDirectives(vue.createElementVNode("input", {
4250
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((customTo).value = $event)),
4251
+ type: "date"
4252
+ }, null, 512 /* NEED_PATCH */), [
4253
+ [vue.vModelText, customTo.value]
4254
+ ])
4255
+ ]),
4256
+ (customFrom.value && customTo.value)
4257
+ ? (vue.openBlock(), vue.createElementBlock("button", {
4258
+ key: 0,
4259
+ class: "btn btn-sm btn-info mt-1",
4260
+ onClick: applyCustom
4261
+ }, "Apply"))
4262
+ : vue.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
4185
4305
  }
4186
- }
4187
- return ''
4188
- },
4189
- doEmitAction: function (action, data) {
4190
- if (typeof action === 'function') {
4191
- action(data);
4192
- } else {
4193
- this.$emit(action, data);
4194
- }
4195
- },
4196
- getFieldType: function (field) {
4197
- const numbers = ['age', 'interest_rate_pa'];
4198
- const moneys = ['amount', 'paid_amount', 'total_paid', 'total', 'monthly_fee', 'share_cost', 'min_contribution', 'min_membership_contribution'];
4199
- const dates = ['invoice_date', 'free_tier_days', 'updated_at', 'created_at', 'end_time'];
4200
- if (numbers.includes(field)) {
4201
- return 'numeric'
4202
- }
4203
- if (moneys.includes(field)) {
4204
- return 'money'
4205
- }
4206
- if (dates.includes(field)) {
4207
- return 'date'
4208
- }
4209
- return 'string'
4210
- },
4211
- replaceLinkUrl: function (path, obj) {
4212
- if (typeof path === 'object') {
4213
- path = path.link ?? path.url;
4214
- }
4215
- var matches = path.match(/\{(.*?)\}/g);
4216
- matches && matches.forEach(key => {
4217
- key = key.replace('{', '');
4218
- key = key.replace('}', '');
4219
- path = path.replace(`{${key}}`, obj[key]);
4220
- });
4221
- return path
4222
4306
  },
4223
- formatDate: function (date) {
4224
- return moment__default["default"](date).format('lll')
4225
- },
4226
- setMoreDetailsModel: function (row) {
4227
- this.moreDetailsModel = null;
4228
- this.moreDetailsModel = row;
4229
- },
4230
- loadMoreRecords: function () {
4231
- this.reloadData(this.page + 1, 1);
4232
- },
4233
- exportData: function (template) {
4234
- this.downloading = true;
4235
- const headers = [];
4236
- const fields = this.downloadFields ? this.downloadFields : this.headers;
4237
- fields.forEach(header => {
4238
- if (typeof header === 'string') {
4239
- headers.push(header);
4307
+ mounted() {
4308
+ if (this.headers) {
4309
+ this.tableHeaders = this.headers;
4240
4310
  }
4241
- });
4242
- const data = {
4243
- titles: headers,
4244
- export: 1
4245
- };
4246
- shApis.doPost(this.endPoint, data).then(res => {
4247
- this.downloading = false;
4248
- if (res.data.file) {
4249
- const url = this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name;
4250
- window.location.href = url;
4251
- // window.open('https://facebook.com')
4252
- // 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
+ });
4253
4318
  }
4254
- }).catch(reason => {
4255
- this.downloading = false;
4256
- const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText}`;
4257
- shRepo.swalError('Error', error);
4258
- });
4259
4319
  },
4260
- reloadData: function (page, append) {
4261
- if (typeof page !== 'undefined') {
4262
- this.page = page;
4263
- }
4264
- if (!append) {
4265
- this.loading = 'loading';
4266
- }
4267
- const data = {
4268
- order_by: this.order_by,
4269
- order_method: this.order_method,
4270
- per_page: this.per_page,
4271
- page: this.page,
4272
- filter_value: this.filter_value,
4273
- paginated: true
4274
- };
4275
- if (this.pagination_data) {
4276
- this.pagination_data.loading = 1;
4277
- }
4278
- let endPoint = this.endPoint;
4279
- if(!this.endPoint && this.query){
4280
- //send ql query
4281
- endPoint = 'sh-ql';
4282
- data.query = this.query;
4283
- }
4284
- shApis.doGet(endPoint, data).then(req => {
4285
- this.$emit('dataReloaded', this.pagination_data);
4286
- this.loading = 'done';
4287
- const response = req.data.data;
4288
- this.pagination_data = {
4289
- current: response.current_page,
4290
- start: response.from,
4291
- end: response.last_page,
4292
- record_count: response.total,
4293
- per_page: response.per_page,
4294
- loading: 0,
4295
- displayCount: response.total > response.per_page ? response.per_page : response.total
4296
- };
4297
- if(!this.headers && response.total > 0){
4298
- this.tableHeaders = Object.keys(response.data[0]);
4299
- }
4300
- if (append) {
4301
- this.records.push(...response.data);
4302
- let totalShown = response.total > response.per_page ? response.per_page * response.current_page : response.total;
4303
- if (totalShown > response.total) {
4304
- totalShown = response.total;
4305
- }
4306
- this.pagination_data.displayCount = totalShown;
4307
- const scrollingElement = (document.scrollingElement || document.body);
4308
- scrollingElement.scrollTop = scrollingElement.scrollHeight;
4309
- } else {
4310
- 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__default["default"](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
+ });
4311
4526
  }
4312
- }).catch(reason => {
4313
- const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText} (${this.endPoint})`;
4314
- this.loading_error = error;
4315
- this.loading = 'error';
4316
- });
4317
- }
4318
- },
4319
- watch: {
4320
- hideIds: {
4321
- handler(newValue) {
4322
- this.records = this.records.filter(record => !newValue.includes(record.id) && record);
4323
- },
4324
- deep: true
4325
- },
4326
- reload () {
4327
- this.reloadData();
4328
4527
  },
4329
- endPoint() {
4330
- this.reloadData();
4331
- }
4332
- },
4333
- created () {
4334
- this.reloadData();
4335
- },
4336
- components: {
4337
- ShSilentAction: script$d,
4338
- ShConfirmAction: script$e,
4339
- ShCanvas: script$g,
4340
- pagination: script$f
4341
- },
4342
- computed: {
4343
- windowWidth: function () {
4344
- 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
+ }
4345
4541
  },
4346
- user () {
4347
- return null
4542
+ created() {
4543
+ this.reloadData();
4348
4544
  },
4349
- hasDefaultSlot () {
4350
- 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
4351
4551
  },
4352
- hasRecordsSlot () {
4353
- 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
+ }
4354
4565
  }
4355
- }
4356
4566
  };
4357
4567
 
4358
- const _hoisted_1$9 = { class: "auto-table mt-2" };
4359
- const _hoisted_2$6 = {
4568
+ const _hoisted_1$8 = { class: "auto-table mt-2" };
4569
+ const _hoisted_2$5 = {
4360
4570
  key: 0,
4361
4571
  class: "col-md-4 mb-2"
4362
4572
  };
4363
- const _hoisted_3$6 = ["disabled"];
4364
- const _hoisted_4$6 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */);
4365
- const _hoisted_5$5 = /*#__PURE__*/vue.createElementVNode("span", {
4573
+ const _hoisted_3$5 = ["disabled"];
4574
+ const _hoisted_4$5 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */);
4575
+ const _hoisted_5$4 = /*#__PURE__*/vue.createElementVNode("span", {
4366
4576
  class: "spinner-border spinner-border-sm",
4367
4577
  role: "status",
4368
4578
  "aria-hidden": "true"
4369
4579
  }, null, -1 /* HOISTED */);
4370
- const _hoisted_6$4 = /*#__PURE__*/vue.createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* HOISTED */);
4371
- const _hoisted_7$3 = {
4580
+ const _hoisted_6$3 = /*#__PURE__*/vue.createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* HOISTED */);
4581
+ const _hoisted_7$2 = {
4372
4582
  key: 1,
4373
4583
  class: "row"
4374
4584
  };
4375
- const _hoisted_8$3 = { class: "col-12 mb-3" };
4376
- const _hoisted_9$3 = { class: "sh-search-bar" };
4377
- 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"];
4378
4591
  const _hoisted_11$1 = {
4379
4592
  key: 0,
4380
4593
  class: "text-center"
@@ -4512,15 +4725,16 @@ const _hoisted_64 = ["href"];
4512
4725
  const _hoisted_65 = ["title", "onClick"];
4513
4726
 
4514
4727
  function render(_ctx, _cache, $props, $setup, $data, $options) {
4728
+ const _component_sh_range = vue.resolveComponent("sh-range");
4515
4729
  const _component_router_link = vue.resolveComponent("router-link");
4516
4730
  const _component_sh_confirm_action = vue.resolveComponent("sh-confirm-action");
4517
4731
  const _component_sh_silent_action = vue.resolveComponent("sh-silent-action");
4518
4732
  const _component_pagination = vue.resolveComponent("pagination");
4519
4733
  const _component_sh_canvas = vue.resolveComponent("sh-canvas");
4520
4734
 
4521
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
4735
+ return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
4522
4736
  ($props.hasDownload)
4523
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$6, [
4737
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$5, [
4524
4738
  vue.createElementVNode("button", {
4525
4739
  disabled: $data.downloading,
4526
4740
  class: "btn btn-warning btn-sm",
@@ -4528,20 +4742,27 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
4528
4742
  }, [
4529
4743
  (!$data.downloading)
4530
4744
  ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
4531
- _hoisted_4$6,
4745
+ _hoisted_4$5,
4532
4746
  vue.createTextVNode(" Export ")
4533
4747
  ], 64 /* STABLE_FRAGMENT */))
4534
4748
  : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
4535
- _hoisted_5$5,
4536
- _hoisted_6$4
4749
+ _hoisted_5$4,
4750
+ _hoisted_6$3
4537
4751
  ], 64 /* STABLE_FRAGMENT */))
4538
- ], 8 /* PROPS */, _hoisted_3$6)
4752
+ ], 8 /* PROPS */, _hoisted_3$5)
4539
4753
  ]))
4540
4754
  : vue.createCommentVNode("v-if", true),
4541
4755
  (!$props.hideSearch)
4542
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$3, [
4543
- vue.createElementVNode("div", _hoisted_8$3, [
4544
- vue.createElementVNode("div", _hoisted_9$3, [
4756
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$2, [
4757
+ vue.createElementVNode("div", _hoisted_8$2, [
4758
+ ($props.hasRange)
4759
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$2, [
4760
+ vue.createVNode(_component_sh_range, { onRangeSelected: $options.rangeChanged }, null, 8 /* PROPS */, ["onRangeSelected"])
4761
+ ]))
4762
+ : vue.createCommentVNode("v-if", true),
4763
+ vue.createElementVNode("div", {
4764
+ class: vue.normalizeClass(["sh-search-bar", $props.hasRange ? 'ms-2':''])
4765
+ }, [
4545
4766
  vue.withDirectives(vue.createElementVNode("input", {
4546
4767
  onKeydown: _cache[1] || (_cache[1] = (...args) => ($options.userTyping && $options.userTyping(...args))),
4547
4768
  onKeyup: _cache[2] || (_cache[2] = (...args) => ($options.userTyping && $options.userTyping(...args))),
@@ -4550,10 +4771,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
4550
4771
  "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => (($data.filter_value) = $event)),
4551
4772
  placeholder: $props.searchPlaceholder ? $props.searchPlaceholder : 'Search',
4552
4773
  class: "form-control sh-search-input"
4553
- }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_10$2), [
4774
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_10$1), [
4554
4775
  [vue.vModelText, $data.filter_value]
4555
4776
  ])
4556
- ])
4777
+ ], 2 /* CLASS */)
4557
4778
  ])
4558
4779
  ]))
4559
4780
  : vue.createCommentVNode("v-if", true),
@@ -4971,10 +5192,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
4971
5192
  ]))
4972
5193
  }
4973
5194
 
4974
- script$c.render = render;
4975
- script$c.__file = "src/lib/components/ShTable.vue";
5195
+ script$b.render = render;
5196
+ script$b.__file = "src/lib/components/ShTable.vue";
4976
5197
 
4977
- var script$b = {
5198
+ var script$a = {
4978
5199
  __name: 'ShTabs',
4979
5200
  props: {
4980
5201
  tabs: {
@@ -5119,20 +5340,20 @@ return (_ctx, _cache) => {
5119
5340
 
5120
5341
  };
5121
5342
 
5122
- script$b.__file = "src/lib/components/ShTabs.vue";
5343
+ script$a.__file = "src/lib/components/ShTabs.vue";
5123
5344
 
5124
- const _hoisted_1$8 = {
5345
+ const _hoisted_1$7 = {
5125
5346
  class: "nav-item",
5126
5347
  role: "presentation"
5127
5348
  };
5128
- const _hoisted_2$5 = ["onClick"];
5129
- const _hoisted_3$5 = /*#__PURE__*/vue.createElementVNode("i", { class: "d-none" }, null, -1 /* HOISTED */);
5130
- const _hoisted_4$5 = { class: "sh_tab_count" };
5131
- const _hoisted_5$4 = { class: "tab-content" };
5349
+ const _hoisted_2$4 = ["onClick"];
5350
+ const _hoisted_3$4 = /*#__PURE__*/vue.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" };
5132
5353
 
5133
- var script$a = {
5354
+ var script$9 = {
5134
5355
  __name: 'ShDynamicTabs',
5135
- props: ['tabs','data'],
5356
+ props: ['tabs','data','classes'],
5136
5357
  setup(__props) {
5137
5358
 
5138
5359
  const props = __props;
@@ -5156,11 +5377,11 @@ function setTab(tab){
5156
5377
  return (_ctx, _cache) => {
5157
5378
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
5158
5379
  vue.createElementVNode("ul", {
5159
- class: vue.normalizeClass(["nav nav-tabs", vue.unref(shRepo).getShConfig('tabsClass','sh-tabs nav-tabs-bordered')]),
5380
+ class: vue.normalizeClass(["nav nav-tabs", vue.unref(shRepo).getShConfig('tabsClass','sh-tabs nav-tabs-bordered') + __props.classes]),
5160
5381
  role: "tablist"
5161
5382
  }, [
5162
5383
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(tabs), (tab) => {
5163
- return (vue.openBlock(), vue.createElementBlock("li", _hoisted_1$8, [
5384
+ return (vue.openBlock(), vue.createElementBlock("li", _hoisted_1$7, [
5164
5385
  vue.createElementVNode("button", {
5165
5386
  onClick: $event => (setTab(tab)),
5166
5387
  class: vue.normalizeClass(["nav-link", vue.unref(currentTab) === tab ? 'active':''])
@@ -5168,15 +5389,15 @@ return (_ctx, _cache) => {
5168
5389
  vue.createTextVNode(vue.toDisplayString(tab.label) + " ", 1 /* TEXT */),
5169
5390
  (tab.count || tab.tabCount)
5170
5391
  ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
5171
- _hoisted_3$5,
5172
- vue.createElementVNode("sup", _hoisted_4$5, vue.toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
5392
+ _hoisted_3$4,
5393
+ vue.createElementVNode("sup", _hoisted_4$4, vue.toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
5173
5394
  ], 64 /* STABLE_FRAGMENT */))
5174
5395
  : vue.createCommentVNode("v-if", true)
5175
- ], 10 /* CLASS, PROPS */, _hoisted_2$5)
5396
+ ], 10 /* CLASS, PROPS */, _hoisted_2$4)
5176
5397
  ]))
5177
5398
  }), 256 /* UNKEYED_FRAGMENT */))
5178
5399
  ], 2 /* CLASS */),
5179
- vue.createElementVNode("div", _hoisted_5$4, [
5400
+ vue.createElementVNode("div", _hoisted_5$3, [
5180
5401
  (vue.unref(currentTab))
5181
5402
  ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(currentTab).component), vue.normalizeProps(vue.mergeProps({ key: 0 }, vue.unref(currentTab))), null, 16 /* FULL_PROPS */))
5182
5403
  : vue.createCommentVNode("v-if", true)
@@ -5187,12 +5408,12 @@ return (_ctx, _cache) => {
5187
5408
 
5188
5409
  };
5189
5410
 
5190
- script$a.__file = "src/lib/components/ShDynamicTabs.vue";
5411
+ script$9.__file = "src/lib/components/ShDynamicTabs.vue";
5191
5412
 
5192
- const _hoisted_1$7 = ["href"];
5413
+ const _hoisted_1$6 = ["href"];
5193
5414
 
5194
5415
 
5195
- var script$9 = {
5416
+ var script$8 = {
5196
5417
  __name: 'ShModalBtn',
5197
5418
  props: {
5198
5419
  modalId: {
@@ -5209,18 +5430,18 @@ return (_ctx, _cache) => {
5209
5430
  "data-bs-toggle": "modal"
5210
5431
  }, [
5211
5432
  vue.renderSlot(_ctx.$slots, "default")
5212
- ], 8 /* PROPS */, _hoisted_1$7))
5433
+ ], 8 /* PROPS */, _hoisted_1$6))
5213
5434
  }
5214
5435
  }
5215
5436
 
5216
5437
  };
5217
5438
 
5218
- script$9.__file = "src/lib/components/ShModalBtn.vue";
5439
+ script$8.__file = "src/lib/components/ShModalBtn.vue";
5219
5440
 
5220
- const _hoisted_1$6 = ["href"];
5441
+ const _hoisted_1$5 = ["href"];
5221
5442
 
5222
5443
 
5223
- var script$8 = {
5444
+ var script$7 = {
5224
5445
  __name: 'ShCanvasBtn',
5225
5446
  props: {
5226
5447
  canvasId: {
@@ -5238,13 +5459,13 @@ return (_ctx, _cache) => {
5238
5459
  "data-bs-toggle": "offcanvas"
5239
5460
  }, [
5240
5461
  vue.renderSlot(_ctx.$slots, "default")
5241
- ], 8 /* PROPS */, _hoisted_1$6))
5462
+ ], 8 /* PROPS */, _hoisted_1$5))
5242
5463
  }
5243
5464
  }
5244
5465
 
5245
5466
  };
5246
5467
 
5247
- script$8.__file = "src/lib/components/ShCanvasBtn.vue";
5468
+ script$7.__file = "src/lib/components/ShCanvasBtn.vue";
5248
5469
 
5249
5470
  const useUserStore = pinia.defineStore('user-store', {
5250
5471
  state: () => ({
@@ -5343,30 +5564,30 @@ const useUserStore = pinia.defineStore('user-store', {
5343
5564
  });
5344
5565
 
5345
5566
  const _withScopeId$1 = n => (vue.pushScopeId("data-v-0d4fa0ac"),n=n(),vue.popScopeId(),n);
5346
- const _hoisted_1$5 = { class: "row permissions-main d-flex" };
5347
- const _hoisted_2$4 = {
5567
+ const _hoisted_1$4 = { class: "row permissions-main d-flex" };
5568
+ const _hoisted_2$3 = {
5348
5569
  id: "permissions-nav",
5349
5570
  class: "col-md-3 d-flex align-items-center py-4"
5350
5571
  };
5351
- const _hoisted_3$4 = {
5572
+ const _hoisted_3$3 = {
5352
5573
  key: 0,
5353
5574
  class: "mx-auto"
5354
5575
  };
5355
- const _hoisted_4$4 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/vue.createElementVNode("span", { class: "spinner-grow mx-auto" }, null, -1 /* HOISTED */));
5356
- const _hoisted_5$3 = [
5357
- _hoisted_4$4
5576
+ const _hoisted_4$3 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/vue.createElementVNode("span", { class: "spinner-grow mx-auto" }, null, -1 /* HOISTED */));
5577
+ const _hoisted_5$2 = [
5578
+ _hoisted_4$3
5358
5579
  ];
5359
- const _hoisted_6$3 = {
5580
+ const _hoisted_6$2 = {
5360
5581
  key: 1,
5361
5582
  class: "d-flex flex-column w-100 px-2"
5362
5583
  };
5363
- const _hoisted_7$2 = ["checked", "onClick", "disabled"];
5364
- const _hoisted_8$2 = ["onClick"];
5365
- const _hoisted_9$2 = {
5584
+ const _hoisted_7$1 = ["checked", "onClick", "disabled"];
5585
+ const _hoisted_8$1 = ["onClick"];
5586
+ const _hoisted_9$1 = {
5366
5587
  id: "permissions-content",
5367
5588
  class: "col-md-9 py-4 px-4"
5368
5589
  };
5369
- 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" };
5370
5591
  const _hoisted_11 = {
5371
5592
  key: 0,
5372
5593
  class: "alert alert-info"
@@ -5383,7 +5604,7 @@ const _hoisted_17 = { class: "col-md-3" };
5383
5604
  const _hoisted_18 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/vue.createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5384
5605
 
5385
5606
 
5386
- var script$7 = {
5607
+ var script$6 = {
5387
5608
  __name: 'ManagePermissions',
5388
5609
  emits: ['success'],
5389
5610
  setup(__props, { emit }) {
@@ -5487,11 +5708,11 @@ const getPermissionStyle = permission => {
5487
5708
  };
5488
5709
 
5489
5710
  return (_ctx, _cache) => {
5490
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
5491
- vue.createElementVNode("div", _hoisted_2$4, [
5711
+ return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
5712
+ vue.createElementVNode("div", _hoisted_2$3, [
5492
5713
  (loadingModules.value)
5493
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$4, _hoisted_5$3))
5494
- : (vue.openBlock(), vue.createElementBlock("ul", _hoisted_6$3, [
5714
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, _hoisted_5$2))
5715
+ : (vue.openBlock(), vue.createElementBlock("ul", _hoisted_6$2, [
5495
5716
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(modules.value, (module) => {
5496
5717
  return (vue.openBlock(), vue.createElementBlock("li", {
5497
5718
  class: vue.normalizeClass(selectedModule.value === module && 'active'),
@@ -5502,17 +5723,17 @@ return (_ctx, _cache) => {
5502
5723
  onClick: $event => (checkAllPermissions(module)),
5503
5724
  disabled: selectedModule.value !== module,
5504
5725
  type: "checkbox"
5505
- }, null, 8 /* PROPS */, _hoisted_7$2),
5726
+ }, null, 8 /* PROPS */, _hoisted_7$1),
5506
5727
  vue.createElementVNode("label", {
5507
5728
  class: "text-capitalize",
5508
5729
  onClick: $event => (setModule(module))
5509
- }, vue.toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_8$2)
5730
+ }, vue.toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_8$1)
5510
5731
  ], 2 /* CLASS */))
5511
5732
  }), 128 /* KEYED_FRAGMENT */))
5512
5733
  ]))
5513
5734
  ]),
5514
- vue.createElementVNode("div", _hoisted_9$2, [
5515
- vue.createElementVNode("div", _hoisted_10$1, [
5735
+ vue.createElementVNode("div", _hoisted_9$1, [
5736
+ vue.createElementVNode("div", _hoisted_10, [
5516
5737
  (loading.value)
5517
5738
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11, " loading ... "))
5518
5739
  : (vue.openBlock(), vue.createElementBlock("div", _hoisted_12, [
@@ -5565,13 +5786,13 @@ return (_ctx, _cache) => {
5565
5786
 
5566
5787
  };
5567
5788
 
5568
- script$7.__scopeId = "data-v-0d4fa0ac";
5569
- 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";
5570
5791
 
5571
- const _hoisted_1$4 = ["href"];
5792
+ const _hoisted_1$3 = ["href"];
5572
5793
 
5573
5794
 
5574
- var script$6 = {
5795
+ var script$5 = {
5575
5796
  __name: 'ShRoutePopups',
5576
5797
  setup(__props) {
5577
5798
 
@@ -5652,7 +5873,7 @@ return (_ctx, _cache) => {
5652
5873
  href: '#' + vue.unref(canvasId),
5653
5874
  shallowRef: "canvasButton",
5654
5875
  class: "d-none"
5655
- }, "Open Modal", 8 /* PROPS */, _hoisted_1$4),
5876
+ }, "Open Modal", 8 /* PROPS */, _hoisted_1$3),
5656
5877
  (popUp.value === 'modal')
5657
5878
  ? (vue.openBlock(), vue.createBlock(script$j, {
5658
5879
  key: 0,
@@ -5686,9 +5907,9 @@ return (_ctx, _cache) => {
5686
5907
 
5687
5908
  };
5688
5909
 
5689
- script$6.__file = "src/lib/components/popups/ShRoutePopups.vue";
5910
+ script$5.__file = "src/lib/components/popups/ShRoutePopups.vue";
5690
5911
 
5691
- var script$5 = {
5912
+ var script$4 = {
5692
5913
  __name: 'ShQueryForm',
5693
5914
  setup(__props) {
5694
5915
 
@@ -5707,9 +5928,9 @@ return (_ctx, _cache) => {
5707
5928
 
5708
5929
  };
5709
5930
 
5710
- script$5.__file = "src/lib/components/ShQueryForm.vue";
5931
+ script$4.__file = "src/lib/components/ShQueryForm.vue";
5711
5932
 
5712
- var script$4 = {
5933
+ var script$3 = {
5713
5934
  __name: 'ShQueryPopups',
5714
5935
  setup(__props) {
5715
5936
 
@@ -5732,7 +5953,7 @@ vue.watch(() => route.query.popup, pop => {
5732
5953
  title.value = route.query.title;
5733
5954
  let queryComponent = route.query.comp ?? route.query.component;
5734
5955
  if(queryComponent && ['shqueryform','queryform'].includes(queryComponent.toLowerCase())) {
5735
- queryComponent = script$5;
5956
+ queryComponent = script$4;
5736
5957
  }
5737
5958
  popupComponent.value = queryComponent;
5738
5959
  if (popUp.value) {
@@ -5782,9 +6003,17 @@ const initPopup = () => {
5782
6003
  const goBack = () => {
5783
6004
  if (route.matched.length) {
5784
6005
  let backUrl = route.path;
5785
- // const params = route.params
5786
- // Object.keys(params).map(key => backUrl = backUrl.replace(`:${key}`,params[key]))
5787
- router.push(backUrl);
6006
+ const params = route.query;
6007
+ let query = '?';
6008
+ // console.log(params)
6009
+ Object.keys(params).map(key => {
6010
+ const removeKeys = ['popup','comp','component'];
6011
+ if(!removeKeys.includes(key)) {
6012
+ query += `${key}=${params[key]}&`;
6013
+ }
6014
+ });
6015
+ console.log(query);
6016
+ router.push(backUrl + query);
5788
6017
  }
5789
6018
  };
5790
6019
 
@@ -5823,188 +6052,7 @@ return (_ctx, _cache) => {
5823
6052
 
5824
6053
  };
5825
6054
 
5826
- script$4.__file = "src/lib/components/popups/ShQueryPopups.vue";
5827
-
5828
- const _hoisted_1$3 = { class: "sh-range" };
5829
- const _hoisted_2$3 = { class: "dropdown" };
5830
- const _hoisted_3$3 = {
5831
- class: "form-control dropdown-toggle",
5832
- href: "#",
5833
- role: "button",
5834
- id: "dropdownMenuLink",
5835
- "data-bs-toggle": "dropdown",
5836
- "aria-expanded": "false"
5837
- };
5838
- const _hoisted_4$3 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-calendar text-dark" }, null, -1 /* HOISTED */);
5839
- const _hoisted_5$2 = ["innerHTML"];
5840
- const _hoisted_6$2 = {
5841
- class: "dropdown-menu",
5842
- "aria-labelledby": "dropdownMenuLink"
5843
- };
5844
- const _hoisted_7$1 = ["onClick"];
5845
- const _hoisted_8$1 = { class: "border-top" };
5846
- const _hoisted_9$1 = { class: "dropdown-item d-flex flex-column" };
5847
- const _hoisted_10 = /*#__PURE__*/vue.createElementVNode("span", null, "Custom", -1 /* HOISTED */);
5848
-
5849
-
5850
-
5851
- var script$3 = {
5852
- __name: 'ShRange',
5853
- props: {
5854
- start: {
5855
- type: Number,
5856
- default: 2021
5857
- },
5858
- selected: {
5859
- type: String,
5860
- default: shRepo.getShConfig('defaultRange', 'This Month')
5861
- }
5862
- },
5863
- emits: ['rangeSelected'],
5864
- setup(__props, { emit }) {
5865
-
5866
- const props = __props;
5867
-
5868
-
5869
-
5870
-
5871
-
5872
- const selectedDate = vue.ref(null);
5873
- const rangeLabel = vue.ref(null);
5874
- vue.ref(false);
5875
- const customFrom = vue.ref(null);
5876
- const customTo = vue.ref(null);
5877
-
5878
- const applyCustom = ()=>{
5879
- const date = [moment__default["default"](customFrom.value),moment__default["default"](customTo.value)];
5880
- setDate(date,'Custom');
5881
- };
5882
-
5883
- const dates = vue.ref([
5884
- {
5885
- label: 'Today',
5886
- value: [moment__default["default"](), moment__default["default"]()]
5887
- },
5888
- {
5889
- label: '7 Days',
5890
- value: [moment__default["default"]().subtract(7, 'days'), moment__default["default"]()]
5891
- },
5892
- {
5893
- label: 'This week',
5894
- value: [moment__default["default"]().subtract(1, 'week').startOf('week'), moment__default["default"]().subtract(1, 'week').endOf('week')]
5895
- },
5896
- {
5897
- label: 'This Month',
5898
- value: [moment__default["default"]().startOf('month'), moment__default["default"]()]
5899
- },
5900
- {
5901
- label: 'Last Month',
5902
- value: [moment__default["default"]().subtract(1, 'month').startOf('month'), moment__default["default"]().subtract(1, 'month').endOf('month')]
5903
- },
5904
- {
5905
- label: 'Last 30 days',
5906
- value: [moment__default["default"]().subtract(30, 'days'), moment__default["default"]()]
5907
- },
5908
- {
5909
- label: 'Last 60 days',
5910
- value: [moment__default["default"]().subtract(60, 'days'), moment__default["default"]()]
5911
- },
5912
- {
5913
- label: 'Last 90 days',
5914
- value: [moment__default["default"]().subtract(90, 'days'), moment__default["default"]()]
5915
- },
5916
- {
5917
- label: '1 Year',
5918
- value: [moment__default["default"]().subtract(12, 'months'), moment__default["default"]()]
5919
- },
5920
- {
5921
- label: 'All Time',
5922
- value: [moment__default["default"]('@/2021').startOf('year'), moment__default["default"]()]
5923
- }
5924
- ]);
5925
- const setDate = (date, label) => {
5926
- selectedDate.value = date;
5927
- rangeLabel.value = '<strong>' + label + '</strong><small>(' + date[0].format('MMMM D, YYYY') + ' - ' + date[1].format('MMMM D, YYYY') + ')</small>';
5928
- const from = date[0];
5929
- const to = date[1];
5930
- const period = label.toString().toLowerCase().replaceAll(' ','_');
5931
- emit('rangeSelected', {
5932
- from: from,
5933
- to: to,
5934
- period: period,
5935
- query: `from=${from.format('L')}&to=${to.format('L')}&period=${period}`
5936
- });
5937
- };
5938
- vue.onMounted(() => {
5939
- let end = parseInt(moment__default["default"]().format('Y'));
5940
- while (end >= props.start) {
5941
- dates.value.push({
5942
- label: end,
5943
- value: [moment__default["default"]('@/' + end).startOf('year'), moment__default["default"]('@/' + end).endOf('year')]
5944
- });
5945
- end--;
5946
- }
5947
-
5948
- dates.value.map(date=>{
5949
- (`${date.label}`.toLowerCase() === props.selected.toLowerCase()) && setDate(date.value, date.label);
5950
- });
5951
- });
5952
-
5953
- return (_ctx, _cache) => {
5954
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
5955
- vue.createElementVNode("div", _hoisted_2$3, [
5956
- vue.createElementVNode("div", _hoisted_3$3, [
5957
- _hoisted_4$3,
5958
- vue.createTextVNode(),
5959
- vue.createElementVNode("span", { innerHTML: rangeLabel.value }, null, 8 /* PROPS */, _hoisted_5$2)
5960
- ]),
5961
- vue.createElementVNode("ul", _hoisted_6$2, [
5962
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(dates.value, (date) => {
5963
- return (vue.openBlock(), vue.createElementBlock("li", {
5964
- key: date.label,
5965
- onClick: $event => (setDate(date.value, date.label))
5966
- }, [
5967
- vue.createElementVNode("a", {
5968
- class: vue.normalizeClass(["dropdown-item", date.value === selectedDate.value ? 'active' : '']),
5969
- href: "#"
5970
- }, vue.toDisplayString(date.label), 3 /* TEXT, CLASS */)
5971
- ], 8 /* PROPS */, _hoisted_7$1))
5972
- }), 128 /* KEYED_FRAGMENT */)),
5973
- vue.createElementVNode("li", _hoisted_8$1, [
5974
- vue.createElementVNode("div", _hoisted_9$1, [
5975
- _hoisted_10,
5976
- vue.createElementVNode("div", null, [
5977
- vue.withDirectives(vue.createElementVNode("input", {
5978
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((customFrom).value = $event)),
5979
- type: "date"
5980
- }, null, 512 /* NEED_PATCH */), [
5981
- [vue.vModelText, customFrom.value]
5982
- ]),
5983
- vue.withDirectives(vue.createElementVNode("input", {
5984
- "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((customTo).value = $event)),
5985
- type: "date"
5986
- }, null, 512 /* NEED_PATCH */), [
5987
- [vue.vModelText, customTo.value]
5988
- ])
5989
- ]),
5990
- (customFrom.value && customTo.value)
5991
- ? (vue.openBlock(), vue.createElementBlock("button", {
5992
- key: 0,
5993
- class: "btn btn-sm btn-info mt-1",
5994
- onClick: applyCustom
5995
- }, "Apply"))
5996
- : vue.createCommentVNode("v-if", true)
5997
- ])
5998
- ])
5999
- ])
6000
- ])
6001
- ]))
6002
- }
6003
- }
6004
-
6005
- };
6006
-
6007
- script$3.__file = "src/lib/components/ShRange.vue";
6055
+ script$3.__file = "src/lib/components/popups/ShQueryPopups.vue";
6008
6056
 
6009
6057
  const useAppStore = pinia.defineStore('sh-app',{
6010
6058
  state: ()=>{
@@ -6070,7 +6118,7 @@ return (_ctx, _cache) => {
6070
6118
  _hoisted_4$2,
6071
6119
  vue.createTextVNode(" ADD DEPARTMENT")
6072
6120
  ], 512 /* NEED_PATCH */),
6073
- vue.createVNode(script$c, {
6121
+ vue.createVNode(script$b, {
6074
6122
  reload: vue.unref(reload),
6075
6123
  headers: ['id','name','description', 'created_at'],
6076
6124
  "end-point": "sh-departments/list",
@@ -6230,7 +6278,7 @@ return (_ctx, _cache) => {
6230
6278
  vue.createElementVNode("div", _hoisted_2$1, [
6231
6279
  _hoisted_3$1,
6232
6280
  vue.createElementVNode("h5", null, "Department #" + vue.toDisplayString(vue.unref(department).id) + " - " + vue.toDisplayString(vue.unref(department).name) + " Allowed Modules", 1 /* TEXT */),
6233
- vue.createVNode(script$c, {
6281
+ vue.createVNode(script$b, {
6234
6282
  actions: {
6235
6283
  label: 'Actions',
6236
6284
  actions: [
@@ -6497,7 +6545,7 @@ const ShFrontend = {
6497
6545
  });
6498
6546
  options.router.addRoute({
6499
6547
  path: '/sh-departments/manage-permissions/:id',
6500
- component: script$7
6548
+ component: script$6
6501
6549
  });
6502
6550
  }
6503
6551
  //filter unwanted config items from options to be put in local storage
@@ -6523,26 +6571,26 @@ var shGql = {
6523
6571
  };
6524
6572
 
6525
6573
  exports.Countries = countries;
6526
- exports.ManagePermissions = script$7;
6574
+ exports.ManagePermissions = script$6;
6527
6575
  exports.ShAutoForm = script$l;
6528
6576
  exports.ShCanvas = script$g;
6529
- exports.ShCanvasBtn = script$8;
6577
+ exports.ShCanvasBtn = script$7;
6530
6578
  exports.ShConfirmAction = script$e;
6531
6579
  exports.ShDropDownForm = script$k;
6532
- exports.ShDynamicTabs = script$a;
6580
+ exports.ShDynamicTabs = script$9;
6533
6581
  exports.ShForm = script$s;
6534
6582
  exports.ShFrontend = ShFrontend;
6535
6583
  exports.ShModal = script$j;
6536
- exports.ShModalBtn = script$9;
6584
+ exports.ShModalBtn = script$8;
6537
6585
  exports.ShModalForm = script$i;
6538
6586
  exports.ShModalFormAuto = script$h;
6539
6587
  exports.ShPhone = script$u;
6540
- exports.ShQueryPopups = script$4;
6541
- exports.ShRange = script$3;
6542
- exports.ShRoutePopups = script$6;
6588
+ exports.ShQueryPopups = script$3;
6589
+ exports.ShRange = script$c;
6590
+ exports.ShRoutePopups = script$5;
6543
6591
  exports.ShSilentAction = script$d;
6544
- exports.ShTable = script$c;
6545
- exports.ShTabs = script$b;
6592
+ exports.ShTable = script$b;
6593
+ exports.ShTabs = script$a;
6546
6594
  exports.shApis = shApis;
6547
6595
  exports.shGql = shGql;
6548
6596
  exports.shRepo = shRepo;