corregido estado, estatus osp

This commit is contained in:
2026-04-12 20:59:15 -04:00
parent ce1727525b
commit 8f207e675c
6 changed files with 67 additions and 90 deletions

View File

@@ -107,7 +107,8 @@ export function CreateTrainingForm({
coorPhone: defaultValues?.coorPhone || '',
visitDate: formatToLocalISO(defaultValues?.visitDate),
productiveActivity: defaultValues?.productiveActivity || undefined,
productiveActivityOther: defaultValues?.productiveActivityOther || undefined,
productiveActivityOther:
defaultValues?.productiveActivityOther || undefined,
ecoSector: defaultValues?.ecoSector || undefined,
productiveSector: defaultValues?.productiveSector || undefined,
centralProductiveActivity:
@@ -172,7 +173,7 @@ export function CreateTrainingForm({
womenCount: defaultValues?.womenCount || 0,
menCount: defaultValues?.menCount || 0,
surveyStatus: defaultValues?.surveyStatus || 'BORRADOR'
surveyStatus: defaultValues?.surveyStatus || 'BORRADOR',
},
mode: 'onChange',
});
@@ -240,7 +241,7 @@ export function CreateTrainingForm({
productiveSector,
centralProductiveActivity,
mainProductiveActivity,
productiveActivity
productiveActivity,
]);
const stateOptions = dataState?.data || [{ id: 0, name: 'Sin estados' }];
@@ -690,26 +691,23 @@ export function CreateTrainingForm({
)}
/>
{other && (<FormField
control={form.control}
name="productiveActivityOther"
render={({ field }) => (
<FormItem className="w-full flex flex-col space-y-3">
<FormLabel className="whitespace-normal leading-tight font-semibold">
¿Cuál otra Actividad Productiva?
</FormLabel>
<FormControl>
<Input
{...field}
value={field.value}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>)}
{other && (
<FormField
control={form.control}
name="productiveActivityOther"
render={({ field }) => (
<FormItem className="w-full flex flex-col space-y-3">
<FormLabel className="whitespace-normal leading-tight font-semibold">
¿Cuál otra Actividad Productiva?
</FormLabel>
<FormControl>
<Input {...field} value={field.value} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
<FormField
control={form.control}
@@ -756,11 +754,7 @@ export function CreateTrainingForm({
Año de constitución
</FormLabel>
<FormControl>
<Input
type="number"
{...field}
value={field.value}
/>
<Input type="number" {...field} value={field.value} />
</FormControl>
<FormMessage />
</FormItem>
@@ -1291,11 +1285,7 @@ export function CreateTrainingForm({
Correo Electrónico de la Comuna (Opcional)
</FormLabel>
<FormControl>
<Input
type="email"
{...field}
value={field.value}
/>
<Input type="email" {...field} value={field.value} />
</FormControl>
<FormMessage />
</FormItem>
@@ -1405,11 +1395,7 @@ export function CreateTrainingForm({
Correo Electrónico del Consejo Comunal (Opcional)
</FormLabel>
<FormControl>
<Input
type="email"
{...field}
value={field.value}
/>
<Input type="email" {...field} value={field.value} />
</FormControl>
<FormMessage />
</FormItem>
@@ -1555,9 +1541,7 @@ export function CreateTrainingForm({
</div>
<div className="flex flex-col gap-2">
<FormLabel>
Subir imágenes (Máximo 3 y opcional)
</FormLabel>
<FormLabel>Subir imágenes (Máximo 3 y opcional)</FormLabel>
<Input
type="file"
multiple
@@ -1643,13 +1627,8 @@ export function CreateTrainingForm({
</CardContent>
</Card>
<div className="grid grid-cols-2 md:grid-cols-3 justify-items-end gap-3 mt-8">
<Button
variant="outline"
type="button"
onClick={onCancel}
className="w-32 col-span-2 md:col-span-1"
>
<div className="flex justify-end gap-4">
<Button variant="outline" type="button" onClick={onCancel}>
Cancelar
</Button>
@@ -1668,8 +1647,10 @@ export function CreateTrainingForm({
</SelectTrigger>
</FormControl>
<SelectContent>
<SelectItem defaultChecked value="BORRADOR">BORRADOR</SelectItem>
<SelectItem value="PUBLICADO">PUBLICADO</SelectItem>
<SelectItem defaultChecked value="BORRADOR">
BORRADOR
</SelectItem>
<SelectItem value="COMPLETADA">COMPLETADA</SelectItem>
</SelectContent>
</Select>
<FormMessage />

View File

@@ -43,22 +43,13 @@ export function columns({ apiUrl }: ColumnsProps): ColumnDef<TrainingSchema>[] {
return date ? new Date(date).toLocaleString() : 'N/A';
},
},
{
accessorKey: 'visitDate',
header: 'Fecha Visita',
cell: ({ row }) => {
const date = row.getValue('visitDate') as string;
return date ? new Date(date).toLocaleString() : 'N/A';
},
},
{
accessorKey: 'surveyStatus',
header: '',
cell: ({ row }) => {
const status = row.getValue('surveyStatus') as string;
return (
<Badge variant={status === 'PUBLICADO' ? 'default' : 'secondary'}>
<Badge variant={status === 'COMPLETADA' ? 'success' : 'secondary'}>
{status}
</Badge>
);