add archive featcher to role , brtanch , car_mainte also update client and clien_addres create car mainte fails and update car fails delete car_maint from saidbar and but it in car model also update car image display

This commit is contained in:
m7amedez1122
2026-07-06 17:41:12 +03:00
parent 25f3468d74
commit a7e53f2047
56 changed files with 3864 additions and 147 deletions

View File

@@ -3,7 +3,7 @@
import { useCallback, useEffect, useState } from "react";
import { useParams, useRouter } from "next/navigation";
import { Alert, Toast } from "@/src/Components/UI";
import { Alert, Toast, ArchiveButton } from "@/src/Components/UI";
import { useClientAddresses } from "@/src/hooks/useClientAddresses";
import { clientService } from "@/src/services/client.service";
@@ -13,6 +13,7 @@ import type { Client, ClientFormData } from "@/src/types/client";
import type { ClientAddress } from "@/src/types/client_adresses";
import { AddressFormModal, DeleteConfirmModal, ClientFormModal } from "@/src/Components/Client";
import { ArchivedClientsAddressesModal } from "@/src/Components/Client_Adress/archive/ArchivedClientsAddressesModal";
import type {
CreateAddressFormValues,
UpdateAddressFormValues,
@@ -352,6 +353,8 @@ export default function ClientAddressesPage() {
const [deleteTarget, setDeleteTarget] = useState<ClientAddress | null>(null);
const [deleting, setDeleting] = useState(false);
const [editingClient, setEditingClient] = useState(false);
// Archive browser modal open/closed — scoped to this client's addresses
const [archiveOpen, setArchiveOpen] = useState(false);
// ── Address form handler ─────────────────────────────────────────────────
const handleAddressSubmit = async (
@@ -445,6 +448,14 @@ export default function ClientAddressesPage() {
/>
)}
{/* Archived addresses browser — scoped to this client */}
{archiveOpen && (
<ArchivedClientsAddressesModal
clientId={clientId}
onClose={() => setArchiveOpen(false)}
/>
)}
<section style={{ display: "flex", flexDirection: "column", gap: "1.5rem" }}>
{/* ── Header ── */}
@@ -655,6 +666,9 @@ export default function ClientAddressesPage() {
</div>
)}
</section>
{/* Floating button to open the address archive for this client */}
<ArchiveButton onClick={() => setArchiveOpen(true)} label="أرشيف العناوين" />
</>
);
}