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:
@@ -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="أرشيف العناوين" />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import { useRouter } from "next/navigation";
|
||||
|
||||
// ── UI components ──────────────────────────────────────────────────────────
|
||||
// NOTE: Toast is now imported from the canonical UI barrel, NOT from Client/Toast.
|
||||
import { Alert, Toast } from "@/src/Components/UI";
|
||||
import { Alert, Toast, ArchiveButton } from "@/src/Components/UI";
|
||||
|
||||
// ── Client-specific components ─────────────────────────────────────────────
|
||||
import { useClients } from "@/src/hooks/useClients";
|
||||
@@ -14,6 +14,8 @@ import type { Client, ClientFormData } from "@/src/types/client";
|
||||
import { ClientFormModal } from "@/src/Components/Client/Clientformmodal";
|
||||
import { ClientTable } from "@/src/Components/Client/Clienttable";
|
||||
import { DeleteConfirmModal } from "@/src/Components/Client/Deleteconfirmmodal";
|
||||
import { ArchivedClientsModal } from "@/src/Components/Client/archive/ArchivedClientsModal";
|
||||
|
||||
|
||||
export default function ClientsPage() {
|
||||
const router = useRouter();
|
||||
@@ -23,6 +25,8 @@ export default function ClientsPage() {
|
||||
const [formTarget, setFormTarget] = useState<Client | null | false>(false);
|
||||
const [deleteTarget, setDeleteTarget] = useState<Client | null>(null);
|
||||
const [deleting, setDeleting] = useState(false);
|
||||
// Archive browser modal open/closed
|
||||
const [archiveOpen, setArchiveOpen] = useState(false);
|
||||
|
||||
// ── Data hook ────────────────────────────────────────────────────────────
|
||||
const {
|
||||
@@ -87,6 +91,11 @@ export default function ClientsPage() {
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Archive browser modal */}
|
||||
{archiveOpen && (
|
||||
<ArchivedClientsModal onClose={() => setArchiveOpen(false)} />
|
||||
)}
|
||||
|
||||
<section style={{ display: "flex", flexDirection: "column", gap: "1.5rem" }}>
|
||||
|
||||
{/* ── Page header ── */}
|
||||
@@ -244,6 +253,9 @@ export default function ClientsPage() {
|
||||
onManageAddresses={handleManageAddresses}
|
||||
/>
|
||||
</section>
|
||||
|
||||
{/* Floating button to open the archive browser */}
|
||||
<ArchiveButton onClick={() => setArchiveOpen(true)} label="أرشيف العملاء" />
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user