Commit 51dd4f78 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

WIP Offre d'emploi espace public

parent 5803f198
Loading
Loading
Loading
Loading
+1 −0
Changes for data/privileges.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -167,6 +167,7 @@ return [
            'offre-emploi-ajouter'       => 'Ajouter des offres d\'emploi',
            'offre-emploi-modifier'      => 'Modifier des offres d\'emploi',
            'offre-emploi-valider'       => 'Valider des offres d\'emploi',
            'offre-emploi-postuler'      => 'Postuler à une offre d\'emploi',


        ],
+49 −12
Changes for front/Mission/ListeOffreEmploi.vue: 49 added lines, 12 removed lines.
Original line number Diff line number Diff line
<template>
    <div class="row row-cols-1 row-cols-md-2 g-4">
        <offreEmploi v-for="offre in offres" @supprimer="supprimer" @refresh="refresh" :key="offre.id" :offre="offre" :public="this.public"></offreEmploi>
    <div v-if="!extended" class="row row-cols-1 row-cols-md-2 g-4">
        <offreEmploi v-for="offre in offres" @supprimer="supprimer" @refresh="refresh" :key="offre.id" :offre="offre" :public="this.public"
                     :canModifier="this.canModifier"
                     :canValider="this.canValider"
                     :canSupprimer="this.canSupprimer"></offreEmploi>
        <a v-if="this.public && this.canModifier" class=" btn btn-primary" :href="ajoutUrl" @click.prevent="ajout">Ajouter une nouvelle offre</a>
    </div>
    <div v-if="extended">
        <offreEmploi v-for="offre in offres" :key="offre.id" :offre="offre" :canPostuler="this.canPostuler" :extended="extended"
                     :public="this.public"></offreEmploi>
    </div>
    <br/>
    <a class="btn btn-primary" :href="ajoutUrl" @click.prevent="ajout">Ajouter une nouvelle offre</a>
</template>

<script>
@@ -16,7 +23,14 @@ export default {
    },
    props: {
        public: {type: Boolean, required: true},
        canAddOffreEmploi: {type: Boolean, required: true},
        id: {type: Number, required: false},
        utilisateur: {required: false},
        canModifier: {type: Boolean, required: false},
        canPostuler: {type: Boolean, required: false},
        canValider: {type: Boolean, required: false},
        canSupprimer: {type: Boolean, required: false},


    },
    data()
    {
@@ -25,11 +39,19 @@ export default {
            ajoutUrl: Util.url('offre-emploi/saisir'),
        };
    },

    mounted()
    {
        this.reload();
        console.log(this.offres);

    },
    computed: {
        extended: function ()
        {
            if (this.id) {
                return true;
            }
            return false
        }
    },
    methods: {
        ajout(event)
@@ -37,28 +59,43 @@ export default {
            modAjax(event.target, (widget) => {
                this.reload();
            });
        },
        }
        ,
        supprimer()
        {
            this.reload();
        },
        }
        ,

        refresh(offre)
        {
            console.log(offre);
            let index = Util.json.indexById(this.offres, offre.id);
            this.offres[index] = offre;
        },
        }
        ,

        reload()
        {
            if (this.id) {
                axios.get(
                    Util.url("offre-emploi/get/:offreEmploi", {offreEmploi: this.id})
                ).then(response => {
                    this.offres = [response.data];

                });

            } else {
                axios.get(
                    Util.url("offre-emploi/liste")
                ).then(response => {
                    this.offres = response.data;
                console.log(this.offres);

                });
        },
            }


        }
        ,
    }
}
</script>
+68 −18
Changes for front/Mission/OffreEmploi.vue: 68 added lines, 18 removed lines.
Original line number Diff line number Diff line
<template>
    <div class="col" v-if="isPublic">
    <div class="col" v-if="isPublic && !this.extended">
        <div class="card h-100">
            <div class="card-header">
                <h4> {{ offre.titre }}</h4>
                <span v-if="offre.validation" class="badge rounded-pill bg-success">Valider le <u-date
                    :value="offre.validation.histoCreation"/> par {{ offre.validation.histoCreateur.displayName }}&nbsp;</span>
                <span v-if="!offre.validation" class="badge rounded-pill bg-warning">En attente de validation par la DRH</span>&nbsp;
                <span class="badge rounded-pill bg-info">{{ offre.nombreHeures }} heure(s)</span> &nbsp;
                <span class="badge rounded-pill bg-info">{{ offre.nombrePostes }} poste(s)</span>

                <span class="badge rounded-pill bg-info">{{ offre.nombrePostes }} poste(s)</span>&nbsp;
                <span v-if="offre.validation && !this.public" class="badge rounded-pill bg-success">Valider le <u-date
                    :value="offre.validation.histoCreation"/> par {{ offre.validation.histoCreateur.displayName }}</span>
                <span v-if="!offre.validation && !this.public" class="badge rounded-pill bg-warning"> En attente de validation par la DRH</span>&nbsp;
            </div>

            <div class="card-body">
