Skip to content

Commit

Permalink
Merge pull request #3 from ipti/new/registration
Browse files Browse the repository at this point in the history
fix: validation password create user, date EUA to brasil, text EUA to…
  • Loading branch information
jonnypaulino authored Apr 30, 2024
2 parents 4972621 + cbc5ec3 commit f34d1ae
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 48 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
REACT_APP_API_PATH=http://localhost:3000/
# REACT_APP_API_PATH=https://br-ipti-beneficiarios.azurewebsites.net/
# REACT_APP_API_PATH=http://localhost:3000/
REACT_APP_API_PATH=https://br-ipti-beneficiarios.azurewebsites.net/
90 changes: 65 additions & 25 deletions src/Components/Calendar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,70 @@ import { PropsInputCalendar } from "../../Types/types";
import { addLocale } from "primereact/api";

const CalendarComponent = ({
value,
onChange,
placeholder,
disabled,
onBlur,
name,
view,
dateFormat
value,
onChange,
placeholder,
disabled,
onBlur,
name,
view,
dateFormat,
}: PropsInputCalendar) => {
addLocale("pt-br", {
firstDayOfWeek: 1,
dayNames: [
"domingo",
"segunda",
"terça",
"quarta",
"quinta",
"sexta",
"sábado",
],
dayNamesShort: ["dom", "seg", "ter", "qua", "qui", "sex", "sáb"],
dayNamesMin: ["D", "S", "T", "Q", "Q", "S", "S"],
monthNames: [
"janeiro",
"fevereiro",
"março",
"abril",
"maio",
"junho",
"julho",
"agosto",
"setembro",
"outubro",
"novembro",
"dezembro",
],
monthNamesShort: [
"jan",
"fev",
"mar",
"abr",
"mai",
"jun",
"jul",
"ago",
"set",
"out",
"nov",
"dez",
],
today: "Hoje",
clear: "Limpiar",
});
return (
<Calendar
value={value}
onChange={onChange}
dateFormat={dateFormat}
style={{ width: "100%" }}
locale="pt-br"
name={name}
placeholder={placeholder}
/>
);
};


addLocale('es', {
firstDayOfWeek: 1,
dayNames: ['domingo', 'segunda', 'terça', 'quarta', 'quinta', 'sexta', 'sábado'],
dayNamesShort: ['dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sáb'],
dayNamesMin: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'],
monthNames: ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'],
monthNamesShort: ['jan', 'fev', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'out', 'nov', 'dez'],
today: 'Hoje',
clear: 'Limpiar'
});
return (
<Calendar value={value} onChange={onChange} dateFormat={dateFormat} style={{width: "100%"}} locale="es" name={name} placeholder={placeholder} />
)
}

