@iankibetsh/shframework 2.0.4 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/library.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),
@@ -3082,7 +3082,7 @@ var script$l = {
3082
3082
  'emails',
3083
3083
  'phones','numbers','selects','dates','gqlMutation'
3084
3084
  ],
3085
- emits: ['success'],
3085
+ emits: ['success','fieldChanged','formSubmitted','formError'],
3086
3086
  setup(__props, { emit }) {
3087
3087
 
3088
3088
  const props = __props;
@@ -3156,7 +3156,10 @@ const getComponentClass = field => validationErrors.value[field] ? getElementCla
3156
3156
  const getHelperText = field => (props.helperTexts && props.helperTexts[field]) ? props.helperTexts[field]:false;
3157
3157
  const getElementClass = section => (props.formClasses && props.formClasses[section]) ? props.formClasses[section]:shFormElementClasses.value[section] ?? ___default["default"].snakeCase(section).replace(/_/gi,'-');
3158
3158
  const getPlaceholder = field => (props.placeHolders && props.placeHolders[field]) && props.placeHolders[field];
3159
- const removeValidationError = field => delete validationErrors.value[field];
3159
+ const fieldChanged = field => {
3160
+ delete validationErrors.value[field];
3161
+ emit('fieldChanged', field, formFields.value.filter(f=>f.field === field)[0].value);
3162
+ };
3160
3163
  const getComponentProps = field => {
3161
3164
  const newField = {...field};
3162
3165
  delete newField.component;
@@ -3305,8 +3308,8 @@ return (_ctx, _cache) => {
3305
3308
  : vue.createCommentVNode("v-if", true),
3306
3309
  (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(getFieldComponent(field)), vue.mergeProps(getComponentProps(field), {
3307
3310
  isInvalid: typeof validationErrors.value[field.field] !== 'undefined',
3308
- onClick: $event => (removeValidationError(field.field)),
3309
- "onUpdate:modelValue": [$event => (removeValidationError(field.field)), $event => ((formFields.value[index].value) = $event)],
3311
+ onClick: $event => (fieldChanged(field.field)),
3312
+ "onUpdate:modelValue": [$event => (fieldChanged(field.field)), $event => ((formFields.value[index].value) = $event)],
3310
3313
  modelValue: formFields.value[index].value,
3311
3314
  class: getComponentClass(field.field)
3312
3315
  }), null, 16 /* FULL_PROPS */, ["isInvalid", "onClick", "onUpdate:modelValue", "modelValue", "class"])),
@@ -3433,19 +3436,28 @@ const _hoisted_5$6 = /*#__PURE__*/vue.createElementVNode("button", {
3433
3436
  const _hoisted_6$5 = { class: "modal-body" };
3434
3437
  const _hoisted_7$4 = { class: "section" };
3435
3438
 
3439
+
3436
3440
  var script$j = {
3437
3441
  __name: 'ShModal',
3438
3442
  props: {
3439
- modalId: {
3440
- required: true,
3441
- type: String
3442
- },
3443
- modalTitle: {
3444
- type: String
3445
- },
3446
- modalSize: {
3447
- type: String
3448
- }
3443
+ modalId: {
3444
+ required: true,
3445
+ type: String
3446
+ },
3447
+ modalTitle: {
3448
+ type: String
3449
+ },
3450
+ modalSize: {
3451
+ type: String
3452
+ },
3453
+ Static: {
3454
+ type: Boolean,
3455
+ default: false
3456
+ },
3457
+ bsKeyboard: {
3458
+ type: Boolean,
3459
+ default: true
3460
+ }
3449
3461
  },
3450
3462
  emits: ['modalClosed'],
3451
3463
  setup(__props, { emit }) {
@@ -3454,11 +3466,11 @@ const props = __props;
3454
3466
 
3455
3467
 
3456
3468
 
3457
- vue.onMounted(()=>{
3458
- const modal = document.getElementById(props.modalId);
3459
- modal.addEventListener('hidden.bs.modal', event => {
3460
- event.target.id == props.modalId && emit('modalClosed');
3461
- });
3469
+ vue.onMounted(() => {
3470
+ const modal = document.getElementById(props.modalId);
3471
+ modal.addEventListener('hidden.bs.modal', event => {
3472
+ event.target.id == props.modalId && emit('modalClosed');
3473
+ });
3462
3474
  });
3463
3475
 
3464
3476
  return (_ctx, _cache) => {
@@ -3763,7 +3775,7 @@ const _hoisted_9$4 = [
3763
3775
  _hoisted_4$7
3764
3776
  ];
3765
3777
  const _hoisted_10$3 = { class: "record_counts" };
3766
- const _hoisted_11$2 = {
3778
+ const _hoisted_11$3 = {
3767
3779
  key: 0,
3768
3780
  "aria-label": "Page navigation"
3769
3781
  };
@@ -3819,7 +3831,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3819
3831
  vue.createElementVNode("span", _hoisted_10$3, " of " + vue.toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
3820
3832
  ]),
3821
3833
  ($props.pagination_data != null)
3822
- ? (vue.openBlock(), vue.createElementBlock("nav", _hoisted_11$2, [
3834
+ ? (vue.openBlock(), vue.createElementBlock("nav", _hoisted_11$3, [
3823
3835
  vue.createElementVNode("ul", _hoisted_12$2, [
3824
3836
  vue.createElementVNode("li", {
3825
3837
  class: vue.normalizeClass([$options.getActivePage === 1 ? 'disabled' : '' , "page-item"])
@@ -4079,302 +4091,515 @@ return (_ctx, _cache) => {
4079
4091
 
4080
4092
  script$d.__file = "src/lib/components/ShSilentAction.vue";
4081
4093
 
4094
+ const _hoisted_1$9 = { class: "sh-range" };
4095
+ const _hoisted_2$6 = { class: "dropdown" };
4096
+ const _hoisted_3$6 = {
4097
+ class: "form-control dropdown-toggle",
4098
+ href: "#",
4099
+ role: "button",
4100
+ id: "dropdownMenuLink",
4101
+ "data-bs-toggle": "dropdown",
4102
+ "aria-expanded": "false"
4103
+ };
4104
+ const _hoisted_4$6 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-calendar text-dark" }, null, -1 /* HOISTED */);
4105
+ const _hoisted_5$5 = ["innerHTML"];
4106
+ const _hoisted_6$4 = {
4107
+ class: "dropdown-menu sh-range-dropdown",
4108
+ "aria-labelledby": "dropdownMenuLink"
4109
+ };
4110
+ const _hoisted_7$3 = { class: "sh-range-preset" };
4111
+ const _hoisted_8$3 = ["onClick"];
4112
+ const _hoisted_9$3 = { class: "border-top" };
4113
+ const _hoisted_10$2 = { class: "dropdown-item d-flex flex-column" };
4114
+ const _hoisted_11$2 = /*#__PURE__*/vue.createElementVNode("span", null, "Custom", -1 /* HOISTED */);
4115
+
4116
+
4117
+
4082
4118
  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
- }
4119
+ __name: 'ShRange',
4120
+ props: {
4121
+ start: {
4122
+ type: Number,
4123
+ default: 2021
4108
4124
  },
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
- }
4125
+ selected: {
4126
+ type: String,
4127
+ default: shRepo.getShConfig('defaultRange', 'This Month')
4128
+ }
4129
+ },
4130
+ emits: ['rangeSelected'],
4131
+ setup(__props, { emit }) {
4132
+
4133
+ const props = __props;
4134
+
4135
+
4136
+
4137
+
4138
+
4139
+ const selectedDate = vue.ref(null);
4140
+ const rangeLabel = vue.ref(null);
4141
+ vue.ref(false);
4142
+ const customFrom = vue.ref(null);
4143
+ const customTo = vue.ref(null);
4144
+
4145
+ const applyCustom = ()=>{
4146
+ const date = [moment__default["default"](customFrom.value),moment__default["default"](customTo.value)];
4147
+ setDate(date,'Custom');
4148
+ };
4149
+
4150
+ const dates = vue.ref([
4151
+ {
4152
+ label: 'Today',
4153
+ value: [moment__default["default"](), moment__default["default"]()]
4121
4154
  },
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();
4155
+ {
4156
+ label: 'Yesterday',
4157
+ value: [moment__default["default"]().subtract(1, 'days'), moment__default["default"]()]
4158
+ },
4159
+ {
4160
+ label: '7 Days',
4161
+ value: [moment__default["default"]().subtract(7, 'days'), moment__default["default"]()]
4162
+ },
4163
+ {
4164
+ label: 'This week',
4165
+ value: [moment__default["default"]().subtract(1, 'week').startOf('week'), moment__default["default"]().subtract(1, 'week').endOf('week')]
4166
+ },
4167
+ {
4168
+ label: 'This Month',
4169
+ value: [moment__default["default"]().startOf('month'), moment__default["default"]()]
4170
+ },
4171
+ {
4172
+ label: 'Last Month',
4173
+ value: [moment__default["default"]().subtract(1, 'month').startOf('month'), moment__default["default"]().subtract(1, 'month').endOf('month')]
4174
+ },
4175
+ {
4176
+ label: 'Last 30 days',
4177
+ value: [moment__default["default"]().subtract(30, 'days'), moment__default["default"]()]
4178
+ },
4179
+ {
4180
+ label: 'Last 60 days',
4181
+ value: [moment__default["default"]().subtract(60, 'days'), moment__default["default"]()]
4182
+ },
4183
+ {
4184
+ label: 'Last 90 days',
4185
+ value: [moment__default["default"]().subtract(90, 'days'), moment__default["default"]()]
4186
+ },
4187
+ {
4188
+ label: 'This Year',
4189
+ value: [moment__default["default"]().startOf('year'), moment__default["default"]()]
4172
4190
  },
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
4191
+ {
4192
+ label: '1 Year',
4193
+ value: [moment__default["default"]().subtract(12, 'months'), moment__default["default"]()]
4194
+ },
4195
+ {
4196
+ label: 'All Time',
4197
+ value: [moment__default["default"]('@/2021').startOf('year'), moment__default["default"]()]
4198
+ }
4199
+ ]);
4200
+ const setDate = (date, label) => {
4201
+ selectedDate.value = date;
4202
+ rangeLabel.value = '<strong>' + label + '</strong><small>(' + date[0].format('MMMM D, YYYY') + ' - ' + date[1].format('MMMM D, YYYY') + ')</small>';
4203
+ const from = date[0];
4204
+ const to = date[1];
4205
+ const period = label.toString().toLowerCase().replaceAll(' ','_');
4206
+ emit('rangeSelected', {
4207
+ from: from,
4208
+ to: to,
4209
+ period: period,
4210
+ query: `from=${from.format('L')}&to=${to.format('L')}&period=${period}`
4211
+ });
4212
+ };
4213
+ vue.onMounted(() => {
4214
+ let end = parseInt(moment__default["default"]().format('Y'));
4215
+ while (end >= props.start) {
4216
+ dates.value.push({
4217
+ label: end,
4218
+ value: [moment__default["default"]('@/' + end).startOf('year'), moment__default["default"]('@/' + end).endOf('year')]
4219
+ });
4220
+ end--;
4221
+ }
4222
+
4223
+ dates.value.map(date=>{
4224
+ (`${date.label}`.toLowerCase() === props.selected.toLowerCase()) && setDate(date.value, date.label);
4225
+ });
4226
+ });
4227
+
4228
+ return (_ctx, _cache) => {
4229
+ return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
4230
+ vue.createElementVNode("div", _hoisted_2$6, [
4231
+ vue.createElementVNode("div", _hoisted_3$6, [
4232
+ _hoisted_4$6,
4233
+ vue.createTextVNode(),
4234
+ vue.createElementVNode("span", { innerHTML: rangeLabel.value }, null, 8 /* PROPS */, _hoisted_5$5)
4235
+ ]),
4236
+ vue.createElementVNode("div", _hoisted_6$4, [
4237
+ vue.createElementVNode("ul", _hoisted_7$3, [
4238
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(dates.value, (date) => {
4239
+ return (vue.openBlock(), vue.createElementBlock("li", {
4240
+ key: date.label,
4241
+ onClick: $event => (setDate(date.value, date.label))
4242
+ }, [
4243
+ vue.createElementVNode("a", {
4244
+ class: vue.normalizeClass(["dropdown-item", date.value === selectedDate.value ? 'active' : '']),
4245
+ href: "#"
4246
+ }, vue.toDisplayString(date.label), 3 /* TEXT, CLASS */)
4247
+ ], 8 /* PROPS */, _hoisted_8$3))
4248
+ }), 128 /* KEYED_FRAGMENT */))
4249
+ ]),
4250
+ vue.createElementVNode("ul", null, [
4251
+ vue.createElementVNode("li", _hoisted_9$3, [
4252
+ vue.createElementVNode("div", _hoisted_10$2, [
4253
+ _hoisted_11$2,
4254
+ vue.createElementVNode("div", null, [
4255
+ vue.withDirectives(vue.createElementVNode("input", {
4256
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((customFrom).value = $event)),
4257
+ type: "date"
4258
+ }, null, 512 /* NEED_PATCH */), [
4259
+ [vue.vModelText, customFrom.value]
4260
+ ]),
4261
+ vue.withDirectives(vue.createElementVNode("input", {
4262
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((customTo).value = $event)),
4263
+ type: "date"
4264
+ }, null, 512 /* NEED_PATCH */), [
4265
+ [vue.vModelText, customTo.value]
4266
+ ])
4267
+ ]),
4268
+ (customFrom.value && customTo.value)
4269
+ ? (vue.openBlock(), vue.createElementBlock("button", {
4270
+ key: 0,
4271
+ class: "btn btn-sm btn-info mt-1",
4272
+ onClick: applyCustom
4273
+ }, "Apply"))
4274
+ : vue.createCommentVNode("v-if", true)
4275
+ ])
4276
+ ])
4277
+ ])
4278
+ ])
4279
+ ])
4280
+ ]))
4281
+ }
4282
+ }
4283
+
4284
+ };
4285
+
4286
+ script$c.__file = "src/lib/components/ShRange.vue";
4287
+
4288
+ var script$b = {
4289
+ name: 'sh-table',
4290
+ props: ['endPoint', 'headers', 'query', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover', 'hideIds', 'paginationStyle', 'hasRange'],
4291
+ inject: ['channel'],
4292
+ data() {
4293
+ return {
4294
+ order_by: '',
4295
+ order_method: '',
4296
+ per_page: shRepo.getShConfig('tablePerPage', 10),
4297
+ page: 1,
4298
+ filter_value: '',
4299
+ loading: 'loading',
4300
+ loading_error: '',
4301
+ records: [],
4302
+ total: 0,
4303
+ pagination_data: null,
4304
+ moreDetailsId: null,
4305
+ moreDetailsModel: null,
4306
+ downloading: false,
4307
+ appUrl: window.VITE_APP_API_URL,
4308
+ hasCanvas: 0,
4309
+ selectedRecord: null,
4310
+ timeOut: null,
4311
+ tableHeaders: [],
4312
+ pageStyle: this.paginationStyle ?? shRepo.getShConfig('tablePaginationStyle', 'loadMore'),
4313
+ range: null,
4314
+ from: null,
4315
+ to: null,
4316
+ period: null
4185
4317
  }
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
4318
  },
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
- },
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);
4319
+ mounted() {
4320
+ if (this.headers) {
4321
+ this.tableHeaders = this.headers;
4240
4322
  }
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()
4323
+ if (this.event) ;
4324
+ if (this.actions && this.actions.actions) {
4325
+ this.actions.actions.forEach(action => {
4326
+ if (action.canvasComponent) {
4327
+ this.hasCanvas = true;
4328
+ }
4329
+ });
4253
4330
  }
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
4331
  },
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;
4332
+ methods: {
4333
+ rangeChanged: function (newRange) {
4334
+ this.range = newRange;
4335
+ this.from = newRange.from.format('L');
4336
+ this.to = newRange.to.format('L');
4337
+ this.period = newRange.period;
4338
+ this.reloadData();
4339
+ },
4340
+ userTyping: function () {
4341
+ if (this.timeOut) {
4342
+ clearTimeout(this.timeOut);
4343
+ }
4344
+ const self = this;
4345
+ this.timeOut = setTimeout(() => {
4346
+ self.reloadData(1);
4347
+ }, 800);
4348
+ },
4349
+ cleanCanvasProps: function (actions) {
4350
+ let replaced = actions;
4351
+ replaced.class = null;
4352
+ return replaced
4353
+ },
4354
+ newRecordAdded: function (ev) {
4355
+ const record = ev.log;
4356
+ if (record.user) {
4357
+ record.user = record.user.name;
4358
+ }
4359
+ this.records.unshift(record);
4360
+ },
4361
+ canvasClosed: function () {
4362
+ this.selectedRecord = null;
4363
+ },
4364
+ rowSelected: function (row) {
4365
+ this.selectedRecord = null;
4366
+ setTimeout(() => {
4367
+ this.selectedRecord = row;
4368
+ this.$emit('rowSelected', row);
4369
+ }, 100);
4370
+ },
4371
+ changeKey: function (key, value) {
4372
+ this[key] = value;
4373
+ if (key === 'order_by') {
4374
+ this.order_method = (this.order_method === 'desc') ? 'asc' : 'desc';
4375
+ }
4376
+ if (key === 'per_page') {
4377
+ this.page = 1;
4378
+ }
4379
+ this.reloadData();
4380
+ },
4381
+ getLinkClass: function (config) {
4382
+ if (typeof config === 'object') {
4383
+ return config.class
4384
+ }
4385
+ return ''
4386
+ },
4387
+ reloadNotifications: function () {
4388
+ this.reloadData();
4389
+ },
4390
+ replaceActionUrl: function (path, obj) {
4391
+ if (path) {
4392
+ var matches = path.match(/\{(.*?)\}/g);
4393
+ try {
4394
+ matches.forEach(key => {
4395
+ key = key.replace('{', '');
4396
+ key = key.replace('}', '');
4397
+ path = path.replace(`{${key}}`, obj[key]);
4398
+ });
4399
+ return path
4400
+ } catch (e) {
4401
+ return path
4402
+ }
4403
+ }
4404
+ return ''
4405
+ },
4406
+ doEmitAction: function (action, data) {
4407
+ if (typeof action === 'function') {
4408
+ action(data);
4409
+ } else {
4410
+ this.$emit(action, data);
4411
+ }
4412
+ },
4413
+ getFieldType: function (field) {
4414
+ const numbers = ['age', 'interest_rate_pa'];
4415
+ const moneys = ['amount', 'paid_amount', 'total_paid', 'total', 'monthly_fee', 'share_cost', 'min_contribution', 'min_membership_contribution'];
4416
+ const dates = ['invoice_date', 'free_tier_days', 'updated_at', 'created_at', 'end_time'];
4417
+ if (numbers.includes(field)) {
4418
+ return 'numeric'
4419
+ }
4420
+ if (moneys.includes(field)) {
4421
+ return 'money'
4422
+ }
4423
+ if (dates.includes(field)) {
4424
+ return 'date'
4425
+ }
4426
+ return 'string'
4427
+ },
4428
+ replaceLinkUrl: function (path, obj) {
4429
+ if (typeof path === 'object') {
4430
+ path = path.link ?? path.url;
4431
+ }
4432
+ var matches = path.match(/\{(.*?)\}/g);
4433
+ matches && matches.forEach(key => {
4434
+ key = key.replace('{', '');
4435
+ key = key.replace('}', '');
4436
+ path = path.replace(`{${key}}`, obj[key]);
4437
+ });
4438
+ return path
4439
+ },
4440
+ formatDate: function (date) {
4441
+ return moment__default["default"](date).format('lll')
4442
+ },
4443
+ setMoreDetailsModel: function (row) {
4444
+ this.moreDetailsModel = null;
4445
+ this.moreDetailsModel = row;
4446
+ },
4447
+ loadMoreRecords: function () {
4448
+ this.reloadData(this.page + 1, 1);
4449
+ },
4450
+ exportData: function (template) {
4451
+ this.downloading = true;
4452
+ const headers = [];
4453
+ const fields = this.downloadFields ? this.downloadFields : this.headers;
4454
+ fields.forEach(header => {
4455
+ if (typeof header === 'string') {
4456
+ headers.push(header);
4457
+ }
4458
+ });
4459
+ const data = {
4460
+ titles: headers,
4461
+ export: 1
4462
+ };
4463
+ shApis.doPost(this.endPoint, data).then(res => {
4464
+ this.downloading = false;
4465
+ if (res.data.file) {
4466
+ const url = this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name;
4467
+ window.location.href = url;
4468
+ // window.open('https://facebook.com')
4469
+ // window.open(this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name, '_blank').focus()
4470
+ }
4471
+ }).catch(reason => {
4472
+ this.downloading = false;
4473
+ const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText}`;
4474
+ shRepo.swalError('Error', error);
4475
+ });
4476
+ },
4477
+ reloadData: function (page, append) {
4478
+ if (typeof page !== 'undefined') {
4479
+ this.page = page;
4480
+ }
4481
+ if (!append) {
4482
+ this.loading = 'loading';
4483
+ }
4484
+ const data = {
4485
+ order_by: this.order_by,
4486
+ order_method: this.order_method,
4487
+ per_page: this.per_page,
4488
+ page: this.page,
4489
+ filter_value: this.filter_value,
4490
+ paginated: true,
4491
+ from: this.from,
4492
+ to: this.to,
4493
+ period: this.period
4494
+ };
4495
+ if (this.pagination_data) {
4496
+ this.pagination_data.loading = 1;
4497
+ }
4498
+ let endPoint = this.endPoint;
4499
+ if (!this.endPoint && this.query) {
4500
+ //send ql query
4501
+ endPoint = 'sh-ql';
4502
+ data.query = this.query;
4503
+ }
4504
+ console.log(endPoint, this.range);
4505
+ shApis.doGet(endPoint, data).then(req => {
4506
+ this.$emit('dataReloaded', this.pagination_data);
4507
+ this.loading = 'done';
4508
+ const response = req.data.data;
4509
+ this.pagination_data = {
4510
+ current: response.current_page,
4511
+ start: response.from,
4512
+ end: response.last_page,
4513
+ record_count: response.total,
4514
+ per_page: response.per_page,
4515
+ loading: 0,
4516
+ displayCount: response.total > response.per_page ? response.per_page : response.total
4517
+ };
4518
+ if (!this.headers && response.total > 0) {
4519
+ this.tableHeaders = Object.keys(response.data[0]);
4520
+ }
4521
+ if (append) {
4522
+ this.records.push(...response.data);
4523
+ let totalShown = response.total > response.per_page ? response.per_page * response.current_page : response.total;
4524
+ if (totalShown > response.total) {
4525
+ totalShown = response.total;
4526
+ }
4527
+ this.pagination_data.displayCount = totalShown;
4528
+ const scrollingElement = (document.scrollingElement || document.body);
4529
+ scrollingElement.scrollTop = scrollingElement.scrollHeight;
4530
+ } else {
4531
+ this.records = response.data;
4532
+ }
4533
+ }).catch(reason => {
4534
+ const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText} (${this.endPoint})`;
4535
+ this.loading_error = error;
4536
+ this.loading = 'error';
4537
+ });
4311
4538
  }
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
4539
  },
4326
- reload () {
4327
- this.reloadData();
4328
- },
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
4540
+ watch: {
4541
+ hideIds: {
4542
+ handler(newValue) {
4543
+ this.records = this.records.filter(record => !newValue.includes(record.id) && record);
4544
+ },
4545
+ deep: true
4546
+ },
4547
+ reload() {
4548
+ this.reloadData();
4549
+ },
4550
+ endPoint() {
4551
+ this.reloadData();
4552
+ }
4345
4553
  },
4346
- user () {
4347
- return null
4554
+ created() {
4555
+ this.reloadData();
4348
4556
  },
4349
- hasDefaultSlot () {
4350
- return !!this.$slots.default
4557
+ components: {
4558
+ ShRange: script$c,
4559
+ ShSilentAction: script$d,
4560
+ ShConfirmAction: script$e,
4561
+ ShCanvas: script$g,
4562
+ pagination: script$f
4351
4563
  },
4352
- hasRecordsSlot () {
4353
- return !!this.$slots.records
4564
+ computed: {
4565
+ windowWidth: function () {
4566
+ return window.innerWidth
4567
+ },
4568
+ user() {
4569
+ return null
4570
+ },
4571
+ hasDefaultSlot() {
4572
+ return !!this.$slots.default
4573
+ },
4574
+ hasRecordsSlot() {
4575
+ return !!this.$slots.records
4576
+ }
4354
4577
  }
4355
- }
4356
4578
  };
4357
4579
 
4358
- const _hoisted_1$9 = { class: "auto-table mt-2" };
4359
- const _hoisted_2$6 = {
4580
+ const _hoisted_1$8 = { class: "auto-table mt-2" };
4581
+ const _hoisted_2$5 = {
4360
4582
  key: 0,
4361
4583
  class: "col-md-4 mb-2"
4362
4584
  };
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", {
4585
+ const _hoisted_3$5 = ["disabled"];
4586
+ const _hoisted_4$5 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */);
4587
+ const _hoisted_5$4 = /*#__PURE__*/vue.createElementVNode("span", {
4366
4588
  class: "spinner-border spinner-border-sm",
4367
4589
  role: "status",
4368
4590
  "aria-hidden": "true"
4369
4591
  }, null, -1 /* HOISTED */);
4370
- const _hoisted_6$4 = /*#__PURE__*/vue.createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* HOISTED */);
4371
- const _hoisted_7$3 = {
4592
+ const _hoisted_6$3 = /*#__PURE__*/vue.createElementVNode("span", { class: "visually-hidden" }, "Loading...", -1 /* HOISTED */);
4593
+ const _hoisted_7$2 = {
4372
4594
  key: 1,
4373
4595
  class: "row"
4374
4596
  };
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"];
4597
+ const _hoisted_8$2 = { class: "col-12 mb-3 d-flex justify-content-start" };
4598
+ const _hoisted_9$2 = {
4599
+ key: 0,
4600
+ class: "sh-range-selector"
4601
+ };
4602
+ const _hoisted_10$1 = ["placeholder"];
4378
4603
  const _hoisted_11$1 = {
4379
4604
  key: 0,
4380
4605
  class: "text-center"
@@ -4512,15 +4737,16 @@ const _hoisted_64 = ["href"];
4512
4737
  const _hoisted_65 = ["title", "onClick"];
4513
4738
 
4514
4739
  function render(_ctx, _cache, $props, $setup, $data, $options) {
4740
+ const _component_sh_range = vue.resolveComponent("sh-range");
4515
4741
  const _component_router_link = vue.resolveComponent("router-link");
4516
4742
  const _component_sh_confirm_action = vue.resolveComponent("sh-confirm-action");
4517
4743
  const _component_sh_silent_action = vue.resolveComponent("sh-silent-action");
4518
4744
  const _component_pagination = vue.resolveComponent("pagination");
4519
4745
  const _component_sh_canvas = vue.resolveComponent("sh-canvas");
4520
4746
 
4521
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
4747
+ return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
4522
4748
  ($props.hasDownload)
4523
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$6, [
4749
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$5, [
4524
4750
  vue.createElementVNode("button", {
4525
4751
  disabled: $data.downloading,
4526
4752
  class: "btn btn-warning btn-sm",
@@ -4528,20 +4754,27 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
4528
4754
  }, [
4529
4755
  (!$data.downloading)
4530
4756
  ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
4531
- _hoisted_4$6,
4757
+ _hoisted_4$5,
4532
4758
  vue.createTextVNode(" Export ")
4533
4759
  ], 64 /* STABLE_FRAGMENT */))
4534
4760
  : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
4535
- _hoisted_5$5,
4536
- _hoisted_6$4
4761
+ _hoisted_5$4,
4762
+ _hoisted_6$3
4537
4763
  ], 64 /* STABLE_FRAGMENT */))
4538
- ], 8 /* PROPS */, _hoisted_3$6)
4764
+ ], 8 /* PROPS */, _hoisted_3$5)
4539
4765
  ]))
4540
4766
  : vue.createCommentVNode("v-if", true),
4541
4767
  (!$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, [
4768
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$2, [
4769
+ vue.createElementVNode("div", _hoisted_8$2, [
4770
+ ($props.hasRange)
4771
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$2, [
4772
+ vue.createVNode(_component_sh_range, { onRangeSelected: $options.rangeChanged }, null, 8 /* PROPS */, ["onRangeSelected"])
4773
+ ]))
4774
+ : vue.createCommentVNode("v-if", true),
4775
+ vue.createElementVNode("div", {
4776
+ class: vue.normalizeClass(["sh-search-bar", $props.hasRange ? 'ms-2':''])
4777
+ }, [
4545
4778
  vue.withDirectives(vue.createElementVNode("input", {
4546
4779
  onKeydown: _cache[1] || (_cache[1] = (...args) => ($options.userTyping && $options.userTyping(...args))),
4547
4780
  onKeyup: _cache[2] || (_cache[2] = (...args) => ($options.userTyping && $options.userTyping(...args))),
@@ -4550,10 +4783,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
4550
4783
  "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => (($data.filter_value) = $event)),
4551
4784
  placeholder: $props.searchPlaceholder ? $props.searchPlaceholder : 'Search',
4552
4785
  class: "form-control sh-search-input"
4553
- }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_10$2), [
4786
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_10$1), [
4554
4787
  [vue.vModelText, $data.filter_value]
4555
4788
  ])
4556
- ])
4789
+ ], 2 /* CLASS */)
4557
4790
  ])
4558
4791
  ]))
