diff --git a/src/interfaces/Plain.ts b/src/interfaces/Plain.ts index 127d89a..e298c84 100644 --- a/src/interfaces/Plain.ts +++ b/src/interfaces/Plain.ts @@ -1,4 +1,5 @@ import Seller from './Seller'; +import Supervisor from './Supervisor'; export default interface Plains { id: string; @@ -8,7 +9,8 @@ export default interface Plains { sellerId: string; done: boolean; supervisorId: string; - visitId: string; - moduleId: string; + visitId: string | null; + moduleId: string | null; seller: Seller; + supervisivor: Supervisor; } diff --git a/src/screens/SalesInspector/TabScreens/Action/Plain/MentoryAndVisit/index.tsx b/src/screens/SalesInspector/TabScreens/Action/Plain/MentoryAndVisit/index.tsx index bdd9e33..c436e41 100644 --- a/src/screens/SalesInspector/TabScreens/Action/Plain/MentoryAndVisit/index.tsx +++ b/src/screens/SalesInspector/TabScreens/Action/Plain/MentoryAndVisit/index.tsx @@ -1,7 +1,6 @@ import React, { useState } from 'react'; import * as S from './styles'; import Select from '@components/Select'; - import DateTimePicker, { DateTimePickerEvent, } from '@react-native-community/datetimepicker'; @@ -10,7 +9,6 @@ import { useToast } from 'react-native-toast-notifications'; import ISeller from '@interfaces/Seller'; import IModules from '@interfaces/Module'; import IVisits from '@interfaces/Visit/Visit'; - import PlainService from '@services/PlainService'; interface PlainActionProps { @@ -50,20 +48,29 @@ const PlainMentory: React.FC = ({ const handleCompletePlainAction = async () => { try { + // Formate a data no formato "dia/mês/ano" + const formattedDate = date.toLocaleDateString('pt-BR', { + day: '2-digit', + month: '2-digit', + year: 'numeric', + }); + const newPlain = await PlainService.createPlain({ title: titleAction, comments: comment, - prize: date.toLocaleDateString(), + prize: formattedDate, // Envia a data formatada sellerId: seller.id, supervisorId: seller.supervisorId, moduleId: seller.stage === 'Mentoria' ? selectedValue : selectedValue, }); + + console.log(newPlain); addNewPlain(newPlain); setState(); showToast('Plano de ação efetivado com sucesso', 'success'); } catch (error) { setState(); - showToast('Modulo Já disponhem de um plano de ação', 'warning'); + showToast('Módulo já dispõe de um plano de ação', 'warning'); } }; @@ -109,7 +116,7 @@ const PlainMentory: React.FC = ({ /> - criar plano de ação + Criar plano de ação Voltar @@ -140,7 +147,7 @@ const ActionSpecificFields: React.FC = ({ <> {stage === 'Visita' && ( <> - Vísita de Avaliação + Visita de Avaliação