ajustes al formulario de organizaciones
This commit is contained in:
@@ -99,18 +99,14 @@ export const trainingSurveys = t.pgTable(
|
||||
.notNull()
|
||||
.default(''),
|
||||
communeSpokespersonCedula: t
|
||||
.text('commune_spokesperson_cedula')
|
||||
.notNull()
|
||||
.default(''),
|
||||
.text('commune_spokesperson_cedula'),
|
||||
communeSpokespersonRif: t
|
||||
.text('commune_spokesperson_rif')
|
||||
.notNull()
|
||||
.default(''),
|
||||
.text('commune_spokesperson_rif'),
|
||||
communeSpokespersonPhone: t
|
||||
.text('commune_spokesperson_phone')
|
||||
.notNull()
|
||||
.default(''),
|
||||
communeEmail: t.text('commune_email').notNull().default(''),
|
||||
communeEmail: t.text('commune_email'),
|
||||
communalCouncil: t.text('communal_council').notNull(),
|
||||
siturCodeCommunalCouncil: t.text('situr_code_communal_council').notNull(),
|
||||
communalCouncilRif: t.text('communal_council_rif').notNull().default(''),
|
||||
@@ -119,13 +115,9 @@ export const trainingSurveys = t.pgTable(
|
||||
.notNull()
|
||||
.default(''),
|
||||
communalCouncilSpokespersonCedula: t
|
||||
.text('communal_council_spokesperson_cedula')
|
||||
.notNull()
|
||||
.default(''),
|
||||
.text('communal_council_spokesperson_cedula'),
|
||||
communalCouncilSpokespersonRif: t
|
||||
.text('communal_council_spokesperson_rif')
|
||||
.notNull()
|
||||
.default(''),
|
||||
.text('communal_council_spokesperson_rif'),
|
||||
communalCouncilSpokespersonPhone: t
|
||||
.text('communal_council_spokesperson_phone')
|
||||
.notNull()
|
||||
|
||||
@@ -30,11 +30,11 @@ export class CreateTrainingDto {
|
||||
|
||||
// === 2. DATOS OSP ===
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
ospName: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
ospRif: string;
|
||||
|
||||
@ApiProperty()
|
||||
@@ -165,20 +165,13 @@ export class CreateTrainingDto {
|
||||
@IsString()
|
||||
communeSpokespersonName: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
communeSpokespersonCedula: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
communeSpokespersonRif: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
communeSpokespersonPhone: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
communeEmail: string;
|
||||
|
||||
@ApiProperty()
|
||||
@@ -197,14 +190,6 @@ export class CreateTrainingDto {
|
||||
@IsString()
|
||||
communalCouncilSpokespersonName: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
communalCouncilSpokespersonCedula: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
communalCouncilSpokespersonRif: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
communalCouncilSpokespersonPhone: string;
|
||||
|
||||
@@ -30,14 +30,13 @@ export function EquipmentList() {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [newItem, setNewItem] = useState({
|
||||
machine: '',
|
||||
specifications: '',
|
||||
quantity: '',
|
||||
});
|
||||
|
||||
const handleAdd = () => {
|
||||
if (newItem.machine && newItem.quantity) {
|
||||
append({ ...newItem, quantity: Number(newItem.quantity) });
|
||||
setNewItem({ machine: '', specifications: '', quantity: '' });
|
||||
setNewItem({ machine: '', quantity: '' });
|
||||
setIsOpen(false);
|
||||
}
|
||||
};
|
||||
@@ -68,16 +67,6 @@ export function EquipmentList() {
|
||||
placeholder="Nombre de la maquinaria"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label>Especificaciones</Label>
|
||||
<Input
|
||||
value={newItem.specifications}
|
||||
onChange={(e) =>
|
||||
setNewItem({ ...newItem, specifications: e.target.value })
|
||||
}
|
||||
placeholder="Especificaciones técnicas"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label>Cantidad</Label>
|
||||
<Input
|
||||
@@ -126,14 +115,6 @@ export function EquipmentList() {
|
||||
{/* @ts-ignore */}
|
||||
{field.machine}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<input
|
||||
type="hidden"
|
||||
{...register(`equipmentList.${index}.specifications`)}
|
||||
/>
|
||||
{/* @ts-ignore */}
|
||||
{field.specifications}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<input
|
||||
type="hidden"
|
||||
|
||||
@@ -118,8 +118,6 @@ export function CreateTrainingForm({
|
||||
communeName: defaultValues?.communeName || '',
|
||||
communeRif: defaultValues?.communeRif || '',
|
||||
communeSpokespersonName: defaultValues?.communeSpokespersonName || '',
|
||||
communeSpokespersonCedula: defaultValues?.communeSpokespersonCedula || '',
|
||||
communeSpokespersonRif: defaultValues?.communeSpokespersonRif || '',
|
||||
communeSpokespersonPhone: defaultValues?.communeSpokespersonPhone || '',
|
||||
communeEmail: defaultValues?.communeEmail || '',
|
||||
communalCouncil: defaultValues?.communalCouncil || '',
|
||||
@@ -127,10 +125,6 @@ export function CreateTrainingForm({
|
||||
communalCouncilRif: defaultValues?.communalCouncilRif || '',
|
||||
communalCouncilSpokespersonName:
|
||||
defaultValues?.communalCouncilSpokespersonName || '',
|
||||
communalCouncilSpokespersonCedula:
|
||||
defaultValues?.communalCouncilSpokespersonCedula || '',
|
||||
communalCouncilSpokespersonRif:
|
||||
defaultValues?.communalCouncilSpokespersonRif || '',
|
||||
communalCouncilSpokespersonPhone:
|
||||
defaultValues?.communalCouncilSpokespersonPhone || '',
|
||||
communalCouncilEmail: defaultValues?.communalCouncilEmail || '',
|
||||
@@ -215,25 +209,22 @@ export function CreateTrainingForm({
|
||||
];
|
||||
|
||||
const coorMunicipalityOptions =
|
||||
Array.isArray(dataCoorMunicipality?.data) &&
|
||||
dataCoorMunicipality.data.length > 0
|
||||
dataCoorMunicipality?.data?.length
|
||||
? dataCoorMunicipality.data
|
||||
: [{ id: 0, stateId: 0, name: 'Sin Municipios' }];
|
||||
|
||||
const coorParishOptions =
|
||||
Array.isArray(dataCoorParish?.data) && dataCoorParish?.data.length > 0
|
||||
Array.isArray(dataCoorParish?.data) && dataCoorParish?.data?.length
|
||||
? dataCoorParish.data
|
||||
: [{ id: 0, stateId: 0, name: 'Sin Parroquias' }];
|
||||
|
||||
const stateOptions = dataState?.data || [{ id: 0, name: 'Sin estados' }];
|
||||
|
||||
const municipalityOptions =
|
||||
Array.isArray(dataMunicipality?.data) && dataMunicipality.data.length > 0
|
||||
const municipalityOptions = dataMunicipality?.data?.length
|
||||
? dataMunicipality.data
|
||||
: [{ id: 0, stateId: 0, name: 'Sin Municipios' }];
|
||||
|
||||
const parishOptions =
|
||||
Array.isArray(dataParish?.data) && dataParish.data.length > 0
|
||||
const parishOptions = dataParish?.data?.length
|
||||
? dataParish.data
|
||||
: [{ id: 0, stateId: 0, name: 'Sin Parroquias' }];
|
||||
|
||||
@@ -727,7 +718,7 @@ export function CreateTrainingForm({
|
||||
render={({ field }) => (
|
||||
<FormItem className="w-full flex flex-col space-y-3">
|
||||
<FormLabel className="whitespace-normal leading-tight font-semibold">
|
||||
Nombre de la organización
|
||||
Nombre de la organización (opcional)
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
@@ -1025,37 +1016,6 @@ export function CreateTrainingForm({
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="communeSpokespersonCedula"
|
||||
render={({ field }) => (
|
||||
<FormItem className="w-full flex flex-col space-y-2">
|
||||
<FormLabel className="font-semibold">
|
||||
Cédula de Identidad del Vocero
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="communeSpokespersonRif"
|
||||
render={({ field }) => (
|
||||
<FormItem className="w-full flex flex-col space-y-2">
|
||||
<FormLabel className="font-semibold">
|
||||
RIF del Vocero
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
@@ -1159,38 +1119,6 @@ export function CreateTrainingForm({
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="communalCouncilSpokespersonCedula"
|
||||
render={({ field }) => (
|
||||
<FormItem className="w-full flex flex-col space-y-2">
|
||||
<FormLabel className="font-semibold">
|
||||
Cédula de Identidad del Vocero
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="communalCouncilSpokespersonRif"
|
||||
render={({ field }) => (
|
||||
<FormItem className="w-full flex flex-col space-y-2">
|
||||
<FormLabel className="font-semibold">
|
||||
RIF del Vocero
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="communalCouncilSpokespersonPhone"
|
||||
|
||||
@@ -220,76 +220,16 @@ export function ProductActivityList() {
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<h4 className="font-semibold">Distribución Interna</h4>
|
||||
<div className="grid grid-cols-3 gap-4">
|
||||
<h4 className="font-semibold">Zona de Distribucción</h4>
|
||||
<div className="grid grid-cols-1 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label>Estado</Label>
|
||||
<SelectSearchable
|
||||
options={stateOptions.map((s) => ({
|
||||
value: String(s.id),
|
||||
label: s.name,
|
||||
}))}
|
||||
onValueChange={(val) => {
|
||||
const id = Number(val);
|
||||
setInternalStateId(id);
|
||||
setNewItem({ ...newItem, internalState: id });
|
||||
}}
|
||||
placeholder="Estado"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label>Municipio</Label>
|
||||
<SelectSearchable
|
||||
options={internalMuniOptions.map((s) => ({
|
||||
value: String(s.id),
|
||||
label: s.name,
|
||||
}))}
|
||||
onValueChange={(val) => {
|
||||
const id = Number(val);
|
||||
setInternalMuniId(id);
|
||||
setNewItem({ ...newItem, internalMunicipality: id });
|
||||
}}
|
||||
placeholder="Municipio"
|
||||
disabled={!internalStateId}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label>Parroquia</Label>
|
||||
<SelectSearchable
|
||||
options={internalParishOptions.map((s) => ({
|
||||
value: String(s.id),
|
||||
label: s.name,
|
||||
}))}
|
||||
onValueChange={(val) =>
|
||||
setNewItem({ ...newItem, internalParish: Number(val) })
|
||||
}
|
||||
placeholder="Parroquia"
|
||||
disabled={!internalMuniId}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label>Breve Descripción</Label>
|
||||
<Label>Breve Descripción de la Zona de Distribucción</Label>
|
||||
<Input
|
||||
value={newItem.internalDescription}
|
||||
value={newItem.internalDistributionZone}
|
||||
onChange={(e) =>
|
||||
setNewItem({
|
||||
...newItem,
|
||||
internalDescription: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label>Cantidad Numérica (Kg, TON, UNID. LT)</Label>
|
||||
<Input
|
||||
type="number"
|
||||
value={newItem.internalQuantity}
|
||||
onChange={(e) =>
|
||||
setNewItem({
|
||||
...newItem,
|
||||
internalQuantity: e.target.value,
|
||||
internalDistributionZone: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
@@ -297,7 +237,7 @@ export function ProductActivityList() {
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<h4 className="font-semibold">Distribución Externa</h4>
|
||||
<h4 className="font-semibold">Exportación</h4>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label>País</Label>
|
||||
@@ -397,7 +337,7 @@ export function ProductActivityList() {
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label>Cantidad Numérica (Kg, TON, UNID. LT)</Label>
|
||||
<Label>Cantidad Numérica (KG, TON, UNID. LT, MTS,QQ, HM2, SACOS)</Label>
|
||||
<Input
|
||||
type="number"
|
||||
value={newItem.externalQuantity}
|
||||
|
||||
@@ -79,7 +79,7 @@ export function ProductionList() {
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label>Cantidad Mensual (Kg, TON, UNID. LT)</Label>
|
||||
<Label>Cantidad Mensual (Kg, TON, UNID.LT, MTS,QQ,HM2,SACO)</Label>
|
||||
<Input
|
||||
type="number"
|
||||
value={newItem.quantity}
|
||||
|
||||
@@ -128,6 +128,8 @@ export const ACTIVIDAD_PRODUCTIVA_MAP: Record<string, string[]> = {
|
||||
'ELABORACION DE ACEITE COMESTIBLE',
|
||||
'FABRICA DE HIELO',
|
||||
'ELABORACION DE PAPELON',
|
||||
'TORREFACTORA DE CÁFE',
|
||||
'ESPULPADORA DE TOMATES Y FRUTAS',
|
||||
'ARTESANIAS',
|
||||
],
|
||||
[ACTIVIDAD_PRINCIPAL.TEXTIL]: [
|
||||
|
||||
@@ -10,11 +10,7 @@ const productItemSchema = z.object({
|
||||
monthlyCount: z.coerce.string().or(z.number()).optional(),
|
||||
|
||||
// Distribución Interna
|
||||
internalState: z.number().optional(),
|
||||
internalMunicipality: z.number().optional(),
|
||||
internalParish: z.number().optional(),
|
||||
internalDescription: z.string().optional(),
|
||||
internalQuantity: z.coerce.string().or(z.number()).optional(),
|
||||
internalDistributionZone: z.string().optional(),
|
||||
|
||||
// Distribución Externa
|
||||
externalCountry: z.string().optional(),
|
||||
@@ -38,7 +34,6 @@ const productionItemSchema = z.object({
|
||||
|
||||
const equipmentItemSchema = z.object({
|
||||
machine: z.string(),
|
||||
specifications: z.string().optional(),
|
||||
quantity: z.coerce.string().or(z.number()).optional(), // Aceptamos string o number por los inputs
|
||||
});
|
||||
|
||||
@@ -62,7 +57,7 @@ export const trainingSchema = z.object({
|
||||
.string()
|
||||
.min(1, { message: 'Actividad productiva es requerida' }),
|
||||
ospRif: z.string().optional().or(z.literal('')),
|
||||
ospName: z.string().min(1, { message: 'Nombre de la OSP es requerido' }),
|
||||
ospName: z.string().optional().or(z.literal('')),
|
||||
companyConstitutionYear: z.coerce
|
||||
.number()
|
||||
.min(1900, { message: 'Año inválido' }),
|
||||
@@ -98,8 +93,6 @@ export const trainingSchema = z.object({
|
||||
siturCodeCommune: z.string().optional().or(z.literal('')),
|
||||
communeRif: z.string().optional().or(z.literal('')),
|
||||
communeSpokespersonName: z.string().optional().or(z.literal('')),
|
||||
communeSpokespersonCedula: z.string().optional().or(z.literal('')),
|
||||
communeSpokespersonRif: z.string().optional().or(z.literal('')),
|
||||
communeSpokespersonPhone: z.string().optional().or(z.literal('')),
|
||||
communeEmail: z
|
||||
.string()
|
||||
@@ -112,8 +105,6 @@ export const trainingSchema = z.object({
|
||||
siturCodeCommunalCouncil: z.string().optional().or(z.literal('')),
|
||||
communalCouncilRif: z.string().optional().or(z.literal('')),
|
||||
communalCouncilSpokespersonName: z.string().optional().or(z.literal('')),
|
||||
communalCouncilSpokespersonCedula: z.string().optional().or(z.literal('')),
|
||||
communalCouncilSpokespersonRif: z.string().optional().or(z.literal('')),
|
||||
communalCouncilSpokespersonPhone: z.string().optional().or(z.literal('')),
|
||||
communalCouncilEmail: z
|
||||
.string()
|
||||
|
||||
Reference in New Issue
Block a user