4559
4792
  : vue.createCommentVNode("v-if", true),
@@ -4971,10 +5204,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
4971
5204
  ]))
4972
5205
  }
4973
5206
 
4974
- script$c.render = render;
4975
- script$c.__file = "src/lib/components/ShTable.vue";
5207
+ script$b.render = render;
5208
+ script$b.__file = "src/lib/components/ShTable.vue";
4976
5209
 
4977
- var script$b = {
5210
+ var script$a = {
4978
5211
  __name: 'ShTabs',
4979
5212
  props: {
4980
5213
  tabs: {
@@ -5119,18 +5352,18 @@ return (_ctx, _cache) => {
5119
5352
 
5120
5353
  };
5121
5354
 
5122
- script$b.__file = "src/lib/components/ShTabs.vue";
5355
+ script$a.__file = "src/lib/components/ShTabs.vue";
5123
5356
 
5124
- const _hoisted_1$8 = {
5357
+ const _hoisted_1$7 = {
5125
5358
  class: "nav-item",
5126
5359
  role: "presentation"
5127
5360
  };
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" };
5361
+ const _hoisted_2$4 = ["onClick"];
5362
+ const _hoisted_3$4 = /*#__PURE__*/vue.createElementVNode("i", { class: "d-none" }, null, -1 /* HOISTED */);
5363
+ const _hoisted_4$4 = { class: "sh_tab_count" };
5364
+ const _hoisted_5$3 = { class: "tab-content" };
5132
5365
 
5133
- var script$a = {
5366
+ var script$9 = {
5134
5367
  __name: 'ShDynamicTabs',
5135
5368
  props: ['tabs','data','classes'],
5136
5369
  setup(__props) {
@@ -5160,7 +5393,7 @@ return (_ctx, _cache) => {
5160
5393
  role: "tablist"
5161
5394
  }, [
5162
5395
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(tabs), (tab) => {
5163
- return (vue.openBlock(), vue.createElementBlock("li", _hoisted_1$8, [
5396
+ return (vue.openBlock(), vue.createElementBlock("li", _hoisted_1$7, [
5164
5397
  vue.createElementVNode("button", {
5165
5398
  onClick: $event => (setTab(tab)),
5166
5399
  class: vue.normalizeClass(["nav-link", vue.unref(currentTab) === tab ? 'active':''])
@@ -5168,15 +5401,15 @@ return (_ctx, _cache) => {
5168
5401
  vue.createTextVNode(vue.toDisplayString(tab.label) + " ", 1 /* TEXT */),
5169
5402
  (tab.count || tab.tabCount)
5170
5403
  ? (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 */)
5404
+ _hoisted_3$4,
5405
+ vue.createElementVNode("sup", _hoisted_4$4, vue.toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
5173
5406
  ], 64 /* STABLE_FRAGMENT */))
5174
5407
  : vue.createCommentVNode("v-if", true)
5175
- ], 10 /* CLASS, PROPS */, _hoisted_2$5)
5408
+ ], 10 /* CLASS, PROPS */, _hoisted_2$4)
5176
5409
  ]))
5177
5410
  }), 256 /* UNKEYED_FRAGMENT */))
5178
5411
  ], 2 /* CLASS */),
5179
- vue.createElementVNode("div", _hoisted_5$4, [
5412
+ vue.createElementVNode("div", _hoisted_5$3, [
5180
5413
  (vue.unref(currentTab))
5181
5414
  ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(currentTab).component), vue.normalizeProps(vue.mergeProps({ key: 0 }, vue.unref(currentTab))), null, 16 /* FULL_PROPS */))
5182
5415
  : vue.createCommentVNode("v-if", true)
@@ -5187,12 +5420,12 @@ return (_ctx, _cache) => {
5187
5420
 
5188
5421
  };
5189
5422
 
5190
- script$a.__file = "src/lib/components/ShDynamicTabs.vue";
5423
+ script$9.__file = "src/lib/components/ShDynamicTabs.vue";
5191
5424
 
5192
- const _hoisted_1$7 = ["href"];
5425
+ const _hoisted_1$6 = ["href"];
5193
5426
 
5194
5427
 
5195
- var script$9 = {
5428
+ var script$8 = {
5196
5429
  __name: 'ShModalBtn',
5197
5430
  props: {
5198
5431
  modalId: {
@@ -5209,18 +5442,18 @@ return (_ctx, _cache) => {
5209
5442
  "data-bs-toggle": "modal"
5210
5443
  }, [
5211
5444
  vue.renderSlot(_ctx.$slots, "default")
5212
- ], 8 /* PROPS */, _hoisted_1$7))
5445
+ ], 8 /* PROPS */, _hoisted_1$6))
5213
5446
  }
5214
5447
  }
5215
5448
 
5216
5449
  };
5217
5450
 
5218
- script$9.__file = "src/lib/components/ShModalBtn.vue";
5451
+ script$8.__file = "src/lib/components/ShModalBtn.vue";
5219
5452
 
5220
- const _hoisted_1$6 = ["href"];
5453
+ const _hoisted_1$5 = ["href"];
5221
5454
 
5222
5455
 
5223
- var script$8 = {
5456
+ var script$7 = {
5224
5457
  __name: 'ShCanvasBtn',
5225
5458
  props: {
5226
5459
  canvasId: {
@@ -5238,13 +5471,13 @@ return (_ctx, _cache) => {
5238
5471
  "data-bs-toggle": "offcanvas"
5239
5472
  }, [
5240
5473
  vue.renderSlot(_ctx.$slots, "default")
5241
- ], 8 /* PROPS */, _hoisted_1$6))
5474
+ ], 8 /* PROPS */, _hoisted_1$5))
5242
5475
  }
