@iankibetsh/shframework 0.0.1

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.
@@ -0,0 +1,3386 @@
1
+ import Axios from 'axios';
2
+ import NProgress from 'nprogress';
3
+ import { openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, resolveComponent, normalizeClass, createBlock, renderSlot, createStaticVNode, withCtx, pushScopeId, popScopeId, createVNode } from 'vue';
4
+ import moment from 'moment';
5
+ import Swal from 'sweetalert2';
6
+
7
+ function setItem (key, value) {
8
+ let toStore = value;
9
+ if (typeof value === 'object') {
10
+ toStore = JSON.stringify(value);
11
+ }
12
+ return localStorage.setItem(key, toStore)
13
+ }
14
+
15
+ function getItem (key) {
16
+ return localStorage.getItem(key)
17
+ }
18
+ function removeItem (key) {
19
+ return localStorage.removeItem(key)
20
+ }
21
+ var shstorage = {
22
+ setItem,
23
+ getItem,
24
+ removeItem
25
+ };
26
+
27
+ let apiUrl = import.meta.env.VITE_APP_API_URL;
28
+ if (process.env.NODE_ENV === 'production') {
29
+ apiUrl = import.meta.env.VITE_APP_API_PRODUCTION_URL;
30
+ }
31
+ const axios = Axios.create({
32
+ baseURL: apiUrl
33
+ });
34
+ function doGet (endPoint, data) {
35
+ return axios.get(endPoint, {
36
+ params: data,
37
+ crossOrigin: true,
38
+ headers: {
39
+ Authorization: 'Bearer ' + shstorage.getItem('access_token')
40
+ // 'X-CSRF-TOKEN': 'INVALID'
41
+ }
42
+ })
43
+ }
44
+ function doPost (endPoint, data) {
45
+ return axios.post(endPoint,
46
+ data,
47
+ {
48
+ headers: {
49
+ Authorization: 'Bearer ' + shstorage.getItem('access_token')
50
+ }
51
+ }
52
+ )
53
+ }
54
+
55
+ var apis = {
56
+ doGet,
57
+ doPost
58
+ };
59
+
60
+ const countries = [
61
+ {
62
+ name: 'Afghanistan',
63
+ dialCode: '+93',
64
+ isoCode: 'AF',
65
+ flag: 'https://www.countryflags.io/AF/flat/64.png'
66
+ },
67
+ {
68
+ name: 'Aland Islands',
69
+ dialCode: '+358',
70
+ isoCode: 'AX',
71
+ flag: 'https://www.countryflags.io/AX/flat/64.png'
72
+ },
73
+ {
74
+ name: 'Albania',
75
+ dialCode: '+355',
76
+ isoCode: 'AL',
77
+ flag: 'https://www.countryflags.io/AL/flat/64.png'
78
+ },
79
+ {
80
+ name: 'Algeria',
81
+ dialCode: '+213',
82
+ isoCode: 'DZ',
83
+ flag: 'https://www.countryflags.io/DZ/flat/64.png'
84
+ },
85
+ {
86
+ name: 'AmericanSamoa',
87
+ dialCode: '+1684',
88
+ isoCode: 'AS',
89
+ flag: 'https://www.countryflags.io/AS/flat/64.png'
90
+ },
91
+ {
92
+ name: 'Andorra',
93
+ dialCode: '+376',
94
+ isoCode: 'AD',
95
+ flag: 'https://www.countryflags.io/AD/flat/64.png'
96
+ },
97
+ {
98
+ name: 'Angola',
99
+ dialCode: '+244',
100
+ isoCode: 'AO',
101
+ flag: 'https://www.countryflags.io/AO/flat/64.png'
102
+ },
103
+ {
104
+ name: 'Anguilla',
105
+ dialCode: '+1264',
106
+ isoCode: 'AI',
107
+ flag: 'https://www.countryflags.io/AI/flat/64.png'
108
+ },
109
+ {
110
+ name: 'Antarctica',
111
+ dialCode: '+672',
112
+ isoCode: 'AQ',
113
+ flag: 'https://www.countryflags.io/AQ/flat/64.png'
114
+ },
115
+ {
116
+ name: 'Antigua and Barbuda',
117
+ dialCode: '+1268',
118
+ isoCode: 'AG',
119
+ flag: 'https://www.countryflags.io/AG/flat/64.png'
120
+ },
121
+ {
122
+ name: 'Argentina',
123
+ dialCode: '+54',
124
+ isoCode: 'AR',
125
+ flag: 'https://www.countryflags.io/AR/flat/64.png'
126
+ },
127
+ {
128
+ name: 'Armenia',
129
+ dialCode: '+374',
130
+ isoCode: 'AM',
131
+ flag: 'https://www.countryflags.io/AM/flat/64.png'
132
+ },
133
+ {
134
+ name: 'Aruba',
135
+ dialCode: '+297',
136
+ isoCode: 'AW',
137
+ flag: 'https://www.countryflags.io/AW/flat/64.png'
138
+ },
139
+ {
140
+ name: 'Ascension Island',
141
+ dialCode: '+247',
142
+ isoCode: 'AC',
143
+ flag: 'https://cdn.kcak11.com/flags/AC_64.png'
144
+ },
145
+ {
146
+ name: 'Australia',
147
+ dialCode: '+61',
148
+ isoCode: 'AU',
149
+ flag: 'https://www.countryflags.io/AU/flat/64.png'
150
+ },
151
+ {
152
+ name: 'Austria',
153
+ dialCode: '+43',
154
+ isoCode: 'AT',
155
+ flag: 'https://www.countryflags.io/AT/flat/64.png'
156
+ },
157
+ {
158
+ name: 'Azerbaijan',
159
+ dialCode: '+994',
160
+ isoCode: 'AZ',
161
+ flag: 'https://www.countryflags.io/AZ/flat/64.png'
162
+ },
163
+ {
164
+ name: 'Bahamas',
165
+ dialCode: '+1242',
166
+ isoCode: 'BS',
167
+ flag: 'https://www.countryflags.io/BS/flat/64.png'
168
+ },
169
+ {
170
+ name: 'Bahrain',
171
+ dialCode: '+973',
172
+ isoCode: 'BH',
173
+ flag: 'https://www.countryflags.io/BH/flat/64.png'
174
+ },
175
+ {
176
+ name: 'Bangladesh',
177
+ dialCode: '+880',
178
+ isoCode: 'BD',
179
+ flag: 'https://www.countryflags.io/BD/flat/64.png'
180
+ },
181
+ {
182
+ name: 'Barbados',
183
+ dialCode: '+1246',
184
+ isoCode: 'BB',
185
+ flag: 'https://www.countryflags.io/BB/flat/64.png'
186
+ },
187
+ {
188
+ name: 'Belarus',
189
+ dialCode: '+375',
190
+ isoCode: 'BY',
191
+ flag: 'https://www.countryflags.io/BY/flat/64.png'
192
+ },
193
+ {
194
+ name: 'Belgium',
195
+ dialCode: '+32',
196
+ isoCode: 'BE',
197
+ flag: 'https://www.countryflags.io/BE/flat/64.png'
198
+ },
199
+ {
200
+ name: 'Belize',
201
+ dialCode: '+501',
202
+ isoCode: 'BZ',
203
+ flag: 'https://www.countryflags.io/BZ/flat/64.png'
204
+ },
205
+ {
206
+ name: 'Benin',
207
+ dialCode: '+229',
208
+ isoCode: 'BJ',
209
+ flag: 'https://www.countryflags.io/BJ/flat/64.png'
210
+ },
211
+ {
212
+ name: 'Bermuda',
213
+ dialCode: '+1441',
214
+ isoCode: 'BM',
215
+ flag: 'https://www.countryflags.io/BM/flat/64.png'
216
+ },
217
+ {
218
+ name: 'Bhutan',
219
+ dialCode: '+975',
220
+ isoCode: 'BT',
221
+ flag: 'https://www.countryflags.io/BT/flat/64.png'
222
+ },
223
+ {
224
+ name: 'Bolivia',
225
+ dialCode: '+591',
226
+ isoCode: 'BO',
227
+ flag: 'https://www.countryflags.io/BO/flat/64.png'
228
+ },
229
+ {
230
+ name: 'Bosnia and Herzegovina',
231
+ dialCode: '+387',
232
+ isoCode: 'BA',
233
+ flag: 'https://www.countryflags.io/BA/flat/64.png'
234
+ },
235
+ {
236
+ name: 'Botswana',
237
+ dialCode: '+267',
238
+ isoCode: 'BW',
239
+ flag: 'https://www.countryflags.io/BW/flat/64.png'
240
+ },
241
+ {
242
+ name: 'Brazil',
243
+ dialCode: '+55',
244
+ isoCode: 'BR',
245
+ flag: 'https://www.countryflags.io/BR/flat/64.png'
246
+ },
247
+ {
248
+ name: 'British Indian Ocean Territory',
249
+ dialCode: '+246',
250
+ isoCode: 'IO',
251
+ flag: 'https://www.countryflags.io/IO/flat/64.png'
252
+ },
253
+ {
254
+ name: 'Brunei Darussalam',
255
+ dialCode: '+673',
256
+ isoCode: 'BN',
257
+ flag: 'https://www.countryflags.io/BN/flat/64.png'
258
+ },
259
+ {
260
+ name: 'Bulgaria',
261
+ dialCode: '+359',
262
+ isoCode: 'BG',
263
+ flag: 'https://www.countryflags.io/BG/flat/64.png'
264
+ },
265
+ {
266
+ name: 'Burkina Faso',
267
+ dialCode: '+226',
268
+ isoCode: 'BF',
269
+ flag: 'https://www.countryflags.io/BF/flat/64.png'
270
+ },
271
+ {
272
+ name: 'Burundi',
273
+ dialCode: '+257',
274
+ isoCode: 'BI',
275
+ flag: 'https://www.countryflags.io/BI/flat/64.png'
276
+ },
277
+ {
278
+ name: 'Cambodia',
279
+ dialCode: '+855',
280
+ isoCode: 'KH',
281
+ flag: 'https://www.countryflags.io/KH/flat/64.png'
282
+ },
283
+ {
284
+ name: 'Cameroon',
285
+ dialCode: '+237',
286
+ isoCode: 'CM',
287
+ flag: 'https://www.countryflags.io/CM/flat/64.png'
288
+ },
289
+ {
290
+ name: 'Canada',
291
+ dialCode: '+1',
292
+ isoCode: 'CA',
293
+ flag: 'https://www.countryflags.io/CA/flat/64.png'
294
+ },
295
+ {
296
+ name: 'Cape Verde',
297
+ dialCode: '+238',
298
+ isoCode: 'CV',
299
+ flag: 'https://www.countryflags.io/CV/flat/64.png'
300
+ },
301
+ {
302
+ name: 'Cayman Islands',
303
+ dialCode: '+1345',
304
+ isoCode: 'KY',
305
+ flag: 'https://www.countryflags.io/KY/flat/64.png'
306
+ },
307
+ {
308
+ name: 'Central African Republic',
309
+ dialCode: '+236',
310
+ isoCode: 'CF',
311
+ flag: 'https://www.countryflags.io/CF/flat/64.png'
312
+ },
313
+ {
314
+ name: 'Chad',
315
+ dialCode: '+235',
316
+ isoCode: 'TD',
317
+ flag: 'https://www.countryflags.io/TD/flat/64.png'
318
+ },
319
+ {
320
+ name: 'Chile',
321
+ dialCode: '+56',
322
+ isoCode: 'CL',
323
+ flag: 'https://www.countryflags.io/CL/flat/64.png'
324
+ },
325
+ {
326
+ name: 'China',
327
+ dialCode: '+86',
328
+ isoCode: 'CN',
329
+ flag: 'https://www.countryflags.io/CN/flat/64.png'
330
+ },
331
+ {
332
+ name: 'Christmas Island',
333
+ dialCode: '+61',
334
+ isoCode: 'CX',
335
+ flag: 'https://www.countryflags.io/CX/flat/64.png'
336
+ },
337
+ {
338
+ name: 'Cocos (Keeling) Islands',
339
+ dialCode: '+61',
340
+ isoCode: 'CC',
341
+ flag: 'https://www.countryflags.io/CC/flat/64.png'
342
+ },
343
+ {
344
+ name: 'Colombia',
345
+ dialCode: '+57',
346
+ isoCode: 'CO',
347
+ flag: 'https://www.countryflags.io/CO/flat/64.png'
348
+ },
349
+ {
350
+ name: 'Comoros',
351
+ dialCode: '+269',
352
+ isoCode: 'KM',
353
+ flag: 'https://www.countryflags.io/KM/flat/64.png'
354
+ },
355
+ {
356
+ name: 'Congo',
357
+ dialCode: '+242',
358
+ isoCode: 'CG',
359
+ flag: 'https://www.countryflags.io/CG/flat/64.png'
360
+ },
361
+ {
362
+ name: 'Cook Islands',
363
+ dialCode: '+682',
364
+ isoCode: 'CK',
365
+ flag: 'https://www.countryflags.io/CK/flat/64.png'
366
+ },
367
+ {
368
+ name: 'Costa Rica',
369
+ dialCode: '+506',
370
+ isoCode: 'CR',
371
+ flag: 'https://www.countryflags.io/CR/flat/64.png'
372
+ },
373
+ {
374
+ name: 'Croatia',
375
+ dialCode: '+385',
376
+ isoCode: 'HR',
377
+ flag: 'https://www.countryflags.io/HR/flat/64.png'
378
+ },
379
+ {
380
+ name: 'Cuba',
381
+ dialCode: '+53',
382
+ isoCode: 'CU',
383
+ flag: 'https://www.countryflags.io/CU/flat/64.png'
384
+ },
385
+ {
386
+ name: 'Cyprus',
387
+ dialCode: '+357',
388
+ isoCode: 'CY',
389
+ flag: 'https://www.countryflags.io/CY/flat/64.png'
390
+ },
391
+ {
392
+ name: 'Czech Republic',
393
+ dialCode: '+420',
394
+ isoCode: 'CZ',
395
+ flag: 'https://www.countryflags.io/CZ/flat/64.png'
396
+ },
397
+ {
398
+ name: 'Democratic Republic of the Congo',
399
+ dialCode: '+243',
400
+ isoCode: 'CD',
401
+ flag: 'https://www.countryflags.io/CD/flat/64.png'
402
+ },
403
+ {
404
+ name: 'Denmark',
405
+ dialCode: '+45',
406
+ isoCode: 'DK',
407
+ flag: 'https://www.countryflags.io/DK/flat/64.png'
408
+ },
409
+ {
410
+ name: 'Djibouti',
411
+ dialCode: '+253',
412
+ isoCode: 'DJ',
413
+ flag: 'https://www.countryflags.io/DJ/flat/64.png'
414
+ },
415
+ {
416
+ name: 'Dominica',
417
+ dialCode: '+1767',
418
+ isoCode: 'DM',
419
+ flag: 'https://www.countryflags.io/DM/flat/64.png'
420
+ },
421
+ {
422
+ name: 'Dominican Republic',
423
+ dialCode: '+1849',
424
+ isoCode: 'DO',
425
+ flag: 'https://www.countryflags.io/DO/flat/64.png'
426
+ },
427
+ {
428
+ name: 'Ecuador',
429
+ dialCode: '+593',
430
+ isoCode: 'EC',
431
+ flag: 'https://www.countryflags.io/EC/flat/64.png'
432
+ },
433
+ {
434
+ name: 'Egypt',
435
+ dialCode: '+20',
436
+ isoCode: 'EG',
437
+ flag: 'https://www.countryflags.io/EG/flat/64.png'
438
+ },
439
+ {
440
+ name: 'El Salvador',
441
+ dialCode: '+503',
442
+ isoCode: 'SV',
443
+ flag: 'https://www.countryflags.io/SV/flat/64.png'
444
+ },
445
+ {
446
+ name: 'Equatorial Guinea',
447
+ dialCode: '+240',
448
+ isoCode: 'GQ',
449
+ flag: 'https://www.countryflags.io/GQ/flat/64.png'
450
+ },
451
+ {
452
+ name: 'Eritrea',
453
+ dialCode: '+291',
454
+ isoCode: 'ER',
455
+ flag: 'https://www.countryflags.io/ER/flat/64.png'
456
+ },
457
+ {
458
+ name: 'Estonia',
459
+ dialCode: '+372',
460
+ isoCode: 'EE',
461
+ flag: 'https://www.countryflags.io/EE/flat/64.png'
462
+ },
463
+ {
464
+ name: 'Eswatini',
465
+ dialCode: '+268',
466
+ isoCode: 'SZ',
467
+ flag: 'https://www.countryflags.io/SZ/flat/64.png'
468
+ },
469
+ {
470
+ name: 'Ethiopia',
471
+ dialCode: '+251',
472
+ isoCode: 'ET',
473
+ flag: 'https://www.countryflags.io/ET/flat/64.png'
474
+ },
475
+ {
476
+ name: 'Falkland Islands (Malvinas)',
477
+ dialCode: '+500',
478
+ isoCode: 'FK',
479
+ flag: 'https://www.countryflags.io/FK/flat/64.png'
480
+ },
481
+ {
482
+ name: 'Faroe Islands',
483
+ dialCode: '+298',
484
+ isoCode: 'FO',
485
+ flag: 'https://www.countryflags.io/FO/flat/64.png'
486
+ },
487
+ {
488
+ name: 'Fiji',
489
+ dialCode: '+679',
490
+ isoCode: 'FJ',
491
+ flag: 'https://www.countryflags.io/FJ/flat/64.png'
492
+ },
493
+ {
494
+ name: 'Finland',
495
+ dialCode: '+358',
496
+ isoCode: 'FI',
497
+ flag: 'https://www.countryflags.io/FI/flat/64.png'
498
+ },
499
+ {
500
+ name: 'France',
501
+ dialCode: '+33',
502
+ isoCode: 'FR',
503
+ flag: 'https://www.countryflags.io/FR/flat/64.png'
504
+ },
505
+ {
506
+ name: 'French Guiana',
507
+ dialCode: '+594',
508
+ isoCode: 'GF',
509
+ flag: 'https://www.countryflags.io/GF/flat/64.png'
510
+ },
511
+ {
512
+ name: 'French Polynesia',
513
+ dialCode: '+689',
514
+ isoCode: 'PF',
515
+ flag: 'https://www.countryflags.io/PF/flat/64.png'
516
+ },
517
+ {
518
+ name: 'Gabon',
519
+ dialCode: '+241',
520
+ isoCode: 'GA',
521
+ flag: 'https://www.countryflags.io/GA/flat/64.png'
522
+ },
523
+ {
524
+ name: 'Gambia',
525
+ dialCode: '+220',
526
+ isoCode: 'GM',
527
+ flag: 'https://www.countryflags.io/GM/flat/64.png'
528
+ },
529
+ {
530
+ name: 'Georgia',
531
+ dialCode: '+995',
532
+ isoCode: 'GE',
533
+ flag: 'https://www.countryflags.io/GE/flat/64.png'
534
+ },
535
+ {
536
+ name: 'Germany',
537
+ dialCode: '+49',
538
+ isoCode: 'DE',
539
+ flag: 'https://www.countryflags.io/DE/flat/64.png'
540
+ },
541
+ {
542
+ name: 'Ghana',
543
+ dialCode: '+233',
544
+ isoCode: 'GH',
545
+ flag: 'https://www.countryflags.io/GH/flat/64.png'
546
+ },
547
+ {
548
+ name: 'Gibraltar',
549
+ dialCode: '+350',
550
+ isoCode: 'GI',
551
+ flag: 'https://www.countryflags.io/GI/flat/64.png'
552
+ },
553
+ {
554
+ name: 'Greece',
555
+ dialCode: '+30',
556
+ isoCode: 'GR',
557
+ flag: 'https://www.countryflags.io/GR/flat/64.png'
558
+ },
559
+ {
560
+ name: 'Greenland',
561
+ dialCode: '+299',
562
+ isoCode: 'GL',
563
+ flag: 'https://www.countryflags.io/GL/flat/64.png'
564
+ },
565
+ {
566
+ name: 'Grenada',
567
+ dialCode: '+1473',
568
+ isoCode: 'GD',
569
+ flag: 'https://www.countryflags.io/GD/flat/64.png'
570
+ },
571
+ {
572
+ name: 'Guadeloupe',
573
+ dialCode: '+590',
574
+ isoCode: 'GP',
575
+ flag: 'https://www.countryflags.io/GP/flat/64.png'
576
+ },
577
+ {
578
+ name: 'Guam',
579
+ dialCode: '+1671',
580
+ isoCode: 'GU',
581
+ flag: 'https://www.countryflags.io/GU/flat/64.png'
582
+ },
583
+ {
584
+ name: 'Guatemala',
585
+ dialCode: '+502',
586
+ isoCode: 'GT',
587
+ flag: 'https://www.countryflags.io/GT/flat/64.png'
588
+ },
589
+ {
590
+ name: 'Guernsey',
591
+ dialCode: '+44',
592
+ isoCode: 'GG',
593
+ flag: 'https://www.countryflags.io/GG/flat/64.png'
594
+ },
595
+ {
596
+ name: 'Guinea',
597
+ dialCode: '+224',
598
+ isoCode: 'GN',
599
+ flag: 'https://www.countryflags.io/GN/flat/64.png'
600
+ },
601
+ {
602
+ name: 'Guinea-Bissau',
603
+ dialCode: '+245',
604
+ isoCode: 'GW',
605
+ flag: 'https://www.countryflags.io/GW/flat/64.png'
606
+ },
607
+ {
608
+ name: 'Guyana',
609
+ dialCode: '+592',
610
+ isoCode: 'GY',
611
+ flag: 'https://www.countryflags.io/GY/flat/64.png'
612
+ },
613
+ {
614
+ name: 'Haiti',
615
+ dialCode: '+509',
616
+ isoCode: 'HT',
617
+ flag: 'https://www.countryflags.io/HT/flat/64.png'
618
+ },
619
+ {
620
+ name: 'Holy See (Vatican City State)',
621
+ dialCode: '+379',
622
+ isoCode: 'VA',
623
+ flag: 'https://www.countryflags.io/VA/flat/64.png'
624
+ },
625
+ {
626
+ name: 'Honduras',
627
+ dialCode: '+504',
628
+ isoCode: 'HN',
629
+ flag: 'https://www.countryflags.io/HN/flat/64.png'
630
+ },
631
+ {
632
+ name: 'Hong Kong',
633
+ dialCode: '+852',
634
+ isoCode: 'HK',
635
+ flag: 'https://www.countryflags.io/HK/flat/64.png'
636
+ },
637
+ {
638
+ name: 'Hungary',
639
+ dialCode: '+36',
640
+ isoCode: 'HU',
641
+ flag: 'https://www.countryflags.io/HU/flat/64.png'
642
+ },
643
+ {
644
+ name: 'Iceland',
645
+ dialCode: '+354',
646
+ isoCode: 'IS',
647
+ flag: 'https://www.countryflags.io/IS/flat/64.png'
648
+ },
649
+ {
650
+ name: 'India',
651
+ dialCode: '+91',
652
+ isoCode: 'IN',
653
+ flag: 'https://www.countryflags.io/IN/flat/64.png'
654
+ },
655
+ {
656
+ name: 'Indonesia',
657
+ dialCode: '+62',
658
+ isoCode: 'ID',
659
+ flag: 'https://www.countryflags.io/ID/flat/64.png'
660
+ },
661
+ {
662
+ name: 'Iran',
663
+ dialCode: '+98',
664
+ isoCode: 'IR',
665
+ flag: 'https://www.countryflags.io/IR/flat/64.png'
666
+ },
667
+ {
668
+ name: 'Iraq',
669
+ dialCode: '+964',
670
+ isoCode: 'IQ',
671
+ flag: 'https://www.countryflags.io/IQ/flat/64.png'
672
+ },
673
+ {
674
+ name: 'Ireland',
675
+ dialCode: '+353',
676
+ isoCode: 'IE',
677
+ flag: 'https://www.countryflags.io/IE/flat/64.png'
678
+ },
679
+ {
680
+ name: 'Isle of Man',
681
+ dialCode: '+44',
682
+ isoCode: 'IM',
683
+ flag: 'https://www.countryflags.io/IM/flat/64.png'
684
+ },
685
+ {
686
+ name: 'Israel',
687
+ dialCode: '+972',
688
+ isoCode: 'IL',
689
+ flag: 'https://www.countryflags.io/IL/flat/64.png'
690
+ },
691
+ {
692
+ name: 'Italy',
693
+ dialCode: '+39',
694
+ isoCode: 'IT',
695
+ flag: 'https://www.countryflags.io/IT/flat/64.png'
696
+ },
697
+ {
698
+ name: 'Ivory Coast / Cote d\'Ivoire',
699
+ dialCode: '+225',
700
+ isoCode: 'CI',
701
+ flag: 'https://www.countryflags.io/CI/flat/64.png'
702
+ },
703
+ {
704
+ name: 'Jamaica',
705
+ dialCode: '+1876',
706
+ isoCode: 'JM',
707
+ flag: 'https://www.countryflags.io/JM/flat/64.png'
708
+ },
709
+ {
710
+ name: 'Japan',
711
+ dialCode: '+81',
712
+ isoCode: 'JP',
713
+ flag: 'https://www.countryflags.io/JP/flat/64.png'
714
+ },
715
+ {
716
+ name: 'Jersey',
717
+ dialCode: '+44',
718
+ isoCode: 'JE',
719
+ flag: 'https://www.countryflags.io/JE/flat/64.png'
720
+ },
721
+ {
722
+ name: 'Jordan',
723
+ dialCode: '+962',
724
+ isoCode: 'JO',
725
+ flag: 'https://www.countryflags.io/JO/flat/64.png'
726
+ },
727
+ {
728
+ name: 'Kazakhstan',
729
+ dialCode: '+77',
730
+ isoCode: 'KZ',
731
+ flag: 'https://www.countryflags.io/KZ/flat/64.png'
732
+ },
733
+ {
734
+ name: 'Kenya',
735
+ dialCode: '+254',
736
+ isoCode: 'KE',
737
+ flag: 'https://www.countryflags.io/KE/flat/64.png'
738
+ },
739
+ {
740
+ name: 'Kiribati',
741
+ dialCode: '+686',
742
+ isoCode: 'KI',
743
+ flag: 'https://www.countryflags.io/KI/flat/64.png'
744
+ },
745
+ {
746
+ name: 'Korea, Democratic People\'s Republic of Korea',
747
+ dialCode: '+850',
748
+ isoCode: 'KP',
749
+ flag: 'https://www.countryflags.io/KP/flat/64.png'
750
+ },
751
+ {
752
+ name: 'Korea, Republic of South Korea',
753
+ dialCode: '+82',
754
+ isoCode: 'KR',
755
+ flag: 'https://www.countryflags.io/KR/flat/64.png'
756
+ },
757
+ {
758
+ name: 'Kosovo',
759
+ dialCode: '+383',
760
+ isoCode: 'XK',
761
+ flag: 'https://www.countryflags.io/XK/flat/64.png'
762
+ },
763
+ {
764
+ name: 'Kuwait',
765
+ dialCode: '+965',
766
+ isoCode: 'KW',
767
+ flag: 'https://www.countryflags.io/KW/flat/64.png'
768
+ },
769
+ {
770
+ name: 'Kyrgyzstan',
771
+ dialCode: '+996',
772
+ isoCode: 'KG',
773
+ flag: 'https://www.countryflags.io/KG/flat/64.png'
774
+ },
775
+ {
776
+ name: 'Laos',
777
+ dialCode: '+856',
778
+ isoCode: 'LA',
779
+ flag: 'https://www.countryflags.io/LA/flat/64.png'
780
+ },
781
+ {
782
+ name: 'Latvia',
783
+ dialCode: '+371',
784
+ isoCode: 'LV',
785
+ flag: 'https://www.countryflags.io/LV/flat/64.png'
786
+ },
787
+ {
788
+ name: 'Lebanon',
789
+ dialCode: '+961',
790
+ isoCode: 'LB',
791
+ flag: 'https://www.countryflags.io/LB/flat/64.png'
792
+ },
793
+ {
794
+ name: 'Lesotho',
795
+ dialCode: '+266',
796
+ isoCode: 'LS',
797
+ flag: 'https://www.countryflags.io/LS/flat/64.png'
798
+ },
799
+ {
800
+ name: 'Liberia',
801
+ dialCode: '+231',
802
+ isoCode: 'LR',
803
+ flag: 'https://www.countryflags.io/LR/flat/64.png'
804
+ },
805
+ {
806
+ name: 'Libya',
807
+ dialCode: '+218',
808
+ isoCode: 'LY',
809
+ flag: 'https://www.countryflags.io/LY/flat/64.png'
810
+ },
811
+ {
812
+ name: 'Liechtenstein',
813
+ dialCode: '+423',
814
+ isoCode: 'LI',
815
+ flag: 'https://www.countryflags.io/LI/flat/64.png'
816
+ },
817
+ {
818
+ name: 'Lithuania',
819
+ dialCode: '+370',
820
+ isoCode: 'LT',
821
+ flag: 'https://www.countryflags.io/LT/flat/64.png'
822
+ },
823
+ {
824
+ name: 'Luxembourg',
825
+ dialCode: '+352',
826
+ isoCode: 'LU',
827
+ flag: 'https://www.countryflags.io/LU/flat/64.png'
828
+ },
829
+ {
830
+ name: 'Macau',
831
+ dialCode: '+853',
832
+ isoCode: 'MO',
833
+ flag: 'https://www.countryflags.io/MO/flat/64.png'
834
+ },
835
+ {
836
+ name: 'Madagascar',
837
+ dialCode: '+261',
838
+ isoCode: 'MG',
839
+ flag: 'https://www.countryflags.io/MG/flat/64.png'
840
+ },
841
+ {
842
+ name: 'Malawi',
843
+ dialCode: '+265',
844
+ isoCode: 'MW',
845
+ flag: 'https://www.countryflags.io/MW/flat/64.png'
846
+ },
847
+ {
848
+ name: 'Malaysia',
849
+ dialCode: '+60',
850
+ isoCode: 'MY',
851
+ flag: 'https://www.countryflags.io/MY/flat/64.png'
852
+ },
853
+ {
854
+ name: 'Maldives',
855
+ dialCode: '+960',
856
+ isoCode: 'MV',
857
+ flag: 'https://www.countryflags.io/MV/flat/64.png'
858
+ },
859
+ {
860
+ name: 'Mali',
861
+ dialCode: '+223',
862
+ isoCode: 'ML',
863
+ flag: 'https://www.countryflags.io/ML/flat/64.png'
864
+ },
865
+ {
866
+ name: 'Malta',
867
+ dialCode: '+356',
868
+ isoCode: 'MT',
869
+ flag: 'https://www.countryflags.io/MT/flat/64.png'
870
+ },
871
+ {
872
+ name: 'Marshall Islands',
873
+ dialCode: '+692',
874
+ isoCode: 'MH',
875
+ flag: 'https://www.countryflags.io/MH/flat/64.png'
876
+ },
877
+ {
878
+ name: 'Martinique',
879
+ dialCode: '+596',
880
+ isoCode: 'MQ',
881
+ flag: 'https://www.countryflags.io/MQ/flat/64.png'
882
+ },
883
+ {
884
+ name: 'Mauritania',
885
+ dialCode: '+222',
886
+ isoCode: 'MR',
887
+ flag: 'https://www.countryflags.io/MR/flat/64.png'
888
+ },
889
+ {
890
+ name: 'Mauritius',
891
+ dialCode: '+230',
892
+ isoCode: 'MU',
893
+ flag: 'https://www.countryflags.io/MU/flat/64.png'
894
+ },
895
+ {
896
+ name: 'Mayotte',
897
+ dialCode: '+262',
898
+ isoCode: 'YT',
899
+ flag: 'https://www.countryflags.io/YT/flat/64.png'
900
+ },
901
+ {
902
+ name: 'Mexico',
903
+ dialCode: '+52',
904
+ isoCode: 'MX',
905
+ flag: 'https://www.countryflags.io/MX/flat/64.png'
906
+ },
907
+ {
908
+ name: 'Micronesia, Federated States of Micronesia',
909
+ dialCode: '+691',
910
+ isoCode: 'FM',
911
+ flag: 'https://www.countryflags.io/FM/flat/64.png'
912
+ },
913
+ {
914
+ name: 'Moldova',
915
+ dialCode: '+373',
916
+ isoCode: 'MD',
917
+ flag: 'https://www.countryflags.io/MD/flat/64.png'
918
+ },
919
+ {
920
+ name: 'Monaco',
921
+ dialCode: '+377',
922
+ isoCode: 'MC',
923
+ flag: 'https://www.countryflags.io/MC/flat/64.png'
924
+ },
925
+ {
926
+ name: 'Mongolia',
927
+ dialCode: '+976',
928
+ isoCode: 'MN',
929
+ flag: 'https://www.countryflags.io/MN/flat/64.png'
930
+ },
931
+ {
932
+ name: 'Montenegro',
933
+ dialCode: '+382',
934
+ isoCode: 'ME',
935
+ flag: 'https://www.countryflags.io/ME/flat/64.png'
936
+ },
937
+ {
938
+ name: 'Montserrat',
939
+ dialCode: '+1664',
940
+ isoCode: 'MS',
941
+ flag: 'https://www.countryflags.io/MS/flat/64.png'
942
+ },
943
+ {
944
+ name: 'Morocco',
945
+ dialCode: '+212',
946
+ isoCode: 'MA',
947
+ flag: 'https://www.countryflags.io/MA/flat/64.png'
948
+ },
949
+ {
950
+ name: 'Mozambique',
951
+ dialCode: '+258',
952
+ isoCode: 'MZ',
953
+ flag: 'https://www.countryflags.io/MZ/flat/64.png'
954
+ },
955
+ {
956
+ name: 'Myanmar',
957
+ dialCode: '+95',
958
+ isoCode: 'MM',
959
+ flag: 'https://www.countryflags.io/MM/flat/64.png'
960
+ },
961
+ {
962
+ name: 'Namibia',
963
+ dialCode: '+264',
964
+ isoCode: 'NA',
965
+ flag: 'https://www.countryflags.io/NA/flat/64.png'
966
+ },
967
+ {
968
+ name: 'Nauru',
969
+ dialCode: '+674',
970
+ isoCode: 'NR',
971
+ flag: 'https://www.countryflags.io/NR/flat/64.png'
972
+ },
973
+ {
974
+ name: 'Nepal',
975
+ dialCode: '+977',
976
+ isoCode: 'NP',
977
+ flag: 'https://www.countryflags.io/NP/flat/64.png'
978
+ },
979
+ {
980
+ name: 'Netherlands',
981
+ dialCode: '+31',
982
+ isoCode: 'NL',
983
+ flag: 'https://www.countryflags.io/NL/flat/64.png'
984
+ },
985
+ {
986
+ name: 'Netherlands Antilles',
987
+ dialCode: '+599',
988
+ isoCode: 'AN',
989
+ flag: 'https://www.countryflags.io/AN/flat/64.png'
990
+ },
991
+ {
992
+ name: 'New Caledonia',
993
+ dialCode: '+687',
994
+ isoCode: 'NC',
995
+ flag: 'https://www.countryflags.io/NC/flat/64.png'
996
+ },
997
+ {
998
+ name: 'New Zealand',
999
+ dialCode: '+64',
1000
+ isoCode: 'NZ',
1001
+ flag: 'https://www.countryflags.io/NZ/flat/64.png'
1002
+ },
1003
+ {
1004
+ name: 'Nicaragua',
1005
+ dialCode: '+505',
1006
+ isoCode: 'NI',
1007
+ flag: 'https://www.countryflags.io/NI/flat/64.png'
1008
+ },
1009
+ {
1010
+ name: 'Niger',
1011
+ dialCode: '+227',
1012
+ isoCode: 'NE',
1013
+ flag: 'https://www.countryflags.io/NE/flat/64.png'
1014
+ },
1015
+ {
1016
+ name: 'Nigeria',
1017
+ dialCode: '+234',
1018
+ isoCode: 'NG',
1019
+ flag: 'https://www.countryflags.io/NG/flat/64.png'
1020
+ },
1021
+ {
1022
+ name: 'Niue',
1023
+ dialCode: '+683',
1024
+ isoCode: 'NU',
1025
+ flag: 'https://www.countryflags.io/NU/flat/64.png'
1026
+ },
1027
+ {
1028
+ name: 'Norfolk Island',
1029
+ dialCode: '+672',
1030
+ isoCode: 'NF',
1031
+ flag: 'https://www.countryflags.io/NF/flat/64.png'
1032
+ },
1033
+ {
1034
+ name: 'North Macedonia',
1035
+ dialCode: '+389',
1036
+ isoCode: 'MK',
1037
+ flag: 'https://www.countryflags.io/MK/flat/64.png'
1038
+ },
1039
+ {
1040
+ name: 'Northern Mariana Islands',
1041
+ dialCode: '+1670',
1042
+ isoCode: 'MP',
1043
+ flag: 'https://www.countryflags.io/MP/flat/64.png'
1044
+ },
1045
+ {
1046
+ name: 'Norway',
1047
+ dialCode: '+47',
1048
+ isoCode: 'NO',
1049
+ flag: 'https://www.countryflags.io/NO/flat/64.png'
1050
+ },
1051
+ {
1052
+ name: 'Oman',
1053
+ dialCode: '+968',
1054
+ isoCode: 'OM',
1055
+ flag: 'https://www.countryflags.io/OM/flat/64.png'
1056
+ },
1057
+ {
1058
+ name: 'Pakistan',
1059
+ dialCode: '+92',
1060
+ isoCode: 'PK',
1061
+ flag: 'https://www.countryflags.io/PK/flat/64.png'
1062
+ },
1063
+ {
1064
+ name: 'Palau',
1065
+ dialCode: '+680',
1066
+ isoCode: 'PW',
1067
+ flag: 'https://www.countryflags.io/PW/flat/64.png'
1068
+ },
1069
+ {
1070
+ name: 'Palestine',
1071
+ dialCode: '+970',
1072
+ isoCode: 'PS',
1073
+ flag: 'https://www.countryflags.io/PS/flat/64.png'
1074
+ },
1075
+ {
1076
+ name: 'Panama',
1077
+ dialCode: '+507',
1078
+ isoCode: 'PA',
1079
+ flag: 'https://www.countryflags.io/PA/flat/64.png'
1080
+ },
1081
+ {
1082
+ name: 'Papua New Guinea',
1083
+ dialCode: '+675',
1084
+ isoCode: 'PG',
1085
+ flag: 'https://www.countryflags.io/PG/flat/64.png'
1086
+ },
1087
+ {
1088
+ name: 'Paraguay',
1089
+ dialCode: '+595',
1090
+ isoCode: 'PY',
1091
+ flag: 'https://www.countryflags.io/PY/flat/64.png'
1092
+ },
1093
+ {
1094
+ name: 'Peru',
1095
+ dialCode: '+51',
1096
+ isoCode: 'PE',
1097
+ flag: 'https://www.countryflags.io/PE/flat/64.png'
1098
+ },
1099
+ {
1100
+ name: 'Philippines',
1101
+ dialCode: '+63',
1102
+ isoCode: 'PH',
1103
+ flag: 'https://www.countryflags.io/PH/flat/64.png'
1104
+ },
1105
+ {
1106
+ name: 'Pitcairn',
1107
+ dialCode: '+872',
1108
+ isoCode: 'PN',
1109
+ flag: 'https://www.countryflags.io/PN/flat/64.png'
1110
+ },
1111
+ {
1112
+ name: 'Poland',
1113
+ dialCode: '+48',
1114
+ isoCode: 'PL',
1115
+ flag: 'https://www.countryflags.io/PL/flat/64.png'
1116
+ },
1117
+ {
1118
+ name: 'Portugal',
1119
+ dialCode: '+351',
1120
+ isoCode: 'PT',
1121
+ flag: 'https://www.countryflags.io/PT/flat/64.png'
1122
+ },
1123
+ {
1124
+ name: 'Puerto Rico',
1125
+ dialCode: '+1939',
1126
+ isoCode: 'PR',
1127
+ flag: 'https://www.countryflags.io/PR/flat/64.png'
1128
+ },
1129
+ {
1130
+ name: 'Qatar',
1131
+ dialCode: '+974',
1132
+ isoCode: 'QA',
1133
+ flag: 'https://www.countryflags.io/QA/flat/64.png'
1134
+ },
1135
+ {
1136
+ name: 'Reunion',
1137
+ dialCode: '+262',
1138
+ isoCode: 'RE',
1139
+ flag: 'https://www.countryflags.io/RE/flat/64.png'
1140
+ },
1141
+ {
1142
+ name: 'Romania',
1143
+ dialCode: '+40',
1144
+ isoCode: 'RO',
1145
+ flag: 'https://www.countryflags.io/RO/flat/64.png'
1146
+ },
1147
+ {
1148
+ name: 'Russia',
1149
+ dialCode: '+7',
1150
+ isoCode: 'RU',
1151
+ flag: 'https://www.countryflags.io/RU/flat/64.png'
1152
+ },
1153
+ {
1154
+ name: 'Rwanda',
1155
+ dialCode: '+250',
1156
+ isoCode: 'RW',
1157
+ flag: 'https://www.countryflags.io/RW/flat/64.png'
1158
+ },
1159
+ {
1160
+ name: 'Saint Barthelemy',
1161
+ dialCode: '+590',
1162
+ isoCode: 'BL',
1163
+ flag: 'https://www.countryflags.io/BL/flat/64.png'
1164
+ },
1165
+ {
1166
+ name: 'Saint Helena, Ascension and Tristan Da Cunha',
1167
+ dialCode: '+290',
1168
+ isoCode: 'SH',
1169
+ flag: 'https://www.countryflags.io/SH/flat/64.png'
1170
+ },
1171
+ {
1172
+ name: 'Saint Kitts and Nevis',
1173
+ dialCode: '+1869',
1174
+ isoCode: 'KN',
1175
+ flag: 'https://www.countryflags.io/KN/flat/64.png'
1176
+ },
1177
+ {
1178
+ name: 'Saint Lucia',
1179
+ dialCode: '+1758',
1180
+ isoCode: 'LC',
1181
+ flag: 'https://www.countryflags.io/LC/flat/64.png'
1182
+ },
1183
+ {
1184
+ name: 'Saint Martin',
1185
+ dialCode: '+590',
1186
+ isoCode: 'MF',
1187
+ flag: 'https://www.countryflags.io/MF/flat/64.png'
1188
+ },
1189
+ {
1190
+ name: 'Saint Pierre and Miquelon',
1191
+ dialCode: '+508',
1192
+ isoCode: 'PM',
1193
+ flag: 'https://www.countryflags.io/PM/flat/64.png'
1194
+ },
1195
+ {
1196
+ name: 'Saint Vincent and the Grenadines',
1197
+ dialCode: '+1784',
1198
+ isoCode: 'VC',
1199
+ flag: 'https://www.countryflags.io/VC/flat/64.png'
1200
+ },
1201
+ {
1202
+ name: 'Samoa',
1203
+ dialCode: '+685',
1204
+ isoCode: 'WS',
1205
+ flag: 'https://www.countryflags.io/WS/flat/64.png'
1206
+ },
1207
+ {
1208
+ name: 'San Marino',
1209
+ dialCode: '+378',
1210
+ isoCode: 'SM',
1211
+ flag: 'https://www.countryflags.io/SM/flat/64.png'
1212
+ },
1213
+ {
1214
+ name: 'Sao Tome and Principe',
1215
+ dialCode: '+239',
1216
+ isoCode: 'ST',
1217
+ flag: 'https://www.countryflags.io/ST/flat/64.png'
1218
+ },
1219
+ {
1220
+ name: 'Saudi Arabia',
1221
+ dialCode: '+966',
1222
+ isoCode: 'SA',
1223
+ flag: 'https://www.countryflags.io/SA/flat/64.png'
1224
+ },
1225
+ {
1226
+ name: 'Senegal',
1227
+ dialCode: '+221',
1228
+ isoCode: 'SN',
1229
+ flag: 'https://www.countryflags.io/SN/flat/64.png'
1230
+ },
1231
+ {
1232
+ name: 'Serbia',
1233
+ dialCode: '+381',
1234
+ isoCode: 'RS',
1235
+ flag: 'https://www.countryflags.io/RS/flat/64.png'
1236
+ },
1237
+ {
1238
+ name: 'Seychelles',
1239
+ dialCode: '+248',
1240
+ isoCode: 'SC',
1241
+ flag: 'https://www.countryflags.io/SC/flat/64.png'
1242
+ },
1243
+ {
1244
+ name: 'Sierra Leone',
1245
+ dialCode: '+232',
1246
+ isoCode: 'SL',
1247
+ flag: 'https://www.countryflags.io/SL/flat/64.png'
1248
+ },
1249
+ {
1250
+ name: 'Singapore',
1251
+ dialCode: '+65',
1252
+ isoCode: 'SG',
1253
+ flag: 'https://www.countryflags.io/SG/flat/64.png'
1254
+ },
1255
+ {
1256
+ name: 'Sint Maarten',
1257
+ dialCode: '+1721',
1258
+ isoCode: 'SX',
1259
+ flag: 'https://www.countryflags.io/SX/flat/64.png'
1260
+ },
1261
+ {
1262
+ name: 'Slovakia',
1263
+ dialCode: '+421',
1264
+ isoCode: 'SK',
1265
+ flag: 'https://www.countryflags.io/SK/flat/64.png'
1266
+ },
1267
+ {
1268
+ name: 'Slovenia',
1269
+ dialCode: '+386',
1270
+ isoCode: 'SI',
1271
+ flag: 'https://www.countryflags.io/SI/flat/64.png'
1272
+ },
1273
+ {
1274
+ name: 'Solomon Islands',
1275
+ dialCode: '+677',
1276
+ isoCode: 'SB',
1277
+ flag: 'https://www.countryflags.io/SB/flat/64.png'
1278
+ },
1279
+ {
1280
+ name: 'Somalia',
1281
+ dialCode: '+252',
1282
+ isoCode: 'SO',
1283
+ flag: 'https://www.countryflags.io/SO/flat/64.png'
1284
+ },
1285
+ {
1286
+ name: 'South Africa',
1287
+ dialCode: '+27',
1288
+ isoCode: 'ZA',
1289
+ flag: 'https://www.countryflags.io/ZA/flat/64.png'
1290
+ },
1291
+ {
1292
+ name: 'South Georgia and the South Sandwich Islands',
1293
+ dialCode: '+500',
1294
+ isoCode: 'GS',
1295
+ flag: 'https://www.countryflags.io/GS/flat/64.png'
1296
+ },
1297
+ {
1298
+ name: 'South Sudan',
1299
+ dialCode: '+211',
1300
+ isoCode: 'SS',
1301
+ flag: 'https://www.countryflags.io/SS/flat/64.png'
1302
+ },
1303
+ {
1304
+ name: 'Spain',
1305
+ dialCode: '+34',
1306
+ isoCode: 'ES',
1307
+ flag: 'https://www.countryflags.io/ES/flat/64.png'
1308
+ },
1309
+ {
1310
+ name: 'Sri Lanka',
1311
+ dialCode: '+94',
1312
+ isoCode: 'LK',
1313
+ flag: 'https://www.countryflags.io/LK/flat/64.png'
1314
+ },
1315
+ {
1316
+ name: 'Sudan',
1317
+ dialCode: '+249',
1318
+ isoCode: 'SD',
1319
+ flag: 'https://www.countryflags.io/SD/flat/64.png'
1320
+ },
1321
+ {
1322
+ name: 'Suriname',
1323
+ dialCode: '+597',
1324
+ isoCode: 'SR',
1325
+ flag: 'https://www.countryflags.io/SR/flat/64.png'
1326
+ },
1327
+ {
1328
+ name: 'Svalbard and Jan Mayen',
1329
+ dialCode: '+47',
1330
+ isoCode: 'SJ',
1331
+ flag: 'https://www.countryflags.io/SJ/flat/64.png'
1332
+ },
1333
+ {
1334
+ name: 'Sweden',
1335
+ dialCode: '+46',
1336
+ isoCode: 'SE',
1337
+ flag: 'https://www.countryflags.io/SE/flat/64.png'
1338
+ },
1339
+ {
1340
+ name: 'Switzerland',
1341
+ dialCode: '+41',
1342
+ isoCode: 'CH',
1343
+ flag: 'https://www.countryflags.io/CH/flat/64.png'
1344
+ },
1345
+ {
1346
+ name: 'Syrian Arab Republic',
1347
+ dialCode: '+963',
1348
+ isoCode: 'SY',
1349
+ flag: 'https://www.countryflags.io/SY/flat/64.png'
1350
+ },
1351
+ {
1352
+ name: 'Taiwan',
1353
+ dialCode: '+886',
1354
+ isoCode: 'TW',
1355
+ flag: 'https://www.countryflags.io/TW/flat/64.png'
1356
+ },
1357
+ {
1358
+ name: 'Tajikistan',
1359
+ dialCode: '+992',
1360
+ isoCode: 'TJ',
1361
+ flag: 'https://www.countryflags.io/TJ/flat/64.png'
1362
+ },
1363
+ {
1364
+ name: 'Tanzania, United Republic of Tanzania',
1365
+ dialCode: '+255',
1366
+ isoCode: 'TZ',
1367
+ flag: 'https://www.countryflags.io/TZ/flat/64.png'
1368
+ },
1369
+ {
1370
+ name: 'Thailand',
1371
+ dialCode: '+66',
1372
+ isoCode: 'TH',
1373
+ flag: 'https://www.countryflags.io/TH/flat/64.png'
1374
+ },
1375
+ {
1376
+ name: 'Timor-Leste',
1377
+ dialCode: '+670',
1378
+ isoCode: 'TL',
1379
+ flag: 'https://www.countryflags.io/TL/flat/64.png'
1380
+ },
1381
+ {
1382
+ name: 'Togo',
1383
+ dialCode: '+228',
1384
+ isoCode: 'TG',
1385
+ flag: 'https://www.countryflags.io/TG/flat/64.png'
1386
+ },
1387
+ {
1388
+ name: 'Tokelau',
1389
+ dialCode: '+690',
1390
+ isoCode: 'TK',
1391
+ flag: 'https://www.countryflags.io/TK/flat/64.png'
1392
+ },
1393
+ {
1394
+ name: 'Tonga',
1395
+ dialCode: '+676',
1396
+ isoCode: 'TO',
1397
+ flag: 'https://www.countryflags.io/TO/flat/64.png'
1398
+ },
1399
+ {
1400
+ name: 'Trinidad and Tobago',
1401
+ dialCode: '+1868',
1402
+ isoCode: 'TT',
1403
+ flag: 'https://www.countryflags.io/TT/flat/64.png'
1404
+ },
1405
+ {
1406
+ name: 'Tunisia',
1407
+ dialCode: '+216',
1408
+ isoCode: 'TN',
1409
+ flag: 'https://www.countryflags.io/TN/flat/64.png'
1410
+ },
1411
+ {
1412
+ name: 'Turkey',
1413
+ dialCode: '+90',
1414
+ isoCode: 'TR',
1415
+ flag: 'https://www.countryflags.io/TR/flat/64.png'
1416
+ },
1417
+ {
1418
+ name: 'Turkmenistan',
1419
+ dialCode: '+993',
1420
+ isoCode: 'TM',
1421
+ flag: 'https://www.countryflags.io/TM/flat/64.png'
1422
+ },
1423
+ {
1424
+ name: 'Turks and Caicos Islands',
1425
+ dialCode: '+1649',
1426
+ isoCode: 'TC',
1427
+ flag: 'https://www.countryflags.io/TC/flat/64.png'
1428
+ },
1429
+ {
1430
+ name: 'Tuvalu',
1431
+ dialCode: '+688',
1432
+ isoCode: 'TV',
1433
+ flag: 'https://www.countryflags.io/TV/flat/64.png'
1434
+ },
1435
+ {
1436
+ name: 'Uganda',
1437
+ dialCode: '+256',
1438
+ isoCode: 'UG',
1439
+ flag: 'https://www.countryflags.io/UG/flat/64.png'
1440
+ },
1441
+ {
1442
+ name: 'Ukraine',
1443
+ dialCode: '+380',
1444
+ isoCode: 'UA',
1445
+ flag: 'https://www.countryflags.io/UA/flat/64.png'
1446
+ },
1447
+ {
1448
+ name: 'United Arab Emirates',
1449
+ dialCode: '+971',
1450
+ isoCode: 'AE',
1451
+ flag: 'https://www.countryflags.io/AE/flat/64.png'
1452
+ },
1453
+ {
1454
+ name: 'United Kingdom',
1455
+ dialCode: '+44',
1456
+ isoCode: 'GB',
1457
+ flag: 'https://www.countryflags.io/GB/flat/64.png'
1458
+ },
1459
+ {
1460
+ name: 'United States',
1461
+ dialCode: '+1',
1462
+ isoCode: 'US',
1463
+ flag: 'https://www.countryflags.io/US/flat/64.png'
1464
+ },
1465
+ {
1466
+ name: 'Uruguay',
1467
+ dialCode: '+598',
1468
+ isoCode: 'UY',
1469
+ flag: 'https://www.countryflags.io/UY/flat/64.png'
1470
+ },
1471
+ {
1472
+ name: 'Uzbekistan',
1473
+ dialCode: '+998',
1474
+ isoCode: 'UZ',
1475
+ flag: 'https://www.countryflags.io/UZ/flat/64.png'
1476
+ },
1477
+ {
1478
+ name: 'Vanuatu',
1479
+ dialCode: '+678',
1480
+ isoCode: 'VU',
1481
+ flag: 'https://www.countryflags.io/VU/flat/64.png'
1482
+ },
1483
+ {
1484
+ name: 'Venezuela, Bolivarian Republic of Venezuela',
1485
+ dialCode: '+58',
1486
+ isoCode: 'VE',
1487
+ flag: 'https://www.countryflags.io/VE/flat/64.png'
1488
+ },
1489
+ {
1490
+ name: 'Vietnam',
1491
+ dialCode: '+84',
1492
+ isoCode: 'VN',
1493
+ flag: 'https://www.countryflags.io/VN/flat/64.png'
1494
+ },
1495
+ {
1496
+ name: 'Virgin Islands, British',
1497
+ dialCode: '+1284',
1498
+ isoCode: 'VG',
1499
+ flag: 'https://www.countryflags.io/VG/flat/64.png'
1500
+ },
1501
+ {
1502
+ name: 'Virgin Islands, U.S.',
1503
+ dialCode: '+1340',
1504
+ isoCode: 'VI',
1505
+ flag: 'https://www.countryflags.io/VI/flat/64.png'
1506
+ },
1507
+ {
1508
+ name: 'Wallis and Futuna',
1509
+ dialCode: '+681',
1510
+ isoCode: 'WF',
1511
+ flag: 'https://www.countryflags.io/WF/flat/64.png'
1512
+ },
1513
+ {
1514
+ name: 'Yemen',
1515
+ dialCode: '+967',
1516
+ isoCode: 'YE',
1517
+ flag: 'https://www.countryflags.io/YE/flat/64.png'
1518
+ },
1519
+ {
1520
+ name: 'Zambia',
1521
+ dialCode: '+260',
1522
+ isoCode: 'ZM',
1523
+ flag: 'https://www.countryflags.io/ZM/flat/64.png'
1524
+ },
1525
+ {
1526
+ name: 'Zimbabwe',
1527
+ dialCode: '+263',
1528
+ isoCode: 'ZW',
1529
+ flag: 'https://www.countryflags.io/ZW/flat/64.png'
1530
+ }
1531
+ ];
1532
+
1533
+ var script$6 = {
1534
+ name: 'ShPhone',
1535
+ props: ['modelValue', 'country_code'],
1536
+ data () {
1537
+ return {
1538
+ input: this.modelValue,
1539
+ countries: countries,
1540
+ selectedCountry: {
1541
+ name: 'Kenya',
1542
+ dialCode: '+254',
1543
+ isoCode: 'KE',
1544
+ flag: 'https://www.countryflags.io/KE/flat/64.png'
1545
+ },
1546
+ flag: import.meta.env.VITE_APP_HOME_URL + 'flags/ke.svg',
1547
+ appUrl: import.meta.env.VITE_APP_HOME_URL
1548
+ }
1549
+ },
1550
+ updated () {
1551
+ if (!this.selectedCountry || !this.input) ;
1552
+ },
1553
+ mounted () {
1554
+ this.setSelectedCountry();
1555
+ },
1556
+ methods: {
1557
+ updateValue: function () {
1558
+ let phone = this.input;
1559
+ phone = '-' + phone;
1560
+ phone = phone.replace('-0', '');
1561
+ phone = phone.replace('-', '');
1562
+ // this.input = phone
1563
+ if (this.selectedCountry) {
1564
+ phone = this.selectedCountry.dialCode + '' + phone;
1565
+ }
1566
+ this.$emit('update:modelValue', phone);
1567
+ this.flag = this.appUrl + 'flags/' + this.selectedCountry.isoCode.toLowerCase() + '.svg';
1568
+ },
1569
+ setSelectedCountry: function () {
1570
+ let countryCode = 'KE';
1571
+ if (this.country_code) {
1572
+ countryCode = this.country_code;
1573
+ }
1574
+ this.input = this.modelValue;
1575
+ const country = this.countries.find(function (country) {
1576
+ if (countryCode.toUpperCase() === country.isoCode) {
1577
+ return country
1578
+ }
1579
+ }, this);
1580
+ if (this.input) {
1581
+ if (!this.input.includes('+')) {
1582
+ this.input = '+' + this.input;
1583
+ }
1584
+ this.flag = this.appUrl + 'flags/' + country.isoCode.toLowerCase() + '.svg';
1585
+ this.input = this.input.replace(country.dialCode, '');
1586
+ this.input = this.input.replace(':', '');
1587
+ this.input = this.input.replace(':', '');
1588
+ this.input = this.input.replace(':', '');
1589
+ this.selectedCountry = country;
1590
+ }
1591
+ }
1592
+ }
1593
+ };
1594
+
1595
+ const _hoisted_1$6 = { class: "sh-phone mb-3" };
1596
+ const _hoisted_2$6 = {
1597
+ key: 0,
1598
+ style: {"display":"contents"}
1599
+ };
1600
+ const _hoisted_3$6 = ["src"];
1601
+ const _hoisted_4$5 = ["value"];
1602
+
1603
+ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
1604
+ return (openBlock(), createElementBlock("div", _hoisted_1$6, [
1605
+ ($data.selectedCountry)
1606
+ ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
1607
+ createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$6),
1608
+ createTextVNode(" " + toDisplayString($data.selectedCountry.dialCode), 1 /* TEXT */)
1609
+ ]))
1610
+ : createCommentVNode("v-if", true),
1611
+ withDirectives(createElementVNode("select", {
1612
+ onChange: _cache[0] || (_cache[0] = (...args) => ($options.updateValue && $options.updateValue(...args))),
1613
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.selectedCountry) = $event)),
1614
+ class: "phone-country"
1615
+ }, [
1616
+ (openBlock(true), createElementBlock(Fragment, null, renderList($data.countries, (country) => {
1617
+ return (openBlock(), createElementBlock("option", {
1618
+ value: country,
1619
+ key: country.dialCode
1620
+ }, toDisplayString(country.name + '(' + country.dialCode + ')'), 9 /* TEXT, PROPS */, _hoisted_4$5))
1621
+ }), 128 /* KEYED_FRAGMENT */))
1622
+ ], 544 /* HYDRATE_EVENTS, NEED_PATCH */), [
1623
+ [vModelSelect, $data.selectedCountry]
1624
+ ]),
1625
+ withDirectives(createElementVNode("input", {
1626
+ type: "text",
1627
+ class: "phone-number",
1628
+ "data-cy": "phone_input",
1629
+ onInput: _cache[2] || (_cache[2] = (...args) => ($options.updateValue && $options.updateValue(...args))),
1630
+ placeholder: "712345678",
1631
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = $event => (($data.input) = $event))
1632
+ }, null, 544 /* HYDRATE_EVENTS, NEED_PATCH */), [
1633
+ [vModelText, $data.input]
1634
+ ])
1635
+ ]))
1636
+ }
1637
+
1638
+ script$6.render = render$6;
1639
+ script$6.__file = "src/views/ShPhone.vue";
1640
+
1641
+ var script$5 = {
1642
+ name: 'ShForm',
1643
+ inject: ['global'],
1644
+ components: {
1645
+ ShPhone: script$6
1646
+ },
1647
+ props: ['action', 'classes', 'hasTerms', 'country_code', 'submit_btn_class', 'fields', 'columns', 'placeholders', 'field_permissions', 'retain_data_after_submission', 'current_data', 'action_label', 'fill_selects', 'phones', 'success_callback', 'failed_callback', 'labels'],
1648
+ data: function () {
1649
+ return {
1650
+ form_elements: {},
1651
+ form_errors: {},
1652
+ form_status: 0,
1653
+ error_res: null,
1654
+ form_files: {},
1655
+ exiting_fields: [],
1656
+ selectData: {},
1657
+ users: [],
1658
+ allPlaceHolders: {},
1659
+ user: this.global.state.user,
1660
+ allLabels: {}
1661
+ }
1662
+ },
1663
+ computed: {
1664
+ currentData () {
1665
+ return this.current_data
1666
+ }
1667
+ },
1668
+ methods: {
1669
+ getSubmitBtnClass: function () {
1670
+ const btnClass = this.submit_btn_class;
1671
+ if (!btnClass) {
1672
+ return 'btn btn-primary mt-2'
1673
+ } else {
1674
+ return btnClass
1675
+ }
1676
+ },
1677
+ getColumns: function () {
1678
+ let cols = parseFloat(this.columns);
1679
+ if (!cols) {
1680
+ cols = 1;
1681
+ }
1682
+ const allowedColumns = [1, 2, 3, 4, 6, 12];
1683
+ if (!allowedColumns.includes(cols)) {
1684
+ return '12'
1685
+ } else {
1686
+ return 12 / parseFloat(cols)
1687
+ }
1688
+ },
1689
+ getFieldType: function (field) {
1690
+ const textareas = ['message', 'meta_description', 'comment', 'call_response', 'comments', 'description'];
1691
+ const selects = ['gender', 'payment_method', 'allow_view_mode', 'reasons_name', 'has_free_tier', 'payment_period', 'role', 'register_as', 'account_type'];
1692
+ const numbers = ['age'];
1693
+ const datePickers = ['free_tier_days', 'recurring_date', 'date', 'paid_at'];
1694
+ const editors = ['html_content', 'listing_description', 'mail'];
1695
+ const mapLocations = ['building_location'];
1696
+ const files = ['file', 'logo'];
1697
+ const phones = ['phone'];
1698
+ if (field.includes('_id') || this.selectData[field]) {
1699
+ return 'select'
1700
+ }
1701
+ if (field === 'email') {
1702
+ return 'email'
1703
+ }
1704
+ if (field.includes('password')) {
1705
+ return 'password'
1706
+ }
1707
+ if (field.includes('file')) {
1708
+ return 'file'
1709
+ }
1710
+ if (textareas.includes(field)) {
1711
+ return 'textarea'
1712
+ }
1713
+ if (phones.includes(field)) {
1714
+ return 'phone'
1715
+ }
1716
+ if (mapLocations.includes(field)) {
1717
+ return 'location'
1718
+ }
1719
+ if (editors.includes(field)) {
1720
+ return 'editor'
1721
+ }
1722
+ if (numbers.includes(field)) {
1723
+ // alert('found')
1724
+ return 'numeric'
1725
+ }
1726
+ if (datePickers.includes(field)) {
1727
+ return 'datepicker'
1728
+ }
1729
+ if (selects.includes(field)) {
1730
+ return 'select'
1731
+ }
1732
+ if (files.includes(field)) {
1733
+ return 'file'
1734
+ }
1735
+ return 'text'
1736
+ },
1737
+ getLabel: function (field) {
1738
+ if (field in this.allLabels) {
1739
+ return this.allLabels[field]
1740
+ } else {
1741
+ return field.replace(/_/g, ' ')
1742
+ }
1743
+ },
1744
+ isDisabled: function (field) {
1745
+ if (typeof this.field_permissions === 'undefined') {
1746
+ return false
1747
+ }
1748
+ if (typeof this.user.isAllowedTo !== 'undefined') {
1749
+ return !this.user.isAllowedTo(this.field_permissions[field])
1750
+ }
1751
+ return true
1752
+ },
1753
+ validateEssentials: function () {
1754
+ if (this.fields.includes('password_confirmation')) {
1755
+ if (!this.form_elements.password) {
1756
+ this.form_errors = {
1757
+ password: ['Password field is required']
1758
+ };
1759
+ return false
1760
+ } else
1761
+ if (this.form_elements.password !== this.form_elements.password_confirmation) {
1762
+ this.form_errors = {
1763
+ password: ['Password confirmation does not match']
1764
+ };
1765
+ return false
1766
+ }
1767
+ }
1768
+ },
1769
+ closeModal: function () {
1770
+ document.body.style = '';
1771
+ setTimeout(() => {
1772
+ const form = this.$refs.ShAutoForm;
1773
+ if (form) {
1774
+ const modal = form.closest('.modal.show');
1775
+ if (modal) {
1776
+ modal.click();
1777
+ }
1778
+ } else {
1779
+ const backdrops = document.getElementsByClassName('modal-backdrop fade show');
1780
+ if (backdrops.length > 0) {
1781
+ backdrops[0].remove();
1782
+ }
1783
+ }
1784
+ this.form_status = 0;
1785
+ }, 1500);
1786
+ },
1787
+ submitForm: async function () {
1788
+ // return false;
1789
+ // if (!this.validateEssentials()) {
1790
+ // return false
1791
+ // }
1792
+ NProgress.start();
1793
+ this.form_status = 1;
1794
+ const data = new FormData();
1795
+ console.log(this.form_elements);
1796
+ Object.keys(this.form_elements).forEach(key => {
1797
+ if (typeof this.form_elements[key] === 'object') {
1798
+ data.append(key, JSON.stringify(this.form_elements[key]));
1799
+ } else if (typeof this.form_elements[key] !== 'undefined') { data.append(key, this.form_elements[key]); }
1800
+ });
1801
+ Object.keys(this.form_files).forEach(key => {
1802
+ data.append(key, this.form_files[key].value);
1803
+ });
1804
+ apis.doPost(this.action, data).then(res => {
1805
+ // console.log(res)
1806
+ this.form_status = 2;
1807
+ Object.keys(this.form_elements).forEach(key => {
1808
+ this.form_errors[key] = null;
1809
+ if (!this.retain_data_after_submission) {
1810
+ this.form_elements[key] = '';
1811
+ }
1812
+ });
1813
+ Object.keys(this.form_files).forEach(key => {
1814
+ this.form_errors[key] = null;
1815
+ });
1816
+ if (this.success_callback) {
1817
+ if (typeof this.success_callback === 'function') {
1818
+ this.success_callback(res.data);
1819
+ } else {
1820
+ this.$emit(this.success_callback, res.data);
1821
+ }
1822
+ }
1823
+ NProgress.done();
1824
+ if (!this.retain_modal_after_submission) {
1825
+ this.closeModal();
1826
+ }
1827
+ }).catch((reason, data) => {
1828
+ NProgress.done();
1829
+ this.form_status = 3;
1830
+ if (typeof reason !== 'undefined') {
1831
+ if (typeof reason.response !== 'undefined') {
1832
+ this.setErrors(reason.response);
1833
+ } else {
1834
+ console.log('catch error');
1835
+ console.log(reason);
1836
+ }
1837
+ } else {
1838
+ console.log(reason);
1839
+ }
1840
+ });
1841
+ return false
1842
+ },
1843
+ removeErrors: function (field) {
1844
+ this.form_errors[field] = null;
1845
+ this.form_status = 0;
1846
+ },
1847
+ setErrors: function (reason) {
1848
+ console.log(reason);
1849
+ if (reason.status === 422) { // change this to 422 validation error response as received from laravel
1850
+ this.form_errors = reason.data.errors;
1851
+ }
1852
+ },
1853
+ handleFileUpload: function (key) {
1854
+ this.form_files[key].value = event.target.files[0];
1855
+ },
1856
+ setCurrentData: function () {
1857
+ this.exiting_fields = [];
1858
+ if (this.currentData) {
1859
+ this.exiting_fields = this.currentData;
1860
+ }
1861
+ this.form_elements.id = this.exiting_fields.id;
1862
+ this.fields.forEach(field => {
1863
+ if (this.getFieldType(field) === 'file') {
1864
+ this.form_files[field] = { key: 'file', value: null };
1865
+ } else {
1866
+ if (this.exiting_fields[field] !== null) {
1867
+ this.form_elements[field] = this.exiting_fields[field];
1868
+ } else {
1869
+ this.form_elements[field] = '';
1870
+ }
1871
+ }
1872
+ this.form_errors[field] = null;
1873
+ });
1874
+ }
1875
+ },
1876
+ mounted: async function () {
1877
+ const selectData = {};
1878
+ if (this.fill_selects) {
1879
+ Object.keys(this.fill_selects).forEach(key => {
1880
+ if (this.fill_selects[key].data) {
1881
+ selectData[key] = this.fill_selects[key].data;
1882
+ this.selectData = selectData;
1883
+ console.log(this.selectData);
1884
+ } else {
1885
+ apis.doGet(this.fill_selects[key].url, { all: 1 }).then(res => {
1886
+ // selectData[key] = res.data
1887
+ // console.log(res)
1888
+ this.selectData[key] = res.data.data;
1889
+ }).catch(res => {
1890
+ console.log(res);
1891
+ });
1892
+ }
1893
+ });
1894
+ console.log(selectData);
1895
+ }
1896
+ },
1897
+ created: function () {
1898
+ console.log('created');
1899
+ if (this.labels) {
1900
+ this.allLabels = this.labels;
1901
+ }
1902
+ this.setCurrentData();
1903
+ if (this.placeholders) {
1904
+ this.allPlaceHolders = this.placeholders;
1905
+ }
1906
+ },
1907
+ watch: {
1908
+ currentData: function () {
1909
+ this.setCurrentData();
1910
+ }
1911
+ }
1912
+ };
1913
+
1914
+ const _hoisted_1$5 = { ref: "ShAutoForm" };
1915
+ const _hoisted_2$5 = {
1916
+ key: 0,
1917
+ class: "alert alert-danger"
1918
+ };
1919
+ const _hoisted_3$5 = /*#__PURE__*/createElementVNode("i", { class: "fa fa-warning" }, null, -1 /* HOISTED */);
1920
+ const _hoisted_4$4 = /*#__PURE__*/createTextVNode(" Error");
1921
+ const _hoisted_5$3 = [
1922
+ _hoisted_3$5,
1923
+ _hoisted_4$4
1924
+ ];
1925
+ const _hoisted_6$2 = { class: "row" };
1926
+ const _hoisted_7$2 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
1927
+ const _hoisted_8$1 = { class: "col-md-12" };
1928
+ const _hoisted_9$1 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
1929
+ const _hoisted_10$2 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
1930
+ const _hoisted_11$2 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
1931
+ const _hoisted_12$2 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
1932
+ const _hoisted_13$2 = ["data-cy", "name", "onFocus", "onUpdate:modelValue"];
1933
+ const _hoisted_14$2 = ["disabled", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
1934
+ const _hoisted_15$2 = ["name", "onFocus", "onUpdate:modelValue"];
1935
+ const _hoisted_16$2 = ["name", "onFocus", "onUpdate:modelValue"];
1936
+ const _hoisted_17$2 = ["value"];
1937
+ const _hoisted_18$2 = {
1938
+ key: 9,
1939
+ class: "invalid-feedback"
1940
+ };
1941
+ const _hoisted_19$2 = {
1942
+ key: 1,
1943
+ class: "row"
1944
+ };
1945
+ const _hoisted_20$2 = /*#__PURE__*/createElementVNode("h5", null, "Confirm and Submit", -1 /* HOISTED */);
1946
+ const _hoisted_21$2 = /*#__PURE__*/createElementVNode("p", null, [
1947
+ /*#__PURE__*/createTextVNode("By clicking submit, you agree to our "),
1948
+ /*#__PURE__*/createElementVNode("a", {
1949
+ target: "_blank",
1950
+ href: "/"
1951
+ }, "terms and conditions"),
1952
+ /*#__PURE__*/createTextVNode(" and that you have read our "),
1953
+ /*#__PURE__*/createElementVNode("a", {
1954
+ target: "_blank",
1955
+ href: "https://hauzisha.co.ke/privacy-policy"
1956
+ }, "privacy policy")
1957
+ ], -1 /* HOISTED */);
1958
+ const _hoisted_22$2 = [
1959
+ _hoisted_20$2,
1960
+ _hoisted_21$2
1961
+ ];
1962
+ const _hoisted_23$2 = {
1963
+ key: 0,
1964
+ style: {"height":"1rem"},
1965
+ class: "float-left",
1966
+ src: "/assets/img/spinner.gif"
1967
+ };
1968
+
1969
+ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
1970
+ const _component_ShPhone = resolveComponent("ShPhone");
1971
+
1972
+ return (openBlock(), createElementBlock("form", _hoisted_1$5, [
1973
+ createCommentVNode(" <div v-if=\"form_status == 1\" class=\"alert alert-info\">Processing...</div>"),
1974
+ createCommentVNode(" <div v-if=\"form_status == 2\" class=\"alert alert-success\">Success</div>"),
1975
+ (_ctx.form_status == 3)
1976
+ ? (openBlock(), createElementBlock("div", _hoisted_2$5, _hoisted_5$3))
1977
+ : createCommentVNode("v-if", true),
1978
+ withDirectives(createElementVNode("input", {
1979
+ type: "hidden",
1980
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((_ctx.form_elements['id']) = $event))
1981
+ }, null, 512 /* NEED_PATCH */), [
1982
+ [vModelText, _ctx.form_elements['id']]
1983
+ ]),
1984
+ createElementVNode("div", _hoisted_6$2, [
1985
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.fields, (field) => {
1986
+ return (openBlock(), createElementBlock("div", {
1987
+ class: normalizeClass(["form-group", 'col-md-' + $options.getColumns()]),
1988
+ key: field
1989
+ }, [
1990
+ createElementVNode("label", _hoisted_7$2, toDisplayString($options.getLabel(field)), 1 /* TEXT */),
1991
+ createElementVNode("div", _hoisted_8$1, [
1992
+ ($options.getFieldType(field) === 'file')
1993
+ ? (openBlock(), createElementBlock("input", {
1994
+ key: 0,
1995
+ "data-cy": field,
1996
+ placeholder: _ctx.allPlaceHolders[field] ? _ctx.allPlaceHolders[field] : '',
1997
+ name: field,
1998
+ onFocus: $event => ($options.removeErrors(field)),
1999
+ class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2000
+ ref_for: true,
2001
+ ref: 'file_'+field,
2002
+ onChange: $event => ($options.handleFileUpload(field)),
2003
+ type: "file"
2004
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_9$1))
2005
+ : createCommentVNode("v-if", true),
2006
+ ($options.getFieldType(field) === 'numeric')
2007
+ ? withDirectives((openBlock(), createElementBlock("input", {
2008
+ key: 1,
2009
+ "data-cy": field,
2010
+ placeholder: _ctx.allPlaceHolders[field] ? _ctx.allPlaceHolders[field] : '',
2011
+ name: field,
2012
+ onFocus: $event => ($options.removeErrors(field)),
2013
+ class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2014
+ "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2015
+ type: "number"
2016
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_10$2)), [
2017
+ [vModelText, _ctx.form_elements[field]]
2018
+ ])
2019
+ : createCommentVNode("v-if", true),
2020
+ ($options.getFieldType(field) === 'password')
2021
+ ? withDirectives((openBlock(), createElementBlock("input", {
2022
+ key: 2,
2023
+ "data-cy": field,
2024
+ placeholder: _ctx.allPlaceHolders[field] ? _ctx.allPlaceHolders[field] : '',
2025
+ name: field,
2026
+ onFocus: $event => ($options.removeErrors(field)),
2027
+ class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2028
+ "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2029
+ type: "password"
2030
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_11$2)), [
2031
+ [vModelText, _ctx.form_elements[field]]
2032
+ ])
2033
+ : createCommentVNode("v-if", true),
2034
+ ($options.getFieldType(field) === 'email')
2035
+ ? withDirectives((openBlock(), createElementBlock("input", {
2036
+ key: 3,
2037
+ "data-cy": field,
2038
+ placeholder: _ctx.allPlaceHolders[field] ? _ctx.allPlaceHolders[field] : '',
2039
+ name: field,
2040
+ onFocus: $event => ($options.removeErrors(field)),
2041
+ class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2042
+ "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2043
+ type: "email",
2044
+ required: ""
2045
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_12$2)), [
2046
+ [vModelText, _ctx.form_elements[field]]
2047
+ ])
2048
+ : createCommentVNode("v-if", true),
2049
+ ($options.getFieldType(field) === 'datepicker' && $options.isDisabled(field) === false)
2050
+ ? withDirectives((openBlock(), createElementBlock("input", {
2051
+ key: 4,
2052
+ "data-cy": field,
2053
+ type: "datetime-local",
2054
+ name: field,
2055
+ onFocus: $event => ($options.removeErrors(field)),
2056
+ class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control active"]),
2057
+ "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
2058
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_13$2)), [
2059
+ [vModelText, _ctx.form_elements[field]]
2060
+ ])
2061
+ : createCommentVNode("v-if", true),
2062
+ ($options.getFieldType(field) === 'phone')
2063
+ ? (openBlock(), createBlock(_component_ShPhone, {
2064
+ key: 5,
2065
+ country_code: $props.country_code,
2066
+ placeholder: _ctx.allPlaceHolders[field] ? _ctx.allPlaceHolders[field] : '',
2067
+ name: field,
2068
+ onFocus: $event => ($options.removeErrors(field)),
2069
+ class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2070
+ modelValue: _ctx.form_elements[field],
2071
+ "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2072
+ required: ""
2073
+ }, null, 8 /* PROPS */, ["country_code", "placeholder", "name", "onFocus", "class", "modelValue", "onUpdate:modelValue"]))
2074
+ : createCommentVNode("v-if", true),
2075
+ ($options.getFieldType(field) === 'text')
2076
+ ? withDirectives((openBlock(), createElementBlock("input", {
2077
+ key: 6,
2078
+ disabled: $options.isDisabled(field),
2079
+ placeholder: field === 'phone_number' ? 'e.g 0712 345 678':'',
2080
+ name: field,
2081
+ onFocus: $event => ($options.removeErrors(field)),
2082
+ class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2083
+ "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2084
+ type: "text"
2085
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_14$2)), [
2086
+ [vModelText, _ctx.form_elements[field]]
2087
+ ])
2088
+ : createCommentVNode("v-if", true),
2089
+ ($options.getFieldType(field) === 'textarea')
2090
+ ? withDirectives((openBlock(), createElementBlock("textarea", {
2091
+ key: 7,
2092
+ name: field,
2093
+ onFocus: $event => ($options.removeErrors(field)),
2094
+ class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2095
+ "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
2096
+ }, null, 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_15$2)), [
2097
+ [vModelText, _ctx.form_elements[field]]
2098
+ ])
2099
+ : createCommentVNode("v-if", true),
2100
+ ($options.getFieldType(field) === 'select' && _ctx.selectData[field] != null)
2101
+ ? withDirectives((openBlock(), createElementBlock("select", {
2102
+ key: 8,
2103
+ name: field,
2104
+ onFocus: $event => ($options.removeErrors(field)),
2105
+ class: normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
2106
+ "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
2107
+ }, [
2108
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectData[field], (item) => {
2109
+ return (openBlock(), createElementBlock("option", {
2110
+ key: item.id,
2111
+ value: item.id
2112
+ }, toDisplayString(item.name), 9 /* TEXT, PROPS */, _hoisted_17$2))
2113
+ }), 128 /* KEYED_FRAGMENT */))
2114
+ ], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_16$2)), [
2115
+ [vModelSelect, _ctx.form_elements[field]]
2116
+ ])
2117
+ : createCommentVNode("v-if", true),
2118
+ (_ctx.form_errors[field] != null )
2119
+ ? (openBlock(), createElementBlock("div", _hoisted_18$2, toDisplayString(_ctx.form_errors[field][0]), 1 /* TEXT */))
2120
+ : createCommentVNode("v-if", true)
2121
+ ])
2122
+ ], 2 /* CLASS */))
2123
+ }), 128 /* KEYED_FRAGMENT */))
2124
+ ]),
2125
+ ($props.hasTerms)
2126
+ ? (openBlock(), createElementBlock("div", _hoisted_19$2, _hoisted_22$2))
2127
+ : createCommentVNode("v-if", true),
2128
+ createElementVNode("button", {
2129
+ "data-cy": "sh_form_submit",
2130
+ class: normalizeClass(["mb-2 form-submit-btn", _ctx.form_status == 1 ? $options.getSubmitBtnClass() + ' disabled': $options.getSubmitBtnClass()]),
2131
+ type: "button",
2132
+ onClick: _cache[1] || (_cache[1] = (...args) => ($options.submitForm && $options.submitForm(...args)))
2133
+ }, [
2134
+ createTextVNode(toDisplayString($props.action_label ? $props.action_label:'Submit') + " ", 1 /* TEXT */),
2135
+ (_ctx.form_status == 1)
2136
+ ? (openBlock(), createElementBlock("img", _hoisted_23$2))
2137
+ : createCommentVNode("v-if", true)
2138
+ ], 2 /* CLASS */)
2139
+ ], 512 /* NEED_PATCH */))
2140
+ }
2141
+
2142
+ script$5.render = render$5;
2143
+ script$5.__file = "src/views/ShForm.vue";
2144
+
2145
+ var script$4 = {
2146
+ name: 'ShCanvas',
2147
+ props: ['canvas_title', 'canvas_id', 'position'],
2148
+ components: {
2149
+ },
2150
+ data () {
2151
+ return {
2152
+ side: this.position === undefined ? 'offcanvas-bottom' : 'offcanvas-' + this.position
2153
+ }
2154
+ },
2155
+ methods: {
2156
+ modalClosed: function () {
2157
+ this.$emit('modalClosed');
2158
+ }
2159
+ }
2160
+ };
2161
+
2162
+ const _hoisted_1$4 = ["id"];
2163
+ const _hoisted_2$4 = { class: "offcanvas-header" };
2164
+ const _hoisted_3$4 = {
2165
+ class: "offcanvas-title",
2166
+ id: "offcanvasScrollingLabel"
2167
+ };
2168
+ const _hoisted_4$3 = { class: "offcanvas-body" };
2169
+
2170
+ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2171
+ return (openBlock(), createElementBlock("div", {
2172
+ class: normalizeClass(["offcanvas", $data.side]),
2173
+ "data-bs-scroll": "true",
2174
+ tabindex: "-1",
2175
+ id: $props.canvas_id,
2176
+ "aria-labelledby": "offcanvasScrollingLabel"
2177
+ }, [
2178
+ createElementVNode("div", _hoisted_2$4, [
2179
+ createElementVNode("h5", _hoisted_3$4, toDisplayString($props.canvas_title), 1 /* TEXT */),
2180
+ createElementVNode("button", {
2181
+ type: "button",
2182
+ ref: "closecanvas",
2183
+ onClick: _cache[0] || (_cache[0] = (...args) => ($options.modalClosed && $options.modalClosed(...args))),
2184
+ class: "btn-close text-reset",
2185
+ "data-bs-dismiss": "offcanvas",
2186
+ "aria-label": "Close"
2187
+ }, null, 512 /* NEED_PATCH */)
2188
+ ]),
2189
+ createElementVNode("div", _hoisted_4$3, [
2190
+ renderSlot(_ctx.$slots, "default")
2191
+ ])
2192
+ ], 10 /* CLASS, PROPS */, _hoisted_1$4))
2193
+ }
2194
+
2195
+ script$4.render = render$4;
2196
+ script$4.__file = "src/views/ShCanvas.vue";
2197
+
2198
+ var script$3 = {
2199
+ name: 'ShModal',
2200
+ props: ['modal_title', 'modal_id', 'modal_size'],
2201
+ components: {
2202
+
2203
+ }
2204
+ };
2205
+
2206
+ const _hoisted_1$3 = ["id"];
2207
+ const _hoisted_2$3 = { class: "modal-content" };
2208
+ const _hoisted_3$3 = { class: "modal-header" };
2209
+ const _hoisted_4$2 = { class: "modal-title" };
2210
+ const _hoisted_5$2 = /*#__PURE__*/createElementVNode("button", {
2211
+ class: "btn btn-danger btn-sm",
2212
+ "data-bs-dismiss": "modal",
2213
+ "data-dismiss": "modal"
2214
+ }, "×", -1 /* HOISTED */);
2215
+ const _hoisted_6$1 = { class: "modal-body" };
2216
+ const _hoisted_7$1 = { class: "section" };
2217
+
2218
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2219
+ return (openBlock(), createElementBlock("div", {
2220
+ class: "modal fade",
2221
+ tabindex: "-1",
2222
+ id: $props.modal_id,
2223
+ "data-focus": "false",
2224
+ "aria-hidden": "true"
2225
+ }, [
2226
+ createElementVNode("div", {
2227
+ class: normalizeClass(["modal-dialog", `modal-${$props.modal_size}`])
2228
+ }, [
2229
+ createElementVNode("div", _hoisted_2$3, [
2230
+ createElementVNode("div", _hoisted_3$3, [
2231
+ createElementVNode("h3", _hoisted_4$2, toDisplayString($props.modal_title), 1 /* TEXT */),
2232
+ _hoisted_5$2
2233
+ ]),
2234
+ createElementVNode("div", _hoisted_6$1, [
2235
+ createElementVNode("div", _hoisted_7$1, [
2236
+ renderSlot(_ctx.$slots, "default")
2237
+ ])
2238
+ ])
2239
+ ])
2240
+ ], 2 /* CLASS */)
2241
+ ], 8 /* PROPS */, _hoisted_1$3))
2242
+ }
2243
+
2244
+ script$3.render = render$3;
2245
+ script$3.__file = "src/views/ShModal.vue";
2246
+
2247
+ var script$2 = {
2248
+ name: 'Pagination',
2249
+ props: ['pagination_data', 'loadMore', 'hideCount', 'hideLoadMore'],
2250
+ data () {
2251
+ return {
2252
+ current_page: this.pagination_data.current,
2253
+ per_page: this.pagination_data.per_page,
2254
+ loadingMore: 0
2255
+ }
2256
+ },
2257
+ methods: {
2258
+ changeTableKey: function (key, value) {
2259
+ this.$emit('changeKey', key, value);
2260
+ },
2261
+ changePerPage: function () {
2262
+ this.$emit('changeKey', 'per_page', this.per_page);
2263
+ },
2264
+ loadMoreRecords: function () {
2265
+ this.$emit('loadMoreRecords', 'now');
2266
+ }
2267
+ },
2268
+ computed: {
2269
+ getActivePage: function () {
2270
+ return this.pagination_data.current
2271
+ },
2272
+ getPerPage: function () {
2273
+ return this.per_page
2274
+ },
2275
+ getPages: function () {
2276
+ const pages = this.pagination_data.end;
2277
+ const current = this.pagination_data.current;
2278
+ var displayPages = [];
2279
+ if (pages < 13) {
2280
+ return this.pagination_data.end
2281
+ } else {
2282
+ if (current < 7) {
2283
+ for (let i = 1; i < 9; i++) {
2284
+ displayPages.push(i);
2285
+ }
2286
+ displayPages.push('...');
2287
+ displayPages.push(pages - 1);
2288
+ displayPages.push(pages);
2289
+ return displayPages
2290
+ } else if ((pages - current) < 6) {
2291
+ displayPages.push(1);
2292
+ displayPages.push(2);
2293
+ displayPages.push('...');
2294
+ var max = pages - 9;
2295
+ let l = 1;
2296
+ for (let i = pages; i > max; i--) {
2297
+ displayPages.push(max + l);
2298
+ l++;
2299
+ }
2300
+ return displayPages
2301
+ } else {
2302
+ displayPages.push(1);
2303
+ displayPages.push(2);
2304
+ displayPages.push('...');
2305
+ for (let i = current - 3; i < current + 4; i++) {
2306
+ displayPages.push(i);
2307
+ }
2308
+ displayPages.push('..');
2309
+ displayPages.push(pages - 1);
2310
+ displayPages.push(pages);
2311
+ return displayPages
2312
+ }
2313
+ }
2314
+ }
2315
+ }
2316
+ };
2317
+
2318
+ const _hoisted_1$2 = { key: 0 };
2319
+ const _hoisted_2$2 = { class: "record_count_body mb-3" };
2320
+ const _hoisted_3$2 = /*#__PURE__*/createElementVNode("span", { class: "per_page_show" }, "Showing", -1 /* HOISTED */);
2321
+ const _hoisted_4$1 = /*#__PURE__*/createTextVNode("  ");
2322
+ const _hoisted_5$1 = /*#__PURE__*/createStaticVNode("<option value=\"10\">10</option><option value=\"25\">25</option><option value=\"50\">50</option><option value=\"100\">100</option><option value=\"200\">200</option>", 5);
2323
+ const _hoisted_10$1 = [
2324
+ _hoisted_5$1
2325
+ ];
2326
+ const _hoisted_11$1 = { class: "record_counts" };
2327
+ const _hoisted_12$1 = {
2328
+ key: 0,
2329
+ "aria-label": "Page navigation"
2330
+ };
2331
+ const _hoisted_13$1 = { class: "pagination" };
2332
+ const _hoisted_14$1 = {
2333
+ key: 0,
2334
+ class: "page-link"
2335
+ };
2336
+ const _hoisted_15$1 = {
2337
+ key: 1,
2338
+ class: "page-link"
2339
+ };
2340
+ const _hoisted_16$1 = ["onClick"];
2341
+ const _hoisted_17$1 = { key: 1 };
2342
+ const _hoisted_18$1 = {
2343
+ key: 0,
2344
+ class: "text-center"
2345
+ };
2346
+ const _hoisted_19$1 = /*#__PURE__*/createElementVNode("div", {
2347
+ class: "spinner-border",
2348
+ role: "status"
2349
+ }, null, -1 /* HOISTED */);
2350
+ const _hoisted_20$1 = [
2351
+ _hoisted_19$1
2352
+ ];
2353
+ const _hoisted_21$1 = {
2354
+ key: 1,
2355
+ class: "text-center"
2356
+ };
2357
+ const _hoisted_22$1 = { class: "per_page_show" };
2358
+ const _hoisted_23$1 = {
2359
+ key: 2,
2360
+ class: "text-center"
2361
+ };
2362
+
2363
+ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2364
+ return (!$props.loadMore)
2365
+ ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
2366
+ createElementVNode("div", _hoisted_2$2, [
2367
+ _hoisted_3$2,
2368
+ _hoisted_4$1,
2369
+ withDirectives(createElementVNode("select", {
2370
+ class: "select_per_page",
2371
+ onChange: _cache[0] || (_cache[0] = (...args) => ($options.changePerPage && $options.changePerPage(...args))),
2372
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.per_page) = $event))
2373
+ }, _hoisted_10$1, 544 /* HYDRATE_EVENTS, NEED_PATCH */), [
2374
+ [vModelSelect, $data.per_page]
2375
+ ]),
2376
+ createElementVNode("span", _hoisted_11$1, " of " + toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
2377
+ ]),
2378
+ ($props.pagination_data != null)
2379
+ ? (openBlock(), createElementBlock("nav", _hoisted_12$1, [
2380
+ createElementVNode("ul", _hoisted_13$1, [
2381
+ createElementVNode("li", {
2382
+ class: normalizeClass([$options.getActivePage === 1 ? 'disabled' : '' , "page-item"])
2383
+ }, [
2384
+ createElementVNode("a", {
2385
+ onClick: _cache[2] || (_cache[2] = $event => ($options.changeTableKey('page',$options.getActivePage - 1))),
2386
+ class: "page-link"
2387
+ }, "«")
2388
+ ], 2 /* CLASS */),
2389
+ (openBlock(true), createElementBlock(Fragment, null, renderList($options.getPages, (page) => {
2390
+ return (openBlock(), createElementBlock("li", {
2391
+ class: normalizeClass(["page-item", $options.getActivePage === page ? 'active':'']),
2392
+ key: page
2393
+ }, [
2394
+ ($options.getActivePage === page)
2395
+ ? (openBlock(), createElementBlock("a", _hoisted_14$1, toDisplayString(page), 1 /* TEXT */))
2396
+ : (['..','...'].includes(page))
2397
+ ? (openBlock(), createElementBlock("a", _hoisted_15$1, toDisplayString(page), 1 /* TEXT */))
2398
+ : (openBlock(), createElementBlock("a", {
2399
+ key: 2,
2400
+ onClick: $event => ($options.changeTableKey('page',page)),
2401
+ class: "page-link"
2402
+ }, toDisplayString(page), 9 /* TEXT, PROPS */, _hoisted_16$1))
2403
+ ], 2 /* CLASS */))
2404
+ }), 128 /* KEYED_FRAGMENT */)),
2405
+ createElementVNode("li", {
2406
+ class: normalizeClass([$options.getActivePage === this.pagination_data.end ? 'disabled' : '' , "page-item"])
2407
+ }, [
2408
+ createElementVNode("a", {
2409
+ onClick: _cache[3] || (_cache[3] = $event => ($options.changeTableKey('page',$options.getActivePage + 1))),
2410
+ class: "page-link"
2411
+ }, "»")
2412
+ ], 2 /* CLASS */)
2413
+ ])
2414
+ ]))
2415
+ : createCommentVNode("v-if", true)
2416
+ ]))
2417
+ : (openBlock(), createElementBlock("div", _hoisted_17$1, [
2418
+ (this.pagination_data.loading === 1)
2419
+ ? (openBlock(), createElementBlock("div", _hoisted_18$1, _hoisted_20$1))
2420
+ : createCommentVNode("v-if", true),
2421
+ (!$props.hideCount)
2422
+ ? (openBlock(), createElementBlock("div", _hoisted_21$1, [
2423
+ createElementVNode("span", _hoisted_22$1, "Showing " + toDisplayString($props.pagination_data.displayCount) + " of " + toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
2424
+ ]))
2425
+ : createCommentVNode("v-if", true),
2426
+ (this.pagination_data.loading !== 1 && $props.pagination_data.displayCount < $props.pagination_data.record_count && !$props.hideLoadMore)
2427
+ ? (openBlock(), createElementBlock("div", _hoisted_23$1, [
2428
+ createElementVNode("button", {
2429
+ class: "btn btn-sm btn-primary mt-1",
2430
+ onClick: _cache[4] || (_cache[4] = (...args) => ($options.loadMoreRecords && $options.loadMoreRecords(...args)))
2431
+ }, "Load More")
2432
+ ]))
2433
+ : createCommentVNode("v-if", true)
2434
+ ]))
2435
+ }
2436
+
2437
+ script$2.render = render$2;
2438
+ script$2.__file = "src/views/list_templates/Pagination.vue";
2439
+
2440
+ function swalSuccess (message) {
2441
+ Swal.fire('Success!', message, 'success');
2442
+ }
2443
+ function swalError (message) {
2444
+ Swal.fire('Error!', message, 'error');
2445
+ }
2446
+
2447
+ function swalHttpError (reason) {
2448
+ let error = '';
2449
+ if (typeof reason !== 'undefined') {
2450
+ if (typeof reason.response !== 'undefined') {
2451
+ let reasonString = '';
2452
+ if (typeof reason.response.data === 'string') {
2453
+ reasonString = reason.response.data;
2454
+ } else {
2455
+ reasonString = JSON.stringify(reason.response.data);
2456
+ }
2457
+ error = reason.response.status + ': ' + reason.response.statusText + '<br/>' + reasonString;
2458
+ } else {
2459
+ if (typeof reason !== 'string') {
2460
+ error = 'A Unexpected script error occurred<br/>' + JSON.stringify(reason);
2461
+ } else {
2462
+ error = 'A Unexpected script error occurred<br/>' + JSON.stringify(reason);
2463
+ }
2464
+ }
2465
+ } else {
2466
+ if (typeof reason !== 'string') {
2467
+ error = 'A Unexpected script error occurred<br/>' + JSON.stringify(reason);
2468
+ } else {
2469
+ error = 'A Unexpected script error occurred<br/>' + JSON.stringify(reason);
2470
+ }
2471
+ }
2472
+ Swal.fire('Error!', error, 'error');
2473
+ }
2474
+
2475
+ function runSilentRequest (url) {
2476
+ return apis.doPost(url)
2477
+ }
2478
+
2479
+ function setTabCounts (url) {
2480
+ apis.doGet(url).then(res => {
2481
+ Object.keys(res.data).forEach(key => {
2482
+ const elem = document.getElementById(key);
2483
+ if (elem === null) {
2484
+ return
2485
+ }
2486
+ if (typeof elem !== 'undefined') {
2487
+ let txt = elem.innerHTML;
2488
+ txt = txt.split('<i class="d-none"></i>')[0];
2489
+ if (parseInt(res.data[key]) > 0) {
2490
+ elem.innerHTML = txt + '<i class="d-none"></i><sup class="rounded-circle p-1 bg-info text-white">' + res.data[key] + '</sup>';
2491
+ }
2492
+ }
2493
+ // document.getElementById(key).innerHTML res.data[key]
2494
+ });
2495
+ });
2496
+ }
2497
+ function formatHttpCatchError (reason) {
2498
+ console.log(reason);
2499
+ let error = '';
2500
+ if (typeof reason !== 'undefined') {
2501
+ if (typeof reason.response !== 'undefined') {
2502
+ alert('here');
2503
+ let reasonString = '';
2504
+ if (typeof reason.response.data === 'string') {
2505
+ reasonString = reason.response.data;
2506
+ } else {
2507
+ reasonString = JSON.stringify(reason.response.data);
2508
+ }
2509
+ error = reason.response.status + ': ' + reason.response.statusText + '<br/>' + reasonString;
2510
+ } else {
2511
+ if (typeof reason !== 'string') {
2512
+ error = 'A Unexpected script error occurred<br/>' + JSON.stringify(reason);
2513
+ } else {
2514
+ error = 'A Unexpected script error occurred<br/>' + JSON.stringify(reason);
2515
+ }
2516
+ }
2517
+ } else {
2518
+ if (typeof reason !== 'string') {
2519
+ error = 'A Unexpected script error occurred<br/>' + JSON.stringify(reason);
2520
+ } else {
2521
+ error = 'A Unexpected script error occurred<br/>' + JSON.stringify(reason);
2522
+ }
2523
+ }
2524
+ return error
2525
+ }
2526
+ function getMenuCount (url) {
2527
+ apis.doGet(url).then(res => {
2528
+ console.log(res);
2529
+ });
2530
+ }
2531
+ const Toast = Swal.mixin({
2532
+ toast: true,
2533
+ position: 'top-end',
2534
+ showConfirmButton: false,
2535
+ customClass: {
2536
+ popup: 'colored-toast'
2537
+ },
2538
+ iconColor: 'white',
2539
+ timer: 2000,
2540
+ timerProgressBar: true,
2541
+ didOpen: (toast) => {
2542
+ toast.addEventListener('mouseenter', Swal.stopTimer);
2543
+ toast.addEventListener('mouseleave', Swal.resumeTimer);
2544
+ }
2545
+ });
2546
+ function showToast (message, toastType) {
2547
+ if (!toastType) {
2548
+ toastType = 'success';
2549
+ }
2550
+ Toast.fire({
2551
+ icon: toastType,
2552
+ title: message
2553
+ });
2554
+ }
2555
+
2556
+ async function runPlainRequest (url, message, title, data) {
2557
+ if (typeof title === 'undefined') {
2558
+ title = null;
2559
+ }
2560
+ return Swal.fire({
2561
+ title: title !== null ? title : 'Are you sure?',
2562
+ html: message,
2563
+ showCancelButton: true,
2564
+ confirmButtonColor: '#32c787',
2565
+ cancelButtonText: 'No, cancel',
2566
+ confirmButtonText: 'Yes, Proceed!',
2567
+ reverseButtons: true,
2568
+ showLoaderOnConfirm: true,
2569
+ preConfirm: () => {
2570
+ return apis.doPost(url, data).then(function (response) {
2571
+ Swal.fire('Success!', 'Action completed successfully', 'success');
2572
+ return {
2573
+ response: response.data,
2574
+ success: true
2575
+ }
2576
+ })
2577
+ .catch(reason => {
2578
+ if (typeof reason.response === 'undefined') {
2579
+ Swal.fire('Error!', `Connection to ${url} lost`, 'error');
2580
+ } else {
2581
+ Swal.fire(`Error ${reason.response.status}`, reason.response.statusText, 'error');
2582
+ }
2583
+ return {
2584
+ success: false
2585
+ }
2586
+ })
2587
+ },
2588
+ allowOutsideClick: () => !Swal.isLoading()
2589
+ })
2590
+ }
2591
+
2592
+ function formatDate(date, format) {
2593
+ if (!format) {
2594
+ format = 'lll';
2595
+ }
2596
+ return moment(date).format(format)
2597
+ }
2598
+
2599
+ var helpers = {
2600
+ swalSuccess,
2601
+ swalError,
2602
+ runPlainRequest,
2603
+ getMenuCount,
2604
+ setTabCounts,
2605
+ showToast,
2606
+ runSilentRequest,
2607
+ swalHttpError,
2608
+ formatHttpCatchError,
2609
+ formatDate
2610
+ };
2611
+
2612
+ var script$1 = {
2613
+ name: 'sh-table',
2614
+ props: ['end_point', 'headers', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'mobile_view', 'hideSearch', 'custom_template', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields'],
2615
+ inject: ['channel', 'global'],
2616
+ data () {
2617
+ return {
2618
+ order_by: '',
2619
+ order_method: '',
2620
+ per_page: this.pageCount ? this.pageCount : 30,
2621
+ page: 1,
2622
+ filter_value: '',
2623
+ loading: 'loading',
2624
+ loading_error: '',
2625
+ records: [],
2626
+ total: 0,
2627
+ pagination_data: null,
2628
+ moreDetailsId: null,
2629
+ moreDetailsModel: null,
2630
+ downloading: false,
2631
+ appUrl: import.meta.env.VITE_APP_API_URL
2632
+ }
2633
+ },
2634
+ mounted () {
2635
+ if (this.event) ;
2636
+ },
2637
+ methods: {
2638
+ newRecordAdded: function (ev) {
2639
+ const record = ev.log;
2640
+ if (record.user) {
2641
+ record.user = record.user.name;
2642
+ }
2643
+ this.records.unshift(record);
2644
+ console.log(event, record);
2645
+ },
2646
+ rowSelected: function (row) {
2647
+ this.$emit('rowSelected', row);
2648
+ },
2649
+ changeKey: function (key, value) {
2650
+ this[key] = value;
2651
+ if (key === 'order_by') {
2652
+ this.order_method = (this.order_method === 'desc') ? 'asc' : 'desc';
2653
+ }
2654
+ if (key === 'per_page') {
2655
+ this.page = 1;
2656
+ }
2657
+ this.reloadData();
2658
+ },
2659
+ getLinkClass: function (config) {
2660
+ console.log(config);
2661
+ if (typeof config === 'object') {
2662
+ return config.class
2663
+ }
2664
+ return ''
2665
+ },
2666
+ reloadNotifications: function () {
2667
+ this.reloadData();
2668
+ },
2669
+ replaceActionUrl: function (path, obj) {
2670
+ if (path) {
2671
+ var matches = path.match(/\{(.*?)\}/g);
2672
+ matches.forEach(key => {
2673
+ key = key.replace('{', '');
2674
+ key = key.replace('}', '');
2675
+ path = path.replace(`{${key}}`, obj[key]);
2676
+ });
2677
+ return path
2678
+ }
2679
+ return ''
2680
+ },
2681
+ doEmitAction: function (action, data) {
2682
+ if (typeof action === 'function') {
2683
+ action(data);
2684
+ } else {
2685
+ this.$emit(action, data);
2686
+ }
2687
+ },
2688
+ getFieldType: function (field) {
2689
+ const numbers = ['age', 'interest_rate_pa'];
2690
+ const moneys = ['amount', 'paid_amount', 'total_paid', 'total', 'monthly_fee', 'share_cost', 'min_contribution', 'min_membership_contribution'];
2691
+ const dates = ['invoice_date', 'free_tier_days', 'updated_at', 'created_at', 'end_time'];
2692
+ if (numbers.includes(field)) {
2693
+ return 'numeric'
2694
+ }
2695
+ if (moneys.includes(field)) {
2696
+ return 'money'
2697
+ }
2698
+ if (dates.includes(field)) {
2699
+ return 'date'
2700
+ }
2701
+ return 'string'
2702
+ },
2703
+ replaceLinkUrl: function (path, obj) {
2704
+ if (typeof path === 'object') {
2705
+ path = path.link;
2706
+ }
2707
+ var matches = path.match(/\{(.*?)\}/g);
2708
+ matches.forEach(key => {
2709
+ key = key.replace('{', '');
2710
+ key = key.replace('}', '');
2711
+ path = path.replace(`{${key}}`, obj[key]);
2712
+ });
2713
+ return path
2714
+ },
2715
+ formatDate: function (date) {
2716
+ return moment(date).format('lll')
2717
+ },
2718
+ setMoreDetailsModel: function (row) {
2719
+ this.moreDetailsModel = null;
2720
+ this.moreDetailsModel = row;
2721
+ },
2722
+ loadMoreRecords: function () {
2723
+ this.reloadData(this.page + 1, 1);
2724
+ },
2725
+ exportData: function (template) {
2726
+ this.downloading = true;
2727
+ const headers = [];
2728
+ const fields = this.downloadFields ? this.downloadFields : this.headers;
2729
+ fields.forEach(header => {
2730
+ if (typeof header === 'string') {
2731
+ headers.push(header);
2732
+ }
2733
+ });
2734
+ const data = {
2735
+ titles: headers,
2736
+ export: 1
2737
+ };
2738
+ apis.doPost(this.end_point, data).then(res => {
2739
+ this.downloading = false;
2740
+ if (res.data.file) {
2741
+ const url = this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name;
2742
+ window.location.href = url;
2743
+ // window.open('https://facebook.com')
2744
+ // window.open(this.appUrl + 'external-download?file=' + res.data.file + '&name=' + res.data.name, '_blank').focus()
2745
+ }
2746
+ }).catch(reason => {
2747
+ console.log(reason);
2748
+ this.downloading = false;
2749
+ const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText}`;
2750
+ helpers.swalError('Error', error);
2751
+ });
2752
+ },
2753
+ reloadData: function (page, append) {
2754
+ if (typeof page !== 'undefined') { this.page = page; }
2755
+ if (!append) {
2756
+ this.loading = 'loading';
2757
+ }
2758
+ const data = {
2759
+ order_by: this.order_by,
2760
+ order_method: this.order_method,
2761
+ per_page: this.per_page,
2762
+ page: this.page,
2763
+ filter_value: this.filter_value
2764
+ };
2765
+ if (this.pagination_data) {
2766
+ this.pagination_data.loading = 1;
2767
+ }
2768
+ apis.doGet(this.end_point, data).then(req => {
2769
+ this.loading = 'done';
2770
+ const response = req.data.data;
2771
+ this.pagination_data = {
2772
+ current: response.current_page,
2773
+ start: response.from,
2774
+ end: response.last_page,
2775
+ record_count: response.total,
2776
+ per_page: response.per_page,
2777
+ loading: 0,
2778
+ displayCount: response.total > response.per_page ? response.per_page : response.total
2779
+ };
2780
+ if (append) {
2781
+ this.records.push(...response.data);
2782
+ let totalShown = response.total > response.per_page ? response.per_page * response.current_page : response.total;
2783
+ if (totalShown > response.total) {
2784
+ totalShown = response.total;
2785
+ }
2786
+ this.pagination_data.displayCount = totalShown;
2787
+ const scrollingElement = (document.scrollingElement || document.body);
2788
+ scrollingElement.scrollTop = scrollingElement.scrollHeight;
2789
+ // const all = []
2790
+ // console.log(all.push(response.data))
2791
+ // console.log(this.records, response.data)
2792
+ } else {
2793
+ this.records = response.data;
2794
+ }
2795
+ }).catch(reason => {
2796
+ const error = (typeof reason.response === 'undefined') ? 'Error getting data from backend' : `${reason.response.status}:${reason.response.statusText} (${this.end_point})`;
2797
+ this.loading_error = error;
2798
+ this.loading = 'error';
2799
+ });
2800
+ }
2801
+ },
2802
+ watch: {
2803
+ reload () {
2804
+ this.reloadData();
2805
+ }
2806
+ },
2807
+ created () {
2808
+ this.reloadData();
2809
+ },
2810
+ components: {
2811
+ pagination: script$2
2812
+ },
2813
+ computed: {
2814
+ windowWidth: function () {
2815
+ return window.innerWidth
2816
+ },
2817
+ hasDefaultSlot () {
2818
+ return !!this.$slots.default
2819
+ },
2820
+ user () {
2821
+ return this.global.state.user
2822
+ }
2823
+ }
2824
+ };
2825
+
2826
+ const _withScopeId = n => (pushScopeId("data-v-a10546a2"),n=n(),popScopeId(),n);
2827
+ const _hoisted_1$1 = { class: "auto-table mt-2" };
2828
+ const _hoisted_2$1 = {
2829
+ key: 0,
2830
+ class: "col-md-4 mb-2"
2831
+ };
2832
+ const _hoisted_3$1 = ["disabled"];
2833
+ const _hoisted_4 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/createElementVNode("i", { class: "bi-download" }, null, -1 /* HOISTED */));
2834
+ const _hoisted_5 = /*#__PURE__*/createTextVNode(" Export ");
2835
+ const _hoisted_6 = {
2836
+ key: 0,
2837
+ style: {"height":"1rem"},
2838
+ class: "float-start",
2839
+ src: "/assets/img/spinner.gif"
2840
+ };
2841
+ const _hoisted_7 = /*#__PURE__*/createTextVNode(" Exporting ... ");
2842
+ const _hoisted_8 = {
2843
+ key: 1,
2844
+ class: "row"
2845
+ };
2846
+ const _hoisted_9 = { class: "col-12 mb-3" };
2847
+ const _hoisted_10 = { class: "sh-search-bar" };
2848
+ const _hoisted_11 = ["placeholder"];
2849
+ const _hoisted_12 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/createElementVNode("span", { class: "sh-search-icon" }, [
2850
+ /*#__PURE__*/createElementVNode("i", { class: "bi bi-search mb-0" })
2851
+ ], -1 /* HOISTED */));
2852
+ const _hoisted_13 = {
2853
+ key: 2,
2854
+ class: "table"
2855
+ };
2856
+ const _hoisted_14 = ["onClick"];
2857
+ const _hoisted_15 = ["onClick"];
2858
+ const _hoisted_16 = ["onClick"];
2859
+ const _hoisted_17 = {
2860
+ key: 0,
2861
+ class: "text-capitalize"
2862
+ };
2863
+ const _hoisted_18 = {
2864
+ key: 0,
2865
+ class: "text-center"
2866
+ };
2867
+ const _hoisted_19 = ["colspan"];
2868
+ const _hoisted_20 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/createElementVNode("img", { src: "/assets/img/loading.gif" }, null, -1 /* HOISTED */));
2869
+ const _hoisted_21 = [
2870
+ _hoisted_20
2871
+ ];
2872
+ const _hoisted_22 = {
2873
+ key: 1,
2874
+ class: "text-center alert alert-danger"
2875
+ };
2876
+ const _hoisted_23 = ["colspan"];
2877
+ const _hoisted_24 = {
2878
+ key: 2,
2879
+ class: "text-center alert alert-info no_records"
2880
+ };
2881
+ const _hoisted_25 = ["colspan"];
2882
+ const _hoisted_26 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/createElementVNode("i", { class: "bi-info-circle" }, null, -1 /* HOISTED */));
2883
+ const _hoisted_27 = /*#__PURE__*/createTextVNode(" No records found ");
2884
+ const _hoisted_28 = [
2885
+ _hoisted_26,
2886
+ _hoisted_27
2887
+ ];
2888
+ const _hoisted_29 = ["onClick"];
2889
+ const _hoisted_30 = { key: 1 };
2890
+ const _hoisted_31 = {
2891
+ key: 2,
2892
+ class: "text-success fw-bold"
2893
+ };
2894
+ const _hoisted_32 = { key: 3 };
2895
+ const _hoisted_33 = ["innerHTML"];
2896
+ const _hoisted_34 = ["innerHTML"];
2897
+ const _hoisted_35 = ["innerHTML"];
2898
+ const _hoisted_36 = {
2899
+ key: 0,
2900
+ style: {"white-space":"nowrap"}
2901
+ };
2902
+ const _hoisted_37 = ["title", "onClick"];
2903
+ const _hoisted_38 = { key: 3 };
2904
+ const _hoisted_39 = {
2905
+ key: 0,
2906
+ class: "text-center"
2907
+ };
2908
+ const _hoisted_40 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/createElementVNode("span", { colspan: 2 }, [
2909
+ /*#__PURE__*/createElementVNode("img", { src: "/assets/img/loading.gif" })
2910
+ ], -1 /* HOISTED */));
2911
+ const _hoisted_41 = [
2912
+ _hoisted_40
2913
+ ];
2914
+ const _hoisted_42 = { key: 1 };
2915
+ const _hoisted_43 = { colspan: 2 };
2916
+ const _hoisted_44 = {
2917
+ key: 2,
2918
+ class: "mobile-list-items"
2919
+ };
2920
+ const _hoisted_45 = ["onClick"];
2921
+ const _hoisted_46 = {
2922
+ key: 0,
2923
+ class: "mb-1 font-weight-bold text-capitalize profile-form-title"
2924
+ };
2925
+ const _hoisted_47 = {
2926
+ key: 1,
2927
+ class: "mb-1 font-weight-bold text-capitalize profile-form-title"
2928
+ };
2929
+ const _hoisted_48 = {
2930
+ key: 2,
2931
+ class: "mb-1 font-weight-bold text-capitalize profile-form-title"
2932
+ };
2933
+ const _hoisted_49 = { key: 1 };
2934
+ const _hoisted_50 = {
2935
+ key: 2,
2936
+ class: "text-primary fw-bold"
2937
+ };
2938
+ const _hoisted_51 = ["innerHTML"];
2939
+ const _hoisted_52 = ["innerHTML"];
2940
+ const _hoisted_53 = ["innerHTML"];
2941
+ const _hoisted_54 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/createElementVNode("hr", { class: "my-2" }, null, -1 /* HOISTED */));
2942
+ const _hoisted_55 = { key: 0 };
2943
+ const _hoisted_56 = ["title", "onClick"];
2944
+
2945
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
2946
+ const _component_router_link = resolveComponent("router-link");
2947
+ const _component_pagination = resolveComponent("pagination");
2948
+
2949
+ return (openBlock(), createElementBlock("div", _hoisted_1$1, [
2950
+ ($props.hasDownload)
2951
+ ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
2952
+ createElementVNode("button", {
2953
+ disabled: $data.downloading,
2954
+ class: "btn btn-warning btn-sm",
2955
+ onClick: _cache[0] || (_cache[0] = $event => ($options.exportData()))
2956
+ }, [
2957
+ (!$data.downloading)
2958
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2959
+ _hoisted_4,
2960
+ _hoisted_5
2961
+ ], 64 /* STABLE_FRAGMENT */))
2962
+ : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2963
+ ($data.downloading)
2964
+ ? (openBlock(), createElementBlock("img", _hoisted_6))
2965
+ : createCommentVNode("v-if", true),
2966
+ _hoisted_7
2967
+ ], 64 /* STABLE_FRAGMENT */))
2968
+ ], 8 /* PROPS */, _hoisted_3$1)
2969
+ ]))
2970
+ : createCommentVNode("v-if", true),
2971
+ (!$props.hideSearch)
2972
+ ? (openBlock(), createElementBlock("div", _hoisted_8, [
2973
+ createElementVNode("div", _hoisted_9, [
2974
+ createElementVNode("div", _hoisted_10, [
2975
+ withDirectives(createElementVNode("input", {
2976
+ type: "text",
2977
+ onChange: _cache[1] || (_cache[1] = $event => ($options.reloadData(1))),
2978
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => (($data.filter_value) = $event)),
2979
+ placeholder: $props.searchPlaceholder ? $props.searchPlaceholder : 'Search',
2980
+ class: "form-control sh-search-input"
2981
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_11), [
2982
+ [vModelText, $data.filter_value]
2983
+ ]),
2984
+ _hoisted_12
2985
+ ])
2986
+ ])
2987
+ ]))
2988
+ : createCommentVNode("v-if", true),
2989
+ ($options.windowWidth > 700)
2990
+ ? (openBlock(), createElementBlock("table", _hoisted_13, [
2991
+ createElementVNode("thead", null, [
2992
+ createElementVNode("tr", null, [
2993
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (title) => {
2994
+ return (openBlock(), createElementBlock("th", {
2995
+ key: title[0]
2996
+ }, [
2997
+ (typeof title === 'string')
2998
+ ? (openBlock(), createElementBlock("a", {
2999
+ key: 0,
3000
+ class: "text-capitalize",
3001
+ onClick: $event => ($options.changeKey('order_by',title))
3002
+ }, toDisplayString(title.replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_14))
3003
+ : (typeof title === 'function')
3004
+ ? (openBlock(), createElementBlock("a", {
3005
+ key: 1,
3006
+ class: "text-capitalize",
3007
+ onClick: $event => ($options.changeKey('order_by',title))
3008
+ }, toDisplayString(title(null).replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_15))
3009
+ : (openBlock(), createElementBlock("a", {
3010
+ key: 2,
3011
+ class: "text-capitalize",
3012
+ onClick: $event => ($options.changeKey('order_by',title[0]))
3013
+ }, toDisplayString(title[1].replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_16))
3014
+ ]))
3015
+ }), 128 /* KEYED_FRAGMENT */)),
3016
+ ($props.actions)
3017
+ ? (openBlock(), createElementBlock("th", _hoisted_17, toDisplayString($props.actions.label), 1 /* TEXT */))
3018
+ : createCommentVNode("v-if", true)
3019
+ ])
3020
+ ]),
3021
+ createElementVNode("tbody", null, [
3022
+ ($data.loading === 'loading')
3023
+ ? (openBlock(), createElementBlock("tr", _hoisted_18, [
3024
+ createElementVNode("td", {
3025
+ colspan: $props.headers.length
3026
+ }, _hoisted_21, 8 /* PROPS */, _hoisted_19)
3027
+ ]))
3028
+ : ($data.loading === 'error')
3029
+ ? (openBlock(), createElementBlock("tr", _hoisted_22, [
3030
+ createElementVNode("td", {
3031
+ colspan: $props.headers.length
3032
+ }, toDisplayString($data.loading_error), 9 /* TEXT, PROPS */, _hoisted_23)
3033
+ ]))
3034
+ : ($data.records.length === 0)
3035
+ ? (openBlock(), createElementBlock("tr", _hoisted_24, [
3036
+ createElementVNode("td", {
3037
+ colspan: $props.actions ? $props.headers.length + 1 : $props.headers.length
3038
+ }, _hoisted_28, 8 /* PROPS */, _hoisted_25)
3039
+ ]))
3040
+ : ($data.loading === 'done')
3041
+ ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList($data.records, (record, index) => {
3042
+ return (openBlock(), createElementBlock("tr", {
3043
+ key: record.id,
3044
+ class: normalizeClass(record.class),
3045
+ onClick: $event => ($options.rowSelected(record))
3046
+ }, [
3047
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (key) => {
3048
+ return (openBlock(), createElementBlock("td", {
3049
+ key: key[0]
3050
+ }, [
3051
+ (typeof key === 'string' && $props.links && $props.links[key])
3052
+ ? (openBlock(), createBlock(_component_router_link, {
3053
+ key: 0,
3054
+ to: $options.replaceLinkUrl($props.links[key],record),
3055
+ class: normalizeClass($options.getLinkClass($props.links[key])),
3056
+ innerHTML: record[key]
3057
+ }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
3058
+ : ($options.getFieldType(key) === 'numeric')
3059
+ ? (openBlock(), createElementBlock("span", _hoisted_30, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3060
+ : ($options.getFieldType(key) === 'money')
3061
+ ? (openBlock(), createElementBlock("span", _hoisted_31, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3062
+ : ($options.getFieldType(key) === 'date')
3063
+ ? (openBlock(), createElementBlock("span", _hoisted_32, toDisplayString($options.formatDate(record[key])), 1 /* TEXT */))
3064
+ : (typeof key === 'string')
3065
+ ? (openBlock(), createElementBlock("span", {
3066
+ key: 4,
3067
+ innerHTML: record[key]
3068
+ }, null, 8 /* PROPS */, _hoisted_33))
3069
+ : (typeof key === 'function')
3070
+ ? (openBlock(), createElementBlock("span", {
3071
+ key: 5,
3072
+ innerHTML: key(record, index)
3073
+ }, null, 8 /* PROPS */, _hoisted_34))
3074
+ : (openBlock(), createElementBlock("span", {
3075
+ key: 6,
3076
+ innerHTML: record[key[0]]
3077
+ }, null, 8 /* PROPS */, _hoisted_35))
3078
+ ]))
3079
+ }), 128 /* KEYED_FRAGMENT */)),
3080
+ ($props.actions)
3081
+ ? (openBlock(), createElementBlock("td", _hoisted_36, [
3082
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.actions.actions, (act) => {
3083
+ return (openBlock(), createElementBlock(Fragment, {
3084
+ key: act.path
3085
+ }, [
3086
+ (!act.permission || $options.user.isAllowedTo(act.permission))
3087
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3088
+ (!act.validator || act.validator(record))
3089
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3090
+ (act.emits)
3091
+ ? (openBlock(), createElementBlock("button", {
3092
+ key: 0,
3093
+ title: act.title,
3094
+ class: normalizeClass(act.class ? act.class:'btn btn-default'),
3095
+ onClick: $event => ($options.doEmitAction(act.emits,record))
3096
+ }, toDisplayString(act.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_37))
3097
+ : createCommentVNode("v-if", true),
3098
+ (!act.emits)
3099
+ ? (openBlock(), createBlock(_component_router_link, {
3100
+ key: 1,
3101
+ title: act.title,
3102
+ to: $options.replaceActionUrl(act.path,record),
3103
+ class: normalizeClass(act.class)
3104
+ }, {
3105
+ default: withCtx(() => [
3106
+ createTextVNode(toDisplayString(act.label), 1 /* TEXT */)
3107
+ ]),
3108
+ _: 2 /* DYNAMIC */
3109
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3110
+ : createCommentVNode("v-if", true)
3111
+ ], 64 /* STABLE_FRAGMENT */))
3112
+ : createCommentVNode("v-if", true)
3113
+ ], 64 /* STABLE_FRAGMENT */))
3114
+ : createCommentVNode("v-if", true)
3115
+ ], 64 /* STABLE_FRAGMENT */))
3116
+ }), 128 /* KEYED_FRAGMENT */))
3117
+ ]))
3118
+ : createCommentVNode("v-if", true)
3119
+ ], 10 /* CLASS, PROPS */, _hoisted_29))
3120
+ }), 128 /* KEYED_FRAGMENT */))
3121
+ : createCommentVNode("v-if", true)
3122
+ ])
3123
+ ]))
3124
+ : (openBlock(), createElementBlock("div", _hoisted_38, [
3125
+ ($data.loading === 'loading')
3126
+ ? (openBlock(), createElementBlock("div", _hoisted_39, _hoisted_41))
3127
+ : ($data.loading === 'error')
3128
+ ? (openBlock(), createElementBlock("div", _hoisted_42, [
3129
+ createElementVNode("span", _hoisted_43, toDisplayString($data.loading_error), 1 /* TEXT */)
3130
+ ]))
3131
+ : ($data.loading === 'done')
3132
+ ? (openBlock(), createElementBlock("div", _hoisted_44, [
3133
+ (openBlock(true), createElementBlock(Fragment, null, renderList($data.records, (record, index) => {
3134
+ return (openBlock(), createElementBlock(Fragment, {
3135
+ key: record.id
3136
+ }, [
3137
+ createElementVNode("h3", null, toDisplayString($props.mobile_view), 1 /* TEXT */),
3138
+ createElementVNode("div", {
3139
+ class: "single-mobile-req bg-light p-3",
3140
+ onClick: $event => ($options.rowSelected(record))
3141
+ }, [
3142
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (key) => {
3143
+ return (openBlock(), createElementBlock(Fragment, {
3144
+ key: key[0]
3145
+ }, [
3146
+ (typeof key === 'string' )
3147
+ ? (openBlock(), createElementBlock("p", _hoisted_46, toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
3148
+ : (typeof key === 'function')
3149
+ ? (openBlock(), createElementBlock("p", _hoisted_47, toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
3150
+ : (openBlock(), createElementBlock("p", _hoisted_48, toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
3151
+ createElementVNode("span", null, [
3152
+ (typeof key === 'string' && $props.links && $props.links[key])
3153
+ ? (openBlock(), createBlock(_component_router_link, {
3154
+ key: 0,
3155
+ to: $options.replaceLinkUrl($props.links[key],record),
3156
+ class: normalizeClass($options.getLinkClass($props.links[key])),
3157
+ innerHTML: record[key]
3158
+ }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
3159
+ : ($options.getFieldType(key) === 'numeric')
3160
+ ? (openBlock(), createElementBlock("span", _hoisted_49, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3161
+ : ($options.getFieldType(key) === 'money')
3162
+ ? (openBlock(), createElementBlock("span", _hoisted_50, "KES " + toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3163
+ : (typeof key === 'string')
3164
+ ? (openBlock(), createElementBlock("span", {
3165
+ key: 3,
3166
+ innerHTML: record[key]
3167
+ }, null, 8 /* PROPS */, _hoisted_51))
3168
+ : (typeof key === 'function')
3169
+ ? (openBlock(), createElementBlock("span", {
3170
+ key: 4,
3171
+ innerHTML: key(record, index )
3172
+ }, null, 8 /* PROPS */, _hoisted_52))
3173
+ : (openBlock(), createElementBlock("span", {
3174
+ key: 5,
3175
+ innerHTML: record[key[0]]
3176
+ }, null, 8 /* PROPS */, _hoisted_53))
3177
+ ]),
3178
+ _hoisted_54
3179
+ ], 64 /* STABLE_FRAGMENT */))
3180
+ }), 128 /* KEYED_FRAGMENT */)),
3181
+ ($props.actions)
3182
+ ? (openBlock(), createElementBlock("div", _hoisted_55, [
3183
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.actions.actions, (act) => {
3184
+ return (openBlock(), createElementBlock(Fragment, {
3185
+ key: act.path
3186
+ }, [
3187
+ (!act.permission || $options.user.isAllowedTo(act.permission))
3188
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3189
+ (!act.validator || act.validator(record))
3190
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3191
+ (act.emits)
3192
+ ? (openBlock(), createElementBlock("button", {
3193
+ key: 0,
3194
+ title: act.title,
3195
+ class: normalizeClass(act.class ? act.class:'btn btn-default'),
3196
+ onClick: $event => ($options.doEmitAction(act.emits,record))
3197
+ }, toDisplayString(act.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_56))
3198
+ : createCommentVNode("v-if", true),
3199
+ (!act.emits)
3200
+ ? (openBlock(), createBlock(_component_router_link, {
3201
+ key: 1,
3202
+ title: act.title,
3203
+ to: $options.replaceActionUrl(act.path,record),
3204
+ class: normalizeClass(act.class)
3205
+ }, {
3206
+ default: withCtx(() => [
3207
+ createTextVNode(toDisplayString(act.label), 1 /* TEXT */)
3208
+ ]),
3209
+ _: 2 /* DYNAMIC */
3210
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3211
+ : createCommentVNode("v-if", true)
3212
+ ], 64 /* STABLE_FRAGMENT */))
3213
+ : createCommentVNode("v-if", true)
3214
+ ], 64 /* STABLE_FRAGMENT */))
3215
+ : createCommentVNode("v-if", true)
3216
+ ], 64 /* STABLE_FRAGMENT */))
3217
+ }), 128 /* KEYED_FRAGMENT */))
3218
+ ]))
3219
+ : createCommentVNode("v-if", true)
3220
+ ], 8 /* PROPS */, _hoisted_45)
3221
+ ], 64 /* STABLE_FRAGMENT */))
3222
+ }), 128 /* KEYED_FRAGMENT */))
3223
+ ]))
3224
+ : createCommentVNode("v-if", true)
3225
+ ])),
3226
+ ($data.pagination_data)
3227
+ ? (openBlock(), createBlock(_component_pagination, {
3228
+ key: 4,
3229
+ onLoadMoreRecords: $options.loadMoreRecords,
3230
+ "hide-load-more": $props.hideLoadMore,
3231
+ "hide-count": $props.hideCount,
3232
+ pagination_data: $data.pagination_data,
3233
+ onChangeKey: $options.changeKey,
3234
+ "load-more": "1"
3235
+ }, null, 8 /* PROPS */, ["onLoadMoreRecords", "hide-load-more", "hide-count", "pagination_data", "onChangeKey"]))
3236
+ : createCommentVNode("v-if", true)
3237
+ ]))
3238
+ }
3239
+
3240
+ script$1.render = render$1;
3241
+ script$1.__scopeId = "data-v-a10546a2";
3242
+ script$1.__file = "src/views/ShTable.vue";
3243
+
3244
+ var script = {
3245
+ name: 'ShTabs',
3246
+ props: ['tabs', 'base_url', 'shared_data', 'tab_counts'],
3247
+ inject: ['global'],
3248
+ data () {
3249
+ return {
3250
+ currentTab: ''
3251
+ }
3252
+ },
3253
+ watch: {
3254
+ refreshStatus: function (state) {
3255
+ if (state === 0) {
3256
+ if (this.tab_counts) {
3257
+ this.setTabCounts(this.tab_counts);
3258
+ }
3259
+ }
3260
+ },
3261
+ tab_counts: function () {
3262
+ this.resetTabCounts();
3263
+ }
3264
+ },
3265
+ computed: {
3266
+ refreshStatus () {
3267
+ return this.global.state.refetch
3268
+ }
3269
+ },
3270
+ mounted () {
3271
+ this.resetTabCounts();
3272
+ },
3273
+ methods: {
3274
+ setTabCounts: function (tabCounts) {
3275
+ if (typeof tabCounts === 'object') {
3276
+ this.setCounts(tabCounts);
3277
+ } else {
3278
+ apis.doGet(tabCounts).then(res => {
3279
+ this.setCounts(res.data);
3280
+ });
3281
+ }
3282
+ },
3283
+ resetTabCounts: function () {
3284
+ const arr = this.$route.fullPath.split('/');
3285
+ if (!this.tabExistsInUrl()) {
3286
+ this.$router.push(this.$route.fullPath + '/tab/' + this.tabs[0]);
3287
+ } else {
3288
+ this.currentTab = arr[arr.length - 1];
3289
+ }
3290
+ if (this.tab_counts) {
3291
+ this.setTabCounts(this.tab_counts);
3292
+ }
3293
+ },
3294
+ tabExistsInUrl: function () {
3295
+ let exists = false;
3296
+ this.tabs.forEach(tab => {
3297
+ if (this.$route.fullPath.includes(tab)) {
3298
+ exists = true;
3299
+ }
3300
+ });
3301
+ return exists
3302
+ },
3303
+ setCounts: function (res) {
3304
+ Object.keys(res).forEach(key => {
3305
+ const elem = document.getElementById('sh_tab_' + key);
3306
+ if (elem) {
3307
+ let txt = elem.innerHTML;
3308
+ txt = txt.split('<i class="d-none"></i>')[0];
3309
+ if (parseInt(res[key]) > 0) {
3310
+ elem.innerHTML = txt + '<i class="d-none"></i><sup class="sh_tab_count">' + res[key] + '</sup>';
3311
+ }
3312
+ }
3313
+ });
3314
+ }
3315
+ }
3316
+ };
3317
+
3318
+ const _hoisted_1 = { class: "common_tabs" };
3319
+ const _hoisted_2 = {
3320
+ class: "nav nav-tabs mb-2",
3321
+ id: "myTab",
3322
+ role: "tablist"
3323
+ };
3324
+ const _hoisted_3 = { class: "tab-content" };
3325
+
3326
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
3327
+ const _component_router_link = resolveComponent("router-link");
3328
+ const _component_router_view = resolveComponent("router-view");
3329
+
3330
+ return (openBlock(), createElementBlock("div", _hoisted_1, [
3331
+ createElementVNode("ul", _hoisted_2, [
3332
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.tabs, (tab) => {
3333
+ return (openBlock(), createElementBlock("li", {
3334
+ class: "nav-item",
3335
+ key: tab
3336
+ }, [
3337
+ createVNode(_component_router_link, {
3338
+ "active-class": 'active',
3339
+ class: "nav-link text-capitalize",
3340
+ to: $props.base_url+'/tab/'+tab,
3341
+ role: "tab",
3342
+ id: 'sh_tab_' + tab
3343
+ }, {
3344
+ default: withCtx(() => [
3345
+ createTextVNode(toDisplayString(tab.replace(/_/g, ' ')), 1 /* TEXT */)
3346
+ ]),
3347
+ _: 2 /* DYNAMIC */
3348
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["to", "id"])
3349
+ ]))
3350
+ }), 128 /* KEYED_FRAGMENT */))
3351
+ ]),
3352
+ createElementVNode("div", _hoisted_3, [
3353
+ createVNode(_component_router_view, {
3354
+ current_tab: $data.currentTab,
3355
+ shared_data: $props.shared_data,
3356
+ tab_counts: $props.tab_counts
3357
+ }, null, 8 /* PROPS */, ["current_tab", "shared_data", "tab_counts"])
3358
+ ])
3359
+ ]))
3360
+ }
3361
+
3362
+ script.render = render;
3363
+ script.__scopeId = "data-v-3628b6a6";
3364
+ script.__file = "src/views/ShTabs.vue";
3365
+
3366
+ var components = {
3367
+ ShForm: script$5,
3368
+ ShCanvas: script$4,
3369
+ ShModal: script$3,
3370
+ ShPhone: script$6,
3371
+ ShTable: script$1,
3372
+ ShTabs: script
3373
+ };
3374
+
3375
+ const plugin = {
3376
+ install (Vue) {
3377
+ for (const prop in components) {
3378
+ if (components.hasOwnProperty(prop)) {
3379
+ const component = components[prop];
3380
+ Vue.component(component.name, component);
3381
+ }
3382
+ }
3383
+ }
3384
+ };
3385
+
3386
+ export { plugin as default };