fix: rework org admin form with full business-rule validation

This commit is contained in:
David 2026-06-07 18:11:09 +02:00
parent aa301eb447
commit 295874e11f
4 changed files with 553 additions and 311 deletions

View File

@ -30,19 +30,7 @@ interface Organization {
createdAt: string;
}
export default function AdminOrganizationsPage() {
const t = useTranslations('dashboard.admin.organizations');
const [organizations, setOrganizations] = useState<Organization[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [selectedOrg, setSelectedOrg] = useState<Organization | null>(null);
const [showCreateModal, setShowCreateModal] = useState(false);
const [showEditModal, setShowEditModal] = useState(false);
const [verifyingId, setVerifyingId] = useState<string | null>(null);
// Form state
const [formData, setFormData] = useState<{
interface FormData {
name: string;
type: string;
scac: string;
@ -54,12 +42,15 @@ export default function AdminOrganizationsPage() {
address: {
street: string;
city: string;
state?: string;
state: string;
postalCode: string;
country: string;
};
logoUrl: string;
}>({
isActive: boolean;
}
const EMPTY_FORM: FormData = {
name: '',
type: 'FREIGHT_FORWARDER',
scac: '',
@ -68,15 +59,34 @@ export default function AdminOrganizationsPage() {
eori: '',
contact_phone: '',
contact_email: '',
address: {
street: '',
city: '',
state: '',
postalCode: '',
country: 'FR',
},
address: { street: '', city: '', state: '', postalCode: '', country: 'FR' },
logoUrl: '',
});
isActive: true,
};
function FieldHint({ children }: { children: React.ReactNode }) {
return <p className="mt-1 text-xs text-gray-400">{children}</p>;
}
function FieldError({ message }: { message?: string }) {
if (!message) return null;
return <p className="mt-1 text-xs text-red-600">{message}</p>;
}
export default function AdminOrganizationsPage() {
const t = useTranslations('dashboard.admin.organizations');
const [organizations, setOrganizations] = useState<Organization[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [selectedOrg, setSelectedOrg] = useState<Organization | null>(null);
const [showCreateModal, setShowCreateModal] = useState(false);
const [showEditModal, setShowEditModal] = useState(false);
const [verifyingId, setVerifyingId] = useState<string | null>(null);
const [formData, setFormData] = useState<FormData>(EMPTY_FORM);
const [formError, setFormError] = useState<string | null>(null);
const [fieldErrors, setFieldErrors] = useState<Partial<Record<string, string>>>({});
const [submitting, setSubmitting] = useState(false);
useEffect(() => {
fetchOrganizations();
@ -95,70 +105,120 @@ export default function AdminOrganizationsPage() {
}
};
const handleCreate = async (e: React.FormEvent) => {
e.preventDefault();
try {
const apiData = {
name: formData.name,
type: formData.type as any,
address: {
const validateForm = (isCreate: boolean): boolean => {
const errors: Partial<Record<string, string>> = {};
if (!formData.name.trim() || formData.name.trim().length < 2) {
errors.name = t('validation.nameTooShort');
}
if (isCreate && formData.type === 'CARRIER') {
if (!formData.scac) {
errors.scac = t('validation.scacRequired');
} else if (!/^[A-Z]{4}$/.test(formData.scac)) {
errors.scac = t('validation.scacFormat');
}
}
if (formData.siren && !/^[0-9]{9}$/.test(formData.siren)) {
errors.siren = t('validation.sirenFormat');
}
if (formData.siret && !/^[0-9]{14}$/.test(formData.siret)) {
errors.siret = t('validation.siretFormat');
}
if (!formData.address.street.trim()) errors.street = t('validation.required');
if (!formData.address.city.trim()) errors.city = t('validation.required');
if (!formData.address.postalCode.trim()) errors.postalCode = t('validation.required');
if (!/^[A-Z]{2}$/.test(formData.address.country)) {
errors.country = t('validation.countryFormat');
}
setFieldErrors(errors);
return Object.keys(errors).length === 0;
};
const buildApiAddress = () => ({
street: formData.address.street,
city: formData.address.city,
postalCode: formData.address.postalCode,
country: formData.address.country,
...(formData.address.state ? { state: formData.address.state } : {}),
},
});
const handleCreate = async (e: React.FormEvent) => {
e.preventDefault();
setFormError(null);
if (!validateForm(true)) return;
setSubmitting(true);
try {
await createOrganization({
name: formData.name.trim(),
type: formData.type as any,
address: buildApiAddress(),
contact_email: formData.contact_email || undefined,
contact_phone: formData.contact_phone || undefined,
logo_url: formData.logoUrl || undefined,
logoUrl: formData.logoUrl || undefined,
...(formData.siren ? { siren: formData.siren } : {}),
...(formData.siret ? { siret: formData.siret } : {}),
...(formData.eori ? { eori: formData.eori } : {}),
...(formData.scac ? { scac: formData.scac } : {}),
};
await createOrganization(apiData);
});
await fetchOrganizations();
setShowCreateModal(false);
resetForm();
} catch (err: any) {
alert(err.message || t('createError'));
setFormError(err.message || t('createError'));
} finally {
setSubmitting(false);
}
};
const handleUpdate = async (e: React.FormEvent) => {
e.preventDefault();
if (!selectedOrg) return;
setFormError(null);
if (!validateForm(false)) return;
setSubmitting(true);
try {
await updateOrganization(selectedOrg.id, formData);
await updateOrganization(selectedOrg.id, {
name: formData.name.trim(),
address: buildApiAddress(),
contact_email: formData.contact_email || undefined,
contact_phone: formData.contact_phone || undefined,
logoUrl: formData.logoUrl || undefined,
isActive: formData.isActive,
...(formData.siren ? { siren: formData.siren } : {}),
...(formData.siret ? { siret: formData.siret } : {}),
...(formData.eori ? { eori: formData.eori } : {}),
});
await fetchOrganizations();
setShowEditModal(false);
setSelectedOrg(null);
resetForm();
} catch (err: any) {
alert(err.message || t('updateError'));
setFormError(err.message || t('updateError'));
} finally {
setSubmitting(false);
}
};
const resetForm = () => {
setFormData({
name: '',
type: 'FREIGHT_FORWARDER',
scac: '',
siren: '',
siret: '',
eori: '',
contact_phone: '',
contact_email: '',
address: {
street: '',
city: '',
state: '',
postalCode: '',
country: 'FR',
},
logoUrl: '',
});
setFormData(EMPTY_FORM);
setFormError(null);
setFieldErrors({});
};
const handleTypeChange = (newType: string) => {
setFormData(prev => ({
...prev,
type: newType,
scac: newType !== 'CARRIER' ? '' : prev.scac,
}));
setFieldErrors(prev => ({ ...prev, scac: undefined }));
};
const handleVerifySiret = async (orgId: string) => {
@ -222,20 +282,41 @@ export default function AdminOrganizationsPage() {
eori: org.eori || '',
contact_phone: org.contact_phone || '',
contact_email: org.contact_email || '',
address: org.address,
address: {
street: org.address.street,
city: org.address.city,
state: org.address.state || '',
postalCode: org.address.postalCode,
country: org.address.country,
},
logoUrl: org.logoUrl || '',
isActive: org.isActive,
});
setFormError(null);
setFieldErrors({});
setShowEditModal(true);
};
const closeModal = () => {
setShowCreateModal(false);
setShowEditModal(false);
setSelectedOrg(null);
resetForm();
};
const getTypeLabel = (type: string) => {
const allowed = ['FREIGHT_FORWARDER', 'CARRIER', 'SHIPPER'];
if (allowed.includes(type)) {
return t(`types.${type}` as any);
}
if (allowed.includes(type)) return t(`types.${type}` as any);
return type.replace('_', ' ');
};
const inputClass = (hasError?: string) =>
`mt-1 block w-full px-3 py-2 border rounded-md shadow-sm focus:outline-none text-sm ${
hasError
? 'border-red-400 focus:border-red-500 focus:ring-red-500'
: 'border-gray-300 focus:border-blue-500 focus:ring-blue-500'
}`;
if (loading) {
return (
<div className="flex items-center justify-center h-96">
@ -262,7 +343,6 @@ export default function AdminOrganizationsPage() {
}
/>
{/* Error Message */}
{error && (
<div className="bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg">
{error}
@ -384,70 +464,135 @@ export default function AdminOrganizationsPage() {
{/* Create / Edit Modal */}
{(showCreateModal || showEditModal) && (
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 overflow-y-auto">
<div className="bg-white rounded-lg p-6 max-w-2xl w-full m-4 max-h-[90vh] overflow-y-auto">
<h2 className="text-xl font-bold mb-4">
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 overflow-y-auto py-4">
<div className="bg-white rounded-lg p-6 max-w-2xl w-full mx-4 max-h-[90vh] overflow-y-auto">
<h2 className="text-xl font-bold mb-6">
{showCreateModal ? t('modal.createTitle') : t('modal.editTitle')}
</h2>
<form onSubmit={showCreateModal ? handleCreate : handleUpdate} className="space-y-4">
<form
onSubmit={showCreateModal ? handleCreate : handleUpdate}
noValidate
className="space-y-5"
>
{/* ── Informations générales ── */}
<section>
<h3 className="text-sm font-semibold text-gray-500 uppercase tracking-wide mb-3">
{t('modal.sectionGeneral')}
</h3>
<div className="grid grid-cols-2 gap-4">
<div className="col-span-2">
<label className="block text-sm font-medium text-gray-700">
{t('modal.name')}
{t('modal.name')} <span className="text-red-500">*</span>
</label>
<input
type="text"
required
value={formData.name}
onChange={e => setFormData({ ...formData, name: e.target.value })}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
onChange={e => {
setFormData({ ...formData, name: e.target.value });
setFieldErrors(prev => ({ ...prev, name: undefined }));
}}
minLength={2}
maxLength={200}
className={inputClass(fieldErrors.name)}
placeholder="Acme Freight Forwarding"
/>
<FieldError message={fieldErrors.name} />
</div>
<div>
<label className="block text-sm font-medium text-gray-700">
{t('modal.type')}
{t('modal.type')} <span className="text-red-500">*</span>
</label>
{showCreateModal ? (
<select
value={formData.type}
onChange={e => setFormData({ ...formData, type: e.target.value })}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
onChange={e => handleTypeChange(e.target.value)}
className={inputClass()}
>
<option value="FREIGHT_FORWARDER">{t('types.FREIGHT_FORWARDER')}</option>
<option value="CARRIER">{t('types.CARRIER')}</option>
<option value="SHIPPER">{t('types.SHIPPER')}</option>
</select>
) : (
<div className="mt-1 flex items-center gap-2">
<span
className={`px-2 py-1 text-xs font-semibold rounded-full ${
formData.type === 'FREIGHT_FORWARDER'
? 'bg-blue-100 text-blue-800'
: formData.type === 'CARRIER'
? 'bg-green-100 text-green-800'
: 'bg-purple-100 text-purple-800'
}`}
>
{getTypeLabel(formData.type)}
</span>
<span className="text-xs text-gray-400">{t('modal.typeReadOnly')}</span>
</div>
)}
</div>
{formData.type === 'CARRIER' && (
{/* SCAC — création uniquement, visible en lecture seule en édition si CARRIER */}
{showCreateModal && formData.type === 'CARRIER' && (
<div>
<label className="block text-sm font-medium text-gray-700">
{t('modal.scacLabel')} <span className="text-red-500">*</span>
</label>
<input
type="text"
value={formData.scac}
onChange={e => {
const v = e.target.value.toUpperCase().replace(/[^A-Z]/g, '');
setFormData({ ...formData, scac: v });
setFieldErrors(prev => ({ ...prev, scac: undefined }));
}}
maxLength={4}
minLength={4}
className={inputClass(fieldErrors.scac)}
placeholder="MAEU"
/>
<FieldHint>{t('modal.scacHint')}</FieldHint>
<FieldError message={fieldErrors.scac} />
</div>
)}
{showEditModal && formData.type === 'CARRIER' && formData.scac && (
<div>
<label className="block text-sm font-medium text-gray-700">
{t('modal.scacLabel')}
</label>
<input
type="text"
required={formData.type === 'CARRIER'}
maxLength={4}
value={formData.scac}
onChange={e =>
setFormData({ ...formData, scac: e.target.value.toUpperCase() })
}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
/>
<div className="mt-1 px-3 py-2 bg-gray-50 border border-gray-200 rounded-md text-sm text-gray-700 font-mono">
{formData.scac}
</div>
<FieldHint>{t('modal.typeReadOnly')}</FieldHint>
</div>
)}
</div>
</section>
{/* ── Identifiants légaux ── */}
<section>
<h3 className="text-sm font-semibold text-gray-500 uppercase tracking-wide mb-3">
{t('modal.sectionLegal')}
</h3>
<div className="grid grid-cols-2 gap-4">
<div>
<label className="block text-sm font-medium text-gray-700">
{t('modal.sirenLabel')}
</label>
<input
type="text"
maxLength={9}
value={formData.siren}
onChange={e => setFormData({ ...formData, siren: e.target.value })}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
onChange={e => {
const v = e.target.value.replace(/\D/g, '').slice(0, 9);
setFormData({ ...formData, siren: v });
setFieldErrors(prev => ({ ...prev, siren: undefined }));
}}
maxLength={9}
className={inputClass(fieldErrors.siren)}
placeholder="123456789"
/>
<FieldHint>{t('modal.sirenHint')}</FieldHint>
<FieldError message={fieldErrors.siren} />
</div>
<div>
@ -456,17 +601,21 @@ export default function AdminOrganizationsPage() {
</label>
<input
type="text"
maxLength={14}
value={formData.siret}
onChange={e =>
setFormData({ ...formData, siret: e.target.value.replace(/\D/g, '') })
}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
placeholder={t('modal.siretPlaceholder')}
onChange={e => {
const v = e.target.value.replace(/\D/g, '').slice(0, 14);
setFormData({ ...formData, siret: v });
setFieldErrors(prev => ({ ...prev, siret: undefined }));
}}
maxLength={14}
className={inputClass(fieldErrors.siret)}
placeholder="12345678901234"
/>
<FieldHint>{t('modal.siretHint')}</FieldHint>
<FieldError message={fieldErrors.siret} />
</div>
<div>
<div className="col-span-2">
<label className="block text-sm font-medium text-gray-700">
{t('modal.eoriLabel')}
</label>
@ -474,7 +623,30 @@ export default function AdminOrganizationsPage() {
type="text"
value={formData.eori}
onChange={e => setFormData({ ...formData, eori: e.target.value })}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
className={inputClass()}
placeholder="FR123456789"
/>
<FieldHint>{t('modal.eoriHint')}</FieldHint>
</div>
</div>
</section>
{/* ── Contact ── */}
<section>
<h3 className="text-sm font-semibold text-gray-500 uppercase tracking-wide mb-3">
{t('modal.sectionContact')}
</h3>
<div className="grid grid-cols-2 gap-4">
<div>
<label className="block text-sm font-medium text-gray-700">
{t('modal.contactEmail')}
</label>
<input
type="email"
value={formData.contact_email}
onChange={e => setFormData({ ...formData, contact_email: e.target.value })}
className={inputClass()}
placeholder="contact@exemple.com"
/>
</div>
@ -486,74 +658,68 @@ export default function AdminOrganizationsPage() {
type="tel"
value={formData.contact_phone}
onChange={e => setFormData({ ...formData, contact_phone: e.target.value })}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
className={inputClass()}
placeholder="+33 6 00 00 00 00"
/>
</div>
<div>
<label className="block text-sm font-medium text-gray-700">
{t('modal.contactEmail')}
</label>
<input
type="email"
value={formData.contact_email}
onChange={e => setFormData({ ...formData, contact_email: e.target.value })}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
/>
</div>
</section>
{/* ── Adresse ── */}
<section>
<h3 className="text-sm font-semibold text-gray-500 uppercase tracking-wide mb-3">
{t('modal.sectionAddress')}
</h3>
<div className="grid grid-cols-2 gap-4">
<div className="col-span-2">
<label className="block text-sm font-medium text-gray-700">
{t('modal.street')}
{t('modal.street')} <span className="text-red-500">*</span>
</label>
<input
type="text"
required
value={formData.address.street}
onChange={e =>
setFormData({
...formData,
address: { ...formData.address, street: e.target.value },
})
}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
onChange={e => {
setFormData({ ...formData, address: { ...formData.address, street: e.target.value } });
setFieldErrors(prev => ({ ...prev, street: undefined }));
}}
className={inputClass(fieldErrors.street)}
placeholder="123 Rue de la République"
/>
<FieldError message={fieldErrors.street} />
</div>
<div>
<label className="block text-sm font-medium text-gray-700">
{t('modal.city')}
{t('modal.city')} <span className="text-red-500">*</span>
</label>
<input
type="text"
required
value={formData.address.city}
onChange={e =>
setFormData({
...formData,
address: { ...formData.address, city: e.target.value },
})
}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
onChange={e => {
setFormData({ ...formData, address: { ...formData.address, city: e.target.value } });
setFieldErrors(prev => ({ ...prev, city: undefined }));
}}
className={inputClass(fieldErrors.city)}
placeholder="Paris"
/>
<FieldError message={fieldErrors.city} />
</div>
<div>
<label className="block text-sm font-medium text-gray-700">
{t('modal.postalCode')}
{t('modal.postalCode')} <span className="text-red-500">*</span>
</label>
<input
type="text"
required
value={formData.address.postalCode}
onChange={e =>
setFormData({
...formData,
address: { ...formData.address, postalCode: e.target.value },
})
}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
onChange={e => {
setFormData({ ...formData, address: { ...formData.address, postalCode: e.target.value } });
setFieldErrors(prev => ({ ...prev, postalCode: undefined }));
}}
className={inputClass(fieldErrors.postalCode)}
placeholder="75001"
/>
<FieldError message={fieldErrors.postalCode} />
</div>
<div>
@ -564,35 +730,43 @@ export default function AdminOrganizationsPage() {
type="text"
value={formData.address.state}
onChange={e =>
setFormData({
...formData,
address: { ...formData.address, state: e.target.value },
})
setFormData({ ...formData, address: { ...formData.address, state: e.target.value } })
}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
className={inputClass()}
placeholder="Île-de-France"
/>
</div>
<div>
<label className="block text-sm font-medium text-gray-700">
{t('modal.country')}
{t('modal.country')} <span className="text-red-500">*</span>
</label>
<input
type="text"
required
maxLength={2}
value={formData.address.country}
onChange={e =>
setFormData({
...formData,
address: { ...formData.address, country: e.target.value.toUpperCase() },
})
}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
onChange={e => {
const v = e.target.value.toUpperCase().replace(/[^A-Z]/g, '').slice(0, 2);
setFormData({ ...formData, address: { ...formData.address, country: v } });
setFieldErrors(prev => ({ ...prev, country: undefined }));
}}
maxLength={2}
minLength={2}
className={inputClass(fieldErrors.country)}
placeholder="FR"
/>
<FieldHint>{t('modal.countryHint')}</FieldHint>
<FieldError message={fieldErrors.country} />
</div>
</div>
</section>
<div className="col-span-2">
{/* ── Autres ── */}
<section>
<h3 className="text-sm font-semibold text-gray-500 uppercase tracking-wide mb-3">
{t('modal.sectionOther')}
</h3>
<div className="space-y-4">
<div>
<label className="block text-sm font-medium text-gray-700">
{t('modal.logoUrl')}
</label>
@ -600,29 +774,53 @@ export default function AdminOrganizationsPage() {
type="url"
value={formData.logoUrl}
onChange={e => setFormData({ ...formData, logoUrl: e.target.value })}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
className={inputClass()}
placeholder="https://exemple.com/logo.png"
/>
</div>
</div>
<div className="flex justify-end space-x-2 pt-4">
{showEditModal && (
<div className="flex items-center gap-3">
<input
id="isActive"
type="checkbox"
checked={formData.isActive}
onChange={e => setFormData({ ...formData, isActive: e.target.checked })}
className="h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"
/>
<label htmlFor="isActive" className="text-sm font-medium text-gray-700">
{t('modal.isActive')}
</label>
</div>
)}
</div>
</section>
{/* Erreur globale */}
{formError && (
<div className="bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-md text-sm">
{formError}
</div>
)}
<div className="flex justify-end space-x-3 pt-2 border-t border-gray-100">
<button
type="button"
onClick={() => {
setShowCreateModal(false);
setShowEditModal(false);
setSelectedOrg(null);
resetForm();
}}
className="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50"
onClick={closeModal}
className="px-4 py-2 border border-gray-300 rounded-md text-sm text-gray-700 hover:bg-gray-50 transition-colors"
>
{t('modal.cancel')}
</button>
<button
type="submit"
className="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700"
disabled={submitting}
className="px-4 py-2 bg-blue-600 text-white rounded-md text-sm font-medium hover:bg-blue-700 disabled:opacity-60 disabled:cursor-not-allowed transition-colors"
>
{showCreateModal ? t('modal.create') : t('modal.update')}
{submitting
? t('modal.saving')
: showCreateModal
? t('modal.create')
: t('modal.update')}
</button>
</div>
</form>

View File

@ -1200,24 +1200,46 @@
"modal": {
"createTitle": "Create New Organization",
"editTitle": "Edit Organization",
"name": "Organization Name *",
"type": "Type *",
"scacLabel": "SCAC Code *",
"sectionGeneral": "General information",
"sectionLegal": "Legal identifiers",
"sectionContact": "Contact",
"sectionAddress": "Address",
"sectionOther": "Other",
"name": "Organization name",
"type": "Type",
"typeReadOnly": "Cannot be changed after creation",
"scacLabel": "SCAC code",
"scacHint": "4 uppercase letters (e.g. MAEU). Required for carriers.",
"sirenLabel": "SIREN",
"siretLabel": "SIRET (14 digits)",
"sirenHint": "9 digits — optional",
"siretLabel": "SIRET",
"siretHint": "14 digits — optional",
"siretPlaceholder": "12345678901234",
"eoriLabel": "EORI",
"contactPhone": "Contact Phone",
"contactEmail": "Contact Email",
"street": "Street Address *",
"city": "City *",
"postalCode": "Postal Code *",
"eoriHint": "EU EORI number (e.g. FR123456789) — optional",
"contactEmail": "Contact email",
"contactPhone": "Contact phone",
"street": "Street address",
"city": "City",
"postalCode": "Postal code",
"state": "State / Region",
"country": "Country *",
"country": "Country",
"countryHint": "2-letter ISO code (e.g. FR, DE, US)",
"logoUrl": "Logo URL",
"isActive": "Active organization",
"cancel": "Cancel",
"create": "Create",
"update": "Update"
"update": "Update",
"saving": "Saving..."
},
"validation": {
"required": "This field is required",
"nameTooShort": "Name must be at least 2 characters",
"scacRequired": "SCAC code is required for carriers",
"scacFormat": "SCAC must be exactly 4 uppercase letters (e.g. MAEU)",
"sirenFormat": "SIREN must be exactly 9 digits",
"siretFormat": "SIRET must be exactly 14 digits",
"countryFormat": "Country must be a 2-letter ISO code (e.g. FR)"
}
},
"users": {

View File

@ -1200,24 +1200,46 @@
"modal": {
"createTitle": "Créer une nouvelle organisation",
"editTitle": "Modifier l'organisation",
"name": "Nom de l'organisation *",
"type": "Type *",
"scacLabel": "Code SCAC *",
"sectionGeneral": "Informations générales",
"sectionLegal": "Identifiants légaux",
"sectionContact": "Contact",
"sectionAddress": "Adresse",
"sectionOther": "Autres",
"name": "Nom de l'organisation",
"type": "Type",
"typeReadOnly": "Non modifiable après création",
"scacLabel": "Code SCAC",
"scacHint": "4 lettres majuscules (ex. MAEU). Obligatoire pour les transporteurs.",
"sirenLabel": "SIREN",
"siretLabel": "SIRET (14 chiffres)",
"sirenHint": "9 chiffres — facultatif",
"siretLabel": "SIRET",
"siretHint": "14 chiffres — facultatif",
"siretPlaceholder": "12345678901234",
"eoriLabel": "EORI",
"contactPhone": "Téléphone de contact",
"eoriHint": "Numéro EORI européen (ex. FR123456789) — facultatif",
"contactEmail": "Email de contact",
"street": "Rue *",
"city": "Ville *",
"postalCode": "Code postal *",
"contactPhone": "Téléphone de contact",
"street": "Rue",
"city": "Ville",
"postalCode": "Code postal",
"state": "État / Région",
"country": "Pays *",
"country": "Pays",
"countryHint": "Code ISO 2 lettres majuscules (ex. FR, DE, US)",
"logoUrl": "URL du logo",
"isActive": "Organisation active",
"cancel": "Annuler",
"create": "Créer",
"update": "Mettre à jour"
"update": "Mettre à jour",
"saving": "Enregistrement..."
},
"validation": {
"required": "Ce champ est obligatoire",
"nameTooShort": "Le nom doit comporter au moins 2 caractères",
"scacRequired": "Le code SCAC est obligatoire pour les transporteurs",
"scacFormat": "Le code SCAC doit comporter exactement 4 lettres majuscules (ex. MAEU)",
"sirenFormat": "Le SIREN doit comporter exactement 9 chiffres",
"siretFormat": "Le SIRET doit comporter exactement 14 chiffres",
"countryFormat": "Le pays doit être un code ISO à 2 lettres majuscules (ex. FR)"
}
},
"users": {

View File

@ -124,7 +124,7 @@ export interface CreateOrganizationRequest {
scac?: string;
contact_email?: string;
contact_phone?: string;
logo_url?: string;
logoUrl?: string;
}
export interface UpdateOrganizationRequest {