Algunos campos agregados/eliminados

This commit is contained in:
2026-01-28 13:50:10 -04:00
parent 5c080c6d32
commit 69843e9e68
10 changed files with 4955 additions and 138 deletions

View File

@@ -8,13 +8,13 @@ export default function NewTrainingPage() {
const router = useRouter();
return (
<PageContainer scrollable>
<div className="flex-1 space-y-4">
<CreateTrainingForm
onSuccess={() => router.push('/dashboard/formulario')}
onCancel={() => router.back()}
/>
</div>
</PageContainer>
// <PageContainer scrollable>
<div className="px-6 pt-2 pb-6 flex-1 space-y-4">
<CreateTrainingForm
onSuccess={() => router.push('/dashboard/formulario')}
onCancel={() => router.back()}
/>
</div>
// </PageContainer>
);
}

View File

@@ -37,25 +37,116 @@ import {
import { SelectSearchable } from '@repo/shadcn/select-searchable';
import React from 'react';
const PRODUCTIVE_ACTIVITIES = [
'Agricola',
'Textil',
'Bloquera',
'Carpinteria',
'Unidad de suministro',
];
// const PRODUCTIVE_ACTIVITIES = [
// 'Agricola',
// 'Textil',
// 'Bloquera',
// 'Carpinteria',
// 'Unidad de suministro',
// ];
const ECO_SECTORS = ['Primario', 'Secundario', 'Terciario'];
// const ECO_SECTORS_PRIMARIO = ['Agropecuario', 'Pesca', 'Minería', 'Forestal'];
// const ECO_SECTORS_SECUNDARIO = ['Manufactura', 'Construcción', 'Energía'];
const ECO_SECTORS_PRIMARIO = ['Agricola'];
const ECO_SECTORS_SECUNDARIO = ['Manufactura'];
const ECO_SECTORS_TERCIARIO = ['Servicios', 'Comercio', 'Turismo'];
const CENTRAL_PRODUCTIVE_ACTIVITY = ['Produción Vegetal', 'Produción Animal', 'Produción Animal y Vegetal'];
const MAIN_PRODUCTIVE_ACTIVITY = ['Agricultura', ''];
const PRODUCTIVE_SECTORS = ['Agricola', 'Manufactura', 'Servicios', 'Comercio', 'Turismo'];
const CENTRAL_PRODUCTIVE_ACTIVITY = [
'Produción Vegetal',
'Produción Animal',
'Produción Animal y Vegetal',
'INDUSTRIAL',
'SERVICIOS',
'TURISMO',
'COMERCIO'
];
// const PRODUCTIVE_SECTORS_PRIMARIO = ['Agricola'];
// const PRODUCTIVE_SECTORS_SECUNDARIO = ['Manufactura'];
// const PRODUCTIVE_SECTORS_TERCIARIO = ['Servicios', 'Comercio', 'Turismo'];
const MAIN_PRODUCTIVE_ACTIVITY = [
'AGRICULTURA ',
'CRIA ',
'PATIOS PRODUCTIVOS O CONUCOS ',
'TRANSFORMACION DE LA MATERIA PRIMA',
'TALLER DE COFECCION TEXTIL ',
'CONSTRUCION ',
'OFRECER PRODUCTOS DE BIENES Y SERVICIOS',
'VISITAS GUIADAS ',
'ALOJAMIENTO ',
'TURISMO',
'COMERCIO'
];
const PRODUCTIVE_ACTIVITIES = [
'SIEMBRA DE MAIZ ',
'SIEMBRA DE AJI',
'SIEMBRA DE CAFÉ ',
'SIEMBRA DE PLATANO',
'SIEMBRA DE CAMBUR ',
'SIEMBRA DE AGUACATE',
'SIEMBRA DE FRUTAS',
'SIEMBRA DE HORTALIZAS ',
'SIEMBRA DE TOMATE ',
'SIEMBRA DE CACAO',
'SIEMBRA DE PIMENTON ',
'SIEMBRA DE YUCA ',
'SIEMBRA DE CAÑA DE AZUCAR ',
'SIEMBRA DE GRANOS (CARAOTAS, FRIJOLES)',
'SIEMBRA DE ARROZ',
'SIEMBRA DE CEREALES (CEBADA, LINAZA, SOYA)',
'ELABORACION DE BIO-INSUMO (ABONO ORGANICO) ',
'BOVINO ',
'PORCINO',
'CAPRINO',
'CUNICULTURA',
'AVICOLA',
'PISCICULA',
'SIEMBRA Y CRIA ',
'ELABORACION DE PRODUCTOS QUIMICOS (LIMPIEZA E HIGIENE PERSONAL)',
'PANADERIAS',
'RESPOSTERIA ',
'ELABORACION DE HARINAS PRECOCIDA ',
'PLANTA ABA (ELABORACION DE ALIMENTOS BALANCEADOS PARA ANIMALES)',
'ELABORACION DE PRODUCTOS DERIVADO DE LA LECHE (VACA, CABRA, BUFFALA)',
'EMPAQUETADORAS DE GRANOS Y POLVOS ',
'ELABORACION DE ACEITE COMESTIBLE ',
'FABRICA DE HIELO',
'ELABORACION DE PAPELON',
'ARTESANIAS',
'ELABORACION DE UNIFORME ESCOLARES Y PRENDA DE VESTIR ',
'ELABORACION DE PRENDAS INTIMAS ',
'ELABORACION DE LENCERIA ',
'SUBLIMACION DE TEJIDOS ',
'ELABORACION DE CALZADOS ',
'BLOQUERAS ',
'PLANTA PREMEZCLADORA DE CEMENTO',
'CARPINTERIAS',
'HERRERIAS',
'MERCADOS COMUNALES',
'CENTROS DE ACOPIOS Y DISTRIBUCION',
'UNIDAD DE SUMINISTRO',
'MATADERO (SALA DE MATANZA DE ANIMALES)',
'PELUQUERIA',
'BARBERIA',
'AGENCIAS DE FESTEJOS',
'LAVANDERIAS',
'REPARACION DE CALZADOS',
'TALLER DE MECANICA',
'TRANSPORTES',
'RUTAS TURISTICAS',
'POSADAS',
'HOTELES',
'AGENCIAS DE VIAJES',
'VENTA DE VIVERES',
'VENTAS DE PRENDAS DE VESTIR',
'VENTA DE PRODUCTOS QUIMICOS Y DERIVADOS',
'BODEGAS COMUNALES',
'FRIGORIFICOS Y CARNICOS'
]
const OSP_TYPES = ['EPSIC', 'EPSDC', 'UPF', 'OTROS', 'COOPERATIVA'];
const STATUS_OPTIONS = ['ACTIVA', 'INACTIVA'];
@@ -77,71 +168,72 @@ export function CreateTrainingForm({
const isSaving = isCreating || isUpdating;
const [state, setState] = React.useState(0);
const [municipality, setMunicipality] = React.useState(0);
const [disabledMunicipality, setDisabledMunicipality] = React.useState(true);
const [disabledParish, setDisabledParish] = React.useState(true);
// const [state, setState] = React.useState(0);
// const [municipality, setMunicipality] = React.useState(0);
// const [disabledMunicipality, setDisabledMunicipality] = React.useState(true);
// const [disabledParish, setDisabledParish] = React.useState(true);
const [coor_state, setCoor_state] = React.useState(0);
const [coor_municipality, setCoor_municipality] = React.useState(0);
const [coorState, setcoorState] = React.useState(0);
const [coorMunicipality, setcoorMunicipality] = React.useState(0);
const [disabledCoorMunicipality, setDisabledCoorMunicipality] = React.useState(true);
const [disabledCoorParish, setDisabledCoorParish] = React.useState(true);
const [selectedFiles, setSelectedFiles] = React.useState<File[]>([]);
const { data: dataState } = useStateQuery();
const { data: dataMunicipality } = useMunicipalityQuery(state);
const { data: dataParish } = useParishQuery(municipality);
// const { data: dataState } = useStateQuery();
// const { data: dataMunicipality } = useMunicipalityQuery(state);
// const { data: dataParish } = useParishQuery(municipality);
const { data: dataCoorState } = useStateQuery();
const { data: dataCoorMunicipality } = useMunicipalityQuery(coor_state);
const { data: dataCoorParish } = useParishQuery(coor_municipality);
const { data: dataCoorMunicipality } = useMunicipalityQuery(coorState);
const { data: dataCoorParish } = useParishQuery(coorMunicipality);
const coor_stateOptions = dataCoorState?.data || [{ id: 0, name: 'Sin estados' }];
const coorStateOptions = dataCoorState?.data || [{ id: 0, name: 'Sin estados' }];
const coor_municipalityOptions =
const coorMunicipalityOptions =
Array.isArray(dataCoorMunicipality?.data) && dataCoorMunicipality.data.length > 0
? dataCoorMunicipality.data
: [{ id: 0, stateId: 0, name: 'Sin Municipios' }];
const coor_parishOptions =
const coorParishOptions =
Array.isArray(dataCoorParish?.data) && dataCoorParish.data.length > 0
? dataCoorParish.data
: [{ id: 0, stateId: 0, name: 'Sin Parroquias' }];
const stateOptions = dataState?.data || [{ id: 0, name: 'Sin estados' }];
// const stateOptions = dataState?.data || [{ id: 0, name: 'Sin estados' }];
const municipalityOptions =
Array.isArray(dataMunicipality?.data) && dataMunicipality.data.length > 0
? dataMunicipality.data
: [{ id: 0, stateId: 0, name: 'Sin Municipios' }];
// const municipalityOptions =
// Array.isArray(dataMunicipality?.data) && dataMunicipality.data.length > 0
// ? dataMunicipality.data
// : [{ id: 0, stateId: 0, name: 'Sin Municipios' }];
const parishOptions =
Array.isArray(dataParish?.data) && dataParish.data.length > 0
? dataParish.data
: [{ id: 0, stateId: 0, name: 'Sin Parroquias' }];
// const parishOptions =
// Array.isArray(dataParish?.data) && dataParish.data.length > 0
// ? dataParish.data
// : [{ id: 0, stateId: 0, name: 'Sin Parroquias' }];
// No local state needed for existing photos, we use form values
React.useEffect(() => {
if (defaultValues) {
if (defaultValues.state) {
setState(Number(defaultValues.state));
setDisabledMunicipality(false);
}
if (defaultValues.municipality) {
setMunicipality(Number(defaultValues.municipality));
setDisabledParish(false);
}
if (defaultValues.coor_state) {
setCoor_state(Number(defaultValues.coor_state));
// if (defaultValues.state) {
// setState(Number(defaultValues.state));
// setDisabledMunicipality(false);
// }
// if (defaultValues.municipality) {
// setMunicipality(Number(defaultValues.municipality));
// setDisabledParish(false);
// }
if (defaultValues.coorState) {
setcoorState(Number(defaultValues.coorState));
setDisabledCoorMunicipality(false);
}
if (defaultValues.coor_municipality) {
setCoor_municipality(Number(defaultValues.coor_municipality));
setDisabledParish(false);
if (defaultValues.coorMunicipality) {
setcoorMunicipality(Number(defaultValues.coorMunicipality));
setDisabledCoorParish(false);
}
}
}, [defaultValues]);
@@ -161,18 +253,44 @@ export function CreateTrainingForm({
defaultValues: {
firstname: defaultValues?.firstname || '',
lastname: defaultValues?.lastname || '',
coor_state: defaultValues?.coor_state || undefined,
coor_municipality: defaultValues?.coor_municipality || undefined,
coor_parish: defaultValues?.coor_parish || undefined,
coor_phone: defaultValues?.coor_phone || '',
coorState: defaultValues?.coorState || undefined,
coorMunicipality: defaultValues?.coorMunicipality || undefined,
coorParish: defaultValues?.coorParish || undefined,
coorPhone: defaultValues?.coorPhone || '',
visitDate: formatToLocalISO(defaultValues?.visitDate),
productiveActivity: defaultValues?.productiveActivity || '',
ecoSector: defaultValues?.ecoSector || '',
ecoSector: defaultValues?.ecoSector || undefined,
productiveSector: defaultValues?.productiveSector || undefined,
centralProductiveActivity: defaultValues?.centralProductiveActivity || '',
mainProductiveActivity: defaultValues?.mainProductiveActivity || '',
typesOfEquipment: defaultValues?.typesOfEquipment || '',
equipmentCount: defaultValues?.equipmentCount || 0,
equipmentDescription: defaultValues?.equipmentDescription || '',
rawMaterial: defaultValues?.rawMaterial || '',
materialType: defaultValues?.materialType || '',
rawMaterialCount: defaultValues?.rawMaterialCount || 0,
productCountDaily: defaultValues?.productCountDaily || 0,
productCountWeekly: defaultValues?.productCountWeekly || 0,
productCountMonthly: defaultValues?.productCountMonthly || 0,
financialRequirementDescription:
defaultValues?.financialRequirementDescription || '',
siturCodeCommune: defaultValues?.siturCodeCommune || '',
communeName: defaultValues?.communeName || '',
communeRif: defaultValues?.communeRif || '',
communeSpokespersonName: defaultValues?.communeSpokespersonName || '',
communeSpokespersonCedula: defaultValues?.communeSpokespersonCedula || '',
communeSpokespersonRif: defaultValues?.communeSpokespersonRif || '',
communeSpokespersonPhone: defaultValues?.communeSpokespersonPhone || '',
communeEmail: defaultValues?.communeEmail || '',
communalCouncil: defaultValues?.communalCouncil || '',
siturCodeCommunalCouncil: defaultValues?.siturCodeCommunalCouncil || '',
communalCouncilRif: defaultValues?.communalCouncilRif || '',
communalCouncilSpokespersonName: defaultValues?.communalCouncilSpokespersonName || '',
communalCouncilSpokespersonCedula: defaultValues?.communalCouncilSpokespersonCedula || '',
communalCouncilSpokespersonRif: defaultValues?.communalCouncilSpokespersonRif || '',
communalCouncilSpokespersonPhone: defaultValues?.communalCouncilSpokespersonPhone || '',
communalCouncilEmail: defaultValues?.communalCouncilEmail || '',
ospGoogleMapsLink: defaultValues?.ospGoogleMapsLink || '',
ospName: defaultValues?.ospName || '',
ospAddress: defaultValues?.ospAddress || '',
ospRif: defaultValues?.ospRif || '',
@@ -198,9 +316,9 @@ export function CreateTrainingForm({
photo2: defaultValues?.photo2 || '',
photo3: defaultValues?.photo3 || '',
paralysisReason: defaultValues?.paralysisReason || '',
state: defaultValues?.state || undefined,
municipality: defaultValues?.municipality || undefined,
parish: defaultValues?.parish || undefined,
// state: defaultValues?.state || undefined,
// municipality: defaultValues?.municipality || undefined,
// parish: defaultValues?.parish || undefined
},
mode: 'onChange',
});
@@ -296,7 +414,7 @@ export function CreateTrainingForm({
<FormField
control={form.control}
name="coor_phone"
name="coorPhone"
render={({ field }) => (
<FormItem>
<FormLabel>Telefono del coordinador Estadal</FormLabel>
@@ -310,18 +428,18 @@ export function CreateTrainingForm({
<FormField
control={form.control}
name="coor_state"
name="coorState"
render={({ field }) => (
<FormItem>
<FormLabel>Estado</FormLabel>
<SelectSearchable
options={stateOptions.map((item) => ({
options={coorStateOptions.map((item) => ({
value: item.id.toString(),
label: item.name,
}))}
onValueChange={(value) => {
field.onChange(Number(value));
setCoor_state(Number(value));
setcoorState(Number(value));
setDisabledCoorMunicipality(false);
setDisabledCoorParish(true);
}}
@@ -335,18 +453,18 @@ export function CreateTrainingForm({
<FormField
control={form.control}
name="coor_municipality"
name="coorMunicipality"
render={({ field }) => (
<FormItem>
<FormLabel>Municipio</FormLabel>
<SelectSearchable
options={municipalityOptions.map((item) => ({
options={coorMunicipalityOptions.map((item) => ({
value: item.id.toString(),
label: item.name,
}))}
onValueChange={(value) => {
field.onChange(Number(value));
setCoor_municipality(Number(value));
setcoorMunicipality(Number(value));
setDisabledCoorParish(false);
}}
placeholder="Selecciona un municipio"
@@ -360,12 +478,12 @@ export function CreateTrainingForm({
<FormField
control={form.control}
name="coor_parish"
name="coorParish"
render={({ field }) => (
<FormItem>
<FormLabel>Parroquia</FormLabel>
<SelectSearchable
options={parishOptions.map((item) => ({
options={coorParishOptions.map((item) => ({
value: item.id.toString(),
label: item.name,
}))}
@@ -463,12 +581,96 @@ export function CreateTrainingForm({
)}
/>
<FormField
control={form.control}
name="productiveSector"
render={({ field }) => (
<FormItem>
<FormLabel>Sector Productivo</FormLabel>
<Select
onValueChange={field.onChange}
defaultValue={field.value}
>
<FormControl>
<SelectTrigger className="w-full">
<SelectValue placeholder="Seleccione tipo" />
</SelectTrigger>
</FormControl>
<SelectContent>
{PRODUCTIVE_SECTORS.map((type) => (
<SelectItem key={type} value={type}>
{type}
</SelectItem>
))}
</SelectContent>
</Select>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="centralProductiveActivity"
render={({ field }) => (
<FormItem>
<FormLabel>Actividad Central Productivo</FormLabel>
<Select
onValueChange={field.onChange}
defaultValue={field.value}
>
<FormControl>
<SelectTrigger className="w-full">
<SelectValue placeholder="Seleccione tipo" />
</SelectTrigger>
</FormControl>
<SelectContent>
{CENTRAL_PRODUCTIVE_ACTIVITY.map((type) => (
<SelectItem key={type} value={type}>
{type}
</SelectItem>
))}
</SelectContent>
</Select>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="mainProductiveActivity"
render={({ field }) => (
<FormItem>
<FormLabel>Actividad Productiva</FormLabel>
<Select
onValueChange={field.onChange}
defaultValue={field.value}
>
<FormControl>
<SelectTrigger className="w-full">
<SelectValue placeholder="Seleccione tipo" />
</SelectTrigger>
</FormControl>
<SelectContent>
{PRODUCTIVE_ACTIVITIES.map((type) => (
<SelectItem key={type} value={type}>
{type}
</SelectItem>
))}
</SelectContent>
</Select>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="ospRif"
render={({ field }) => (
<FormItem>
<FormLabel>RIF de la OSP</FormLabel>
<FormLabel>RIF de la Organización</FormLabel>
<FormControl>
<Input {...field} placeholder="J-12345678-9" />
</FormControl>
@@ -491,7 +693,7 @@ export function CreateTrainingForm({
)}
/>
<FormField
{/* <FormField
control={form.control}
name="productiveActivity"
render={({ field }) => (
@@ -517,8 +719,162 @@ export function CreateTrainingForm({
<FormMessage />
</FormItem>
)}
/> */}
{/* Tipo de equipamiento */}
<hr className="col-span-2" />
<h3 className="text-lg font-semibold col-span-2">Tipo de equipamiento:</h3>
<FormField
control={form.control}
name="typesOfEquipment"
render={({ field }) => (
<FormItem>
<FormLabel>Maquinarias</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="equipmentCount"
render={({ field }) => (
<FormItem>
<FormLabel>Cantidad</FormLabel>
<FormControl>
<Input type="number" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="equipmentDescription"
render={({ field }) => (
<FormItem className="col-span-2">
<FormLabel>Descripción</FormLabel>
<FormControl>
<Textarea {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<hr className="col-span-2" />
{/* Productos Terminados */}
<h3 className="text-lg font-semibold col-span-2">Datos de Producción de la Organización Socio Productivo:</h3>
<FormField
control={form.control}
name="rawMaterial"
render={({ field }) => (
<FormItem>
<FormLabel>Materia prima requerida (mensual)</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="materialType"
render={({ field }) => (
<FormItem>
<FormLabel>Tipo de Insumo/Rubro</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="rawMaterialCount"
render={({ field }) => (
<FormItem>
<FormLabel>Cantidad</FormLabel>
<FormControl>
<Input type="number" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<hr className="col-span-2" />
{/* Productos Terminados */}
<h3 className="text-lg font-semibold col-span-2">Productos Terminados</h3>
<FormField
control={form.control}
name="productDescription"
render={({ field }) => (
<FormItem className="col-span-2">
<FormLabel>Descripción del producto</FormLabel>
<FormControl>
<Textarea {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="productCountDaily"
render={({ field }) => (
<FormItem>
<FormLabel>Diario</FormLabel>
<FormControl>
<Input type="number" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="productCountWeekly"
render={({ field }) => (
<FormItem>
<FormLabel>Semanal</FormLabel>
<FormControl>
<Input type="number" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="productCountMonthly"
render={({ field }) => (
<FormItem>
<FormLabel>Mensual</FormLabel>
<FormControl>
<Input type="number" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<hr className="col-span-2" />
<FormField
control={form.control}
name="companyConstitutionYear"
@@ -659,24 +1015,13 @@ export function CreateTrainingForm({
<CardContent className="grid grid-cols-1 md:grid-cols-2 gap-4">
<FormField
control={form.control}
name="state"
name="ospAddress"
render={({ field }) => (
<FormItem>
<FormLabel>Estado</FormLabel>
<SelectSearchable
options={stateOptions.map((item) => ({
value: item.id.toString(),
label: item.name,
}))}
onValueChange={(value) => {
field.onChange(Number(value));
setState(Number(value));
setDisabledMunicipality(false);
setDisabledParish(true);
}}
placeholder="Selecciona un estado"
defaultValue={field.value?.toString()}
/>
<FormItem className="col-span-2">
<FormLabel>Dirección de la Organización Socio Productivo</FormLabel>
<FormControl>
<Textarea {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
@@ -684,45 +1029,31 @@ export function CreateTrainingForm({
<FormField
control={form.control}
name="municipality"
name="ospGoogleMapsLink"
render={({ field }) => (
<FormItem>
<FormLabel>Municipio</FormLabel>
<SelectSearchable
options={municipalityOptions.map((item) => ({
value: item.id.toString(),
label: item.name,
}))}
onValueChange={(value) => {
field.onChange(Number(value));
setMunicipality(Number(value));
setDisabledParish(false);
}}
placeholder="Selecciona un municipio"
disabled={disabledMunicipality}
defaultValue={field.value?.toString()}
/>
<FormItem className="col-span-2">
<FormLabel>Dirección Link Google Maps</FormLabel>
<FormControl>
<Input {...field} placeholder="https://maps.google.com/..." />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<div className="col-span-2">
<h4 className="font-semibold mb-2">Datos de la Comuna</h4>
</div>
<FormField
control={form.control}
name="parish"
name="communeName"
render={({ field }) => (
<FormItem>
<FormLabel>Parroquia</FormLabel>
<SelectSearchable
options={parishOptions.map((item) => ({
value: item.id.toString(),
label: item.name,
}))}
onValueChange={(value) => field.onChange(Number(value))}
placeholder="Selecciona una parroquia"
disabled={disabledParish}
defaultValue={field.value?.toString()}
/>
<FormLabel>Nombre de la Comuna</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
@@ -733,7 +1064,109 @@ export function CreateTrainingForm({
name="siturCodeCommune"
render={({ field }) => (
<FormItem>
<FormLabel>Código SITUR Comuna</FormLabel>
<FormLabel>Código SITUR de la Comuna</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="communeRif"
render={({ field }) => (
<FormItem>
<FormLabel>Rif de la Comuna</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="communeSpokespersonName"
render={({ field }) => (
<FormItem>
<FormLabel>Nombre del Vocero o Vocera</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="communeSpokespersonCedula"
render={({ field }) => (
<FormItem>
<FormLabel>Cédula de Identidad del Vocero</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="communeSpokespersonRif"
render={({ field }) => (
<FormItem>
<FormLabel>RIF del Vocero</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="communeSpokespersonPhone"
render={({ field }) => (
<FormItem>
<FormLabel>Número de Teléfono del Vocero</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="communeEmail"
render={({ field }) => (
<FormItem>
<FormLabel>Correo Electrónico de la Comuna</FormLabel>
<FormControl>
<Input type="email" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<div className="col-span-2">
<h4 className="font-semibold mb-2">Datos del Consejo Comunal</h4>
</div>
<FormField
control={form.control}
name="communalCouncil"
render={({ field }) => (
<FormItem>
<FormLabel>Nombre del Consejo Comunal</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
@@ -747,7 +1180,7 @@ export function CreateTrainingForm({
name="siturCodeCommunalCouncil"
render={({ field }) => (
<FormItem>
<FormLabel>Código SITUR Consejo Comunal</FormLabel>
<FormLabel>Código SITUR del Consejo Comunal</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
@@ -758,10 +1191,10 @@ export function CreateTrainingForm({
<FormField
control={form.control}
name="communalCouncil"
name="communalCouncilRif"
render={({ field }) => (
<FormItem>
<FormLabel>Consejo Comunal</FormLabel>
<FormLabel>Rif del Consejo Comunal</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
@@ -772,12 +1205,68 @@ export function CreateTrainingForm({
<FormField
control={form.control}
name="ospAddress"
name="communalCouncilSpokespersonName"
render={({ field }) => (
<FormItem className="col-span-2">
<FormLabel>Dirección</FormLabel>
<FormItem>
<FormLabel>Nombre del Vocero o Vocera</FormLabel>
<FormControl>
<Textarea {...field} />
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="communalCouncilSpokespersonCedula"
render={({ field }) => (
<FormItem>
<FormLabel>Cédula de Identidad del Vocero</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="communalCouncilSpokespersonRif"
render={({ field }) => (
<FormItem>
<FormLabel>RIF del Vocero</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="communalCouncilSpokespersonPhone"
render={({ field }) => (
<FormItem>
<FormLabel>Número de Teléfono del Vocero</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="communalCouncilEmail"
render={({ field }) => (
<FormItem>
<FormLabel>Correo Electrónico del Consejo Comunal</FormLabel>
<FormControl>
<Input type="email" {...field} />
</FormControl>
<FormMessage />
</FormItem>

View File

@@ -16,12 +16,52 @@ export const trainingSchema = z.object({
siturCodeCommune: z
.string()
.min(1, { message: 'Código SITUR Comuna es requerido' }),
communeName: z
.string()
.min(1, { message: 'Nombre de la Comuna es requerido' }),
communeRif: z
.string()
.min(1, { message: 'RIF de la Comuna es requerido' }),
communeSpokespersonName: z
.string()
.min(1, { message: 'Nombre del Vocero de la Comuna es requerido' }),
communeSpokespersonCedula: z
.string()
.min(1, { message: 'Cédula del Vocero de la Comuna es requerida' }),
communeSpokespersonRif: z
.string()
.min(1, { message: 'RIF del Vocero de la Comuna es requerido' }),
communeSpokespersonPhone: z
.string()
.min(1, { message: 'Teléfono del Vocero de la Comuna es requerido' }),
communeEmail: z.string().email({ message: 'Correo electrónico de la Comuna inválido' }),
communalCouncil: z
.string()
.min(1, { message: 'Consejo Comunal es requerido' }),
siturCodeCommunalCouncil: z
.string()
.min(1, { message: 'Código SITUR Consejo Comunal es requerido' }),
communalCouncilRif: z
.string()
.min(1, { message: 'RIF del Consejo Comunal es requerido' }),
communalCouncilSpokespersonName: z
.string()
.min(1, { message: 'Nombre del Vocero del Consejo Comunal es requerido' }),
communalCouncilSpokespersonCedula: z
.string()
.min(1, { message: 'Cédula del Vocero del Consejo Comunal es requerida' }),
communalCouncilSpokespersonRif: z
.string()
.min(1, { message: 'RIF del Vocero del Consejo Comunal es requerido' }),
communalCouncilSpokespersonPhone: z
.string()
.min(1, { message: 'Teléfono del Vocero del Consejo Comunal es requerido' }),
communalCouncilEmail: z
.string()
.email({ message: 'Correo electrónico del Consejo Comunal inválido' }),
ospGoogleMapsLink: z
.string()
.min(1, { message: 'Enlace de Google Maps es requerido' }),
ospName: z.string().min(1, { message: 'Nombre de la OSP es requerido' }),
ospAddress: z
.string()
@@ -79,15 +119,27 @@ export const trainingSchema = z.object({
photo3: z.string().optional().nullable(),
files: z.any().optional(),
paralysisReason: z.string().optional().default(''),
state: z.number().optional().nullable(),
municipality: z.number().optional().nullable(),
parish: z.number().optional().nullable(),
coor_state: z.number().optional().nullable(),
coor_municipality: z.number().optional().nullable(),
coor_parish: z.number().optional().nullable(),
coor_phone: z.string().optional().nullable(),
ecoSector: z.string().min(1, { message: 'Sector económico es requerido' })
// mainProductiveActivity: z.string().optional().nullable(),
// state: z.number().optional().nullable(),
// municipality: z.number().optional().nullable(),
// parish: z.number().optional().nullable(),
coorState: z.number().optional().nullable(),
coorMunicipality: z.number().optional().nullable(),
coorParish: z.number().optional().nullable(),
coorPhone: z.string().optional().nullable(),
ecoSector: z.string().min(1, { message: 'Sector económico es requerido' }),
productiveSector: z.string().min(1, { message: 'Sector productivo es requerido' }),
centralProductiveActivity: z.string().min(1, { message: 'Actividad productiva central es requerida' }),
mainProductiveActivity: z.string().min(1, { message: 'Actividad productiva principal es requerida' }),
typesOfEquipment: z.string().min(1, { message: 'Tipo de equipo es requerido' }),
equipmentCount: z.coerce.number().min(0, { message: 'Cantidad de equipo requerida' }),
equipmentDescription: z.string().min(1, { message: 'Descripción del equipo es requerida' }),
rawMaterial: z.string().min(1, { message: 'Material bruto es requerido' }),
materialType: z.string().min(1, { message: 'Tipo de material es requerido' }),
rawMaterialCount: z.coerce.number().min(0, { message: 'Cantidad de material bruto requerida' }),
productCountDaily: z.coerce.number().min(0, { message: 'Cantidad diaria de productos requerida' }),
productCountWeekly: z.coerce.number().min(0, { message: 'Cantidad semanal de productos requerida' }),
productCountMonthly: z.coerce.number().min(0, { message: 'Cantidad mensual de productos requerida' }),
// productCountYearly: z.number().min(0, { message: 'Cantidad anual de productos requerida' }),
});
export type TrainingSchema = z.infer<typeof trainingSchema>;