@agendar/shared 0.5.0 → 0.7.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.
Files changed (47) hide show
  1. package/assets/illustrations/appointments-empty-state.svg +16 -0
  2. package/assets/illustrations/client-packages-empty-state.svg +16 -0
  3. package/assets/illustrations/client-tabs-empty-state.svg +17 -0
  4. package/assets/illustrations/clients-empty-state.svg +17 -0
  5. package/assets/illustrations/clients-search-empty-state.svg +20 -0
  6. package/assets/illustrations/filter-empty-state.svg +14 -0
  7. package/assets/illustrations/load-error-state.svg +15 -0
  8. package/assets/illustrations/professional-empty-state.svg +18 -0
  9. package/assets/illustrations/professional-paid-empty-state.svg +16 -0
  10. package/assets/illustrations/professional-payables-empty-state.svg +17 -0
  11. package/assets/illustrations/professional-vouchers-empty-state.svg +16 -0
  12. package/assets/illustrations/professionals-search-empty-state.svg +26 -0
  13. package/assets/illustrations/specializations-empty-state.svg +17 -0
  14. package/dist/{chunk-V35KHOP7.js → chunk-5Z4HAF3G.js} +426 -38
  15. package/dist/chunk-5Z4HAF3G.js.map +1 -0
  16. package/dist/{chunk-VHINV4UK.js → chunk-BQME4XFT.js} +424 -36
  17. package/dist/chunk-BQME4XFT.js.map +1 -0
  18. package/dist/{chunk-KBHYWZZW.js → chunk-YWAHSJNC.js} +425 -37
  19. package/dist/chunk-YWAHSJNC.js.map +1 -0
  20. package/dist/i18n/en.cjs +422 -34
  21. package/dist/i18n/en.cjs.map +1 -1
  22. package/dist/i18n/en.d.cts +413 -25
  23. package/dist/i18n/en.d.ts +413 -25
  24. package/dist/i18n/en.js +1 -1
  25. package/dist/i18n/es.cjs +423 -35
  26. package/dist/i18n/es.cjs.map +1 -1
  27. package/dist/i18n/es.d.cts +413 -25
  28. package/dist/i18n/es.d.ts +413 -25
  29. package/dist/i18n/es.js +1 -1
  30. package/dist/i18n/index.cjs +1269 -105
  31. package/dist/i18n/index.cjs.map +1 -1
  32. package/dist/i18n/index.js +3 -3
  33. package/dist/i18n/pt.cjs +424 -36
  34. package/dist/i18n/pt.cjs.map +1 -1
  35. package/dist/i18n/pt.d.cts +413 -25
  36. package/dist/i18n/pt.d.ts +413 -25
  37. package/dist/i18n/pt.js +1 -1
  38. package/dist/utils/appointments.cjs +1 -1
  39. package/dist/utils/appointments.cjs.map +1 -1
  40. package/dist/utils/appointments.d.cts +2 -0
  41. package/dist/utils/appointments.d.ts +2 -0
  42. package/dist/utils/appointments.js +1 -1
  43. package/dist/utils/appointments.js.map +1 -1
  44. package/package.json +5 -3
  45. package/dist/chunk-KBHYWZZW.js.map +0 -1
  46. package/dist/chunk-V35KHOP7.js.map +0 -1
  47. package/dist/chunk-VHINV4UK.js.map +0 -1
