= (props: ErrorComponentProps) => (\r\n\t\r\n\t\t{typeof props.error === 'string' ? props.error : Object.keys(props.error)\r\n\t\t\t.filter((key: string) => typeof props.error[key] === 'string')\r\n\t\t\t.map((key: string) => props.error[key])\r\n\t\t\t.join(', ')}\r\n\t
\r\n);\r\n\r\nexport const FormikInput: React.FC = ({\r\n\tfieldProps,\r\n\tcontainerClassName = 'form-group col-sm-6',\r\n\trender = defaultRender,\r\n\ttitle,\r\n\tinputId,\r\n\tshowValidateAfterSubmit = true,\r\n\tinputProps,\r\n\tErrorComponent = defaultErrorComponent,\r\n}) => {\r\n\tconst { form, field } = fieldProps;\r\n\r\n\tconst errorMessage = (showValidateAfterSubmit ? form.submitCount > 0 : true)\r\n\t\t? ) => } />\r\n\t\t: null;\r\n\tconst isError = errorMessage && Object.keys(form.errors).includes(field.name);\r\n\r\n\treturn (\r\n\t\t\r\n\t\t\t{title && }\r\n\t\t\t{render(fieldProps, inputProps)}\r\n\t\t\t{errorMessage}\r\n\t\t
\r\n\t);\r\n};\r\n","import { WithFile } from '@common/typescript/objects/WithFile';\r\n\r\nimport {\r\n\tPet,\r\n\tPetPrice,\r\n\tPetUrn,\r\n\tServiceType,\r\n} from '@app/objects/Pet';\r\nimport {\r\n\tCreatePetMessage,\r\n\tUpdatePetMessage,\r\n\tPetFormValues,\r\n\tReturnValues,\r\n\tUpdatePetPriceMessage,\r\n\tUpdatePetUrnMessage,\r\n\tCreatePetUrnMessage,\r\n} from '@app/components/Pages/PetEditor/OldPetEditor/Types';\r\nimport { UserRole } from '@app/objects/User';\r\nimport { PriceKind } from '@app/objects/Price';\r\nimport { PetFile } from '@app/objects/PetFile';\r\nimport { SpecialServiceType } from '@app/objects/SpecialService';\r\n\r\nexport function toCreateMessage(values: ReturnValues): CreatePetMessage {\r\n\tconst allServices = [...values.services, ...values.products];\r\n\tconst files = values.files.map((item: WithFile) => ({ fileId: item.fileId }));\r\n\r\n\treturn {\r\n\t\tactualWeight: Math.max(values.actualWeight || 0, 0),\r\n\t\treportedWeight: Math.max(values.reportedWeight || 0, 0),\r\n\r\n\t\tcrematoryId: values.crematoryId,\r\n\t\tclinicId: values.clinicId,\r\n\t\tclinicLocationId: values.clinicLocationId,\r\n\r\n\t\tname: values.name,\r\n\t\tengraving: values.engraving ?? [],\r\n\t\tcolor: values.color,\r\n\t\tonHold: values.onHold,\r\n\r\n\t\tdeliveryAddress: values.deliveryAddress,\r\n\t\tdeliveryAddress2: values.deliveryAddress2,\r\n\t\tdeliveryCity: values.deliveryCity,\r\n\t\tdeliveryClinicId: values.deliveryClinicId,\r\n\t\tdeliveryStateId: values.deliveryStateId,\r\n\t\tdeliveryType: values.deliveryType,\r\n\t\tdeliveryZip: values.deliveryZip,\r\n\r\n\t\tcarrierId: values.carrierId ?? null,\r\n\t\ttrackingNumber: values.trackingNumber ?? '',\r\n\r\n\t\tgenderId: values.genderId,\r\n\t\tdiscountId: values.discountId,\r\n\r\n\t\tserviceType: values.serviceType,\r\n\t\tpriceType: values.priceType,\r\n\r\n\t\townerAddress: values.ownerAddress,\r\n\t\townerAddress2: values.ownerAddress2,\r\n\t\townerCity: values.ownerCity,\r\n\t\townerEmail: values.ownerEmail,\r\n\t\townerFirstName: values.ownerFirstName,\r\n\t\townerLastName: values.ownerLastName,\r\n\t\townerNotes: values.ownerNotes,\r\n\t\townerPhone: values.ownerPhone,\r\n\t\townerPhone2: values.ownerPhone2,\r\n\t\townerStateId: values.ownerStateId,\r\n\t\townerZip: values.ownerZip,\r\n\r\n\t\tpetSpecieId: values.petSpecieId,\r\n\t\tpetBreedId: values.petBreedId,\r\n\t\tisMixed: values.isMixed,\r\n\t\trush: values.rush,\r\n\r\n\t\treceivedDate: values.receivedDate,\r\n\t\tservices: allServices.map((item: PetPrice) => ({\r\n\t\t\tid: item.id,\r\n\t\t\tpriceId: item.priceId,\r\n\t\t\tname: item.name,\r\n\t\t\tcount: item.count,\r\n\t\t\tvalue: item.value,\r\n\t\t\textra: item.extra,\r\n\t\t\tnote: item.note,\r\n\t\t})) ?? [],\r\n\r\n\t\turns: values.urns.map(((item: PetUrn) => ({\r\n\t\t\tcategoryId: item.categoryId,\r\n\t\t\tsizeId: item.sizeId,\r\n\t\t\tcount: item.count,\r\n\t\t}))),\r\n\r\n\t\tspreadLat: values.serviceType === ServiceType.Communal ? values.spreadLat : null,\r\n\t\tspreadLong: values.serviceType === ServiceType.Communal ? values.spreadLong : null,\r\n\r\n\t\tspecialInstructions: values.specialInstructions,\r\n\t\tinternalIdNum: values.internalIdNum,\r\n\t\tvet: '',\r\n\t\tfiles,\r\n\t};\r\n}\r\n\r\nexport function toUpdateMessage(values: PetFormValues | ReturnValues, userRole?: UserRole): UpdatePetMessage {\r\n\tconst allServices = [...values.services ?? [], ...values.products];\r\n\tconst services: Array = allServices\r\n\t\t.filter((q: PetPrice) =>\r\n\t\t\t!q.price\r\n\t\t\t|| q.price.specialServiceId !== null\r\n\t\t\t|| q.price.priceKind === PriceKind.ProductPrice\r\n\t\t\t|| q.price.priceKind === PriceKind.PickupPrice)\r\n\t\t.map((service: PetPrice): UpdatePetPriceMessage => ({\r\n\t\t\tid: service.id,\r\n\t\t\tremoved: service.removed ?? false,\r\n\r\n\t\t\tpriceId: service.priceId,\r\n\t\t\tcount: service.count,\r\n\t\t\tvalue: service.value,\r\n\t\t\tnote: service.note,\r\n\t\t}));\r\n\r\n\tconst crematoryId = userRole && userRole === UserRole.Admin ? values.crematoryId : undefined;\r\n\tconst files = values.files.map((item: PetFile) => ({\r\n\t\tfileId: item.fileId,\r\n\t\tid: item.id,\r\n\t\tobjectId: item.objectId,\r\n\t\ttext: item.text,\r\n\t\tdeleted: item.deleted,\r\n\t}));\r\n\r\n\treturn {\r\n\t\tid: values.id,\r\n\r\n\t\tactualWeight: Math.max(values.actualWeight || 0, 0),\r\n\t\treportedWeight: Math.max(values.reportedWeight || 0, 0),\r\n\r\n\t\tclinicId: values.clinicId,\r\n\t\tclinicLocationId: values.clinicLocationId,\r\n\r\n\t\tcrematoryId,\r\n\r\n\t\tname: values.name,\r\n\t\tengraving: values.engraving ?? [],\r\n\t\tcolor: values.color,\r\n\t\tonHold: values.onHold,\r\n\r\n\t\tdeliveryAddress: values.deliveryAddress,\r\n\t\tdeliveryAddress2: values.deliveryAddress2,\r\n\t\tdeliveryCity: values.deliveryCity,\r\n\t\tdeliveryClinicId: values.deliveryClinicId,\r\n\t\tdeliveryStateId: values.deliveryStateId,\r\n\t\tdeliveryType: values.deliveryType,\r\n\t\tdeliveryZip: values.deliveryZip,\r\n\r\n\t\tcarrierId: values.carrierId ?? null,\r\n\t\ttrackingNumber: values.trackingNumber ?? '',\r\n\r\n\t\tgenderId: values.genderId,\r\n\t\tdiscountId: values.discountId,\r\n\r\n\t\tserviceType: values.serviceType,\r\n\t\tpriceType: values.priceType,\r\n\r\n\t\townerAddress: values.ownerAddress,\r\n\t\townerAddress2: values.ownerAddress2,\r\n\t\townerCity: values.ownerCity,\r\n\t\townerEmail: values.ownerEmail,\r\n\t\townerFirstName: values.ownerFirstName,\r\n\t\townerLastName: values.ownerLastName,\r\n\t\townerNotes: values.ownerNotes,\r\n\t\townerPhone: values.ownerPhone,\r\n\t\townerPhone2: values.ownerPhone2,\r\n\t\townerStateId: values.ownerStateId,\r\n\t\townerZip: values.ownerZip,\r\n\r\n\t\tpetSpecieId: values.petSpecieId,\r\n\t\tpetBreedId: values.petBreedId,\r\n\t\tisMixed: values.isMixed,\r\n\t\trush: values.rush,\r\n\r\n\t\treceivedDate: values.receivedDate,\r\n\t\tisSpecial: values.isSpecial,\r\n\r\n\t\tspreadLat: values.serviceType === ServiceType.Communal ? values.spreadLat : null,\r\n\t\tspreadLong: values.serviceType === ServiceType.Communal ? values.spreadLong : null,\r\n\r\n\t\tspecialInstructions: values.specialInstructions,\r\n\t\tinternalIdNum: values.internalIdNum,\r\n\t\tvet: values.vet,\r\n\r\n\t\tupdateServices: services,\r\n\t\turns: values.urns.map((item: PetUrn) => ({\r\n\t\t\tid: item.id,\r\n\t\t\tcategoryId: item.categoryId,\r\n\t\t\tsizeId: item.sizeId,\r\n\t\t\tcount: item.count,\r\n\t\t\tremoved: item.removed ?? false,\r\n\t\t})),\r\n\r\n\t\trecalculatePrice: values.recalculatePrice,\r\n\r\n\t\tfiles,\r\n\t};\r\n}\r\n\r\n// Calculate full internationalization dictionary key\r\nexport function iKey(key: string): string {\r\n\treturn `editors.pet-editor.${key}`;\r\n}\r\n\r\nexport function updateSpecialServiceKit(services: Array): Array {\r\n\treturn services.map((i: PetPrice) => {\r\n\t\tif (i.price?.specialService?.specialServiceType === SpecialServiceType.Kit) {\r\n\t\t\tconst parent = i;\r\n\r\n\t\t\tconst children = services.filter((c) => c.price?.specialService?.parentId === parent.price?.specialServiceId);\r\n\t\t\tconst completed = children.reduce((prev, cur) => prev && cur.done, true);\r\n\r\n\t\t\treturn { ...parent, done: completed };\r\n\t\t}\r\n\r\n\t\treturn i;\r\n\t})\r\n};\r\n","module.exports = (__webpack_require__(10))(741);","import { WithId } from '@common/typescript/objects/WithId';\r\nimport { Nullable } from '@common/typescript/objects/Nullable';\r\n\r\nimport { StatusOrder } from '@app/objects/StatusOrder';\r\nimport { User } from '@app/objects/User';\r\n\r\nexport enum FunctionsGroup {\r\n\tReports = 'Reports',\r\n\tClinic = 'Clinic Dashboard',\r\n\tSystemActions = 'System Actions',\r\n}\r\n\r\nexport enum StatusFunction {\r\n\tPickupReport = 0,\r\n\tBatchAction = 1,\r\n\tDropOffReport = 2,\r\n\tMarkAtClinic = 3,\r\n\tMarkAtCrematory = 4,\r\n\tMarkDelivered = 5,\r\n\tRequireManualChange = 6,\r\n\tInvoiceDate = 7,\r\n\tCoordinateBatch = 9,\r\n\tTurnAroundDelivered = 10,\r\n\tTurnAroundPickup = 11,\r\n}\r\n\r\nexport interface StatusOrderFunction extends WithId {\r\n\tstatusOrder: Nullable;\r\n\tstatusOrderId: number;\r\n\tcreator: Nullable;\r\n\tcreatorId: number;\r\n\tfunction: StatusFunction;\r\n\tcreatedDate: number;\r\n}\r\n\r\n/* eslint max-len: [\"error\", { \"ignoreStrings\": true }] */\r\nexport const statusOrderFunctionDescriptions: Record = {\r\n\t[StatusFunction.PickupReport]: 'Mark pets in this status to be used for pickup report as pet to be picked up.',\r\n\t[StatusFunction.BatchAction]: 'Mark pets in this status to be used by Batch Action.',\r\n\t[StatusFunction.DropOffReport]: 'Mark pets in this status to be used for pickup report as pet to be dropped off.',\r\n\t[StatusFunction.MarkAtClinic]: 'Pets in this status and all subsequent statuses (until Mark At Crematory / Mark Delivered) will be counted as \\'At Clinic\\' on clinic\\'s dashboard.',\r\n\t[StatusFunction.MarkAtCrematory]: 'Pets in this status and all subsequent statuses (until Mark At Clinic / Mark Delivered) will be counted as \\'At Crematory\\' on clinic\\'s dashboard.',\r\n\t[StatusFunction.MarkDelivered]: 'Pets in this status and all subsequent statuses (until Mark At Clinic / Mark At Crematory) will be counted as \\'Delivered\\' on clinic\\'s dashboard.',\r\n\t[StatusFunction.RequireManualChange]: 'Force stop at this status during status change even if no user action is required. This makes difference only when using Status Flow Policy - Allow Skipping.',\r\n\t[StatusFunction.InvoiceDate]: 'Use date and time when pet entered current status for invoice calculation. By default invoices use date and time when pet was added to the system.',\r\n\t[StatusFunction.CoordinateBatch]: 'Pets in this or any subsequent status can be used for \\'Coordinate Batch\\'',\r\n\t[StatusFunction.TurnAroundDelivered]: 'Mark status to be used as final status for turnaround report (except Pickup delivery type)',\r\n\t[StatusFunction.TurnAroundPickup]: 'Mark status to be used as final status for turnaround report (Pickup delivery type)',\r\n};\r\n","module.exports = (__webpack_require__(10))(749);","module.exports = (__webpack_require__(10))(126);","module.exports = (__webpack_require__(10))(1232);","import { request as baseRequest } from '@common/react/components/Api';\r\nimport { BaseParams } from '@common/react/objects/BaseParams';\r\n\r\nimport { ApplicationState } from '@app/store';\r\nimport { User } from '@app/objects/User';\r\n\r\nexport function request(type: string, data?: D, state?: ApplicationState, signal?: AbortSignal): Promise {\r\n\treturn baseRequest(type, data, state, signal);\r\n}\r\n","module.exports = (__webpack_require__(10))(323);","import {\r\n\tbindActionCreators,\r\n\tDispatch,\r\n\tReducer,\r\n} from 'redux';\r\n\r\nimport {\r\n\tgetActionCreators as baseGetActionCreators, getReducer,\r\n\tIActionCreators,\r\n\tIMappedActionCreators, ItemsState, KnownPageAction,\r\n} from '@common/react/store/ItemList';\r\nimport { WithId } from '@common/typescript/objects/WithId';\r\n\r\nimport { User } from '@app/objects/User';\r\n\r\nimport { ApplicationState } from '@app/store/index';\r\n\r\nexport type ItemsActionCreators = IActionCreators;\r\nexport type MappedItemsActionCreators = IMappedActionCreators;\r\nexport type KnownItemsActions = KnownPageAction;\r\n\r\nexport function getItemsActionCreators(): ItemsActionCreators {\r\n\treturn baseGetActionCreators();\r\n}\r\n\r\nexport function bindItemsActionCreators(dispatch: Dispatch): MappedItemsActionCreators {\r\n\treturn bindActionCreators, MappedItemsActionCreators>(getItemsActionCreators(), dispatch);\r\n}\r\n\r\nexport function getItemsReducer(storageName: keyof ApplicationState): Reducer> {\r\n\treturn getReducer(storageName);\r\n}\r\n","/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */ export function invariant(condition, format, ...args) {\n if (isProduction()) {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n if (!condition) {\n let error;\n if (format === undefined) {\n error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n } else {\n let argIndex = 0;\n error = new Error(format.replace(/%s/g, function() {\n return args[argIndex++];\n }));\n error.name = 'Invariant Violation';\n }\n error.framesToPop = 1 // we don't care about invariant's own frame\n ;\n throw error;\n }\n}\nfunction isProduction() {\n return typeof process !== 'undefined' && process.env['NODE_ENV'] === 'production';\n}\n\n//# sourceMappingURL=index.js.map","import notification from 'antd/lib/notification';\r\nimport { ReactNode } from 'react';\r\n\r\nexport enum MessageType {\r\n\tsuccess = 'success',\r\n\terror = 'error',\r\n\twarning = 'warning',\r\n\tinfo = 'info'\r\n}\r\n\r\nexport function alertMessage(type: MessageType, message: ReactNode): void {\r\n\tnotification[type]({\r\n\t\tmessage,\r\n\t\tplacement: 'bottomRight',\r\n\t});\r\n}\r\n","/* eslint-disable radix */\r\nimport { SorterResult } from 'antd/lib/table';\r\nimport moment from 'moment';\r\nimport { parse, stringify } from 'query-string';\r\nimport * as Yup from 'yup';\r\n\r\nimport { List } from '@common/typescript/objects/List';\r\nimport { Named } from '@common/react/utils/utils';\r\nimport { WithId } from '@common/typescript/objects/WithId';\r\nimport { Sorter } from '@common/react/smart components/Table/TableRemoteSorter';\r\nimport { SortingDirection } from '@common/react/components/Pages/ItemsPage';\r\n\r\nimport { ExpirationColoring } from '@app/objects/Crematory';\r\nimport { filterKeys, Filters } from '@app/components/UI/FIlters/FilterHook';\r\n/** An abstraction over different date types */\r\nexport type DateType = Date | moment.Moment | number | null | undefined;\r\n\r\nexport const dateFormat = 'MM/DD/yyyy';\r\nexport const timeFormat = 'hh:mm a';\r\n\r\nexport const phoneMask = (code: string) => [\r\n\t...code.split(''), ' ', '(', /\\d/, /\\d/, /\\d/, ')', ' ', /\\d/, /\\d/, /\\d/, '-', /\\d/, /\\d/, /\\d/, /\\d/];\r\nexport const phoneFormat = /^\\+\\d{1,3} \\(\\d{3}\\) \\d{3}-\\d{4}$/;\r\n\r\nexport const FILE_INFO_MESSAGE = 'Image size must not exceed 5 Mb';\r\n\r\nexport enum ViewMode {\r\n\tview = 'view',\r\n\tedit = 'edit',\r\n}\r\n\r\nexport enum DeviceType {\r\n\tmobile = 0,\r\n\tdesktop = 1,\r\n}\r\n\r\nexport interface ResultDatesRange {\r\n\tfrom: number | undefined,\r\n\tto: number | undefined,\r\n}\r\n\r\n/**\r\n * Function takes formatted phone (i.e. +1 (999) 642-2120 and converts it to raw number string (+19996422120)\r\n * @param {string | null | undefined} phone - formatted phone string (it's not being verified)\r\n * @returns {string} Formatted phone\r\n */\r\nexport const phoneReplace = (phone: string | null | undefined): string => (phone?.replace(/[()\\-\\s]/g, '') ?? '');\r\n\r\n/**\r\n * Function converts phone saved as number string to formatted phone string (i.e. +19996422120 to +1 (999) 642-2120)\r\n * @param {string | null | undefined} phone - raw number string phone\r\n * @returns {string} formatted phone string\r\n */\r\nexport const formatPhone = (phone: string | null | undefined): string => (phone?.replace(/^\\+1(\\d{3})(\\d{3})(\\d{4})$/, '+1 ($1) $2-$3') ?? '');\r\n\r\n/**\r\n * Function checks if specified string is formatted phone string\r\n * @param {string | null | undefined} phone - formatted phone string\r\n * @returns {boolean} True if string is formatted phone string, false otherwise\r\n */\r\nexport const isFormattedPhone = (phone: string | null | undefined): boolean =>\r\n\t(phone ? new RegExp(/^\\+1 \\(\\d{3}\\) \\d{3}-\\d{4}$/, undefined).test(phone) : false);\r\n\r\n/**\r\n * Converts string of type 'testString' to 'TestString' - making first char to be upper cased\r\n * @param {string} item - string for conversion\r\n * @return {string}\r\n */\r\nexport const toUpperCase = (item: string): string => item[0].toUpperCase() + item.slice(1);\r\nexport const toLowerCase = (item: string): string => item[0].toLowerCase() + item.slice(1);\r\n\r\nexport const toWords = (camelCase: string): string => camelCase.replace(/([a-z])([A-Z])/g, '$1 $2');\r\n/**\r\n * Returns concatenated name string. Use this function in order to have uniform names\r\n * @param {Named} item - any object that has firstName and lastName\r\n * @return {string}\r\n */\r\nexport const getUserName = (item: Named): string => (item ? `${item.firstName || ''} ${item.lastName || ''}`.trim() : '');\r\n\r\n/**\r\n * Options that control how date should be formatted\r\n */\r\ninterface FormatDateOptions {\r\n\tview: 'short' | 'long';\r\n\twithTime: boolean;\r\n\twithWeekDay: boolean;\r\n\tfallback: string;\r\n}\r\n\r\n/**\r\n * Convert DateType object to string to display\r\n * @param {DateType} date - date that needs to be displayed\r\n * @param {Partial} formatOptions - options that control formatting\r\n * @return {string}\r\n */\r\nexport const formatDate = (date: DateType, formatOptions?: Partial): string => {\r\n\tconst locale = 'en-US';\r\n\tlet options: Intl.DateTimeFormatOptions;\r\n\tconst formatDateOptions: FormatDateOptions = {\r\n\t\tview: formatOptions?.view ?? 'short',\r\n\t\twithTime: formatOptions?.withTime ?? false,\r\n\t\twithWeekDay: formatOptions?.withWeekDay ?? false,\r\n\t\tfallback: formatOptions?.fallback ?? '-',\r\n\t};\r\n\tconst time: Intl.DateTimeFormatOptions = {\r\n\t\thour12: true,\r\n\t\thour: formatDateOptions.withTime ? 'numeric' : undefined,\r\n\t\tminute: formatDateOptions.withTime ? 'numeric' : undefined,\r\n\t};\r\n\r\n\tif (formatDateOptions.view === 'long') {\r\n\t\toptions = {\r\n\t\t\tyear: 'numeric',\r\n\t\t\tmonth: 'long',\r\n\t\t\tday: 'numeric',\r\n\t\t\tweekday: formatDateOptions.withWeekDay ? 'long' : undefined,\r\n\t\t\t...time,\r\n\t\t};\r\n\t} else {\r\n\t\toptions = {\r\n\t\t\tyear: 'numeric',\r\n\t\t\tmonth: '2-digit',\r\n\t\t\tday: '2-digit',\r\n\t\t\t...time,\r\n\t\t};\r\n\t}\r\n\r\n\tif (typeof date === 'number') return new Date(date).toLocaleDateString(locale, options);\r\n\tif (date instanceof Date) return date.toLocaleDateString(locale, options);\r\n\tif (moment.isMoment(date)) return moment().toDate().toLocaleDateString(locale, options);\r\n\r\n\treturn formatDateOptions.fallback;\r\n};\r\n\r\n/**\r\n * Helper function that identifies whether current device's viewport is mobile or not\r\n * @return {boolean}\r\n */\r\nexport const isMobile = (): boolean => typeof window !== 'undefined' && window.innerWidth < 768;\r\n\r\n/**\r\n * Calculated difference between current date (today) and 'value' in full days\r\n * @param {DateType} value - date to calculate difference for\r\n * @return {number}\r\n */\r\nexport const convertDate = (value: number): number => moment().subtract(value, 'days').startOf('day').valueOf();\r\nexport const getDatesDiff = (value: DateType): number => moment().diff(moment(value).startOf('day'), 'days');\r\nexport const isTablet = (): boolean => typeof window !== 'undefined' && window.innerWidth < 1024;\r\nexport const isDesktop = (): boolean => typeof window !== 'undefined' && window.innerWidth > 1200;\r\nexport const getFiltersDate = (value: number | undefined):number | undefined => (value !== undefined ? convertDate(value) : undefined);\r\n\r\nexport const withZeroNumberValidator = Yup.number().integer().moreThan(-1).required('Required field');\r\n\r\n/**\r\n * Return expiration color code based on passed time\r\n * @param {ExpirationColoring[]} colorTags - an array of preferences to choose from\r\n * @param {number} daysDiff - how much time has passed\r\n * @return {string | undefined}\r\n */\r\nexport const getColor = (colorTags: Array, daysDiff: number): string | undefined => {\r\n\tfor (let i = 0; i < colorTags.length; i++) {\r\n\t\tconst elm = colorTags[i];\r\n\t\tif (daysDiff >= elm.days) {\r\n\t\t\treturn elm.color;\r\n\t\t}\r\n\t}\r\n\r\n\treturn undefined;\r\n};\r\n\r\nexport const getDateRange = (colorTags: Array, color: string | undefined): ResultDatesRange => {\r\n\tconst res: ResultDatesRange = { from: undefined, to: undefined };\r\n\r\n\tfor (let i = 0; i < colorTags.length; i++) {\r\n\t\tconst elm = colorTags[i];\r\n\t\tif (elm.color === color) {\r\n\t\t\tres.from = elm.days;\r\n\r\n\t\t\tif (i > 0) {\r\n\t\t\t\tres.to = colorTags[i - 1].days;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (res.from === undefined && colorTags.length) {\r\n\t\t\tres.to = colorTags[colorTags.length - 1].days;\r\n\t\t}\r\n\t}\r\n\r\n\treturn res;\r\n};\r\n\r\n/**\r\n * Type Guard that checks if items are a List\r\n * @param {Array | List} items - items which type is tested\r\n * @return {items is List}\r\n */\r\nexport function isList(items: Array | List): items is List {\r\n\treturn (items as List).list !== undefined;\r\n}\r\n\r\n/**\r\n * Type Guard that checks if items are an array\r\n * @param {Array | List} items - items which type is tested\r\n * @return {items is Array}\r\n */\r\nexport function isArray(items: Array | List): items is Array {\r\n\treturn (items as Array).length !== undefined;\r\n}\r\n\r\n/**\r\n * The function is used to get an exact number of items in array or list.\r\n * This is a helper function that allows one to skip checks for exact items type (list or array)\r\n * @param {Array | List} items - a list or array of items\r\n * @return {number}\r\n */\r\nexport function count(items: Array | List): number {\r\n\tif (isList(items)) return items.count;\r\n\r\n\treturn items.length;\r\n}\r\n\r\n/**\r\n * Function converts current filter preset to url search params string\r\n * @param {Partial} params - filters object that needs to be encoded\r\n * @return {string}\r\n */\r\nexport const encodeSearchParams = (params: Partial): string => {\r\n\tconst parsedParams = Object.keys(params).reduce((acc, key) => {\r\n\t\tif (Object.prototype.toString.call(params[key]) === '[object Object]') {\r\n\t\t\tacc[key] = JSON.stringify(params[key]);\r\n\t\t} else {\r\n\t\t\tacc[key] = params[key];\r\n\t\t}\r\n\r\n\t\treturn acc;\r\n\t}, {});\r\n\r\n\treturn stringify(parsedParams, { arrayFormat: 'bracket' });\r\n};\r\n\r\n/**\r\n * Helper function that identifies whether current string is a json object\r\n * @param {string} value - string to test\r\n * @return {boolean}\r\n */\r\nexport function isJsonObject(value: string): boolean {\r\n\ttry {\r\n\t\treturn JSON.parse(value).toString() === '[object Object]';\r\n\t} catch (e) {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\n/**\r\n * Function converts url search params into a Filters object\r\n * @param {string} params - a url encoded filters object\r\n * @return {Partial}\r\n */\r\nexport const decodeSearchParams = (params: string): Partial => {\r\n\tconst parsedParams: Partial = parse(params, { arrayFormat: 'bracket', parseNumbers: true });\r\n\r\n\treturn Object.keys(parsedParams).reduce((acc, key) => {\r\n\t\tif (isJsonObject(parsedParams[key])) {\r\n\t\t\tacc[key] = JSON.parse(parsedParams[key].toString());\r\n\t\t} else {\r\n\t\t\tacc[key] = parsedParams[key];\r\n\t\t}\r\n\r\n\t\treturn acc;\r\n\t}, {});\r\n};\r\n\r\n/**\r\n * Converts an object of extended type T to object of type T by removing all of its keys that do not fit filter function\r\n * @param {T} object - an object that needs to be filtered\r\n * @param {(key: string) => boolean} filter - a function that tests whether current key should be included into final object\r\n * @return {T}\r\n */\r\nexport const filterObject = <\r\n\tT extends Record,\r\n>(object: T, filter: (key: keyof T) => boolean): T => {\r\n\treturn Object.keys(object)\r\n\t\t.filter(filter)\r\n\t\t.reduce((obj: Partial, key: keyof T) => {\r\n\t\t\t// eslint-disable-next-line no-param-reassign\r\n\t\t\tobj[key] = object[key];\r\n\r\n\t\t\treturn obj;\r\n\t\t}, {}) as T;\r\n};\r\n\r\n/**\r\n * Leaves only those fields of 'filters' that are valid filter options\r\n * @param {Record} filters - an object containing both filters options and other fields\r\n * @return {Record}\r\n */\r\nexport const getPageFilters = (filters: Record): Partial => {\r\n\treturn filterObject(filters, (key: string) => filterKeys.includes(key));\r\n};\r\n\r\n/**\r\n * Leaves only those fields of 'filters' that are not valid filter options\r\n * @param {Record} filters - an object containing both filters options and other fields\r\n * @return {Record}\r\n */\r\nexport const getSideFilters = (filters: Record): Record => {\r\n\treturn filterObject(filters, (key: string) => !filterKeys.includes(key));\r\n};\r\n\r\n/**\r\n * Transforms Antd sorter props to ones we send to server\r\n * @param {SorterResult|undefined} sorter - an object containing props from ant table sorter\r\n * @return {Sorter}\r\n */\r\nexport const transformSorter = (sorter: SorterResult | undefined): Sorter => {\r\n\treturn {\r\n\t\tcolumn: sorter?.column ? [{\r\n\t\t\tcaption: sorter.field,\r\n\t\t\tdirection: sorter.order === 'descend'\r\n\t\t\t\t? SortingDirection.Descending\r\n\t\t\t\t: SortingDirection.Ascending,\r\n\t\t}] : [],\r\n\t};\r\n};\r\n","import * as React from 'react';\r\n\r\n// Place before method\r\n// Binds function to react component\r\nexport function member(target: React.Component, propertyKey: string, descriptor: PropertyDescriptor) {\r\n\treturn {\r\n\t\tget() {\r\n\t\t\tconst bound = descriptor.value.bind(this);\r\n\r\n\t\t\tObject.defineProperty(this, propertyKey, {\r\n\t\t\t\tvalue: bound,\r\n\t\t\t});\r\n\r\n\t\t\treturn bound;\r\n\t\t}\r\n\t};\r\n}\r\n","import { Action } from 'redux';\r\n\r\nimport { Nullable } from '@common/typescript/objects/Nullable';\r\nimport { WithId } from '@common/typescript/objects/WithId';\r\n\r\nimport {\r\n\tIListAction,\r\n\tIListReceiveAction,\r\n\tIListReceiveMoreAction,\r\n\tIListRequestAction,\r\n\tIListRequestErrorAction,\r\n\tIListUpdateAction,\r\n\tisListAction, TypeKeys,\r\n} from '@app/store/SelectList/ListActions';\r\nimport { ClinicSelectInfo } from '@app/objects/Clinic';\r\nimport {\r\n\tAdjustmentCodeFilter,\r\n\tClinicSelectFilter,\r\n\tCountrySelectFilter,\r\n\tCrematorySelectFilter,\r\n\tDiscountSelectFilter,\r\n\tInventoryItemFilter,\r\n\tLabelPaperSelectFilter,\r\n\tInventoryParentsSelectFilter,\r\n\tLanguageSelectFilter,\r\n\tMeasuringUnitFilter,\r\n\tPetBreedSelectFilter,\r\n\tProductSelectFilter,\r\n\tRegionSelectFilter,\r\n\tRouteSelectFilter,\r\n\tSpecialServicesSelectFilter,\r\n\tStatusSelectFilter,\r\n\tUrnCategoriesSelectFilter,\r\n\tUrnSelectFilter,\r\n\tUserSelectFilter,\r\n\tMachineSelectFilter,\r\n\tSearchable,\r\n\tStoreEntrySelectFilter,\r\n\tPickupServicesSelectFilter,\r\n} from '@app/store/SelectList/SelectsInterfaces';\r\nimport { Status } from '@app/objects/Status';\r\nimport { PetBreed } from '@app/objects/Pet';\r\nimport { InventoryItem } from '@app/objects/Inventory';\r\nimport { State } from '@app/objects/State';\r\nimport { SpecialService } from '@app/objects/SpecialService';\r\nimport { IAdjustmentCode } from '@app/objects/Adjustment';\r\nimport { MeasuringUnit } from '@app/objects/MeasuringUnits';\r\nimport {\r\n\tStoreType,\r\n\tRecordType,\r\n} from '@app/store/SelectList/UtilityTypes';\r\nimport { Price } from '@app/objects/Price';\r\nimport { Country } from '@app/objects/Country';\r\nimport { Language } from '@app/objects/Language';\r\nimport { CrematoryListInfo, CrematoryMachine } from '@app/objects/Crematory';\r\nimport { UserListInfo } from '@app/objects/User';\r\nimport { Route } from '@app/objects/Route';\r\nimport { LabelPaper } from '@app/objects/LabelPaper';\r\nimport { StoreEntry } from '@app/objects/StoreEntry';\r\nimport { PickupService } from '@app/objects/PickupService';\r\n\r\nexport interface SelectItem {\r\n\titems: Array;\r\n\tisLoading: boolean;\r\n\tpagination: {\r\n\t\ttotal: number;\r\n\t};\r\n\tfilters: Nullable;\r\n\terror: Nullable;\r\n\trequestId: number;\r\n\tparams: Nullable>\r\n}\r\n\r\nexport type SelectItemState = Record>, SelectItem>;\r\nexport const GeneralKey = 'GENERAL_KEY';\r\nexport const RootKey = 'ROOT_KEY';\r\n\r\ntype ReducedSelectItem = Omit, 'filters' | 'items'> & { items: Array };\r\ntype ReducedSelectState = Record, ReducedSelectItem>;\r\n\r\nexport interface SelectList {\r\n\tclinics: SelectItem,\r\n\tcrematories: SelectItem,\r\n\tstatus: SelectItem,\r\n\tpetBreeds: SelectItem,\r\n\turns: SelectItemState,\r\n\turnCategories: SelectItem,\r\n\tregions: SelectItem,\r\n\tspecialServices: SelectItem,\r\n\tpickupServices: SelectItem\r\n\tpickupServicePrices: SelectItem,\r\n\tproducts: SelectItemState,\r\n\tinventoryItems: SelectItem