5243
5476
  }
5244
5477
 
5245
5478
  };
5246
5479
 
5247
- script$8.__file = "src/lib/components/ShCanvasBtn.vue";
5480
+ script$7.__file = "src/lib/components/ShCanvasBtn.vue";
5248
5481
 
5249
5482
  const useUserStore = pinia.defineStore('user-store', {
5250
5483
  state: () => ({
@@ -5343,30 +5576,30 @@ const useUserStore = pinia.defineStore('user-store', {
5343
5576
  });
5344
5577
 
5345
5578
  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 = {
5579
+ const _hoisted_1$4 = { class: "row permissions-main d-flex" };
5580
+ const _hoisted_2$3 = {
5348
5581
  id: "permissions-nav",
5349
5582
  class: "col-md-3 d-flex align-items-center py-4"
5350
5583
  };
5351
- const _hoisted_3$4 = {
5584
+ const _hoisted_3$3 = {
5352
5585
  key: 0,
5353
5586
  class: "mx-auto"
5354
5587
  };
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
5588
+ const _hoisted_4$3 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/vue.createElementVNode("span", { class: "spinner-grow mx-auto" }, null, -1 /* HOISTED */));
5589
+ const _hoisted_5$2 = [
5590
+ _hoisted_4$3
5358
5591
  ];
5359
- const _hoisted_6$3 = {
5592
+ const _hoisted_6$2 = {
5360
5593
  key: 1,
5361
5594
  class: "d-flex flex-column w-100 px-2"
5362
5595
  };
5363
- const _hoisted_7$2 = ["checked", "onClick", "disabled"];
5364
- const _hoisted_8$2 = ["onClick"];
5365
- const _hoisted_9$2 = {
5596
+ const _hoisted_7$1 = ["checked", "onClick", "disabled"];
5597
+ const _hoisted_8$1 = ["onClick"];
5598
+ const _hoisted_9$1 = {
5366
5599
  id: "permissions-content",
5367
5600
  class: "col-md-9 py-4 px-4"
5368
5601
  };
5369
- const _hoisted_10$1 = { class: "p-2 rounded-2 bg-white h-100" };
5602
+ const _hoisted_10 = { class: "p-2 rounded-2 bg-white h-100" };
5370
5603
  const _hoisted_11 = {
5371
5604
  key: 0,
5372
5605
  class: "alert alert-info"
@@ -5383,7 +5616,7 @@ const _hoisted_17 = { class: "col-md-3" };
5383
5616
  const _hoisted_18 = /*#__PURE__*/ _withScopeId$1(() => /*#__PURE__*/vue.createElementVNode("i", { class: "bi-check" }, null, -1 /* HOISTED */));
5384
5617
 
5385
5618
 
5386
- var script$7 = {
5619
+ var script$6 = {
5387
5620
  __name: 'ManagePermissions',
5388
5621
  emits: ['success'],
5389
5622
  setup(__props, { emit }) {
@@ -5487,11 +5720,11 @@ const getPermissionStyle = permission => {
5487
5720
  };
5488
5721
 
5489
5722
  return (_ctx, _cache) => {
5490
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
5491
- vue.createElementVNode("div", _hoisted_2$4, [
5723
+ return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
5724
+ vue.createElementVNode("div", _hoisted_2$3, [
5492
5725
  (loadingModules.value)
5493
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$4, _hoisted_5$3))
5494
- : (vue.openBlock(), vue.createElementBlock("ul", _hoisted_6$3, [
5726
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, _hoisted_5$2))
5727
+ : (vue.openBlock(), vue.createElementBlock("ul", _hoisted_6$2, [
5495
5728
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(modules.value, (module) => {
5496
5729
  return (vue.openBlock(), vue.createElementBlock("li", {
5497
5730
  class: vue.normalizeClass(selectedModule.value === module && 'active'),
@@ -5502,17 +5735,17 @@ return (_ctx, _cache) => {
5502
5735
  onClick: $event => (checkAllPermissions(module)),
5503
5736
  disabled: selectedModule.value !== module,
5504
5737
  type: "checkbox"
5505
- }, null, 8 /* PROPS */, _hoisted_7$2),
5738
+ }, null, 8 /* PROPS */, _hoisted_7$1),
5506
5739
  vue.createElementVNode("label", {
5507
5740
  class: "text-capitalize",
5508
5741
  onClick: $event => (setModule(module))
5509
- }, vue.toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_8$2)
5742
+ }, vue.toDisplayString(module.replaceAll('_',' ')), 9 /* TEXT, PROPS */, _hoisted_8$1)
5510
5743
  ], 2 /* CLASS */))
5511
5744
  }), 128 /* KEYED_FRAGMENT */))
5512
5745
  ]))
5513
5746
  ]),
5514
- vue.createElementVNode("div", _hoisted_9$2, [
5515
- vue.createElementVNode("div", _hoisted_10$1, [
5747
+ vue.createElementVNode("div", _hoisted_9$1, [
5748
+ vue.createElementVNode("div", _hoisted_10, [
5516
5749
  (loading.value)
5517
5750
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11, " loading ... "))
5518
5751
  : (vue.openBlock(), vue.createElementBlock("div", _hoisted_12, [
@@ -5565,13 +5798,13 @@ return (_ctx, _cache) => {
5565
5798
 
5566
5799
  };
5567
5800
 
5568
- script$7.__scopeId = "data-v-0d4fa0ac";
5569
- script$7.__file = "src/lib/components/core/Departments/department/ManagePermissions.vue";
5801
+ script$6.__scopeId = "data-v-0d4fa0ac";
5802
+ script$6.__file = "src/lib/components/core/Departments/department/ManagePermissions.vue";
5570
5803
 
5571
- const _hoisted_1$4 = ["href"];
5804
+ const _hoisted_1$3 = ["href"];
5572
5805
 
5573
5806
 
5574
- var script$6 = {
5807
+ var script$5 = {
5575
5808
  __name: 'ShRoutePopups',
5576
5809
  setup(__props) {
5577
5810
 
@@ -5652,13 +5885,15 @@ return (_ctx, _cache) => {
5652
5885
  href: '#' + vue.unref(canvasId),
5653
5886
  shallowRef: "canvasButton",
5654
5887
  class: "d-none"
5655
- }, "Open Modal", 8 /* PROPS */, _hoisted_1$4),
5888
+ }, "Open Modal", 8 /* PROPS */, _hoisted_1$3),
5656
5889
  (popUp.value === 'modal')
5657
5890
  ? (vue.openBlock(), vue.createBlock(script$j, {
5658
5891
  key: 0,
5659
5892
  "modal-title": title.value,
5660
5893
  "modal-id": vue.unref(modalId),
5661
- "modal-size": size.value
5894
+ "modal-size": size.value,
5895
+ "data-bs-backdrop": "static",
5896
+ "data-bs-keyboard": "false"
5662
5897
  }, {
5663
5898
  default: vue.withCtx(() => [
5664
5899
  (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(componentView.value)))
@@ -5686,9 +5921,9 @@ return (_ctx, _cache) => {
5686
5921
 
5687
5922
  };
5688
5923
 
5689
- script$6.__file = "src/lib/components/popups/ShRoutePopups.vue";
5924
+ script$5.__file = "src/lib/components/popups/ShRoutePopups.vue";
5690
5925
 
5691
- var script$5 = {
5926
+ var script$4 = {
5692
5927
  __name: 'ShQueryForm',
5693
5928
  setup(__props) {
5694
5929
 
@@ -5707,9 +5942,9 @@ return (_ctx, _cache) => {
5707
5942
 
5708
5943
  };
5709
5944
 
5710
- script$5.__file = "src/lib/components/ShQueryForm.vue";
5945
+ script$4.__file = "src/lib/components/ShQueryForm.vue";
5711
5946
 
5712
- var script$4 = {
5947
+ var script$3 = {
5713
5948
  __name: 'ShQueryPopups',
5714
5949
  setup(__props) {
5715
5950
 
@@ -5732,7 +5967,7 @@ vue.watch(() => route.query.popup, pop => {
5732
5967
  title.value = route.query.title;
5733
5968
  let queryComponent = route.query.comp ?? route.query.component;
5734
5969
  if(queryComponent && ['shqueryform','queryform'].includes(queryComponent.toLowerCase())) {
5735
- queryComponent = script$5;
5970
+ queryComponent = script$4;
5736
5971
  }
5737
5972
  popupComponent.value = queryComponent;
5738
5973
  if (popUp.value) {
@@ -5782,9 +6017,17 @@ const initPopup = () => {
5782
6017
  const goBack = () => {
5783
6018
  if (route.matched.length) {
5784
6019
  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);
6020
+ const params = route.query;
6021
+ let query = '?';
6022
+ // console.log(params)
6023
+ Object.keys(params).map(key => {
6024
+ const removeKeys = ['popup','comp','component'];
6025
+ if(!removeKeys.includes(key)) {
6026
+ query += `${key}=${params[key]}&`;
6027
+ }
6028
+ });
6029
+ console.log(query);
6030
+ router.push(backUrl + query);
5788
6031
  }
5789
6032
  };
5790
6033
 
@@ -5794,6 +6037,8 @@ return (_ctx, _cache) => {
5794
6037
  ? (vue.openBlock(), vue.createBlock(script$j, {
5795
6038
  key: 0,
5796
6039
  "modal-title": title.value,
6040
+ "data-bs-backdrop": "static",
6041
+ "data-bs-keyboard": "false",
5797
6042
  "modal-id": vue.unref(modalId),
5798
6043
  "modal-size": size.value
5799
6044
  }, {
@@ -5823,188 +6068,7 @@ return (_ctx, _cache) => {
5823
6068
 
5824
6069
  };
5825
6070
 
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";
6071
+ script$3.__file = "src/lib/components/popups/ShQueryPopups.vue";
6008
6072
 
6009
6073
  const useAppStore = pinia.defineStore('sh-app',{
6010
6074
  state: ()=>{
@@ -6070,7 +6134,7 @@ return (_ctx, _cache) => {
6070
6134
  _hoisted_4$2,
6071
6135
  vue.createTextVNode(" ADD DEPARTMENT")
6072
6136
  ], 512 /* NEED_PATCH */),
6073
- vue.createVNode(script$c, {
6137
+ vue.createVNode(script$b, {
6074
6138
  reload: vue.unref(reload),
6075
6139
  headers: ['id','name','description', 'created_at'],
6076
6140
  "end-point": "sh-departments/list",
@@ -6230,7 +6294,7 @@ return (_ctx, _cache) => {
6230
6294
  vue.createElementVNode("div", _hoisted_2$1, [
6231
6295
  _hoisted_3$1,
6232
6296
  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, {
6297
+ vue.createVNode(script$b, {
6234
6298
  actions: {
6235
6299
  label: 'Actions',
6236
6300
  actions: [
@@ -6497,7 +6561,7 @@ const ShFrontend = {
6497
6561
  });
6498
6562
  options.router.addRoute({
6499
6563
  path: '/sh-departments/manage-permissions/:id',
6500
- component: script$7
6564
+ component: script$6
6501
6565
  });
6502
6566
  }
6503
6567
  //filter unwanted config items from options to be put in local storage
@@ -6523,26 +6587,26 @@ var shGql = {
6523
6587
  };
6524
6588
 
6525
6589
  exports.Countries = countries;
6526
- exports.ManagePermissions = script$7;
6590
+ exports.ManagePermissions = script$6;
6527
6591
  exports.ShAutoForm = script$l;
6528
6592
  exports.ShCanvas = script$g;
6529
- exports.ShCanvasBtn = script$8;
6593
+ exports.ShCanvasBtn = script$7;
6530
6594
  exports.ShConfirmAction = script$e;
6531
6595
  exports.ShDropDownForm = script$k;
6532
- exports.ShDynamicTabs = script$a;
6596
+ exports.ShDynamicTabs = script$9;
6533
6597
  exports.ShForm = script$s;
6534
6598
  exports.ShFrontend = ShFrontend;
6535
6599
  exports.ShModal = script$j;
6536
- exports.ShModalBtn = script$9;
6600
+ exports.ShModalBtn = script$8;
6537
6601
  exports.ShModalForm = script$i;
6538
6602
  exports.ShModalFormAuto = script$h;
6539
6603
  exports.ShPhone = script$u;
6540
- exports.ShQueryPopups = script$4;
6541
- exports.ShRange = script$3;
6542
- exports.ShRoutePopups = script$6;
6604
+ exports.ShQueryPopups = script$3;
6605
+ exports.ShRange = script$c;
6606
+ exports.ShRoutePopups = script$5;
6543
6607
  exports.ShSilentAction = script$d;
6544
- exports.ShTable = script$c;
6545
- exports.ShTabs = script$b;
6608
+ exports.ShTable = script$b;
6609
+ exports.ShTabs = script$a;
6546
6610
  exports.shApis = shApis;
6547
6611
  exports.shGql = shGql;
6548
6612
  exports.shRepo = shRepo;