Skip to content

Commit

Permalink
Merge pull request #28 from fga-eps-mds/105-edicao-marca
Browse files Browse the repository at this point in the history
#105 fix: salva marca em edicao de equipamento
  • Loading branch information
DafneM authored Jun 5, 2023
2 parents d7ea660 + 1c37d47 commit 784b804
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
6 changes: 3 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 @@ -153,8 +153,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
6 changes: 3 additions & 3 deletions 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 Expand Up @@ -109,8 +109,8 @@ export default function EquipmentViewForm({

<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-view-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,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

0 comments on commit 784b804

Please sign in to comment.