Commit d2ba6b79 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

UI de configuration PCRU

parent ca412388
Loading
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -75,6 +75,16 @@ exports.activityDocumentWatch = function(cb){
    watch(pathModuleSrc + "ActivityDocument.vue", activityDocument);
}

//// 2.4 Correspondance Type de contrat PCRU / Type d'activité Oscar
function contratTypePCRU(cb) {
    compile("ContratTypePCRU");
    cb();
}
exports.contratTypePCRU = contratTypePCRU;
exports.contratTypePCRUWatch = function(cb){
    watch(pathModuleSrc + "ContratTypePCRU.vue", contratTypePCRU);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// 3. COMPOSANTS
///////////////////////// COMPOSANTS COMPILES
+30 −0
Original line number Diff line number Diff line
<template>
  <div>
    <strong @click="handlerSelect">{{ tree.label}}</strong>
    <div v-if="tree.children">
      <tree v-for="c in tree.children" :tree="c" :key="c.id" @select="$emit('select', $event)"></tree>
      {{ tree.children }}
    </div>
  </div>
</template>
<script>
export default {
  props: {
    tree: { required: true }
  },
  components: {
    'tree': this
  },
  methods: {

    handlerSelect() {
      this.$emit("select", this.tree);
    }
  },

  mounted(){
    console.log("mounted tree");
  }

}
</script>
 No newline at end of file
+103 −0
Original line number Diff line number Diff line
<template>
  <div id="contrattypepcru">
    <h1>Correspondance Type d'activité / Type de contrat PCRU</h1>

    <div class="overlay">
      <div class="overlay-content" v-if="oscartypes.length">
        TYPES OSCAR
        <tree :tree="oscartypes[0]"></tree>
      </div>
    </div>

    <div class="row">
      <div class="col-md-6">
        <h2>Types côté <strong>PCRU</strong></h2>
        <article class="card xs" v-for="t in pcrutypes" :key="t.id" :class="t.activitytype_id != null ? 'active' : 'disabled'">
          <h3><code>[{{ t.id }}]</code>
            <strong>{{ t.label }}</strong>
          </h3>
          <div v-if="t.activitytype_id">
            Associé au activité <strong>{{ t.activitytype_label }}</strong>
          </div>
          <button class="btn xs">
            Associer à un type dans Oscar
          </button>
        </article>
      </div>
    </div>
    HOP {{ url }}
  </div>
</template>
<script>
/******************************************************************************************************************/
/* ! DEVELOPPEUR
Depuis la racine OSCAR :

cd front

Pour compiler en temps réél :
node node_modules/.bin/gulp contratTypePCRUWatch

Pour compiler :
node node_modules/.bin/gulp contratTypePCRU

 */

import AjaxOscar from "./remote/AjaxOscar";
import OscarRemoteData from "./remote/OscarRemoteData";
import Tree from "./ActivityTypeTree";

// test
let oscarRemoteData = new OscarRemoteData();

function flashMessage(){
  // TODO
}



export default {

  components: {
    "ajax-oscar": AjaxOscar,
    "tree": Tree
  },

  props: {
    url: { required: true }
  },

  data(){
    return {
      formData: null,
      remoterState: oscarRemoteData.state,
      configuration: null,
      oscartypes: [],
      pcrutypes: []
    }
  },

  methods:{

    handlerSuccess(success){
      let datas = success.data;
      this.oscartypes = datas.activitytypes;
      this.pcrutypes = datas.pcrucontracttypes;
    },

    fetch(){
      console.log("FETCH()");
      oscarRemoteData
          .setDebug(true)
          .setPendingMessage("Chargement des types de contrat")
          .setErrorMessage("Impossible de charger la configuration")
          .performGet(this.url, this.handlerSuccess);
    }
  },

  mounted(){
    this.fetch();
  }

}
</script>
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ return array(
                        'connectorExecute',
                        'connectorsHome',
                        'connectorConfigure',
                        'contratTypePcru',
                        'discipline', // OK
                        'documentSections',
                        'index',
@@ -218,6 +219,8 @@ return array(
                ['controller' => 'Api',
                    'action' => [
                        'activity',
                        'activityType',
                        'activityTypePcru',
                        'help',
                        'organization',
                        'organizations',
+23 −1
Original line number Diff line number Diff line
@@ -106,6 +106,20 @@ api:
                defaults:
                    action: activity

        typeactivity:
            type: segment
            options:
                route: /activity-type
                defaults:
                    action: activityType

        typeactivitypcru:
            type: segment
            options:
                route: /activity-type-pcru
                defaults:
                    action: activityTypePcru

################################################################################
# NOTIFICATIONS
notification:
@@ -1598,7 +1612,15 @@ administration:
            options:
                route: /documents-sections
                defaults:
                    action: documentSections
                    action: documentSection

        contrat-type-pcru:
            type: segment
            may_terminate: true
            options:
                route: /contrat-type-pcru
                defaults:
                    action: contratTypePcru

        testconfig:
            type: segment
Loading