@agendar/shared 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-VHINV4UK.js → chunk-6MEQXAPW.js} +101 -4
- package/dist/chunk-6MEQXAPW.js.map +1 -0
- package/dist/{chunk-V35KHOP7.js → chunk-NGCGPQ4L.js} +101 -4
- package/dist/chunk-NGCGPQ4L.js.map +1 -0
- package/dist/{chunk-KBHYWZZW.js → chunk-Y2LPIEBZ.js} +101 -4
- package/dist/chunk-Y2LPIEBZ.js.map +1 -0
- package/dist/i18n/en.cjs +99 -2
- package/dist/i18n/en.cjs.map +1 -1
- package/dist/i18n/en.d.cts +98 -1
- package/dist/i18n/en.d.ts +98 -1
- package/dist/i18n/en.js +1 -1
- package/dist/i18n/es.cjs +99 -2
- package/dist/i18n/es.cjs.map +1 -1
- package/dist/i18n/es.d.cts +98 -1
- package/dist/i18n/es.d.ts +98 -1
- package/dist/i18n/es.js +1 -1
- package/dist/i18n/index.cjs +297 -6
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.js +3 -3
- package/dist/i18n/pt.cjs +99 -2
- package/dist/i18n/pt.cjs.map +1 -1
- package/dist/i18n/pt.d.cts +98 -1
- package/dist/i18n/pt.d.ts +98 -1
- package/dist/i18n/pt.js +1 -1
- package/dist/utils/appointments.cjs +1 -1
- package/dist/utils/appointments.cjs.map +1 -1
- package/dist/utils/appointments.d.cts +2 -0
- package/dist/utils/appointments.d.ts +2 -0
- package/dist/utils/appointments.js +1 -1
- package/dist/utils/appointments.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-KBHYWZZW.js.map +0 -1
- package/dist/chunk-V35KHOP7.js.map +0 -1
- package/dist/chunk-VHINV4UK.js.map +0 -1
package/dist/i18n/pt.d.cts
CHANGED
|
@@ -553,6 +553,50 @@ declare const appPT: {
|
|
|
553
553
|
"clients.create.submit": string;
|
|
554
554
|
"clients.create.success": string;
|
|
555
555
|
"clients.create.error": string;
|
|
556
|
+
"clients.edit.fields.firstname": string;
|
|
557
|
+
"clients.edit.fields.lastname": string;
|
|
558
|
+
"clients.edit.toast.firstname": string;
|
|
559
|
+
"clients.edit.toast.lastname": string;
|
|
560
|
+
"clients.edit.toast.photo": string;
|
|
561
|
+
"clients.edit.editPhoto": string;
|
|
562
|
+
"clients.edit.editPhotoHint": string;
|
|
563
|
+
"clients.edit.photoSheet.title": string;
|
|
564
|
+
"clients.edit.photoSheet.label": string;
|
|
565
|
+
"clients.edit.photoSheet.invalid": string;
|
|
566
|
+
"clients.edit.photoSheet.save": string;
|
|
567
|
+
"clients.edit.photoSheet.remove": string;
|
|
568
|
+
"clients.edit.fields.phone": string;
|
|
569
|
+
"clients.edit.countryHint": string;
|
|
570
|
+
"clients.edit.fields.email": string;
|
|
571
|
+
"clients.edit.fields.birthday": string;
|
|
572
|
+
"clients.edit.fields.notes": string;
|
|
573
|
+
"clients.edit.empty": string;
|
|
574
|
+
"clients.edit.editHint": string;
|
|
575
|
+
"clients.edit.openHint": string;
|
|
576
|
+
"clients.edit.saved": string;
|
|
577
|
+
"clients.edit.toast.phone": string;
|
|
578
|
+
"clients.edit.toast.email": string;
|
|
579
|
+
"clients.edit.toast.birthday": string;
|
|
580
|
+
"clients.edit.toast.notes": string;
|
|
581
|
+
"clients.edit.undo": string;
|
|
582
|
+
"clients.edit.undoHint": string;
|
|
583
|
+
"clients.edit.undone": string;
|
|
584
|
+
"clients.edit.phoneTaken": string;
|
|
585
|
+
"clients.edit.emailTaken": string;
|
|
586
|
+
"clients.edit.checking": string;
|
|
587
|
+
"clients.edit.birthdayValue": string;
|
|
588
|
+
"clients.edit.notesHint": string;
|
|
589
|
+
"clients.edit.notesCount": string;
|
|
590
|
+
"clients.edit.notesPlaceholder": string;
|
|
591
|
+
"clients.edit.deleteHint": string;
|
|
592
|
+
"clients.edit.birthdaySheet.title": string;
|
|
593
|
+
"clients.edit.birthdaySheet.closeHint": string;
|
|
594
|
+
"clients.edit.birthdaySheet.day": string;
|
|
595
|
+
"clients.edit.birthdaySheet.month": string;
|
|
596
|
+
"clients.edit.birthdaySheet.year": string;
|
|
597
|
+
"clients.edit.birthdaySheet.age": string;
|
|
598
|
+
"clients.edit.birthdaySheet.save": string;
|
|
599
|
+
"clients.edit.birthdaySheet.remove": string;
|
|
556
600
|
"clients.edit.submit": string;
|
|
557
601
|
"clients.edit.success": string;
|
|
558
602
|
"clients.edit.error": string;
|
|
@@ -617,6 +661,8 @@ declare const appPT: {
|
|
|
617
661
|
"clients.tabHistory.packageDetail": string;
|
|
618
662
|
"clients.tabHistory.subtotal": string;
|
|
619
663
|
"clients.tabHistory.total": string;
|
|
664
|
+
"clients.tabHistory.openStatus": string;
|
|
665
|
+
"clients.tabHistory.goToOpenTab": string;
|
|
620
666
|
"clients.tabHistory.payment": string;
|
|
621
667
|
"clients.tabHistory.noPayment": string;
|
|
622
668
|
"clients.tabHistory.expandHint": string;
|
|
@@ -790,7 +836,6 @@ declare const appPT: {
|
|
|
790
836
|
"professionals.commissions.vouchers.cancelSuccess": string;
|
|
791
837
|
"professionals.commissions.vouchers.emptyTitle": string;
|
|
792
838
|
"professionals.commissions.vouchers.emptySubtitle": string;
|
|
793
|
-
"professionals.commissions.vouchers.emptyAction": string;
|
|
794
839
|
"professionals.commissions.vouchers.loadError": string;
|
|
795
840
|
"professionals.commissions.vouchers.new": string;
|
|
796
841
|
"professionals.commissions.vouchers.newHint": string;
|
|
@@ -2254,10 +2299,62 @@ declare const appPT: {
|
|
|
2254
2299
|
"packages.services.validation.percentage.invalid": string;
|
|
2255
2300
|
"packages.sales.validation.client.required": string;
|
|
2256
2301
|
"packages.sales.validation.package.required": string;
|
|
2302
|
+
"appointment.form.newTitle": string;
|
|
2303
|
+
"appointment.form.editTitle": string;
|
|
2304
|
+
"appointment.form.closeHint": string;
|
|
2305
|
+
"appointment.form.phone": string;
|
|
2306
|
+
"appointment.form.anyProfessional": string;
|
|
2307
|
+
"appointment.form.missing.phone": string;
|
|
2308
|
+
"appointment.form.notes.hint": string;
|
|
2309
|
+
"appointment.form.dateTime.businessHours": string;
|
|
2310
|
+
"appointment.form.dateTime.legendBusiness": string;
|
|
2311
|
+
"appointment.form.items.confirmEmpty": string;
|
|
2312
|
+
"appointment.form.clearClient": string;
|
|
2313
|
+
"appointment.form.clearClientHint": string;
|
|
2314
|
+
"appointment.form.clearProfessional": string;
|
|
2315
|
+
"appointment.form.clearProfessionalHint": string;
|
|
2316
|
+
"appointment.form.client": string;
|
|
2317
|
+
"appointment.form.services": string;
|
|
2318
|
+
"appointment.form.professional": string;
|
|
2319
|
+
"appointment.form.dateTime": string;
|
|
2320
|
+
"appointment.form.choose": string;
|
|
2321
|
+
"appointment.form.add": string;
|
|
2322
|
+
"appointment.form.required": string;
|
|
2323
|
+
"appointment.form.minutes": string;
|
|
2324
|
+
"appointment.form.addAnother": string;
|
|
2325
|
+
"appointment.form.clientHint": string;
|
|
2326
|
+
"appointment.form.servicesHint": string;
|
|
2327
|
+
"appointment.form.professionalHint": string;
|
|
2328
|
+
"appointment.form.dateTimeHint": string;
|
|
2329
|
+
"appointment.form.submit": string;
|
|
2330
|
+
"appointment.form.save": string;
|
|
2331
|
+
"appointment.form.missing.time": string;
|
|
2332
|
+
"appointment.form.missing.and": string;
|
|
2333
|
+
"appointment.form.missing.text_one": string;
|
|
2334
|
+
"appointment.form.missing.text_other": string;
|
|
2335
|
+
"appointment.form.items.title": string;
|
|
2336
|
+
"appointment.form.items.confirm_one": string;
|
|
2337
|
+
"appointment.form.items.confirm_other": string;
|
|
2338
|
+
"appointment.form.items.searchHint": string;
|
|
2339
|
+
"appointment.form.dateTime.title": string;
|
|
2340
|
+
"appointment.form.dateTime.closeHint": string;
|
|
2341
|
+
"appointment.form.dateTime.today": string;
|
|
2342
|
+
"appointment.form.dateTime.periods.morning": string;
|
|
2343
|
+
"appointment.form.dateTime.periods.afternoon": string;
|
|
2344
|
+
"appointment.form.dateTime.periods.evening": string;
|
|
2345
|
+
"appointment.form.dateTime.noSlots": string;
|
|
2346
|
+
"appointment.form.dateTime.legend": string;
|
|
2347
|
+
"appointment.form.dateTime.confirm": string;
|
|
2348
|
+
"appointment.form.dateTime.confirmHint": string;
|
|
2349
|
+
"appointment.form.dateTime.pickTime": string;
|
|
2350
|
+
"appointment.form.dateTime.taken": string;
|
|
2351
|
+
"appointment.form.notes.label": string;
|
|
2352
|
+
"appointment.form.notes.placeholder": string;
|
|
2257
2353
|
APPT_001: string;
|
|
2258
2354
|
APPT_002: string;
|
|
2259
2355
|
APPT_003: string;
|
|
2260
2356
|
APPT_004: string;
|
|
2357
|
+
APPT_005: string;
|
|
2261
2358
|
APPT_200: string;
|
|
2262
2359
|
APPT_200_DELETE: string;
|
|
2263
2360
|
APPT_201: string;
|
package/dist/i18n/pt.d.ts
CHANGED
|
@@ -553,6 +553,50 @@ declare const appPT: {
|
|
|
553
553
|
"clients.create.submit": string;
|
|
554
554
|
"clients.create.success": string;
|
|
555
555
|
"clients.create.error": string;
|
|
556
|
+
"clients.edit.fields.firstname": string;
|
|
557
|
+
"clients.edit.fields.lastname": string;
|
|
558
|
+
"clients.edit.toast.firstname": string;
|
|
559
|
+
"clients.edit.toast.lastname": string;
|
|
560
|
+
"clients.edit.toast.photo": string;
|
|
561
|
+
"clients.edit.editPhoto": string;
|
|
562
|
+
"clients.edit.editPhotoHint": string;
|
|
563
|
+
"clients.edit.photoSheet.title": string;
|
|
564
|
+
"clients.edit.photoSheet.label": string;
|
|
565
|
+
"clients.edit.photoSheet.invalid": string;
|
|
566
|
+
"clients.edit.photoSheet.save": string;
|
|
567
|
+
"clients.edit.photoSheet.remove": string;
|
|
568
|
+
"clients.edit.fields.phone": string;
|
|
569
|
+
"clients.edit.countryHint": string;
|
|
570
|
+
"clients.edit.fields.email": string;
|
|
571
|
+
"clients.edit.fields.birthday": string;
|
|
572
|
+
"clients.edit.fields.notes": string;
|
|
573
|
+
"clients.edit.empty": string;
|
|
574
|
+
"clients.edit.editHint": string;
|
|
575
|
+
"clients.edit.openHint": string;
|
|
576
|
+
"clients.edit.saved": string;
|
|
577
|
+
"clients.edit.toast.phone": string;
|
|
578
|
+
"clients.edit.toast.email": string;
|
|
579
|
+
"clients.edit.toast.birthday": string;
|
|
580
|
+
"clients.edit.toast.notes": string;
|
|
581
|
+
"clients.edit.undo": string;
|
|
582
|
+
"clients.edit.undoHint": string;
|
|
583
|
+
"clients.edit.undone": string;
|
|
584
|
+
"clients.edit.phoneTaken": string;
|
|
585
|
+
"clients.edit.emailTaken": string;
|
|
586
|
+
"clients.edit.checking": string;
|
|
587
|
+
"clients.edit.birthdayValue": string;
|
|
588
|
+
"clients.edit.notesHint": string;
|
|
589
|
+
"clients.edit.notesCount": string;
|
|
590
|
+
"clients.edit.notesPlaceholder": string;
|
|
591
|
+
"clients.edit.deleteHint": string;
|
|
592
|
+
"clients.edit.birthdaySheet.title": string;
|
|
593
|
+
"clients.edit.birthdaySheet.closeHint": string;
|
|
594
|
+
"clients.edit.birthdaySheet.day": string;
|
|
595
|
+
"clients.edit.birthdaySheet.month": string;
|
|
596
|
+
"clients.edit.birthdaySheet.year": string;
|
|
597
|
+
"clients.edit.birthdaySheet.age": string;
|
|
598
|
+
"clients.edit.birthdaySheet.save": string;
|
|
599
|
+
"clients.edit.birthdaySheet.remove": string;
|
|
556
600
|
"clients.edit.submit": string;
|
|
557
601
|
"clients.edit.success": string;
|
|
558
602
|
"clients.edit.error": string;
|
|
@@ -617,6 +661,8 @@ declare const appPT: {
|
|
|
617
661
|
"clients.tabHistory.packageDetail": string;
|
|
618
662
|
"clients.tabHistory.subtotal": string;
|
|
619
663
|
"clients.tabHistory.total": string;
|
|
664
|
+
"clients.tabHistory.openStatus": string;
|
|
665
|
+
"clients.tabHistory.goToOpenTab": string;
|
|
620
666
|
"clients.tabHistory.payment": string;
|
|
621
667
|
"clients.tabHistory.noPayment": string;
|
|
622
668
|
"clients.tabHistory.expandHint": string;
|
|
@@ -790,7 +836,6 @@ declare const appPT: {
|
|
|
790
836
|
"professionals.commissions.vouchers.cancelSuccess": string;
|
|
791
837
|
"professionals.commissions.vouchers.emptyTitle": string;
|
|
792
838
|
"professionals.commissions.vouchers.emptySubtitle": string;
|
|
793
|
-
"professionals.commissions.vouchers.emptyAction": string;
|
|
794
839
|
"professionals.commissions.vouchers.loadError": string;
|
|
795
840
|
"professionals.commissions.vouchers.new": string;
|
|
796
841
|
"professionals.commissions.vouchers.newHint": string;
|
|
@@ -2254,10 +2299,62 @@ declare const appPT: {
|
|
|
2254
2299
|
"packages.services.validation.percentage.invalid": string;
|
|
2255
2300
|
"packages.sales.validation.client.required": string;
|
|
2256
2301
|
"packages.sales.validation.package.required": string;
|
|
2302
|
+
"appointment.form.newTitle": string;
|
|
2303
|
+
"appointment.form.editTitle": string;
|
|
2304
|
+
"appointment.form.closeHint": string;
|
|
2305
|
+
"appointment.form.phone": string;
|
|
2306
|
+
"appointment.form.anyProfessional": string;
|
|
2307
|
+
"appointment.form.missing.phone": string;
|
|
2308
|
+
"appointment.form.notes.hint": string;
|
|
2309
|
+
"appointment.form.dateTime.businessHours": string;
|
|
2310
|
+
"appointment.form.dateTime.legendBusiness": string;
|
|
2311
|
+
"appointment.form.items.confirmEmpty": string;
|
|
2312
|
+
"appointment.form.clearClient": string;
|
|
2313
|
+
"appointment.form.clearClientHint": string;
|
|
2314
|
+
"appointment.form.clearProfessional": string;
|
|
2315
|
+
"appointment.form.clearProfessionalHint": string;
|
|
2316
|
+
"appointment.form.client": string;
|
|
2317
|
+
"appointment.form.services": string;
|
|
2318
|
+
"appointment.form.professional": string;
|
|
2319
|
+
"appointment.form.dateTime": string;
|
|
2320
|
+
"appointment.form.choose": string;
|
|
2321
|
+
"appointment.form.add": string;
|
|
2322
|
+
"appointment.form.required": string;
|
|
2323
|
+
"appointment.form.minutes": string;
|
|
2324
|
+
"appointment.form.addAnother": string;
|
|
2325
|
+
"appointment.form.clientHint": string;
|
|
2326
|
+
"appointment.form.servicesHint": string;
|
|
2327
|
+
"appointment.form.professionalHint": string;
|
|
2328
|
+
"appointment.form.dateTimeHint": string;
|
|
2329
|
+
"appointment.form.submit": string;
|
|
2330
|
+
"appointment.form.save": string;
|
|
2331
|
+
"appointment.form.missing.time": string;
|
|
2332
|
+
"appointment.form.missing.and": string;
|
|
2333
|
+
"appointment.form.missing.text_one": string;
|
|
2334
|
+
"appointment.form.missing.text_other": string;
|
|
2335
|
+
"appointment.form.items.title": string;
|
|
2336
|
+
"appointment.form.items.confirm_one": string;
|
|
2337
|
+
"appointment.form.items.confirm_other": string;
|
|
2338
|
+
"appointment.form.items.searchHint": string;
|
|
2339
|
+
"appointment.form.dateTime.title": string;
|
|
2340
|
+
"appointment.form.dateTime.closeHint": string;
|
|
2341
|
+
"appointment.form.dateTime.today": string;
|
|
2342
|
+
"appointment.form.dateTime.periods.morning": string;
|
|
2343
|
+
"appointment.form.dateTime.periods.afternoon": string;
|
|
2344
|
+
"appointment.form.dateTime.periods.evening": string;
|
|
2345
|
+
"appointment.form.dateTime.noSlots": string;
|
|
2346
|
+
"appointment.form.dateTime.legend": string;
|
|
2347
|
+
"appointment.form.dateTime.confirm": string;
|
|
2348
|
+
"appointment.form.dateTime.confirmHint": string;
|
|
2349
|
+
"appointment.form.dateTime.pickTime": string;
|
|
2350
|
+
"appointment.form.dateTime.taken": string;
|
|
2351
|
+
"appointment.form.notes.label": string;
|
|
2352
|
+
"appointment.form.notes.placeholder": string;
|
|
2257
2353
|
APPT_001: string;
|
|
2258
2354
|
APPT_002: string;
|
|
2259
2355
|
APPT_003: string;
|
|
2260
2356
|
APPT_004: string;
|
|
2357
|
+
APPT_005: string;
|
|
2261
2358
|
APPT_200: string;
|
|
2262
2359
|
APPT_200_DELETE: string;
|
|
2263
2360
|
APPT_201: string;
|
package/dist/i18n/pt.js
CHANGED
|
@@ -60,7 +60,7 @@ function generateTimelineEvents(data, getStatusColorValue) {
|
|
|
60
60
|
const startTime = appointment.appointment_time.slice(0, 5);
|
|
61
61
|
const endTime = addMinutesToTime(
|
|
62
62
|
startTime,
|
|
63
|
-
appointment.service?.duration_minutes ?? DEFAULT_DURATION_MINUTES
|
|
63
|
+
appointment.duration_minutes ?? appointment.service?.duration_minutes ?? DEFAULT_DURATION_MINUTES
|
|
64
64
|
);
|
|
65
65
|
return {
|
|
66
66
|
id: appointment.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/utils/date.ts","../../src/core/utils/fullname.ts","../../src/core/utils/appointments.ts"],"names":["dayjs","localizedFormat","localeData"],"mappings":";;;;;;;;;;;;;AAIAA,sBAAA,CAAM,OAAOC,gCAAe,CAAA;AAC5BD,sBAAA,CAAM,OAAOE,2BAAU,CAAA;AA6EhB,SAAS,gBAAA,CAAiB,MAAc,OAAA,EAAyB;AACtE,EAAA,OAAOF,sBAAA,CAAM,CAAA,WAAA,EAAc,IAAI,CAAA,CAAE,CAAA,CAAE,IAAI,OAAA,EAAS,QAAQ,CAAA,CAAE,MAAA,CAAO,OAAO,CAAA;AAC1E;;;ACpFO,IAAM,WAAA,GAAc,CAAC,SAAA,EAAmB,QAAA,KAC7C,WAAW,CAAA,EAAG,SAAS,CAAA,CAAA,EAAI,QAAQ,CAAA,CAAA,GAAK,SAAA;;;ACkD1C,IAAM,cAAA,GAAiB,WAAA;AACvB,IAAM,wBAAA,GAA2B,EAAA;AAE1B,IAAM,QAAQA,sBAAAA;AAEd,SAAS,sBAAA,CACd,IAAA,EACA,QAAA,EACA,MAAA,EACoB;AACpB,EAAA,MAAM,WAA+B,EAAC;AACtC,EAAA,IAAI,OAAA,GAAUA,uBAAM,QAAQ,CAAA;AAC5B,EAAA,MAAM,GAAA,GAAMA,uBAAM,MAAM,CAAA;AAExB,EAAA,OAAO,CAAC,OAAA,CAAQ,OAAA,CAAQ,GAAG,CAAA,EAAG;AAC5B,IAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,MAAA,CAAO,YAAY,CAAA;AACvC,IAAA,QAAA,CAAS,IAAA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AAEA,QAAA,OAAO;AAAA,UACL,IAAI,WAAA,CAAY,EAAA;AAAA,UAChB,KAAA,EAAO,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,SAAS,CAAA,GAAA,CAAA;AAAA,UAC3B,GAAA,EAAK,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,OAAO,CAAA,GAAA,CAAA;AAAA,UACvB,KAAA,EAAO,YAAY,MAAA,GACf,WAAA;AAAA,YACE,WAAA,CAAY,OAAO,SAAA,IAAa,EAAA;AAAA,YAChC,WAAA,CAAY,OAAO,QAAA,IAAY;AAAA,cAEjC,WAAA,CAAY,YAAA;AAAA,UAChB,OAAA,EAAS,WAAA,CAAY,OAAA,EAAS,IAAA,IAAQ,GAAA;AAAA,UACtC,KAAA,EAAO,mBAAA,CAAoB,WAAA,CAAY,MAAM,CAAA;AAAA,UAC7C,cAAA,EAAgB,WAAA,CAAY,YAAA,EAAc,EAAA,IAAM;AAAA,SAClD;AAAA,MACF,CAAC;AAAA,KACF;AAAA,GACH;AACF","file":"appointments.cjs","sourcesContent":["import dayjs from \"dayjs\";\nimport localeData from \"dayjs/plugin/localeData.js\";\nimport localizedFormat from \"dayjs/plugin/localizedFormat.js\";\n\ndayjs.extend(localizedFormat);\ndayjs.extend(localeData);\n\nexport function addDays(date: Date, days: number): Date {\n return dayjs(date).add(days, \"day\").toDate();\n}\n\n/** Full years elapsed since a \"YYYY-MM-DD\" birthday, as of today. */\nexport function calculateAge(birthday: string): number {\n return dayjs().diff(dayjs(birthday), \"year\");\n}\n\n/**\n * Whether a \"YYYY-MM-DD\" string is a real calendar date (rejects e.g. \"2024-02-30\"\n * or \"2024-13-01\", which a shape-only regex like `birthdayRegex` would let through).\n */\nexport function isValidCalendarDate(value: string): boolean {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value);\n if (!match) return false;\n\n const [, yearStr, monthStr, dayStr] = match;\n const year = Number(yearStr);\n const month = Number(monthStr);\n const day = Number(dayStr);\n\n const date = new Date(year, month - 1, day);\n return (\n date.getFullYear() === year &&\n date.getMonth() === month - 1 &&\n date.getDate() === day\n );\n}\n\n/** Converts a \"YYYY-MM-DD\" value to \"DD/MM/YYYY\" for masked-input display. Empty in, empty out. */\nexport function isoToDisplayDate(iso: string): string {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(iso);\n if (!match) return \"\";\n\n const [, year, month, day] = match;\n return `${day}/${month}/${year}`;\n}\n\n/**\n * Converts the raw digits typed into a DD/MM/YYYY mask (e.g. \"15081990\") into\n * \"YYYY-MM-DD\". Returns \"\" until all 8 digits have been entered.\n */\nexport function maskedDigitsToIsoDate(digits: string): string {\n if (digits.length !== 8) return \"\";\n\n const day = digits.slice(0, 2);\n const month = digits.slice(2, 4);\n const year = digits.slice(4, 8);\n return `${year}-${month}-${day}`;\n}\n\nexport function toDateString(date: Date): string {\n return dayjs(date).format(\"YYYY-MM-DD\");\n}\n\nexport function parseDateParts(dateString: string): {\n month: string;\n day: string;\n} {\n const date = dayjs(dateString);\n return {\n month: date.format(\"MMM\").toUpperCase(),\n day: date.format(\"D\"),\n };\n}\n\nexport function formatMonthDay(dateString: string): string {\n return dayjs(dateString).format(\"MMM D\");\n}\n\nexport function formatTime12h(time: string): string {\n return dayjs(`1970-01-01 ${time}`).format(\"h:mm a\");\n}\n\nexport function addMinutesToTime(time: string, minutes: number): string {\n return dayjs(`1970-01-01 ${time}`).add(minutes, \"minute\").format(\"HH:mm\");\n}\n\n/** Formats a date using the active dayjs locale (e.g. DD/MM/YYYY for pt-br, MM/DD/YYYY for en). */\nexport function formatLocalizedDate(\n date: Date | string | null | undefined,\n): string {\n if (!date) return \"—\";\n return dayjs(date).format(\"L\");\n}\n\n/** Formats a date and time using the active dayjs locale. */\nexport function formatLocalizedDateTime(\n date: Date | string | null | undefined,\n): string {\n if (!date) return \"—\";\n return dayjs(date).format(\"L LT\");\n}\n\n/** Day/month order for the active dayjs locale, derived from its full date pattern (e.g. \"DD/MM\" for pt-br, \"MM/DD\" for en). */\nfunction localizedShortDatePattern(): string {\n const longFormat = dayjs.localeData().longDateFormat(\"L\");\n return longFormat\n .replace(/^[,./\\-\\s]*Y+[,./\\-\\s]*/, \"\")\n .replace(/[,./\\-\\s]*Y+[,./\\-\\s]*$/, \"\");\n}\n\n/** Formats a date as day/month (no year), in the order the active dayjs locale uses. */\nexport function formatLocalizedShortDate(\n date: Date | string | null | undefined,\n): string {\n if (!date) return \"—\";\n return dayjs(date).format(localizedShortDatePattern());\n}\n","export const getFullName = (firstname: string, lastname?: string): string =>\n lastname ? `${firstname} ${lastname}` : firstname;\n","import dayjs from \"dayjs\";\n\nimport { addMinutesToTime } from \"./date\";\nimport { getFullName } from \"./fullname\";\n\nexport interface AppointmentLike {\n id: number;\n appointment_time: string;\n status?: string | null;\n phone_number: string;\n service?: {\n duration_minutes?: number | null;\n name?: string | null;\n } | null;\n client?: {\n firstname?: string | null;\n lastname?: string | null;\n } | null;\n professional?: {\n id: number;\n firstname?: string | null;\n lastname?: string | null;\n } | null;\n}\n\nexport interface AgendaSection<T> {\n title: string;\n data: T[];\n}\n\nexport interface TimelineEvent {\n id: number;\n start: string;\n end: string;\n title: string;\n summary: string;\n color: string;\n professionalId: number | null;\n}\n\nexport interface MarkedDateDot {\n key: string;\n color: string;\n}\n\nexport interface MarkedDate {\n dots: MarkedDateDot[];\n}\n\nexport type MarkedDatesMap = Record<string, MarkedDate>;\n\nconst DEFAULT_STATUS = \"scheduled\";\nconst DEFAULT_DURATION_MINUTES = 30;\n\nexport const today = dayjs();\n\nexport function generateAgendaSections<T>(\n data: Record<string, T[]>,\n dateFrom: string,\n dateTo: string,\n): AgendaSection<T>[] {\n const sections: AgendaSection<T>[] = [];\n let current = dayjs(dateFrom);\n const end = dayjs(dateTo);\n\n while (!current.isAfter(end)) {\n const key = current.format(\"YYYY-MM-DD\");\n sections.push({\n title: key,\n data: data[key] ?? [],\n });\n current = current.add(1, \"day\");\n }\n\n return sections;\n}\n\nexport function generateMarkedDates<T extends { status?: string | null }>(\n data: Record<string, T[]>,\n getStatusColorValue: (status: string | null | undefined) => string,\n): MarkedDatesMap {\n return Object.keys(data).reduce<MarkedDatesMap>((acc, date) => {\n const uniqueStatuses = [\n ...new Set(data[date].map((appointment) => appointment.status)),\n ];\n acc[date] = {\n dots: uniqueStatuses.map((status) => ({\n key: status ?? DEFAULT_STATUS,\n color: getStatusColorValue(status),\n })),\n };\n return acc;\n }, {});\n}\n\nexport function generateTimelineEvents<T extends AppointmentLike>(\n data: Record<string, T[]>,\n getStatusColorValue: (status: string | null | undefined) => string,\n): Record<string, TimelineEvent[]> {\n return Object.fromEntries(\n Object.entries(data).map(([date, appointments]) => [\n date,\n appointments.map((appointment) => {\n const startTime = appointment.appointment_time.slice(0, 5);\n const endTime = addMinutesToTime(\n startTime,\n appointment.service?.duration_minutes ?? DEFAULT_DURATION_MINUTES,\n );\n\n return {\n id: appointment.id,\n start: `${date} ${startTime}:00`,\n end: `${date} ${endTime}:00`,\n title: appointment.client\n ? getFullName(\n appointment.client.firstname ?? \"\",\n appointment.client.lastname ?? \"\",\n )\n : appointment.phone_number,\n summary: appointment.service?.name ?? \"-\",\n color: getStatusColorValue(appointment.status),\n professionalId: appointment.professional?.id ?? null,\n };\n }),\n ]),\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/core/utils/date.ts","../../src/core/utils/fullname.ts","../../src/core/utils/appointments.ts"],"names":["dayjs","localizedFormat","localeData"],"mappings":";;;;;;;;;;;;;AAIAA,sBAAA,CAAM,OAAOC,gCAAe,CAAA;AAC5BD,sBAAA,CAAM,OAAOE,2BAAU,CAAA;AA6EhB,SAAS,gBAAA,CAAiB,MAAc,OAAA,EAAyB;AACtE,EAAA,OAAOF,sBAAA,CAAM,CAAA,WAAA,EAAc,IAAI,CAAA,CAAE,CAAA,CAAE,IAAI,OAAA,EAAS,QAAQ,CAAA,CAAE,MAAA,CAAO,OAAO,CAAA;AAC1E;;;ACpFO,IAAM,WAAA,GAAc,C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ments.cjs","sourcesContent":["import dayjs from \"dayjs\";\nimport localeData from \"dayjs/plugin/localeData.js\";\nimport localizedFormat from \"dayjs/plugin/localizedFormat.js\";\n\ndayjs.extend(localizedFormat);\ndayjs.extend(localeData);\n\nexport function addDays(date: Date, days: number): Date {\n return dayjs(date).add(days, \"day\").toDate();\n}\n\n/** Full years elapsed since a \"YYYY-MM-DD\" birthday, as of today. */\nexport function calculateAge(birthday: string): number {\n return dayjs().diff(dayjs(birthday), \"year\");\n}\n\n/**\n * Whether a \"YYYY-MM-DD\" string is a real calendar date (rejects e.g. \"2024-02-30\"\n * or \"2024-13-01\", which a shape-only regex like `birthdayRegex` would let through).\n */\nexport function isValidCalendarDate(value: string): boolean {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value);\n if (!match) return false;\n\n const [, yearStr, monthStr, dayStr] = match;\n const year = Number(yearStr);\n const month = Number(monthStr);\n const day = Number(dayStr);\n\n const date = new Date(year, month - 1, day);\n return (\n date.getFullYear() === year &&\n date.getMonth() === month - 1 &&\n date.getDate() === day\n );\n}\n\n/** Converts a \"YYYY-MM-DD\" value to \"DD/MM/YYYY\" for masked-input display. Empty in, empty out. */\nexport function isoToDisplayDate(iso: string): string {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(iso);\n if (!match) return \"\";\n\n const [, year, month, day] = match;\n return `${day}/${month}/${year}`;\n}\n\n/**\n * Converts the raw digits typed into a DD/MM/YYYY mask (e.g. \"15081990\") into\n * \"YYYY-MM-DD\". Returns \"\" until all 8 digits have been entered.\n */\nexport function maskedDigitsToIsoDate(digits: string): string {\n if (digits.length !== 8) return \"\";\n\n const day = digits.slice(0, 2);\n const month = digits.slice(2, 4);\n const year = digits.slice(4, 8);\n return `${year}-${month}-${day}`;\n}\n\nexport function toDateString(date: Date): string {\n return dayjs(date).format(\"YYYY-MM-DD\");\n}\n\nexport function parseDateParts(dateString: string): {\n month: string;\n day: string;\n} {\n const date = dayjs(dateString);\n return {\n month: date.format(\"MMM\").toUpperCase(),\n day: date.format(\"D\"),\n };\n}\n\nexport function formatMonthDay(dateString: string): string {\n return dayjs(dateString).format(\"MMM D\");\n}\n\nexport function formatTime12h(time: string): string {\n return dayjs(`1970-01-01 ${time}`).format(\"h:mm a\");\n}\n\nexport function addMinutesToTime(time: string, minutes: number): string {\n return dayjs(`1970-01-01 ${time}`).add(minutes, \"minute\").format(\"HH:mm\");\n}\n\n/** Formats a date using the active dayjs locale (e.g. DD/MM/YYYY for pt-br, MM/DD/YYYY for en). */\nexport function formatLocalizedDate(\n date: Date | string | null | undefined,\n): string {\n if (!date) return \"—\";\n return dayjs(date).format(\"L\");\n}\n\n/** Formats a date and time using the active dayjs locale. */\nexport function formatLocalizedDateTime(\n date: Date | string | null | undefined,\n): string {\n if (!date) return \"—\";\n return dayjs(date).format(\"L LT\");\n}\n\n/** Day/month order for the active dayjs locale, derived from its full date pattern (e.g. \"DD/MM\" for pt-br, \"MM/DD\" for en). */\nfunction localizedShortDatePattern(): string {\n const longFormat = dayjs.localeData().longDateFormat(\"L\");\n return longFormat\n .replace(/^[,./\\-\\s]*Y+[,./\\-\\s]*/, \"\")\n .replace(/[,./\\-\\s]*Y+[,./\\-\\s]*$/, \"\");\n}\n\n/** Formats a date as day/month (no year), in the order the active dayjs locale uses. */\nexport function formatLocalizedShortDate(\n date: Date | string | null | undefined,\n): string {\n if (!date) return \"—\";\n return dayjs(date).format(localizedShortDatePattern());\n}\n","export const getFullName = (firstname: string, lastname?: string): string =>\n lastname ? `${firstname} ${lastname}` : firstname;\n","import dayjs from \"dayjs\";\n\nimport { addMinutesToTime } from \"./date\";\nimport { getFullName } from \"./fullname\";\n\nexport interface AppointmentLike {\n id: number;\n appointment_time: string;\n status?: string | null;\n phone_number: string;\n /** The whole appointment's length (all its services); falls back to the service's. */\n duration_minutes?: number | null;\n service?: {\n duration_minutes?: number | null;\n name?: string | null;\n } | null;\n client?: {\n firstname?: string | null;\n lastname?: string | null;\n } | null;\n professional?: {\n id: number;\n firstname?: string | null;\n lastname?: string | null;\n } | null;\n}\n\nexport interface AgendaSection<T> {\n title: string;\n data: T[];\n}\n\nexport interface TimelineEvent {\n id: number;\n start: string;\n end: string;\n title: string;\n summary: string;\n color: string;\n professionalId: number | null;\n}\n\nexport interface MarkedDateDot {\n key: string;\n color: string;\n}\n\nexport interface MarkedDate {\n dots: MarkedDateDot[];\n}\n\nexport type MarkedDatesMap = Record<string, MarkedDate>;\n\nconst DEFAULT_STATUS = \"scheduled\";\nconst DEFAULT_DURATION_MINUTES = 30;\n\nexport const today = dayjs();\n\nexport function generateAgendaSections<T>(\n data: Record<string, T[]>,\n dateFrom: string,\n dateTo: string,\n): AgendaSection<T>[] {\n const sections: AgendaSection<T>[] = [];\n let current = dayjs(dateFrom);\n const end = dayjs(dateTo);\n\n while (!current.isAfter(end)) {\n const key = current.format(\"YYYY-MM-DD\");\n sections.push({\n title: key,\n data: data[key] ?? [],\n });\n current = current.add(1, \"day\");\n }\n\n return sections;\n}\n\nexport function generateMarkedDates<T extends { status?: string | null }>(\n data: Record<string, T[]>,\n getStatusColorValue: (status: string | null | undefined) => string,\n): MarkedDatesMap {\n return Object.keys(data).reduce<MarkedDatesMap>((acc, date) => {\n const uniqueStatuses = [\n ...new Set(data[date].map((appointment) => appointment.status)),\n ];\n acc[date] = {\n dots: uniqueStatuses.map((status) => ({\n key: status ?? DEFAULT_STATUS,\n color: getStatusColorValue(status),\n })),\n };\n return acc;\n }, {});\n}\n\nexport function generateTimelineEvents<T extends AppointmentLike>(\n data: Record<string, T[]>,\n getStatusColorValue: (status: string | null | undefined) => string,\n): Record<string, TimelineEvent[]> {\n return Object.fromEntries(\n Object.entries(data).map(([date, appointments]) => [\n date,\n appointments.map((appointment) => {\n const startTime = appointment.appointment_time.slice(0, 5);\n const endTime = addMinutesToTime(\n startTime,\n appointment.duration_minutes ??\n appointment.service?.duration_minutes ??\n DEFAULT_DURATION_MINUTES,\n );\n\n return {\n id: appointment.id,\n start: `${date} ${startTime}:00`,\n end: `${date} ${endTime}:00`,\n title: appointment.client\n ? getFullName(\n appointment.client.firstname ?? \"\",\n appointment.client.lastname ?? \"\",\n )\n : appointment.phone_number,\n summary: appointment.service?.name ?? \"-\",\n color: getStatusColorValue(appointment.status),\n professionalId: appointment.professional?.id ?? null,\n };\n }),\n ]),\n );\n}\n"]}
|
|
@@ -5,6 +5,8 @@ interface AppointmentLike {
|
|
|
5
5
|
appointment_time: string;
|
|
6
6
|
status?: string | null;
|
|
7
7
|
phone_number: string;
|
|
8
|
+
/** The whole appointment's length (all its services); falls back to the service's. */
|
|
9
|
+
duration_minutes?: number | null;
|
|
8
10
|
service?: {
|
|
9
11
|
duration_minutes?: number | null;
|
|
10
12
|
name?: string | null;
|
|
@@ -5,6 +5,8 @@ interface AppointmentLike {
|
|
|
5
5
|
appointment_time: string;
|
|
6
6
|
status?: string | null;
|
|
7
7
|
phone_number: string;
|
|
8
|
+
/** The whole appointment's length (all its services); falls back to the service's. */
|
|
9
|
+
duration_minutes?: number | null;
|
|
8
10
|
service?: {
|
|
9
11
|
duration_minutes?: number | null;
|
|
10
12
|
name?: string | null;
|
|
@@ -41,7 +41,7 @@ function generateTimelineEvents(data, getStatusColorValue) {
|
|
|
41
41
|
const startTime = appointment.appointment_time.slice(0, 5);
|
|
42
42
|
const endTime = addMinutesToTime(
|
|
43
43
|
startTime,
|
|
44
|
-
appointment.service?.duration_minutes ?? DEFAULT_DURATION_MINUTES
|
|
44
|
+
appointment.duration_minutes ?? appointment.service?.duration_minutes ?? DEFAULT_DURATION_MINUTES
|
|
45
45
|
);
|
|
46
46
|
return {
|
|
47
47
|
id: appointment.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/utils/appointments.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"sources":["../../src/core/utils/appointments.ts"],"names":[],"mappings":";;;;AAqDA,IAAM,cAAA,GAAiB,WAAA;AACvB,IAAM,wBAAA,GAA2B,EAA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AA,CAAO,WAAA;AAAA,IACZ,MAAA,CAAO,QAAQ,IAAI,CAAA,CAAE,IAAI,CAAC,CAAC,IAAA,EAAM,YAAY,CAAA,KAAM;AAAA,MACjD,IAAA;AAAA,MACA,YAAA,CAAa,GAAA,CAAI,CAAC,WAAA,KAAgB;AAChC,QAAA,MAAM,SAAA,GAAY,WAAA,CAAY,gBAAA,CAAiB,KAAA,CAAM,GAAG,CAAC,CAAA;AACzD,QAAA,MAAM,OAAA,GAAU,gBAAA;AAAA,UACd,SAAA;AAAA,UACA,WAAA,CAAY,gBAAA,IACV,WAAA,CAAY,OAAA,EAAS,gBAAA,IACrB;AAAA,SACJ;AAEA,QAAA,OAAO;AAAA,UACL,IAAI,WAAA,CAAY,EAAA;AAAA,UAChB,KAAA,EAAO,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,SAAS,CAAA,GAAA,CAAA;AAAA,UAC3B,GAAA,EAAK,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,OAAO,CAAA,GAAA,CAAA;AAAA,UACvB,KAAA,EAAO,YAAY,MAAA,GACf,WAAA;AAAA,YACE,WAAA,CAAY,OAAO,SAAA,IAAa,EAAA;AAAA,YAChC,WAAA,CAAY,OAAO,QAAA,IAAY;AAAA,cAEjC,WAAA,CAAY,YAAA;AAAA,UAChB,OAAA,EAAS,WAAA,CAAY,OAAA,EAAS,IAAA,IAAQ,GAAA;AAAA,UACtC,KAAA,EAAO,mBAAA,CAAoB,WAAA,CAAY,MAAM,CAAA;AAAA,UAC7C,cAAA,EAAgB,WAAA,CAAY,YAAA,EAAc,EAAA,IAAM;AAAA,SAClD;AAAA,MACF,CAAC;AAAA,KACF;AAAA,GACH;AACF","file":"appointments.js","sourcesContent":["import dayjs from \"dayjs\";\n\nimport { addMinutesToTime } from \"./date\";\nimport { getFullName } from \"./fullname\";\n\nexport interface AppointmentLike {\n id: number;\n appointment_time: string;\n status?: string | null;\n phone_number: string;\n /** The whole appointment's length (all its services); falls back to the service's. */\n duration_minutes?: number | null;\n service?: {\n duration_minutes?: number | null;\n name?: string | null;\n } | null;\n client?: {\n firstname?: string | null;\n lastname?: string | null;\n } | null;\n professional?: {\n id: number;\n firstname?: string | null;\n lastname?: string | null;\n } | null;\n}\n\nexport interface AgendaSection<T> {\n title: string;\n data: T[];\n}\n\nexport interface TimelineEvent {\n id: number;\n start: string;\n end: string;\n title: string;\n summary: string;\n color: string;\n professionalId: number | null;\n}\n\nexport interface MarkedDateDot {\n key: string;\n color: string;\n}\n\nexport interface MarkedDate {\n dots: MarkedDateDot[];\n}\n\nexport type MarkedDatesMap = Record<string, MarkedDate>;\n\nconst DEFAULT_STATUS = \"scheduled\";\nconst DEFAULT_DURATION_MINUTES = 30;\n\nexport const today = dayjs();\n\nexport function generateAgendaSections<T>(\n data: Record<string, T[]>,\n dateFrom: string,\n dateTo: string,\n): AgendaSection<T>[] {\n const sections: AgendaSection<T>[] = [];\n let current = dayjs(dateFrom);\n const end = dayjs(dateTo);\n\n while (!current.isAfter(end)) {\n const key = current.format(\"YYYY-MM-DD\");\n sections.push({\n title: key,\n data: data[key] ?? [],\n });\n current = current.add(1, \"day\");\n }\n\n return sections;\n}\n\nexport function generateMarkedDates<T extends { status?: string | null }>(\n data: Record<string, T[]>,\n getStatusColorValue: (status: string | null | undefined) => string,\n): MarkedDatesMap {\n return Object.keys(data).reduce<MarkedDatesMap>((acc, date) => {\n const uniqueStatuses = [\n ...new Set(data[date].map((appointment) => appointment.status)),\n ];\n acc[date] = {\n dots: uniqueStatuses.map((status) => ({\n key: status ?? DEFAULT_STATUS,\n color: getStatusColorValue(status),\n })),\n };\n return acc;\n }, {});\n}\n\nexport function generateTimelineEvents<T extends AppointmentLike>(\n data: Record<string, T[]>,\n getStatusColorValue: (status: string | null | undefined) => string,\n): Record<string, TimelineEvent[]> {\n return Object.fromEntries(\n Object.entries(data).map(([date, appointments]) => [\n date,\n appointments.map((appointment) => {\n const startTime = appointment.appointment_time.slice(0, 5);\n const endTime = addMinutesToTime(\n startTime,\n appointment.duration_minutes ??\n appointment.service?.duration_minutes ??\n DEFAULT_DURATION_MINUTES,\n );\n\n return {\n id: appointment.id,\n start: `${date} ${startTime}:00`,\n end: `${date} ${endTime}:00`,\n title: appointment.client\n ? getFullName(\n appointment.client.firstname ?? \"\",\n appointment.client.lastname ?? \"\",\n )\n : appointment.phone_number,\n summary: appointment.service?.name ?? \"-\",\n color: getStatusColorValue(appointment.status),\n professionalId: appointment.professional?.id ?? null,\n };\n }),\n ]),\n );\n}\n"]}
|