): string => {\r\n return originalString.replace(/./g, function (character: string, index: number) {\r\n return stringInsertions[index] ? stringInsertions[index] + character : character;\r\n });\r\n};\r\n\r\n\r\n/**\r\n * Sanitizes string and returns html as JSX \r\n * @param htmlString \r\n * @returns html as converted JSX element\r\n */\r\nconst htmlFrom = (htmlString: string) => {\r\n const cleanHtmlString = sanitize(htmlString,\r\n { USE_PROFILES: { html: true } });\r\n const html = parse(cleanHtmlString);\r\n return html;\r\n}\r\n\r\n/**\r\n * Strips html from string \r\n * @param htmlString \r\n * @returns string with html parsed out\r\n */\r\nconst stripHTML = (htmlString: string) => {\r\n const stripRegex = /(<([^>]+)>)/ig;\r\n const result = htmlString.replace(stripRegex, '');\r\n return result;\r\n}\r\n\r\n/**\r\n * Finds contents of the first paragraph tag and strips out html\r\n * @param htmlString \r\n * @returns content of first paragraph\r\n */\r\nconst cleanseFirstParagraph = (htmlString: string) => {\r\n const firstParagraphRegex = /(.*?)<\\/p>/;\r\n const corresp = firstParagraphRegex.exec(htmlString);\r\n const firstParagraph = (corresp) ? corresp[1] : \"\";\r\n const stripRegex = /(<([^>]+)>)/ig;\r\n const result = firstParagraph.replace(stripRegex, '');\r\n return result;\r\n}\r\n\r\nexport {\r\n makePhoneNumberBoldAndHiddenIfNeeded,\r\n makeBold,\r\n makeAllBold,\r\n htmlFrom,\r\n stripHTML,\r\n cleanseFirstParagraph\r\n}\r\n","\r\nexport class ObjectUtility {\r\n\r\n /**\r\n * Case-insensitive retrieval of object properties\r\n * @param object object to parse\r\n * @param key property to return\r\n * @returns property if found\r\n */\r\n static getPropertyCaseInsensitive(object: any, key: string) {\r\n const asLowercase = key.toLowerCase();\r\n const property = Object.keys(object)\r\n .find(k => k.toLowerCase() === asLowercase);\r\n\r\n if (property) {\r\n return object[property];\r\n }\r\n }\r\n\r\n /**\r\n * Deep compare two arrays of the same type to determine if they have the same contents.\r\n */\r\n static sequenceEquals(arr1: T[], arr2: T[]) {\r\n return _(arr1).differenceWith(arr2, _.isEqual).isEmpty();\r\n }\r\n}\r\n","export const formatCurrency = (value: number) =>\r\n new Intl.NumberFormat(`en-US`, {\r\n currency: `USD`,\r\n style: 'currency',\r\n }).format(value);\r\n\r\nexport const floorToTwoDecimals = (value: number) => _.floor(value, 2);\r\n\r\nexport const convertToNumber = (value: any) => _.isNil(value) ? undefined : Number(value);\r\n","\r\nexport class BoolUtility {\r\n static hasValue = (val: boolean | undefined | null) =>\r\n val !== null && val !== undefined\r\n\r\n}\r\n","import { usePromiseTracker } from \"react-promise-tracker\";\r\n\r\n\r\n/**\r\n * Creates a React Promise Tracker custom hook that exposes the `promiseInProgress` boolean\r\n * @param param tag - string promiseTracker tag\r\n * @param delay number - optional parameter for delay promise in progress. Default value is 0\r\n * @returns boolean - promise tracker boolean hook\r\n */\r\nconst PromiseByTag = ({ tag, delay = 0 }: { tag: string, delay: number }) => {\r\n const { promiseInProgress } = usePromiseTracker({ area: tag, delay: delay});\r\n\r\n return promiseInProgress;\r\n}\r\n\r\n/**\r\n * Provided an array of tags, returns an array of booleans to follow promises in progress\r\n * @param tags string[] - promiseTracker tags you wish to observe\r\n * @param delay number - optional parameter for delay promise in progress. Default value is 0\r\n * @returns boolean[] - all promised hooks associated to the tags\r\n */\r\nconst createPromisesFromTags = (tags: string[], delay: number = 0): boolean[] => {\r\n if (tags !== undefined && tags.length > 0) {\r\n // iterate over each tags and get add to a list of promise trackers\r\n let promisesInProgress = tags.map((t) => {\r\n return PromiseByTag({ tag: t, delay: delay })\r\n })\r\n\r\n return promisesInProgress;\r\n }\r\n\r\n return [];\r\n}\r\n\r\n/**\r\n * Provided an array of tags, returns a boolean if any are considered still in progress of a promise\r\n * @param tags string[] - promiseTracker tags you wish to observe\r\n * @param delay number - optional parameter for delay promise in progress. Default value is 0\r\n * @returns boolean - if one or more tags is still in progress\r\n */\r\nconst anyPromiseTrackerTagsInProgress = (tags: string[], delay: number = 0): boolean => {\r\n return createPromisesFromTags(tags, delay).some(p => p === true);\r\n}\r\n\r\n\r\nexport {\r\n createPromisesFromTags,\r\n anyPromiseTrackerTagsInProgress\r\n}\r\n","import { BusinessLineModel, SalesItemAttributeModel, SalesItemModel, VisitSalesItemAttributeModel } from \"@common/models\";\r\nimport { BusinessLineName, BusinessLineEnum, SalesItemAttributeProcessingType, VisitSalesItemAttributesName } from \"@common/models/Enums\";\r\n\r\nexport class AttributeUtils {\r\n\r\n private static hospitalMedicationAttributeNames: string[] = [\r\n 'QTY:', 'Unit of Measure:', 'Dose:', 'Frequency:',\r\n 'Refills:', 'Instructions:', 'Expiration:', 'Notes:'\r\n ];\r\n\r\n static generatePredefinedAttributes = (attributeGroup: PredefinedAttributes, salesItem: SalesItemModel) => {\r\n const attributes: SalesItemAttributeModel[] = [];\r\n let order = salesItem.salesItemAttributes.length + 1;\r\n switch (attributeGroup) {\r\n case PredefinedAttributes.HospitalMedicationAttributes:\r\n // This is the only attribute with default value for this group.\r\n attributes.push(new SalesItemAttributeModel({\r\n businessLineId: BusinessLineEnum.Hospital,\r\n businessLine: new BusinessLineModel({ businessLineId: BusinessLineEnum.Hospital, name: BusinessLineName.Hospital }),\r\n salesItemAttributeTypeId: 1,\r\n name: 'Prescribed Product:',\r\n salesItemAttributeProcessingTypeId: SalesItemAttributeProcessingType.NoProcessing,\r\n // Using FullName since \"Description\" is just a FE Label.\r\n defaultValue: salesItem.fullName,\r\n sortOrder: order\r\n }));\r\n order++;\r\n AttributeUtils.hospitalMedicationAttributeNames.map(attName => {\r\n attributes.push(new SalesItemAttributeModel({\r\n businessLineId: BusinessLineEnum.Hospital,\r\n businessLine: new BusinessLineModel({ businessLineId: BusinessLineEnum.Hospital, name: BusinessLineName.Hospital }),\r\n salesItemAttributeTypeId: 1,\r\n name: attName,\r\n salesItemAttributeProcessingTypeId: SalesItemAttributeProcessingType.NoProcessing,\r\n sortOrder: order,\r\n }))\r\n order++;\r\n });\r\n return attributes;\r\n default:\r\n // Do we need to do something here or just break?\r\n return [];\r\n }\r\n }\r\n\r\n static getSalesItemAttributeValueByName = (visitSalesItemAttributes: VisitSalesItemAttributeModel[], nameKey: VisitSalesItemAttributesName, defaultValue = \"\") => {\r\n return _.defaultTo(visitSalesItemAttributes.find((v) => v.name == nameKey)?.stringValue, defaultValue)\r\n }\r\n}\r\n\r\nexport enum PredefinedAttributes {\r\n HospitalMedicationAttributes = 0,\r\n}\r\n","import localforage from \"localforage\";\r\nimport { DateTime } from \"luxon\";\r\n\r\nexport class CacheUtils {\r\n\r\n static LastAccessedSuffix = \"_PPLastAccessed\"\r\n\r\n private static getLastAccessedKey = (key: string) => key + this.LastAccessedSuffix\r\n private static getObjectKey = (lastAccessedKey: string) => lastAccessedKey.replace(this.LastAccessedSuffix, '');\r\n private static isLastAccessedKey = (key: string) => key.endsWith(this.LastAccessedSuffix);\r\n\r\n /** \r\n * Determine if the given value key has expired by evaluating its corresponding lastAccessed key.\r\n * */\r\n private static async hasExpired(key: string, maxAgeMs: number): Promise {\r\n // fetch the cached timestamp (if any)\r\n const timestamp = await localforage.getItem(this.getLastAccessedKey(key));\r\n // attempt to convert the timestamp string to an ISO DateTime.\r\n const timestampDT = DateTime.fromISO(timestamp ?? \"\", { zone: \"utc\" });\r\n // the cached object has expired if the timestamp can't be resolved,\r\n // OR it is older than our defined maxCacheAgeMs.\r\n return !timestampDT.isValid // not a valid timestamp\r\n || DateTime.utc().diff(timestampDT).milliseconds > maxAgeMs // too old\r\n }\r\n\r\n /**\r\n * Set the last accessed time of this key to now.\r\n */\r\n private static async updateLastAccessed(key: string): Promise {\r\n const timestamp = DateTime.utc().toISO()\r\n await localforage.setItem(this.getLastAccessedKey(key), timestamp);\r\n }\r\n\r\n /** \r\n * Get a value from storage.\r\n * */\r\n static async get(key: string): Promise {\r\n const value = await localforage.getItem(key);\r\n if (value === null) {\r\n return undefined;\r\n } else {\r\n await this.updateLastAccessed(key);\r\n return value;\r\n }\r\n }\r\n\r\n /** \r\n * Add a value to storage.\r\n * */\r\n static async set(key: string, value: T): Promise {\r\n await Promise.all([\r\n localforage.setItem(key, value),\r\n this.updateLastAccessed(key)\r\n ])\r\n return value;\r\n }\r\n\r\n /**\r\n * Remove a value from storage.\r\n */\r\n static async remove(key: string): Promise {\r\n // remove the cached value and corresponding timestamp\r\n await Promise.all([\r\n localforage.removeItem(key),\r\n localforage.removeItem(this.getLastAccessedKey(key))\r\n ]);\r\n }\r\n\r\n /** \r\n * Remove all expired keys from storage.\r\n * */\r\n static async evictExpiredKeys(maxAgeMs: number): Promise {\r\n // fetch all cached keys.\r\n const keys = await localforage.keys();\r\n // filter to only 'lastAccessed` keys to prevent removal of objects not managed by CacheUtils.\r\n for (const key of keys.filter(this.isLastAccessedKey).map(this.getObjectKey)) {\r\n // if cached object has expired remove it.\r\n if (await this.hasExpired(key, maxAgeMs))\r\n await this.remove(key)\r\n }\r\n }\r\n}\r\n","import { ISelectOption } from \"@common/components/forms\";\r\nimport { DateTimeUtils } from \"@common/utils\";\r\nimport { filter, includes } from \"lodash\";\r\nimport { DateTime } from \"luxon\";\r\nimport { AppointmentListingModel, AppointmentStatusOptions, IModel, ModelRecord } from \"..\";\r\nimport { AppointmentStatus, ReservationAssignmentStatuses } from '../Enums';\r\n\r\nexport interface IAppointmentRequest extends IModel {\r\n reservationId: number | undefined,\r\n hospitalId: number,\r\n clientId: number,\r\n petId: number,\r\n appointmentTypeId: number,\r\n appointmentTypeName: string, //extra field UI\r\n veterinarianId: number | undefined,\r\n hospitalScheduletemplateId: number | undefined,\r\n startDate: string,\r\n endDate: string,\r\n reasonForVisit: string,\r\n notes: string,\r\n appointmentStatus: AppointmentStatus;\r\n statusId: number\r\n length: string;\r\n duration: number; //extra field UI\r\n startTime: string, //extra field UI\r\n endTime: string, //extra field UI\r\n veterinarianFullName: string //extra field UI....\r\n assignmentStatus: ReservationAssignmentStatuses | undefined,\r\n isWalkIn: boolean\r\n}\r\n\r\nexport class AppointmentRequest implements ModelRecord {\r\n reservationId: number | undefined;\r\n hospitalId: number;\r\n clientId: number;\r\n petId: number;\r\n duration: number;\r\n appointmentTypeId: number;\r\n appointmentTypeName: string;\r\n veterinarianId: number | undefined;\r\n hospitalScheduletemplateId: number | undefined;\r\n startDate: string;\r\n startTime: string;\r\n endDate: string;\r\n endTime: string;\r\n reasonForVisit: string;\r\n veterinarianFullName: string;\r\n notes: string;\r\n appointmentStatus: AppointmentStatus;\r\n statusId: number;\r\n length: string;\r\n assignmentStatus: ReservationAssignmentStatuses | undefined;\r\n isWalkIn: boolean\r\n rowVersion: string;\r\n\r\n constructor(params: Partial) {\r\n const {\r\n reservationId = undefined,\r\n hospitalId = 0,\r\n clientId = 0,\r\n petId = 0,\r\n duration = 900,\r\n appointmentTypeId = 0,\r\n appointmentTypeName = '',\r\n veterinarianId = undefined,\r\n hospitalScheduletemplateId = undefined,\r\n startDate = DateTime.utc().toISO(),\r\n startTime = DateTime.utc().toISO(),\r\n endDate = DateTime.utc().toISO(),\r\n endTime = DateTime.utc().toISO(),\r\n reasonForVisit = '',\r\n notes = '',\r\n length = '',\r\n appointmentStatus = AppointmentStatus.Booked,\r\n statusId = 1,\r\n veterinarianFullName = '',\r\n assignmentStatus = ReservationAssignmentStatuses.Unassigned,\r\n isWalkIn = false,\r\n rowVersion = ''\r\n } = params;\r\n\r\n this.reservationId = reservationId;\r\n this.hospitalId = hospitalId;\r\n this.clientId = clientId;\r\n this.petId = petId;\r\n this.veterinarianFullName = veterinarianFullName;\r\n this.appointmentTypeId = appointmentTypeId;\r\n this.appointmentTypeName = appointmentTypeName;\r\n this.veterinarianId = veterinarianId;\r\n this.hospitalScheduletemplateId = hospitalScheduletemplateId;\r\n this.startDate = startDate;\r\n this.endDate = endDate;\r\n this.reasonForVisit = reasonForVisit;\r\n this.notes = notes;\r\n this.duration = duration;\r\n this.startTime = startTime;\r\n this.endTime = endTime;\r\n this.length = length;\r\n this.appointmentStatus = appointmentStatus;\r\n this.assignmentStatus = assignmentStatus;\r\n this.statusId = statusId;\r\n this.isWalkIn = isWalkIn;\r\n this.rowVersion = rowVersion;\r\n }\r\n\r\n /**\r\n * Provides a dropdown list of all appointment status options that exist provided the business rules exist\r\n * @returns all appointment status options applicable for the current appointment\r\n */\r\n getAvailableAppointmentStatuses(isAppointmentForCurrentDay?: boolean): ISelectOption[] {\r\n let appointmentStatuses: ISelectOption[] = [];\r\n if (this.reservationId == 0) {\r\n appointmentStatuses = filter(AppointmentStatusOptions, (appointmentStatus) => { return includes(['Confirmed', 'Booked', isAppointmentForCurrentDay ? 'Walk-in' : ''], appointmentStatus.label); });\r\n }\r\n else if (this.statusId == 5) {\r\n appointmentStatuses = filter(AppointmentStatusOptions, (appointmentStatus) => { return includes(['Cancelled', 'Showed'], appointmentStatus.label); });\r\n }\r\n else if (this.statusId > 3) {\r\n appointmentStatuses = filter(AppointmentStatusOptions, (appointmentStatus) => { return includes([AppointmentStatus.statusFormattedName(AppointmentStatus[this.statusId])], appointmentStatus.label); });\r\n }\r\n else {\r\n appointmentStatuses = filter(AppointmentStatusOptions, (appointmentStatus) => { return includes(['Confirmed', 'Booked', 'Cancelled'], appointmentStatus.label); });\r\n }\r\n\r\n return appointmentStatuses;\r\n }\r\n\r\n static FromListingModel(hospitalId: number, model: AppointmentListingModel) {\r\n return new AppointmentRequest({\r\n reservationId: model.reservationId,\r\n hospitalId: hospitalId,\r\n clientId: model.clientId,\r\n petId: model.petId,\r\n appointmentTypeId: model.appointmentTypeId,\r\n appointmentTypeName: model.appointmentTypeName,\r\n veterinarianId: model.veterinarianId,\r\n hospitalScheduletemplateId: model.hospitalScheduleTemplateId,\r\n startDate: model.startDate,\r\n endDate: model.endDate,\r\n reasonForVisit: model.reasonForVisit,\r\n notes: model.notes,\r\n duration: (model.startDate != undefined && model.endDate != undefined) ? DateTimeUtils.getDuration(model.startDate, model.endDate, \"seconds\") : 900,\r\n statusId: model.appointmentStatusId,\r\n appointmentStatus: model.appointmentStatusId == AppointmentStatus.Walk_In ? AppointmentStatus.Showed : model.appointmentStatusId,\r\n assignmentStatus: model.assignmentStatus,\r\n isWalkIn: model.appointmentStatusId == AppointmentStatus.Walk_In ? true : false,\r\n rowVersion: model.rowVersion\r\n });\r\n }\r\n}\r\n","import { AppointmentListingModel, IModel, ModelRecord } from \"@common/models\";\r\nimport { ICheckInModel } from \"@models/forms/ICheckInModel\";\r\nimport { defaultTo } from \"lodash\";\r\nexport interface IAppointmentCheckInRequest extends IModel {\r\n reservationId: number\r\n veterinarianId: number,\r\n veterinarianFirstName: string,\r\n veterinarianLastName: string,\r\n veterinarianEmailName: string,\r\n veterinarianLicenseNumber: string,\r\n veterinarianLicenseStateId: number | undefined,\r\n veterinarianLicenseExpirationDate: string,\r\n createAsInProgress: boolean,\r\n dispensingAuthUserId: number | undefined,\r\n dispensingUserFirstName: string | undefined,\r\n dispensingUserLastName: string | undefined,\r\n reasonForVisit: string | undefined\r\n appointmentNotes: string | undefined;\r\n intakeNotes: string | undefined;\r\n weight: number | undefined;\r\n room: string | undefined;\r\n}\r\n\r\nexport class AppointmentCheckInRequest implements ModelRecord {\r\n reservationId: number;\r\n veterinarianId: number;\r\n veterinarianFirstName: string;\r\n veterinarianLastName: string;\r\n veterinarianEmailName: string;\r\n veterinarianLicenseNumber: string;\r\n veterinarianLicenseStateId: number | undefined;\r\n veterinarianLicenseExpirationDate: string;\r\n createAsInProgress: boolean;\r\n dispensingAuthUserId: number | undefined;\r\n dispensingUserFirstName: string | undefined;\r\n dispensingUserLastName: string | undefined;\r\n reasonForVisit: string | undefined\r\n appointmentNotes: string | undefined;\r\n intakeNotes: string | undefined;\r\n weight: number | undefined;\r\n room: string | undefined;\r\n rowVersion: string;\r\n\r\n constructor(params: Partial) {\r\n const {\r\n reservationId = 0,\r\n veterinarianId = 0,\r\n veterinarianFirstName = '',\r\n veterinarianLastName = '',\r\n veterinarianEmailName = '',\r\n veterinarianLicenseNumber = '',\r\n veterinarianLicenseStateId = undefined,\r\n veterinarianLicenseExpirationDate = '',\r\n createAsInProgress = false,\r\n rowVersion = ''\r\n } = params;\r\n\r\n this.reservationId = reservationId;\r\n this.veterinarianId = veterinarianId;\r\n this.veterinarianFirstName = veterinarianFirstName;\r\n this.veterinarianLastName = veterinarianLastName;\r\n this.veterinarianEmailName = veterinarianEmailName;\r\n this.veterinarianLicenseNumber = veterinarianLicenseNumber;\r\n this.veterinarianLicenseStateId = veterinarianLicenseStateId;\r\n this.veterinarianLicenseExpirationDate = veterinarianLicenseExpirationDate;\r\n this.createAsInProgress = createAsInProgress;\r\n this.dispensingAuthUserId = defaultTo(params?.dispensingAuthUserId, undefined);\r\n this.dispensingUserFirstName = defaultTo(params?.dispensingUserFirstName, '');\r\n this.dispensingUserLastName = defaultTo(params?.dispensingUserLastName, '');\r\n this.reasonForVisit = defaultTo(params?.reasonForVisit, '');\r\n this.appointmentNotes = defaultTo(params?.appointmentNotes, '');\r\n this.intakeNotes = defaultTo(params?.intakeNotes, '');\r\n this.weight = defaultTo(params?.weight, undefined);\r\n this.room = defaultTo(params?.room, '');\r\n this.rowVersion = rowVersion;\r\n }\r\n\r\n static FromListingModel(model: AppointmentListingModel, checkInModel: ICheckInModel, createAsInProgress: boolean = false) {\r\n return new AppointmentCheckInRequest({\r\n reservationId: model.reservationId,\r\n // We send vetId, and not other details on vet because we want vet in db to be source of truth.\r\n veterinarianId: model.veterinarianId,\r\n\r\n // We send first and last name here to save a fetch on the backend.\r\n dispensingAuthUserId: model.dispensingAuthUserId,\r\n dispensingUserFirstName: model.dispensingUserFirstName,\r\n dispensingUserLastName: model.dispensingUserLastName,\r\n\r\n appointmentNotes: checkInModel.appointmentNotes,\r\n intakeNotes: checkInModel.intakeNotes,\r\n reasonForVisit: checkInModel.reasonForVisit,\r\n weight: checkInModel.weight,\r\n room: checkInModel.room,\r\n rowVersion: model.rowVersion,\r\n createAsInProgress: createAsInProgress\r\n });\r\n }\r\n}\r\n","import { StringUtility } from \"@common/utils\";\r\nimport { defaultTo } from \"lodash\";\r\nimport { EntityScheduleType, WeekDay } from \"@common/models/Enums\";\r\n\r\nexport interface IEntityScheduleOverridePreferenceRequest {\r\n storeId: number;\r\n entityId: number;\r\n entityType: EntityScheduleType | undefined;\r\n schedulePreferenceOverrideId: number | undefined;\r\n schedulePreferenceId: number;\r\n scheduleBlockTypeId: number;\r\n startTime: string;\r\n endTime: string;\r\n dayOfWeek: WeekDay.Day;\r\n overrideDate: string;\r\n notes: string | undefined;\r\n createdBy: string | undefined;\r\n updatedBy: string | undefined;\r\n dateCreated: string | undefined;\r\n dateUpdated: string | undefined;\r\n}\r\n\r\nexport class EntityScheduleOverridePreferenceRequest implements IEntityScheduleOverridePreferenceRequest {\r\n storeId: number;\r\n entityId: number;\r\n entityType: EntityScheduleType | undefined;\r\n schedulePreferenceOverrideId: number | undefined;\r\n schedulePreferenceId: number;\r\n scheduleBlockTypeId: number;\r\n startTime: string;\r\n endTime: string;\r\n dayOfWeek: WeekDay.Day;\r\n overrideDate: string;\r\n notes: string | undefined;\r\n createdBy: string | undefined;\r\n updatedBy: string | undefined;\r\n dateCreated: string | undefined;\r\n dateUpdated: string | undefined;\r\n\r\n constructor(init: Partial) {\r\n this.storeId = defaultTo(init.storeId, 0);\r\n this.schedulePreferenceOverrideId = init.schedulePreferenceOverrideId;\r\n this.entityId = defaultTo(init.entityId, 0);\r\n this.entityType = init.entityType;\r\n this.schedulePreferenceId = defaultTo(init.schedulePreferenceId, 0);\r\n this.scheduleBlockTypeId = defaultTo(init.scheduleBlockTypeId, 0);\r\n this.startTime = defaultTo(init.startTime, '12:00:00');\r\n this.endTime = defaultTo(init.endTime, '12:30:00');\r\n this.dayOfWeek = defaultTo(init.dayOfWeek as WeekDay.Day, WeekDay.Day.Monday);\r\n this.overrideDate = defaultTo(init.overrideDate, '');\r\n this.notes = StringUtility.SanitizeString(init.notes);\r\n this.createdBy = defaultTo(init.createdBy, '');\r\n this.updatedBy = defaultTo(init.updatedBy, '');\r\n this.dateCreated = defaultTo(init.dateCreated, '');\r\n this.dateUpdated = defaultTo(init.dateUpdated, '');\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { DateTime } from \"luxon\";\r\nimport { Model } from \"../Model\";\r\n\r\nexport interface IHospitalScheduleRequestModel extends Model {\r\n hospitalScheduleId: number;\r\n veterinarianId: number | undefined;\r\n hospitalScheduleTemplateId: number | undefined;\r\n hospitalId: number\r\n date: string;\r\n}\r\n\r\nexport class HospitalScheduleRequestModel implements IHospitalScheduleRequestModel {\r\n hospitalScheduleId: number;\r\n veterinarianId: number | undefined;\r\n hospitalScheduleTemplateId: number | undefined;\r\n hospitalId: number\r\n date: string;\r\n isAdHoc: boolean;\r\n rowVersion: string;\r\n\r\n\r\n\r\n constructor(params?: Partial) {\r\n this.hospitalScheduleId = defaultTo(params?.hospitalScheduleId, 0);\r\n this.veterinarianId = defaultTo(params?.veterinarianId, undefined);\r\n this.hospitalScheduleTemplateId = defaultTo(params?.hospitalScheduleTemplateId, undefined);\r\n this.hospitalId = defaultTo(params?.hospitalId, 0);\r\n this.date = defaultTo(params?.date?.substring(0, 10), DateTime.utc().toISO().substring(0, 10)); // trim off any timezone offset\r\n this.isAdHoc = false;\r\n this.rowVersion = defaultTo(params?.rowVersion, '');\r\n }\r\n}\r\n","\r\nexport interface IVisitConsentClientRequest {\r\n reasonForVisit: string;\r\n treatmentStarted: boolean;\r\n previousTreatment: string;\r\n isCurrentlyOnMedications: boolean;\r\n medicationList: string;\r\n}\r\n\r\nexport class VisitConsentClientRequest implements IVisitConsentClientRequest {\r\n reasonForVisit: string;\r\n treatmentStarted: boolean;\r\n previousTreatment: string;\r\n isCurrentlyOnMedications: boolean;\r\n medicationList: string;\r\n\r\n constructor(params: IVisitConsentClientRequest) {\r\n this.reasonForVisit = _.defaultTo(params.reasonForVisit, '');\r\n this.treatmentStarted = _.defaultTo(params.treatmentStarted, false);\r\n this.previousTreatment = _.defaultTo(params.previousTreatment, '');\r\n this.isCurrentlyOnMedications = _.defaultTo(params.isCurrentlyOnMedications, false);\r\n this.medicationList = _.defaultTo(params.medicationList, '');\r\n }\r\n}\r\n","\r\nexport interface IVisitConsentDentalExtractionRequest {\r\n authorizationResponseId: number;\r\n authorizationLimit: string;\r\n}\r\n\r\nexport class VisitConsentDentalExtractionRequest implements IVisitConsentDentalExtractionRequest {\r\n authorizationResponseId: number;\r\n authorizationLimit: string;\r\n\r\n constructor(params: IVisitConsentDentalExtractionRequest) {\r\n this.authorizationResponseId = _.defaultTo(params.authorizationResponseId, 0);\r\n this.authorizationLimit = _.defaultTo(params.authorizationLimit, '');\r\n }\r\n}\r\n","\r\nexport interface IVisitConsentEuthanasiaRequest {\r\n euthanasiaResponseId: number;\r\n}\r\n\r\nexport class VisitConsentEuthanasiaRequest implements IVisitConsentEuthanasiaRequest {\r\n euthanasiaResponseId: number;\r\n\r\n constructor(params: IVisitConsentEuthanasiaRequest) {\r\n this.euthanasiaResponseId = _.defaultTo(params.euthanasiaResponseId, 0);\r\n }\r\n}\r\n","\r\nexport interface IVisitConsentSurgeryRequest {\r\n proceduresRequested: string;\r\n lastEatDate: string;\r\n areVaccincationsCurrent: boolean | undefined;\r\n outOfDateVaccincations: string;\r\n isPetIll: boolean | undefined;\r\n hasConcernsToday: boolean | undefined;\r\n illnessOrConcernsNotes: string;\r\n isPetMicrochipped: boolean | undefined;\r\n microchipRequested: boolean | undefined;\r\n medicationsList: string;\r\n fleaTickMedications: string;\r\n hasSeriousHealthConcerns: boolean | undefined;\r\n hadPreviousReactions: boolean | undefined;\r\n needsAdditionalServices: boolean | undefined;\r\n additionalConcerns: string;\r\n infectiousDiseaseInitials: string;\r\n isCPRAllowed: boolean | undefined;\r\n}\r\n\r\nexport class VisitConsentSurgeryRequest implements IVisitConsentSurgeryRequest {\r\n proceduresRequested: string;\r\n lastEatDate: string;\r\n areVaccincationsCurrent: boolean | undefined;\r\n outOfDateVaccincations: string;\r\n isPetIll: boolean | undefined;\r\n hasConcernsToday: boolean | undefined;\r\n illnessOrConcernsNotes: string;\r\n isPetMicrochipped: boolean | undefined;\r\n microchipRequested: boolean | undefined;\r\n medicationsList: string;\r\n fleaTickMedications: string;\r\n hasSeriousHealthConcerns: boolean | undefined;\r\n hadPreviousReactions: boolean | undefined;\r\n needsAdditionalServices: boolean | undefined;\r\n additionalConcerns: string;\r\n infectiousDiseaseInitials: string;\r\n isCPRAllowed: boolean | undefined;\r\n\r\n constructor(params: IVisitConsentSurgeryRequest) {\r\n this.proceduresRequested = _.defaultTo(params.proceduresRequested, '');\r\n this.lastEatDate = _.defaultTo(params.lastEatDate, '');\r\n this.areVaccincationsCurrent = _.defaultTo(params.areVaccincationsCurrent, undefined);\r\n this.outOfDateVaccincations = _.defaultTo(params.outOfDateVaccincations, '');\r\n this.isPetIll = _.defaultTo(params.isPetIll, undefined);\r\n this.hasConcernsToday = _.defaultTo(params.hasConcernsToday, undefined);\r\n this.illnessOrConcernsNotes = _.defaultTo(params.illnessOrConcernsNotes, '');\r\n this.isPetMicrochipped = _.defaultTo(params.isPetMicrochipped, undefined);\r\n this.microchipRequested = _.defaultTo(params.microchipRequested, undefined);\r\n this.medicationsList = _.defaultTo(params.medicationsList, '');\r\n this.fleaTickMedications = _.defaultTo(params.fleaTickMedications, '');\r\n this.hasSeriousHealthConcerns = _.defaultTo(params.hasSeriousHealthConcerns, undefined);\r\n this.hadPreviousReactions = _.defaultTo(params.hadPreviousReactions, undefined);\r\n this.needsAdditionalServices = _.defaultTo(params.needsAdditionalServices, undefined);\r\n this.additionalConcerns = _.defaultTo(params.additionalConcerns, '');\r\n this.infectiousDiseaseInitials = _.defaultTo(params.infectiousDiseaseInitials, '');\r\n this.isCPRAllowed = _.defaultTo(params.isCPRAllowed, undefined);\r\n }\r\n}\r\n","\r\nexport interface IVisitConsentTreatmentRequest {\r\n isCPRAllowed: boolean;\r\n}\r\n\r\nexport class VisitConsentTreatmentRequest implements IVisitConsentTreatmentRequest {\r\n isCPRAllowed: boolean;\r\n\r\n constructor(params: IVisitConsentTreatmentRequest) {\r\n this.isCPRAllowed = _.defaultTo(params.isCPRAllowed, false);\r\n }\r\n}\r\n","import { IConsentForm } from \"@common/models/forms/ConsentForm\";\r\nimport { VisitConsentClientRequest } from \"./VisitConsentClientRequest\";\r\nimport { VisitConsentDentalExtractionRequest } from \"./VisitConsentDentalExtractionRequest\";\r\nimport { VisitConsentEuthanasiaRequest } from \"./VisitConsentEuthanasiaRequest\";\r\nimport { VisitConsentSurgeryRequest } from \"./VisitConsentSurgeryRequest\";\r\nimport { VisitConsentTreatmentRequest } from \"./VisitConsentTreatmentRequest\";\r\n\r\nexport interface ISignAndStoreConsentRequest {\r\n visitPublicId: string;\r\n consentTypePublicId: string;\r\n signatureBase64Encoded: string;\r\n visitConsentEuthanasiaRequest?: VisitConsentEuthanasiaRequest;\r\n visitConsentClientRequest?: VisitConsentClientRequest;\r\n visitConsentDentalExtractionRequest?: VisitConsentDentalExtractionRequest;\r\n visitConsentTreatmentRequest?: VisitConsentTreatmentRequest;\r\n visitConsentSurgeryRequest?: VisitConsentSurgeryRequest\r\n}\r\n\r\nexport class SignAndStoreConsentRequest implements ISignAndStoreConsentRequest {\r\n visitPublicId: string;\r\n consentTypePublicId: string;\r\n signatureBase64Encoded: string;\r\n visitConsentEuthanasiaRequest?: VisitConsentEuthanasiaRequest;\r\n visitConsentClientRequest?: VisitConsentClientRequest;\r\n visitConsentDentalExtractionRequest?: VisitConsentDentalExtractionRequest;\r\n visitConsentTreatmentRequest?: VisitConsentTreatmentRequest;\r\n visitConsentSurgeryRequest?: VisitConsentSurgeryRequest;\r\n\r\n constructor(params: ISignAndStoreConsentRequest) {\r\n this.visitPublicId = _.defaultTo(params.visitPublicId, '');\r\n this.consentTypePublicId = _.defaultTo(params.consentTypePublicId, '');\r\n this.signatureBase64Encoded = _.defaultTo(params.signatureBase64Encoded, '');\r\n this.visitConsentEuthanasiaRequest = params.visitConsentEuthanasiaRequest ? new VisitConsentEuthanasiaRequest(params.visitConsentEuthanasiaRequest) : undefined;\r\n this.visitConsentClientRequest = params.visitConsentClientRequest ? new VisitConsentClientRequest(params.visitConsentClientRequest) : undefined;\r\n this.visitConsentDentalExtractionRequest = params.visitConsentDentalExtractionRequest ? new VisitConsentDentalExtractionRequest(params.visitConsentDentalExtractionRequest) : undefined;\r\n this.visitConsentTreatmentRequest = params.visitConsentTreatmentRequest ? new VisitConsentTreatmentRequest(params.visitConsentTreatmentRequest) : undefined;\r\n this.visitConsentSurgeryRequest = params.visitConsentSurgeryRequest ? new VisitConsentSurgeryRequest(params.visitConsentSurgeryRequest) : undefined;\r\n }\r\n\r\n static ParseSignAndStoreConsentRequest(visitPublicId: string, consentTypePublicId: string, signatureBase64Encoded: string, formData?: IConsentForm): SignAndStoreConsentRequest {\r\n return {\r\n signatureBase64Encoded,\r\n visitPublicId,\r\n consentTypePublicId,\r\n visitConsentEuthanasiaRequest: formData?.euthanasiaConsentForm ? new VisitConsentEuthanasiaRequest(formData.euthanasiaConsentForm) : undefined,\r\n visitConsentClientRequest: formData?.clientConsentForm ? new VisitConsentClientRequest(formData.clientConsentForm) : undefined,\r\n visitConsentDentalExtractionRequest: formData?.dentalExtractionConsentForm ? new VisitConsentDentalExtractionRequest(formData.dentalExtractionConsentForm) : undefined,\r\n visitConsentTreatmentRequest: formData?.treatmentConsentForm ? new VisitConsentTreatmentRequest(formData.treatmentConsentForm) : undefined,\r\n visitConsentSurgeryRequest: formData?.surgeryConsentForm ? new VisitConsentSurgeryRequest(formData.surgeryConsentForm) : undefined\r\n }\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\n\r\nexport interface IAddSalesItemRequest {\r\n visitId: number;\r\n salesItemOptionId: number | undefined;\r\n isPending: boolean;\r\n salesItemOptionIdBeingReplaced: number | undefined;\r\n isPackageUpgrade: boolean;\r\n isFromDI: boolean;\r\n refillVisitId: number | undefined;\r\n blockTagAlongs: boolean;\r\n prescriptionVisitSalesItemId: number | undefined;\r\n}\r\n\r\nexport class AddSalesItemRequest implements IAddSalesItemRequest {\r\n visitId: number;\r\n salesItemOptionId: number | undefined;\r\n isPending: boolean;\r\n salesItemOptionIdBeingReplaced: number | undefined;\r\n isPackageUpgrade: boolean;\r\n isFromDI: boolean;\r\n refillVisitId: number | undefined;\r\n blockTagAlongs: boolean;\r\n prescriptionVisitSalesItemId: number | undefined;\r\n\r\n constructor(params: Partial) {\r\n this.visitId = defaultTo(params.visitId, 0);\r\n this.salesItemOptionId = params.salesItemOptionId;\r\n this.isPending = defaultTo(params.isPending, false);\r\n this.salesItemOptionIdBeingReplaced = params.salesItemOptionIdBeingReplaced;\r\n this.isPackageUpgrade = defaultTo(params.isPackageUpgrade, false);\r\n this.isFromDI = defaultTo(params.isFromDI, false);\r\n this.refillVisitId = params.refillVisitId;\r\n this.blockTagAlongs = defaultTo(params.blockTagAlongs, false);\r\n this.prescriptionVisitSalesItemId = params.prescriptionVisitSalesItemId;\r\n }\r\n}\r\n","import { IModel, Model } from \"./Model\";\r\n\r\nexport interface IPrognosisScoreModel extends IModel {\r\n prognosisScoreId: number;\r\n name: string;\r\n description: string;\r\n}\r\n\r\nexport class PrognosisScoreModel extends Model implements Record {\r\n prognosisScoreId: number\r\n name: string\r\n description: string\r\n constructor(params: Partial = {}) {\r\n super(params);\r\n this.prognosisScoreId = params.prognosisScoreId ?? 0;\r\n this.name = params.name ?? \"\";\r\n this.description = params.description ?? \"\";\r\n }\r\n}\r\n","import { StringUtility } from \"@common/utils\";\r\nimport { DateTime } from \"luxon\";\r\nimport { WellnessExamPrognosisScore } from \"./Enums\";\r\nimport { IModel, Model } from \"./Model\";\r\nimport { IPrognosisScoreModel, PrognosisScoreModel } from \"./PrognosisScoreModel\";\r\n\r\nexport interface IVisitWellnessExamModel extends IModel {\r\n visitWellnessExamId: number;\r\n vaccinationsRequested: boolean | undefined;\r\n diagnosticRequested: boolean | undefined;\r\n parasiticalRequested: boolean | undefined;\r\n microchipRequested: boolean | undefined;\r\n isHealthy: boolean | undefined;\r\n hasNormalAppetite: boolean | undefined;\r\n isBehavorActive: boolean | undefined;\r\n hasNoIllnessSigns: boolean | undefined;\r\n temperature: number | undefined;\r\n pulse: number | undefined;\r\n weight: number | undefined;\r\n respiration: number | undefined;\r\n approvedForVaccinations: boolean | undefined;\r\n notes: string;\r\n temperatureUTE: boolean | undefined;\r\n temperatureDNE: boolean | undefined;\r\n pulseUTE: boolean | undefined;\r\n pulseDNE: boolean | undefined;\r\n respirationUTE: boolean | undefined;\r\n respirationDNE: boolean | undefined;\r\n visitDate: string | undefined;\r\n attitude: string | undefined;\r\n painScale: number | undefined;\r\n mucousMembrane: string | undefined;\r\n capillaryRefill: string | undefined;\r\n bodyConditionScore: number | undefined;\r\n attitudeUTE: boolean | undefined;\r\n attitudeDNE: boolean | undefined;\r\n painScaleUTE: boolean | undefined;\r\n painScaleDNE: boolean | undefined;\r\n mucousMembraneUTE: boolean | undefined;\r\n mucousMembraneDNE: boolean | undefined;\r\n capillaryRefillUTE: boolean | undefined;\r\n capillaryRefillDNE: boolean | undefined;\r\n bodyConditionScoreUTE: boolean | undefined;\r\n bodyConditionScoreDNE: boolean | undefined;\r\n intakeNotes: string | undefined;\r\n subjectiveNotes: string | undefined;\r\n objectiveNotes: string | undefined;\r\n vitalsNotes: string | undefined;\r\n planNotes: string | undefined;\r\n diagnosisNotes: string | undefined;\r\n prognosisNotes: string | undefined;\r\n dischargeNotes: string | undefined;\r\n privateNotes: string | undefined;\r\n prognosisScore: IPrognosisScoreModel | undefined;\r\n prognosisScoreId: number | undefined;\r\n diagnosisIds: number[] | undefined;\r\n}\r\n\r\nexport class VisitWellnessExamModel extends Model implements Record {\r\n visitWellnessExamId: number;\r\n vaccinationsRequested: boolean | undefined;\r\n diagnosticRequested: boolean | undefined;\r\n parasiticalRequested: boolean | undefined;\r\n microchipRequested: boolean | undefined;\r\n isHealthy: boolean | undefined;\r\n hasNormalAppetite: boolean | undefined;\r\n isBehavorActive: boolean | undefined;\r\n hasNoIllnessSigns: boolean | undefined;\r\n temperature: number | undefined;\r\n pulse: number | undefined;\r\n weight: number | undefined;\r\n respiration: number | undefined;\r\n approvedForVaccinations: boolean | undefined;\r\n notes: string | undefined; // assessment notes\r\n temperatureUTE: boolean | undefined;\r\n temperatureDNE: boolean | undefined;\r\n pulseUTE: boolean | undefined;\r\n pulseDNE: boolean | undefined;\r\n respirationUTE: boolean | undefined;\r\n respirationDNE: boolean | undefined;\r\n visitDate: DateTime | undefined;\r\n attitude: string | undefined;\r\n painScale: number | undefined;\r\n mucousMembrane: string | undefined;\r\n capillaryRefill: string | undefined;\r\n bodyConditionScore: number | undefined;\r\n\r\n attitudeUTE: boolean | undefined;\r\n attitudeDNE: boolean | undefined;\r\n painScaleUTE: boolean | undefined;\r\n painScaleDNE: boolean | undefined;\r\n mucousMembraneUTE: boolean | undefined;\r\n mucousMembraneDNE: boolean | undefined;\r\n capillaryRefillUTE: boolean | undefined;\r\n capillaryRefillDNE: boolean | undefined;\r\n bodyConditionScoreUTE: boolean | undefined;\r\n bodyConditionScoreDNE: boolean | undefined;\r\n\r\n intakeNotes: string | undefined;\r\n subjectiveNotes: string | undefined;\r\n objectiveNotes: string | undefined;\r\n vitalsNotes: string | undefined;\r\n planNotes: string | undefined;\r\n diagnosisNotes: string | undefined;\r\n prognosisNotes: string | undefined;\r\n dischargeNotes: string | undefined;\r\n privateNotes: string | undefined;\r\n\r\n prognosisScore: PrognosisScoreModel | undefined;\r\n prognosisScoreId: WellnessExamPrognosisScore | undefined;\r\n\r\n diagnosisIds: number[] | undefined;\r\n\r\n constructor(params: Partial) {\r\n super(params);\r\n this.visitWellnessExamId = params.visitWellnessExamId ?? 0;\r\n this.vaccinationsRequested = StringUtility.SanitizeBool(params.vaccinationsRequested);\r\n this.diagnosticRequested = StringUtility.SanitizeBool(params.diagnosticRequested);\r\n this.parasiticalRequested = StringUtility.SanitizeBool(params.parasiticalRequested);\r\n this.microchipRequested = StringUtility.SanitizeBool(params.microchipRequested);\r\n this.isHealthy = StringUtility.SanitizeBool(params.isHealthy);\r\n this.hasNormalAppetite = StringUtility.SanitizeBool(params.hasNormalAppetite);\r\n this.isBehavorActive = StringUtility.SanitizeBool(params.isBehavorActive);\r\n this.hasNoIllnessSigns = StringUtility.SanitizeBool(params.hasNoIllnessSigns);\r\n this.temperature = StringUtility.SanitizeNumber(params.temperature);\r\n this.pulse = StringUtility.SanitizeNumber(params.pulse);\r\n this.weight = StringUtility.SanitizeNumber(params.weight);\r\n this.respiration = StringUtility.SanitizeNumber(params.respiration);\r\n this.approvedForVaccinations = StringUtility.SanitizeBool(params.approvedForVaccinations);\r\n this.notes = params.notes ?? undefined;\r\n this.temperatureUTE = StringUtility.SanitizeBool(params.temperatureUTE);\r\n this.temperatureDNE = StringUtility.SanitizeBool(params.temperatureDNE);\r\n this.pulseUTE = StringUtility.SanitizeBool(params.pulseUTE);\r\n this.pulseDNE = StringUtility.SanitizeBool(params.pulseDNE);\r\n this.respirationUTE = StringUtility.SanitizeBool(params.respirationUTE);\r\n this.respirationDNE = StringUtility.SanitizeBool(params.respirationDNE);\r\n this.visitDate = StringUtility.SanitizeDateTimeISOAsUtc(params.visitDate);\r\n this.attitude = StringUtility.SanitizeString(params.attitude);\r\n this.painScale = StringUtility.SanitizeNumber(params.painScale);\r\n this.mucousMembrane = StringUtility.SanitizeString(params.mucousMembrane);\r\n this.capillaryRefill = StringUtility.SanitizeString(params.capillaryRefill);\r\n this.bodyConditionScore = StringUtility.SanitizeNumber(params.bodyConditionScore);\r\n this.attitudeUTE = StringUtility.SanitizeBool(params.attitudeUTE);\r\n this.attitudeDNE = StringUtility.SanitizeBool(params.attitudeDNE);\r\n this.painScaleUTE = StringUtility.SanitizeBool(params.painScaleUTE);\r\n this.painScaleDNE = StringUtility.SanitizeBool(params.painScaleDNE);\r\n this.mucousMembraneUTE = StringUtility.SanitizeBool(params.mucousMembraneUTE);\r\n this.mucousMembraneDNE = StringUtility.SanitizeBool(params.mucousMembraneDNE);\r\n this.capillaryRefillUTE = StringUtility.SanitizeBool(params.capillaryRefillUTE);\r\n this.capillaryRefillDNE = StringUtility.SanitizeBool(params.capillaryRefillDNE);\r\n this.bodyConditionScoreUTE = StringUtility.SanitizeBool(params.bodyConditionScoreUTE);\r\n this.bodyConditionScoreDNE = StringUtility.SanitizeBool(params.bodyConditionScoreDNE);\r\n this.intakeNotes = StringUtility.SanitizeString(params.intakeNotes)\r\n this.subjectiveNotes = StringUtility.SanitizeString(params.subjectiveNotes)\r\n this.objectiveNotes = StringUtility.SanitizeString(params.objectiveNotes)\r\n this.vitalsNotes = StringUtility.SanitizeString(params.vitalsNotes)\r\n this.planNotes = StringUtility.SanitizeString(params.planNotes)\r\n this.diagnosisNotes = StringUtility.SanitizeString(params.diagnosisNotes)\r\n this.prognosisNotes = StringUtility.SanitizeString(params.prognosisNotes)\r\n this.dischargeNotes = StringUtility.SanitizeString(params.dischargeNotes)\r\n this.privateNotes = StringUtility.SanitizeString(params.privateNotes)\r\n this.prognosisScore = params.prognosisScore === undefined ? undefined : new PrognosisScoreModel(params.prognosisScore);\r\n this.prognosisScoreId = StringUtility.SanitizeNumber(params.prognosisScoreId)\r\n this.diagnosisIds = params.diagnosisIds ?? undefined\r\n }\r\n}\r\n","import { IModel, Model } from \"../Model\";\r\n\r\nexport interface IAuthApplicationModel extends IModel {\r\n authApplicationId: number,\r\n description: string,\r\n key: string,\r\n isFilterable: boolean,\r\n isViewable: boolean\r\n}\r\n\r\nexport class AuthApplicationModel extends Model implements IAuthApplicationModel {\r\n authApplicationId: number;\r\n description: string;\r\n key: string;\r\n isFilterable: boolean;\r\n isViewable: boolean;\r\n\r\n constructor(params: Partial) {\r\n super(params);\r\n const {\r\n authApplicationId = 0,\r\n description = '',\r\n key = '',\r\n isFilterable = false,\r\n isViewable = false\r\n } = params;\r\n\r\n this.authApplicationId = authApplicationId;\r\n this.description = description;\r\n this.key = key;\r\n this.isFilterable = isFilterable;\r\n this.isViewable = isViewable;\r\n }\r\n}\r\n","import { IModel, Model } from \"../Model\";\r\n\r\nexport const AuthOperationNames: Object = {\r\n Home_Index: \"Home_Index\"\r\n}\r\n\r\nexport interface IAuthOperationModel extends IModel {\r\n authOperationId: number\r\n description: string | undefined\r\n}\r\n\r\nexport class AuthOperationModel extends Model implements IAuthOperationModel {\r\n authOperationId: number;\r\n description: string | undefined;\r\n\r\n constructor(params: Partial) {\r\n super(params);\r\n const {\r\n authOperationId = 0,\r\n description = undefined,\r\n } = params;\r\n\r\n this.authOperationId = authOperationId\r\n this.description = description;\r\n\r\n }\r\n\r\n}\r\n","import { IModel, Model } from \"../Model\";\r\nimport { AuthOperationModel, IAuthOperationModel } from \"./AuthOperationModel\";\r\n\r\nexport interface IAuthRoleModel extends IModel {\r\n authRoleId: number\r\n description: string\r\n systemId: string | null\r\n authApplicationId: number\r\n operations: IAuthOperationModel[] | null\r\n roleAuthOperationName: string;\r\n}\r\n\r\nexport class AuthRoleModel extends Model implements IAuthRoleModel {\r\n authRoleId: number;\r\n description: string;\r\n systemId: string | null;\r\n authApplicationId: number;\r\n operations: IAuthOperationModel[] | null;\r\n roleAuthOperationName: string;\r\n\r\n constructor(params: Partial) {\r\n super(params);\r\n const {\r\n authRoleId = 0,\r\n description = '',\r\n systemId = null,\r\n authApplicationId = 0,\r\n operations = null,\r\n roleAuthOperationName = 'missing'\r\n } = params;\r\n\r\n this.authRoleId = authRoleId;\r\n this.description = description;\r\n this.systemId = systemId;\r\n this.authApplicationId = authApplicationId;\r\n this.roleAuthOperationName = roleAuthOperationName;\r\n\r\n\r\n this.operations = new Array();\r\n if (operations && operations.length) {\r\n operations.forEach(value => {\r\n this.operations!.push(new AuthOperationModel(value));\r\n });\r\n }\r\n }\r\n\r\n}\r\n","export interface IUserModel {\r\n userId: number\r\n authUserId: number\r\n firstName: string | undefined\r\n lastName: string | undefined\r\n emailAddress: string | undefined\r\n objectIdentifier: string | undefined\r\n allowSecurityAdmin: boolean\r\n}\r\n\r\nexport class UserModel implements IUserModel {\r\n userId: number;\r\n authUserId: number;\r\n firstName: string | undefined;\r\n lastName: string | undefined;\r\n emailAddress: string | undefined;\r\n objectIdentifier: string | undefined;\r\n allowSecurityAdmin: boolean;\r\n\r\n constructor(params: Partial) {\r\n const {\r\n userId = 0,\r\n authUserId = 0,\r\n firstName = undefined,\r\n lastName = undefined,\r\n emailAddress = undefined,\r\n objectIdentifier = undefined,\r\n allowSecurityAdmin = false\r\n } = params;\r\n\r\n this.userId = userId;\r\n this.authUserId = authUserId;\r\n this.firstName = firstName;\r\n this.lastName = lastName;\r\n this.emailAddress = emailAddress;\r\n this.objectIdentifier = objectIdentifier;\r\n this.allowSecurityAdmin = allowSecurityAdmin;\r\n }\r\n\r\n}\r\n","import { IModel, Model } from '../Model';\r\nimport { AuthRoleModel, IAuthRoleModel } from './AuthRoleModel';\r\nimport { IUserModel, UserModel as SecurityUserModel } from './UserModel';\r\n\r\nexport interface IAuthUserModel extends IModel {\r\n authUserId: number\r\n authUserName: string | undefined\r\n roles: IAuthRoleModel[]\r\n user: IUserModel\r\n}\r\n\r\nexport class AuthUserModel extends Model implements IAuthUserModel {\r\n authUserId: number;\r\n authUserName: string | undefined;\r\n roles: IAuthRoleModel[];\r\n user: IUserModel;\r\n\r\n constructor(params: Partial) {\r\n super(params);\r\n const {\r\n authUserId = 0,\r\n authUserName = undefined,\r\n roles = [],\r\n user = {}\r\n } = params;\r\n\r\n this.authUserId = authUserId;\r\n this.authUserName = authUserName;\r\n\r\n this.roles = new Array();\r\n if (roles && roles.length && roles.length > 0) {\r\n roles.forEach(value => {\r\n this.roles.push(new AuthRoleModel(value));\r\n });\r\n }\r\n this.user = new SecurityUserModel(user);\r\n }\r\n\r\n}\r\n","export interface IScheduleEntityTypeModel {\r\n scheduleEntityTypeId: number;\r\n scheduleEntityTypeName: string;\r\n sortOrder?: number;\r\n legacyEntityTypeId: number;\r\n businessLineId: number;\r\n isGloballyScheduled: boolean;\r\n}\r\n/**\r\n * This model shows the relation between a ScheduleEntityTypeId and a ScheduleBlockTypeId\r\n * it's used to determine which ScheduleBlockTypes are allowed for a ScheduleEntityType\r\n */\r\nexport class ScheduleEntityTypeModel implements IScheduleEntityTypeModel {\r\n scheduleEntityTypeId: number;\r\n scheduleEntityTypeName: string;\r\n sortOrder?: number;\r\n legacyEntityTypeId: number;\r\n businessLineId: number;\r\n isGloballyScheduled: boolean;\r\n\r\n constructor(model: IScheduleEntityTypeModel) {\r\n this.scheduleEntityTypeId = model.scheduleEntityTypeId;\r\n this.scheduleEntityTypeName = model.scheduleEntityTypeName;\r\n this.sortOrder = model.sortOrder;\r\n this.legacyEntityTypeId = model.legacyEntityTypeId;\r\n this.businessLineId = model.businessLineId;\r\n this.isGloballyScheduled = model.isGloballyScheduled;\r\n }\r\n}\r\n","import { WeekDay } from \"@common/models/Enums\";\r\nimport { defaultTo } from \"lodash\";\r\n\r\n/**\r\n * The backend for Hospital Schedule now returns a common base between all kinds of schedule preferneces, EntitySchedulePreference, OverrideSchedulePreference, DefaultEntitySchedulePreference, and ComputedSchedulePreference\r\n * They all have these fields.\r\n */\r\nexport class BaseEntitySchedulePreference {\r\n schedulePreferenceId: number;\r\n startTime: string;\r\n endTime: string;\r\n dayOfWeek: WeekDay.Day;\r\n scheduleBlockTypeId: number;\r\n scheduleBlockTypeColor: string;\r\n scheduleBlockTypeName: string;\r\n scheduleBlockIsOverrideType: boolean;\r\n\r\n constructor(init?: Partial) {\r\n this.schedulePreferenceId = defaultTo(init?.schedulePreferenceId, 0);\r\n this.startTime = defaultTo(init?.startTime, '08:00:00');\r\n this.endTime = defaultTo(init?.endTime, '21:00:00');\r\n this.dayOfWeek = defaultTo(init?.dayOfWeek, WeekDay.Day.Monday);\r\n this.scheduleBlockTypeId = defaultTo(init?.scheduleBlockTypeId, 0);\r\n this.scheduleBlockTypeColor = defaultTo(init?.scheduleBlockTypeColor, '#8cdef1');\r\n this.scheduleBlockTypeName = defaultTo(init?.scheduleBlockTypeName, 'Unknown');\r\n this.scheduleBlockIsOverrideType = defaultTo(init?.scheduleBlockIsOverrideType, false);\r\n }\r\n}\r\n","import { EntityScheduleType } from \"@common/models/Enums\";\r\nimport { BaseEntitySchedulePreference } from \"@common/models/Schedule/BaseEntitySchedulePreference\";\r\nimport { defaultTo } from 'lodash';\r\n/**\r\n * This class represents the base of Schedule Preferences for both vets and templates for the preferences that are on ProcessHospitalScheduleModel which represent\r\n * the unmodified (unprocessed) schedule preferences. They will be on the base of the ProcessedHospitalScheduleModel and can be used to know what a preference or override was before it got modifed into a ComputedSchedulePreference\r\n * \r\n * recall: there are for schedule preference tables, two for normal preferences, and two for overrides. So this is for normal preferences and the override version of this is for override preferences.\r\n */\r\nexport class EntitySchedulePreference extends BaseEntitySchedulePreference {\r\n entityPreferenceId: number;\r\n entityId: number;\r\n hospitalId: number;\r\n entityType: EntityScheduleType;\r\n uniqueId: string;\r\n rowVersion: string;\r\n\r\n constructor(init: EntitySchedulePreference) {\r\n super(init);\r\n\r\n this.entityPreferenceId = init.entityPreferenceId;\r\n this.entityId = init.entityId;\r\n this.hospitalId = init.hospitalId;\r\n this.entityType = init.entityType;\r\n this.uniqueId = `${this.entityPreferenceId}_${this.entityType}`;\r\n this.rowVersion = defaultTo(init?.rowVersion, '');\r\n }\r\n\r\n\r\n /**\r\n * Instantiate a new default EntitySchedulePreference and optional spread in fields with specific values\r\n * @param init\r\n * @returns \r\n */\r\n static createNewEntitySchedulePreference(init?: Partial): EntitySchedulePreference {\r\n\r\n const fields: EntitySchedulePreference = {\r\n entityPreferenceId: 0,\r\n entityId: 0,\r\n hospitalId: 0,\r\n entityType: EntityScheduleType.Veterinarian,\r\n uniqueId: \"0_0\",\r\n schedulePreferenceId: 0,\r\n startTime: \"00:00:00\",\r\n endTime: \"00:00:00\",\r\n dayOfWeek: 0,\r\n scheduleBlockTypeId: 0,\r\n scheduleBlockTypeName: '',\r\n scheduleBlockTypeColor: '',\r\n scheduleBlockIsOverrideType: false,\r\n rowVersion: ''\r\n };\r\n\r\n const combinedInit: EntitySchedulePreference = {\r\n ...fields,\r\n ...init\r\n }\r\n\r\n return new EntitySchedulePreference(combinedInit);\r\n }\r\n}\r\n","import { EntitySchedulePreference } from \"./EntitySchedulePreference\";\r\n\r\n/**\r\n * A DefaultEntitySchedulePreference represents a schedule preference that was inherited from a hospitals default schedule template\r\n * As such it's entity ID will be for that entity (vet for example, so 0), and the entity preferenceId will be from the preference on the default template\r\n * Since this preference isn't actually from the entity presented by the entityId there are two extra fields here so you know it came from a template, templateId is that template.\r\n * If these fields are present on an entityscheduleprefernece, it was inherited from a default template.\r\n */\r\nexport class DefaultEntitySchedulePreference extends EntitySchedulePreference {\r\n templateId: number;\r\n inheritedFromTemplate: boolean;\r\n\r\n constructor(init: DefaultEntitySchedulePreference) {\r\n super(init);\r\n\r\n this.templateId = init.templateId;\r\n this.inheritedFromTemplate = init.inheritedFromTemplate;\r\n }\r\n}\r\n","import { DateTimeUtils } from \"@common/utils\";\r\nimport { EventInput } from \"@fullcalendar/react\";\r\nimport { DateTime } from \"luxon\";\r\nimport { EntityScheduleOverridePreferenceRequest } from \"@common/models/requests/EntityScheduleOverridePreferenceRequest\";\r\nimport { EntitySchedulePreference } from \"@common/models/Schedule/EntitySchedulePreference\";\r\n\r\nexport interface IEntityOverrideSchedulePreference extends EntitySchedulePreference {\r\n overrideDate: DateTime;\r\n notes: string | undefined;\r\n createdBy: string | undefined;\r\n updatedBy: string | undefined;\r\n dateCreated: string | undefined;\r\n dateUpdated: string | undefined;\r\n}\r\n\r\n/**\r\n * This class represents the base of Schedule Override Preferences for both vets and templates for the preferences that are on ProcessHospitalScheduleModel which represent\r\n * the unmodified (unprocessed) schedule preferences. They will be on the base of the ProcessedHospitalScheduleModel and can be used to know what a preference or override was before it got modifed into a ComputedSchedulePreference\r\n */\r\nexport class EntityOverrideSchedulePreference extends EntitySchedulePreference {\r\n overrideDate: DateTime;\r\n notes: string | undefined;\r\n createdBy: string | undefined;\r\n updatedBy: string | undefined;\r\n dateCreated: string | undefined;\r\n dateUpdated: string | undefined;\r\n\r\n constructor(init: IEntityOverrideSchedulePreference) {\r\n super(init);\r\n\r\n this.overrideDate = DateTimeUtils.getAsDateTimeUTC(init.overrideDate)!;\r\n this.notes = init.notes;\r\n this.createdBy = init.createdBy;\r\n this.updatedBy = init.updatedBy;\r\n this.dateCreated = init.dateCreated;\r\n this.dateUpdated = init.dateUpdated;\r\n }\r\n\r\n /**\r\n * Takes the EntityOverrideSchedulePreference and returns a new calendar event\r\n */\r\n toCalendarEventInput(): EventInput {\r\n return {\r\n id: `${this.entityPreferenceId}_${this.entityType}`,\r\n extendedProps: {\r\n eventType: 'override',\r\n eventColor: this.scheduleBlockTypeColor,\r\n originalEntityId: this.entityId,\r\n originalEntityPreferenceId: this.entityPreferenceId,\r\n override: new EntityScheduleOverridePreferenceRequest({\r\n storeId: this.hospitalId,\r\n schedulePreferenceOverrideId: this.entityPreferenceId,\r\n entityId: this.entityId,\r\n entityType: this.entityType,\r\n schedulePreferenceId: this.schedulePreferenceId,\r\n scheduleBlockTypeId: this.scheduleBlockTypeId,\r\n startTime: this.startTime,\r\n endTime: this.endTime,\r\n dayOfWeek: this.dayOfWeek,\r\n overrideDate: this.overrideDate.toISO(),\r\n notes: this.notes,\r\n createdBy: this.createdBy,\r\n updatedBy: this.updatedBy,\r\n dateCreated: this.dateCreated,\r\n dateUpdated: this.dateUpdated,\r\n }),\r\n },\r\n resourceId: this.entityId + \"_\" + this.entityType,\r\n title: this.scheduleBlockTypeName,\r\n allDay: false,\r\n textColor: \"#FFF\",\r\n editable: true,\r\n startEditable: true,\r\n resourceEditable: true,\r\n backgroundColor: `${this.scheduleBlockTypeColor}`,\r\n className: \"appointmentEvent\",\r\n borderColor: \"#FFF\",\r\n start: `${this.overrideDate.toFormat('yyyy-LL-dd')}T${this.startTime}`,\r\n end: `${this.overrideDate.toFormat('yyyy-LL-dd')}T${this.endTime}`\r\n };\r\n }\r\n}\r\n","import { EntityScheduleType } from \"@common/models/Enums\";\r\nimport { BaseEntitySchedulePreference } from \"./BaseEntitySchedulePreference\";\r\nimport { DateTime } from \"luxon\";\r\nimport { DateTimeUtils } from \"@common/utils/datetimeUtils\";\r\n\r\n/**\r\n * Represents a Schedule Preference that have may have been modified via processing logic in the HospitalScheduleModelFactory\r\n * ComputedSchedulePreferences are now how background events on the calendar are generated. The computed preferences are the\r\n * result of the final preferences for an entity (vet or template) after having applied overrides, default preferences, etc.\r\n */\r\nexport class ComputedSchedulePreference extends BaseEntitySchedulePreference {\r\n hospitalId: number;\r\n uniqueId: string;\r\n entityPreferenceId: number;\r\n entityType: EntityScheduleType;\r\n entityId: number;\r\n isOverride: boolean;\r\n overrideNotes?: string | null;\r\n overrideDate?: DateTime | null;\r\n inheritedFromTemplate: boolean;\r\n inheritedTemplateId: number | undefined;\r\n\r\n\r\n\r\n constructor(init?: Partial) {\r\n super(init);\r\n this.hospitalId = _.defaultTo(init?.hospitalId, 0);\r\n this.uniqueId = _.defaultTo(init?.uniqueId, '');\r\n this.entityPreferenceId = _.defaultTo(init?.entityPreferenceId, 0);\r\n this.entityType = _.defaultTo(init?.entityType, EntityScheduleType.Veterinarian);\r\n this.entityId = _.defaultTo(init?.entityId, 0);\r\n this.isOverride = _.defaultTo(init?.isOverride, false);\r\n this.overrideNotes = _.defaultTo(init?.overrideNotes, null);\r\n this.overrideDate = DateTimeUtils.getAsDateTimeUTC(init?.overrideDate);\r\n this.inheritedFromTemplate = _.defaultTo(init?.inheritedFromTemplate, false);\r\n this.inheritedTemplateId = _.defaultTo(init?.inheritedTemplateId, undefined);\r\n }\r\n}\r\n","import { HospitalScheduleTemplateListingModel } from \"../HospitalScheduleTemplateListingModel\";\r\n\r\n/**\r\n * An extension on the original HospitalScheduleTemplateListingModel that is used just for GetHospitalSchedule requests and includes whether the template\r\n * is on a schedule or not. False means it's not on any requested hospital schedule in the request, true means it's scheduled.\r\n * Because templates are unique to hospitals this means if it's true it means it's scheduled at that hospital. This prevents needing to do deep lookups in scheduledEntities to look for it\r\n * since the templates are returned on the root of the ProcessHospitalScheduleModel\r\n */\r\nexport class ScheduleHospitalScheduleTemplateListingModel extends HospitalScheduleTemplateListingModel {\r\n isScheduled: boolean;\r\n\r\n constructor(init: ScheduleHospitalScheduleTemplateListingModel) {\r\n super(init);\r\n this.isScheduled = init.isScheduled ? true : false;\r\n }\r\n}\r\n","import { StringUtility } from \"@common/utils\";\r\nimport { IModel, ModelRecord } from \"@common/models\";\r\nimport { defaultTo } from \"lodash\";\r\n\r\nexport interface IHospitalScheduleTemplateListingModel extends IModel {\r\n hospitalScheduleTemplateId: number,\r\n hospitalId: number,\r\n name: string,\r\n isDefault: boolean,\r\n isActive: boolean;\r\n color: string | undefined,\r\n hasSchedulePreferences: boolean,\r\n schedulePreferenceCount: number\r\n}\r\n\r\nexport class HospitalScheduleTemplateListingModel implements ModelRecord {\r\n rowVersion: string\r\n hospitalScheduleTemplateId: number;\r\n hospitalId: number;\r\n name: string;\r\n isDefault: boolean;\r\n isActive: boolean;\r\n color: string | undefined;\r\n hasSchedulePreferences: boolean;\r\n schedulePreferenceCount: number;\r\n\r\n\r\n constructor(init: IHospitalScheduleTemplateListingModel) {\r\n this.rowVersion = defaultTo(init.rowVersion, '');\r\n this.hospitalScheduleTemplateId = defaultTo(init.hospitalScheduleTemplateId, 0);\r\n this.hospitalId = defaultTo(init.hospitalId, 0);\r\n this.name = init.name;\r\n this.color = StringUtility.SanitizeString(init.color ?? '#2596be');\r\n this.isActive = defaultTo(init.isActive, false);\r\n this.isDefault = defaultTo(init.isDefault, false);\r\n this.hasSchedulePreferences = defaultTo(init.hasSchedulePreferences, false);\r\n this.schedulePreferenceCount = defaultTo(init.schedulePreferenceCount, 0);\r\n }\r\n}\r\n","import { DateTimeUtils } from \"@common/utils\";\r\nimport { defaultTo, first } from \"lodash\";\r\nimport { DateTime } from \"luxon\";\r\nimport { EntityScheduleType, WeekDay } from \"../Enums\";\r\nimport { Model } from \"../Model\";\r\nimport { ComputedSchedulePreference, ProcessedHospitalScheduleModel } from \".\";\r\nimport { HospitalScheduleRequestModel } from \"../requests\";\r\nimport { schedule } from \"..\";\r\nimport { petcoPewterBlue } from \"@common/_assets/color-constants.js\";\r\n\r\n\r\n\r\n/**\r\n * A generic combined class for a schedule vet or template on a given day at a hospital. entityId will be either vet id or template id, and entityType determines whether it's a vet or a template.\r\n * The unique id is a calculated field that you should use if you need an ID from this type, because vet's and templates could have conflicting id's, the uniqueId is the entityId_entityTypeId, \r\n * i.e. 3146_0 which would be for a vet, because 0 is the type id for a vet. Use this id for calendar events etc to prevent having events with duplicate ids. Also use it for resource columns\r\n * to prevent resources from conflicting and causing events to render wrong or disappear.\r\n */\r\nexport class HospitalScheduleDayEntityModel extends Model {\r\n hospitalScheduleId: number;\r\n hospitalId: number;\r\n day: DateTime;\r\n entityType: EntityScheduleType;\r\n entityId: number;\r\n isGloballyScheduled: boolean;\r\n sortOrder: number;\r\n isAdhoc: boolean;\r\n entityName: string | undefined;\r\n schedulingColor: string | undefined;\r\n computedSchedulePreferences: ComputedSchedulePreference[];\r\n hasSchedulePreferences: boolean;\r\n hasInheritedSchedulePreferences: boolean;\r\n defaultScheduleTemplateId: number | undefined;\r\n entityTitle: string;\r\n isActive: boolean\r\n\r\n constructor(init?: Partial) {\r\n super(init);\r\n this.hospitalScheduleId = defaultTo(init?.hospitalScheduleId, 0);\r\n this.hospitalId = defaultTo(init?.hospitalId, 0);\r\n this.day = DateTimeUtils.getAsDateTimeUTC(init?.day ? init?.day : DateTime.utc())!;\r\n this.entityType = defaultTo(init?.entityType, EntityScheduleType.Veterinarian);\r\n this.entityId = defaultTo(init?.entityId, 0);\r\n this.isGloballyScheduled = defaultTo(init?.isGloballyScheduled, false);\r\n this.sortOrder = defaultTo(init?.sortOrder, 0);\r\n this.isAdhoc = defaultTo(init?.isAdhoc, false);\r\n this.entityName = defaultTo(init?.entityName, undefined);\r\n this.schedulingColor = defaultTo(init?.schedulingColor, petcoPewterBlue);\r\n this.computedSchedulePreferences = init?.computedSchedulePreferences?.map(cp => new ComputedSchedulePreference(cp)) ?? [] as ComputedSchedulePreference[];\r\n this.hasSchedulePreferences = defaultTo(init?.hasSchedulePreferences, false);\r\n this.hasInheritedSchedulePreferences = defaultTo(init?.hasInheritedSchedulePreferences, false);\r\n this.defaultScheduleTemplateId = defaultTo(init?.defaultScheduleTemplateId, undefined);\r\n this.entityTitle = defaultTo(init?.entityTitle, '');\r\n this.isActive = defaultTo(init?.isActive, false)\r\n }\r\n\r\n get uniqueId() {\r\n return `${this.entityId.toString()}_${this.entityType.toString()}`;\r\n }\r\n\r\n getStringWhenEntityType(strings?: { vet?: string | undefined, template?: string | undefined }): string | undefined {\r\n switch (this.entityType) {\r\n case EntityScheduleType.Veterinarian:\r\n return strings?.vet ?? undefined;\r\n case EntityScheduleType.Template:\r\n return strings?.template ?? undefined;\r\n case EntityScheduleType.Technician:\r\n return 'Technician';\r\n case EntityScheduleType.Unassigned:\r\n return 'Unassigned';\r\n default:\r\n break;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Converts the HospitalScheduleEntityModel to a HospitalScheduleRequestModel and returns it. This handles, based on EntityType, whether vet or template id should be set on the request model.\r\n * @returns \r\n */\r\n toRequestModel() {\r\n return new HospitalScheduleRequestModel({\r\n hospitalScheduleId: this.hospitalScheduleId,\r\n veterinarianId: this.entityType === EntityScheduleType.Veterinarian ? this.entityId : undefined,\r\n hospitalScheduleTemplateId: this.entityType === EntityScheduleType.Template ? this.entityId : undefined,\r\n hospitalId: this.hospitalId,\r\n date: this.day.toISO(),\r\n rowVersion: this.rowVersion\r\n });\r\n }\r\n\r\n /**\r\n * Create a new HospitalScheduleEntityModel from a vet or a template and set the appropriate entity type, id, and schedulingColor fields for the entity. Also determines the hasSchedulePreferences and hasInheritedSchedulePreferences \r\n * values based on the ProcessedHospitalSchedule supplied\r\n * @param entity \r\n * @param overrides \r\n * @returns \r\n */\r\n static createNewScheduleEntityFromEntity(hospitalId: number, processedSchedule: ProcessedHospitalScheduleModel, entity: T, overrides?: Partial, checkDate?: DateTime | undefined) {\r\n const base = new HospitalScheduleDayEntityModel({\r\n hospitalScheduleId: 0,\r\n rowVersion: '',\r\n isAdhoc: false,\r\n });\r\n\r\n var defaultTemplate = first(processedSchedule.getTemplates(hospitalId, { isDefault: true }));\r\n\r\n //entity is vet\r\n if ('veterinarianId' in entity) {\r\n const vet = entity as schedule.HospitalScheduleVeterinarianModel;\r\n base.entityType = EntityScheduleType.Veterinarian;\r\n base.entityId = vet.veterinarianId;\r\n base.entityName = vet.fullName;\r\n base.entityTitle = vet.titleFullName;\r\n base.schedulingColor = vet.schedulingColor;\r\n base.defaultScheduleTemplateId = defaultTemplate?.hospitalScheduleTemplateId;\r\n base.isActive = vet.isActive();\r\n }\r\n\r\n //entity is template\r\n if ('hospitalScheduleTemplateId' in entity) {\r\n const template = entity as schedule.ScheduleHospitalScheduleTemplateListingModel;\r\n base.entityType = EntityScheduleType.Template;\r\n base.entityId = template.hospitalScheduleTemplateId;\r\n base.entityName = template.name;\r\n base.entityTitle = template.name;\r\n base.schedulingColor = template.color;\r\n base.isActive = template.isActive;\r\n }\r\n\r\n const ret = new HospitalScheduleDayEntityModel({\r\n ...base,\r\n ...overrides\r\n });\r\n\r\n HospitalScheduleDayEntityModel.updateEntityPreferenceFields(processedSchedule, ret, checkDate);\r\n return ret;\r\n }\r\n\r\n static updateEntityPreferenceFields(processedSchedule: ProcessedHospitalScheduleModel, entity: HospitalScheduleDayEntityModel, checkDate: DateTime | undefined) {\r\n const day = checkDate !== undefined ? WeekDay.fromDateTime(checkDate) : WeekDay.fromDateTime(entity.day);\r\n const preferenceCount = processedSchedule.entitySchedulePreferences.filter(p => p.entityType === entity.entityType && p.entityId === entity.entityId && (checkDate === undefined || day === p.dayOfWeek)).length;\r\n let inheritedCount = 0;\r\n\r\n if (preferenceCount <= 0) {\r\n const defaultTemplate = first(processedSchedule.getTemplates(entity.hospitalId, { day: entity.day, isDefault: true }));\r\n if (defaultTemplate) {\r\n inheritedCount = processedSchedule.entitySchedulePreferences.filter(p => p.entityType === EntityScheduleType.Template && p.entityId === defaultTemplate.hospitalScheduleTemplateId && (checkDate === undefined || day === p.dayOfWeek)).length;\r\n }\r\n }\r\n\r\n entity.hasSchedulePreferences = preferenceCount > 0;\r\n entity.hasInheritedSchedulePreferences = inheritedCount > 0;\r\n }\r\n}\r\n","import { DateTimeUtils } from \"@common/utils\";\r\nimport { defaultTo } from \"lodash\";\r\nimport { DateTime } from \"luxon\";\r\nimport { HospitalScheduleDayEntityModel } from \"./HospitalScheduleDayEntityModel\";\r\n\r\n/**\r\n * This is a wrapper for a single schedule day. Instead of a record for each vet/template for each day, the new schedule end point returns 1 schedule for each day in the requested range, and the scheduled entities for that day\r\n * and each of those scheduled entities could be a template or a vet and can have computed schedule preferences.\r\n * This will be for a hospitalId requested to the new schedule end point and the open/close time of that hospital for the day on this model is included.\r\n */\r\nexport class HospitalScheduleDayModel {\r\n hospitalId: number;\r\n day: DateTime;\r\n openTime: string;\r\n closeTime: string;\r\n isOpen: boolean;\r\n scheduledEntities: HospitalScheduleDayEntityModel[]\r\n\r\n constructor(init?: Partial) {\r\n this.hospitalId = defaultTo(init?.hospitalId, 0);\r\n this.day = DateTimeUtils.getAsDateTimeUTC(init?.day ?? DateTime.utc())!;\r\n this.openTime = defaultTo(init?.openTime, '08:00:00');\r\n this.closeTime = defaultTo(init?.closeTime, '21:00:00');\r\n this.isOpen = defaultTo(init?.isOpen, false);\r\n this.scheduledEntities = init?.scheduledEntities?.map(e => new HospitalScheduleDayEntityModel(e)) ?? [] as HospitalScheduleDayEntityModel[];\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { HospitalScheduleDayModel } from \"./HospitalScheduleDayModel\";\r\n\r\n/**\r\n * This model exists to wrap a hospital schedule for a hospital id and unflatten the schedule days into a schedule array of HospitalScheduleDayModel's\r\n */\r\nexport class HospitalScheduleWrapperModel {\r\n hospitalId: number;\r\n schedule: HospitalScheduleDayModel[]\r\n\r\n constructor(init?: Partial) {\r\n this.hospitalId = defaultTo(init?.hospitalId, 0);\r\n this.schedule = init?.schedule?.map(s => new HospitalScheduleDayModel(s)) ?? [] as HospitalScheduleDayModel[];\r\n }\r\n}\r\n","import { DateTimeUtils } from \"@common/utils\";\r\nimport { DateTime } from \"luxon\";\r\nimport { VeterinarianListingModel } from '../';\r\nimport {\r\n DefaultEntitySchedulePreference, HospitalScheduleDayModel, HospitalScheduleDayEntityModel, HospitalScheduleVeterinarianModel, HospitalScheduleVetTechModel, ScheduleHospitalScheduleTemplateListingModel,\r\n EntityOverrideSchedulePreference, EntitySchedulePreference, ScheduleEntityTypeModel\r\n} from './';\r\nimport { HospitalScheduleWrapperModel } from \"./HospitalScheduleWrapperModel\";\r\nimport { EntityScheduleType, WeekDay } from \"../Enums\";\r\nimport { first, flatMap, some } from \"lodash\";\r\n\r\n/**\r\n * The outermost model for GetHospitalSchedule, which contains (or will contain) the entire payload for a schedule request\r\n */\r\nexport class ProcessedHospitalScheduleModel {\r\n /**\r\n * The start date for the requested schedule range\r\n */\r\n startDate: DateTime;\r\n /**\r\n * The end date for the requested schedule range\r\n */\r\n endDate: DateTime;\r\n /**\r\n * The Veterinarian Listing Model's for any vets on the schedule for the requested date range, or that have access to any hospitals the schedule was requested for. \r\n * If a vet isn't scheduled and doesn't have access to one of the requested hospitals, they won't be in this list.\r\n */\r\n veterinarians: HospitalScheduleVeterinarianModel[];\r\n /**\r\n * The Veterinarian Listing Model's for any vets on the schedule for the requested date range, or that have access to any hospitals the schedule was requested for. \r\n * If a vet isn't scheduled and doesn't have access to one of the requested hospitals, they won't be in this list.\r\n */\r\n vetTechs: HospitalScheduleVetTechModel[];\r\n /**\r\n * The templates scheduled at any hospitals the schedule was requested for. \r\n * Also, default templates for hospitals the schedule was requested for are included here whether they were scheduled or not. \r\n * This is so we have the default schedule preferences to give to vets that don't have any. \r\n */\r\n templates: ScheduleHospitalScheduleTemplateListingModel[];\r\n\r\n\r\n /**\r\n * A schedule wrapper for each hospital the schedule was requested for. If only 1 hospital was requested there will only be 1 entry in this array.\r\n */\r\n hospitalSchedules: HospitalScheduleWrapperModel[];\r\n /**\r\n * The combined, unprocessed (non computed) vet and schedule template schedule preferences, use entityType to tell the difference.\r\n * These are needed for show overrides, and future initiatives to remove schedule v1 and redundant preference calls in the app \r\n */\r\n entitySchedulePreferences: EntitySchedulePreference[];\r\n /**\r\n * The combined, unprocessed (non computed) vet and schedule template override schedule preferences.\r\n */\r\n entityOverrideSchedulePreferences: EntityOverrideSchedulePreference[];\r\n\r\n constructor(init?: Partial) {\r\n this.startDate = DateTimeUtils.getAsDateTimeUTC(init?.startDate ?? DateTime.utc())!;\r\n this.endDate = DateTimeUtils.getAsDateTimeUTC(init?.endDate ?? DateTime.utc())!;\r\n this.veterinarians = init?.veterinarians?.map(sv => new HospitalScheduleVeterinarianModel(sv)) ?? [] as HospitalScheduleVeterinarianModel[];\r\n this.vetTechs = init?.vetTechs?.map(sv => new HospitalScheduleVetTechModel(sv)) ?? [] as HospitalScheduleVetTechModel[];\r\n\r\n this.templates = init?.templates?.map(t => new ScheduleHospitalScheduleTemplateListingModel(t)) ?? [] as ScheduleHospitalScheduleTemplateListingModel[];\r\n this.hospitalSchedules = init?.hospitalSchedules?.map(t => new HospitalScheduleWrapperModel(t)) ?? [new HospitalScheduleWrapperModel({ hospitalId: 0, schedule: [new HospitalScheduleDayModel()] })] as HospitalScheduleWrapperModel[];\r\n\r\n //unprocessed preferences (does not include preferences for adhoc vets/templates unless @includeAdHocPreferences is 1 to the stored procedure, not currently implemented as it's not needed as of now)\r\n this.entitySchedulePreferences = init?.entitySchedulePreferences?.map(t => new EntitySchedulePreference(t)) ?? [] as EntitySchedulePreference[];\r\n this.entityOverrideSchedulePreferences = init?.entityOverrideSchedulePreferences?.map(t => new EntityOverrideSchedulePreference(t)) ?? [] as EntityOverrideSchedulePreference[];\r\n }\r\n\r\n /**\r\n * Will grab the vet listing model or scheduleHospitalScheduleTemplateListingModel for the supplied entity, if it's a vet entity vet model, if it's a template entity, template model, cast the result as needed\r\n * @param entity \r\n * @returns \r\n */\r\n getScheduledEntity(entity: HospitalScheduleDayEntityModel): VeterinarianListingModel | ScheduleHospitalScheduleTemplateListingModel | ScheduleEntityTypeModel | undefined {\r\n switch (entity.entityType) {\r\n case EntityScheduleType.Template:\r\n return first(this.templates.filter(t => t.hospitalScheduleTemplateId === entity.entityId));\r\n case EntityScheduleType.Veterinarian:\r\n return first(this.veterinarians.filter(t => t.veterinarianId === entity.entityId));\r\n case EntityScheduleType.Technician:\r\n return new ScheduleEntityTypeModel({\r\n scheduleEntityTypeId: 400,\r\n scheduleEntityTypeName: 'Technician',\r\n legacyEntityTypeId: 400,\r\n businessLineId: 3,\r\n isGloballyScheduled: true\r\n });\r\n case EntityScheduleType.Unassigned:\r\n return new ScheduleEntityTypeModel({\r\n scheduleEntityTypeId: 200,\r\n scheduleEntityTypeName: 'Unassigned',\r\n legacyEntityTypeId: 200,\r\n businessLineId: 3,\r\n isGloballyScheduled: true\r\n });\r\n default:\r\n return undefined;\r\n }\r\n }\r\n\r\n getScheduleEntitiesForAllDays(hospitalId: number) {\r\n\r\n return flatMap(this.hospitalSchedules.filter(h => h.hospitalId === hospitalId), h => flatMap(h.schedule, s => s.scheduledEntities));\r\n }\r\n\r\n /**\r\n * Returns all the veterinarians for the specified options from the schedule payload. Available veterinarians are vets that are on at least 1 schedule entry, and or have access to the requested hospital or hospitals.\r\n * @param hospitalId The id of the hospital to filter vets down to.\r\n * @param options Options that further filter the vets being returned, day is special, if you leave it undefined it'll assume you don't know the day yet (not loaded, or doesn't have a schedule that day) so it'll cause isScheduled to always return no vets if it's undefined.\r\n * isScheduled undefined means vets are included regardless of whether they are scheduled or not. true (only scheduled vets), false (only unscheduled vets)\r\n * hasAccess undefined means vets are included regardless of whether they have access to the requested hospital, true (only vets that have access), false (only vets that don't have access)\r\n * @returns \r\n */\r\n getVeterinarians(hospitalId: number, options: { day?: DateTime | string | undefined, isAdhoc?: boolean | undefined, isScheduled?: boolean | undefined, hasLicense?: boolean | undefined, hasAccess?: boolean | undefined }) {\r\n const lday = options?.day\r\n ? typeof (options?.day) === 'string'\r\n ? DateTime.fromISO(options?.day, { zone: 'UTC' }).startOf('day')\r\n : options?.day.startOf('day')\r\n : DateTime.utc().startOf('day');\r\n\r\n const hospitalSchedule = first(this.hospitalSchedules.filter(h => h.hospitalId == hospitalId));\r\n const hospitalScheduleDays = hospitalSchedule?.schedule.filter(s => {\r\n return lday.toISO() === s.day.startOf('day').toISO()\r\n }) ?? [];\r\n const totalScheduledEntities: HospitalScheduleDayEntityModel[] = [];\r\n hospitalScheduleDays.forEach(scheduleDay => {\r\n scheduleDay.scheduledEntities.filter(\r\n e => e.entityType === EntityScheduleType.Veterinarian\r\n )\r\n .forEach(day => totalScheduledEntities.push(day))\r\n });\r\n\r\n if (!options?.day && options?.isScheduled)\r\n throw 'Unable to filter vets to only sheduled templates because no day was specified. When filtering on scheduled you must specify an options day.';\r\n\r\n return this.veterinarians.filter(v => {\r\n let includeOnScheduled = () => (options?.isScheduled == null || some(totalScheduledEntities, tse => tse.entityId === v.veterinarianId) === options.isScheduled);\r\n let includeOnLicense = () => (options?.hasLicense == null || v.isLicensed(hospitalId));\r\n let includeOnAccess = () => (options?.hasAccess == null || v.hasAccess(hospitalId))\r\n let includeOnAdHoc = () => (options?.isAdhoc == null || some(totalScheduledEntities, tse => tse.entityId === v.veterinarianId && tse.isAdhoc === options.isAdhoc));\r\n let activeOnly = () => (v.employmentStatus === 'A')\r\n return includeOnScheduled() && includeOnLicense() && includeOnAccess() && includeOnAdHoc() && activeOnly();\r\n });\r\n }\r\n\r\n /**\r\n * Returns all the templates for the specified options from the schedule payload. You can filter down with options to include only default or non default templates, active or non active templates, etc.\r\n * Undefined options mean the otions are ignored and don't affect the result.\r\n * @param hospitalId \r\n * @param options \r\n * @returns \r\n */\r\n getTemplates(hospitalId: number, options: { day?: DateTime | string | undefined, isScheduled?: boolean | undefined, isActive?: boolean | undefined, isDefault?: boolean | undefined }) {\r\n const lday = options?.day ? typeof (options?.day) === 'string' ? DateTime.fromISO(options?.day, { zone: 'UTC' }).startOf('day') : options?.day.startOf('day') : DateTime.utc().startOf('day');\r\n const hospitalSchedule = first(this.hospitalSchedules.filter(h => h.hospitalId == hospitalId));\r\n const hospitalScheduleDays = hospitalSchedule?.schedule.filter(s => lday.toISO() === s.day.startOf('day').toISO()) ?? [];\r\n const totalScheduledEntities: HospitalScheduleDayEntityModel[] = [];\r\n hospitalScheduleDays.forEach(scheduleDay => {\r\n scheduleDay.scheduledEntities.filter(\r\n e => e.entityType === EntityScheduleType.Template\r\n )\r\n .forEach(day => totalScheduledEntities.push(day));\r\n });\r\n if (!options?.day && options?.isScheduled) {\r\n throw 'Unable to filter templates to only sheduled templates because no day was specified. When filtering on scheduled you must specify an options day.';\r\n }\r\n\r\n return this.templates.filter(t =>\r\n (options?.isScheduled == null || some(totalScheduledEntities, tse => tse.entityId === t.hospitalScheduleTemplateId) === options.isScheduled)\r\n && (options?.isDefault == null || t.isDefault === options?.isDefault)\r\n && (options?.isActive == null || t.isActive === options?.isActive));\r\n }\r\n\r\n /**\r\n * Takes a schedule entity which might be for a vet or a template, and gets copies of all the default schedule preferences from the EntitySchedulePreferences array\r\n * also modifies the schedule preferences entity id to point at the passed in entity instead of the original template id. This is used to render\r\n * default schedule preferences for vets on scheduling calendar modals.\r\n * The preferences for the default template are already in the base payload, so we look them up in it to prevent redundantly nesting the json data in the response.\r\n * @param entity \r\n * @returns \r\n */\r\n createDefaultEntitySchedulePreferences(entity: HospitalScheduleDayEntityModel, dayOfWeek?: WeekDay.Day | undefined) {\r\n if (entity.defaultScheduleTemplateId == null)\r\n return [] as EntitySchedulePreference[];\r\n return this.entitySchedulePreferences.filter(p => p.entityType === EntityScheduleType.Template && p.entityId === entity.defaultScheduleTemplateId && (dayOfWeek == null || dayOfWeek == p.dayOfWeek))\r\n .map(p => {\r\n return new DefaultEntitySchedulePreference({ ...p as DefaultEntitySchedulePreference, entityId: entity.entityId, entityType: EntityScheduleType.Veterinarian, inheritedFromTemplate: true, templateId: entity.defaultScheduleTemplateId! })\r\n });\r\n }\r\n\r\n getEntitySchedulePreferences(entity: HospitalScheduleDayEntityModel, dayOfWeek?: WeekDay.Day | undefined) {\r\n if (!entity.hasSchedulePreferences)\r\n return entity.hasInheritedSchedulePreferences && entity.defaultScheduleTemplateId != null ? this.createDefaultEntitySchedulePreferences(entity, dayOfWeek) : [] as EntitySchedulePreference[];\r\n return this.entitySchedulePreferences.filter(p => p.entityType === entity.entityType && p.entityId === entity.entityId && (dayOfWeek == null || dayOfWeek === p.dayOfWeek));\r\n }\r\n\r\n getFirstScheduleDay(hospitalId: number) {\r\n return first(first(this.hospitalSchedules.filter(h => h.hospitalId === hospitalId))?.schedule);\r\n }\r\n\r\n static getDefault() {\r\n const daySchedule = new HospitalScheduleDayModel({ hospitalId: 0 });\r\n const wrapper = new HospitalScheduleWrapperModel({ hospitalId: 0, schedule: [daySchedule] });\r\n return new ProcessedHospitalScheduleModel({\r\n hospitalSchedules: [wrapper]\r\n });\r\n }\r\n}\r\n","import { some } from \"lodash\";\r\nimport { VeterinarianListingModel } from \"../VeterinarianListingModel\";\r\n\r\n/**\r\n * This is a hospital schedule specific veterinarian model that extends the new VeterinarianListingModel, a lighter weight vet model\r\n * It is returned by the new hospital schedule end point. Whether the vet has a DVM license for a hospital state or has access to the hospital\r\n * can be determined here. But note, the activeDVMLicenseHospitalIds and accessibleHospitalIds are populated by getHospitalSchedule's response payload only for the requested hospitals on the request.\r\n * I.e. if you only request the schedule for hospital id 1205, you'll only have license and access info for hospital 1205, that's because vet's are only included if they're on the schedule for hospital 1205 or have access to hospital 1205.\r\n */\r\nexport class HospitalScheduleVeterinarianModel extends VeterinarianListingModel {\r\n activeDVMLicenseHospitalIds: number[];\r\n accessibleHospitalIds: number[];\r\n\r\n constructor(init?: Partial) {\r\n super(init);\r\n this.activeDVMLicenseHospitalIds = init?.activeDVMLicenseHospitalIds?.map(id => id) ?? [] as number[];\r\n this.accessibleHospitalIds = init?.accessibleHospitalIds?.map(id => id) ?? [] as number[];\r\n }\r\n\r\n isLicensed(hospitalId: number) {\r\n return some(this.activeDVMLicenseHospitalIds.filter(l => l === hospitalId));\r\n }\r\n\r\n hasAccess(hospitalId: number) {\r\n return some(this.accessibleHospitalIds.filter(l => l === hospitalId));\r\n }\r\n\r\n isActive = () => this.employmentStatus === 'A'\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { petcoPewterBlue } from \"@common/_assets/color-constants.js\";\r\n\r\n/**\r\n * Introduced for GetHospitalSchedule, a light weight vet listing model with no sub types on it. This\r\n * is returned from GetHospitalSchedule on ProcessedHospitalScheduleModel\r\n */\r\nexport class VeterinarianListingModel {\r\n veterinarianId: number;\r\n title: string | undefined;\r\n firstName: string;\r\n lastName: string;\r\n email: string;\r\n username: string;\r\n fullName: string;\r\n schedulingColor: string | undefined;\r\n sourceSystemKey: string | undefined;\r\n titleFullName: string;\r\n employmentStatus: string;\r\n\r\n constructor(init?: Partial) {\r\n this.veterinarianId = defaultTo(init?.veterinarianId, 0);\r\n this.title = defaultTo(init?.title, undefined);\r\n this.firstName = defaultTo(init?.firstName, '');\r\n this.lastName = defaultTo(init?.lastName, '');\r\n this.email = defaultTo(init?.email, '');\r\n this.username = defaultTo(init?.username, '');\r\n this.fullName = defaultTo(init?.fullName, '');\r\n this.titleFullName = defaultTo(init?.titleFullName, '');\r\n this.schedulingColor = defaultTo(init?.schedulingColor, petcoPewterBlue);\r\n this.employmentStatus = defaultTo(init?.employmentStatus, '')\r\n }\r\n}\r\n","import { IModel, Model } from \"./Model\";\r\n\r\nexport interface IUserListingModel extends IModel {\r\n userId: number;\r\n firstName: string;\r\n lastName: string;\r\n emailAddress: string;\r\n objectIdentifier: string;\r\n allowSecurityAdmin: boolean;\r\n roleCount: number;\r\n featureFlagCount: number;\r\n organizationCount: number;\r\n organizationRelationKey: string;\r\n roles: string;\r\n organizations: string;\r\n isProfileActive: boolean;\r\n}\r\n\r\nexport class UserListingModel extends Model implements IUserListingModel {\r\n userId: number;\r\n firstName: string;\r\n lastName: string;\r\n emailAddress: string;\r\n objectIdentifier: string;\r\n allowSecurityAdmin: boolean;\r\n roleCount: number;\r\n featureFlagCount: number;\r\n organizationCount: number;\r\n organizationRelationKey: string;\r\n roles: string;\r\n organizations: string;\r\n isProfileActive: boolean;\r\n\r\n constructor(params: Partial) {\r\n super(params);\r\n const {\r\n userId = 0,\r\n firstName = '',\r\n lastName = '',\r\n emailAddress = '',\r\n objectIdentifier = '',\r\n allowSecurityAdmin = false,\r\n roleCount = 0,\r\n featureFlagCount = 0,\r\n organizationCount = 0,\r\n organizationRelationKey = '',\r\n roles = '',\r\n organizations = '',\r\n isProfileActive = false\r\n } = params;\r\n\r\n this.userId = userId;\r\n this.firstName = firstName;\r\n this.lastName = lastName;\r\n this.emailAddress = emailAddress;\r\n this.objectIdentifier = objectIdentifier;\r\n this.allowSecurityAdmin = allowSecurityAdmin;\r\n this.roleCount = roleCount;\r\n this.featureFlagCount = featureFlagCount;\r\n this.organizationCount = organizationCount;\r\n this.organizationRelationKey = organizationRelationKey;\r\n this.roles = roles;\r\n this.organizations = organizations;\r\n this.isProfileActive = isProfileActive;\r\n }\r\n\r\n}\r\n","import { UserListingModel } from \"../UserListingModel\";\r\n\r\n/**\r\n * This is a hospital schedule specific veterinarian model that extends the new VeterinarianListingModel, a lighter weight vet model\r\n * It is returned by the new hospital schedule end point. Whether the vet has a DVM license for a hospital state or has access to the hospital\r\n * can be determined here. But note, the activeDVMLicenseHospitalIds and accessibleHospitalIds are populated by getHospitalSchedule's response payload only for the requested hospitals on the request.\r\n * I.e. if you only request the schedule for hospital id 1205, you'll only have license and access info for hospital 1205, that's because vet's are only included if they're on the schedule for hospital 1205 or have access to hospital 1205.\r\n */\r\nexport class HospitalScheduleVetTechModel extends UserListingModel {\r\n accessibleHospitalIds: number[];\r\n\r\n constructor(init: Partial) {\r\n super(init);\r\n this.accessibleHospitalIds = init?.accessibleHospitalIds?.map(id => id) ?? [] as number[];\r\n }\r\n\r\n}\r\n","import { ScheduleBlockType } from \"../Enums\";\r\n\r\nexport interface IScheduleEntityBlockTypeModel {\r\n scheduleEntityBlockTypeId: number;\r\n scheduleEntityTypeId: number;\r\n scheduleBlockTypeId: ScheduleBlockType;\r\n}\r\n/**\r\n * This model shows the relation between a ScheduleEntityTypeId and a ScheduleBlockTypeId\r\n * it's used to determine which ScheduleBlockTypes are allowed for a ScheduleEntityType\r\n */\r\nexport class ScheduleEntityBlockTypeModel implements IScheduleEntityBlockTypeModel {\r\n scheduleEntityBlockTypeId: number;\r\n scheduleEntityTypeId: number;\r\n scheduleBlockTypeId: ScheduleBlockType;\r\n\r\n constructor(model: IScheduleEntityBlockTypeModel) {\r\n this.scheduleEntityBlockTypeId = model.scheduleEntityBlockTypeId;\r\n this.scheduleEntityTypeId = model.scheduleEntityTypeId;\r\n this.scheduleBlockTypeId = model.scheduleBlockTypeId;\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model, ModelRecord } from \"./Model\";\r\n\r\nexport interface IAdditionalInfoLabelModel extends IModel {\r\n additionalInfoLabelId: number;\r\n name: string;\r\n information: string;\r\n}\r\n\r\nexport class AdditionalInfoLabelModel extends Model implements ModelRecord {\r\n additionalInfoLabelId: number;\r\n name: string;\r\n information: string;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.additionalInfoLabelId = defaultTo(params?.additionalInfoLabelId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n this.information = defaultTo(params?.information, '');\r\n }\r\n}\r\n","import { DateTime } from \"luxon\";\r\n\r\nexport interface IAppointmentAuditLogModel {\r\n reservationId: number\r\n dateCreated: string\r\n type: string\r\n event: string\r\n initiator: string\r\n note: string\r\n}\r\n\r\nexport class AppointmentAuditLogModel implements Record {\r\n reservationId: number\r\n dateCreated: DateTime\r\n type: string\r\n event: string\r\n initiator: string\r\n note: string\r\n\r\n // not making this a partial constructor because these objects are read-only from the API.\r\n constructor(params: IAppointmentAuditLogModel, timezone: string) {\r\n this.reservationId = params.reservationId\r\n this.dateCreated = DateTime.fromISO(params.dateCreated, { zone: \"utc\" }).setZone(timezone);\r\n this.type = params.type\r\n this.event = params.event\r\n this.initiator = params.initiator\r\n this.note = params.note\r\n }\r\n}\r\n","import { AppointmentListingModel, IModel, ModelRecord } from \"@common/models\";\r\nimport { defaultTo } from \"lodash\";\r\n\r\nexport interface IAppointmentStatusRequest extends IModel {\r\n reservationId: number\r\n visitId: number | undefined\r\n}\r\n\r\nexport class AppointmentStatusRequest implements ModelRecord {\r\n reservationId: number;\r\n visitId: number | undefined\r\n rowVersion: string;\r\n\r\n constructor(init?: Partial) {\r\n this.reservationId = defaultTo(init?.reservationId, 0);\r\n this.visitId = defaultTo(init?.visitId, 0);\r\n this.rowVersion = defaultTo(init?.rowVersion, '');\r\n }\r\n\r\n static FromListingModel(model: AppointmentListingModel) {\r\n return new AppointmentStatusRequest({\r\n reservationId: model.reservationId,\r\n visitId: model.visitId,\r\n rowVersion: model.rowVersion\r\n });\r\n }\r\n}\r\n","import { AppointmentRequest, AppointmentCheckInRequest } from \"@common/models/requests\";\r\nimport { ResourceApi } from '@fullcalendar/resource-common';\r\nimport { DateTime } from \"luxon\";\r\nimport { AppointmentFlowActionOperations, AppointmentStatus, EntityScheduleType, ReservationAssignmentStatuses } from \"@common/models/Enums\";\r\nimport { ISelectOption } from \"@common/components/forms\";\r\nimport { StringUtility } from \"@common/utils\";\r\nimport { defaultTo } from \"lodash\";\r\nimport { IModel, ModelRecord, PetAlertModel, IPetAlertModel, schedule } from \"@common/models\";\r\nimport { AppointmentStatusRequest } from \"./requests/AppointmentStatusRequest\";\r\nimport { ICheckInModel } from \"@models/forms/ICheckInModel\";\r\n\r\nexport interface IAppointmentListingModel extends IModel {\r\n clinicId: number\r\n clinicStoreId: number\r\n clinicLocationName: string\r\n reservationId: number\r\n rescheduledReservationId: number | undefined\r\n rescheduledToDate: string | undefined\r\n visitId?: number\r\n appointmentStatusId: AppointmentStatus\r\n clientId: number\r\n clientFirstName: string\r\n clientLastName: string\r\n clientEmail: string\r\n clientPhone: string | undefined\r\n petId: number\r\n petAlerts: IPetAlertModel[] | undefined\r\n petName: string\r\n speciesName: string | undefined\r\n breedName: string | undefined\r\n genderName: string | undefined\r\n petDOB: string | undefined\r\n veterinarianId?: number | undefined\r\n veterinarianTitle: string | undefined\r\n veterinarianFirstName: string | undefined\r\n veterinarianLastName: string | undefined\r\n hospitalScheduleTemplateId?: number | undefined\r\n hospitalScheduleTemplateName: string | undefined\r\n appointmentTypeId: number\r\n appointmentTypeName: string\r\n appointmentTypeColor: string\r\n visitCompletionTypeId: number | undefined\r\n visitCompletionTypeName: string | undefined\r\n\r\n startDate: string\r\n startTime: string\r\n endDate: string\r\n endTime: string\r\n createdDate: string\r\n lastModifiedDate: string\r\n\r\n visitStarted: string | undefined\r\n checkinStart: string | undefined\r\n inProgressStart: string | undefined\r\n admittedStart: string | undefined\r\n finalizedStart: string | undefined\r\n paidStart: string | undefined\r\n checkoutStart: string | undefined\r\n\r\n isDropOff: boolean\r\n isOnlineBooking: boolean\r\n reasonForVisit: string | undefined\r\n notes: string | undefined\r\n assignmentStatus: ReservationAssignmentStatuses | undefined\r\n room: string | undefined\r\n\r\n dispensingAuthUserId: number | undefined\r\n dispensingUserFirstName: string | undefined\r\n dispensingUserLastName: string | undefined\r\n\r\n wasPriorCustomer: boolean\r\n isWalkIn: boolean\r\n canCall: boolean,\r\n canSMS: boolean,\r\n isRebook: boolean,\r\n previousStartDate: string,\r\n previousEndDate: string\r\n}\r\n\r\nexport const defaultApptListingModel: IAppointmentListingModel = {\r\n reservationId: 0,\r\n clinicId: 0,\r\n appointmentStatusId: AppointmentStatus.Booked,\r\n clinicStoreId: 0,\r\n clinicLocationName: \"\",\r\n clientId: 0,\r\n clientFirstName: \"\",\r\n clientLastName: \"\",\r\n clientEmail: \"\",\r\n clientPhone: undefined,\r\n petId: 0,\r\n petName: \"\",\r\n speciesName: \"\",\r\n breedName: \"\",\r\n genderName: \"\",\r\n petDOB: \"\",\r\n appointmentTypeId: 0,\r\n appointmentTypeName: \"\",\r\n appointmentTypeColor: \"\",\r\n visitCompletionTypeName: undefined,\r\n startDate: \"\",\r\n startTime: \"\",\r\n endDate: \"\",\r\n endTime: \"\",\r\n createdDate: \"\",\r\n lastModifiedDate: \"\",\r\n visitStarted: undefined,\r\n checkinStart: undefined,\r\n inProgressStart: undefined,\r\n admittedStart: undefined,\r\n finalizedStart: undefined,\r\n paidStart: undefined,\r\n checkoutStart: undefined,\r\n isOnlineBooking: false,\r\n isDropOff: false,\r\n veterinarianId: undefined,\r\n veterinarianFirstName: undefined,\r\n veterinarianLastName: undefined,\r\n veterinarianTitle: undefined,\r\n hospitalScheduleTemplateId: undefined,\r\n hospitalScheduleTemplateName: undefined,\r\n assignmentStatus: ReservationAssignmentStatuses.Unassigned,\r\n room: undefined,\r\n rescheduledReservationId: undefined,\r\n rescheduledToDate: undefined,\r\n petAlerts: undefined,\r\n visitCompletionTypeId: undefined,\r\n reasonForVisit: undefined,\r\n notes: undefined,\r\n dispensingAuthUserId: undefined,\r\n dispensingUserFirstName: \"\",\r\n dispensingUserLastName: \"\",\r\n wasPriorCustomer: false,\r\n isWalkIn: false,\r\n canCall: true,\r\n canSMS: true,\r\n rowVersion: \"\",\r\n isRebook: false,\r\n previousEndDate: \"\",\r\n previousStartDate: \"\"\r\n}\r\n\r\nexport class AppointmentListingModel implements ModelRecord {\r\n rowVersion: string\r\n clinicId: number\r\n clinicStoreId: number\r\n clinicLocationName: string\r\n reservationId: number\r\n rescheduledReservationId: number | undefined\r\n rescheduledToDate: DateTime | undefined\r\n visitId: number | undefined\r\n appointmentStatusId: AppointmentStatus\r\n clientId: number\r\n clientFirstName: string\r\n clientLastName: string\r\n clientEmail: string\r\n clientPhone: string | undefined\r\n petId: number\r\n petAlerts: IPetAlertModel[] | undefined\r\n speciesName: string | undefined\r\n breedName: string | undefined\r\n genderName: string | undefined\r\n petDOB: string | undefined\r\n petName: string\r\n veterinarianId: number | undefined\r\n veterinarianTitle: string | undefined\r\n veterinarianFirstName: string | undefined\r\n veterinarianLastName: string | undefined\r\n hospitalScheduleTemplateId: number | undefined\r\n hospitalScheduleTemplateName: string | undefined\r\n appointmentTypeId: number\r\n appointmentTypeName: string\r\n appointmentTypeColor: string\r\n visitCompletionTypeId: number | undefined\r\n visitCompletionTypeName: string | undefined\r\n startDate: string\r\n startTime: string\r\n endDate: string\r\n endTime: string\r\n createdDate: string\r\n lastModifiedDate: string\r\n visitStarted: string | undefined\r\n checkinStart: string | undefined\r\n inProgressStart: string | undefined\r\n admittedStart: string | undefined\r\n finalizedStart: string | undefined\r\n paidStart: string | undefined\r\n checkoutStart: string | undefined\r\n isOnlineBooking: boolean\r\n isDropOff: boolean\r\n reasonForVisit: string | undefined\r\n notes: string | undefined\r\n assignmentStatus: ReservationAssignmentStatuses\r\n room: string | undefined\r\n dispensingAuthUserId: number | undefined\r\n dispensingUserFirstName: string | undefined\r\n dispensingUserLastName: string | undefined\r\n wasPriorCustomer: boolean\r\n isWalkIn: boolean\r\n canCall: boolean\r\n canSMS: boolean\r\n isRebook: boolean\r\n previousStartDate: string\r\n previousEndDate: string\r\n\r\n constructor(params: IAppointmentListingModel) {\r\n this.rowVersion = defaultTo(params?.rowVersion, '');\r\n this.clinicId = defaultTo(params?.clinicId, 0);\r\n this.clinicStoreId = defaultTo(params?.clinicStoreId, 0);\r\n this.clinicLocationName = defaultTo(params?.clinicLocationName, '');\r\n this.reservationId = defaultTo(params?.reservationId, 0);\r\n this.rescheduledReservationId = defaultTo(params?.rescheduledReservationId, undefined);\r\n this.rescheduledToDate = StringUtility.SanitizeDateTimeISO(params.rescheduledToDate);\r\n this.visitId = defaultTo(params?.visitId, undefined);\r\n this.appointmentStatusId = defaultTo(params?.appointmentStatusId, AppointmentStatus.Booked);\r\n this.clientId = defaultTo(params?.clientId, 0);\r\n this.clientFirstName = defaultTo(params?.clientFirstName, '');\r\n this.clientLastName = defaultTo(params?.clientLastName, '');\r\n this.clientEmail = defaultTo(params?.clientEmail, '');\r\n this.clientPhone = defaultTo(params?.clientPhone, '');\r\n this.petId = defaultTo(params?.petId, 0);\r\n this.petAlerts = params?.petAlerts ? params?.petAlerts.map(p => new PetAlertModel(p)) : [] as PetAlertModel[];\r\n this.petName = defaultTo(params?.petName, '');\r\n this.speciesName = defaultTo(params?.speciesName, '');\r\n this.breedName = defaultTo(params?.breedName, '');\r\n this.genderName = defaultTo(params?.genderName, '');\r\n this.petDOB = defaultTo(params?.petDOB, '');\r\n this.assignmentStatus = defaultTo(params?.assignmentStatus, ReservationAssignmentStatuses.Unassigned);\r\n this.veterinarianId = defaultTo(params?.veterinarianId, undefined);\r\n this.veterinarianTitle = defaultTo(params?.veterinarianTitle, '');\r\n this.veterinarianFirstName = defaultTo(params?.veterinarianFirstName, '');\r\n this.veterinarianLastName = defaultTo(params?.veterinarianLastName, '');\r\n this.hospitalScheduleTemplateId = defaultTo(params?.hospitalScheduleTemplateId, undefined);\r\n this.hospitalScheduleTemplateName = defaultTo(params?.hospitalScheduleTemplateName, '');\r\n this.appointmentTypeId = defaultTo(params?.appointmentTypeId, 0);\r\n this.appointmentTypeName = defaultTo(params?.appointmentTypeName, '');\r\n this.appointmentTypeColor = defaultTo(params?.appointmentTypeColor, '');\r\n this.visitCompletionTypeId = defaultTo(params?.visitCompletionTypeId, undefined);\r\n this.visitCompletionTypeName = defaultTo(params?.visitCompletionTypeName, '');\r\n this.startDate = defaultTo(params?.startDate, '');\r\n this.endDate = defaultTo(params?.endDate, '');\r\n this.startTime = defaultTo(params?.startTime, '');\r\n this.endTime = defaultTo(params?.endTime, '');\r\n this.createdDate = defaultTo(params?.createdDate, '');\r\n this.lastModifiedDate = defaultTo(params?.lastModifiedDate, '');\r\n this.visitStarted = defaultTo(params?.visitStarted, undefined);\r\n this.checkinStart = defaultTo(params?.checkinStart, undefined);\r\n this.inProgressStart = defaultTo(params?.inProgressStart, undefined);\r\n this.admittedStart = defaultTo(params?.admittedStart, undefined);\r\n this.finalizedStart = defaultTo(params?.finalizedStart, undefined);\r\n this.paidStart = defaultTo(params?.paidStart, undefined);\r\n this.checkoutStart = defaultTo(params?.checkoutStart, undefined);\r\n this.isOnlineBooking = defaultTo(params?.isOnlineBooking, false);\r\n this.isDropOff = defaultTo(params?.isDropOff, false);\r\n this.reasonForVisit = defaultTo(params?.reasonForVisit, '');\r\n this.notes = defaultTo(params?.notes, '');\r\n this.room = StringUtility.SanitizeString(defaultTo(params?.room, undefined));\r\n this.dispensingAuthUserId = defaultTo(params?.dispensingAuthUserId, undefined);\r\n this.dispensingUserFirstName = defaultTo(params?.dispensingUserFirstName, '');\r\n this.dispensingUserLastName = defaultTo(params?.dispensingUserLastName, '');\r\n this.wasPriorCustomer = defaultTo(params?.wasPriorCustomer, false);\r\n this.isWalkIn = defaultTo(params?.isWalkIn, false);\r\n this.canCall = params.canCall;\r\n this.canSMS = params.canSMS;\r\n this.isRebook = params.isRebook\r\n this.previousStartDate = params.previousStartDate,\r\n this.previousEndDate = params.previousEndDate\r\n }\r\n\r\n getAssignmentOrDrName() {\r\n if (!this.assignmentStatus) return 'Unassigned';\r\n switch (this.assignmentStatus) {\r\n case ReservationAssignmentStatuses.Assigned:\r\n return `Dr. ${this.veterinarianFirstName} ${this.veterinarianLastName}`;\r\n case ReservationAssignmentStatuses.Unassigned:\r\n return 'Unassigned';\r\n case ReservationAssignmentStatuses.Unassigned_Technician:\r\n if (this.veterinarianId && this.veterinarianId > 0)\r\n return `Dr. ${this.veterinarianFirstName} ${this.veterinarianLastName}`;\r\n else\r\n return 'Unassigned Technician';\r\n case ReservationAssignmentStatuses.Assigned_Template:\r\n return this.hospitalScheduleTemplateName;\r\n case ReservationAssignmentStatuses.Assigned_Technician:\r\n return `Attending Doctor: Dr. ${this.veterinarianFirstName} ${this.veterinarianLastName}`;\r\n default:\r\n throw 'Unknown assignment status';\r\n }\r\n }\r\n\r\n getVetTechOrAssistantName() {\r\n if (!this.dispensingAuthUserId)\r\n return 'Unassigned';\r\n else\r\n return `Vet Tech/Vet Assistant: ${this.dispensingUserFirstName} ${this.dispensingUserLastName}`\r\n }\r\n\r\n unassignedCheckInCanBeReassigned(operation: AppointmentFlowActionOperations): boolean {\r\n if ((this.assignmentStatus === ReservationAssignmentStatuses.Unassigned\r\n || this.assignmentStatus === ReservationAssignmentStatuses.Unassigned_Technician\r\n || this.assignmentStatus === ReservationAssignmentStatuses.Assigned_Template)\r\n && operation == AppointmentFlowActionOperations.CheckIn) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n isFullyAssigned(): boolean { // helper function to ensure an appointment is filled out. external import may need these added.\r\n return (this.clientId !== 0 && this.petId !== 0);\r\n }\r\n\r\n static getDefault() {\r\n return new AppointmentListingModel(defaultApptListingModel);\r\n }\r\n\r\n static fromCalendarResource = (resource: ResourceApi | undefined, selectedDate: DateTime | null): AppointmentListingModel => {\r\n let apptModel: AppointmentListingModel = AppointmentListingModel.getDefault();\r\n apptModel.startDate = selectedDate ? selectedDate.toISO() : apptModel.startDate;\r\n\r\n const scheduleEntity = (resource?.extendedProps[\"scheduleEntity\"] as schedule.HospitalScheduleDayEntityModel | undefined);\r\n const vet: schedule.HospitalScheduleVeterinarianModel | undefined = resource?.extendedProps[\"veterinarian\"] as schedule.HospitalScheduleVeterinarianModel;\r\n\r\n if (scheduleEntity == null)\r\n throw 'invalid scheduleEntity, not expecting null';\r\n\r\n if (resource) {\r\n apptModel.assignmentStatus = resource.id === \"-1\" ? ReservationAssignmentStatuses.Unassigned_Technician : resource.id === \"0\" ? ReservationAssignmentStatuses.Unassigned : ReservationAssignmentStatuses.Assigned;\r\n\r\n switch (scheduleEntity.entityType) {\r\n case EntityScheduleType.Template:\r\n apptModel.assignmentStatus = ReservationAssignmentStatuses.Assigned_Template;\r\n apptModel.veterinarianFirstName = undefined;\r\n apptModel.veterinarianLastName = undefined;\r\n apptModel.veterinarianTitle = undefined;\r\n apptModel.veterinarianId = undefined;\r\n apptModel.hospitalScheduleTemplateId = scheduleEntity.entityId;\r\n apptModel.hospitalScheduleTemplateName = scheduleEntity.entityTitle;\r\n break;\r\n case EntityScheduleType.Veterinarian:\r\n apptModel.assignmentStatus = ReservationAssignmentStatuses.Assigned;\r\n apptModel.veterinarianFirstName = vet?.firstName ?? '';\r\n apptModel.veterinarianLastName = vet?.lastName ?? '';\r\n apptModel.veterinarianTitle = vet?.title;\r\n apptModel.veterinarianId = scheduleEntity.entityId;\r\n apptModel.hospitalScheduleTemplateId = undefined;\r\n apptModel.hospitalScheduleTemplateName = undefined;\r\n break;\r\n case EntityScheduleType.Unassigned:\r\n apptModel.assignmentStatus = ReservationAssignmentStatuses.Unassigned;\r\n apptModel.veterinarianFirstName = undefined;\r\n apptModel.veterinarianLastName = undefined;\r\n apptModel.veterinarianTitle = undefined;\r\n apptModel.veterinarianId = undefined;\r\n apptModel.hospitalScheduleTemplateId = undefined;\r\n apptModel.hospitalScheduleTemplateName = undefined;\r\n break;\r\n case EntityScheduleType.Technician:\r\n apptModel.assignmentStatus = ReservationAssignmentStatuses.Unassigned_Technician;\r\n apptModel.veterinarianFirstName = undefined;\r\n apptModel.veterinarianLastName = undefined;\r\n apptModel.veterinarianTitle = undefined;\r\n apptModel.veterinarianId = undefined;\r\n apptModel.hospitalScheduleTemplateId = undefined;\r\n apptModel.hospitalScheduleTemplateName = undefined;\r\n break;\r\n default:\r\n throw 'unknown EntityScheduleType';\r\n }\r\n }\r\n\r\n return apptModel;\r\n }\r\n\r\n toRequest(hospitalId: number): AppointmentRequest {\r\n return AppointmentRequest.FromListingModel(hospitalId, this);\r\n }\r\n\r\n toCheckInRequest(checkInModel: ICheckInModel, createAsInProgress: boolean = false): AppointmentCheckInRequest {\r\n return AppointmentCheckInRequest.FromListingModel(this, checkInModel, createAsInProgress);\r\n }\r\n\r\n toStatusRequest(): AppointmentStatusRequest {\r\n return AppointmentStatusRequest.FromListingModel(this);\r\n }\r\n\r\n isBlockedFromReschedule(): boolean {\r\n return !_.includes([\r\n AppointmentStatus.Cancelled,\r\n AppointmentStatus.Rescheduled,\r\n AppointmentStatus.Check_In,\r\n AppointmentStatus.In_Progress,\r\n AppointmentStatus.Admitted,\r\n AppointmentStatus.Finalized,\r\n AppointmentStatus.Paid,\r\n AppointmentStatus.Check_Out,\r\n AppointmentStatus.NoShow\r\n ], this.appointmentStatusId);\r\n }\r\n\r\n shouldHide(): boolean {\r\n return _.includes([AppointmentStatus.Cancelled, AppointmentStatus.Rescheduled], this.appointmentStatusId);\r\n }\r\n}\r\n/**\r\n * All available appointment statuses and their matching id\r\n */\r\nexport const AppointmentStatusOptions: ISelectOption[] = [\r\n { value: 1, label: \"Booked\" },\r\n { value: 2, label: \"Confirmed\" },\r\n { value: 3, label: \"Cancelled\" },\r\n { value: 4, label: \"Rescheduled\" },\r\n { value: 5, label: \"Showed\" },\r\n { value: 7, label: \"Clinic Cancelled\" },\r\n { value: 8, label: \"No Show\" },\r\n { value: 9, label: \"In Progress\" },\r\n { value: 10, label: \"Admitted\" },\r\n { value: 11, label: \"Finalized\" },\r\n { value: 12, label: \"Paid\" },\r\n { value: 500, label: \"Check In\" },\r\n { value: 501, label: \"Consultation\" },\r\n { value: 502, label: \"Vet Services\" },\r\n { value: 503, label: \"Check Out\" },\r\n { value: 9999, label: \"Walk-in\" }, // UI only Appointment Status that maps to \"Showed\" with a Reservation Trait of: Reservation - Walk In\r\n]\r\n","import { map } from \"lodash\";\r\nimport { AppointmentManagementItem, IAppointmentManagementItem } from \".\";\r\nexport interface IAppointmentManagementGroupingModel {\r\n status: string;\r\n clinicDate: Date;\r\n partnerName: string;\r\n address: string;\r\n city: string;\r\n state: string;\r\n zip: string;\r\n\r\n firstName: string;\r\n lastName: string;\r\n email: string;\r\n phone: string;\r\n wasPriorCustomer: boolean;\r\n\r\n clinicId: number;\r\n storeCode: string;\r\n intakePublicId: string;\r\n canViewIntake: boolean;\r\n canConfirm: boolean;\r\n canSendVisitCompletion: boolean;\r\n canCancel: boolean;\r\n canReschedule: boolean;\r\n canRebook: boolean;\r\n sortOrder: number;\r\n rescheduleViaVOB: boolean;\r\n vobRescheduleUrl: string;\r\n isHospitalReservation: boolean;\r\n hospitalName: string;\r\n hospitalPhone: string;\r\n publicAppointmentTypeId: string;\r\n items: IAppointmentManagementItem[];\r\n}\r\n\r\nexport class AppointmentManagementGroupingModel implements IAppointmentManagementGroupingModel {\r\n status: string;\r\n clinicDate: Date;\r\n partnerName: string;\r\n address: string;\r\n city: string;\r\n state: string;\r\n zip: string;\r\n\r\n firstName: string;\r\n lastName: string;\r\n email: string;\r\n phone: string;\r\n wasPriorCustomer: boolean;\r\n\r\n clinicId: number;\r\n storeCode: string;\r\n intakePublicId: string;\r\n canViewIntake: boolean;\r\n canConfirm: boolean;\r\n canSendVisitCompletion: boolean;\r\n canCancel: boolean;\r\n canReschedule: boolean;\r\n canRebook: boolean;\r\n sortOrder: number;\r\n rescheduleViaVOB: boolean;\r\n vobRescheduleUrl: string;\r\n isHospitalReservation: boolean;\r\n hospitalName: string;\r\n hospitalPhone: string;\r\n publicAppointmentTypeId: string;\r\n items: AppointmentManagementItem[] = [];\r\n\r\n constructor(params: Partial = {}) {\r\n const {\r\n status = '',\r\n clinicDate = '',\r\n partnerName = '',\r\n address = '',\r\n city = '',\r\n state = '',\r\n zip = '',\r\n firstName = '',\r\n lastName = '',\r\n email = '',\r\n phone = '',\r\n wasPriorCustomer = false,\r\n clinicId = 0,\r\n storeCode = '',\r\n intakePublicId = '',\r\n canViewIntake = false,\r\n canConfirm = false,\r\n canSendVisitCompletion = false,\r\n canCancel = false,\r\n canReschedule = false,\r\n canRebook = false,\r\n sortOrder = 0,\r\n rescheduleViaVOB = false,\r\n vobRescheduleUrl = '',\r\n isHospitalReservation = false,\r\n hospitalName = '',\r\n hospitalPhone = '',\r\n publicAppointmentTypeId = '',\r\n items = [] as Array\r\n } = params;\r\n\r\n this.status = status;\r\n this.clinicDate = new Date(clinicDate);\r\n this.partnerName = partnerName;\r\n this.address = address;\r\n this.city = city;\r\n this.state = state;\r\n this.zip = zip;\r\n\r\n this.firstName = firstName;\r\n this.lastName = lastName;\r\n this.email = email;\r\n this.phone = phone;\r\n this.wasPriorCustomer = wasPriorCustomer;\r\n\r\n this.clinicId = clinicId;\r\n this.storeCode = storeCode;\r\n this.intakePublicId = intakePublicId;\r\n this.canViewIntake = canViewIntake;\r\n this.canConfirm = canConfirm;\r\n this.canSendVisitCompletion = canSendVisitCompletion;\r\n this.canCancel = canCancel;\r\n this.canReschedule = canReschedule;\r\n this.canRebook = canRebook;\r\n this.sortOrder = sortOrder;\r\n this.rescheduleViaVOB = rescheduleViaVOB;\r\n this.vobRescheduleUrl = vobRescheduleUrl;\r\n this.hospitalName = hospitalName;\r\n this.hospitalPhone = hospitalPhone;\r\n this.isHospitalReservation = isHospitalReservation;\r\n this.publicAppointmentTypeId = publicAppointmentTypeId;\r\n map(items, (item) => { this.items.push(new AppointmentManagementItem(item)); });\r\n }\r\n}\r\n","import { ordinal } from '../utils/ordinal';\r\nimport { DateTime } from 'luxon';\r\n\r\nexport interface IAppointmentManagementItem {\r\n displayFullAppt: string;\r\n itemTime: string;\r\n petName: string;\r\n species: string;\r\n reservationPublicId?: string;\r\n visitPublicId?: string;\r\n}\r\n\r\nexport class AppointmentManagementItem implements IAppointmentManagementItem {\r\n displayFullAppt: string;\r\n itemTime: string;\r\n petName: string;\r\n species: string;\r\n reservationPublicId?: string | undefined;\r\n visitPublicId?: string | undefined;\r\n\r\n constructor(params: Partial = {}) {\r\n const {\r\n itemTime = '',\r\n petName = '',\r\n species = '',\r\n reservationPublicId = undefined,\r\n visitPublicId = undefined\r\n } = params;\r\n\r\n this.petName = petName;\r\n this.species = species;\r\n const fullDate = new Date(itemTime);\r\n this.displayFullAppt = `${DateTime.fromJSDate(fullDate).toFormat(\"EEEE, MMMM\")} ${ordinal.getNumberOrdinal(fullDate.getDate())}`\r\n this.itemTime = DateTime.fromJSDate(fullDate).toFormat(\"h:mma\");\r\n this.reservationPublicId = reservationPublicId;\r\n this.visitPublicId = visitPublicId;\r\n }\r\n}\r\n","import { map } from \"lodash\";\r\nimport { IAppointmentManagementGroupingModel, AppointmentManagementGroupingModel, CommunicationPreferenceModel, ICommunicationPreferenceModel } from \".\";\r\n\r\nexport interface IAppointmentManagementListModel {\r\n name: string;\r\n description: string;\r\n sortOrder: number;\r\n canViewWhatToExpect: boolean;\r\n groups: IAppointmentManagementGroupingModel[];\r\n communicationPreference: ICommunicationPreferenceModel;\r\n showCommunicationPreference: boolean;\r\n}\r\n\r\nexport class AppointmentManagementListModel implements IAppointmentManagementListModel {\r\n name: string;\r\n description: string;\r\n sortOrder: number;\r\n canViewWhatToExpect: boolean;\r\n groups: AppointmentManagementGroupingModel[] = [];\r\n communicationPreference: CommunicationPreferenceModel;\r\n showCommunicationPreference: boolean;\r\n\r\n constructor(params: Partial = {}) {\r\n const {\r\n name = '',\r\n description = '',\r\n sortOrder = 0,\r\n canViewWhatToExpect = false,\r\n groups = [] as Array\r\n } = params;\r\n\r\n this.name = name;\r\n this.description = description;\r\n this.sortOrder = sortOrder;\r\n this.canViewWhatToExpect = canViewWhatToExpect;\r\n map(groups, (group) => { this.groups.push(new AppointmentManagementGroupingModel(group)); });\r\n this.communicationPreference = params?.communicationPreference ? new CommunicationPreferenceModel(params?.communicationPreference) : new CommunicationPreferenceModel();\r\n this.showCommunicationPreference = _.defaultTo(params?.showCommunicationPreference, false);\r\n\r\n }\r\n}\r\n","import { IModel, Model } from \".\";\r\nexport interface IIdexxSpeciesModel extends IModel {\r\n idexxSpeciesId: number;\r\n name: string,\r\n code: string,\r\n}\r\nexport class IdexxSpeciesModel extends Model implements IIdexxSpeciesModel {\r\n idexxSpeciesId: number;\r\n name: string;\r\n code: string;\r\n constructor(params: IIdexxSpeciesModel) {\r\n super(params);\r\n this.idexxSpeciesId = params.idexxSpeciesId;\r\n this.name = params.name;\r\n this.code = params.code;\r\n }\r\n}\r\n","import { IModel, Model } from \".\";\r\nimport { IdexxSpeciesModel, IIdexxSpeciesModel } from \"./IdexxSpeciesModel\";\r\n\r\nexport interface ISpeciesModel extends IModel {\r\n speciesId: number;\r\n name: string;\r\n idexxSpeciesId?: number;\r\n idexxSpecies?: IIdexxSpeciesModel;\r\n}\r\nexport class SpeciesModel extends Model implements ISpeciesModel {\r\n speciesId: number;\r\n name: string;\r\n idexxSpeciesId?: number | undefined;\r\n idexxSpecies?: IdexxSpeciesModel | undefined;\r\n\r\n constructor(params: Partial = {} as ISpeciesModel) {\r\n super(params);\r\n const {\r\n speciesId = 0,\r\n name = '',\r\n } = params;\r\n\r\n this.speciesId = speciesId;\r\n this.name = name;\r\n // Do not default these fields, when creating a pet, a user will never fill them out and add idexx values.\r\n this.idexxSpeciesId = params.idexxSpeciesId;\r\n this.idexxSpecies = params.idexxSpecies ? new IdexxSpeciesModel(params.idexxSpecies) : undefined;\r\n }\r\n}\r\n","import { ISelectOption } from \"@common/components/forms/\";\r\nimport { IModel, ISpeciesModel, Model } from \"@common/models\";\r\nimport { SpeciesModel } from \"./SpeciesModel\";\r\n\r\nexport interface IAppointmentTypeRequest extends IModel {\r\n authApplicationId: number\r\n name: string\r\n species: Array\r\n color: string\r\n description: string\r\n defaultDurationSeconds: number\r\n onlineBooking: boolean,\r\n isSurgery: boolean,\r\n isDropoff: boolean,\r\n isActive: boolean,\r\n isLocked: boolean\r\n}\r\n\r\nexport interface IAppointmentTypeModel extends IAppointmentTypeRequest {\r\n appointmentTypeId: number,\r\n}\r\n\r\nexport class AppointmentTypeModel extends Model implements IAppointmentTypeModel {\r\n authApplicationId: number;\r\n appointmentTypeId: number;\r\n name: string;\r\n species: ISpeciesModel[];\r\n color: string;\r\n description: string;\r\n defaultDurationSeconds: number;\r\n onlineBooking: boolean;\r\n isSurgery: boolean;\r\n isDropoff: boolean;\r\n isActive: boolean;\r\n isLocked: boolean;\r\n\r\n constructor(params: IAppointmentTypeModel) {\r\n super(params);\r\n this.authApplicationId = params.authApplicationId;\r\n this.appointmentTypeId = params.appointmentTypeId;\r\n this.name = params.name;\r\n this.species = params.species && params.species.map(s => new SpeciesModel(s));\r\n this.color = params.color;\r\n this.description = params.description;\r\n this.defaultDurationSeconds = params.defaultDurationSeconds;\r\n this.onlineBooking = params.onlineBooking;\r\n this.isSurgery = params.isSurgery;\r\n this.isDropoff = params.isDropoff;\r\n this.isActive = params.isActive;\r\n this.isLocked = params.isLocked;\r\n }\r\n}\r\n\r\nexport const AppointmentDurationOptions: ISelectOption[] & { disabled?: boolean } = [\r\n { value: 900, label: \"15 minutes\" },\r\n { value: 1800, label: \"30 minutes\" },\r\n { value: 2700, label: \"45 minutes\" },\r\n { value: 3600, label: \"1 hour\" },\r\n { value: 5400, label: \"1 hour 30 minutes\" },\r\n { value: 7200, label: \"2 hours\" },\r\n { value: 9000, label: \"2 hours 30 minutes\" },\r\n { value: 10800, label: \"3 hours\" }\r\n]\r\n","import { VisitAnesthesiaFormPreOpModel, IVisitAnesthesiaFormPreOpModel, VisitAnesthesiaFormSurgeryModel, IVisitAnesthesiaFormSurgeryModel, VisitAnesthesiaFormPostSurgeryModel, IVisitAnesthesiaFormPostSurgeryModel, IModel, Model, ModelRecord } from \"@common/models\"\r\n\r\nexport interface IVisitAnesthesiaFormModel extends IModel {\r\n visitAnesthesiaFormId: number;\r\n visitId: number;\r\n petId: number;\r\n preOp: IVisitAnesthesiaFormPreOpModel;\r\n surgery: IVisitAnesthesiaFormSurgeryModel;\r\n postSurgery: IVisitAnesthesiaFormPostSurgeryModel;\r\n}\r\n\r\nexport class VisitAnesthesiaFormModel extends Model implements ModelRecord {\r\n visitAnesthesiaFormId: number\r\n visitId: number\r\n petId: number\r\n preOp: VisitAnesthesiaFormPreOpModel;\r\n surgery: VisitAnesthesiaFormSurgeryModel;\r\n postSurgery: VisitAnesthesiaFormPostSurgeryModel;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.visitAnesthesiaFormId = _.defaultTo(params?.visitAnesthesiaFormId, 0);\r\n this.visitId = _.defaultTo(params?.visitId, 0);\r\n this.petId = _.defaultTo(params?.petId, 0);\r\n this.preOp = params?.preOp ? new VisitAnesthesiaFormPreOpModel(params.preOp) : new VisitAnesthesiaFormPreOpModel();\r\n this.surgery = params?.surgery ? new VisitAnesthesiaFormSurgeryModel(params.surgery) : new VisitAnesthesiaFormSurgeryModel();\r\n this.postSurgery = params?.postSurgery ? new VisitAnesthesiaFormPostSurgeryModel(params.postSurgery) : new VisitAnesthesiaFormPostSurgeryModel();\r\n }\r\n\r\n}\r\n","import { VisitAnesthesiaFormPreOpMedicationModel, IVisitAnesthesiaFormPreOpMedicationModel, IModel, Model, ModelRecord } from \"@common/models\"\r\nimport { ISelectOptionString } from '@common/components/forms';\r\nimport { DateTime } from \"luxon\";\r\nimport { MedicationTypes } from \"@common/models/Enums\";\r\n\r\nexport interface IVisitAnesthesiaFormPreOpModel extends IModel {\r\n visitAnesthesiaFormPreOpId: number;\r\n procedure: string;\r\n temperature: string;\r\n pulse: string;\r\n respiratoryRate: string;\r\n time: string;\r\n asaPhysicalStatus: string;\r\n ivSizeLocation: string;\r\n ivFluidType: string;\r\n startRate: string;\r\n qualityOfSedation: string;\r\n intubated: boolean | undefined;\r\n tubeSize: string;\r\n anesthesiaSystem: string;\r\n additionalNotes: string;\r\n medications: IVisitAnesthesiaFormPreOpMedicationModel[];\r\n dateCreated: string;\r\n dateUpdated: string;\r\n userUpdatedTitle: string;\r\n userUpdatedFirstName: string;\r\n userUpdatedLastName: string;\r\n}\r\n\r\nexport class VisitAnesthesiaFormPreOpModel extends Model implements ModelRecord {\r\n visitAnesthesiaFormPreOpId: number;\r\n procedure: string;\r\n temperature: string;\r\n pulse: string;\r\n respiratoryRate: string;\r\n time: string;\r\n asaPhysicalStatus: string;\r\n ivSizeLocation: string;\r\n ivFluidType: string;\r\n startRate: string;\r\n qualityOfSedation: string;\r\n intubated: boolean | undefined;\r\n tubeSize: string;\r\n anesthesiaSystem: string;\r\n additionalNotes: string;\r\n medications: VisitAnesthesiaFormPreOpMedicationModel[] = [];\r\n dateCreated: DateTime;\r\n dateUpdated: DateTime;\r\n userUpdatedTitle: string;\r\n userUpdatedFirstName: string;\r\n userUpdatedLastName: string;\r\n\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.visitAnesthesiaFormPreOpId = _.defaultTo(params?.visitAnesthesiaFormPreOpId, 0);\r\n this.procedure = _.defaultTo(params?.procedure, '');\r\n this.temperature = _.defaultTo(params?.temperature, '');\r\n this.pulse = _.defaultTo(params?.pulse, '');\r\n this.respiratoryRate = _.defaultTo(params?.respiratoryRate, '');\r\n this.time = _.defaultTo(params?.time, '');\r\n this.asaPhysicalStatus = _.defaultTo(params?.asaPhysicalStatus, '');\r\n this.ivSizeLocation = _.defaultTo(params?.ivSizeLocation, '');\r\n this.ivFluidType = _.defaultTo(params?.ivFluidType, '');\r\n this.startRate = _.defaultTo(params?.startRate, '');\r\n this.qualityOfSedation = _.defaultTo(params?.qualityOfSedation, '');\r\n this.intubated = _.defaultTo(params?.intubated, undefined);\r\n this.tubeSize = _.defaultTo(params?.tubeSize, '');\r\n this.anesthesiaSystem = _.defaultTo(params?.anesthesiaSystem, '');\r\n this.additionalNotes = _.defaultTo(params?.additionalNotes, '');\r\n\r\n if (params?.medications?.length! > 0) {\r\n _.map(params?.medications, (m) => { this.medications.push(new VisitAnesthesiaFormPreOpMedicationModel(m)) });\r\n }\r\n else {\r\n this.medications = VisitAnesthesiaFormPreOpModel.getDefaultMedications();\r\n }\r\n this.dateCreated = params?.dateCreated ? DateTime.fromISO(params.dateCreated, { zone: \"utc\" }) : DateTime.min();\r\n this.dateUpdated = params?.dateUpdated ? DateTime.fromISO(params.dateUpdated, { zone: \"utc\" }) : DateTime.min();\r\n this.userUpdatedTitle = _.defaultTo(params?.userUpdatedTitle, \"\");\r\n this.userUpdatedFirstName = _.defaultTo(params?.userUpdatedFirstName, \"\");\r\n this.userUpdatedLastName = _.defaultTo(params?.userUpdatedLastName, \"\");\r\n\r\n }\r\n\r\n static getDefaultMedications() {\r\n const defaultMedications: VisitAnesthesiaFormPreOpMedicationModel[] = [];\r\n for (const key in MedicationTypes) {\r\n if (MedicationTypes[key] == MedicationTypes[MedicationTypes.PREANESTHETIC_SEDATIVE_MEDICATIONS]) {\r\n defaultMedications.push(new VisitAnesthesiaFormPreOpMedicationModel({ medicationTypeId: MedicationTypes.PREANESTHETIC_SEDATIVE_MEDICATIONS, rowIndex: 0 }))\r\n defaultMedications.push(new VisitAnesthesiaFormPreOpMedicationModel({ medicationTypeId: MedicationTypes.PREANESTHETIC_SEDATIVE_MEDICATIONS, rowIndex: 1 }))\r\n defaultMedications.push(new VisitAnesthesiaFormPreOpMedicationModel({ medicationTypeId: MedicationTypes.PREANESTHETIC_SEDATIVE_MEDICATIONS, rowIndex: 2 }))\r\n\r\n }\r\n if (MedicationTypes[key] == MedicationTypes[MedicationTypes.ANESTHETIC_INDUCTION_MEDICATIONS]) {\r\n defaultMedications.push(new VisitAnesthesiaFormPreOpMedicationModel({ medicationTypeId: MedicationTypes.ANESTHETIC_INDUCTION_MEDICATIONS, rowIndex: 3 }))\r\n }\r\n if (MedicationTypes[key] == MedicationTypes[MedicationTypes.CONSTANT_RATE_INFUSION]) {\r\n defaultMedications.push(new VisitAnesthesiaFormPreOpMedicationModel({ medicationTypeId: MedicationTypes.CONSTANT_RATE_INFUSION, rowIndex: 4 }))\r\n }\r\n if (MedicationTypes[key] == MedicationTypes[MedicationTypes.ADDITIONAL_MEDICATIONS]) {\r\n defaultMedications.push(new VisitAnesthesiaFormPreOpMedicationModel({ medicationTypeId: MedicationTypes.ADDITIONAL_MEDICATIONS, rowIndex: 5 }))\r\n }\r\n }\r\n return defaultMedications;\r\n }\r\n\r\n}\r\n\r\nexport const asaPhysicalStatusOptions: ISelectOptionString[] = [\r\n { value: \"1\", label: \"1\" },\r\n { value: \"2\", label: \"2\" },\r\n { value: \"3\", label: \"3\" },\r\n { value: \"4\", label: \"4\" },\r\n { value: \"5\", label: \"5\" }\r\n]\r\nexport const routeSelectOptions: ISelectOptionString[] = [\r\n {\r\n label: 'IV',\r\n value: 'IV'\r\n },\r\n {\r\n label: 'IM',\r\n value: 'IM'\r\n },\r\n {\r\n label: 'PO',\r\n value: 'PO'\r\n },\r\n {\r\n label: 'SQ',\r\n value: 'SQ'\r\n },\r\n {\r\n label: 'Other',\r\n value: 'Other'\r\n }\r\n];\r\n","import { VisitAnesthesiaFormSurgeryVitalModel } from '@common/models/VisitAnesthesiaFormSurgeryVitalModel';\r\nimport { DateTimeUtils } from '@common/utils/datetimeUtils';\r\nimport { DateTime } from 'luxon';\r\nimport { textEditor } from 'react-data-grid';\r\nexport const getFormattedTimeForHeader = (number: number) => {\r\n const pad = (number: number) => number.toString().padStart(2, '0')\r\n if (number > 60) {\r\n const unroundedHours = number / 60\r\n const hours = Math.floor(number / 60);\r\n\r\n const minutes = Math.round((unroundedHours - hours) * 60);\r\n minutes.toString().padStart(2, '0')\r\n return `${hours}:${pad(minutes)}`\r\n }\r\n else if (number > -1) {\r\n return `:${pad(number)}`\r\n }\r\n else {\r\n return 'unknown'\r\n }\r\n}\r\n\r\nexport const surgeryDummyColumn = (num: number) => ({\r\n \"visitAnesthesiaFormSurgeryVitalId\": 0,\r\n \"visitAnesthesiaFormSurgeryId\": 0,\r\n \"fluidRate\": '',\r\n \"anesthesiaDepth\": '',\r\n \"iso\": '',\r\n \"o2Flow\": '',\r\n \"hr\": '',\r\n \"sP02\": '',\r\n \"temperature\": '',\r\n \"rr\": '',\r\n \"etcO2\": '',\r\n \"mm\": '',\r\n \"systolic\": '',\r\n \"diastolic\": '',\r\n \"map\": '',\r\n \"interval\": num,\r\n \"rowVersion\": \"\",\r\n \"dateCreated\": undefined,\r\n \"dateUpdated\": undefined\r\n})\r\nexport const postSurgeryDummyColumn = (num: number) => ({\r\n \"visitAnesthesiaFormPostSurgeryVitalId\": 0,\r\n \"visitAnesthesiaFormPostSurgeryId\": 0,\r\n \"temperature\": '',\r\n \"hr\": '',\r\n \"rr\": '',\r\n \"painScore\": '',\r\n \"interval\": num,\r\n \"rowVersion\": \"\",\r\n \"dateCreated\": undefined,\r\n \"dateUpdated\": undefined,\r\n})\r\nexport const addDummyColumns = (currentNumberOfVitals: number, dummyColumn: (num: number) => any) => {\r\n const twoHours = 120; // minutes\r\n const interval = 5; // minutes\r\n\r\n const numberOfColumnsToAdd = (twoHours / interval) - currentNumberOfVitals;\r\n const dummyColumns = []\r\n for (let count = 0; count <= numberOfColumnsToAdd; count++) {\r\n dummyColumns.push(dummyColumn(count + currentNumberOfVitals + 1))\r\n }\r\n return dummyColumns;\r\n}\r\n\r\n\r\n// columns variable: contains all of the properties to customize the grid column.\r\n// columns: [{ key }, {key, name, width, resizable, editor, cellClass, headerCellClass}, {}, ...etc]\r\nexport const createColumns = (\r\n {\r\n vitals,\r\n highlightedColumnIndex,\r\n surgeryHasStopped,\r\n passedClassName = \"\",\r\n timezoneName,\r\n isBody\r\n }: {\r\n vitals: VisitAnesthesiaFormSurgeryVitalModel[],\r\n highlightedColumnIndex: number,\r\n surgeryHasStopped: boolean,\r\n passedClassName: string,\r\n timezoneName?: string,\r\n isBody: boolean,\r\n }\r\n) => {\r\n const columnArray = vitals.map(({ dateCreated }, index) => {\r\n const highlightedColumn = index === highlightedColumnIndex && isBody;\r\n const disabledColumn = index > highlightedColumnIndex;\r\n const disableHighlightedColumnWhenSurgeryStopped = (surgeryHasStopped && index === highlightedColumnIndex);\r\n const columnHeader = dateCreated && timezoneName ? DateTimeUtils.getZoneDateAsLocal(dateCreated, timezoneName).toLocaleString(DateTime.TIME_SIMPLE) : ''\r\n return ({\r\n key: `${index}`,\r\n name: columnHeader,\r\n width: 90,\r\n resizable: true,\r\n editor: textEditor,\r\n /* States supported by both cell class and header class\r\n 1. disable column if surgery is stopped.\r\n 2. disable column if after the highlighted column.\r\n 3. columns can only be created when highlighted which is driven by 2 flags.\r\n i. column index\r\n ii. highlightEnabled,\r\n a. we no longer highlight a column when it has been created\r\n b. and the interval to highlight the next column resets\r\n 4. all previous columns to the current column can be edited.\r\n\r\n Note: disabling columns also have javascript logic on whether to trigger modal click event or not.\r\n onCellClick={(args, event) => {\r\n !surgeryHasStopped && checkAndOpenModal(args);\r\n }\r\n How the Timer works: located at apps/common/hooks/useGridHighlightTimer.ts\r\n 1. Currently the logic changes the inteval every 5 minutes.\r\n 2. This is changing and instead\r\n i. We reset the timer for the following conditions:\r\n a. starting the surgery starts the timer.\r\n b. saving the highlighted column restarts the timer.\r\n c. what does stopping and starting the timer do?\r\n ii. We will only ever highlight one column rightward to the last edited column.\r\n */\r\n cellClass: (disableHighlightedColumnWhenSurgeryStopped || disabledColumn) // The order of this ternary is important take care when changing.\r\n ? 'cursor-not-allowed bg-disabled'\r\n : highlightedColumn\r\n ? 'modified-col-cell cursor-pointer' + passedClassName\r\n : 'cursor-pointer', // this happens after we edit.\r\n headerCellClass: (disableHighlightedColumnWhenSurgeryStopped || disabledColumn)\r\n ? 'react-grid-petco-header cursor-not-allowed bg-disabled'\r\n : highlightedColumn\r\n ? 'react-grid-petco-header modified-header-cell' + passedClassName\r\n : 'react-grid-petco-header'\r\n })\r\n })\r\n return columnArray;\r\n} // columns: [{ key }, {}, {}, ...etc] // key is used by the rows.\r\n\r\nexport function createRows(vitals: VisitAnesthesiaFormSurgeryVitalModel[], surgeryPickKeys: string[]) {\r\n // shrunkVitals summary:\r\n // [ // Each vital, which is separated by interval, is contained in a sub array. These items look like the following:\r\n // ['1', 'Deep', '2.0', '0.3', '158', '99%', '100.1', '119', '33', '6', '120', '122', '84'],\r\n // [],[],[],[],[],[],[],[...etc]\r\n // ]\r\n\r\n const shrunkVitals = vitals.map((vital) => {\r\n const shrunkVitals = _.pick(vital, surgeryPickKeys);\r\n const vitalsAsArray = Object.values(shrunkVitals);\r\n return vitalsAsArray;\r\n })\r\n // [\r\n // [fluidRate, anesthesiaDepth, iso, o2Flow, hr, sP02, temperature, rr, etcO2, mm, systolic, diastolic, map],\r\n // [fluidRate, anesthesiaDepth, iso, o2Flow, hr, sP02, temperature, rr, etcO2, mm, systolic, diastolic, map],\r\n // ...\r\n // ]\r\n // needs to be converted to:\r\n // [\r\n // [fluidRate, fluidRate, fluidRate, fluidRate, fluidRate, fluidRate],\r\n // [anesthesiaDepth, anesthesiaDepth, anesthesiaDepth, anesthesiaDepth, anesthesiaDepth, anesthesiaDepth, anesthesiaDepth],\r\n // ...\r\n // ]\r\n const rows = [];\r\n // Iterate all of the rows and add the cells to the columns, transposing the data.\r\n for (let rowCount = 0; rowCount < shrunkVitals[0].length; rowCount++) { // There are a finite number of rows.\r\n const row: any = []\r\n for (let index = 0; index < vitals.length; index++) { // There are a finite number of rows.\r\n row.push(shrunkVitals[index][rowCount]) // add the headerKey to the object and value as the cell.\r\n }\r\n rows.push(row); // rows are now filled with cells associated with the correct column headers.\r\n }\r\n return rows;\r\n /* rows Summary:\r\n For react-data-grid rows contain cells of the table.\r\n Here is an example of what a rows looks like:\r\n [\r\n [ '1', '1', ...etc ],\r\n ['Deep', 'Deep', ...etc],\r\n ...\r\n ]\r\n */\r\n}\r\n\r\nexport const remapVitalsObjectViaTranspose = (rows: any, vitals: any) => { // currently not used but can be a helpful function in the future.\r\n // We could in theory edit inline using useForm Hooks. but this is not asked for.\r\n const transposedRows: any = [];\r\n for (let count = 0; count <= 24; count++) { transposedRows.push([]) }\r\n\r\n rows.forEach(\r\n (row: any) => {\r\n for (let cellCount = 0; cellCount < row.length; cellCount++) {\r\n const cell = row[cellCount];\r\n transposedRows[cellCount].push(cell) // creates a 2d array where each row has the different values needed in the payload object.\r\n }\r\n }\r\n )\r\n\r\n const final = transposedRows.map((rowValues: any, index: number) => {\r\n const [fluidRate, anesthesiaDepth, iso, o2Flow, hr, sP02, temperature, rr, etcO2, mm, systolic, diastolic, map] = rowValues\r\n const vital = vitals[index];\r\n return { ...vital, fluidRate, anesthesiaDepth, iso, o2Flow, hr, sP02, temperature, rr, etcO2, mm, systolic, diastolic, map }\r\n });\r\n return final;\r\n\r\n // note, \"the below content\" is not useful because gridCells would not be part of useFormHooks. but leaving as it might be useful for the modal.\r\n // const [fluidRate, anesthesiaDepth, iso, o2Flow, hr, sP02, temperature, rr, etcO2, mm, systolic, diastolic, map] = gridCells[index]\r\n // return { ...vital, fluidRate, anesthesiaDepth, iso, o2Flow, hr, sP02, temperature, rr, etcO2, mm, systolic, diastolic, map }\r\n}\r\n","import { addDummyColumns, surgeryDummyColumn } from \"@common/components/table/SurgeryGridHelpers\";\r\nimport { VisitAnesthesiaFormSurgeryVitalModel, IVisitAnesthesiaFormSurgeryVitalModel, IModel, Model, ModelRecord } from \"@common/models\"\r\nimport { DateTime } from \"luxon\";\r\n\r\nexport interface IVisitAnesthesiaFormSurgeryModel extends IModel {\r\n visitAnesthesiaFormSurgeryId: number;\r\n anesthesiaStartTime: string;\r\n anesthesiaStopTime: string;\r\n surgeryStartTime: string;\r\n surgeryStopTime: string;\r\n complicationNotes: string;\r\n vitals: IVisitAnesthesiaFormSurgeryVitalModel[];\r\n dateCreated: string;\r\n dateUpdated: string;\r\n userUpdatedTitle: string;\r\n userUpdatedFirstName: string;\r\n userUpdatedLastName: string;\r\n}\r\n\r\nexport class VisitAnesthesiaFormSurgeryModel extends Model implements ModelRecord {\r\n visitAnesthesiaFormSurgeryId: number;\r\n anesthesiaStartTime: string;\r\n anesthesiaStopTime: string;\r\n surgeryStartTime: string;\r\n surgeryStopTime: string;\r\n complicationNotes: string;\r\n vitals: VisitAnesthesiaFormSurgeryVitalModel[] = [];\r\n dateCreated: DateTime;\r\n dateUpdated: DateTime;\r\n userUpdatedTitle: string;\r\n userUpdatedFirstName: string;\r\n userUpdatedLastName: string;\r\n vitalsLength: number;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.visitAnesthesiaFormSurgeryId = _.defaultTo(params?.visitAnesthesiaFormSurgeryId, 0);\r\n this.anesthesiaStartTime = _.defaultTo(params?.anesthesiaStartTime, '');\r\n this.anesthesiaStopTime = _.defaultTo(params?.anesthesiaStopTime, '');\r\n this.surgeryStartTime = _.defaultTo(params?.surgeryStartTime, '');\r\n this.surgeryStopTime = _.defaultTo(params?.surgeryStopTime, '');\r\n this.complicationNotes = _.defaultTo(params?.complicationNotes, '');\r\n this.vitalsLength = params?.vitals?.length || 0;\r\n _.map(params?.vitals, (m) => { this.vitals.push(new VisitAnesthesiaFormSurgeryVitalModel(m)) });\r\n this.vitals = [...addDummyColumns(this.vitals.length, surgeryDummyColumn), ...this.vitals];\r\n\r\n if (!this.anesthesiaStopTime && this.vitalsLength >= 25) {\r\n this.vitals.push(surgeryDummyColumn(this.vitalsLength + 1))\r\n }\r\n this.vitals.sort((a, b) => Number(a.interval) - Number(b.interval));\r\n this.dateCreated = params?.dateCreated ? DateTime.fromISO(params.dateCreated, { zone: \"utc\" }) : DateTime.now();\r\n this.dateUpdated = params?.dateUpdated ? DateTime.fromISO(params.dateUpdated, { zone: \"utc\" }) : DateTime.now();\r\n this.userUpdatedTitle = _.defaultTo(params?.userUpdatedTitle, \"\");\r\n this.userUpdatedFirstName = _.defaultTo(params?.userUpdatedFirstName, \"\");\r\n this.userUpdatedLastName = _.defaultTo(params?.userUpdatedLastName, \"\");\r\n }\r\n\r\n}\r\n","import { postSurgeryDummyColumn, addDummyColumns } from \"@common/components/table/SurgeryGridHelpers\";\r\nimport { VisitAnesthesiaFormPostSurgeryVitalModel, IVisitAnesthesiaFormPostSurgeryVitalModel, IModel, Model, ModelRecord } from \"@common/models\"\r\nimport { DateTime } from \"luxon\";\r\n\r\nexport interface IVisitAnesthesiaFormPostSurgeryModel extends IModel {\r\n visitAnesthesiaFormPostSurgeryId: number;\r\n startTime: string | undefined;\r\n stopTime: string | undefined;\r\n timeOfExtubation: string;\r\n qualityOfRecovery: string;\r\n surgeryNote: string;\r\n vitals: IVisitAnesthesiaFormPostSurgeryVitalModel[];\r\n dateCreated: string;\r\n dateUpdated: string;\r\n userUpdatedTitle: string;\r\n userUpdatedFirstName: string;\r\n userUpdatedLastName: string;\r\n}\r\n\r\nexport class VisitAnesthesiaFormPostSurgeryModel extends Model implements ModelRecord {\r\n visitAnesthesiaFormPostSurgeryId: number;\r\n startTime: string;\r\n stopTime: string;\r\n timeOfExtubation: string;\r\n qualityOfRecovery: string;\r\n surgeryNote: string;\r\n vitals: VisitAnesthesiaFormPostSurgeryVitalModel[] = [];\r\n dateCreated: DateTime;\r\n dateUpdated: DateTime;\r\n userUpdatedTitle: string;\r\n userUpdatedFirstName: string;\r\n userUpdatedLastName: string;\r\n vitalsLength: number;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.visitAnesthesiaFormPostSurgeryId = _.defaultTo(params?.visitAnesthesiaFormPostSurgeryId, 0);\r\n this.startTime = _.defaultTo(params?.startTime, '');\r\n this.stopTime = _.defaultTo(params?.stopTime, '');\r\n this.timeOfExtubation = _.defaultTo(params?.timeOfExtubation, '');\r\n this.qualityOfRecovery = _.defaultTo(params?.qualityOfRecovery, '');\r\n this.surgeryNote = _.defaultTo(params?.surgeryNote, '');\r\n this.vitalsLength = params?.vitals?.length || 0;\r\n _.map(params?.vitals, (m) => { this.vitals.push(new VisitAnesthesiaFormPostSurgeryVitalModel(m)) });\r\n this.vitals = [...addDummyColumns(this.vitals.length, postSurgeryDummyColumn), ...this.vitals];\r\n if (!this.stopTime && this.vitalsLength >= 25) {\r\n this.vitals.push(postSurgeryDummyColumn(this.vitalsLength + 1))\r\n }\r\n this.vitals.sort((a, b) => Number(a.interval) - Number(b.interval));\r\n this.dateCreated = params?.dateCreated ? DateTime.fromISO(params.dateCreated, { zone: \"utc\" }) : DateTime.min();\r\n this.dateUpdated = params?.dateUpdated ? DateTime.fromISO(params.dateUpdated, { zone: \"utc\" }) : DateTime.min();\r\n this.userUpdatedTitle = _.defaultTo(params?.userUpdatedTitle, \"\");\r\n this.userUpdatedFirstName = _.defaultTo(params?.userUpdatedFirstName, \"\");\r\n this.userUpdatedLastName = _.defaultTo(params?.userUpdatedLastName, \"\");\r\n }\r\n\r\n}\r\n","import { MedicationTypeModel, IMedicationTypeModel, IModel, Model, ModelRecord } from \"@common/models\"\r\n\r\nexport interface IVisitAnesthesiaFormPreOpMedicationModel extends IModel {\r\n visitAnesthesiaFormPreOpMedicationId: number;\r\n visitAnesthesiaFormPreOpId: number;\r\n medicationTypeId: number;\r\n salesItemId: number;\r\n dose: string;\r\n totalAmount: string;\r\n route: string;\r\n site: string;\r\n timeAdmin: string;\r\n initials: string;\r\n notes: string;\r\n medicationType: IMedicationTypeModel;\r\n rowIndex: number; //this is a client side property only to track index of the collection for inline editing.\r\n\r\n}\r\n\r\nexport class VisitAnesthesiaFormPreOpMedicationModel extends Model implements ModelRecord {\r\n visitAnesthesiaFormPreOpMedicationId: number;\r\n visitAnesthesiaFormPreOpId: number;\r\n medicationTypeId: number;\r\n salesItemId: number;\r\n dose: string;\r\n totalAmount: string;\r\n route: string;\r\n site: string;\r\n timeAdmin: string;\r\n initials: string;\r\n notes: string;\r\n medicationType: MedicationTypeModel;\r\n rowIndex: number;\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.visitAnesthesiaFormPreOpMedicationId = _.defaultTo(params?.visitAnesthesiaFormPreOpMedicationId, 0);\r\n this.visitAnesthesiaFormPreOpId = _.defaultTo(params?.visitAnesthesiaFormPreOpId, 0);\r\n this.medicationTypeId = _.defaultTo(params?.medicationTypeId, 0);\r\n this.salesItemId = _.defaultTo(params?.salesItemId, 0);\r\n this.dose = _.defaultTo(params?.dose, '');\r\n this.totalAmount = _.defaultTo(params?.totalAmount, '');\r\n this.route = _.defaultTo(params?.route, '');\r\n this.site = _.defaultTo(params?.site, '');\r\n this.timeAdmin = _.defaultTo(params?.timeAdmin, '');\r\n this.initials = _.defaultTo(params?.initials, '');\r\n this.notes = _.defaultTo(params?.notes, '');\r\n this.medicationType = params?.medicationType ? new MedicationTypeModel(params.medicationType) : new MedicationTypeModel();\r\n this.rowIndex = _.defaultTo(params?.rowIndex, 0);\r\n }\r\n\r\n}\r\n","import { IModel, Model, ModelRecord } from \"@common/models\"\r\nimport { StringUtility } from \"@common/utils\";\r\nimport { DateTime } from \"luxon\";\r\nexport interface IVisitAnesthesiaFormSurgeryVitalModel extends IModel {\r\n visitAnesthesiaFormSurgeryVitalId: number;\r\n visitAnesthesiaFormSurgeryId: number;\r\n fluidRate: string;\r\n anesthesiaDepth: string;\r\n iso: string;\r\n o2Flow: string;\r\n hr: string;\r\n sP02: string;\r\n temperature: string;\r\n rr: string;\r\n etcO2: string;\r\n mm: string;\r\n systolic: string;\r\n diastolic: string;\r\n map: string;\r\n interval: number;\r\n dateCreated: string | undefined;\r\n dateUpdated: string | undefined;\r\n}\r\n\r\nexport class VisitAnesthesiaFormSurgeryVitalModel extends Model implements ModelRecord {\r\n visitAnesthesiaFormSurgeryVitalId: number;\r\n visitAnesthesiaFormSurgeryId: number;\r\n fluidRate: string;\r\n anesthesiaDepth: string;\r\n iso: string;\r\n o2Flow: string;\r\n hr: string;\r\n sP02: string;\r\n temperature: string;\r\n rr: string;\r\n etcO2: string;\r\n mm: string;\r\n systolic: string;\r\n diastolic: string;\r\n map: string;\r\n interval: number;\r\n dateCreated: DateTime | undefined;\r\n dateUpdated: DateTime | undefined;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.visitAnesthesiaFormSurgeryVitalId = _.defaultTo(params?.visitAnesthesiaFormSurgeryVitalId, 0);\r\n this.visitAnesthesiaFormSurgeryId = _.defaultTo(params?.visitAnesthesiaFormSurgeryId, 0);\r\n this.fluidRate = _.defaultTo(params?.fluidRate, '');\r\n this.anesthesiaDepth = _.defaultTo(params?.anesthesiaDepth, '');\r\n this.iso = _.defaultTo(params?.iso, '');\r\n this.o2Flow = _.defaultTo(params?.o2Flow, '');\r\n this.hr = _.defaultTo(params?.hr, '');\r\n this.sP02 = _.defaultTo(params?.sP02, '');\r\n this.temperature = _.defaultTo(params?.temperature, '');\r\n this.rr = _.defaultTo(params?.rr, '');\r\n this.etcO2 = _.defaultTo(params?.etcO2, '');\r\n this.mm = _.defaultTo(params?.mm, '');\r\n this.systolic = _.defaultTo(params?.systolic, '');\r\n this.diastolic = _.defaultTo(params?.diastolic, '');\r\n this.map = _.defaultTo(params?.map, '');\r\n this.interval = _.defaultTo(params?.interval, 0);\r\n this.dateCreated = StringUtility.SanitizeDateTimeISOAsUtc(params?.dateCreated);\r\n this.dateUpdated = StringUtility.SanitizeDateTimeISOAsUtc(params?.dateUpdated);\r\n\r\n }\r\n\r\n}\r\n","import { IModel, Model, ModelRecord } from \"@common/models\"\r\nimport { StringUtility } from \"@common/utils\";\r\nimport { DateTime } from \"luxon\";\r\n\r\nexport interface IVisitAnesthesiaFormPostSurgeryVitalModel extends IModel {\r\n visitAnesthesiaFormPostSurgeryVitalId: number;\r\n visitAnesthesiaFormPostSurgeryId: number;\r\n temperature: string;\r\n hr: string;\r\n rr: string;\r\n painScore: string;\r\n interval: number;\r\n dateCreated: string | undefined;\r\n dateUpdated: string | undefined;\r\n}\r\n\r\nexport class VisitAnesthesiaFormPostSurgeryVitalModel extends Model implements ModelRecord {\r\n visitAnesthesiaFormPostSurgeryVitalId: number;\r\n visitAnesthesiaFormPostSurgeryId: number;\r\n temperature: string;\r\n hr: string;\r\n rr: string;\r\n painScore: string;\r\n interval: number;\r\n dateCreated: DateTime | undefined;\r\n dateUpdated: DateTime | undefined;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.visitAnesthesiaFormPostSurgeryVitalId = _.defaultTo(params?.visitAnesthesiaFormPostSurgeryVitalId, 0);\r\n this.visitAnesthesiaFormPostSurgeryId = _.defaultTo(params?.visitAnesthesiaFormPostSurgeryId, 0);\r\n this.temperature = _.defaultTo(params?.temperature, '');\r\n this.hr = _.defaultTo(params?.hr, '');\r\n this.rr = _.defaultTo(params?.rr, '');\r\n this.painScore = _.defaultTo(params?.painScore, '');\r\n this.interval = _.defaultTo(params?.interval, 0);\r\n this.dateCreated = StringUtility.SanitizeDateTimeISOAsUtc(params?.dateCreated);\r\n this.dateUpdated = StringUtility.SanitizeDateTimeISOAsUtc(params?.dateUpdated);\r\n\r\n }\r\n\r\n}\r\n","import { IModel, Model, ModelRecord } from \"./Model\";\r\n\r\nexport interface IMedicationTypeModel extends IModel {\r\n medicationTypeId: number;\r\n name: string;\r\n \r\n}\r\n\r\nexport class MedicationTypeModel extends Model implements ModelRecord {\r\n medicationTypeId: number;\r\n name: string;\r\n \r\n constructor(params?: Partial) {\r\n super(params);\r\n\r\n this.medicationTypeId = _.defaultTo(params?.medicationTypeId, 0);\r\n this.name = _.defaultTo(params?.name, '');\r\n \r\n }\r\n}\r\n","export interface IStorageContentModel {\r\n storageContentId: number;\r\n storageContentUrl: string;\r\n container: string;\r\n fileName: string;\r\n}\r\nexport class StorageContentModel implements IStorageContentModel {\r\n storageContentId: number;\r\n storageContentUrl: string;\r\n container: string;\r\n fileName: string;\r\n\r\n constructor(params: Partial = {} as IStorageContentModel) {\r\n const {\r\n storageContentId = 0,\r\n storageContentUrl = \"\",\r\n container = \"\",\r\n fileName = \"\"\r\n } = params;\r\n\r\n this.storageContentId = storageContentId;\r\n this.storageContentUrl = storageContentUrl;\r\n this.container = container;\r\n this.fileName = fileName;\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { AutoRecommendationTypeModel, RecommendationTypeModel } from \".\";\r\nimport { IModel, Model, ModelRecord, } from \"./Model\";\r\nimport { StorageContentModel } from \"./StorageContentModel\";\r\n\r\nexport interface IAssessmentRecommendationModel extends IModel {\r\n assessmentRecommendationId: number;\r\n assessmentReferralId: number;\r\n name: string;\r\n description: string;\r\n sortOrder: number;\r\n isActive: boolean;\r\n\r\n attachmentStorageContentId: number | undefined;\r\n attachmentStorageContent: StorageContentModel | undefined;\r\n\r\n recommendationTypeId: number;\r\n recommendationType: RecommendationTypeModel | undefined;\r\n\r\n autoRecommendationTypeId: number;\r\n autoRecommendationType: AutoRecommendationTypeModel | undefined;\r\n autoRecommendationValue: string;\r\n}\r\n\r\nexport class AssessmentRecommendationModel extends Model implements ModelRecord {\r\n assessmentRecommendationId: number;\r\n assessmentReferralId: number;\r\n name: string;\r\n description: string;\r\n sortOrder: number;\r\n isActive: boolean;\r\n\r\n attachmentStorageContentId: number | undefined;\r\n attachmentStorageContent: StorageContentModel | undefined;\r\n\r\n recommendationTypeId: number;\r\n recommendationType: RecommendationTypeModel | undefined;\r\n\r\n autoRecommendationTypeId: number;\r\n autoRecommendationType: AutoRecommendationTypeModel | undefined;\r\n autoRecommendationValue: string;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.assessmentRecommendationId = defaultTo(params?.assessmentRecommendationId, 0);\r\n this.assessmentReferralId = defaultTo(params?.assessmentReferralId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n this.description = defaultTo(params?.description, '');\r\n this.sortOrder = defaultTo(params?.sortOrder, 999);\r\n this.isActive = defaultTo(params?.isActive, true);\r\n\r\n this.attachmentStorageContentId = defaultTo(params?.attachmentStorageContentId, undefined);\r\n this.attachmentStorageContent = params?.attachmentStorageContent ? new StorageContentModel(params.attachmentStorageContent) : undefined;\r\n\r\n this.recommendationTypeId = defaultTo(params?.recommendationTypeId, 0);\r\n this.recommendationType = params?.recommendationType ? new RecommendationTypeModel(params?.recommendationType) : undefined;\r\n\r\n this.autoRecommendationTypeId = defaultTo(params?.autoRecommendationTypeId, 0);\r\n this.autoRecommendationType = params?.autoRecommendationType ? new AutoRecommendationTypeModel(params?.autoRecommendationType) : undefined;\r\n this.autoRecommendationValue = defaultTo(params?.autoRecommendationValue, '');\r\n }\r\n}\r\n","import { defaultTo, map } from \"lodash\";\r\nimport { AssessmentRecommendationModel, IModel, Model, ModelRecord, StorageContentModel } from \"@common/models\";\r\n\r\nexport interface IAssessmentReferralModel extends IModel {\r\n assessmentReferralId: number;\r\n name: string;\r\n description: string;\r\n sortOrder: number;\r\n isActive: boolean;\r\n attachmentStorageContentId: number | undefined;\r\n attachmentStorageContent: StorageContentModel | undefined;\r\n assessmentRecommendations: AssessmentRecommendationModel[];\r\n}\r\n\r\nexport class AssessmentReferralModel extends Model implements ModelRecord {\r\n assessmentReferralId: number;\r\n name: string;\r\n description: string;\r\n sortOrder: number;\r\n isActive: boolean;\r\n attachmentStorageContentId: number | undefined;\r\n attachmentStorageContent: StorageContentModel | undefined;\r\n assessmentRecommendations: AssessmentRecommendationModel[] = [];\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.assessmentReferralId = defaultTo(params?.assessmentReferralId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n this.description = defaultTo(params?.description, '');\r\n this.sortOrder = defaultTo(params?.sortOrder, 0);\r\n this.isActive = defaultTo(params?.isActive, true);\r\n this.attachmentStorageContentId = defaultTo(params?.attachmentStorageContentId, undefined);\r\n this.attachmentStorageContent = params?.attachmentStorageContent ? new StorageContentModel(params.attachmentStorageContent) : undefined;\r\n map(params?.assessmentRecommendations, (ar) => { this.assessmentRecommendations.push(new AssessmentRecommendationModel(ar)) });\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model, ModelRecord } from \"./Model\";\r\n\r\nexport interface IAutoRecommendationTypeModel extends IModel {\r\n autoRecommendationTypeId: number;\r\n name: string;\r\n isActive: boolean;\r\n needsValue: boolean;\r\n}\r\n\r\nexport class AutoRecommendationTypeModel extends Model implements ModelRecord {\r\n autoRecommendationTypeId: number;\r\n name: string;\r\n isActive: boolean;\r\n needsValue: boolean;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.autoRecommendationTypeId = defaultTo(params?.autoRecommendationTypeId, 0);\r\n this.name = defaultTo(params?.name, \"\");\r\n this.isActive = defaultTo(params?.isActive, true);\r\n this.needsValue = defaultTo(params?.needsValue, false);\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model, ModelRecord } from \".\";\r\n\r\nexport interface IAutoAddToVisitTypeModel extends IModel {\r\n autoAddToVisitTypeId: number;\r\n name: string;\r\n}\r\n\r\nexport class AutoAddToVisitTypeModel extends Model implements ModelRecord {\r\n autoAddToVisitTypeId: number;\r\n name: string;\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.autoAddToVisitTypeId = defaultTo(params?.autoAddToVisitTypeId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n }\r\n}\r\n","export interface IBlobSasModel {\r\n modelId: number,\r\n modelTypeName: string,\r\n fileName: string,\r\n container: string,\r\n sasUrl: string,\r\n sasToken: string,\r\n issueDate: string\r\n}\r\n\r\nexport class BlobSasModel implements IBlobSasModel {\r\n modelId: number;\r\n modelTypeName: string;\r\n fileName: string;\r\n container: string;\r\n sasUrl: string;\r\n sasToken: string;\r\n issueDate: string;\r\n\r\n constructor(params: Partial = {}) {\r\n const {\r\n modelId = 0,\r\n modelTypeName = '',\r\n fileName = '',\r\n container = '',\r\n sasUrl = '',\r\n sasToken = '',\r\n issueDate = ''\r\n } = params;\r\n\r\n this.modelId = modelId;\r\n this.modelTypeName = modelTypeName;\r\n this.fileName = fileName;\r\n this.container = container;\r\n this.sasUrl = sasUrl;\r\n this.sasToken = sasToken;\r\n this.issueDate = issueDate;\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, ModelRecord } from \".\";\r\n\r\nexport interface IBrandModel extends IModel {\r\n brandId: number;\r\n name: string;\r\n sourceSystemKey: string | undefined;\r\n sourceSystemId: number;\r\n}\r\n\r\nexport interface IBrandModelUIFields {\r\n legalBackerHTML: string | undefined;//UI Only field\r\n}\r\n\r\nexport class BrandModel implements ModelRecord {\r\n rowVersion: string;\r\n brandId: number;\r\n name: string;\r\n sourceSystemKey: string | undefined;\r\n sourceSystemId: number;\r\n legalBackerHTML: string | undefined;//UI Only field\r\n\r\n constructor(init?: Partial) {\r\n this.rowVersion = defaultTo(init?.rowVersion, '');\r\n this.brandId = defaultTo(init?.brandId, 0);\r\n this.name = defaultTo(init?.name, '');\r\n this.sourceSystemKey = defaultTo(init?.sourceSystemKey, '');\r\n this.sourceSystemId = defaultTo(init?.sourceSystemId, 0);\r\n this.legalBackerHTML = defaultTo(init?.legalBackerHTML, undefined);\r\n }\r\n}\r\n","import { IPGRBreedModel, ISpeciesModel, IIdexxBreedModel, PGRBreedModel, SpeciesModel, IdexxBreedModel } from \".\";\r\nimport { defaultTo } from \"lodash\";\r\nimport { IModel, Model, ModelRecord, } from \"./Model\";\r\n\r\nexport interface IBreedModel extends IModel {\r\n breedId: number;\r\n name: string;\r\n speciesId: number;\r\n species: ISpeciesModel;\r\n pgrBreed: IPGRBreedModel;\r\n pgrBreedId: number;\r\n idexxBreedId: number;\r\n idexxBreed: IIdexxBreedModel;\r\n}\r\n\r\nexport class BreedModel extends Model implements ModelRecord {\r\n breedId: number;\r\n name: string;\r\n speciesId: number;\r\n species: SpeciesModel;\r\n pgrBreedId: number;\r\n pgrBreed: PGRBreedModel;\r\n idexxBreedId: number;\r\n idexxBreed: IdexxBreedModel;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.breedId = defaultTo(params?.breedId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n this.speciesId = defaultTo(params?.speciesId, 0);\r\n this.species = params?.species ? new SpeciesModel(params.species) : new SpeciesModel();\r\n this.pgrBreedId = defaultTo(params?.pgrBreedId, 0);\r\n this.pgrBreed = params?.pgrBreed ? new PGRBreedModel(params.pgrBreed) : new PGRBreedModel();\r\n this.idexxBreedId = defaultTo(params?.idexxBreedId, 0);\r\n this.idexxBreed = params?.idexxBreed ? new IdexxBreedModel(params.idexxBreed) : new IdexxBreedModel();\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model, ModelRecord } from \"./Model\";\r\n\r\nexport interface IBusinessLineModel extends IModel {\r\n businessLineId: number;\r\n name: string;\r\n \r\n}\r\n\r\nexport class BusinessLineModel extends Model implements ModelRecord {\r\n businessLineId: number;\r\n name: string;\r\n \r\n constructor(params?: Partial) {\r\n super(params);\r\n\r\n this.businessLineId = defaultTo(params?.businessLineId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n \r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model, ModelRecord } from \"./Model\";\r\n\r\nexport interface ICallCodeModel extends IModel {\r\n callCodeId: number;\r\n name: string;\r\n isSystemGenerated: boolean;\r\n}\r\n\r\nexport class CallCodeModel extends Model implements ModelRecord {\r\n callCodeId: number;\r\n name: string;\r\n isSystemGenerated: boolean;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n\r\n this.callCodeId = defaultTo(params?.callCodeId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n this.isSystemGenerated = defaultTo(params?.isSystemGenerated, false);\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model, ModelRecord } from \"./Model\";\r\n\r\nexport interface ICallOriginModel extends IModel {\r\n callOriginId: number;\r\n name: string;\r\n isSystemGenerated: boolean;\r\n}\r\n\r\nexport class CallOriginModel extends Model implements ModelRecord {\r\n callOriginId: number;\r\n name: string;\r\n isSystemGenerated: boolean;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n\r\n this.callOriginId = defaultTo(params?.callOriginId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n this.isSystemGenerated = defaultTo(params?.isSystemGenerated, false);\r\n }\r\n}\r\n","\r\nexport interface IClientListingModel {\r\n ClientId: string, //2\r\n FirstName: string, //Joe\r\n LastName: string, //Jones\r\n FullName: string //Jones, Joe,\r\n AlternatePetParentName: string //Sam,\r\n EmailAddress: string, //joejones@gmail.com,\r\n HomePhone: string, //123-123-1234\r\n CellPhone: string, //123-123-1234\r\n AlternatePhone: string,//123-123-1234\r\n Address: string, //123 Elm St,\r\n Address2: string, //Apt 1,\r\n City: string, //New York,\r\n State: string, //NY,\r\n LastVisitDate: string | undefined,\r\n CanCall: boolean,\r\n CanSMS: boolean,\r\n IsActive: boolean,\r\n /* Other fields in search result but not used. */\r\n //\"ExternalSystemName\":undefined,\r\n //\"ExternalSystemId\":undefined,\r\n //\"ExternalSystemUri\":undefined,\r\n //\"@search.score\":1.6099695,\r\n //\"IsOKToSMS\":true,\r\n //\"PALSNumber\":undefined,\r\n //\"IsOKToSMSCellPhone\":false,\r\n //\"IsOKToSMSHomePhone\":false,\r\n //\"IsOKToSMSAlternatePhone\":false,\r\n //\"PGRMasterId\":undefined,\r\n //\"ClientIds\":[]\r\n}\r\n\r\nexport class ClientListingModel implements IClientListingModel {\r\n ClientId: string;\r\n FirstName: string;\r\n LastName: string;\r\n FullName: string;\r\n AlternatePetParentName: string;\r\n EmailAddress: string;\r\n HomePhone: string;\r\n CellPhone: string;\r\n AlternatePhone: string;\r\n Address: string;\r\n Address2: string;\r\n City: string;\r\n State: string;\r\n LastVisitDate: string | undefined;\r\n CanCall: boolean;\r\n CanSMS: boolean;\r\n IsActive: boolean;\r\n\r\n constructor(params: IClientListingModel) {\r\n this.ClientId = params.ClientId;\r\n this.FirstName = params.FirstName;\r\n this.LastName = params.LastName;\r\n this.FullName = params.FullName;\r\n this.AlternatePetParentName = params.AlternatePetParentName;\r\n this.EmailAddress = params.EmailAddress;\r\n this.HomePhone = params.HomePhone;\r\n this.CellPhone = params.CellPhone;\r\n this.AlternatePhone = params.AlternatePhone;\r\n this.Address = params.Address;\r\n this.Address2 = params.Address2;\r\n this.City = params.City;\r\n this.State = params.State;\r\n this.LastVisitDate = params.LastVisitDate;\r\n this.CanCall = params.CanCall;\r\n this.CanSMS = params.CanSMS;\r\n this.IsActive = params.IsActive;\r\n }\r\n}\r\n","export interface IClientVerificationRequest {\r\n phone: string;\r\n email: string;\r\n}\r\n\r\nexport class ClientVerificationRequest implements IClientVerificationRequest {\r\n phone: string;\r\n email: string;\r\n\r\n constructor(params: Partial = {}) {\r\n const {\r\n phone = '',\r\n email = ''\r\n } = params;\r\n\r\n this.phone = phone;\r\n this.email = email;\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model, ModelRecord } from \"@common/models\";\r\nimport { DateTime } from \"luxon\";\r\n\r\nexport interface IClinicIncentiveModel extends IModel {\r\n clinicIncentiveId: number;\r\n clinicIncentivePeriodId: number;\r\n storeId: number;\r\n targetAOV: number;\r\n partnerPayout: number;\r\n storeCode: string;\r\n dispatchDistrict: string;\r\n state: string;\r\n periodName: string;\r\n startDate: string | null;\r\n endDate: string | null;\r\n}\r\n\r\nexport class ClinicIncentiveModel extends Model implements ModelRecord {\r\n clinicIncentiveId: number;\r\n clinicIncentivePeriodId: number;\r\n storeId: number;\r\n targetAOV: number;\r\n partnerPayout: number;\r\n storeCode: string;\r\n dispatchDistrict: string;\r\n state: string;\r\n periodName: string;\r\n startDate: DateTime | undefined;\r\n endDate: DateTime | undefined;\r\n\r\n constructor(params?: IClinicIncentiveModel) {\r\n super(params);\r\n this.clinicIncentiveId = defaultTo(params?.clinicIncentiveId, 0);\r\n this.clinicIncentivePeriodId = defaultTo(params?.clinicIncentivePeriodId, 0);\r\n this.storeId = defaultTo(params?.storeId, 0);\r\n this.targetAOV = defaultTo(params?.targetAOV, 0.0);\r\n this.partnerPayout = defaultTo(params?.partnerPayout, 0.0);\r\n this.storeCode = defaultTo(params?.storeCode, '');\r\n this.dispatchDistrict = defaultTo(params?.dispatchDistrict, '');\r\n this.state = defaultTo(params?.state, '');\r\n this.periodName = defaultTo(params?.periodName, '');\r\n this.startDate = (params?.startDate) ? DateTime.fromISO(params?.startDate, { zone: \"utc\" }) : undefined;\r\n this.endDate = (params?.endDate) ? DateTime.fromISO(defaultTo(params?.endDate, \"2000-01-01\"), { zone: \"utc\" }) : undefined;\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\"\r\nimport { IModel, Model, ModelRecord } from \"./Model\"\r\n\r\nexport interface IClinicIncentivePeriodModel extends IModel {\r\n clinicIncentivePeriodId: number;\r\n name: string;\r\n startDate: string;\r\n endDate: string|undefined; \r\n}\r\n\r\nexport class ClinicIncentivePeriodModel extends Model implements ModelRecord {\r\n clinicIncentivePeriodId: number;\r\n name: string;\r\n startDate: string;\r\n endDate: string|undefined;\r\n \r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.clinicIncentivePeriodId = defaultTo(params?.clinicIncentivePeriodId, 0);\r\n this.name = defaultTo(params?.name, \"\");\r\n this.startDate = defaultTo(params?.startDate, \"\");\r\n this.endDate = defaultTo(params?.endDate, undefined);\r\n }\r\n}\r\n","import { StringUtility } from \"@common/utils\";\r\nimport { IModel, ModelRecord, Model } from './Model';\r\nimport { defaultTo } from \"lodash\";\r\n\r\nexport interface IClinicRoleTypeModel extends IModel {\r\n clinicRoleTypeId: number,\r\n name: string | undefined\r\n}\r\n\r\nexport class ClinicRoleTypeModel extends Model implements ModelRecord {\r\n clinicRoleTypeId: number;\r\n name: string | undefined; \r\n constructor(params?: Partial) {\r\n super(params);\r\n this.clinicRoleTypeId = defaultTo(params?.clinicRoleTypeId, 0); \r\n this.name = StringUtility.SanitizeStringWithEmpty(defaultTo(params?.name, ''));\r\n }\r\n}\r\n","import { ClinicRoleTypeModel, IClinicRoleTypeModel } from './ClinicRoleTypeModel';\r\nimport { IModel, ModelRecord, Model } from './Model';\r\nimport { defaultTo } from \"lodash\";\r\n\r\nexport interface IClinicRoleModel extends IModel {\r\n clinicRoleId: number;\r\n name: string | undefined;\r\n displayName: string | undefined;\r\n abbreviation: string | undefined;\r\n desiredMaxUsers: number;\r\n isVetAssistant: boolean;\r\n isDVM: boolean;\r\n clinicRoleTypeId: number;\r\n sortOrder: number;\r\n clinicRoleType: IClinicRoleTypeModel;\r\n}\r\n\r\nexport class ClinicRoleModel extends Model implements ModelRecord {\r\n clinicRoleId: number;\r\n name: string | undefined;\r\n displayName: string | undefined;\r\n abbreviation: string | undefined;\r\n desiredMaxUsers: number;\r\n isVetAssistant: boolean;\r\n isDVM: boolean;\r\n clinicRoleTypeId: number;\r\n sortOrder: number;\r\n clinicRoleType: ClinicRoleTypeModel;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.clinicRoleId = defaultTo(params?.clinicRoleId, 0); \r\n this.name = defaultTo(params?.name, '');\r\n this.displayName = defaultTo(params?.displayName, '');\r\n this.abbreviation = defaultTo(params?.abbreviation, '');\r\n this.desiredMaxUsers = defaultTo(params?.desiredMaxUsers, 0);\r\n this.isVetAssistant = defaultTo(params?.isVetAssistant, false);\r\n this.isDVM = defaultTo(params?.isDVM, false);\r\n this.clinicRoleTypeId = defaultTo(params?.clinicRoleTypeId, 0);\r\n this.sortOrder = defaultTo(params?.sortOrder, 0);\r\n this.clinicRoleType = params?.clinicRoleType ? new ClinicRoleTypeModel(params?.clinicRoleType) : new ClinicRoleTypeModel();\r\n }\r\n\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { DateTime } from \"luxon\";\r\nimport { IModel, ISalesItemModel, Model, SalesItemModel } from \".\";\r\n\r\nexport interface IClinicSalesItems extends IModel {\r\n clinicId: number;\r\n salesDate: string;\r\n salesItems: ISalesItemModel[];\r\n}\r\n\r\nexport class ClinicSalesItems extends Model implements Record{\r\n clinicId: number;\r\n salesDate: DateTime;\r\n salesItems: SalesItemModel[];\r\n\r\n constructor(params: Partial) {\r\n super(params);\r\n this.clinicId = defaultTo(params.clinicId, 0);\r\n this.salesDate = DateTime.fromISO(defaultTo(params.salesDate, \"2000-01-01\"), { zone: \"utc\" })\r\n this.salesItems = (params.salesItems ?? []).map(si => new SalesItemModel(si));\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\"\r\nimport { IModel, Model, ModelRecord } from \"./Model\"\r\n\r\nexport interface IClinicTaskTypeModel extends IModel {\r\n clinicTaskTypeId: number;\r\n name: string;\r\n description: string;\r\n defaultDurationMins: number;\r\n isActive: boolean;\r\n}\r\n\r\nexport class ClinicTaskTypeModel extends Model implements ModelRecord {\r\n clinicTaskTypeId: number;\r\n name: string;\r\n description: string;\r\n defaultDurationMins: number;\r\n isActive: boolean;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.clinicTaskTypeId = defaultTo(params?.clinicTaskTypeId, 0);\r\n this.name = defaultTo(params?.name, \"\");\r\n this.description = defaultTo(params?.description, \"\");\r\n this.defaultDurationMins = defaultTo(params?.defaultDurationMins, 0);\r\n this.isActive = defaultTo(params?.isActive, true);\r\n }\r\n}\r\n","export interface IClinicUserListingModel {\r\n userId: number\r\n clinicId: number\r\n storeId: number\r\n storeCode: string | undefined\r\n scheduledStartDate: string | undefined\r\n address: string | undefined\r\n marketName: string | undefined\r\n joinedDate: string | undefined\r\n}\r\n\r\nexport class ClinicUserListingModel implements IClinicUserListingModel {\r\n userId: number;\r\n clinicId: number;\r\n storeId: number;\r\n storeCode: string | undefined;\r\n scheduledStartDate: string | undefined;\r\n address: string | undefined;\r\n marketName: string | undefined;\r\n joinedDate: string | undefined;\r\n\r\n constructor(params: Partial) {\r\n const {\r\n userId = 0,\r\n clinicId = 0,\r\n storeId = 0,\r\n storeCode = undefined,\r\n scheduledStartDate = undefined,\r\n address = undefined,\r\n marketName = undefined,\r\n joinedDate = undefined\r\n } = params;\r\n\r\n this.userId = userId;\r\n this.clinicId = clinicId;\r\n this.storeId = storeId;\r\n this.storeCode = storeCode;\r\n this.scheduledStartDate = scheduledStartDate;\r\n this.address = address;\r\n this.marketName = marketName;\r\n this.joinedDate = joinedDate;\r\n }\r\n}\r\n","export interface IPhotoRequest {\r\n container: string;\r\n fileName: string;\r\n photoUrl: string;\r\n}\r\n\r\nexport interface IPhotoModel extends IPhotoRequest {\r\n photoId: number;\r\n processedPhotoBaseUrl: string\r\n}\r\n\r\nexport class PhotoModel implements IPhotoModel {\r\n photoId: number;\r\n container: string;\r\n fileName: string;\r\n photoUrl: string;\r\n processedPhotoBaseUrl: string;\r\n\r\n constructor(params: Partial = {}) {\r\n const {\r\n photoId = 0,\r\n container = '',\r\n fileName = '',\r\n photoUrl = '',\r\n processedPhotoBaseUrl = '',\r\n } = params;\r\n\r\n this.photoId = photoId;\r\n this.container = container;\r\n this.fileName = fileName;\r\n this.photoUrl = photoUrl;\r\n this.processedPhotoBaseUrl = processedPhotoBaseUrl;\r\n }\r\n}\r\n","import {\r\n\tIHospitalScheduleModel,\r\n\tHospitalScheduleModel,\r\n\tILicenseModel,\r\n\tIVeterinarianSignatureModel,\r\n\tLicenseModel,\r\n\tVeterinarianSignatureModel,\r\n\tschedule,\r\n} from \"@common/models\";\r\nimport { computed, makeObservable, observable } from \"mobx\";\r\nimport { IModel } from \"@common/models/Model\";\r\nimport { petcoPewterBlue } from \"@common/_assets/color-constants.js\";\r\n\r\nexport interface IVeterinarianModel extends IModel {\r\n\tveterinarianId: number;\r\n\ttitle: string;\r\n\tfirstName: string;\r\n\tlastName: string;\r\n\temail: string;\r\n\tusername: string;\r\n\tschedulingColor: string;\r\n\tlicenses: ILicenseModel[];\r\n\tactiveSignature: IVeterinarianSignatureModel | undefined;\r\n\tschedulePreferences: schedule.EntitySchedulePreference[];\r\n\thospitalSchedules: IHospitalScheduleModel[] | undefined;\r\n\tpetcoUserId: string;\r\n\tfullName: string | undefined;\r\n}\r\n\r\nexport class VeterinarianModel implements IVeterinarianModel {\r\n\t@observable rowVersion: string;\r\n\t@observable veterinarianId: number;\r\n\t@observable title: string;\r\n\t@observable firstName: string;\r\n\t@observable lastName: string;\r\n\t@observable email: string;\r\n\t@observable username: string;\r\n\t@observable schedulingColor: string;\r\n\t@observable activeSignature: VeterinarianSignatureModel | undefined;\r\n\t@observable licenses: LicenseModel[] = [];\r\n\t@observable hospitalSchedules: HospitalScheduleModel[] = [];\r\n\t@observable schedulePreferences: schedule.EntitySchedulePreference[] = [];\r\n\t@observable petcoUserId: string;\r\n\t@observable fullName: string | undefined;\r\n\r\n\tconstructor(init?: Partial) {\r\n\t\tthis.rowVersion = _.defaultTo(init?.rowVersion, \"\");\r\n\t\tthis.veterinarianId = _.defaultTo(init?.veterinarianId, 0);\r\n\t\tthis.title = _.defaultTo(init?.title, \"\");\r\n\t\tthis.firstName = _.defaultTo(init?.firstName, \"\");\r\n\t\tthis.lastName = _.defaultTo(init?.lastName, \"\");\r\n\t\tthis.email = _.defaultTo(init?.email, \"\");\r\n\t\tthis.username = _.defaultTo(init?.username, \"\");\r\n\t\tthis.schedulingColor = _.defaultTo(init?.schedulingColor, petcoPewterBlue);\r\n\t\tthis.licenses = (init?.licenses ?? []).map(l => new LicenseModel(l));\r\n\t\tthis.activeSignature = init?.activeSignature ? new VeterinarianSignatureModel(init.activeSignature) : undefined;\r\n\t\tthis.hospitalSchedules = (init?.hospitalSchedules ?? []).map(sp => new HospitalScheduleModel(sp));\r\n\t\tthis.schedulePreferences = (init?.schedulePreferences ?? []).map(sp => new schedule.EntitySchedulePreference(sp));\r\n\t\tthis.petcoUserId = _.defaultTo(init?.petcoUserId, \"\");\r\n\t\tthis.fullName = _.defaultTo(init?.fullName, \"\");\r\n\r\n\t\tmakeObservable(this, undefined, { autoBind: true });\r\n\t}\r\n\r\n\t@computed get doctorTitle() {\r\n\t\treturn `${this.title ? this.title + \" \" : \"\"}${this.firstName} ${this.lastName}`;\r\n\t}\r\n}\r\n","import { DateTime } from \"luxon\";\r\nimport { IModel, Model, ModelRecord } from \"@common/models\"\r\nimport { StringUtility } from \"@common/utils\";\r\n\r\nexport interface ICommunicationPreferenceModel extends IModel {\r\n canSMS: boolean;\r\n canSMSDateUpdated: DateTime | undefined;\r\n canSMSUpdatedUserTitle: string;\r\n canSMSUpdatedUserFirstName: string;\r\n canSMSUpdatedUserLastName: string;\r\n canCall: boolean;\r\n canCallDateUpdated: DateTime | undefined;\r\n canCallUpdatedUserTitle: string;\r\n canCallUpdatedUserFirstName: string;\r\n canCallUpdatedUserLastName: string;\r\n storeTimeZone: string;\r\n phoneNumber: string;\r\n}\r\n\r\nexport class CommunicationPreferenceModel extends Model implements ModelRecord {\r\n canSMS: boolean;\r\n canSMSDateUpdated: DateTime | undefined;\r\n canSMSUpdatedUserTitle: string;\r\n canSMSUpdatedUserFirstName: string;\r\n canSMSUpdatedUserLastName: string;\r\n canCall: boolean;\r\n canCallDateUpdated: DateTime | undefined;\r\n canCallUpdatedUserTitle: string;\r\n canCallUpdatedUserFirstName: string;\r\n canCallUpdatedUserLastName: string;\r\n storeTimeZone: string;\r\n phoneNumber: string;\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.canSMS = _.defaultTo(params?.canSMS, true);\r\n this.canSMSDateUpdated = params?.canSMSDateUpdated ? StringUtility.SanitizeDateTimeISOAsUtc(params?.canSMSDateUpdated.toString()) : undefined;\r\n this.canSMSUpdatedUserTitle = _.defaultTo(params?.canSMSUpdatedUserTitle, '');\r\n this.canSMSUpdatedUserFirstName = _.defaultTo(params?.canSMSUpdatedUserFirstName, '');\r\n this.canSMSUpdatedUserLastName = _.defaultTo(params?.canSMSUpdatedUserLastName, '');\r\n this.canCall = _.defaultTo(params?.canCall, true);\r\n this.canCallDateUpdated = params?.canCallDateUpdated ? StringUtility.SanitizeDateTimeISOAsUtc(params?.canCallDateUpdated.toString()) : undefined;\r\n this.canCallUpdatedUserTitle = _.defaultTo(params?.canCallUpdatedUserTitle, '');\r\n this.canCallUpdatedUserFirstName = _.defaultTo(params?.canCallUpdatedUserFirstName, '');\r\n this.canCallUpdatedUserLastName = _.defaultTo(params?.canCallUpdatedUserLastName, '');\r\n this.storeTimeZone = _.defaultTo(params?.storeTimeZone, '');\r\n this.phoneNumber = _.defaultTo(params?.phoneNumber, '');\r\n }\r\n\r\n get canCallFullName() {\r\n if (this.canCallUpdatedUserFirstName && this.canCallUpdatedUserLastName)\r\n return StringUtility.formattedUserName(this.canCallUpdatedUserFirstName, this.canCallUpdatedUserLastName, this.canCallUpdatedUserTitle);\r\n else\r\n return undefined\r\n }\r\n get canSMSFullName() {\r\n if (this.canSMSUpdatedUserFirstName && this.canSMSUpdatedUserLastName)\r\n return StringUtility.formattedUserName(this.canSMSUpdatedUserFirstName, this.canSMSUpdatedUserLastName, this.canSMSUpdatedUserTitle);\r\n else\r\n return undefined\r\n }\r\n}\r\n","import { Model, IModel,ModelRecord } from \"./Model\";\r\nimport { defaultTo } from \"lodash\";\r\nexport interface ICommunicationTypeModel extends IModel {\r\n communicationTypeId: number,\r\n name: string | undefined\r\n}\r\n\r\n\r\n\r\nexport class CommunicationTypeModel extends Model implements ModelRecord {\r\n communicationTypeId: number;\r\n name: string | undefined;\r\n \r\n constructor(params?: Partial) {\r\n super(params);\r\n this.communicationTypeId = defaultTo(params?.communicationTypeId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { DateTime } from \"luxon\";\r\nimport { IModel, Model } from \"./Model\";\r\n\r\nexport interface IConsentModel extends IModel {\r\n consentId: number;\r\n consentTypeId: number;\r\n stateId: number | undefined;\r\n storeId: number | undefined;\r\n startDate: string;\r\n endDate: string | undefined;\r\n legalBackerHTML: string;\r\n consentTypePublicId: string;\r\n consentTypeAuthApplicationKey: string;\r\n consentTypeAuthApplicationDescription: string;\r\n consentTypeName: string;\r\n stateName: string | undefined;\r\n stateAbbreviation: string | undefined;\r\n storeCode: string | undefined;\r\n storeName: string | undefined;\r\n}\r\n\r\nexport class ConsentModel extends Model implements Record {\r\n consentId: number;\r\n consentTypeId: number;\r\n stateId: number | undefined;\r\n storeId: number | undefined;\r\n startDate: DateTime;\r\n endDate: DateTime | undefined;\r\n legalBackerHTML: string;\r\n consentTypePublicId: string;\r\n consentTypeAuthApplicationKey: string;\r\n consentTypeAuthApplicationDescription: string;\r\n consentTypeName: string;\r\n stateName: string | undefined;\r\n stateAbbreviation: string | undefined;\r\n storeCode: string | undefined;\r\n storeName: string | undefined;\r\n\r\n constructor(params: Partial) {\r\n super(params);\r\n this.consentId = defaultTo(params.consentId, 0);\r\n this.consentTypeId = defaultTo(params.consentTypeId, 0);\r\n this.stateId = params.stateId\r\n this.storeId = params.storeId\r\n this.startDate = DateTime.fromISO(defaultTo(params.startDate, \"2000-01-01\"), { zone: \"utc\" });\r\n this.endDate = params.endDate ? DateTime.fromISO(params.endDate, { zone: \"utc\" }) : undefined;\r\n this.legalBackerHTML = defaultTo(params.legalBackerHTML, \"\");\r\n this.consentTypePublicId = defaultTo(params.consentTypePublicId, \"\")\r\n this.consentTypeAuthApplicationKey = defaultTo(params.consentTypeAuthApplicationKey, \"\")\r\n this.consentTypeAuthApplicationDescription = defaultTo(params.consentTypeAuthApplicationDescription, \"\")\r\n this.consentTypeName = defaultTo(params.consentTypeName, \"\")\r\n this.stateName = params.stateName\r\n this.stateAbbreviation = params.stateAbbreviation\r\n this.storeCode = params.storeCode\r\n this.storeName = params.storeName\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model, ModelRecord } from \"./Model\";\r\n\r\nexport interface IDiagnosisModel extends IModel {\r\n diagnosisId: number;\r\n name: string;\r\n isActive: boolean;\r\n}\r\n\r\nexport class DiagnosisModel extends Model implements ModelRecord {\r\n diagnosisId: number;\r\n name: string;\r\n isActive: boolean;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n\r\n this.diagnosisId = defaultTo(params?.diagnosisId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n this.isActive = defaultTo(params?.isActive, true);\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model, ModelRecord } from \".\";\r\n\r\nexport interface IDiscountTypeModel extends IModel {\r\n discountTypeId: number;\r\n name: string;\r\n sortOrder: number;\r\n}\r\n\r\nexport class DiscountTypeModel extends Model implements ModelRecord {\r\n discountTypeId: number;\r\n name: string;\r\n sortOrder: number;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.discountTypeId = defaultTo(params?.discountTypeId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n this.sortOrder = defaultTo(params?.sortOrder, 0); \r\n }\r\n}\r\n","import { IModel, Model } from \".\";\r\n\r\nexport interface IDocumentTypeModel extends IModel {\r\n documentTypeId: number;\r\n description: string;\r\n}\r\n\r\nexport class DocumentTypeModel extends Model implements Record {\r\n documentTypeId: number;\r\n description: string;\r\n\r\n constructor(params: IDocumentTypeModel) {\r\n super(params);\r\n\r\n this.documentTypeId = params.documentTypeId;\r\n this.description = params.description;\r\n }\r\n}\r\n","\r\nexport interface IEnsurePetAlertsRequest {\r\n petId: number;\r\n PetAlertIds: number[];\r\n}\r\n\r\nexport class EnsurePetAlertsRequest implements IEnsurePetAlertsRequest {\r\n petId: number;\r\n PetAlertIds: number[] = [];\r\n\r\n constructor(params: Partial = {}) {\r\n const {\r\n petId = 0,\r\n PetAlertIds = [] as Array\r\n } = params;\r\n\r\n this.petId = petId;\r\n this.PetAlertIds = PetAlertIds;\r\n }\r\n}\r\n","import { ExamObservationModel, IExamObservationModel, AssessmentReferralModel, IAssessmentReferralModel, IModel, Model, ModelRecord, IBusinessLineModel, BusinessLineModel, ISpeciesModel, SpeciesModel } from \"@common/models\"\r\n\r\nexport interface IExamCategoryModel extends IModel {\r\n examCategoryId: number\r\n name: string\r\n sortOrder: number\r\n observations: IExamObservationModel[]\r\n assessmentReferralId: number | undefined;\r\n assessmentReferral: IAssessmentReferralModel | undefined;\r\n businessLineId: number;\r\n businessLine: IBusinessLineModel;\r\n species: ISpeciesModel[];\r\n}\r\n\r\nexport class ExamCategoryModel extends Model implements ModelRecord {\r\n examCategoryId: number;\r\n name: string;\r\n sortOrder: number;\r\n observations: ExamObservationModel[] = [];\r\n assessmentReferralId: number | undefined;\r\n assessmentReferral: AssessmentReferralModel | undefined;\r\n businessLineId: number;\r\n businessLine: BusinessLineModel;\r\n species: SpeciesModel[] = [];\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.examCategoryId = _.defaultTo(params?.examCategoryId, 0);\r\n this.name = _.defaultTo(params?.name, '');\r\n this.sortOrder = _.defaultTo(params?.sortOrder, 999);\r\n _.map(params?.observations, (o) => { this.observations.push(new ExamObservationModel(o)) });\r\n this.assessmentReferralId = _.defaultTo(params?.assessmentReferralId, undefined);\r\n this.assessmentReferral = params?.assessmentReferral ? new AssessmentReferralModel(params.assessmentReferral) : undefined;\r\n this.businessLineId = _.defaultTo(params?.businessLineId, 1);//default to Global\r\n this.businessLine = params?.businessLine ? new BusinessLineModel(params.businessLine) : new BusinessLineModel({ businessLineId: 1, name: \"Global\" });\r\n _.map(params?.species, (s) => { this.species.push(new SpeciesModel(s)) });\r\n \r\n }\r\n\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model,ModelRecord } from \"./Model\"\r\n\r\nexport interface IExamResultTypeModel extends IModel {\r\n examResultTypeId: number\r\n name: string\r\n}\r\n\r\nexport class ExamResultTypeModel extends Model implements ModelRecord {\r\n examResultTypeId: number;\r\n name: string;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.examResultTypeId = defaultTo(params?.examResultTypeId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n }\r\n}\r\n","import { IExamResultTypeModel, ExamResultTypeModel } from \"./ExamResultTypeModel\";\r\nimport { IModel, Model, ModelRecord, } from \"./Model\";\r\nimport { IBusinessLineModel, BusinessLineModel, ISpeciesModel, SpeciesModel } from \"@common/models\"\r\nexport interface IExamObservationModel extends IModel {\r\n examObservationId: number\r\n examCategoryId: number\r\n examResultTypeId: number\r\n name: string\r\n sortOrder: number\r\n examCategoryName: string\r\n examCategorySortOrder: number\r\n examResultType: IExamResultTypeModel | undefined\r\n businessLineId: number;\r\n businessLine: IBusinessLineModel;\r\n rowIndex: number; //this is a client side property only to track index of the collection for inline editing.\r\n species: ISpeciesModel[];\r\n}\r\n\r\nexport class ExamObservationModel extends Model implements ModelRecord {\r\n examObservationId: number;\r\n examCategoryId: number;\r\n examResultTypeId: number;\r\n name: string;\r\n sortOrder: number;\r\n examCategoryName: string;\r\n examCategorySortOrder: number;\r\n examResultType: ExamResultTypeModel | undefined;\r\n businessLineId: number;\r\n businessLine: BusinessLineModel;\r\n rowIndex: number;\r\n species: SpeciesModel[] = [];\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.examObservationId = _.defaultTo(params?.examObservationId, 0);\r\n this.examCategoryId = _.defaultTo(params?.examCategoryId, 0);\r\n this.examResultTypeId = _.defaultTo(params?.examResultTypeId, 0);\r\n this.name = _.defaultTo(params?.name, '');\r\n this.sortOrder = _.defaultTo(params?.sortOrder, 0);\r\n this.examCategoryName = _.defaultTo(params?.examCategoryName, '');\r\n this.examCategorySortOrder = _.defaultTo(params?.examCategorySortOrder, 0);\r\n this.examResultType = params?.examResultType ? new ExamResultTypeModel(params.examResultType) : undefined;\r\n this.rowIndex = _.defaultTo(params?.rowIndex, 0);\r\n this.businessLineId = _.defaultTo(params?.businessLineId, 1);//default to Global\r\n this.businessLine = params?.businessLine ? new BusinessLineModel(params.businessLine) : new BusinessLineModel({ businessLineId: 1, name: \"Global\" });\r\n _.map(params?.species, (s) => { this.species.push(new SpeciesModel(s)) });\r\n \r\n }\r\n}\r\n","import { IModel, Model } from \"./Model\";\r\n\r\nexport interface IFeatureFlagModel extends IModel {\r\n featureFlagId: number;\r\n name: string;\r\n description: string;\r\n globalStartDate: string | undefined;\r\n globalEndDate: string | undefined;\r\n enabled: boolean;\r\n}\r\n\r\nexport class FeatureFlagModel extends Model implements IFeatureFlagModel {\r\n featureFlagId: number;\r\n name: string;\r\n description: string;\r\n globalStartDate: string | undefined;\r\n globalEndDate: string | undefined;\r\n enabled: boolean;\r\n\r\n constructor(params: Partial) {\r\n super(params);\r\n const {\r\n featureFlagId = 0,\r\n name = '',\r\n description = '',\r\n globalStartDate = undefined,\r\n globalEndDate = undefined,\r\n enabled = false\r\n } = params;\r\n\r\n this.featureFlagId = featureFlagId;\r\n this.name = name;\r\n this.description = description;\r\n this.globalStartDate = globalStartDate;\r\n this.globalEndDate = globalEndDate;\r\n this.enabled = enabled;\r\n }\r\n}\r\n","import { IModel, Model } from \"./Model\";\r\nimport { defaultTo } from \"lodash\";\r\n\r\nexport interface IFollowUpTypeModel extends IModel {\r\n followUpTypeId: number;\r\n name: string;\r\n isForTextMessages: boolean;\r\n isForCallInteractions: boolean;\r\n isForVisits: boolean;\r\n}\r\n\r\nexport class FollowUpTypeModel extends Model implements Record {\r\n followUpTypeId: number;\r\n name: string;\r\n isForTextMessages: boolean;\r\n isForCallInteractions: boolean;\r\n isForVisits: boolean;\r\n\r\n constructor(params: IFollowUpTypeModel) {\r\n super(params);\r\n this.followUpTypeId = defaultTo(params.followUpTypeId, 0);\r\n this.name = defaultTo(params.name, \"\");\r\n this.isForTextMessages = params.isForTextMessages;\r\n this.isForCallInteractions = params.isForCallInteractions;\r\n this.isForVisits = params.isForVisits;\r\n }\r\n\r\n static defaultFollowUpType: FollowUpTypeModel = {\r\n followUpTypeId: 1,\r\n name: \"No Follow Up\",\r\n isForTextMessages: false,\r\n isForCallInteractions: true,\r\n isForVisits: true,\r\n rowVersion: \"\"\r\n }\r\n}\r\n","import { IModel } from \"./Model\";\r\n\r\nexport interface IGenderModel extends IModel {\r\n genderId: number;\r\n name: string;\r\n rowVersion: string;\r\n}\r\n\r\nexport class GenderModel implements IGenderModel {\r\n genderId: number;\r\n name: string;\r\n rowVersion: string;\r\n\r\n constructor(params: Partial = {} as IGenderModel) {\r\n const {\r\n genderId = 0,\r\n name = \"\",\r\n rowVersion = '',\r\n } = params;\r\n\r\n this.genderId = genderId;\r\n this.name = name;\r\n this.rowVersion = rowVersion;\r\n }\r\n}\r\n","\r\nimport { makeObservable, observable } from \"mobx\";\r\nimport { WeekDay } from \"@common/models/Enums\";\r\n\r\nexport interface IHospitalHoursModel {\r\n hospitalHoursId: number;\r\n dayOfWeek: WeekDay.Day;\r\n openTime: string;\r\n closeTime: string;\r\n isOpen: boolean;\r\n}\r\n\r\nexport class HospitalHoursModel implements IHospitalHoursModel {\r\n @observable hospitalHoursId: number;\r\n @observable dayOfWeek: WeekDay.Day;\r\n @observable openTime: string;\r\n @observable closeTime: string;\r\n @observable isOpen: boolean;\r\n\r\n constructor(hospitalHoursModel: IHospitalHoursModel) {\r\n this.hospitalHoursId = hospitalHoursModel.hospitalHoursId;\r\n this.dayOfWeek = hospitalHoursModel.dayOfWeek;\r\n this.openTime = hospitalHoursModel.openTime;\r\n this.closeTime = hospitalHoursModel.closeTime;\r\n this.isOpen = hospitalHoursModel.isOpen;\r\n\r\n makeObservable(this, undefined, { autoBind: true });\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model, ModelRecord } from \"./Model\";\r\n\r\nexport interface IMarketModel extends IModel {\r\n marketId: number;\r\n code: string;\r\n name: string;\r\n diagnosticLabUserProvided: boolean| undefined;\r\n diagnosticLabUserName: string| undefined;\r\n diagnosticLabPassword: string | undefined;\r\n}\r\n\r\nexport class MarketModel extends Model implements ModelRecord {\r\n marketId: number;\r\n code: string;\r\n name: string;\r\n diagnosticLabUserProvided: boolean| undefined;\r\n diagnosticLabUserName: string | undefined;\r\n diagnosticLabPassword: string | undefined; \r\n\r\n constructor(init?: Partial) {\r\n super(init);\r\n this.marketId = defaultTo(init?.marketId, 0);\r\n this.code = defaultTo(init?.code, '');\r\n this.name = defaultTo(init?.name, '');\r\n this.diagnosticLabUserProvided = defaultTo(init?.diagnosticLabUserProvided, undefined);\r\n this.diagnosticLabUserName = defaultTo(init?.diagnosticLabUserName, undefined);\r\n this.diagnosticLabPassword = defaultTo(init?.diagnosticLabPassword, undefined);\r\n }\r\n\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel } from \".\";\r\nimport { ModelRecord } from \"./Model\";\r\n\r\nexport interface IPartnerModel extends IModel {\r\n partnerId: number;\r\n name: string;\r\n label: string;\r\n description: string | undefined;\r\n sourceSystemKey: string;\r\n}\r\n\r\nexport class PartnerModel implements ModelRecord {\r\n partnerId: number;\r\n name: string;\r\n label: string;\r\n description: string | undefined;\r\n sourceSystemKey: string;\r\n rowVersion: string;\r\n\r\n\r\n constructor(init?: Partial) {\r\n this.rowVersion = defaultTo(init?.rowVersion, '');\r\n this.partnerId = defaultTo(init?.partnerId, 0);\r\n this.name = defaultTo(init?.name, '');\r\n this.label = defaultTo(init?.label, '');\r\n this.description = defaultTo(init?.description, undefined);\r\n this.sourceSystemKey = defaultTo(init?.sourceSystemKey, '');\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel } from \".\";\r\nimport { ModelRecord } from \"./Model\";\r\nexport interface IPaymentTypeModel extends IModel {\r\n paymentTypeId: number;\r\n code: string;\r\n name: string;\r\n}\r\nexport class PaymentTypeModel implements ModelRecord {\r\n rowVersion: string;\r\n paymentTypeId: number;\r\n code: string;\r\n name: string;\r\n\r\n constructor(params?: Partial) {\r\n this.rowVersion = defaultTo(params?.rowVersion, '');\r\n this.paymentTypeId = defaultTo(params?.paymentTypeId, 0);\r\n this.code = defaultTo(params?.code, '');\r\n this.name = defaultTo(params?.name, '');\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, ModelRecord } from \".\";\r\n\r\nexport interface IRegionModel extends IModel {\r\n regionId: number;\r\n name: string;\r\n}\r\nexport class RegionModel implements ModelRecord {\r\n rowVersion: string;\r\n regionId: number;\r\n name: string;\r\n\r\n constructor(params?: Partial) {\r\n this.rowVersion = defaultTo(params?.rowVersion, '');\r\n this.regionId = defaultTo(params?.regionId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { Model, IModel, ModelRecord } from \"./Model\";\r\n\r\nexport interface IStateModel extends IModel {\r\n stateId: number;\r\n name: string;\r\n abbreviation: string;\r\n taxValue: number;\r\n hasPrescriptionProductTax: boolean;\r\n hasClinicServiceTax: boolean;\r\n hasLicenseFeeTax: boolean;\r\n hasVetcoPrescriptionTax: boolean;\r\n zoneOffset: number;\r\n visitNote: string;\r\n}\r\n\r\nexport class StateModel extends Model implements ModelRecord {\r\n stateId: number;\r\n name: string;\r\n abbreviation: string;\r\n taxValue: number;\r\n hasPrescriptionProductTax: boolean;\r\n hasClinicServiceTax: boolean;\r\n hasLicenseFeeTax: boolean;\r\n hasVetcoPrescriptionTax: boolean;\r\n zoneOffset: number;\r\n visitNote: string;\r\n\r\n\r\n constructor(params?: Partial) { \r\n super(params);\r\n this.stateId = defaultTo(params?.stateId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n this.abbreviation = defaultTo(params?.abbreviation, '');\r\n this.taxValue = defaultTo(params?.taxValue, 0);\r\n this.hasPrescriptionProductTax = defaultTo(params?.hasPrescriptionProductTax, false);\r\n this.hasClinicServiceTax = defaultTo(params?.hasClinicServiceTax, false);\r\n this.hasVetcoPrescriptionTax = defaultTo(params?.hasVetcoPrescriptionTax, false);\r\n this.hasLicenseFeeTax = defaultTo(params?.hasLicenseFeeTax, false);\r\n this.zoneOffset = defaultTo(params?.zoneOffset, 0);\r\n this.visitNote = defaultTo(params?.visitNote, '');\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, ModelRecord } from \".\";\r\n\r\nexport interface IStoreTypeModel extends IModel {\r\n storeTypeId: number;\r\n code: string;\r\n name: string;\r\n}\r\n\r\nexport class StoreTypeModel implements ModelRecord {\r\n rowVersion: string;\r\n storeTypeId: number;\r\n code: string;\r\n name: string;\r\n\r\n constructor(params?: Partial) {\r\n this.rowVersion = defaultTo(params?.rowVersion, '');\r\n this.storeTypeId = defaultTo(params?.storeTypeId, 0);\r\n this.code = defaultTo(params?.code, '');\r\n this.name = defaultTo(params?.name, '');\r\n }\r\n\r\n}\r\n","import { defaultTo } from 'lodash';\r\nimport { BrandModel } from './BrandModel';\r\nimport { MarketModel } from './MarketModel';\r\nimport { IModel, Model, ModelRecord } from './Model';\r\nimport { PartnerModel } from './PartnerModel';\r\nimport { PaymentTypeModel } from './PaymentTypeModel';\r\nimport { RegionModel } from './RegionModel';\r\nimport { StateModel } from './StateModel';\r\nimport { StoreTypeModel } from './StoreTypeModel';\r\n\r\n\r\ninterface IStoreModelBase extends IModel {\r\n rowVersion: string;\r\n storeId: number;\r\n code: string | undefined;\r\n name: string | undefined;\r\n address: string | undefined;\r\n address2: string | undefined;\r\n city: string | undefined;\r\n zipCode: string | undefined;\r\n phone: string | undefined;\r\n secondaryPhone: string | undefined;\r\n salesTaxRate: number;\r\n isOutdoorClinic: boolean;\r\n timezoneName: string | undefined;\r\n latitude: number;\r\n longitude: number;\r\n bookingMessage: string | undefined;\r\n stateId: number;\r\n marketId: number;\r\n regionId: number;\r\n brandId: number;\r\n paymentTypeId: number;\r\n storeTypeId: number;\r\n partnerId: number;\r\n}\r\n\r\n\r\n\r\n\r\nclass StoreModelBase extends Model implements ModelRecord {\r\n storeId: number;\r\n code: string | undefined;\r\n name: string | undefined;\r\n address: string | undefined;\r\n address2: string | undefined;\r\n city: string | undefined;\r\n zipCode: string | undefined;\r\n phone: string | undefined;\r\n secondaryPhone: string | undefined;\r\n salesTaxRate: number;\r\n isOutdoorClinic: boolean;\r\n timezoneName: string | undefined;\r\n latitude: number;\r\n longitude: number;\r\n bookingMessage: string | undefined;\r\n stateId: number;\r\n marketId: number;\r\n regionId: number;\r\n brandId: number;\r\n paymentTypeId: number;\r\n storeTypeId: number;\r\n partnerId: number;\r\n\r\n constructor(init?: Partial) {\r\n super(init);\r\n\r\n this.rowVersion = defaultTo(init?.rowVersion, '');\r\n this.storeId = defaultTo(init?.storeId, 0);\r\n this.code = defaultTo(init?.code, undefined);\r\n this.name = defaultTo(init?.name, undefined);\r\n this.address = defaultTo(init?.address, undefined);\r\n this.address2 = defaultTo(init?.address2, undefined);\r\n this.city = defaultTo(init?.city, undefined);\r\n this.zipCode = defaultTo(init?.zipCode, undefined);\r\n this.phone = defaultTo(init?.phone, undefined);\r\n this.secondaryPhone = defaultTo(init?.secondaryPhone, undefined);\r\n this.salesTaxRate = defaultTo(init?.salesTaxRate, 0);\r\n this.isOutdoorClinic = defaultTo(init?.isOutdoorClinic, false);\r\n this.latitude = defaultTo(init?.latitude, 0);\r\n this.longitude = defaultTo(init?.longitude, 0);\r\n this.bookingMessage = defaultTo(init?.bookingMessage, undefined);\r\n this.timezoneName = defaultTo(init?.timezoneName, undefined);\r\n\r\n this.stateId = defaultTo(init?.stateId, 0);\r\n this.marketId = defaultTo(init?.marketId, 0);\r\n this.regionId = defaultTo(init?.regionId, 0);\r\n this.brandId = defaultTo(init?.brandId, 0);\r\n this.paymentTypeId = defaultTo(init?.paymentTypeId, 0);\r\n this.storeTypeId = defaultTo(init?.storeTypeId, 0);\r\n this.partnerId = defaultTo(init?.partnerId, 0);\r\n }\r\n}\r\n\r\nexport interface IStoreModel extends IStoreModelBase {\r\n state: StateModel;\r\n market: MarketModel;\r\n region: RegionModel;\r\n brand: BrandModel;\r\n paymentType: PaymentTypeModel;\r\n storeType: StoreTypeModel;\r\n partner: PartnerModel;\r\n}\r\n\r\nexport class StoreModel extends StoreModelBase implements ModelRecord {\r\n state: StateModel;\r\n market: MarketModel;\r\n region: RegionModel;\r\n brand: BrandModel;\r\n paymentType: PaymentTypeModel;\r\n storeType: StoreTypeModel;\r\n partner: PartnerModel;\r\n\r\n constructor(init?: Partial) {\r\n super(init);\r\n this.state = new StateModel(init?.state);\r\n this.market = new MarketModel(init?.market);\r\n this.region = new RegionModel(init?.region)\r\n this.brand = new BrandModel(init?.brand);\r\n this.paymentType = new PaymentTypeModel(init?.paymentType);\r\n this.storeType = new StoreTypeModel(init?.storeType);\r\n this.partner = new PartnerModel(init?.partner);\r\n }\r\n\r\n}\r\n\r\nexport interface IStoreListingModel extends IStoreModelBase {\r\n stateName: string;\r\n stateAbbreviation: string;\r\n marketName: string;\r\n regionName: string;\r\n brandName: string;\r\n paymentTypeName: string;\r\n storeTypeName: string;\r\n partnerName: string;\r\n partnerLabel: string;\r\n hasHospital: boolean;\r\n hospitalName: string;\r\n}\r\n\r\nexport class StoreListingModel extends StoreModelBase implements IStoreListingModel {\r\n stateName: string;\r\n stateAbbreviation: string;\r\n marketName: string;\r\n regionName: string;\r\n brandName: string;\r\n paymentTypeName: string;\r\n storeTypeName: string;\r\n partnerName: string;\r\n partnerLabel: string;\r\n hasHospital: boolean;\r\n hospitalName: string;\r\n\r\n constructor(params: IStoreListingModel) {\r\n super(params);\r\n this.stateName = params.stateName;\r\n this.stateAbbreviation = params.stateAbbreviation;\r\n this.marketName = params.marketName;\r\n this.regionName = params.regionName;\r\n this.brandName = params.brandName;\r\n this.paymentTypeName = params.paymentTypeName;\r\n this.storeTypeName = params.storeTypeName;\r\n this.partnerName = params.partnerName;\r\n this.partnerLabel = params.partnerLabel;\r\n this.hasHospital = params.hasHospital;\r\n this.hospitalName = params.hospitalName;\r\n }\r\n}\r\n","import { StringUtility } from \"@common/utils\";\r\nimport { defaultTo } from \"lodash\";\r\nimport { IModel, ModelRecord, schedule } from \"@common/models\";\r\n\r\n\r\nexport interface IHospitalScheduleTemplateModel extends IModel {\r\n hospitalScheduleTemplateId: number,\r\n hospitalId: number,\r\n name: string | undefined,\r\n isActive: boolean;\r\n isDefault: boolean,\r\n color: string | undefined,\r\n hospitalSchedulePreferences: schedule.EntitySchedulePreference[],\r\n}\r\nexport class HospitalScheduleTemplateModel implements ModelRecord {\r\n rowVersion: string\r\n hospitalScheduleTemplateId: number;\r\n hospitalId: number;\r\n name: string | undefined;\r\n color: string | undefined;\r\n isActive: boolean;\r\n isDefault: boolean;\r\n hospitalSchedulePreferences: schedule.EntitySchedulePreference[];\r\n\r\n constructor(init?: Partial) {\r\n this.rowVersion = defaultTo(init?.rowVersion, '');\r\n this.hospitalScheduleTemplateId = defaultTo(init?.hospitalScheduleTemplateId, 0);\r\n this.hospitalId = defaultTo(init?.hospitalId, 0);\r\n this.name = StringUtility.SanitizeString(init?.name);\r\n this.color = StringUtility.SanitizeString(init?.color ?? '#2596be');\r\n this.isActive = defaultTo(init?.isActive, false);\r\n this.isDefault = defaultTo(init?.isDefault, false);\r\n this.hospitalSchedulePreferences = init?.hospitalSchedulePreferences ? init.hospitalSchedulePreferences.map(p => new schedule.EntitySchedulePreference(p)) : [] as schedule.EntitySchedulePreference[];\r\n }\r\n}\r\n","import { DateTime } from \"luxon\";\r\nimport { IModel, Model } from \".\";\r\nimport { StringUtility } from \"@common/utils\";\r\n\r\nexport interface IIvlsDeviceModel extends IModel {\r\n ivlsDeviceId: number;\r\n hospitalId: number;\r\n deviceSerialNumber: string;\r\n displayName: string;\r\n lastPolledCloudTime: DateTime | undefined;\r\n\r\n\r\n}\r\n\r\nexport class IvlsDeviceModel extends Model implements IIvlsDeviceModel {\r\n ivlsDeviceId: number;\r\n hospitalId: number;\r\n deviceSerialNumber: string;\r\n displayName: string;\r\n lastPolledCloudTime: DateTime | undefined;\r\n\r\n constructor(params: Partial = {}) {\r\n super(params);\r\n const {\r\n ivlsDeviceId = 0,\r\n hospitalId = 0,\r\n deviceSerialNumber = '',\r\n displayName = '',\r\n lastPolledCloudTime = undefined,\r\n } = params;\r\n\r\n this.ivlsDeviceId = ivlsDeviceId;\r\n this.hospitalId = hospitalId;\r\n this.deviceSerialNumber = deviceSerialNumber;\r\n this.displayName = displayName;\r\n this.lastPolledCloudTime = lastPolledCloudTime;\r\n this.lastPolledCloudTime = lastPolledCloudTime ? StringUtility.SanitizeDateTimeISOAsUtc(lastPolledCloudTime.toString()) : undefined;\r\n }\r\n}\r\n","import { IModel, Model, ModelRecord } from './Model';\r\nimport { IStoreModel, StoreModel } from './StoreModel';\r\nimport { IHospitalHoursModel, HospitalHoursModel } from './HospitalHoursModel';\r\nimport { computed, makeObservable, observable } from 'mobx';\r\nimport { StringUtility } from '@common/utils';\r\nimport { IHospitalScheduleTemplateModel, HospitalScheduleTemplateModel } from './HospitalScheduleTemplateModel';\r\nimport { IvlsDeviceModel } from './IvlsDeviceModel';\r\n\r\nexport interface IHospitalModel extends IModel {\r\n hospitalId: number;\r\n storeId: number;\r\n store: IStoreModel | undefined;\r\n name: string;\r\n phone: string;\r\n email: string;\r\n isDisabled: boolean;\r\n code: string;\r\n url: string;\r\n fax: string;\r\n outboundSMSPhone: string;\r\n hospitalHours: IHospitalHoursModel[];\r\n parentOrganizationId: number | undefined;\r\n organizationRelationKey: string;\r\n diagnosticLabUserProvided?: boolean | undefined;\r\n diagnosticLabUserName?: string | undefined;\r\n diagnosticLabPassword?: string | undefined;\r\n isDoubleBookingEnabled: boolean;\r\n defaultScheduleTemplate: IHospitalScheduleTemplateModel | undefined;\r\n currentClinicId: number | undefined;\r\n ivlsDevices: IvlsDeviceModel[];\r\n}\r\n\r\nexport class HospitalModel implements ModelRecord {\r\n @observable hospitalId: number;\r\n @observable storeId: number;\r\n @observable store: StoreModel | undefined;\r\n @observable name: string;\r\n @observable phone: string;\r\n @observable email: string;\r\n @observable code: string;\r\n @observable isDisabled: boolean;\r\n @observable url: string | undefined;\r\n @observable fax: string | undefined;\r\n @observable outboundSMSPhone: string;\r\n @observable hospitalHours: HospitalHoursModel[];\r\n @observable organizationRelationKey: string;\r\n @observable parentOrganizationId: number | undefined;\r\n @observable diagnosticLabUserProvided: boolean | undefined;\r\n @observable diagnosticLabUserName: string | undefined;\r\n @observable diagnosticLabPassword: string | undefined;\r\n @observable rowVersion: string;\r\n @observable isDoubleBookingEnabled: boolean;\r\n @observable defaultScheduleTemplate: HospitalScheduleTemplateModel | undefined;\r\n @observable currentClinicId: number | undefined;\r\n @observable ivlsDevices: IvlsDeviceModel[];\r\n\r\n constructor(init?: IHospitalModel) {\r\n this.rowVersion = _.defaultTo(init?.rowVersion, '');\r\n this.hospitalId = _.defaultTo(init?.hospitalId, 0);\r\n this.code = _.defaultTo(init?.code, '');\r\n this.storeId = _.defaultTo(init?.storeId, 0);\r\n this.store = init?.store ? new StoreModel(init.store) : undefined;\r\n this.name = _.defaultTo(init?.name, '');\r\n this.phone = _.defaultTo(init?.phone, '');\r\n this.email = _.defaultTo(init?.email, '');\r\n this.isDisabled = _.defaultTo(init?.isDisabled, false);\r\n this.url = StringUtility.SanitizeString(init?.url);\r\n this.fax = StringUtility.SanitizeString(init?.fax);\r\n this.outboundSMSPhone = _.defaultTo(init?.outboundSMSPhone, '');\r\n this.organizationRelationKey = _.defaultTo(init?.organizationRelationKey, '');\r\n this.diagnosticLabUserProvided = _.defaultTo(init?.diagnosticLabUserProvided, undefined);\r\n this.diagnosticLabUserName = _.defaultTo(init?.diagnosticLabUserName, undefined);\r\n this.diagnosticLabPassword = _.defaultTo(init?.diagnosticLabPassword, undefined);\r\n this.hospitalHours = init?.hospitalHours ? init.hospitalHours.map(hh => new HospitalHoursModel(hh)) : [] as HospitalHoursModel[];\r\n this.isDoubleBookingEnabled = init?.isDoubleBookingEnabled ?? true;\r\n this.defaultScheduleTemplate = init?.defaultScheduleTemplate ? new HospitalScheduleTemplateModel(init?.defaultScheduleTemplate) : undefined;\r\n this.parentOrganizationId = _.defaultTo(init?.parentOrganizationId, undefined);\r\n this.currentClinicId = _.defaultTo(init?.currentClinicId, undefined);\r\n this.ivlsDevices = init?.ivlsDevices ? init.ivlsDevices.map(hh => new IvlsDeviceModel(hh)) : [] as IvlsDeviceModel[];\r\n makeObservable(this, undefined, { autoBind: true });\r\n }\r\n\r\n @computed get openDaysOfWeek(): number[] {\r\n //O.o get open days and map to day of week and then select unique day of week as an array of days of the week the hospital is open\r\n return this.hospitalHours.filter(a => a.isOpen).map(a => a.dayOfWeek).filter((item, i, ar) => ar.indexOf(item) === i);\r\n }\r\n\r\n @computed get openStartTime(): string {\r\n return '8:00'; //TODO get earliest open time for specific day\r\n }\r\n\r\n @computed get closeStartTime(): string {\r\n return '12:00'; //TODO get latest open time for specific day\r\n }\r\n\r\n @computed get hospitalFlags(): HospitalFlags {\r\n const flags: HospitalFlags = {\r\n isDoubleBookingEnabled: this.isDoubleBookingEnabled\r\n };\r\n return flags;\r\n }\r\n}\r\n\r\nexport interface IHospitalListingModel extends IModel {\r\n hospitalId: number;\r\n code: string;\r\n name: string;\r\n address: string;\r\n isDisabled: boolean;\r\n organizationRelationKey: string;\r\n}\r\n\r\nexport class HospitalListingModel extends Model implements IHospitalListingModel {\r\n hospitalId: number;\r\n code: string;\r\n name: string;\r\n address: string;\r\n isDisabled: boolean;\r\n organizationRelationKey: string;\r\n\r\n constructor(params: IHospitalListingModel) {\r\n super(params);\r\n this.hospitalId = params.hospitalId;\r\n this.code = params.code;\r\n this.name = params.name;\r\n this.address = params.address;\r\n this.isDisabled = params.isDisabled;\r\n this.organizationRelationKey = params.organizationRelationKey\r\n }\r\n\r\n}\r\n\r\nexport type HospitalFlags = Pick;\r\n","export enum MacroType {\r\n Hospitals = 1,\r\n Location = 2,\r\n Provider = 3\r\n}\r\n","import * as enums from './Enums';\r\nimport { defaultTo } from \"lodash\";\r\nimport { IModel, Model,ModelRecord } from './Model';\r\nexport interface IOrganizationListingModel extends IModel {\r\n code: string,\r\n description: string,\r\n name: string,\r\n organizationId: number,\r\n organizationSource: string,\r\n organizationSourceId: number,\r\n organizationType: string,\r\n organizationTypeId: enums.OrganizationTypes,\r\n organizationVersion: string,\r\n organizationVersionId: number,\r\n shortName: string\r\n}\r\n\r\nexport class OrganizationListingModel extends Model implements ModelRecord {\r\n code: string;\r\n description: string;\r\n name: string;\r\n organizationId: number;\r\n organizationSource: string;\r\n organizationSourceId: number;\r\n organizationType: string;\r\n organizationTypeId: any;\r\n organizationVersion: string;\r\n organizationVersionId: number;\r\n shortName: string;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.code = defaultTo(params?.code, '');\r\n this.description = defaultTo(params?.description, '');\r\n this.name = defaultTo(params?.name, '');\r\n this.organizationId = defaultTo(params?.organizationId, 0);\r\n this.organizationSource = defaultTo(params?.organizationSource, '');\r\n this.organizationSourceId = defaultTo(params?.organizationSourceId, 0);\r\n this.organizationType = defaultTo(params?.organizationType, '');\r\n this.organizationTypeId = defaultTo(params?.organizationTypeId, 0);\r\n this.organizationVersion = defaultTo(params?.organizationVersion, '');\r\n this.organizationVersionId = defaultTo(params?.organizationVersionId, 0);\r\n this.shortName = defaultTo(params?.shortName, '');\r\n\r\n }\r\n\r\n}\r\n","import { DateTime } from 'luxon';\r\nimport * as enums from './Enums';\r\nimport { IOrganizationListingModel } from './OrganizationListingModel';\r\nimport { IUserModel } from './UserModel';\r\nexport interface IOrganizationRelationListingModel {\r\n organizationRelationId: number;\r\n authApplicationId: number;\r\n organizationId: number;\r\n key: string;\r\n isDefault: boolean;\r\n startDate: string;\r\n endDate: string | undefined;\r\n organizationName: string;\r\n organizationDescription: string;\r\n organizationType: string;\r\n organizationTypeId: number;\r\n organizationVersion: string;\r\n organizationVersionId: number;\r\n organizationSourceName: string;\r\n organizationSourceId: number;\r\n}\r\n\r\nexport class OrganizationRelationListingModel implements IOrganizationRelationListingModel {\r\n organizationRelationId: number;\r\n authApplicationId: number;\r\n organizationId: number;\r\n key: string;\r\n isDefault: boolean;\r\n startDate: string;\r\n endDate: string | undefined;\r\n organizationName: string;\r\n organizationDescription: string;\r\n organizationType: string;\r\n organizationTypeId: number;\r\n organizationVersion: string;\r\n organizationVersionId: number;\r\n organizationSourceName: string;\r\n organizationSourceId: number;\r\n\r\n constructor(params: Partial) {\r\n const {\r\n organizationRelationId = 0,\r\n authApplicationId = 0,\r\n organizationId = 0,\r\n key = '',\r\n isDefault = false,\r\n startDate = DateTime.utc().toISODate(),\r\n endDate = undefined,\r\n organizationName = '',\r\n organizationDescription = '',\r\n organizationType = '',\r\n organizationTypeId = 0,\r\n organizationVersion = '',\r\n organizationVersionId = 0,\r\n organizationSourceName = '',\r\n organizationSourceId = 0\r\n } = params\r\n\r\n this.organizationRelationId = organizationRelationId;\r\n this.authApplicationId = authApplicationId;\r\n this.organizationId = organizationId;\r\n this.key = key;\r\n this.isDefault = isDefault;\r\n this.startDate = startDate;\r\n this.endDate = endDate;\r\n this.organizationName = organizationName;\r\n this.organizationDescription = organizationDescription;\r\n this.organizationType = organizationType;\r\n this.organizationTypeId = organizationTypeId;\r\n this.organizationVersion = organizationVersion;\r\n this.organizationVersionId = organizationVersionId;\r\n this.organizationSourceName = organizationSourceName;\r\n this.organizationSourceId = organizationSourceId;\r\n\r\n }\r\n\r\n static GetUserOrganizationFromListingOrganization(user: IUserModel, organization: IOrganizationListingModel){\r\n return new OrganizationRelationListingModel({\r\n organizationRelationId: 0,\r\n authApplicationId: 1,\r\n organizationId: organization.organizationId,\r\n key: 'user-' + user.userId,\r\n startDate: DateTime.now().toISO(),\r\n endDate: undefined,\r\n organizationName: organization.name,\r\n organizationType: organization.organizationType,\r\n organizationTypeId: organization.organizationTypeId,\r\n organizationVersion: organization.organizationVersion,\r\n organizationVersionId: organization.organizationVersionId,\r\n organizationSourceName: organization.organizationSource,\r\n organizationDescription: organization.description,\r\n organizationSourceId: organization.organizationSourceId\r\n });\r\n }\r\n\r\n static CreateForUserOrgRelation(user: IUserModel, organization: IOrganizationListingModel): IOrganizationRelationListingModel {\r\n return new OrganizationRelationListingModel({\r\n organizationRelationId: 0,\r\n authApplicationId: enums.AuthApplicationIds.PetPass,\r\n organizationId: organization.organizationId,\r\n key: user.organizationRelationKey\r\n });\r\n }\r\n}\r\n","import { IOrganizationRelationListingModel, OrganizationRelationListingModel } from \"./OrganizationRelationListingModel\";\r\n\r\nexport interface IHospitalOrganizationRelationListingModel extends IOrganizationRelationListingModel {\r\n hospitalCount: number\r\n}\r\n\r\nexport class HospitalOrganizationRelationListingModel extends OrganizationRelationListingModel implements IHospitalOrganizationRelationListingModel {\r\n hospitalCount: number;\r\n constructor(params: Partial) {\r\n super(params);\r\n const {\r\n hospitalCount = 0\r\n } = params;\r\n this.hospitalCount = hospitalCount;\r\n }\r\n}\r\n","import { DateTime } from \"luxon\";\r\nimport { IModel, Model, ModelRecord } from \"@common/models/Model\";\r\nimport { defaultTo } from \"lodash\";\r\n\r\nexport interface IHospitalPrescriptionEventModel extends IModel {\r\n hospitalPrescriptionEventId: number;\r\n hospitalPrescriptionId: number;\r\n hospitalPrescriptionEventTypeId: number;\r\n visitSalesItemId: number | undefined;\r\n salesItemOptionId: number;\r\n integrationResponsePayloadStorageContentId: number | undefined;\r\n wasSuccessful: boolean;\r\n note: string | undefined;\r\n hospitalPrescriptionEventTypeName: string;\r\n visitSalesItemSalesItemName: string | undefined;\r\n integrationResponsePayloadStorageContentUrl: string | undefined;\r\n eventDate: string;\r\n}\r\n\r\nexport class HospitalPrescriptionEventModel extends Model implements ModelRecord {\r\n hospitalPrescriptionEventId: number;\r\n hospitalPrescriptionId: number;\r\n hospitalPrescriptionEventTypeId: number;\r\n visitSalesItemId: number | undefined;\r\n salesItemOptionId: number;\r\n integrationResponsePayloadStorageContentId: number | undefined;\r\n wasSuccessful: boolean;\r\n note: string | undefined;\r\n hospitalPrescriptionEventTypeName: string;\r\n visitSalesItemSalesItemName: string | undefined;\r\n integrationResponsePayloadStorageContentUrl: string | undefined;\r\n eventDate: DateTime;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.hospitalPrescriptionEventId = defaultTo(params?.hospitalPrescriptionEventId, 0);\r\n this.hospitalPrescriptionId = defaultTo(params?.hospitalPrescriptionId, 0);\r\n this.hospitalPrescriptionEventTypeId = defaultTo(params?.hospitalPrescriptionEventTypeId, 0);\r\n this.visitSalesItemId = defaultTo(params?.visitSalesItemId, 0);\r\n this.salesItemOptionId = defaultTo(params?.salesItemOptionId, 0);\r\n this.integrationResponsePayloadStorageContentId = defaultTo(params?.integrationResponsePayloadStorageContentId, 0);\r\n this.wasSuccessful = defaultTo(params?.wasSuccessful, false);\r\n this.note = defaultTo(params?.note, \"\");\r\n this.hospitalPrescriptionEventTypeName = defaultTo(params?.hospitalPrescriptionEventTypeName, \"\");\r\n this.visitSalesItemSalesItemName = defaultTo(params?.visitSalesItemSalesItemName, \"\");\r\n this.integrationResponsePayloadStorageContentUrl = defaultTo(params?.integrationResponsePayloadStorageContentUrl, \"\");\r\n this.eventDate = params?.eventDate ? DateTime.fromISO(params?.eventDate, { zone: \"utc\" }) : DateTime.utc();\r\n }\r\n}\r\n","import { DateTime } from \"luxon\";\r\nimport { HospitalPrescriptionRefillStatus, HospitalPrescriptionStatus } from \"@common/models/Enums\";\r\nimport { StringUtility } from \"@common/utils\";\r\nimport { defaultTo } from \"lodash\";\r\nimport { IModel, ModelRecord, PhotoModel } from \"@common/models\";\r\nimport { HospitalPrescriptionModel } from \"./HospitalPrescriptionModel\";\r\n\r\nexport interface IHospitalPrescriptionRequestListingModel extends IModel {\r\n hospitalPrescriptionId: number | undefined;\r\n hospitalPrescriptionStatusId: HospitalPrescriptionStatus | undefined;\r\n hospitalPrescriptionRefillId: number | undefined;\r\n hospitalPrescriptionRefillStatusId: HospitalPrescriptionRefillStatus | undefined;\r\n prescriptionName: string;\r\n expiresDate: string;\r\n refills: string;\r\n notes: string;\r\n instructions: string;\r\n salesDate: string;\r\n veterinarianId: number | undefined;\r\n veterinarianName: string;\r\n veterinarianFirstName: string | undefined;\r\n veterinarianLastName: string | undefined;\r\n veterinarianLicenseNumber: string | undefined;\r\n veterinarianLicenseStateId: number | undefined;\r\n veterinarianLicenseStateAbbreviation: string | undefined;\r\n veterinarianLicenseExpirationDate: string | undefined;\r\n veterinarianEmail: string | undefined;\r\n veterinarianSignaturePhotoId: number | undefined;\r\n veterinarianSignaturePhotoURL: string | undefined;\r\n fullName: string;\r\n unitOfMeasure: string;\r\n dose: string | undefined;\r\n frequency: string;\r\n optionDisplayName: string | undefined;\r\n clientId: number;\r\n clientFirstName: string;\r\n clientLastName: string;\r\n clientAddress: string;\r\n clientCity: string;\r\n clientState: string;\r\n clientZipcode: string;\r\n petId: number;\r\n petName: string;\r\n petSpecies: string;\r\n petBreed: string;\r\n petBirthDate: string;\r\n petWeight: number;\r\n quantity: string;\r\n dateRequested: string;\r\n dateUpdated: string\r\n rowVersion: string;\r\n hospitalPrescriptionRowVersion: string | undefined;\r\n fillByDate: string;\r\n completedDate: string;\r\n salesItemOptionId: number | undefined;\r\n orderNotes: string | undefined;\r\n creatorFirstName: string | undefined;\r\n creatorLastName: string | undefined;\r\n creatorTitle: string | undefined;\r\n dateCreated: string;\r\n}\r\n\r\nexport class HospitalPrescriptionRequestListingModel implements ModelRecord {\r\n hospitalPrescriptionId: number | undefined;\r\n hospitalPrescriptionStatusId: HospitalPrescriptionStatus | undefined;\r\n hospitalPrescriptionRefillId: number | undefined;\r\n hospitalPrescriptionRefillStatusId: HospitalPrescriptionRefillStatus | undefined;\r\n prescriptionName: string;\r\n expiresDate: DateTime | undefined;\r\n refills: string;\r\n notes: string | undefined;\r\n instructions: string | undefined;\r\n salesDate: DateTime;\r\n veterinarianId: number | undefined;\r\n veterinarianName: string;\r\n veterinarianFirstName: string | undefined;\r\n veterinarianLastName: string | undefined;\r\n veterinarianLicenseNumber: string | undefined;\r\n veterinarianLicenseStateId: number | undefined;\r\n veterinarianLicenseStateAbbreviation: string | undefined;\r\n veterinarianLicenseExpirationDate: DateTime | undefined;\r\n veterinarianEmail: string | undefined;\r\n veterinarianSignaturePhotoId: number | undefined;\r\n veterinarianSignaturePhotoURL: string | undefined;\r\n fullName: string;\r\n unitOfMeasure: string;\r\n dose: string | undefined;\r\n frequency: string | undefined;\r\n optionDisplayName: string | undefined;\r\n clientId: number;\r\n clientFirstName: string;\r\n clientLastName: string;\r\n clientAddress: string;\r\n clientCity: string;\r\n clientState: string;\r\n clientZipcode: string;\r\n petId: number;\r\n petName: string;\r\n petSpecies: string;\r\n petBreed: string;\r\n petBirthDate: string;\r\n petWeight: number;\r\n quantity: string;\r\n dateRequested: string;\r\n rowVersion: string;\r\n hospitalPrescriptionRowVersion: string | undefined;\r\n fillByDate: DateTime | undefined;\r\n completedDate: DateTime | undefined;\r\n salesItemOptionId: number | undefined;\r\n orderNotes: string | undefined;\r\n creatorFirstName: string | undefined;\r\n creatorLastName: string | undefined;\r\n creatorTitle: string | undefined;\r\n dateCreated: DateTime | undefined;\r\n dateUpdated: DateTime | undefined;\r\n\r\n constructor(params: IHospitalPrescriptionRequestListingModel) {\r\n this.hospitalPrescriptionId = defaultTo(params?.hospitalPrescriptionId, undefined);\r\n this.hospitalPrescriptionStatusId = defaultTo(params?.hospitalPrescriptionStatusId, undefined);\r\n this.hospitalPrescriptionRefillId = defaultTo(params?.hospitalPrescriptionRefillId, undefined);\r\n this.hospitalPrescriptionRefillStatusId = defaultTo(params?.hospitalPrescriptionRefillStatusId, undefined);\r\n this.prescriptionName = defaultTo(params?.prescriptionName, '');\r\n this.expiresDate = StringUtility.SanitizeDateTimeISOAsUtc(params.expiresDate);\r\n this.refills = defaultTo(params?.refills, '');\r\n this.notes = params?.notes;\r\n this.instructions = params?.instructions;\r\n this.salesDate = StringUtility.SanitizeDateTimeISOAsUtc(params.salesDate)!;\r\n this.veterinarianId = defaultTo(params?.veterinarianId, undefined);\r\n this.veterinarianName = defaultTo(params?.veterinarianName, '');\r\n this.veterinarianFirstName = params?.veterinarianFirstName;\r\n this.veterinarianLastName = params?.veterinarianLastName;\r\n this.veterinarianLicenseNumber = params?.veterinarianLicenseNumber;\r\n this.veterinarianLicenseStateId = params?.veterinarianLicenseStateId\r\n this.veterinarianLicenseStateAbbreviation = params?.veterinarianLicenseStateAbbreviation;\r\n this.veterinarianLicenseExpirationDate = params?.veterinarianLicenseExpirationDate ? DateTime.fromISO(params?.veterinarianLicenseExpirationDate) : undefined;\r\n this.veterinarianEmail = params?.veterinarianEmail;\r\n this.veterinarianSignaturePhotoId = params?.veterinarianSignaturePhotoId;\r\n this.veterinarianSignaturePhotoURL = defaultTo(params?.veterinarianSignaturePhotoURL, undefined);\r\n this.fullName = defaultTo(params?.fullName, '');\r\n this.unitOfMeasure = defaultTo(params?.unitOfMeasure, '');\r\n this.dose = params?.dose;\r\n this.frequency = params?.frequency;\r\n this.optionDisplayName = defaultTo(params?.optionDisplayName, '');\r\n this.clientId = defaultTo(params?.clientId, 0);\r\n this.clientFirstName = defaultTo(params?.clientFirstName, '');\r\n this.clientLastName = defaultTo(params?.clientLastName, '');\r\n this.clientAddress = defaultTo(params?.clientAddress, '');\r\n this.clientCity = defaultTo(params?.clientCity, '');\r\n this.clientState = defaultTo(params?.clientState, '');\r\n this.clientZipcode = defaultTo(params?.clientZipcode, '');\r\n this.petId = defaultTo(params?.petId, 0);\r\n this.petName = defaultTo(params?.petName, '');\r\n this.petSpecies = defaultTo(params?.petSpecies, '');\r\n this.petBreed = defaultTo(params?.petBreed, '');\r\n this.petBirthDate = defaultTo(params?.petBirthDate, '');\r\n this.petWeight = defaultTo(params?.petWeight, 0);\r\n this.quantity = defaultTo(params?.quantity, '');\r\n this.dateRequested = defaultTo(params?.dateRequested, '');\r\n this.rowVersion = defaultTo(params?.rowVersion, '');\r\n this.hospitalPrescriptionRowVersion = defaultTo(params?.hospitalPrescriptionRowVersion, '');\r\n this.fillByDate = StringUtility.SanitizeDateTimeISO(params.fillByDate);\r\n this.completedDate = StringUtility.SanitizeDateTimeISO(params.completedDate);\r\n this.salesItemOptionId = defaultTo(params?.salesItemOptionId, undefined);\r\n this.orderNotes = defaultTo(params?.orderNotes, undefined);\r\n this.creatorFirstName = defaultTo(params?.creatorFirstName, '');\r\n this.creatorLastName = defaultTo(params?.creatorLastName, '');\r\n this.creatorTitle = defaultTo(params?.creatorTitle, '');\r\n this.dateCreated = params?.dateRequested ? DateTime.fromISO(params?.dateRequested, { zone: \"utc\" }) : undefined;\r\n this.dateUpdated = params?.dateUpdated ? DateTime.fromISO(params?.dateUpdated, { zone: \"utc\" }) : undefined;\r\n }\r\n\r\n toHospitalPrescriptionModel(): HospitalPrescriptionModel {\r\n return new HospitalPrescriptionModel({\r\n hospitalPrescriptionId: this.hospitalPrescriptionId,\r\n prescribedProduct: this.prescriptionName,\r\n remainingRefills: defaultTo(Number(this.refills), 0),\r\n quantity: this.quantity,\r\n unitOfMeasure: this.unitOfMeasure,\r\n dose: this.dose,\r\n frequency: this.frequency,\r\n instructions: this.instructions,\r\n expirationDate: defaultTo(this.expiresDate?.toISO(), undefined),\r\n notes: this.notes,\r\n salesDate: defaultTo(this.salesDate?.toISO(), undefined),\r\n veterinarianName: this.veterinarianName,\r\n veterinarianFirstName: this.veterinarianFirstName,\r\n veterinarianLastName: this.veterinarianLastName,\r\n veterinarianLicenseNumber: this.veterinarianLicenseNumber,\r\n veterinarianLicenseStateId: this.veterinarianLicenseStateId,\r\n veterinarianLicenseStateAbbreviation: this.veterinarianLicenseStateAbbreviation,\r\n veterinarianLicenseExpirationDate: defaultTo(this.veterinarianLicenseExpirationDate?.toISO(), undefined),\r\n veterinarianEmail: this.veterinarianEmail,\r\n fullName: this.fullName,\r\n optionDisplayName: this.optionDisplayName,\r\n fillByDate: defaultTo(this.fillByDate?.toISO(), undefined),\r\n completedDate: defaultTo(this.completedDate?.toISO(), undefined),\r\n petId: this.petId,\r\n veterinarianSignaturePhotoId: this.veterinarianSignaturePhotoId,\r\n veterinarianSignaturePhoto: this.veterinarianSignaturePhotoURL ? new PhotoModel({ photoUrl: this.veterinarianSignaturePhotoURL }) : undefined,\r\n veterinarianId: this.veterinarianId,\r\n salesItemOptionId: this.salesItemOptionId,\r\n hospitalPrescriptionStatusId: this.hospitalPrescriptionStatusId,\r\n orderNotes: this.orderNotes,\r\n rowVersion: this.hospitalPrescriptionRowVersion,\r\n dateCreated: defaultTo(this.dateCreated?.toISO(), undefined),\r\n dateUpdated: defaultTo(this.dateUpdated?.toISO(), undefined),\r\n })\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model } from \"./Model\";\r\n\r\nexport interface ITraitModel extends IModel {\r\n traitId: number;\r\n name: string;\r\n isForSalesCategories: boolean;\r\n isForSalesSubCategories: boolean;\r\n isForSalesItems: boolean;\r\n isForVisitSalesItems: boolean;\r\n isForVeterinarians: boolean;\r\n isForUsers: boolean;\r\n isForStates: boolean;\r\n isForStores: boolean;\r\n isForHospitals: boolean;\r\n}\r\n\r\nexport class TraitModel extends Model implements ITraitModel {\r\n traitId: number;\r\n name: string;\r\n isForSalesCategories: boolean;\r\n isForSalesSubCategories: boolean;\r\n isForSalesItems: boolean;\r\n isForVisitSalesItems: boolean;\r\n isForVeterinarians: boolean;\r\n isForUsers: boolean;\r\n isForStates: boolean;\r\n isForStores: boolean;\r\n isForHospitals: boolean;\r\n\r\n constructor(params: Partial) {\r\n super(params);\r\n this.traitId = defaultTo(params.traitId, 0);\r\n this.name = defaultTo(params.name, \"\");\r\n this.isForSalesCategories = defaultTo(params.isForSalesCategories, false);\r\n this.isForSalesSubCategories = defaultTo(params.isForSalesSubCategories, false);\r\n this.isForSalesItems = defaultTo(params.isForSalesItems, false);\r\n this.isForVisitSalesItems = defaultTo(params.isForVisitSalesItems, false);\r\n this.isForVeterinarians = defaultTo(params.isForVeterinarians, false);\r\n this.isForUsers = defaultTo(params.isForUsers, false);\r\n this.isForStates = defaultTo(params.isForStates, false);\r\n this.isForStores = defaultTo(params.isForStores, false);\r\n this.isForHospitals = defaultTo(params.isForHospitals, false);\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model } from \"./Model\";\r\nimport { ITraitModel, TraitModel } from \"./TraitModel\";\r\n\r\nexport interface IModelWithTrait extends IModel {\r\n traitId: number;\r\n stringValue: string | undefined;\r\n numberValue: number | undefined;\r\n decimalValue: number | undefined;\r\n boolValue: boolean | undefined;\r\n extendedValue: string | undefined;\r\n trait: ITraitModel;\r\n}\r\n\r\nexport class ModelWithTrait extends Model implements Record {\r\n traitId: number;\r\n stringValue: string | undefined;\r\n numberValue: number | undefined;\r\n decimalValue: number | undefined;\r\n boolValue: boolean | undefined;\r\n extendedValue: string | undefined;\r\n trait: TraitModel;\r\n\r\n constructor(params: Partial) {\r\n super(params)\r\n this.traitId = defaultTo(params.traitId, 0)\r\n this.stringValue = params.stringValue;\r\n this.numberValue = params.numberValue;\r\n this.decimalValue = params.decimalValue;\r\n this.boolValue = params.boolValue;\r\n this.extendedValue = params.extendedValue;\r\n this.trait = new TraitModel(defaultTo(params.trait, {}));\r\n }\r\n\r\n}\r\n","import { TraitModel } from \"@common/models/TraitModel\";\r\nimport { defaultTo } from \"lodash\";\r\nimport { IModelWithTrait, ModelWithTrait } from \"./ModelWithTrait\";\r\nimport { SalesItemModel } from \"./SalesItemModel\";\r\n\r\nexport interface ISalesItemTraitModel extends IModelWithTrait {\r\n salesItemTraitId: number;\r\n salesItemId: number;\r\n // salesItem: ISalesItemModel;\r\n}\r\n\r\nexport class SalesItemTraitModel extends ModelWithTrait implements ISalesItemTraitModel {\r\n salesItemTraitId: number;\r\n salesItemId: number;\r\n // salesItem: ISalesItemModel;\r\n\r\n constructor(params: Partial) {\r\n super(params);\r\n this.salesItemTraitId = defaultTo(params.salesItemTraitId, 0);\r\n this.salesItemId = defaultTo(params.salesItemId, 0);\r\n }\r\n\r\n static GetSalesItemTraitModelFromTraitModel(trait: Partial, salesItem: Partial){\r\n return new SalesItemTraitModel({\r\n salesItemTraitId: 0,\r\n salesItemId: salesItem.salesItemId,\r\n traitId: trait.traitId,\r\n trait: new TraitModel(trait),\r\n })\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model } from \".\";\r\n\r\nexport interface IHospitalPrescriptionRefillStatusModel extends IModel {\r\n hospitalPrescriptionRefillStatusId: number\r\n name: string\r\n description: string;\r\n}\r\n\r\nexport class HospitalPrescriptionRefillStatusModel extends Model implements IHospitalPrescriptionRefillStatusModel {\r\n hospitalPrescriptionRefillStatusId: number;\r\n name: string;\r\n description: string;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.hospitalPrescriptionRefillStatusId = defaultTo(params?.hospitalPrescriptionRefillStatusId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n this.description = defaultTo(params?.description, '');\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\n\r\nexport interface IVisitSalesItemPublicModel {\r\n salesItemCode: string;\r\n salesItemDescription: string;\r\n salesItemName: string;\r\n salesItemFullName: string;\r\n salesItemOptionName: string;\r\n salesItemOptionDisplayName: string;\r\n salesItemPrice: number;\r\n invoicePrice: number | undefined;\r\n invoiceUnitPrice: number | undefined;\r\n salesPackageName: string | undefined;\r\n salesPackagePrice: number | undefined;\r\n quantity: number | undefined;\r\n salesItemUnitPrice: number | undefined;\r\n estimateQuantityLow: number | undefined;\r\n estimateQuantityHigh: number | undefined;\r\n showQuantityRanges: boolean | undefined;\r\n salesItemOptionAllowPartialQuantities: boolean | undefined;\r\n salesItemOptionAllowQuantityChanges: boolean | undefined;\r\n salesItemOptionAllowQuantityRanges: boolean | undefined;\r\n salesItemOptionAllowUserEnteredPrice: boolean | undefined; // defines if the Sales Item Option allows the user to dictate the price of the item once it is in a visit. Whatever price that is in the pricing rule will initially be set when items are added to a visit, but the pricing engine in the platform will not attempt to set/reset the price at any time.\r\n salesItemOptionMinimumQuantity: number | undefined;\r\n salesItemOptionMaximumQuantity: number | undefined;\r\n dispensingFee: number | undefined;\r\n wasDeclinedByClient: boolean;\r\n wasDeclinedByVeterinarian: boolean;\r\n isPending: boolean;\r\n given: boolean;\r\n isDiscountItem: boolean;\r\n isPackageAddOn: boolean;\r\n wasPreviouslyPended: boolean;\r\n packageAddOnPrice: number | undefined;//UI Only\r\n upgradingPrice: number | undefined;//UI Only\r\n isPackageUpgrade: boolean;\r\n}\r\n\r\nexport class VisitSalesItemPublicModel implements IVisitSalesItemPublicModel {\r\n salesItemCode: string;\r\n salesItemDescription: string;\r\n salesItemName: string;\r\n salesItemFullName: string;\r\n salesItemOptionName: string;\r\n salesItemOptionDisplayName: string;\r\n salesItemPrice: number;\r\n invoicePrice: number;\r\n invoiceUnitPrice: number;\r\n salesPackageName: string | undefined;\r\n salesPackagePrice: number | undefined;\r\n quantity: number;\r\n salesItemUnitPrice: number;\r\n estimateQuantityLow: number | undefined;\r\n estimateQuantityHigh: number | undefined;\r\n showQuantityRanges: boolean;\r\n salesItemOptionAllowPartialQuantities: boolean;\r\n salesItemOptionAllowQuantityChanges: boolean;\r\n salesItemOptionAllowQuantityRanges: boolean;\r\n salesItemOptionAllowUserEnteredPrice: boolean; // defines if the Sales Item Option allows the user to dictate the price of the item once it is in a visit. Whatever price that is in the pricing rule will initially be set when items are added to a visit, but the pricing engine in the platform will not attempt to set/reset the price at any time.\r\n salesItemOptionMinimumQuantity: number;\r\n salesItemOptionMaximumQuantity: number;\r\n dispensingFee: number | undefined\r\n wasDeclinedByClient: boolean;\r\n wasDeclinedByVeterinarian: boolean;\r\n isPending: boolean;\r\n given: boolean;\r\n isDiscountItem: boolean;\r\n isPackageAddOn: boolean;\r\n packageAddOnPrice: number | undefined;//UI Only\r\n upgradingPrice: number | undefined; //UI Only*/\r\n wasPreviouslyPended: boolean;\r\n isPackageUpgrade: boolean;\r\n\r\n constructor(params: IVisitSalesItemPublicModel) {\r\n this.salesItemCode = params.salesItemCode;\r\n this.salesItemDescription = params.salesItemDescription;\r\n this.salesItemName = params.salesItemName;\r\n this.salesItemFullName = params.salesItemFullName;\r\n this.salesItemOptionName = params.salesItemOptionName;\r\n this.salesItemOptionDisplayName = params.salesItemOptionDisplayName;\r\n this.salesItemPrice = params.salesItemPrice;\r\n this.salesPackageName = params.salesPackageName;\r\n this.salesPackagePrice = params.salesPackagePrice;\r\n this.quantity = defaultTo(params.quantity, 1);\r\n this.salesItemUnitPrice = defaultTo(params.salesItemUnitPrice, params.salesItemPrice);\r\n this.estimateQuantityLow = params.estimateQuantityLow;\r\n this.estimateQuantityHigh = params.estimateQuantityHigh;\r\n this.showQuantityRanges = defaultTo(params.showQuantityRanges, false);\r\n this.salesItemOptionAllowPartialQuantities = defaultTo(params.salesItemOptionAllowPartialQuantities, false);\r\n this.salesItemOptionAllowQuantityChanges = defaultTo(params.salesItemOptionAllowQuantityChanges, false);\r\n this.salesItemOptionAllowQuantityRanges = defaultTo(params.salesItemOptionAllowQuantityRanges, false);\r\n this.salesItemOptionAllowUserEnteredPrice = defaultTo(params.salesItemOptionAllowUserEnteredPrice, false);\r\n this.salesItemOptionMinimumQuantity = defaultTo(params.salesItemOptionMinimumQuantity, 1);\r\n this.salesItemOptionMaximumQuantity = defaultTo(params.salesItemOptionMaximumQuantity, 1); this.wasDeclinedByClient = defaultTo(params.wasDeclinedByClient, false);\r\n this.dispensingFee = params.dispensingFee;\r\n this.wasDeclinedByVeterinarian = defaultTo(params.wasDeclinedByVeterinarian, false);\r\n this.isPending = defaultTo(params.isPending, false);\r\n this.given = defaultTo(params.given, false);\r\n this.isDiscountItem = defaultTo(params.isDiscountItem, false);\r\n this.invoicePrice = defaultTo(params.invoicePrice, params.salesItemPrice);\r\n this.invoiceUnitPrice = defaultTo(params.invoiceUnitPrice, defaultTo(params.salesItemUnitPrice, params.salesItemPrice));\r\n this.isPackageAddOn = defaultTo(params.isPackageAddOn, false);\r\n this.isPackageUpgrade = defaultTo(params.isPackageUpgrade, false);\r\n this.wasPreviouslyPended = defaultTo(params.wasPreviouslyPended, false);\r\n }\r\n}\r\n","import { defaultTo, orderBy } from \"lodash\";\r\nimport { DateTime } from \"luxon\";\r\nimport { VisitSalesItemPublicModel } from './VisitSalesItemPublicModel';\r\nimport { IVisitSalesItemAttributeModel, IVisitSalesItemPublicModel, VisitSalesItemAttributeModel, VisitSalesItemTraitListingModel, IVisitSalesItemTraitListingModel } from \".\";\r\nimport { DiscountItemTypes } from \"./Enums\";\r\n\r\nexport interface IVisitSalesItemModel extends IVisitSalesItemPublicModel {\r\n isInPackage: boolean;\r\n /*\r\n isPackageAddOn: boolean; \r\n */\r\n salesItemId: number;\r\n salesItemOptionId: number;\r\n salesPlanId: number | undefined;\r\n salesPlanName: string | undefined;\r\n\r\n salesItemSalesItemTypeId: number;\r\n salesPackageId: number | undefined;\r\n salesItemSalesItemTypeName: string;\r\n salesItemCommunicationTypeId: number | null;\r\n salesItemReminderDays: number | null;\r\n /*\r\n salesItemSalesCategoryId: number;\r\n salesItemSalesCategoryName: string;\r\n salesItemSalesSubCategoryId: number;\r\n salesItemSalesSubCategoryName: string;\r\n \r\n \r\n /*\r\n salesItemDiscountTypeId: number;\r\n salesItemDiscountTypeName: string;\r\n salesItemIsAutomaticallyGiven: boolean;\r\n salesItemIsRabiesVaccination: boolean;\r\n \r\n salesItemCommunicationTypeName: string;\r\n \r\n salesItemSupplierProductName: string;\r\n */\r\n salesItemSupplierProductCode: string;\r\n visitId: number;\r\n /*\r\n reminderResetByVisitSalesItemId: number | null;\r\n pendedResetByVisitSalesItemId: number | null;\r\n */\r\n visitSalesItemId: number;\r\n /*\r\n prescriptionLabelId: number | null;\r\n salesItemOptionRefills: number | null;\r\n salesItemOptionPackageQuantity: number | null;\r\n */\r\n parentVisitSalesItemId: number | undefined;\r\n /*\r\n salesItemAutoAddToVisitTypeId: number;\r\n salesItemAutoAddToVisitTypeName: string;\r\n */\r\n visitSalesItemAttributes: IVisitSalesItemAttributeModel[];\r\n salesItemOptionBusinessLineSKU: string | undefined;\r\n salesItemOptionPetcoSKU: string | undefined;\r\n salesItemOptionUnitOfMeasureQuantity: number | undefined;\r\n salesItemOptionUnitOfMeasureId: number | undefined;\r\n salesItemOptionUnitOfMeasureName: string | undefined;\r\n visitSalesItemTraits: IVisitSalesItemTraitListingModel[];\r\n /*\r\n salesItemOptionAdditionalInfoLabelId: number | null;\r\n salesItemOptionAdditionalInfoLabel: string;\r\n diagnosticResultsRawData: string;\r\n includeInDrugLog: boolean;\r\n prescriptionFulfillmentId: number | null;\r\n prescriptionFulfillmentPackageItemCount: number | null;\r\n prescriptionFulfillmentPackageRefillDays: number | null;\r\n prescriptionFulfillmentPackagesSold: number | null;\r\n prescriptionFulfillmentPackagesForYear: number | null;\r\n prescriptionFulfillmentPackagesSoldRefillDays: number | null;\r\n prescriptionVisitSalesItemId: number | null; \r\n salesItemOptionPrescriptionLabelName: string;\r\n salesItemOptionPrescriptionLabelInstructions: string;\r\n // prescription: PrescriptionModel;\r\n attributeHTML: string;\r\n attributeText: string;\r\n diagnosticHTML: string;\r\n */\r\n}\r\n\r\nexport class VisitSalesItemModel extends VisitSalesItemPublicModel implements IVisitSalesItemModel {// Record {\r\n visitId: number;\r\n visitSalesItemId: number;\r\n salesItemId: number;\r\n salesItemOptionId: number;\r\n visitSalesItemAttributes: VisitSalesItemAttributeModel[];\r\n parentVisitSalesItemId: number | undefined\r\n salesItemOptionBusinessLineSKU: string | undefined\r\n attributeElements: (string | JSX.Element | JSX.Element[])[]\r\n isInPackage: boolean;\r\n salesPackageId: number | undefined;\r\n salesPlanId: number | undefined;\r\n salesPlanName: string | undefined;\r\n salesItemSalesItemTypeId: number;\r\n salesItemSalesItemTypeName: string;\r\n salesItemCommunicationTypeId: number | null;\r\n salesItemOptionPetcoSKU: string | undefined;\r\n salesItemOptionUnitOfMeasureQuantity: number | undefined;\r\n salesItemOptionUnitOfMeasureId: number | undefined;\r\n salesItemOptionUnitOfMeasureName: string | undefined;\r\n salesItemSupplierProductCode: string;\r\n visitSalesItemTraits: VisitSalesItemTraitListingModel[];\r\n salesItemReminderDays: number | null;\r\n\r\n constructor(params: IVisitSalesItemModel, visitDate?: DateTime | undefined) {\r\n super(params);\r\n this.visitId = defaultTo(params.visitId, 0);\r\n this.visitSalesItemId = defaultTo(params.visitSalesItemId, 0);\r\n this.salesItemId = defaultTo(params.salesItemId, 0);\r\n this.salesItemOptionId = defaultTo(params.salesItemOptionId, 0);\r\n this.salesItemSalesItemTypeId = defaultTo(params.salesItemSalesItemTypeId, 0);\r\n this.parentVisitSalesItemId = params.parentVisitSalesItemId;\r\n this.salesItemOptionBusinessLineSKU = params.salesItemOptionBusinessLineSKU;\r\n this.salesItemOptionPetcoSKU = defaultTo(params.salesItemOptionPetcoSKU, \"\");\r\n this.salesItemOptionUnitOfMeasureQuantity = params.salesItemOptionUnitOfMeasureQuantity;\r\n this.salesItemOptionUnitOfMeasureId = params.salesItemOptionUnitOfMeasureId;\r\n this.salesItemOptionUnitOfMeasureName = defaultTo(params.salesItemOptionUnitOfMeasureName, \"\");\r\n this.salesItemCommunicationTypeId = defaultTo(params.salesItemCommunicationTypeId, 0);\r\n this.salesItemSalesItemTypeName = defaultTo(params.salesItemSalesItemTypeName, \"\");\r\n this.visitSalesItemAttributes = orderBy(params.visitSalesItemAttributes ?? [], \"sortOrder\").map(vsa => new VisitSalesItemAttributeModel(vsa, visitDate, this.quantity, this.salesItemOptionUnitOfMeasureName, this.salesItemCommunicationTypeId!))\r\n this.isInPackage = defaultTo(params.isInPackage, false)\r\n this.salesPackageId = params.salesPackageId\r\n this.salesPackageName = params.salesPackageName\r\n this.salesPlanId = params.salesPlanId;\r\n this.salesPlanName = params.salesPlanName;\r\n this.attributeElements = VisitSalesItemAttributeModel.parseAttributeElements(this.visitSalesItemAttributes);\r\n this.salesItemSalesItemTypeId = defaultTo(params.salesItemSalesItemTypeId, 0);\r\n this.salesItemSupplierProductCode = params.salesItemSupplierProductCode;\r\n this.visitSalesItemTraits = (params.visitSalesItemTraits ?? []).map(vsit => new VisitSalesItemTraitListingModel(vsit));\r\n this.salesItemReminderDays = params.salesItemReminderDays;\r\n }\r\n\r\n IsDiscountItem = () => DiscountItemTypes.includes(this.salesItemSalesItemTypeId);\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { DateTime } from \"luxon\";\r\nimport { HospitalPrescriptionRefillStatusModel, IHospitalPrescriptionRefillStatusModel } from \"./HospitalPrescriptionRefillStatusModel\";\r\nimport { IModel, Model, ModelRecord } from \"./Model\";\r\nimport { IVisitSalesItemModel, VisitSalesItemModel } from \"./VisitSalesItemModel\";\r\n\r\nexport interface IHospitalPrescriptionRefillModel extends IModel {\r\n hospitalPrescriptionRefillId: number;\r\n dateFilled: string | undefined;\r\n hospitalPrescriptionId: number;\r\n visitSalesItemId: number;\r\n visitSalesItem: IVisitSalesItemModel;\r\n hospitalPrescriptionRefillStatusId: number;\r\n hospitalPrescriptionRefillStatus: IHospitalPrescriptionRefillStatusModel;\r\n hospitalId: number;\r\n dateCreated: string | undefined;\r\n}\r\n\r\nexport class HospitalPrescriptionRefillModel extends Model implements ModelRecord {\r\n hospitalPrescriptionRefillId: number;\r\n dateFilled: DateTime | undefined;\r\n hospitalPrescriptionId: number;\r\n visitSalesItemId: number;\r\n visitSalesItem: VisitSalesItemModel | undefined;\r\n hospitalPrescriptionRefillStatusId: number;\r\n hospitalPrescriptionRefillStatus: HospitalPrescriptionRefillStatusModel;\r\n hospitalId: number;\r\n dateCreated: DateTime | undefined;\r\n\r\n constructor(params: Partial) {\r\n super(params);\r\n this.hospitalPrescriptionRefillId = defaultTo(params.hospitalPrescriptionRefillId, 0);\r\n this.dateFilled = params.dateFilled ? DateTime.fromISO(params.dateFilled, { zone: \"utc\" }) : undefined;\r\n this.hospitalPrescriptionId = defaultTo(params.hospitalPrescriptionId, 0);\r\n this.visitSalesItemId = defaultTo(params.visitSalesItemId, 0);\r\n this.visitSalesItem = params.visitSalesItem ? new VisitSalesItemModel(params.visitSalesItem) : undefined;\r\n this.hospitalPrescriptionRefillStatusId = defaultTo(params.hospitalPrescriptionRefillStatusId, 0);\r\n this.hospitalPrescriptionRefillStatus = new HospitalPrescriptionRefillStatusModel(params.hospitalPrescriptionRefillStatus);\r\n this.hospitalId = defaultTo(params.hospitalId, 0);\r\n this.dateCreated = params.dateCreated ? DateTime.fromISO(params.dateCreated, { zone: \"utc\" }) : undefined;\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, Model } from \".\";\r\n\r\nexport interface IHospitalPrescriptionStatusModel extends IModel {\r\n hospitalPrescriptionStatusId: number;\r\n name: string;\r\n description: string;\r\n isOwnedByPetPass: boolean;\r\n canBeRefilledByPetPass: boolean;\r\n canBeRecalledByPetPass: boolean;\r\n canBeCancelledByPetPass: boolean;\r\n}\r\n\r\nexport class HospitalPrescriptionStatusModel extends Model implements IHospitalPrescriptionStatusModel {\r\n hospitalPrescriptionStatusId: number;\r\n name: string;\r\n description: string;\r\n isOwnedByPetPass: boolean;\r\n canBeRefilledByPetPass: boolean;\r\n canBeRecalledByPetPass: boolean;\r\n canBeCancelledByPetPass: boolean;\r\n\r\n constructor(params?: Partial) {\r\n super(params);\r\n this.hospitalPrescriptionStatusId = defaultTo(params?.hospitalPrescriptionStatusId, 0);\r\n this.name = defaultTo(params?.name, '');\r\n this.description = defaultTo(params?.description, '');\r\n this.isOwnedByPetPass = defaultTo(params?.isOwnedByPetPass, false);\r\n this.canBeRefilledByPetPass = defaultTo(params?.canBeRefilledByPetPass, false);\r\n this.canBeRecalledByPetPass = defaultTo(params?.canBeRecalledByPetPass, false);\r\n this.canBeCancelledByPetPass = defaultTo(params?.canBeCancelledByPetPass, false);\r\n }\r\n}\r\n","import { defaultTo } from \"lodash\";\r\nimport { IModel, ISalesItemOptionTagAlongListingModel, Model, SalesItemOptionTagAlongListingModel } from \".\";\r\n\r\nexport interface ISalesItemOptionModel extends IModel {\r\n salesItemOptionId: number;\r\n salesItemId: number;\r\n name: string;\r\n displayName: string;\r\n reminderDays: number | undefined;\r\n sortOrder: number;\r\n code: string;\r\n prescriptionLabelId: number | undefined;\r\n // salesItem: SalesItemModel;\r\n refills: number | undefined;\r\n packageQuantity: number | undefined;\r\n additionalInfoLabelId: number | undefined;\r\n prescriptionFulfillmentId: number | undefined;\r\n petcoSKU: string;\r\n allowPartialQuantities: boolean;\r\n allowQuantityChanges: boolean;\r\n allowQuantityRanges: boolean;\r\n defaultQuantity: number;\r\n minimumQuantity: number;\r\n maximumQuantity: number;\r\n unitOfMeasureId: number;\r\n unitOfMeasureQuantity: number;\r\n allowUserEnteredPrice: boolean;\r\n tagAlongs: ISalesItemOptionTagAlongListingModel[];\r\n clinicSKU: string;\r\n hospitalSKU: string;\r\n dosesSold: number | undefined;\r\n}\r\n\r\nexport class SalesItemOptionModel extends Model implements Record {\r\n salesItemOptionId: number;\r\n salesItemId: number;\r\n name: string;\r\n displayName: string;\r\n reminderDays: number | undefined;\r\n sortOrder: number;\r\n code: string;\r\n prescriptionLabelId: number | undefined;\r\n refills: number | undefined;\r\n packageQuantity: number | undefined;\r\n additionalInfoLabelId: number | undefined;\r\n prescriptionFulfillmentId: number | undefined;\r\n petcoSKU: string;\r\n allowPartialQuantities: boolean;\r\n allowQuantityChanges: boolean;\r\n allowQuantityRanges: boolean;\r\n defaultQuantity: number;\r\n minimumQuantity: number;\r\n maximumQuantity: number;\r\n unitOfMeasureId: number;\r\n unitOfMeasureQuantity: number;\r\n allowUserEnteredPrice: boolean;\r\n tagAlongs: SalesItemOptionTagAlongListingModel[];\r\n clinicSKU: string;\r\n hospitalSKU: string;\r\n defaultStartDate?: string;//UI Field Only\r\n dosesSold: number | undefined;\r\n constructor(params?: Partial