{"version":3,"file":"BmDateHighlighter-b7d0685f.js","sources":["../../src/components/controls/input/mixins/BmDateHighlighter.ts"],"sourcesContent":["import { tenantService } from \"@/app/services/extensions/tenantServiceExtended\";\nimport { LocalDate } from \"@js-joda/core\";\nimport type { EnumDayOfWeek } from \"@/app/services/generated/enums/enumDayOfWeek.generated\";\nimport { defineComponent } from \"vue\";\n\nexport function despatchDateHighlighter(\n date: LocalDate,\n despatchDays: EnumDayOfWeek[],\n leadTimeDays: number,\n primaryEventColour: string = \"brand02\",\n warningEventColour: string = \"warningMedium\"\n) {\n let dayOfWeekKey = date.dayOfWeek().value();\n const today = tenantService.today;\n // Check if values are in the future or today and the day of the week matches distribution Object\n if (\n !date.isBefore(today) &&\n despatchDays.some(\n (distributionActiveDay: EnumDayOfWeek) =>\n dayOfWeekKey === distributionActiveDay.key\n )\n ) {\n // If the value is within the lead time, Show but highlight with warning color\n if (leadTimeDays && date.isBefore(today.plusDays(leadTimeDays))) {\n return warningEventColour;\n }\n return primaryEventColour;\n }\n return \"\";\n}\n\nexport function despatchDateStringHighlighter(\n date: string,\n despatchDays: EnumDayOfWeek[],\n leadTimeDays: number,\n primaryEventColour: string = \"brand02\",\n warningEventColour: string = \"warningMedium\"\n) {\n return date\n ? despatchDateHighlighter(\n LocalDate.parse(date),\n despatchDays,\n leadTimeDays,\n primaryEventColour,\n warningEventColour\n ) || false\n : false;\n}\n\nexport const BmDateHighlighter = defineComponent({\n methods: {\n getEventFromDaysAndLeadTime(\n date: string,\n despatchDays: EnumDayOfWeek[],\n leadTimeDays: number\n ): boolean | string {\n return despatchDateStringHighlighter(date, despatchDays, leadTimeDays);\n },\n },\n});\n"],"names":[],"mappings":"+LAKO,SAAS,wBACd,KACA,aACA,aACA,mBAA6B,UAC7B,mBAA6B,gBAC7B,CACA,IAAI,aAAe,KAAK,UAAU,EAAE,MAAM,EAC1C,MAAM,MAAQ,cAAc,MAE5B,MACE,CAAC,KAAK,SAAS,KAAK,GACpB,aAAa,KACV,uBACC,eAAiB,sBAAsB,GAAA,EAIvC,cAAgB,KAAK,SAAS,MAAM,SAAS,YAAY,CAAC,EACrD,mBAEF,mBAEF,EACT,CAxBgB,0DA0BT,SAAS,8BACd,KACA,aACA,aACA,mBAA6B,UAC7B,mBAA6B,gBAC7B,CACA,OAAO,MACH,wBACE,UAAU,MAAM,IAAI,EACpB,aACA,aACA,mBACA,kBAAA,GACG,EAEX,CAhBgB"}