Skip to content

Commit

Permalink
Ajout d'astérisque sur les champs requis dans les formulaires de créa…
Browse files Browse the repository at this point in the history
…tion et d'édition
  • Loading branch information
SonofaPancak committed May 11, 2024
1 parent c170ed2 commit 21adcb1
Show file tree
Hide file tree
Showing 23 changed files with 45 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const CreateEquipmentForm = ({ onPositiveResponse, initValues }) => {
<div>
<Select2
name="equipmentType"
label={lang.equipmentType}
label={lang.equipmentType+lang.required}
formTools={formTools}
creatable={true}
modalType={TYPE_TAXONOMY}
Expand All @@ -96,7 +96,7 @@ const CreateEquipmentForm = ({ onPositiveResponse, initValues }) => {
/>
<Input
name="label"
label={lang.label}
label={lang.label+lang.required}
formTools={formTools}
placeholder={lang.labelPlaceholder}
/>
Expand All @@ -111,6 +111,7 @@ const CreateEquipmentForm = ({ onPositiveResponse, initValues }) => {
formTools={formTools}
/>
</div>
<div>Suite à la création de l'équipement et de votre fiche, nous vous suggérons d'aller voir la fiche de l'équipement afin d'ajouter des liens vers des pages internet de celui-ci.</div>
<div className="d-flex justify-content-end">
<Button disabled={!formState.isValid} type="button" onClick={submitHandler}>{lang.continue}</Button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const SelectEquipment = ({name, formTools, parentEntity, ...props}) => {
<div className="col-9">
<Select2
name="equipment"
label={lang.Equipment}
label={lang.Equipment+lang.required}
creatable
fetch={"/equipment/list"}
searchField={"label"}
Expand All @@ -62,7 +62,7 @@ const SelectEquipment = ({name, formTools, parentEntity, ...props}) => {
className="col-3"
name="qty"
type="number"
label={lang.Quantity}
label={lang.Quantity+lang.required}
default={1}
validationRules={[
{name: "REQUIRED"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const EquipmentSingleEdit = ({ positiveRequestActions, ...props}) => {
<div>
<Select2
name="equipmentType"
label={lang.equipmentType}
label={lang.equipmentType+lang.required}
formTools={formTools}
creatable={true}
modalType={TYPE_TAXONOMY}
Expand All @@ -187,10 +187,13 @@ const EquipmentSingleEdit = ({ positiveRequestActions, ...props}) => {
requestData={{category:"equipmentType", name:""}}
searchField={"name"}
selectField={"name"}
validationRules={[
{name: "REQUIRED"}
]}
/>
<Input
name="label"
label={lang.label}
label={lang.label+lang.required}
formClassName="discrete-without-focus form-text-white"
formTools={formTools}
placeholder={lang.labelPlaceholder}
Expand Down Expand Up @@ -267,14 +270,12 @@ const EquipmentSingleEdit = ({ positiveRequestActions, ...props}) => {
}
</>
)


{/*********** Submit section ***********/}
const SinglePageBottom = (
<SubmitEntity submitHandler={modalSaveEntityReminder.displayModal} formState={formState} />
)

console.log("EQUIPEMENT", breadCrumb);
return (
<>
<SingleBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const CreateEventForm = ({ onPositiveResponse, initValues }) => {
<Input
name="name"
className="my-1"
label={lang.eventName}
label={lang.eventName+lang.required}
formTools={formTools}
validationRules={[
{name: "REQUIRED"}
Expand All @@ -101,7 +101,7 @@ const CreateEventForm = ({ onPositiveResponse, initValues }) => {
name="startDate"
className="my-1"
type="date"
label={lang.startDate}
label={lang.startDate+lang.required}
formTools={formTools}
validationRules={[
{name: "REQUIRED"}
Expand All @@ -111,7 +111,7 @@ const CreateEventForm = ({ onPositiveResponse, initValues }) => {
name="endDate"
className="my-1"
type="date"
label={lang.endDate}
label={lang.endDate+lang.required}
formTools={formTools}
validationRules={[
{name: "REQUIRED"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ const UpdateSchedule = ({name, formTools, schedule, ...props}) => {
<Input
className="col-md-12 col-lg-4 mb-2"
name="name"
label={lang.activityName}
label={lang.activityName+lang.required}
validationRules={[
{name: "REQUIRED"}
]}
/>
<div className="col-md-12 col-lg-8">
<h6 className="col text-dark fw-normal mb-1 mt-1">Début</h6>
<h6 className="col text-dark fw-normal mb-1 mt-1">Début{lang.required}</h6>
<div className="col-12 p-2 mb-2 rounded-1" >
<div className="row">
<Input
Expand All @@ -82,7 +82,7 @@ const UpdateSchedule = ({name, formTools, schedule, ...props}) => {
/>
</div>
</div>
<h6 className="col text-dark fw-normal mb-1 mt-1">Fin</h6>
<h6 className="col text-dark fw-normal mb-1 mt-1">Fin{lang.required}</h6>
<div className="col-12 rounded-1 p-2">
{/* adjust that live to avoid past of endDate */}
<div className="row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ const EventSingleEdit = ({data}, ...props) => {
<>
<Input
name="name"
label={lang.eventName}
label={lang.eventName+lang.required}
className="col-12 col-md-6"
formClassName="discrete-without-focus form-text-white"
validationRules={[
Expand Down Expand Up @@ -354,7 +354,7 @@ const EventSingleEdit = ({data}, ...props) => {
className="col-7"
formClassName="discrete-without-focus form-text-white "
name="startDate"
label={lang.date}
label={lang.date+lang.required}
type="date"
formTools={formTools}
validationRules={[
Expand All @@ -379,7 +379,7 @@ const EventSingleEdit = ({data}, ...props) => {
<Input name="endDate"
className="col-7"
formClassName="discrete-without-focus form-text-white "
label={lang.date}
label={lang.date+lang.required}
type="date"
formTools={formTools}
validationRules={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const CreateOrganisationForm = ({ onPositiveResponse }) => {
<FormUI />
<Input
name="name"
label="Nom"
label={"Nom"+lang.required}
className="my-1"
validationRules={[{name: "REQUIRED"}]}
errorText="Cette information est requise"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ const OrganisationSingleEdit = (props) => {
<Input
name="name"
placeholder="Nom de l'organisation"
label="Nom de l'organisation"
label={"Nom de l'organisation"+lang.required}
formClassName="discrete-without-focus form-text-white"
validationRules={[
{name: "REQUIRED"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const UpdateTeams = ({name, formTools, parentEntity, ...props}) => {
<div className="col-12 col-lg-6">
<Select2
name="member"
label={lang.teamMember}
label={lang.teamMember+lang.required}
creatable={false}
isMulti={false}
fetch={"/persons/list"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import RichTextarea from '@/FormElements/RichTextArea/RichTextarea'

//Context
import {useAuth} from "@/src/authentification/context/auth-context";
import { lang } from '@/src/common/Data/GlobalConstants'

//Styling
import styles from './CreatePersonForm.module.scss'

//FormData
import {getDefaultCreateEntityMeta} from "@/src/DataTypes/Meta/EntityMeta";
import { lang } from '@/src/common/Data/GlobalConstants'


const CreatePersonForm = ({ onPositiveResponse }) => {
Expand Down Expand Up @@ -87,7 +87,7 @@ const CreatePersonForm = ({ onPositiveResponse }) => {
<div className="row">
<Input
name="firstName"
label="Prénom"
label={"Prénom"+lang.required}
className="col-12 col-md-6"
validationRules={[{name: "REQUIRED"}]}
errorText="Cette information est requise"
Expand All @@ -96,7 +96,7 @@ const CreatePersonForm = ({ onPositiveResponse }) => {

<Input
name="lastName"
label="Nom"
label={"Nom"+lang.required}
className="col-12 col-md-6"
validationRules={[{name: "REQUIRED"}]}
errorText="Cette information est requise"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {useRootModal} from '@/src/hooks/useModal/useRootModal'
import Button from '@/FormElements/Button/Button'
import Input from '@/FormElements/Input/Input'
import RichTextarea from '@/FormElements/RichTextArea/RichTextarea'
import {lang} from "@/src/common/Data/GlobalConstants";
import Select2 from '@/src/common/FormElements/Select2/Select2'
import {SingleEntityMeta} from '@/src/DataTypes/Meta/components/SingleEntityMeta'
import SingleInfo from "@/DataTypes/common/layouts/SingleInfo/SingleInfo";
Expand All @@ -19,6 +18,7 @@ import UpdateSocialHandles from '@/src/DataTypes/common/Forms/UpdateSocialHandle
//Context
import {useAuth} from "@/src/authentification/context/auth-context";
import {MessageContext} from '@/src/common/UserNotifications/Message/Context/Message-Context';
import { lang } from '@/src/common/Data/GlobalConstants'

//FormData
import {getDefaultUpdateEntityMeta} from "@/src/DataTypes/Meta/EntityMeta";
Expand Down Expand Up @@ -239,7 +239,7 @@ const PersonSingleEdit = ({ positiveRequestActions, ...props}) => {
<div className="row">
<Input
name="firstName"
label="Prénom"
label={"Prénom"+lang.required}
className="col-12 col-sm-6 col-md-4"
formClassName="discrete-without-focus form-text-white"
validationRules={[
Expand All @@ -251,7 +251,7 @@ const PersonSingleEdit = ({ positiveRequestActions, ...props}) => {

<Input
name="lastName"
label="Nom"
label={"Nom"+lang.required}
className="col-12 col-sm-6 col-md-4"
formClassName="discrete-without-focus form-text-white"
validationRules={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const CreatePlaceForm = ({ onPositiveResponse, initValues }) => {
<FormUI />
<Input
name="name"
label={lang.name}
label={lang.name+lang.required}
className="col-12 col-md-6"
validationRules={[{name: "REQUIRED"}]}
errorText="Cette information est requise"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const PlaceSingleEdit = ({ positiveRequestActions, ...props}) => {
<>
<Input
name="name"
label={lang.name}
label={lang.name+lang.required}
formClassName="discrete-without-focus form-text-white h2"
validationRules={[
{name: "REQUIRED"}
Expand Down
2 changes: 1 addition & 1 deletion src/DataTypes/Project/component/forms/CreateProjectForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const CreateProjectForm = ({ onPositiveResponse, initValues }) => {
<Input
name="name"
className="my-1"
label="Nom du projet"
label={"Nom du projet"+lang.required}
formTools={formTools}
validationRules={[
{name: "REQUIRED"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const UpdateScheduleBudget = ({name, formTools, ...props}) => {
<Input
className="col-12 col-lg-4"
name="step"
label="Nom de l'étape"
label={"Nom de l'étape"+lang.required}
formTools={formTools}
validationRules={[
{name: "REQUIRED"}
Expand Down
2 changes: 1 addition & 1 deletion src/DataTypes/Project/component/forms/UpdateSponsor.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const UpdateSponsor = ({name, formTools, ...props}) => {
<div className="col-12 col-lg-6">
<Select2
name="entity"
label={lang.organisationSponsor}
label={lang.organisationSponsor+lang.required}
formTools={formTools}
creatable={false}
isMulti={false}
Expand Down
2 changes: 1 addition & 1 deletion src/DataTypes/Project/layouts/single/ProjectSingleEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ const ProjectSingleEdit = (props) => {
const title = (
<Input
name="name"
label="Nom du projet"
label={"Nom du projet"+lang.required}
formTools={formTools}
formClassName="discrete-without-focus form-text-white"
validationRules={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Button from "@/FormElements/Button/Button"
import Input from '@/src/common/FormElements/Input/Input';
import Repeater from '@/src/common/FormElements/Repeater/Repeater';
import {TYPE_TAXONOMY} from '@/src/DataTypes/Entity/Types';
import { lang } from '@/src/common/Data/GlobalConstants';


const UpdateSkillGroup = ({parentEntity, name, formTools, labelInput, labelSelect, ...props}) => {
Expand Down Expand Up @@ -40,7 +41,7 @@ const UpdateSkillGroup = ({parentEntity, name, formTools, labelInput, labelSelec
<div className="col-12 col-lg-6">
<Select2
name="skills"
label={labelSelect ?? "Compétences associées"}
label={labelSelect ? labelSelect+lang.required : "Compétences associées"+lang.required}
formTools={formTools}
creatable={true}
modalType={TYPE_TAXONOMY}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const UpdateSocialHandles = ({parentEntity, name, formTools, ...props}) => {
<section className="row col">
<Input
className="col-12"
label={"Description du lien"}
label={"Description du lien"+lang.required}
name="label"
validationRules={[
{name: "REQUIRED"}
Expand All @@ -49,7 +49,7 @@ const UpdateSocialHandles = ({parentEntity, name, formTools, ...props}) => {
<Input
className="col-12"
name="url"
label={lang.url}
label={lang.url+lang.required}
type="url"
//pattern="^https?:\/\/[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$"
placeholder="Exemple : https://siteWeb.com"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ const ContactPointView = ({contact, ...props}) => {
const telSection = tel.num !== "" && (
<article className={`d-flex flex-column p-2 mb-2`}>
<h5 className="text-dark mb-2">{lang.phoneNumber}</h5>
{/* Not wise to put <a href="tel: ...> because we don't force telephone format atm*/}
{tel.num}{tel.ext !== "" && `#${tel.ext}`}
</article>
)
const emailAddressSection = email.address !== "" && (
<article className={`d-flex flex-column p-2 mb-2`}>
<h5 className="text-dark mb-2">{lang.email}</h5>
{email.address}
<a href={"mailto:"+email.address}>{email.address}</a>
</article>
)
const websiteUrlSection = website.url !== "" && (
<article className={`d-flex flex-column p-2 mb-2`}>
<h5 className="text-dark mb-2">{lang.website}</h5>
{website.url}
<a href={website.url}>{website.url}</a>
</article>
)
return (
Expand Down
3 changes: 2 additions & 1 deletion src/common/FormElements/SelectLicence/SelectLicence.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import styles from './SelectLicence.module.scss'
import Select from '@/FormElements/Select/Select';
import Button from '@/src/common/FormElements/Button/Button'
import HtmlTagsRemover from '@/src/utils/HtmlTagsRemover';
import { lang } from '../../Data/GlobalConstants';


const SelectLicence = ({name, formTools, ...props}) => {
Expand Down Expand Up @@ -67,7 +68,7 @@ const SelectLicence = ({name, formTools, ...props}) => {
<>
<Select
name="licence"
label="Licence"
label={"Licence"+lang.required}
options={licences}
formTools={formTools}
noValueText="Aucune sélection"
Expand Down
1 change: 1 addition & 0 deletions src/languages/en-ca/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const base = {

"formNotValid": "Warning. The form send is invalid. Make sure that all fields required are correctly filled.",
"submit": "Submit",
"required": "*",


// CreatePersonForm.js
Expand Down
Loading

0 comments on commit 21adcb1

Please sign in to comment.