@@ -22,34 +21,69 @@
                    <u-date :value="offre.dateFin"/>
                    <br/>
                    <b>Demandé par la composante :</b> {{ offre.structure.libelle }}
                    <br/>
                    <b>Type de mission :</b> {{ offre.typeMission.libelle }}

                </p>
                {{ offre.description }}
                {{ shortDesc }}

            </div>
            <div class="card-footer">
                <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                    <a v-if="offre.validation"
                    <a v-if="offre.validation && this.canValider"
                       :href="devaliderUrl"
                       class="btn btn-danger"
                       @click.prevent="devalider">Devalider</a>
                    <a v-if="!offre.validation"
                    <a v-if="!offre.validation && this.canValider"
                       :href="validerUrl"
                       class="btn btn-success"
                       @click.prevent="valider">Valider</a>
                    <a :href="saisirUrl"
                    <a v-if="this.canModifier"
                       :href="saisirUrl"
                       class="btn btn-primary"
                       @click.prevent="saisir">Modifier</a>
                    <a :href="supprimerUrl"
                    <a v-if="this.canSupprimer"
                       :href="supprimerUrl"
                       class="btn btn-danger"
                       data-title="Suppression de l'offre"
                       data-content="Êtes-vous sur de vouloir supprimer l'offre ?"
                       @click.prevent="supprimer">Supprimer</a>

                    <a v-if="this.public"
                       :href="consulterUrl"
                       class="btn btn-primary"
                    >Consulter</a>
                </div>
            </div>
        </div>
    </div>
    <div v-if="this.extended">
        <p class="bg-light" style="padding:5px;">
            <b>Crée le : </b>
            <u-date :value="offre.histoCreation"/>
            par {{ offre.histoCreateur.displayName }}<br/>
            <b>Période à pourvoir : </b>du
            <u-date :value="offre.dateDebut"/>
            au
            <u-date :value="offre.dateFin"/>
            <br/>
            <b>Demandé par la composante :</b> {{ offre.structure.libelle }}
            <br/>
            <b>Type de mission :</b> {{ offre.typeMission.libelle }}
            <br/>
            <b>Nombre d'heures pour la mission :</b> {{ offre.nombreHeures }} heure(s)
            <br/>
            <b>Nombre de postes à pourvoir :</b> {{ offre.nombrePostes }} poste(s)
            <br/>

        </p>
        {{ offre.description }}
        <div style="margin-top:20px;">
            <a class="btn btn-primary" href="/offre-emploi/public">Retour aux offres</a>&nbsp;
            <a :class="isDisabled" href="/offre-emploi/postuler">Postuler</a>

        </div>
    </div>

</template>

