Commit 67048850 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Modification offre emploi et affichage listing offre d'emploi

parent e877a819
Loading
Loading
Loading
Loading
+36 −0
Changes for data/ddl/table/OFFRE_EMPLOI.php: 36 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -45,6 +45,18 @@ return [
            'position'    => 5,
            'commentaire' => NULL,
        ],
        'TITRE'           => [
            'name'        => 'TITRE',
            'type'        => 'string',
            'bdd-type'    => 'VARCHAR2',
            'length'      => 200,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => TRUE,
            'default'     => NULL,
            'position'    => 15,
            'commentaire' => NULL,
        ],
        'DESCRIPTION'           => [
            'name'        => 'DESCRIPTION',
            'type'        => 'string',
@@ -57,6 +69,30 @@ return [
            'position'    => 6,
            'commentaire' => NULL,
        ],
        'NOMBRE_HEURES'           => [
            'name'        => 'NOMBRE_HEURES',
            'type'        => 'integer',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => TRUE,
            'default'     => NULL,
            'position'    => 16,
            'commentaire' => NULL,
        ],
        'NOMBRE_POSTES'           => [
            'name'        => 'NOMBRE_POSTES',
            'type'        => 'integer',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => TRUE,
            'default'     => NULL,
            'position'    => 17,
            'commentaire' => NULL,
        ],
        'HISTO_CREATEUR_ID'     => [
            'name'        => 'HISTO_CREATEUR_ID',
            'type'        => 'int',
+11 −8
Changes for front/Mission/ListeOffreEmploi.vue: 11 added lines, 8 removed lines.
Original line number Diff line number Diff line
<template>
    <div class="row row-cols-1 row-cols-md-2 g-4">

        <div v-for="offre in listeOffres">
        <offreEmploi :key="offre.id" :taux="offre"
                     :listeTaux="listeOffreEmploi"></offreEmploi>
            <offreEmploi @refresh="refresh" :key="offre.id" :offre="offre"></offreEmploi>
        </div>
    </div>
    <a v-if="canEditTaux" class="btn btn-primary" :href="ajoutUrl" @click.prevent="ajout">Ajout d'un nouveau taux</a>
    <!-- <a v-if="canEditTaux" class="btn btn-primary" :href="ajoutUrl" @click.prevent="ajout">Ajout d'un nouveau taux</a>-->
</template>

<script>
@@ -14,9 +16,6 @@ export default {
    components: {
        offreEmploi
    },
    props: {
        canEditTaux: {type: Boolean, required: true},
    },
    data()
    {
        return {
@@ -40,16 +39,20 @@ export default {
            this.reload();
        },

        refresh(taux)
        refresh(offre)
        {

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

        reload()
        {
            axios.get(
                Util.url("offre-emploi/liste")
            ).then(response => {
                this.listeOffres = response.data;
                console.log(this.listeOffres);
            });
        },
    }
+40 −7
Changes for front/Mission/OffreEmploi.vue: 40 added lines, 7 removed lines.
Original line number Diff line number Diff line
<template>
    <div class="card">
    <div class="col">
        <div class="card h-100">
            <div class="card-header">
            <h3 style="display:inline">Titre</h3>
            <div class="float-end">
                <h4> {{ offre.titre }}</h4>
                <span class="badge bg-success">En cours</span>&nbsp;
                <span class="badge bg-info">{{ offre.nombreHeures }} heure(s)</span>&nbsp;
                <span class="badge bg-info">{{ offre.nombrePostes }} poste(s)</span>&nbsp;
            </div>

            <div class="card-body">

                {{ offre.description }}

            </div>
            <div class="card-footer">
                <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                    <a :href="saisirUrl"
                       class="btn btn-primary"
                       @click.prevent="saisir">Modifier</a>

                </div>
            </div>
        <div class="card-body">
            <!-- BODY -->
        </div>
    </div>
</template>
@@ -18,15 +31,35 @@ export default {
    name: "OffreEmploi.vue",
    props: {
        offre: {required: true},
        listeTaux: {required: true},
    },
    data()
    {
        return {
            saisieUrl: Util.url('offre-emploi/saisir/:offre', {offre: this.offre.id}),
            saisirUrl: Util.url('offre-emploi/saisir/:offre', {offre: this.offre.id}),
            supprimerUrl: Util.url("offre-emploi/supprimer/:offre", {offre: this.offre.id}),
        };
    },
    methods: {
        saisir(event)
        {
            console.log(this.saisirUrl);
            modAjax(event.target, (response) => {
                this.$emit('refresh');
            });
        },
        refresh()
        {
            axios.get(
                Util.url("offre-emploi/get/:offreEmploi", {offreEmploi: this.offre.id})
            ).then(response => {
                console.log(response.data);
                this.$emit('refresh', response.data);
            });
        }


    },

}

</script>
+13 −3
Changes for module/Mission/config/module.config.php: 13 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -128,7 +128,16 @@ return [
            'privileges'    => Privileges::MISSION_OFFRE_EMPLOI_VISUALISATION,
            'may_terminate' => true,
            'child_routes'  => [

                'saisir' => [
                    'route'      => '/saisir[/:offreEmploi]',
                    'controller' => OffreEmploiController::class,
                    'action'     => 'saisir',
                ],
                'get'    => [
                    'route'      => '/get/:offreEmploi',
                    'controller' => OffreEmploiController::class,
                    'action'     => 'get',
                ],
                'liste'  => [
                    'route'      => '/liste',
                    'controller' => OffreEmploiController::class,
@@ -216,7 +225,7 @@ return [
        ],
        [
            'controller' => MissionTypeController::class,
            'action'     => ['saisir'],
            'action'     => ['saisie'],
            'privileges' => [
                Privileges::MISSION_EDITION_TYPE,
            ],
@@ -230,7 +239,7 @@ return [
        ],
        [
            'controller' => OffreEmploiController::class,
            'action'     => ['index', 'liste'],
            'action'     => ['index', 'liste', 'saisir'],
            'privileges' => [
                Privileges::MISSION_OFFRE_EMPLOI_VISUALISATION,
            ],
@@ -252,6 +261,7 @@ return [

    'forms' => [
        Form\MissionForm::class     => Form\MissionFormFactory::class,
        Form\OffreEmploiForm::class => Form\OffreEmploiFormFactory::class,
    ],

    'view_helpers' => [
+50 −0
Changes for module/Mission/src/Controller/OffreEmploiController.php: 50 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -13,8 +13,10 @@ use Application\Service\Traits\WorkflowServiceAwareTrait;
use Laminas\View\Model\JsonModel;
use Laminas\View\Model\ViewModel;
use Mission\Entity\Db\Mission;
use Mission\Entity\Db\OffreEmploi;
use Mission\Entity\Db\VolumeHoraireMission;
use Mission\Form\MissionFormAwareTrait;
use Mission\Form\OffreEmploiFormAwareTrait;
use Mission\Service\MissionServiceAwareTrait;
use Mission\Service\OffreEmploiServiceAwareTrait;
use Service\Entity\Db\TypeVolumeHoraire;
@@ -28,6 +30,8 @@ use Service\Entity\Db\TypeVolumeHoraire;
class OffreEmploiController extends AbstractController
{
    use OffreEmploiServiceAwareTrait;
    use OffreEmploiFormAwareTrait;


    public function indexAction()
    {
@@ -38,6 +42,31 @@ class OffreEmploiController extends AbstractController



    public function saisirAction()
    {

        $offreEmploi = $this->getEvent()->getParam('offreEmploi');
        $form        = $this->getFormOffreEmploi();
        if (empty($offreEmploi)) {
            $title       = "Création d'une nouvelle offre d'emploi";
            $offreEmploi = $this->getServiceOffreEmploi()->newEntity();
        } else {
            $title = "Modification d'une offre d'emploi";
        }
        $form->bindRequestSave($offreEmploi, $this->getRequest(), function () use ($offreEmploi, $form) {

            $this->getServiceOffreEmploi()->save($offreEmploi);

            $this->flashMessenger()->addSuccessMessage(
                "Enregistrement effectué"
            );
        });

        return compact('form', 'title');
    }



    /**
     * Retourne la liste des offres d'emploi
     *
@@ -50,4 +79,25 @@ class OffreEmploiController extends AbstractController
        return $this->axios()->send($query);
    }



    /**
     * Retourne les données pour une mission
     *
     * @return JsonModel
     */
    public function getAction(?OffreEmploi $offreEmploi = null)
    {
        if (!$offreEmploi) {
            /** @var OffreEmploi $offreEmploi */
            $offreEmploi = $this->getEvent()->getParam('offreEmploi');
        }

        $this->em()->clear();

        $query = $this->getServiceOffreEmploi()->query(['offreEmploi' => $offreEmploi]);

        return $this->axios()->send($this->axios()::extract($query)[0]);
    }

}
 No newline at end of file
Loading