Skip to content

Commit

Permalink
[Backend] Correction et modification "Liste des offres"
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieu29nick committed Sep 10, 2024
1 parent 68dc622 commit f1a50e6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
20 changes: 13 additions & 7 deletions src/views/offres/Add/Creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const CreateOffer = () => {
<CForm onSubmit={handleSubmit}>
<CInputGroup className="mb-3">
<CInputGroupText>Type d'offre</CInputGroupText>
<CFormSelect name="type" value={offerData.type} onChange={handleInputChange}>
<CFormSelect name="type" value={offerData.type} onChange={handleInputChange} required>
<option value="">Sélectionner</option>
<option value="Stage">Stage</option>
<option value="Emplois">Emploi</option>
Expand All @@ -116,6 +116,7 @@ const CreateOffer = () => {
type="text"
placeholder="Libellé"
name="label"
required
value={offerData.label}
onChange={handleInputChange}
/>
Expand All @@ -125,6 +126,7 @@ const CreateOffer = () => {
<CInputGroupText>Entreprise</CInputGroupText>
<CFormInput
type="text"
required
placeholder="Nom de l'entreprise"
name="company"
value={offerData.company}
Expand All @@ -137,6 +139,7 @@ const CreateOffer = () => {
<CFormTextarea
placeholder="Courte description de l'offre"
name="shortdescription"
required
value={offerData.shortdescription}
onChange={handleInputChange}
/>
Expand All @@ -146,6 +149,7 @@ const CreateOffer = () => {
<CInputGroupText>Compétences</CInputGroupText>
<CFormInput
type="text"
required
placeholder="Compétences (séparées par des virgules)"
name="skills"
value={offerData.skills}
Expand All @@ -155,7 +159,7 @@ const CreateOffer = () => {

<CInputGroup className="mb-3">
<CInputGroupText>Contrat</CInputGroupText>
<CFormSelect name="contract" value={offerData.contract} onChange={handleInputChange}>
<CFormSelect name="contract" value={offerData.contract} onChange={handleInputChange} required>
<option value="">Sélectionner</option>
<option value="CDD">CDD</option>
<option value="CDI">CDI</option>
Expand All @@ -165,7 +169,7 @@ const CreateOffer = () => {

<CInputGroup className="mb-3">
<CInputGroupText>Type de Travail</CInputGroupText>
<CFormSelect name="typeWork" value={offerData.typeWork} onChange={handleInputChange}>
<CFormSelect name="typeWork" value={offerData.typeWork} onChange={handleInputChange} required>
<option value="">Sélectionner</option>
<option value="Sur Site">Sur Site</option>
<option value="A Distance">A Distance</option>
Expand All @@ -176,6 +180,7 @@ const CreateOffer = () => {
<CInputGroupText>Ville</CInputGroupText>
<CFormInput
type="text"
required
placeholder="Ville"
name="city"
value={offerData.city}
Expand All @@ -187,6 +192,7 @@ const CreateOffer = () => {
<CInputGroupText>Date Limite</CInputGroupText>
<CFormInput
type="date"
required
name="deadlinedate"
value={offerData.deadlinedate}
onChange={handleInputChange}
Expand All @@ -197,6 +203,7 @@ const CreateOffer = () => {
<CInputGroupText>Années d'expérience minimum</CInputGroupText>
<CFormInput
type="number"
required
name="minexperience"
value={offerData.minexperience}
onChange={handleInputChange}
Expand All @@ -207,6 +214,7 @@ const CreateOffer = () => {
<CInputGroupText>Langue</CInputGroupText>
<CFormInput
type="text"
required
placeholder="Label de la langue"
name="label"
value={offerData.language.label}
Expand All @@ -216,21 +224,19 @@ const CreateOffer = () => {

<CInputGroup className="mb-3">
<CInputGroupText>Niveau</CInputGroupText>
<CFormSelect name="level" value={offerData.language.level} onChange={handleLanguageChange}>
<CFormSelect name="level" value={offerData.language.level} onChange={handleLanguageChange} required>
<option value="">Sélectionner</option>
<option value="Moyen">Moyen</option>
<option value="Intermédiaire">Intermédiaire</option>
<option value="Avancé">Avancé</option>
</CFormSelect>
</CInputGroup>

{message && <p style={{ color: 'success' }}>{message}</p>}
<div className="d-grid">
<CButton color="primary" type="submit" disabled={loading}>
{loading ? 'Création en cours...' : 'Créer l\'offre'}
</CButton>
</div>

{message && <p>{message}</p>}
</CForm>
</CCardBody>
</CCard>
Expand Down
6 changes: 3 additions & 3 deletions src/views/offres/liste/Liste.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const ListeOffre = () => {
const [filters, setFilters] = useState({
type: '',
skills: '',
city: '',
label: '',
contract: '',
minexperience: '',
language: '',
Expand All @@ -42,7 +42,7 @@ const ListeOffre = () => {
totalResults: 0
})

const fetchOffers = async (page = 1) => {
const fetchOffers = async (page = 0) => {
setLoading(true)
try {
const response = await axios.get(`${API_URL}/search`, {
Expand Down Expand Up @@ -108,7 +108,7 @@ const ListeOffre = () => {
<CFormInput name="skills" placeholder="Compétences" value={filters.skills} onChange={handleInputChange} />
</CCol>
<CCol md={3}>
<CFormInput name="city" placeholder="Ville" value={filters.city} onChange={handleInputChange} />
<CFormInput name="label" placeholder="Titre de l\'offre" value={filters.label} onChange={handleInputChange} />
</CCol>
<CCol md={3}>
<CFormSelect
Expand Down

0 comments on commit f1a50e6

Please sign in to comment.