import { ErrorAlert, NotFoundCard, PageHeader } from "@erp/core/components";
import { UnsavedChangesProvider, UpdateCommitButtonGroup } from "@erp/core/hooks";
import { AppContent, AppHeader, BackHistoryButton } from "@repo/rdx-ui/components";
import { FormProvider } from "react-hook-form";
import { useTranslation } from "../../../i18n";
import { useCustomerUpdatePageController } from "../../controllers";
import { CustomerEditorSkeleton } from "../components";
import { CustomerUpdateEditorForm } from "../editor";
export const CustomerUpdatePage = () => {
const { t } = useTranslation();
const { updateCtrl } = useCustomerUpdatePageController();
const {
form,
formId,
onSubmit,
resetForm,
customerData,
isLoading,
isLoadError,
loadError,
isUpdating,
isUpdateError,
updateError,
} = updateCtrl;
const isDirty = form.formState.isDirty;
if (isLoading) {
return ;
}
if (isLoadError) {
return (
<>
>
);
}
if (!customerData)
return (
<>
>
);
return (
}
title={t("pages.update.title")}
/>
{/* Alerta de error de actualización (si ha fallado el último intento) */}
{isUpdateError && (
)}
);
};