agregado los campos de distribucion (interna y externa)
This commit is contained in:
196
apps/web/constants/countries.ts
Normal file
196
apps/web/constants/countries.ts
Normal file
@@ -0,0 +1,196 @@
|
||||
export const COUNTRY_OPTIONS = [
|
||||
'Afganistán',
|
||||
'Albania',
|
||||
'Alemania',
|
||||
'Andorra',
|
||||
'Angola',
|
||||
'Antigua y Barbuda',
|
||||
'Arabia Saudita',
|
||||
'Argelia',
|
||||
'Argentina',
|
||||
'Armenia',
|
||||
'Australia',
|
||||
'Austria',
|
||||
'Azerbaiyán',
|
||||
'Bahamas',
|
||||
'Bangladés',
|
||||
'Barbados',
|
||||
'Baréin',
|
||||
'Bélgica',
|
||||
'Belice',
|
||||
'Benín',
|
||||
'Bielorrusia',
|
||||
'Birmania',
|
||||
'Bolivia',
|
||||
'Bosnia y Herzegovina',
|
||||
'Botsuana',
|
||||
'Brasil',
|
||||
'Brunéi',
|
||||
'Bulgaria',
|
||||
'Burkina Faso',
|
||||
'Burundi',
|
||||
'Bután',
|
||||
'Cabo Verde',
|
||||
'Camboya',
|
||||
'Camerún',
|
||||
'Canadá',
|
||||
'Catar',
|
||||
'Chad',
|
||||
'Chile',
|
||||
'China',
|
||||
'Chipre',
|
||||
'Ciudad del Vaticano',
|
||||
'Colombia',
|
||||
'Comoras',
|
||||
'Corea del Norte',
|
||||
'Corea del Sur',
|
||||
'Costa de Marfil',
|
||||
'Costa Rica',
|
||||
'Croacia',
|
||||
'Cuba',
|
||||
'Dinamarca',
|
||||
'Dominica',
|
||||
'Ecuador',
|
||||
'Egipto',
|
||||
'El Salvador',
|
||||
'Emiratos Árabes Unidos',
|
||||
'Eritrea',
|
||||
'Eslovaquia',
|
||||
'Eslovenia',
|
||||
'España',
|
||||
'Estados Unidos',
|
||||
'Estonia',
|
||||
'Etiopía',
|
||||
'Filipinas',
|
||||
'Finlandia',
|
||||
'Fiyi',
|
||||
'Francia',
|
||||
'Gabón',
|
||||
'Gambia',
|
||||
'Georgia',
|
||||
'Ghana',
|
||||
'Granada',
|
||||
'Grecia',
|
||||
'Guatemala',
|
||||
'Guyana',
|
||||
'Guinea',
|
||||
'Guinea Ecuatorial',
|
||||
'Guinea-Bisáu',
|
||||
'Haití',
|
||||
'Honduras',
|
||||
'Hungría',
|
||||
'India',
|
||||
'Indonesia',
|
||||
'Irak',
|
||||
'Irán',
|
||||
'Irlanda',
|
||||
'Islandia',
|
||||
'Islas Marshall',
|
||||
'Islas Salomón',
|
||||
'Israel',
|
||||
'Italia',
|
||||
'Jamaica',
|
||||
'Japón',
|
||||
'Jordania',
|
||||
'Kazajistán',
|
||||
'Kenia',
|
||||
'Kirguistán',
|
||||
'Kiribati',
|
||||
'Kuwait',
|
||||
'Laos',
|
||||
'Lesoto',
|
||||
'Letonia',
|
||||
'Líbano',
|
||||
'Liberia',
|
||||
'Libia',
|
||||
'Liechtenstein',
|
||||
'Lituania',
|
||||
'Luxemburgo',
|
||||
'Madagascar',
|
||||
'Malasia',
|
||||
'Malaui',
|
||||
'Maldivas',
|
||||
'Malí',
|
||||
'Malta',
|
||||
'Marruecos',
|
||||
'Mauricio',
|
||||
'Mauritania',
|
||||
'México',
|
||||
'Micronesia',
|
||||
'Moldavia',
|
||||
'Mónaco',
|
||||
'Mongolia',
|
||||
'Montenegro',
|
||||
'Mozambique',
|
||||
'Namibia',
|
||||
'Nauru',
|
||||
'Nepal',
|
||||
'Nicaragua',
|
||||
'Níger',
|
||||
'Nigeria',
|
||||
'Noruega',
|
||||
'Nueva Zelanda',
|
||||
'Omán',
|
||||
'Países Bajos',
|
||||
'Pakistán',
|
||||
'Palaos',
|
||||
'Panamá',
|
||||
'Papúa Nueva Guinea',
|
||||
'Paraguay',
|
||||
'Perú',
|
||||
'Polonia',
|
||||
'Portugal',
|
||||
'Reino Unido',
|
||||
'República Centroafricana',
|
||||
'República Checa',
|
||||
'República de Macedonia',
|
||||
'República del Congo',
|
||||
'República Democrática del Congo',
|
||||
'República Dominicana',
|
||||
'República Sudafricana',
|
||||
'Ruanda',
|
||||
'Rumanía',
|
||||
'Rusia',
|
||||
'Samoa',
|
||||
'San Cristóbal y Nieves',
|
||||
'San Marino',
|
||||
'San Vicente y las Granadinas',
|
||||
'Santa Lucía',
|
||||
'Santo Tomé y Príncipe',
|
||||
'Senegal',
|
||||
'Serbia',
|
||||
'Seychelles',
|
||||
'Sierra Leona',
|
||||
'Singapur',
|
||||
'Siria',
|
||||
'Somalia',
|
||||
'Sri Lanka',
|
||||
'Suazilandia',
|
||||
'Sudán',
|
||||
'Sudán del Sur',
|
||||
'Suecia',
|
||||
'Suiza',
|
||||
'Surinam',
|
||||
'Tailandia',
|
||||
'Tanzania',
|
||||
'Tayikistán',
|
||||
'Timor Oriental',
|
||||
'Togo',
|
||||
'Tonga',
|
||||
'Trinidad y Tobago',
|
||||
'Túnez',
|
||||
'Turkmenistán',
|
||||
'Turquía',
|
||||
'Tuvalu',
|
||||
'Ucrania',
|
||||
'Uganda',
|
||||
'Uruguay',
|
||||
'Uzbekistán',
|
||||
'Vanuatu',
|
||||
'Venezuela',
|
||||
'Vietnam',
|
||||
'Yemen',
|
||||
'Yibuti',
|
||||
'Zambia',
|
||||
'Zimbabue'
|
||||
];
|
||||
@@ -37,6 +37,8 @@ import {
|
||||
import { SelectSearchable } from '@repo/shadcn/select-searchable';
|
||||
import React from 'react';
|
||||
|
||||
import { COUNTRY_OPTIONS } from '@/constants/countries';
|
||||
|
||||
// const PRODUCTIVE_ACTIVITIES = [
|
||||
// 'Agricola',
|
||||
// 'Textil',
|
||||
@@ -47,9 +49,6 @@ import React from 'react';
|
||||
|
||||
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 PRODUCTIVE_SECTORS = ['Agricola', 'Manufactura', 'Servicios', 'Comercio', 'Turismo'];
|
||||
|
||||
const CENTRAL_PRODUCTIVE_ACTIVITY = [
|
||||
@@ -62,11 +61,6 @@ const CENTRAL_PRODUCTIVE_ACTIVITY = [
|
||||
'COMERCIO'
|
||||
];
|
||||
|
||||
|
||||
// const PRODUCTIVE_SECTORS_PRIMARIO = ['Agricola'];
|
||||
// const PRODUCTIVE_SECTORS_SECUNDARIO = ['Manufactura'];
|
||||
// const PRODUCTIVE_SECTORS_TERCIARIO = ['Servicios', 'Comercio', 'Turismo'];
|
||||
|
||||
const MAIN_PRODUCTIVE_ACTIVITY = [
|
||||
'AGRICULTURA ',
|
||||
'CRIA ',
|
||||
@@ -168,10 +162,10 @@ 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 [coorState, setcoorState] = React.useState(0);
|
||||
const [coorMunicipality, setcoorMunicipality] = React.useState(0);
|
||||
@@ -180,9 +174,9 @@ export function CreateTrainingForm({
|
||||
|
||||
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(coorState);
|
||||
@@ -202,30 +196,30 @@ export function CreateTrainingForm({
|
||||
: [{ 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.state) {
|
||||
setState(Number(defaultValues.state));
|
||||
setDisabledMunicipality(false);
|
||||
}
|
||||
if (defaultValues.municipality) {
|
||||
setMunicipality(Number(defaultValues.municipality));
|
||||
setDisabledParish(false);
|
||||
}
|
||||
|
||||
if (defaultValues.coorState) {
|
||||
setcoorState(Number(defaultValues.coorState));
|
||||
@@ -272,8 +266,8 @@ export function CreateTrainingForm({
|
||||
productCountDaily: defaultValues?.productCountDaily || 0,
|
||||
productCountWeekly: defaultValues?.productCountWeekly || 0,
|
||||
productCountMonthly: defaultValues?.productCountMonthly || 0,
|
||||
financialRequirementDescription:
|
||||
defaultValues?.financialRequirementDescription || '',
|
||||
// financialRequirementDescription:
|
||||
// defaultValues?.financialRequirementDescription || '',
|
||||
siturCodeCommune: defaultValues?.siturCodeCommune || '',
|
||||
communeName: defaultValues?.communeName || '',
|
||||
communeRif: defaultValues?.communeRif || '',
|
||||
@@ -299,8 +293,9 @@ export function CreateTrainingForm({
|
||||
companyConstitutionYear:
|
||||
defaultValues?.companyConstitutionYear || new Date().getFullYear(),
|
||||
producerCount: defaultValues?.producerCount || 0,
|
||||
productCount: defaultValues?.productCount || 0,
|
||||
// productCount: defaultValues?.productCount || 0,
|
||||
productDescription: defaultValues?.productDescription || '',
|
||||
prodDescriptionInternal: defaultValues?.prodDescriptionInternal || '',
|
||||
installedCapacity: defaultValues?.installedCapacity || '',
|
||||
operationalCapacity: defaultValues?.operationalCapacity || '',
|
||||
ospResponsibleFullname: defaultValues?.ospResponsibleFullname || '',
|
||||
@@ -316,9 +311,16 @@ 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,
|
||||
internalCount: defaultValues?.internalCount || 0,
|
||||
externalCount: defaultValues?.externalCount || 0,
|
||||
prodDescriptionExternal: defaultValues?.prodDescriptionExternal || '',
|
||||
country: defaultValues?.country || undefined,
|
||||
city: defaultValues?.city || undefined,
|
||||
menCount: defaultValues?.menCount || 0,
|
||||
womenCount: defaultValues?.womenCount || 0,
|
||||
},
|
||||
mode: 'onChange',
|
||||
});
|
||||
@@ -565,7 +567,7 @@ export function CreateTrainingForm({
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="Seleccione tipo" />
|
||||
<SelectValue placeholder="Seleccione sector económico" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
@@ -593,7 +595,7 @@ export function CreateTrainingForm({
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="Seleccione tipo" />
|
||||
<SelectValue placeholder="Seleccione sector productivo" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
@@ -621,7 +623,7 @@ export function CreateTrainingForm({
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="Seleccione tipo" />
|
||||
<SelectValue placeholder="Seleccione actividad central productiva" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
@@ -640,6 +642,34 @@ export function CreateTrainingForm({
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="mainProductiveActivity"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Actividad Productiva Principal</FormLabel>
|
||||
<Select
|
||||
onValueChange={field.onChange}
|
||||
defaultValue={field.value}
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="Seleccione actividad productiva principal" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
{MAIN_PRODUCTIVE_ACTIVITY.map((type) => (
|
||||
<SelectItem key={type} value={type}>
|
||||
{type}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="productiveActivity"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Actividad Productiva</FormLabel>
|
||||
@@ -649,7 +679,7 @@ export function CreateTrainingForm({
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="Seleccione tipo" />
|
||||
<SelectValue placeholder="Seleccione actividad productiva" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
@@ -721,8 +751,64 @@ export function CreateTrainingForm({
|
||||
)}
|
||||
/> */}
|
||||
|
||||
{/* Tipo de equipamiento */}
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="companyConstitutionYear"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Año de constitución</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="number" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="currentStatus"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Estatus</FormLabel>
|
||||
<Select
|
||||
onValueChange={field.onChange}
|
||||
defaultValue={field.value}
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Seleccione estatus" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
{STATUS_OPTIONS.map((status) => (
|
||||
<SelectItem key={status} value={status}>
|
||||
{status}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="paralysisReason"
|
||||
render={({ field }) => (
|
||||
<FormItem className="col-span-2">
|
||||
<FormLabel>Razones de paralización (si aplica)</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<hr className="col-span-2" />
|
||||
{/* Tipo de equipamiento */}
|
||||
<h3 className="text-lg font-semibold col-span-2">Tipo de equipamiento:</h3>
|
||||
<FormField
|
||||
control={form.control}
|
||||
@@ -767,7 +853,7 @@ export function CreateTrainingForm({
|
||||
/>
|
||||
<hr className="col-span-2" />
|
||||
|
||||
{/* Productos Terminados */}
|
||||
{/* Datos de Producción de la Organización Socio Productivo */}
|
||||
<h3 className="text-lg font-semibold col-span-2">Datos de Producción de la Organización Socio Productivo:</h3>
|
||||
|
||||
<FormField
|
||||
@@ -871,16 +957,88 @@ export function CreateTrainingForm({
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
|
||||
<hr className="col-span-2" />
|
||||
|
||||
{/* Distribución Interna */}
|
||||
<h3 className="text-lg font-semibold col-span-2">Distribución Interna</h3>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="companyConstitutionYear"
|
||||
name="state"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Año de constitución</FormLabel>
|
||||
<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()}
|
||||
/>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="municipality"
|
||||
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()}
|
||||
/>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="parish"
|
||||
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()}
|
||||
/>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="internalCount"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Cantidad</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="number" {...field} />
|
||||
</FormControl>
|
||||
@@ -890,6 +1048,125 @@ export function CreateTrainingForm({
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="prodDescriptionInternal"
|
||||
render={({ field }) => (
|
||||
<FormItem className="col-span-2">
|
||||
<FormLabel>Breve descripción</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<hr className='col-span-2' />
|
||||
|
||||
{/* Distribución Externa */}
|
||||
<h3 className="text-lg font-semibold col-span-2">Distribución Externa (Exportación)</h3>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="country"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>País</FormLabel>
|
||||
<Select
|
||||
onValueChange={field.onChange}
|
||||
defaultValue={field.value}
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="Seleccione tipo" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
{COUNTRY_OPTIONS.map((type) => (
|
||||
<SelectItem key={type} value={type}>
|
||||
{type}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="city"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Ciudad</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="number" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="externalCount"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Cantidad (Kg, TON, UNID. LT)</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="number" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="prodDescriptionExternal"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Breve descripción</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<hr className='col-span-2' />
|
||||
|
||||
<h3 className="text-lg font-semibold col-span-2">Cantidad Mano de Obra</h3>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="menCount"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Hombres</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="number" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="womenCount"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Mujeres</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="number" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
{/* <FormField
|
||||
control={form.control}
|
||||
name="productCount"
|
||||
render={({ field }) => (
|
||||
@@ -901,37 +1178,9 @@ export function CreateTrainingForm({
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
/> */}
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="currentStatus"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Estatus</FormLabel>
|
||||
<Select
|
||||
onValueChange={field.onChange}
|
||||
defaultValue={field.value}
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Seleccione estatus" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
{STATUS_OPTIONS.map((status) => (
|
||||
<SelectItem key={status} value={status}>
|
||||
{status}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
{/* <FormField
|
||||
control={form.control}
|
||||
name="productDescription"
|
||||
render={({ field }) => (
|
||||
@@ -945,9 +1194,9 @@ export function CreateTrainingForm({
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
/> */}
|
||||
|
||||
<FormField
|
||||
{/* <FormField
|
||||
control={form.control}
|
||||
name="installedCapacity"
|
||||
render={({ field }) => (
|
||||
@@ -959,9 +1208,9 @@ export function CreateTrainingForm({
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
/> */}
|
||||
|
||||
<FormField
|
||||
{/* <FormField
|
||||
control={form.control}
|
||||
name="operationalCapacity"
|
||||
render={({ field }) => (
|
||||
@@ -973,9 +1222,9 @@ export function CreateTrainingForm({
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
/> */}
|
||||
|
||||
<FormField
|
||||
{/* <FormField
|
||||
control={form.control}
|
||||
name="financialRequirementDescription"
|
||||
render={({ field }) => (
|
||||
@@ -989,21 +1238,7 @@ export function CreateTrainingForm({
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="paralysisReason"
|
||||
render={({ field }) => (
|
||||
<FormItem className="col-span-2">
|
||||
<FormLabel>Razones de paralización (si aplica)</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
/> */}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ export const trainingSchema = z.object({
|
||||
productiveActivity: z
|
||||
.string()
|
||||
.min(1, { message: 'Actividad productiva es requerida' }),
|
||||
financialRequirementDescription: z
|
||||
.string()
|
||||
.min(1, { message: 'Descripción es requerida' }),
|
||||
// financialRequirementDescription: z
|
||||
// .string()
|
||||
// .min(1, { message: 'Descripción es requerida' }),
|
||||
siturCodeCommune: z
|
||||
.string()
|
||||
.min(1, { message: 'Código SITUR Comuna es requerido' }),
|
||||
@@ -78,13 +78,16 @@ export const trainingSchema = z.object({
|
||||
producerCount: z.coerce
|
||||
.number()
|
||||
.min(0, { message: 'Cantidad de productores requerida' }),
|
||||
productCount: z.coerce
|
||||
.number()
|
||||
.min(0, { message: 'Cantidad de productos requerida' })
|
||||
.optional(),
|
||||
// productCount: z.coerce
|
||||
// .number()
|
||||
// .min(0, { message: 'Cantidad de productos requerida' })
|
||||
// .optional(),
|
||||
productDescription: z
|
||||
.string()
|
||||
.min(1, { message: 'Descripción del producto es requerida' }),
|
||||
prodDescriptionInternal: z
|
||||
.string()
|
||||
.min(1, { message: 'Descripción del producto es requerida' }),
|
||||
installedCapacity: z
|
||||
.string()
|
||||
.min(1, { message: 'Capacidad instalada es requerida' }),
|
||||
@@ -119,9 +122,9 @@ 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(),
|
||||
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(),
|
||||
@@ -139,7 +142,13 @@ export const trainingSchema = z.object({
|
||||
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' }),
|
||||
internalCount: z.coerce.number().min(0, { message: 'Cantidad interna requerida' }),
|
||||
externalCount: z.coerce.number().min(0, { message: 'Cantidad externa requerida' }),
|
||||
prodDescriptionExternal: z.string().min(1, { message: 'Descripción del producto es requerida' }),
|
||||
country: z.string().min(1, { message: 'País es requerido' }),
|
||||
city: z.string().min(1, { message: 'Ciudad es requerida' }),
|
||||
menCount: z.coerce.number().min(0, { message: 'Cantidad de hombres requerida' }),
|
||||
womenCount: z.coerce.number().min(0, { message: 'Cantidad de mujeres requerida' }),
|
||||
});
|
||||
|
||||
export type TrainingSchema = z.infer<typeof trainingSchema>;
|
||||
|
||||
Reference in New Issue
Block a user