Skip to content

Commit

Permalink
#105 fix: salva marca em edicao de equipamento
Browse files Browse the repository at this point in the history
  • Loading branch information
DafneM committed Jun 4, 2023
1 parent 5ce95cc commit 3507e0b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/components/equipment-edit-form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type EditEquipFormValues = {
processor?: string;
storageType?: { value: string; label: string };
storageAmount?: string;
brand: { name: string };
brandName: string;
acquisition: { name: string };
unitId?: string;
ram_size?: string;
Expand Down Expand Up @@ -65,6 +65,7 @@ export default function EquipmentEditForm({
defaultValues: equip,
});

console.log(equip);
const watchType = watch('type');

useEffect(() => {
Expand Down Expand Up @@ -153,8 +154,8 @@ export default function EquipmentEditForm({

<Input
label="Marca"
errors={errors.brand?.name}
{...register('brand.name', {
errors={errors.brandName}
{...register('brandName', {
required: 'Campo Obrigatório',
maxLength: 50,
})}
Expand Down
2 changes: 2 additions & 0 deletions src/components/equipment-edit-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ function transformFields(data: any) {
value: transformedData.initialUseDate.split('-')[0],
};

transformedData.brandName = transformedData.brand.name;

transformedData.acquisitionDate = new Date(transformedData.acquisitionDate);

return transformedData;
Expand Down
2 changes: 1 addition & 1 deletion src/components/equipment-view-form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type ViewEquipFormValues = {
processor?: string;
storageType?: { value: string; label: string };
storageAmount?: string;
brand: { name: string };
brandName: string;
acquisition: { name: string };
unitId?: string;
ram_size?: string;
Expand Down

0 comments on commit 3507e0b

Please sign in to comment.