Skip to content

Commit

Permalink
#104 fix: correção da abertura da modal de cadastrar OS
Browse files Browse the repository at this point in the history
  • Loading branch information
JPedroCh committed Jun 21, 2023
1 parent 4143993 commit 3e009f1
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions src/pages/order-service/OrderServiceControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,13 @@ import { Datepicker } from '@/components/form-fields/date';
import { Input } from '@/components/form-fields/input';
import { OSStatusMap, OSStatusStyleMap } from '@/constants/orderservice';
import { NewControlledSelect } from '@/components/form-fields/new-controlled-select';
import { OrderServiceEditModal } from '@/components/order-service-edit-modal';
import { OrderServiceRegisterModal } from '@/components/order-service-register-modal';

interface ISelectOption {
label: string;
value: number | string;
}
export const mockData = {
equipment: 'EquipmentData',
equipmentId: 'c2a7ac1f-b8d1-4a69-88a7-60f6fc8d1ec8',
seiProcess: '123456789789562',
id: '',
status: 'concluido',
description: 'nada',
finishDate: '2022-06-18',
senderName: 'maria',
senderDocument: '12345678912',
};

export interface Equipment {
tippingNumber: string;
Expand Down Expand Up @@ -111,8 +101,6 @@ const STATUS_OS: SelectItem<StatusOS>[] = [

function OrderServiceTable() {
const [orderServices, setOrderServices] = useState<OrderServiceData[]>([]);
const [selectedOrderServiceToEdit, setSelectedOrderServiceToEdit] =
useState<OrderServiceData>();
const [nextOrderServices, setNextOrderServices] = useState<
OrderServiceData[]
>([]);
Expand All @@ -126,7 +114,16 @@ function OrderServiceTable() {
const limit = 10;
const [filter, setFilter] = useState<string>('');
const [search, setSearch] = useState<string>('');

const [selectedOrderServiceToEdit, setSelectedOrderServiceToEdit] =
useState<OrderServiceData>();

const { isOpen, onClose, onOpen } = useDisclosure();
const {
isOpen: isOpenEditOrderService,
onClose: onCloseEditOrderService,
onOpen: onOpenEditOrderService,
} = useDisclosure();

const {
control,
Expand Down Expand Up @@ -415,11 +412,17 @@ function OrderServiceTable() {
)}
</Td>
<Td>
<IconButton
aria-label="Mudar status da ordem de serviço"
variant="ghost"
icon={<FaTools />}
/>
<button onClick={onOpenEditOrderService}>
<IconButton
aria-label="Mudar status da ordem de serviço"
variant="ghost"
icon={<FaTools />}
onClick={(event) => {
event.stopPropagation();
handleEdit(orderService);
}}
/>
</button>
</Td>
</Tr>
))}
Expand Down Expand Up @@ -463,6 +466,13 @@ function OrderServiceTable() {
</Flex>
</Flex>
</Flex>
<OrderServiceEditModal
onClose={onCloseEditOrderService}
isOpen={isOpenEditOrderService}
orderService={selectedOrderServiceToEdit}
refreshRequest={refreshRequest}
setRefreshRequest={setRefreshRequest}
/>
<OrderServiceRegisterModal
onClose={onClose}
isOpen={isOpen}
Expand Down

0 comments on commit 3e009f1

Please sign in to comment.