fixed some types, add some labels
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
import apiClient from "@/lib/api/client";
|
||||
import type { LocalizedText } from "@/features/branches/api/branchesApi";
|
||||
|
||||
// ─── Card Order ───────────────────────────────────────────────────────────────
|
||||
|
||||
export interface CardOrder {
|
||||
id: number;
|
||||
uniqueId: string;
|
||||
cardStateId: number;
|
||||
cardTypeId: number;
|
||||
cardState: { id: number; name: LocalizedText | string } | null;
|
||||
cardType: { id: number; name: LocalizedText | string } | null;
|
||||
region: string;
|
||||
branchId: number;
|
||||
branch: { id: number; name: LocalizedText | string } | null;
|
||||
user: { id: number; name: string; username: string; phone: string; email: string } | null;
|
||||
customerName: string;
|
||||
customerSurname: string;
|
||||
customerPatronicName: string;
|
||||
@@ -31,7 +33,6 @@ export interface CardOrder {
|
||||
passportThree: string;
|
||||
passportFour: string;
|
||||
notes: string;
|
||||
userId: number;
|
||||
paid: boolean;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
|
||||
@@ -431,12 +431,12 @@ function StepContact({ form, errors, set, t, initialData }: StepContentProps & {
|
||||
label: u.name || `${u.firstName || ""} ${u.lastName || ""}`.trim() || u.username || String(u.id),
|
||||
}));
|
||||
|
||||
if (initialData?.userId && !opts.some((o) => o.value === String(initialData.userId))) {
|
||||
if (initialData?.user?.id && !opts.some((o) => o.value === String(initialData.user!.id))) {
|
||||
opts.unshift({
|
||||
value: String(initialData.userId),
|
||||
value: String(initialData.user!.id),
|
||||
label: initialData.customerName
|
||||
? `${initialData.customerName} ${initialData.customerSurname || ""}`.trim()
|
||||
: String(initialData.userId),
|
||||
: String(initialData.user!.id),
|
||||
});
|
||||
}
|
||||
return opts;
|
||||
@@ -732,10 +732,10 @@ function mapInitial(data: CardOrder): Partial<OrderNewCardFormData> {
|
||||
uniqueId: data.uniqueId,
|
||||
status: data.status,
|
||||
paid: data.paid,
|
||||
cardStateId: String(data.cardStateId ?? ""),
|
||||
cardTypeId: String(data.cardTypeId ?? ""),
|
||||
cardStateId: String(data.cardState?.id ?? ""),
|
||||
cardTypeId: String(data.cardType?.id ?? ""),
|
||||
region: data.region ?? "",
|
||||
branchId: String(data.branchId ?? ""),
|
||||
branchId: String(data.branch?.id ?? ""),
|
||||
customerName: data.customerName,
|
||||
customerSurname: data.customerSurname,
|
||||
customerPatronicName: data.customerPatronicName ?? "",
|
||||
@@ -756,7 +756,7 @@ function mapInitial(data: CardOrder): Partial<OrderNewCardFormData> {
|
||||
passportAddress: data.passportAddress ?? "",
|
||||
realAddress: data.realAddress ?? "",
|
||||
jobLocation: data.jobLocation ?? "",
|
||||
userId: String(data.userId ?? ""),
|
||||
userId: String(data.user?.id ?? ""),
|
||||
notes: data.notes ?? "",
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user