forked from fga-eps-mds/2017.2-MerendaMais
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fga-eps-mds#164 - Standardization of generic functions related to ins…
…pection
- Loading branch information
Showing
4 changed files
with
73 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
export const verifyAgentInvited = (visitSchedule) => { | ||
if (visitSchedule.content.invitedAgent) { | ||
return 'Um agente foi convidado'; | ||
} | ||
return 'Agente não convidado'; | ||
}; | ||
|
||
export const verifyStatus = (isConfirmed, text) => { | ||
if (isConfirmed === true) { | ||
return text; | ||
} | ||
return `Não , ${text}!`; | ||
}; | ||
|
||
export const getVisitData = (visitSchedule) => { | ||
const data = [ | ||
{ | ||
label: 'Escola:', | ||
value: visitSchedule.content.schoolName, | ||
}, | ||
{ | ||
label: 'Data:', | ||
value: visitSchedule.content.date, | ||
}, | ||
{ | ||
label: 'Horário:', | ||
value: visitSchedule.content.time, | ||
}, | ||
{ | ||
label: verifyAgentInvited(visitSchedule), | ||
value: '', | ||
}, | ||
{ | ||
label: 'Número de participantes:', | ||
value: Object.keys(visitSchedule.content.visitListOfInvitees).length, | ||
}, | ||
]; | ||
return data; | ||
}; | ||
|
||
export const getCounselorData = (counselor) => { | ||
const data = [ | ||
{ | ||
label: 'Nome:', | ||
value: counselor.name, | ||
}, | ||
{ | ||
label: 'Email:', | ||
value: counselor.email, | ||
}, | ||
{ | ||
label: 'Telefone:', | ||
value: counselor.profile.phone, | ||
}, | ||
{ | ||
label: 'Status da Visita:', | ||
value: verifyStatus(counselor.confirmed, 'Confirmado'), | ||
}, | ||
{ | ||
label: 'Status da Fiscalização:', | ||
value: verifyStatus(counselor.realizedVisit, 'Realizada'), | ||
}, | ||
]; | ||
|
||
return data; | ||
}; |