{"version":3,"file":"BmSnHsbr.js","sources":["../../../../src/utils/pageData/utils.ts","../../../../src/enums/componentProperties.ts","../../../../src/utils/pageData/getOfficeTableRowItems.ts"],"sourcesContent":["import type {\n OfficeMarket_Office_Entry,\n Services_Service_Entry,\n Events_Event_Entry,\n Locations_Location_Entry,\n Persons_Person_Entry,\n} from '~~/src/gql/schema';\nimport dayjs from '~~/src/helpers/dayJs';\n\nexport function extractOfficeRoomRent(entry: OfficeMarket_Office_Entry) {\n let coldRoomRent: number | null;\n let warmRoomRent: number | null;\n let totalRoomRent: number | null;\n if (entry.officeRoomRent && entry.officeRoomRent.length > 0) {\n coldRoomRent = entry.officeRoomRent[0].officeRoomColdRent;\n warmRoomRent = entry.officeRoomRent[0].officeRoomWarmRent;\n totalRoomRent = entry.officeRoomRent[0].officeRoomTotalRent;\n }\n const coldRoomRentFrom: number | null = entry.officeRoomColdRentFrom;\n const coldRoomRentTo: number | null = entry.officeRoomColdRentTo;\n return {\n coldRoomRent,\n warmRoomRent,\n totalRoomRent,\n coldRoomRentFrom,\n coldRoomRentTo,\n };\n}\n\nexport function getFormattedPrice(price: number): string {\n if (price % 1 !== 0) {\n return useTrans().n(price, 'currency');\n }\n return useTrans().n(price, 'currencyNoCents');\n}\n\nexport function getSpeakers(entry: Events_Event_Entry): Persons_Person_Entry[] {\n if (!entry.hasOwnProperty('eventSpeakers')) {\n return [];\n }\n return entry.eventSpeakers.map(\n (evtSpeaker) => evtSpeaker as Persons_Person_Entry,\n );\n}\n\nexport function getEntryDate(entry: Events_Event_Entry) {\n return entry.entryDate === null\n ? null\n : dayjs(entry.entryDate ?? dayjs()).toDate();\n}\n\nexport type AdditionalDates = {\n date: Date;\n startTime: Date;\n endTime: Date;\n}[];\n\nexport function getAdditionalDates(entry: Events_Event_Entry): AdditionalDates {\n return entry.entryAdditionalDates\n ? entry.entryAdditionalDates.map((date) => {\n return {\n date: dayjs(date.entryAdditionalDate).toDate(),\n startTime: dayjs(date.entryAdditionalStartTime).toDate(),\n endTime: dayjs(date.entryAdditionalEndTime).toDate(),\n };\n })\n : [];\n}\n\nexport function getLocation(\n entry:\n | Events_Event_Entry\n | OfficeMarket_Office_Entry\n | Services_Service_Entry,\n) {\n return entry.entryLocation.length != 0\n ? (entry.entryLocation[0] as Locations_Location_Entry)\n : null;\n}\n\nexport function checkDatesForConsecutiveness(entry: Events_Event_Entry) {\n const additionalDates = getAdditionalDates(entry);\n if (!additionalDates || additionalDates.length === 0) return false;\n let consecutiveDates = true;\n const mainDate = entry.entryDate;\n\n for (let i = 0; i < additionalDates.length; i++) {\n if (i === 0) {\n if (\n dayjs(mainDate).add(1, 'day').toDate().toString() ==\n dayjs(additionalDates[i].date).toDate().toString()\n ) {\n continue;\n } else {\n consecutiveDates = false;\n break;\n }\n } else {\n if (\n dayjs(additionalDates[i - 1].date)\n .add(1, 'day')\n .toDate()\n .toString() == dayjs(additionalDates[i].date).toDate().toString()\n ) {\n continue;\n } else {\n consecutiveDates = false;\n break;\n }\n }\n }\n return consecutiveDates;\n}\n","/** Global component enums */\n\nexport enum EPosition {\n LEFT = 'left',\n RIGHT = 'right',\n TOP = 'top',\n BOTTOM = 'bottom',\n}\n\nexport enum ERadioType {\n NONE = 'none',\n YES = 'yes',\n NO = 'no',\n}\n\n/** Component specific enums */\n\n/** basic-button.vue */\nexport enum EButtonStyle {\n DEFAULT = 'default',\n LIGHT = 'light',\n INVERTED = 'inverted',\n CTA = 'cta',\n}\n\nexport enum EButtonType {\n BUTTON = 'button',\n LINK = 'link',\n ROUTERLINK = 'routerlink',\n}\n\n/** bullet-list.vue */\nexport enum EListType {\n Bullet = 0,\n Number = 1,\n Checkmark = 2,\n}\n","import type { OfficeData } from '~~/src/server/transformers/EntityTransformers/officeTransformer';\nimport { ERadioType } from '../../enums/componentProperties';\nimport type {\n Locations_Location_Entry,\n OfficeMarket_Office_Entry,\n} from '../../gql/schema';\nimport dayjs, { formatDate } from '../../helpers/dayJs';\nimport { extractOfficeRoomRent, getFormattedPrice } from './utils';\n\nexport enum EOfficeRowType {\n COLD_ROOM_RENT = 'coldRoomRent',\n ROOM_RENT = 'roomRent',\n PLACEHOLDER = 'placeholder',\n}\n\nexport interface IOfficeTableRow {\n icon?: string;\n specialType?: EOfficeRowType;\n label: string;\n value: string | number | string[] | number[];\n}\n\nexport default function getOfficeTableRowItems(\n entry: OfficeMarket_Office_Entry,\n isList = false,\n): IOfficeTableRow[] {\n const items = [];\n if (!isList && entry.officeBoxNr) {\n items.push({\n icon: 'fal fa-hashtag',\n label: 'office.boxNr',\n value: entry.officeBoxNr,\n });\n }\n\n const location =\n entry.entryLocation && entry.entryLocation.length != 0\n ? (entry.entryLocation[0] as Locations_Location_Entry)\n : null;\n\n if (location && location.title) {\n items.push({\n icon: 'fal fa-map-location-dot',\n label: isList ? '' : 'office.location',\n value: location.title,\n });\n }\n if (!isList && entry.officeBranchType) {\n items.push({\n icon: 'fal fa-hospital-user',\n label: 'office.branchType',\n value: useTrans().t(`office.${entry.officeBranchType}`),\n });\n }\n if (entry.officeAreaFrom && entry.officeAreaTo) {\n items.push({\n icon: 'far fa-border-bottom-right',\n label: 'office.objectSize',\n value:\n entry.officeAreaFrom === entry.officeAreaTo\n ? entry.officeAreaFrom + ' m²'\n : entry.officeAreaFrom + ' m²' + ' - ' + entry.officeAreaTo + ' m²',\n });\n }\n if (entry.officeTreatmentRoomsFrom && entry.officeTreatmentRoomsTill) {\n items.push({\n icon: 'far fa-seat-airline',\n label: 'office.treatmentRooms',\n value:\n entry.officeTreatmentRoomsFrom === entry.officeTreatmentRoomsTill\n ? entry.officeTreatmentRoomsFrom\n : entry.officeTreatmentRoomsFrom +\n ' - ' +\n entry.officeTreatmentRoomsTill,\n });\n }\n if (entry.officeRoomsFrom && entry.officeRoomsTo) {\n items.push({\n icon: 'fal fa-compress',\n label: 'office.rooms',\n value:\n entry.officeRoomsFrom === entry.officeRoomsTo\n ? entry.officeRoomsFrom\n : entry.officeRoomsFrom + ' - ' + entry.officeRoomsTo,\n });\n }\n if (entry.officeAmountParkingLots) {\n items.push({\n icon: 'fal fa-square-parking',\n label: 'office.amountParkingLots',\n value: entry.officeAmountParkingLots,\n });\n }\n if (entry.officeStorey) {\n items.push({\n icon: 'far fa-building',\n label: 'office.storey',\n value: entry.officeStorey,\n });\n }\n if (entry.officeSpecialisation) {\n items.push({\n icon: 'fal fa-crown',\n label: 'office.specialisation',\n value: entry.officeSpecialisation,\n });\n }\n if (entry.officeLaboratory) {\n items.push({\n icon: 'fal fa-microscope',\n label: 'office.laboratory',\n value: entry.officeLaboratory,\n });\n }\n if (entry.officeIsExtendable !== ERadioType.NONE) {\n items.push({\n icon: 'fal fa-plus-circle',\n label: 'office.extendable',\n value: useTrans().t(\n entry.officeIsExtendable === ERadioType.YES\n ? 'office.true'\n : 'office.false',\n ),\n });\n }\n if (entry.officeIsAccessible !== ERadioType.NONE) {\n items.push({\n icon: 'fal fa-wheelchair',\n label: 'office.accessible',\n value: useTrans().t(\n entry.officeIsAccessible === ERadioType.YES\n ? 'office.true'\n : 'office.false',\n ),\n });\n }\n\n const availableFrom =\n entry.officeAvailableFrom === null\n ? null\n : dayjs(entry.officeAvailableFrom ?? dayjs()).toDate();\n if (availableFrom) {\n items.push({\n icon: 'fal fa-door-open',\n label: 'office.availableFrom',\n value: formatDate(availableFrom),\n });\n }\n if (entry.officeConstructionYear) {\n items.push({\n icon: 'fal fa-shovel',\n label: 'office.constructionYear',\n value: entry.officeConstructionYear,\n });\n }\n\n const {\n coldRoomRent,\n warmRoomRent,\n totalRoomRent,\n coldRoomRentFrom,\n coldRoomRentTo,\n } = extractOfficeRoomRent(entry);\n\n if (!isList && (coldRoomRent || warmRoomRent || totalRoomRent)) {\n items.push({\n icon: 'fal fa-euro-sign',\n label: 'office.roomRent',\n value: '',\n specialType: EOfficeRowType.ROOM_RENT,\n });\n }\n if (!isList && coldRoomRentFrom && coldRoomRentTo) {\n items.push({\n icon: 'fal fa-euro-sign',\n label: 'office.roomRent',\n value:\n coldRoomRentFrom === coldRoomRentTo\n ? `${getFormattedPrice(coldRoomRentFrom)}/m²`\n : `${\n coldRoomRentFrom % 1 === 0\n ? coldRoomRentFrom\n : useTrans().n(coldRoomRentFrom, 'decimal')\n } - ${getFormattedPrice(coldRoomRentTo)}/m²`,\n specialType: EOfficeRowType.COLD_ROOM_RENT,\n });\n }\n if (entry.officeRealEstatePrice) {\n items.push({\n icon: 'fal fa-euro-sign',\n label: 'office.realEstatePrice',\n value: getFormattedPrice(entry.officeRealEstatePrice),\n });\n }\n\n if (isList) {\n return items.slice(0, 4);\n }\n\n return items;\n}\n\n// TODO: WIP part of the component types, will be combined with above when the office table is refactored\nexport function getOfficeTableRowItemsNEW(\n office: OfficeData,\n isList = false,\n): IOfficeTableRow[] {\n const items = [];\n if (!isList && office.boxNr) {\n items.push({\n icon: 'fal fa-hashtag',\n label: 'office.boxNr',\n value: office.boxNr,\n });\n }\n\n if (office.location && office.location.title) {\n items.push({\n icon: 'fal fa-map-location-dot',\n label: isList ? '' : 'office.location',\n value: office.location.title,\n });\n }\n if (!isList && office.branchType) {\n items.push({\n icon: 'fal fa-hospital-user',\n label: 'office.branchType',\n value: useTrans().t(`office.${office.branchType}`),\n });\n }\n if (office.areaFrom && office.areaTo) {\n items.push({\n icon: 'far fa-border-bottom-right',\n label: 'office.objectSize',\n value:\n office.areaFrom === office.areaTo\n ? office.areaFrom + ' m²'\n : office.areaFrom + ' m²' + ' - ' + office.areaTo + ' m²',\n });\n }\n if (office.treatmentRoomsFrom && office.treatmentRoomsTill) {\n items.push({\n icon: 'far fa-seat-airline',\n label: 'office.treatmentRooms',\n value:\n office.treatmentRoomsFrom === office.treatmentRoomsTill\n ? office.treatmentRoomsFrom\n : office.treatmentRoomsFrom + ' - ' + office.treatmentRoomsTill,\n });\n }\n if (office.roomsFrom && office.roomsTo) {\n items.push({\n icon: 'fal fa-compress',\n label: 'office.rooms',\n value:\n office.roomsFrom === office.roomsTo\n ? office.roomsFrom\n : office.roomsFrom + ' - ' + office.roomsTo,\n });\n }\n if (office.parkingLots) {\n items.push({\n icon: 'fal fa-square-parking',\n label: 'office.amountParkingLots',\n value: office.parkingLots,\n });\n }\n if (office.storey) {\n items.push({\n icon: 'far fa-building',\n label: 'office.storey',\n value: office.storey,\n });\n }\n if (office.specialisation) {\n items.push({\n icon: 'fal fa-crown',\n label: 'office.specialisation',\n value: office.specialisation,\n });\n }\n if (office.laboratory) {\n items.push({\n icon: 'fal fa-microscope',\n label: 'office.laboratory',\n value: office.laboratory,\n });\n }\n if (office.isExtendable !== ERadioType.NONE) {\n items.push({\n icon: 'fal fa-plus-circle',\n label: 'office.extendable',\n value: useTrans().t(\n office.isExtendable === ERadioType.YES ? 'office.true' : 'office.false',\n ),\n });\n }\n if (office.isAccessible !== ERadioType.NONE) {\n items.push({\n icon: 'fal fa-wheelchair',\n label: 'office.accessible',\n value: useTrans().t(\n office.isAccessible === ERadioType.YES ? 'office.true' : 'office.false',\n ),\n });\n }\n\n const availableFrom =\n office.availableFrom === null\n ? null\n : dayjs(office.availableFrom ?? dayjs()).toDate();\n if (availableFrom) {\n items.push({\n icon: 'fal fa-door-open',\n label: 'office.availableFrom',\n value: formatDate(availableFrom),\n });\n }\n if (office.constructionYear) {\n items.push({\n icon: 'fal fa-shovel',\n label: 'office.constructionYear',\n value: office.constructionYear,\n });\n }\n\n if (\n !isList &&\n (office.coldRoomRent || office.warmRoomRent || office.totalRoomRent)\n ) {\n items.push({\n icon: 'fal fa-euro-sign',\n label: 'office.roomRent',\n value: '',\n specialType: EOfficeRowType.ROOM_RENT,\n });\n }\n if (!isList && office.coldRoomRentFrom && office.coldRoomRentTo) {\n items.push({\n icon: 'fal fa-euro-sign',\n label: 'office.roomRent',\n value:\n office.coldRoomRentFrom === office.coldRoomRentTo\n ? `${getFormattedPrice(office.coldRoomRentFrom)}/m²`\n : `${\n office.coldRoomRentFrom % 1 === 0\n ? office.coldRoomRentFrom\n : useTrans().n(office.coldRoomRentFrom, 'decimal')\n } - ${getFormattedPrice(office.coldRoomRentTo)}/m²`,\n specialType: EOfficeRowType.COLD_ROOM_RENT,\n });\n }\n if (office.realEstatePrice) {\n items.push({\n icon: 'fal fa-euro-sign',\n label: 'office.realEstatePrice',\n value: getFormattedPrice(office.realEstatePrice),\n });\n }\n\n if (isList) {\n return items.slice(0, 4);\n }\n\n return items;\n}\n"],"names":["getFormattedPrice","price","useTrans","ERadioType","EOfficeRowType","getOfficeTableRowItemsNEW","office","isList","items","availableFrom","dayjs","formatDate"],"mappings":"2EA6BO,SAASA,EAAkBC,EAAuB,CACnD,OAAAA,EAAQ,IAAM,EACTC,EAAS,EAAE,EAAED,EAAO,UAAU,EAEhCC,EAAS,EAAE,EAAED,EAAO,iBAAiB,CAC9C,CCzBY,IAAAE,GAAAA,IACVA,EAAA,KAAO,OACPA,EAAA,IAAM,MACNA,EAAA,GAAK,KAHKA,IAAAA,GAAA,CAAA,CAAA,ECAAC,GAAAA,IACVA,EAAA,eAAiB,eACjBA,EAAA,UAAY,WACZA,EAAA,YAAc,cAHJA,IAAAA,GAAA,CAAA,CAAA,EAkMI,SAAAC,EACdC,EACAC,EAAS,GACU,CACnB,MAAMC,EAAQ,CAAA,EACV,CAACD,GAAUD,EAAO,OACpBE,EAAM,KAAK,CACT,KAAM,iBACN,MAAO,eACP,MAAOF,EAAO,KAAA,CACf,EAGCA,EAAO,UAAYA,EAAO,SAAS,OACrCE,EAAM,KAAK,CACT,KAAM,0BACN,MAAOD,EAAS,GAAK,kBACrB,MAAOD,EAAO,SAAS,KAAA,CACxB,EAEC,CAACC,GAAUD,EAAO,YACpBE,EAAM,KAAK,CACT,KAAM,uBACN,MAAO,oBACP,MAAON,EAAS,EAAE,EAAE,UAAUI,EAAO,UAAU,EAAE,CAAA,CAClD,EAECA,EAAO,UAAYA,EAAO,QAC5BE,EAAM,KAAK,CACT,KAAM,6BACN,MAAO,oBACP,MACEF,EAAO,WAAaA,EAAO,OACvBA,EAAO,SAAW,MAClBA,EAAO,SAAW,SAAgBA,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