Commit 07ea96a2 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Administration > Gestion des déclarations

 - Les validateurs s'affichent correctement
 - Déplacement des sources vers ./front (Node 10.24) + Gulp
parent cdedf8dc
Loading
Loading
Loading
Loading
Loading
+16 −0
Changes for front/gulpfile.js: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -130,6 +130,21 @@ exports.workpackageUIWatch = function(cb){
    ], workpackageUI);
}

//// 2.9 Liste des déclarations (Administration)
function timesheetDeclarationsList(cb) {
    compile("TimesheetDeclarationsList");
    cb();
}
exports.timesheetDeclarationsList = timesheetDeclarationsList;
exports.timesheetDeclarationsListWatch = function(cb){
    watch([
        pathModuleSrc + "TimesheetDeclarationsList.vue",
        pathModuleSrc + "components/PersonSchedule.vue",
        pathModuleSrc + "components/PersonAutoCompleter.vue",
        pathModuleSrc + "components/AjaxResolve.js"
    ], timesheetDeclarationsList);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// 3. COMPOSANTS
///////////////////////// COMPOSANTS COMPILES
@@ -168,6 +183,7 @@ let commands = [
    'administrationPcruPC',
    'componentRNSRField',
    'createProcessusPCRU',
    'timesheetDeclarationsList',
    'workpackageUI',
];

+14 −13
Changes for front/src/TimesheetDeclarationsList.vue: 14 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@
                                <strong>Validation projet en attente</strong>
                                par l'un des validateurs suivant :
                                <ul>
                                    <li v-for="p in selectedValidation.validateursPrj">
                                    <li v-for="p in selectedValidation.validatorsPrj">
                                        <i class="icon-user"></i>{{ p.person }}
                                        <a class="link" @click.prevent.stop="handlerDelete('prj', p)"><i class="icon-trash"></i> Supprimer</a>
                                    </li>
@@ -253,7 +253,7 @@
                                <strong>Validation scientifique en attente</strong>
                                par l'un des validateurs suivant :
                                <ul>
                                    <li v-for="p in selectedValidation.validateursSci">
                                    <li v-for="p in selectedValidation.validatorsSci">
                                        <i class="icon-user"></i>{{ p.person }}
                                        <a class="link" @click.prevent.stop="handlerDelete('sci', p)"><i class="icon-trash"></i> Supprimer</a>
                                    </li>
@@ -276,7 +276,7 @@
                            <strong>Validation administrative en attente</strong>
                            par l'un des validateurs suivant :
                            <ul>
                                <li v-for="p in selectedValidation.validateursAdm">
                                <li v-for="p in selectedValidation.validatorsAdm">
                                    <i class="icon-user"></i>{{ p.person }}
                                    <a class="link" @click.prevent.stop="handlerDelete('adm', p)"><i class="icon-trash"></i> Supprimer</a>
                                </li>
@@ -293,9 +293,10 @@
</template>
<script>
    // nodejs node_modules/.bin/poi watch --format umd --moduleName  TimesheetDeclarationsList --filename.css TimesheetDeclarationsList.css --filename.js TimesheetDeclarationsList.js --dist public/js/oscar/dist public/js/oscar/src/TimesheetDeclarationsList.vue
    import AjaxResolve from "./AjaxResolve";
    import PersonAutoCompleter from "./PersonAutoCompleter";
    import PersonSchedule from "./PersonSchedule";

    import PersonAutoCompleter from "./components/PersonAutoCompleter";
    import PersonSchedule from "./components/PersonSchedule";
    import AjaxResolve from "./components/AjaxResolve";



@@ -417,7 +418,7 @@
                        this.fetch();
                    },
                    ko => {
                        this.error = AjaxResolve.resolve("Impossible de modifier les horaires", ko);
                        // this.error = AjaxResolve.resolve("Impossible de modifier les horaires", ko);

                    }
                ).then(foo => {
@@ -464,13 +465,13 @@

                        switch( type ){
                            case "prj":
                                this.selectedValidation.validateursPrj.splice(this.selectedValidation.validateursPrj.indexOf(person, 1));
                                this.selectedValidation.validatorsPrj.splice(this.selectedValidation.validatorsPrj.indexOf(person, 1));
                                break;
                            case "sci":
                                this.selectedValidation.validateursSci.splice(this.selectedValidation.validateursSci.indexOf(person, 1));
                                this.selectedValidation.validatorsSci.splice(this.selectedValidation.validatorsSci.indexOf(person, 1));
                                break;
                            case "adm":
                                this.selectedValidation.validateursAdm.splice(this.selectedValidation.validateursAdm.indexOf(person, 1));
                                this.selectedValidation.validatorsAdm.splice(this.selectedValidation.validatorsAdm.indexOf(person, 1));
                                break;
                        }
                    },
@@ -498,13 +499,13 @@
                    ok => {
                        switch( type ){
                            case "prj":
                                this.selectedValidation.validateursPrj.push(ok.body);
                                this.selectedValidation.validatorsPrj.push(ok.body);
                                break;
                            case "sci":
                                this.selectedValidation.validateursSci.push(ok.body);
                                this.selectedValidation.validatorsSci.push(ok.body);
                                break;
                            case "adm":
                                this.selectedValidation.validateursAdm.push(ok.body);
                                this.selectedValidation.validatorsAdm.push(ok.body);
                                break;
                        }
                    },
+13 −0
Changes for front/src/components/AjaxResolve.js: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
export default {
    resolve( message, ajaxResponse ){
        let serverMsg = "Erreur inconnue";
        if( ajaxResponse ){
            serverMsg = ajaxResponse.body;

            if( ajaxResponse.status == 403 ){
                serverMsg = "Vous avez été déconnectez de l'application";
            }
        }
        return message + " (Réponse : " + serverMsg +")";
    }
}
 No newline at end of file
+188 −0
Changes for front/src/components/PersonSchedule.vue: 188 added lines, 0 removed lines.
Original line number Diff line number Diff line
<template>
    <section class="schedule">

        <transition name="fade">
            <div class="pending overlay" v-if="loading">
                <div class="overlay-content">
                    <i class="icon-spinner animate-spin"></i>
                    {{ loading }}
                </div>
            </div>
        </transition>

        <transition name="fade">
            <div class="pending overlay" v-if="error">
                <div class="overlay-content">
                    <i class="icon-attention-1"></i>
                    {{ error }}
                </div>
            </div>
        </transition>

        <p>La répartition horaire est issue de {{ from }}

        <strong v-if="from == 'application'">la configuration Oscar par défaut</strong>
        <strong v-if="from == 'sync'">la synchronisation (Connector)</strong>
        <strong v-if="from == 'custom'">la configuration prédéfinie</strong>
        <strong v-if="from == 'free'">la configuration manuelle</strong>
        </p>


        <article class="card xs" v-for="total, day in days">
            <h3 class="card-title">
                <strong>{{daysLabels[day]}}</strong>
                <input type="text" v-model="days[day]" v-if="editDay">
                <em class="big right" @click="handlerEditDays()" v-else>{{ total | heures }}</em>
            </h3>
        </article>

        <article class="card">
            <h3 class="card-title">
                <strong>Total / semaine</strong>
                <em class="big right">{{ totalWeek | heures }}</em>
            </h3>
        </article>

        <nav v-if="editable">
            <button @click.prevent="handlerEditDays()" class="btn btn-default" v-if="!editDay"><i class="icon-pencil"></i> modifier</button>
            <button @click.prevent="handlerSaveDays()" class="btn btn-primary" v-if="editDay"><i class="icon-floppy"></i> enregistrer</button>
            <select v-model="model" class="form-inline" v-if="models && editDay" @change="handlerSaveDays(model)">
                <option value="default">Aucun</option>
                <option v-for="m, key in models" :value="key" :selected="model == key">{{ m.label }}</option>
            </select>

            <button @click.prevent="handlerSaveDays('default')" class="btn btn-primary" v-if="editDay && from != 'default'"><i class="icon-floppy"></i> Horaires par défaut</button>
            <button @click.prevent="handlerCancel()" class="btn btn-primary" v-if="editDay"><i class="icon-cancel-circled"></i> annuler</button>
        </nav>
    </section>
</template>
<script>
    // poi watch --format umd --moduleName  PersonSchedule --filename.css PersonSchedule.css --filename.js PersonSchedule.js --dist public/js/oscar/dist public/js/oscar/src/PersonSchedule.vue
    import AjaxResolve from "./AjaxResolve";

    export default {
        name: 'PersonSchedule',

        props: {
            urlapi: {default: ''},
            editable: { default: false },
            schedule: null
        },

        data() {
            return {
                daysLabels: {
                    '1': 'Lundi',
                    '2': 'Mardi',
                    '3': 'Mercredi',
                    '4': 'Jeudi',
                    '5': 'Vendredi',
                    '6': 'Samedi',
                    '7': 'Dimanche'
                },
                loading: null,
                error: null,
                dayLength: 0.0,
                from: null,
                days: {},
                editDay: null,
                newValue: 0,
                models: [],
                model: null
            }
        },

        computed: {
            totalWeek(){
                let total = 0.0;
                Object.keys(this.days).forEach(i => {
                    total += parseFloat(this.days[i]);
                });
                return total;
            }
        },

        methods: {
            day(index){
                if( this.days.hasOwnProperty(index) ){
                    return this.days[index];
                }
                return this.dayLength;
            },

            handlerEditDays(){
                this.editDay = true;
            },

            handlerCancel(){
                if( !this.urlapi ){
                    this.$emit('cancel');
                } else {
                    this.fetch();
                }
            },

            handlerSaveDays( model = 'input'){
                if( !this.urlapi ){
                    this.$emit('changeschedule', this.days);
                }
                else {
                    this.loading = "Enregistrement des horaires";
                    let datas = new FormData();
                    if( model == 'input' ){
                        datas.append('days', JSON.stringify(this.days));
                    }
                    else {
                        datas.append('model', model);
                    }


                    this.$http.post(this.urlapi, datas).then(
                        ok => {
                            this.fetch();
                        },
                        ko => {
                            this.error = AjaxResolve.resolve('Impossible de modifier les horaires', ko);
                        }
                    ).then(foo => {
                        this.loading = false
                    });
                }
            },


            fetch(clear = true) {
                if( this.schedule == null ){

                    this.loading = "Chargement des données";

                    this.$http.get(this.urlapi).then(
                        ok => {
                            console.log(ok.body);
                            this.days = ok.body.days;
                            this.dayLength = ok.body.dayLength;
                            this.from = ok.body.from;
                            this.models = ok.body.models;
                            this.model = ok.body.model;
                        },
                        ko => {
                            this.error = AjaxResolve.resolve('Impossible de charger les données', ko);
                        }
                    ).then(foo => {
                        this.loading = false;
                        this.editDay = null;
                    });
                } else {
                    console.log(this.schedule);
                    this.days = this.schedule.days;
                    this.dayLength = this.schedule.dayLength;
                    this.editDay = true;
                }
            }
        },

        mounted() {
            this.fetch(true)
        }
    }
</script>
 No newline at end of file
+2 −2
Changes for module/Oscar/src/Oscar/Service/TimesheetService.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -3140,7 +3140,7 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
        $body = str_ireplace($find, $replace, $messageTemplate);

        $message = $this->getPersonService()->getMailingService()->newMessage(
            "[OSCAR] Déclaration de temps $declarer pour " . $periodInfos->getPeriodLabel()
            "Déclaration de temps $declarer pour " . $periodInfos->getPeriodLabel()
        );
        $message->setTo($declarer->getEmail());
        $message->setBody($body);
@@ -3200,7 +3200,7 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
        $body = str_ireplace($find, $replace, $messageTemplate);

        $message = $this->getPersonService()->getMailingService()->newMessage(
            "[OSCAR] Feuille de temps à valider pour " . $periodInfos->getPeriodLabel()
            "Feuille de temps à valider pour " . $periodInfos->getPeriodLabel()
        );
        $message->setTo($validator->getEmail());
        $message->setBody($body);
Loading