diff --git a/src/app/app-modules/supervisor/allocation/allocate-records.component.ts b/src/app/app-modules/supervisor/allocation/allocate-records.component.ts new file mode 100644 index 0000000..17efc95 --- /dev/null +++ b/src/app/app-modules/supervisor/allocation/allocate-records.component.ts @@ -0,0 +1,359 @@ +/* + * AMRIT – Accessible Medical Records via Integrated Technologies + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { + ChangeDetectionStrategy, + Component, + computed, + effect, + inject, + input, + OnInit, + output, + signal, +} from '@angular/core'; +import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; + +import { ZardButtonComponent } from '@common-ui/ui/button'; +import { ZardInputDirective } from '@common-ui/ui/input'; +import { ZardSelectImports } from '@common-ui/ui/select'; + +import { AllocationApiService, AllocationFlavor } from './allocation-api.service'; +import { NotificationService } from '@/app-modules/core/services/notification.service'; +import { SessionStore } from '@/app-modules/core/state/session.store'; +import { numOrNull } from '@/app-modules/core/utils/select-value'; + +/** Context handed down by the allocation/reallocation parents (old `outboundCallRequests`). */ +export interface AllocationContext { + /** Raw picker dates (the old app posted these instants on the grievance allocate too). */ + startDate?: Date; + endDate?: Date; + language?: string; + noOfRecords?: number; + assignedUserID?: number | string; + isAllocate?: boolean; +} + +export interface FilterAgent { + agentName: string; + roleID: number | string; + languageName: string; + assignedUserID: number | string; +} + +interface RoleRow { + roleID?: number | string; + roleName?: string; +} + +interface AgentRow { + userID?: number | string; + firstName?: string; + lastName?: string; +} + +/** + * Shared allocate-to-agents form (the old app had three near-identical copies: + * `outbound-allocate-records`, grievance and everwell `*-allocate-records`). + * Role → agents (multi) → count, then the flavor's allocation endpoint. + */ +@Component({ + selector: 'app-allocate-records', + imports: [ReactiveFormsModule, ZardButtonComponent, ZardInputDirective, ...ZardSelectImports], + changeDetection: ChangeDetectionStrategy.OnPush, + template: ` +
+ `, +}) +export class AllocateRecordsComponent implements OnInit { + private readonly fb = inject(FormBuilder); + private readonly api = inject(AllocationApiService); + private readonly notify = inject(NotificationService); + private readonly sessionStore = inject(SessionStore); + + readonly flavor = input.required+ Default shows calls between today and the next seven days. +
+ + +| Language | +No. of Records | ++ |
|---|---|---|
| {{ row.language }} | +{{ row.count }} | ++ @if (row.language !== 'All') { + + } + | +
| + No Records Found + | +||
| Language | +No. of Records | ++ |
|---|---|---|
| {{ row.language }} | +{{ row.count }} | +
+ @if (row.language !== 'All') {
+
+
+
+
+ }
+ |
+