package/dist/i18n/pt.d.ts CHANGED
@@ -505,6 +505,8 @@ declare const appPT: {
505
505
  "clients.subtitle": string;
506
506
  "clients.new": string;
507
507
  "clients.list.filterHint": string;
508
+ "clients.list.count_one": string;
509
+ "clients.list.count_other": string;
508
510
  "clients.list.newClientHint": string;
509
511
  "clients.searchPlaceholder": string;
510
512
  "clients.filter": string;
@@ -553,6 +555,63 @@ declare const appPT: {
553
555
  "clients.create.submit": string;
554
556
  "clients.create.success": string;
555
557
  "clients.create.error": string;
558
+ "clients.create.closeHint": string;
559
+ "clients.create.addPhoto": string;
560
+ "clients.create.addPhotoHint": string;
561
+ "clients.create.required": string;
562
+ "clients.create.missing.firstname": string;
563
+ "clients.create.missing.phone": string;
564
+ "clients.create.missing.and": string;
565
+ "clients.create.missing.text_one": string;
566
+ "clients.create.missing.text_other": string;
567
+ "clients.create.discard.title": string;
568
+ "clients.create.discard.description": string;
569
+ "clients.create.discard.keep": string;
570
+ "clients.create.discard.confirm": string;
571
+ "fieldEdit.empty": string;
572
+ "fieldEdit.editHint": string;
573
+ "fieldEdit.openHint": string;
574
+ "fieldEdit.saved": string;
575
+ "fieldEdit.checking": string;
576
+ "fieldEdit.countryHint": string;
577
+ "fieldEdit.phone": string;
578
+ "fieldEdit.count": string;
579
+ "fieldEdit.photoSheet.label": string;
580
+ "fieldEdit.photoSheet.invalid": string;
581
+ "fieldEdit.photoSheet.save": string;
582
+ "fieldEdit.photoSheet.remove": string;
583
+ "clients.edit.fields.firstname": string;
584
+ "clients.edit.fields.lastname": string;
585
+ "clients.edit.toast.firstname": string;
586
+ "clients.edit.toast.lastname": string;
587
+ "clients.edit.toast.photo": string;
588
+ "clients.edit.editPhoto": string;
589
+ "clients.edit.editPhotoHint": string;
590
+ "clients.edit.photoSheet.title": string;
591
+ "clients.edit.fields.email": string;
592
+ "clients.edit.fields.birthday": string;
593
+ "clients.edit.fields.notes": string;
594
+ "clients.edit.toast.phone": string;
595
+ "clients.edit.toast.email": string;
596
+ "clients.edit.toast.birthday": string;
597
+ "clients.edit.toast.notes": string;
598
+ "clients.edit.undo": string;
599
+ "clients.edit.undoHint": string;
600
+ "clients.edit.undone": string;
601
+ "clients.edit.phoneTaken": string;
602
+ "clients.edit.emailTaken": string;
603
+ "clients.edit.birthdayValue": string;
604
+ "clients.edit.notesHint": string;
605
+ "clients.edit.notesPlaceholder": string;
606
+ "clients.edit.deleteHint": string;
607
+ "clients.edit.birthdaySheet.title": string;
608
+ "clients.edit.birthdaySheet.closeHint": string;
609
+ "clients.edit.birthdaySheet.day": string;
610
+ "clients.edit.birthdaySheet.month": string;
611
+ "clients.edit.birthdaySheet.year": string;
612
+ "clients.edit.birthdaySheet.age": string;
613
+ "clients.edit.birthdaySheet.save": string;
614
+ "clients.edit.birthdaySheet.remove": string;
556
615
  "clients.edit.submit": string;
557
616
  "clients.edit.success": string;
558
617
  "clients.edit.error": string;
@@ -617,6 +676,8 @@ declare const appPT: {
617
676
  "clients.tabHistory.packageDetail": string;
618
677
  "clients.tabHistory.subtotal": string;
619
678
  "clients.tabHistory.total": string;
679
+ "clients.tabHistory.openStatus": string;
680
+ "clients.tabHistory.goToOpenTab": string;
620
681
  "clients.tabHistory.payment": string;
621
682
  "clients.tabHistory.noPayment": string;
622
683
  "clients.tabHistory.expandHint": string;
@@ -737,33 +798,11 @@ declare const appPT: {
737
798
  "professionals.commissions.rules.shared": string;
738
799
  "professionals.commissions.rules.editHint": string;
739
800
  "professionals.commissions.rules.sharedHint": string;
740
- "professionals.commissions.rules.sharedDialog.title": string;
741
- "professionals.commissions.rules.sharedDialog.description": string;
742
801
  "professionals.commissions.rules.products": string;
743
802
  "professionals.commissions.rules.productsSubtitle": string;
744
803
  "professionals.commissions.rules.productsPerProduct": string;
745
804
  "professionals.commissions.rules.productsHint": string;
746
805
  "professionals.commissions.rules.loadError": string;
747
- "professionals.commissions.editRule.price": string;
748
- "professionals.commissions.editRule.percentage": string;
749
- "professionals.commissions.editRule.fixed": string;
750
- "professionals.commissions.editRule.decrease": string;
751
- "professionals.commissions.editRule.decreaseHint": string;
752
- "professionals.commissions.editRule.increase": string;
753
- "professionals.commissions.editRule.increaseHint": string;
754
- "professionals.commissions.editRule.fixedLabel": string;
755
- "professionals.commissions.editRule.fixedHint": string;
756
- "professionals.commissions.editRule.preview": string;
757
- "professionals.commissions.editRule.productPreview": string;
758
- "professionals.commissions.editRule.pendingNote_one": string;
759
- "professionals.commissions.editRule.pendingNote_other": string;
760
- "professionals.commissions.editRule.closingChange": string;
761
- "professionals.commissions.editRule.save": string;
762
- "professionals.commissions.editRule.success": string;
763
- "professionals.commissions.editRule.close": string;
764
- "professionals.commissions.editRule.closeHint": string;
765
- "professionals.commissions.editRule.useProductRate": string;
766
- "professionals.commissions.editRule.useProductRateHint": string;
767
806
  "professionals.commissions.detail.defineRule": string;
768
807
  "professionals.commissions.detail.defineRuleHint": string;
769
808
  "professionals.commissions.detail.fixed": string;
@@ -790,7 +829,6 @@ declare const appPT: {
790
829
  "professionals.commissions.vouchers.cancelSuccess": string;
791
830
  "professionals.commissions.vouchers.emptyTitle": string;
792
831
  "professionals.commissions.vouchers.emptySubtitle": string;
793
- "professionals.commissions.vouchers.emptyAction": string;
794
832
  "professionals.commissions.vouchers.loadError": string;
795
833
  "professionals.commissions.vouchers.new": string;
796
834
  "professionals.commissions.vouchers.newHint": string;
@@ -800,8 +838,20 @@ declare const appPT: {
800
838
  "professionals.commissions.newVoucher.success": string;
801
839
  "professionals.commissions.newVoucher.close": string;
802
840
  "professionals.commissions.newVoucher.closeHint": string;
803
- "professionals.commissions.newVoucher.delete": string;
804
- "professionals.commissions.newVoucher.deleteHint": string;
841
+ "professionals.commissions.newVoucher.pickSubtitle": string;
842
+ "professionals.commissions.newVoucher.searchPlaceholder": string;
843
+ "professionals.commissions.newVoucher.searchLabel": string;
844
+ "professionals.commissions.newVoucher.openVouchers_one": string;
845
+ "professionals.commissions.newVoucher.openVouchers_other": string;
846
+ "professionals.commissions.newVoucher.owner": string;
847
+ "professionals.commissions.newVoucher.inactiveHidden": string;
848
+ "professionals.commissions.newVoucher.noResults": string;
849
+ "professionals.commissions.newVoucher.pickHint": string;
850
+ "professionals.commissions.newVoucher.back": string;
851
+ "professionals.commissions.newVoucher.backHint": string;
852
+ "professionals.commissions.newVoucher.amountLabel": string;
853
+ "professionals.commissions.newVoucher.clearSearchHint": string;
854
+ "professionals.commissions.newVoucher.amountHint": string;
805
855
  "professionals.commissions.receipt.title": string;
806
856
  "professionals.commissions.receipt.subtitle": string;
807
857
  "professionals.commissions.receipt.heading": string;
@@ -840,8 +890,106 @@ declare const appPT: {
840
890
  "professionals.filters.activeCount_other": string;
841
891
  "professionals.filters.apply": string;
842
892
  "professionals.filters.emptyOptions": string;
893
+ "professionals.commissions.detail.payAll": string;
894
+ "professionals.commissions.detail.paySelected_one": string;
895
+ "professionals.commissions.detail.paySelected_other": string;
896
+ "professionals.commissions.detail.select": string;
897
+ "professionals.commissions.detail.selectHint": string;
898
+ "professionals.commissions.detail.filters.services": string;
899
+ "professionals.commissions.detail.filters.products": string;
900
+ "professionals.dayStatus.busyWith": string;
901
+ "professionals.dayStatus.busy": string;
902
+ "professionals.dayStatus.freeNow": string;
903
+ "professionals.dayStatus.freeUntil": string;
904
+ "professionals.dayStatus.nextAt": string;
905
+ "professionals.dayStatus.backAt": string;
906
+ "professionals.dayStatus.dayOver": string;
907
+ "professionals.dayStatus.off": string;
908
+ "professionals.dayStatus.inactive": string;
909
+ "professionals.list.teamSize_one": string;
910
+ "professionals.list.teamSize_other": string;
911
+ "professionals.list.workingToday_one": string;
912
+ "professionals.list.workingToday_other": string;
913
+ "professionals.list.openProfileHint": string;
914
+ "professionals.filters.clear": string;
915
+ "professionals.filters.clearHint": string;
916
+ "professionals.filters.status": string;
917
+ "professionals.filters.statusAll": string;
918
+ "professionals.filters.statusActive": string;
919
+ "professionals.filters.statusInactive": string;
920
+ "professionals.filters.role": string;
921
+ "professionals.filters.specialization": string;
922
+ "professionals.filters.today": string;
923
+ "professionals.filters.day.busy": string;
924
+ "professionals.filters.day.free": string;
925
+ "professionals.filters.day.off": string;
926
+ "professionals.filters.show_one": string;
927
+ "professionals.filters.show_other": string;
928
+ "professionals.filters.showNone": string;
929
+ "professionals.filters.applyHint": string;
930
+ "professionals.payables.summaryLabel_one": string;
931
+ "professionals.payables.summaryLabel_other": string;
932
+ "professionals.payables.summaryVouchers": string;
933
+ "professionals.payables.withoutRuleCount_one": string;
934
+ "professionals.payables.withoutRuleCount_other": string;
935
+ "professionals.payables.withoutRuleNote_one": string;
936
+ "professionals.payables.withoutRuleNote_other": string;
937
+ "professionals.payables.review": string;
938
+ "professionals.payables.reviewHint": string;
939
+ "professionals.payables.showAll": string;
940
+ "professionals.payables.net": string;
941
+ "professionals.payables.pay": string;
942
+ "professionals.payables.payHint": string;
943
+ "professionals.payables.view": string;
944
+ "professionals.payables.viewHint": string;
945
+ "professionals.payables.openHint": string;
946
+ "professionals.payables.emptyTitle": string;
947
+ "professionals.payables.emptySubtitle": string;
948
+ "professionals.paid.summaryLabel_one": string;
949
+ "professionals.paid.summaryLabel_other": string;
950
+ "professionals.paid.summaryReversed_one": string;
951
+ "professionals.paid.summaryReversed_other": string;
952
+ "professionals.paid.paidOnShort": string;
953
+ "professionals.paid.reversedOnShort": string;
954
+ "professionals.paid.reversedBy_one": string;
955
+ "professionals.paid.reversedBy_other": string;
956
+ "professionals.paid.reversedOn_one": string;
957
+ "professionals.paid.reversedOn_other": string;
958
+ "professionals.paid.reversedNoDate_one": string;
959
+ "professionals.paid.reversedNoDate_other": string;
960
+ "professionals.paid.emptyTitle": string;
961
+ "professionals.paid.emptySubtitle": string;
962
+ "professionals.vouchers.summaryLabel": string;
963
+ "professionals.vouchers.summaryCaption_one": string;
964
+ "professionals.vouchers.summaryCaption_other": string;
965
+ "professionals.vouchers.summaryProfessionals_one": string;
966
+ "professionals.vouchers.summaryProfessionals_other": string;
967
+ "professionals.vouchers.outlierPrefix": string;
968
+ "professionals.vouchers.outlierSuffix": string;
969
+ "professionals.vouchers.review": string;
970
+ "professionals.vouchers.reviewHint": string;
971
+ "professionals.vouchers.sectionOpen": string;
972
+ "professionals.vouchers.sectionDiscounted": string;
973
+ "professionals.vouchers.sectionCanceled": string;
974
+ "professionals.vouchers.statusDiscounted": string;
975
+ "professionals.vouchers.discountedMeta": string;
976
+ "professionals.vouchers.cancelHint": string;
977
+ "professionals.vouchers.cancelSheet.title": string;
978
+ "professionals.vouchers.cancelSheet.impact": string;
979
+ "professionals.vouchers.cancelSheet.impactNext": string;
980
+ "professionals.vouchers.cancelSheet.partial": string;
981
+ "professionals.vouchers.cancelSheet.reasonTitle": string;
982
+ "professionals.vouchers.cancelSheet.reason.mistake": string;
983
+ "professionals.vouchers.cancelSheet.reason.wrongAmount": string;
984
+ "professionals.vouchers.cancelSheet.reason.returned": string;
985
+ "professionals.vouchers.cancelSheet.reason.other": string;
986
+ "professionals.vouchers.cancelSheet.otherPlaceholder": string;
987
+ "professionals.vouchers.cancelSheet.keep": string;
988
+ "professionals.vouchers.cancelSheet.confirm": string;
989
+ "professionals.vouchers.cancelSheet.footnote": string;
843
990
  "professionals.emptySearch.title": string;
844
991
  "professionals.emptySearch.subtitle": string;
992
+ "professionals.emptySearch.create": string;
845
993
  "professionals.emptySearch.clear": string;
846
994
  "professionals.emptyFilter.title": string;
847
995
  "clients.select.title": string;
@@ -1173,6 +1321,193 @@ declare const appPT: {
1173
1321
  "cashDrawer.validation.reason.maxLength": string;
1174
1322
  "professionals.empty": string;
1175
1323
  "professionals.new": string;
1324
+ "professionals.list.pickHint": string;
1325
+ "products.professionals.saveHint": string;
1326
+ "planner.professionalFilter.allHint": string;
1327
+ "professionals.transfer.title": string;
1328
+ "professionals.transfer.subtitle_one": string;
1329
+ "professionals.transfer.subtitle_other": string;
1330
+ "professionals.transfer.goBackHint": string;
1331
+ "professionals.transfer.banner": string;
1332
+ "professionals.transfer.bannerNone": string;
1333
+ "professionals.transfer.thisWeek": string;
1334
+ "professionals.transfer.nextWeek": string;
1335
+ "professionals.transfer.prefers": string;
1336
+ "professionals.transfer.noClient": string;
1337
+ "professionals.transfer.nobodyFree": string;
1338
+ "professionals.transfer.willCancel": string;
1339
+ "professionals.transfer.assigneeHint": string;
1340
+ "professionals.transfer.sheetTitle": string;
1341
+ "professionals.transfer.preferred": string;
1342
+ "professionals.transfer.busyWithOther": string;
1343
+ "professionals.transfer.cancelOption": string;
1344
+ "professionals.transfer.cancelOptionHint": string;
1345
+ "professionals.transfer.optionHint": string;
1346
+ "professionals.transfer.footer_one": string;
1347
+ "professionals.transfer.footer_other": string;
1348
+ "professionals.transfer.confirm": string;
1349
+ "professionals.transfer.confirmCancelAll": string;
1350
+ "professionals.transfer.loadError": string;
1351
+ "professionals.transfer.retry": string;
1352
+ "professionals.transfer.empty": string;
1353
+ "professionals.transfer.emptySubtitle": string;
1354
+ "professionals.transfer.deactivateNow": string;
1355
+ PROF_021: string;
1356
+ "professionals.serviceSetup.title": string;
1357
+ "professionals.serviceSetup.subtitle": string;
1358
+ "professionals.serviceSetup.goBackHint": string;
1359
+ "professionals.serviceSetup.search": string;
1360
+ "professionals.serviceSetup.defaultsTitle": string;
1361
+ "professionals.serviceSetup.products.title": string;
1362
+ "professionals.serviceSetup.products.subtitle": string;
1363
+ "professionals.serviceSetup.products.perProduct": string;
1364
+ "professionals.serviceSetup.products.perProductHint": string;
1365
+ "professionals.serviceSetup.discountProductCost.title": string;
1366
+ "professionals.serviceSetup.discountProductCost.subtitle": string;
1367
+ "professionals.serviceSetup.discountAuxiliary.title": string;
1368
+ "professionals.serviceSetup.discountAuxiliary.subtitle": string;
1369
+ "professionals.serviceSetup.servicesTitle": string;
1370
+ "professionals.serviceSetup.servicesCount": string;
1371
+ "professionals.serviceSetup.row.notDone": string;
1372
+ "professionals.serviceSetup.row.shared": string;
1373
+ "professionals.serviceSetup.row.fixed": string;
1374
+ "professionals.serviceSetup.row.percentage": string;
1375
+ "professionals.serviceSetup.row.noRule": string;
1376
+ "professionals.serviceSetup.row.pending_one": string;
1377
+ "professionals.serviceSetup.row.pending_other": string;
1378
+ "professionals.serviceSetup.row.define": string;
1379
+ "professionals.serviceSetup.row.toggleHint": string;
1380
+ "professionals.serviceSetup.row.expandHint": string;
1381
+ "professionals.serviceSetup.editor.percentage": string;
1382
+ "professionals.serviceSetup.editor.fixed": string;
1383
+ "professionals.serviceSetup.editor.commission": string;
1384
+ "professionals.serviceSetup.editor.auxiliary": string;
1385
+ "professionals.serviceSetup.editor.fixedLabel": string;
1386
+ "professionals.serviceSetup.editor.fixedHint": string;
1387
+ "professionals.serviceSetup.editor.decrease": string;
1388
+ "professionals.serviceSetup.editor.increase": string;
1389
+ "professionals.serviceSetup.editor.stepHint": string;
1390
+ "professionals.serviceSetup.editor.sharedNote": string;
1391
+ "professionals.serviceSetup.editor.pendingNote_one": string;
1392
+ "professionals.serviceSetup.editor.pendingNote_other": string;
1393
+ "professionals.serviceSetup.preview.serviceAmount": string;
1394
+ "professionals.serviceSetup.preview.productCost": string;
1395
+ "professionals.serviceSetup.preview.gross": string;
1396
+ "professionals.serviceSetup.preview.auxiliary": string;
1397
+ "professionals.serviceSetup.preview.fixed": string;
1398
+ "professionals.serviceSetup.preview.receives": string;
1399
+ "professionals.serviceSetup.missingRule": string;
1400
+ "professionals.serviceSetup.save": string;
1401
+ "professionals.serviceSetup.saved": string;
1402
+ "professionals.serviceSetup.discard.title": string;
1403
+ "professionals.serviceSetup.discard.description": string;
1404
+ "professionals.serviceSetup.empty": string;
1405
+ "professionals.serviceSetup.noResults": string;
1406
+ "professionals.serviceSetup.loadError": string;
1407
+ "professionals.deactivate.title": string;
1408
+ "professionals.deactivate.subtitle": string;
1409
+ "professionals.deactivate.loading": string;
1410
+ "professionals.deactivate.appointments_one": string;
1411
+ "professionals.deactivate.appointments_other": string;
1412
+ "professionals.deactivate.appointmentsSuffix_one": string;
1413
+ "professionals.deactivate.appointmentsSuffix_other": string;
1414
+ "professionals.deactivate.noAppointments": string;
1415
+ "professionals.deactivate.payable": string;
1416
+ "professionals.deactivate.payableSuffix": string;
1417
+ "professionals.deactivate.schedule": string;
1418
+ "professionals.deactivate.transfer.title": string;
1419
+ "professionals.deactivate.transfer.subtitle": string;
1420
+ "professionals.deactivate.transfer.hint": string;
1421
+ "professionals.deactivate.keep": string;
1422
+ "professionals.deactivate.confirm": string;
1423
+ "professionals.deactivate.confirmTransfer": string;
1424
+ "professionals.deactivate.confirmCancel": string;
1425
+ "professionals.deactivate.footnote": string;
1426
+ "professionals.deactivate.done": string;
1427
+ "professionals.deactivate.doneDetail": string;
1428
+ PROF_019: string;
1429
+ PROF_020: string;
1430
+ "professionals.profileForm.sections.who": string;
1431
+ "professionals.profileForm.sections.contact": string;
1432
+ "professionals.profileForm.sections.work": string;
1433
+ "professionals.profileForm.sections.account": string;
1434
+ "professionals.profileForm.fields.firstname": string;
1435
+ "professionals.profileForm.fields.lastname": string;
1436
+ "professionals.profileForm.fields.nickname": string;
1437
+ "professionals.profileForm.fields.phone": string;
1438
+ "professionals.profileForm.fields.email": string;
1439
+ "professionals.profileForm.fields.role": string;
1440
+ "professionals.profileForm.fields.specializations": string;
1441
+ "professionals.profileForm.fields.services": string;
1442
+ "professionals.profileForm.fields.appAccess": string;
1443
+ "professionals.profileForm.fields.active": string;
1444
+ "professionals.profileForm.activeOn": string;
1445
+ "professionals.profileForm.activeOff": string;
1446
+ "professionals.profileForm.activeHint": string;
1447
+ "professionals.profileForm.servicesSummary": string;
1448
+ "professionals.profileForm.servicesNone": string;
1449
+ "professionals.profileForm.servicesHint": string;
1450
+ "professionals.profileForm.appAccess.linked": string;
1451
+ "professionals.profileForm.appAccess.invited": string;
1452
+ "professionals.profileForm.appAccess.none": string;
1453
+ "professionals.profileForm.appAccess.noChannel": string;
1454
+ "professionals.profileForm.appAccess.sheetTitle": string;
1455
+ "professionals.profileForm.toast.firstname": string;
1456
+ "professionals.profileForm.toast.lastname": string;
1457
+ "professionals.profileForm.toast.nickname": string;
1458
+ "professionals.profileForm.toast.phone": string;
1459
+ "professionals.profileForm.toast.email": string;
1460
+ "professionals.profileForm.toast.photo": string;
1461
+ "professionals.profileForm.toast.role": string;
1462
+ "professionals.profileForm.toast.specializations": string;
1463
+ "professionals.profileForm.toast.active": string;
1464
+ "professionals.profileForm.photoTitle": string;
1465
+ "professionals.profileForm.goBackHint": string;
1466
+ "professionals.profileForm.deleteNote": string;
1467
+ "professionals.profileForm.create.closeHint": string;
1468
+ "professionals.profileForm.create.submit": string;
1469
+ "professionals.profileForm.create.missing.firstname": string;
1470
+ "professionals.profileForm.create.missing.lastname": string;
1471
+ "professionals.profileForm.create.missing.role": string;
1472
+ "professionals.profileForm.create.discard.title": string;
1473
+ "professionals.profileForm.roleSheet.subtitle": string;
1474
+ "professionals.profileForm.roleSheet.count_one": string;
1475
+ "professionals.profileForm.roleSheet.count_other": string;
1476
+ "professionals.profileForm.roleSheet.empty": string;
1477
+ "professionals.profileForm.roleSheet.createNew": string;
1478
+ "professionals.profileForm.roleSheet.createNewHint": string;
1479
+ "professionals.profileForm.roleSheet.choose": string;
1480
+ "professionals.profileForm.roleSheet.pickFirst": string;
1481
+ "professionals.profileForm.roleSheet.selectHint": string;
1482
+ "professionals.profileForm.specSheet.subtitle": string;
1483
+ "professionals.profileForm.specSheet.search": string;
1484
+ "professionals.profileForm.specSheet.create": string;
1485
+ "professionals.profileForm.specSheet.remove": string;
1486
+ "professionals.profileForm.specSheet.removeHint": string;
1487
+ "professionals.profileForm.specSheet.toggleHint": string;
1488
+ "professionals.profileForm.specSheet.empty": string;
1489
+ "professionals.profileForm.specSheet.confirm": string;
1490
+ "professionals.profileForm.specSheet.confirmCount": string;
1491
+ "professionals.profileForm.created.subtitle": string;
1492
+ "professionals.profileForm.created.title": string;
1493
+ "professionals.profileForm.created.meta": string;
1494
+ "professionals.profileForm.created.nextSteps": string;
1495
+ "professionals.profileForm.created.optional": string;
1496
+ "professionals.profileForm.created.invite.title": string;
1497
+ "professionals.profileForm.created.invite.description": string;
1498
+ "professionals.profileForm.created.invite.noChannel": string;
1499
+ "professionals.profileForm.created.invite.action": string;
1500
+ "professionals.profileForm.created.invite.sent": string;
1501
+ "professionals.profileForm.created.services.title": string;
1502
+ "professionals.profileForm.created.services.description": string;
1503
+ "professionals.profileForm.created.services.done_one": string;
1504
+ "professionals.profileForm.created.services.done_other": string;
1505
+ "professionals.profileForm.created.services.action": string;
1506
+ "professionals.profileForm.created.schedule.title": string;
1507
+ "professionals.profileForm.created.schedule.description": string;
1508
+ "professionals.profileForm.created.schedule.action": string;
1509
+ "professionals.profileForm.created.viewProfile": string;
1510
+ "professionals.profileForm.created.actionHint": string;
1176
1511
  "professionals.create.professionRole": string;
1177
1512
  "professionals.list.newProfessionalHint": string;
1178
1513
  "professionals.searchPlaceholder": string;
@@ -2254,10 +2589,62 @@ declare const appPT: {
2254
2589
  "packages.services.validation.percentage.invalid": string;
2255
2590
  "packages.sales.validation.client.required": string;
2256
2591
  "packages.sales.validation.package.required": string;
2592
+ "appointment.form.newTitle": string;
2593
+ "appointment.form.editTitle": string;
2594
+ "appointment.form.closeHint": string;
2595
+ "appointment.form.phone": string;
2596
+ "appointment.form.anyProfessional": string;
2597
+ "appointment.form.missing.phone": string;
2598
+ "appointment.form.notes.hint": string;
2599
+ "appointment.form.dateTime.businessHours": string;
2600
+ "appointment.form.dateTime.legendBusiness": string;
2601
+ "appointment.form.items.confirmEmpty": string;
2602
+ "appointment.form.clearClient": string;
2603
+ "appointment.form.clearClientHint": string;
2604
+ "appointment.form.clearProfessional": string;
2605
+ "appointment.form.clearProfessionalHint": string;
2606
+ "appointment.form.client": string;
2607
+ "appointment.form.services": string;
2608
+ "appointment.form.professional": string;
2609
+ "appointment.form.dateTime": string;
2610
+ "appointment.form.choose": string;
2611
+ "appointment.form.add": string;
2612
+ "appointment.form.required": string;
2613
+ "appointment.form.minutes": string;
2614
+ "appointment.form.addAnother": string;
2615
+ "appointment.form.clientHint": string;
2616
+ "appointment.form.servicesHint": string;
2617
+ "appointment.form.professionalHint": string;
2618
+ "appointment.form.dateTimeHint": string;
2619
+ "appointment.form.submit": string;
2620
+ "appointment.form.save": string;
2621
+ "appointment.form.missing.time": string;
2622
+ "appointment.form.missing.and": string;
2623
+ "appointment.form.missing.text_one": string;
2624
+ "appointment.form.missing.text_other": string;
2625
+ "appointment.form.items.title": string;
2626
+ "appointment.form.items.confirm_one": string;
2627
+ "appointment.form.items.confirm_other": string;
2628
+ "appointment.form.items.searchHint": string;
2629
+ "appointment.form.dateTime.title": string;
2630
+ "appointment.form.dateTime.closeHint": string;
2631
+ "appointment.form.dateTime.today": string;
2632
+ "appointment.form.dateTime.periods.morning": string;
2633
+ "appointment.form.dateTime.periods.afternoon": string;
2634
+ "appointment.form.dateTime.periods.evening": string;
2635
+ "appointment.form.dateTime.noSlots": string;
2636
+ "appointment.form.dateTime.legend": string;
2637
+ "appointment.form.dateTime.confirm": string;
2638
+ "appointment.form.dateTime.confirmHint": string;
2639
+ "appointment.form.dateTime.pickTime": string;
2640
+ "appointment.form.dateTime.taken": string;
2641
+ "appointment.form.notes.label": string;
2642
+ "appointment.form.notes.placeholder": string;
2257
2643
  APPT_001: string;
2258
2644
  APPT_002: string;
2259
2645
  APPT_003: string;
2260
2646
  APPT_004: string;
2647
+ APPT_005: string;
2261
2648
  APPT_200: string;
2262
2649
  APPT_200_DELETE: string;
2263
2650
  APPT_201: string;
@@ -2391,6 +2778,7 @@ declare const appPT: {
2391
2778
  PROF_015: string;
2392
2779
  PROF_016: string;
2393
2780
  PROF_017: string;
2781
+ PROF_018: string;
2394
2782
  PROF_200: string;
2395
2783
  PROF_200_DELETE: string;
2396
2784
  PROF_200_PAYOUT_CANCELED: string;
package/dist/i18n/pt.js CHANGED
@@ -1,3 +1,3 @@
1
- export { appPT } from '../chunk-V35KHOP7.js';
1
+ export { appPT } from '../chunk-5Z4HAF3G.js';
2
2
  //# sourceMappingURL=pt.js.map
3
3
  //# sourceMappingURL=pt.js.map
@@ -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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;AAEO,SAAS,sBAAA,CACd,MACA,mBAAA,EACiC;AACjC,EAAA,OAAO,MAAA,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,SAAS,gBAAA,IAAoB;AAAA,SAC3C;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,CAAC,SAAA,EAAmB,QAAA,KAC7C,WAAW,CAAA,EAAG,SAAS,CAAA,CAAA,EAAI,QAAQ,CAAA,CAAA,GAAK,SAAA;;;ACoD1C,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,CAAK;AAAA,MACZ,KAAA,EAAO,GAAA;AAAA,MACP,IAAA,EAAM,IAAA,CAAK,GAAG,CAAA,IAAK;AAAC,KACrB,CAAA;AACD,IAAA,OAAA,GAAU,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,KAAK,CAAA;AAAA,EAChC;AAEA,EAAA,OAAO,QAAA;AACT;AAEO,SAAS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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 /** 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 ?? DE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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/appointments.ts"],"names":[],"mappings":";;;;AAqDA,IAAM,cAAA,GAAiB,WAAA;AACvB,IAAM,wBAAA,GAA2B,EAAA;AAE1B,IAAM,QAAQ,KAAA;AAEd,SAAS,sBAAA,CACd,IAAA,EACA,QAAA,EACA,MAAA,EACoB;AACpB,EAAA,MAAM,WAA+B,EAAC;AACtC,EAAA,IAAI,OAAA,GAAU,MAAM,QAAQ,CAAA;AAC5B,EAAA,MAAM,GAAA,GAAM,MAAM,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,CAAK;AAAA,MACZ,KAAA,EAAO,GAAA;AAAA,MACP,IAAA,EAAM,IAAA,CAAK,GAAG,CAAA,IAAK;AAAC,KACrB,CAAA;AACD,IAAA,OAAA,GAAU,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,KAAK,CAAA;AAAA,EAChC;AAEA,EAAA,OAAO,QAAA;AACT;AAEO,SAAS,mBAAA,CACd,MACA,mBAAA,EACgB;AAChB,EAAA,OAAO,OAAO,IAAA,CAAK,IAAI,EAAE,MAAA,C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,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"]}