diff --git a/resources/ts/back/Pages/Document/Form.tsx b/resources/ts/back/Pages/Document/Form.tsx index 5969b729..5ef837d0 100644 --- a/resources/ts/back/Pages/Document/Form.tsx +++ b/resources/ts/back/Pages/Document/Form.tsx @@ -137,7 +137,7 @@ export default function Form({ }), ).ucFirst().value()} placeholder={"ex: " + enumDocStatus.unpublished.label} - selected={String(data.status)} + selected={Number(data.status)} setData={setData} /> diff --git a/resources/ts/lib/mapPivotOptions.ts b/resources/ts/lib/mapPivotOptions.ts index d846534f..bfbe3b14 100644 --- a/resources/ts/lib/mapPivotOptions.ts +++ b/resources/ts/lib/mapPivotOptions.ts @@ -13,16 +13,16 @@ export function mapPivotOptions< /** If we have a translatable field we pass the current locale */ locale?: string | null ) { - const options = model.map((opt) => { + const options = (model && model.length) ? model.map((opt) => { const raw = opt[valueKey as keyof typeof opt] as unknown as string; - return { value: opt.id.toString(), label: locale && typeof raw === "object" ? raw[locale] : raw }; - }); + }) : []; + const defaultValue: string[] = data && valueKey ? data.map((item) => { return item.id.toString();