ajustes al formulario de organizaciones
This commit is contained in:
@@ -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,27 +209,24 @@ 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
|
||||
? dataMunicipality.data
|
||||
: [{ id: 0, stateId: 0, name: 'Sin Municipios' }];
|
||||
const municipalityOptions = dataMunicipality?.data?.length
|
||||
? 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 = dataParish?.data?.length
|
||||
? dataParish.data
|
||||
: [{ id: 0, stateId: 0, name: 'Sin Parroquias' }];
|
||||
|
||||
// No local state needed for existing photos, we use form values
|
||||
|
||||
@@ -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,38 +1016,7 @@ 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}
|
||||
name="communeSpokespersonPhone"
|
||||
@@ -1158,39 +1118,7 @@ export function CreateTrainingForm({
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<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}
|
||||
|
||||
Reference in New Issue
Block a user