export default CalendarComponent;
export default CalendarComponent;
2 changes: 1 addition & 1 deletion src/Components/Card/CardClassroom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const CardClassroom = ({
<ConfirmDialog
visible={visible}
onHide={() => setVisible(false)}
message="Are you sure you want to proceed?"
message="Tem certeza de que deseja prosseguir?"
header="Confirmation"
icon="pi pi-exclamation-triangle"
accept={() => props.DeleteClassroom(id)}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Card/CardRegistration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const CardRegistration = ({
<ConfirmDialog
visible={visible}
onHide={() => setVisible(false)}
message="Are you sure you want to proceed?"
message="Tem certeza de que deseja prosseguir??"
header="Confirmation"
icon="pi pi-exclamation-triangle"
accept={() => props.DeleteRegistration(idRegistration)}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Card/CardSchedule/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const CardSchedule = ({
<ConfirmDialog
visible={visible}
onHide={() => setVisible(false)}
message="Are you sure you want to proceed?"
message="Tem certeza de que deseja prosseguir?"
header="Confirmation"
icon="pi pi-exclamation-triangle"
accept={() => props.DeleteSchedule(id)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const CreateMeetingPage = () => {
<CalendarComponent
placeholder="Data do encontro *"
name="meeting_date"
dateFormat="dd/mm/yy"
value={values.meeting_date}
onChange={handleChange}
/>
Expand Down
44 changes: 30 additions & 14 deletions src/Pages/Classroom/ClassroomOne/MeetingList/Meeting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import DataMeeting from "./DataMeeting";
import ListArchivesAttendanceList from "./UploadArchivesAttendanceList";
import Loading from "../../../../../Components/Loading";
import TextAreaComponent from "../../../../../Components/TextArea";
import { Chip } from "primereact/chip";

const Meeting = () => {
return (
Expand Down Expand Up @@ -46,19 +47,19 @@ const MeetingPage = () => {
props.meeting?.status === Status.PENDING
? "warn"
: props.meeting?.status === Status.APPROVED
? "success"
: props.meeting?.status === Status.REPROVED
? "error"
: "info"
? "success"
: props.meeting?.status === Status.REPROVED
? "error"
: "info"
}
text={
props.meeting?.status === Status.PENDING
? "Pendente"
: props.meeting?.status === Status.APPROVED
? "Aprovado"
: props.meeting?.status === Status.REPROVED
? "Pendente de Revisão"
: "info"
? "Aprovado"
: props.meeting?.status === Status.REPROVED
? "Pendente de Revisão"
: "info"
}
/>
</div>
Expand All @@ -77,16 +78,31 @@ const MeetingPage = () => {
</div>
)}
</div>

<Padding padding="8px" />
<DataMeeting />
<div className="col-12 md:col-6">
<label>Responsáveis pelo encontro</label>
<Padding />
<div className="flex flex-wrap gap-2">
{props.meeting.meeting_user.map((item) => {
return <Chip label={item.users.name} />;
})}
</div>
</div>
<Padding padding="16px" />
{!(props.meeting.status === Status.APPROVED && propsAplication.user?.role === ROLE.REAPPLICATORS) && <div className="grid">
<div className="col-12 md:col-6">
<label>Salve os arquivos do encontro</label>
<Padding />
<Upload />
{!(
props.meeting.status === Status.APPROVED &&
propsAplication.user?.role === ROLE.REAPPLICATORS
) && (
<div className="grid">
<div className="col-12 md:col-6">
<label>Salve os arquivos do encontro</label>
<Padding />
<Upload />
</div>
</div>
</div>}
)}
<Padding />
{props.meeting?.meeting_archives?.length > 0 && (
<label>Arquivos</label>
Expand Down
6 changes: 3 additions & 3 deletions src/Pages/Users/CreateUser/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const CreateUserPage = () => {
const props = useContext(UsersContext) as UsersTypes;

const CreateUserSchema = Yup.object().shape({
name: Yup.string().required("Campo Obrigatório"),
username: Yup.string().required("Campo Obrigatório"),
password: Yup.string().required("Campo Obrigatório"),
name: Yup.string().required("Campo Obrigatório").min(16, "Nome deve ter pelo menos 16 caracteres"),
username: Yup.string().required("Campo Obrigatório").min(8, "Nome do usuário deve ter pelo menos 8 caracteres"),
password: Yup.string().required("Campo Obrigatório").min(8, "Senha deve ter pelo menos 8 caracteres"),
role: Yup.object().required("Campo Obrigatório"),
project: Yup.array().required("Campo Obrigatório"),
confirmPassword: Yup.string()
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Users/ListUsers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ const ListUsersPage = () => {
<Button label="Criar usuário" onClick={() => history("/users/criar")} />
<Padding padding="16px" />
<DataTable value={props.users} tableStyle={{ minWidth: "50rem" }}>
<Column field="id" header="Code"></Column>
<Column field="name" header="Nome"></Column>
<Column field="username" header="Usuário"></Column>
<Column field="role" body={typeUserBody} header="Tipo"></Column>
<Column field="active" body={ActiveUserBody} header="Ativo"></Column>
</DataTable>
Expand Down

0 comments on commit f34d1ae

Please sign in to comment.