Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 1x 1x 3x 3x 3x 3x 3x 3x 3x 15x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 5x 5x 5x 7x 7x 3x 3x 3x | import { Office } from "@/api/models/Office"; import { Relation } from "@/api/models/Relation"; import { OfficeImpl } from "@/types/OfficeImpl"; /** * Creates a list of possible providers for a service. * @param serviceId The id of the service * @param providers Optinal list of allowed providers * @param relations List of all releations between services and providers * @param offices List of all providers * @returns List of all possible providers for a service */ export function getProviders( serviceId: string, providers: string[] | null, relations: Relation[], offices: Office[] ): OfficeImpl[] { const officesAtService = new Array<OfficeImpl>(); relations.forEach((relation) => { if (relation.serviceId == serviceId) { const office = offices.find((office) => office.id == relation.officeId); if (office) { const foundOffice: OfficeImpl = new OfficeImpl( office.id, office.name, office.address, office.showAlternativeLocations, office.displayNameAlternatives, office.organization, office.organizationUnit, office.slotTimeInMinutes, office.disabledByServices, office.scope, office.maxSlotsPerAppointment, office.slots, office.priority || 1 ); if (!providers || providers.includes(foundOffice.id.toString())) { foundOffice.slots = relation.slots; officesAtService.push(foundOffice); } } } }); return officesAtService; } |