<script>
@@ -58,19 +92,23 @@ export default {
    name: "OffreEmploi.vue",
    props: {
        offre: {required: true},
        public: {type: Boolean, required: true}
        public: {type: Boolean, required: false},
        extended: {type: Boolean, required: false},
        canModifier: {type: Boolean, required: false},
        canPostuler: {type: Boolean, required: false},
        canValider: {type: Boolean, required: false},
        canSupprimer: {type: Boolean, required: false},
    },
    data()
    {
        console.log(this.offre.histoCreation);
        console.log(this.public);
        return {

        console.log(this.canPostuler);
        return {
            saisirUrl: Util.url('offre-emploi/saisir/:offre', {offre: this.offre.id}),
            supprimerUrl: Util.url("offre-emploi/supprimer/:offre", {offre: this.offre.id}),
            validerUrl: Util.url('offre-emploi/valider/:offre', {offre: this.offre.id}),
            devaliderUrl: Util.url('offre-emploi/devalider/:offre', {offre: this.offre.id}),

            consulterUrl: Util.url('offre-emploi/public/:offre', {offre: this.offre.id}),
        };
    },
    computed: {
@@ -82,13 +120,25 @@ export default {
            } else {
                return false;
            }
        },
        isDisabled: function () {
            if (!this.canPostuler) {
                return 'btn btn-primary disabled';
            }
            return 'btn btn-primary';
        },
        shortDesc: function () {
            var shorDesc = this.offre.description.substr(0, 200);
            if (this.offre.description.length > 200) {
                shorDesc += '...';
            }
            return shorDesc;
        }
    },

    methods: {
        saisir(event)
        {
            console.log(this.saisirUrl);
            modAjax(event.target, (widget) => {
                this.refresh();
            });
+1 −0
Changes for module/Application/src/Provider/Privilege/Privileges.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -172,6 +172,7 @@ class Privileges extends \UnicaenPrivilege\Provider\Privilege\Privileges {
    const MISSION_EDITION_TYPE                                 = 'mission-edition-type';
    const MISSION_OFFRE_EMPLOI_AJOUTER                         = 'mission-offre-emploi-ajouter';
    const MISSION_OFFRE_EMPLOI_MODIFIER                        = 'mission-offre-emploi-modifier';
    const MISSION_OFFRE_EMPLOI_POSTULER                        = 'mission-offre-emploi-postuler';
    const MISSION_OFFRE_EMPLOI_SUPPRESSION                     = 'mission-offre-emploi-suppression';
    const MISSION_OFFRE_EMPLOI_VALIDER                         = 'mission-offre-emploi-valider';
    const MISSION_OFFRE_EMPLOI_VISUALISATION                   = 'mission-offre-emploi-visualisation';
+31 −6
Changes for module/Mission/config/module.config.php: 31 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ use Mission\Controller\OffreEmploiController;
use Mission\Controller\OffreEmploiControllerFactory;
use Mission\Service\MissionTypeService;
use Mission\Service\MissionTypeServiceFactory;
use Service\Controller\ModificationServiceDuController;
use UnicaenPrivilege\Assertion\AssertionFactory;
use UnicaenPrivilege\Guard\PrivilegeController;
use Mission\Service\OffreEmploiService;
@@ -169,10 +170,11 @@ return [
                    'privileges' => Privileges::MISSION_OFFRE_EMPLOI_VALIDER,
                ],
                'public'    => [
                    'route'      => '/public',
                    'route'      => '/public[/:offreEmploi]',
                    'controller' => OffreEmploiController::class,
                    'action'     => 'public',
                ],

            ],

        ],
@@ -242,18 +244,35 @@ return [
                        ],
                    ],
                ],
                'rh'           => [

            ],
        ],
        'gestion'        => [
            'pages' => [
                        'offre-emploi' => [
                            'label'    => "Offres d'emploi",
                'offres-emploi' => [
                    'label'    => "Offre emplois étudiants",
                    'icon'     => 'fas fa-duotone fa-pen-to-square',
                    'title'    => "Offre",
                    'route'    => 'offre-emploi',
                    'resource' => PrivilegeController::getResourceId(OffreEmploiController::class, 'index'),
                    'order'    => 60,
                    'color'    => '#217DD8',
                    'pages'    => [
                        'offre' => [
                            'label'    => "Consulter la liste des offres",
                            'icon'     => 'fas fa-duotone fa-pen-to-square',
                            'title'    => "Consulter la liste des emplois étudiants",
                            'route'    => 'offre-emploi',
                            'resource' => PrivilegeController::getResourceId(OffreEmploiController::class, 'index'),
                            'order'    => 80,
                            'order'    => 10,
                            'color'    => '#217DD8',
                        ],
                    ],
                ],
            ],
        ],


    ],

    'rules' => [
@@ -289,7 +308,7 @@ return [
        ],
        [
            'controller' => OffreEmploiController::class,
            'action'     => ['index', 'liste', 'saisir', 'get'],
            'action'     => ['index', 'saisir',],
            'privileges' => [
                Privileges::MISSION_OFFRE_EMPLOI_VISUALISATION,
            ],
@@ -308,6 +327,12 @@ return [
                Privileges::MISSION_OFFRE_EMPLOI_VALIDER,
            ],
        ],
        [
            'controller' => OffreEmploiController::class,
            'action'     => ['public', 'list', 'get'],
            'roles'      => ['guest'],

        ],
    ],

    'controllers' => [
Loading