SimulateurStepFormation.vue 2.03 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<template>
  <div id="SimulateurStepFormation">
    <div class="row">
      <div class="col-md-12">
        <h4>Formation</h4>
      </div>
    </div>
    <div class="row">
      <div class="col-md-12">
        <label for="id_formation">Identifiant de formation intercarif</label>
        <input v-model="id_formation" v-on:keydown="formationNotExists=null; $parent.formation.numero=null" id="id_formation" type="text" value="" placeholder="identifiant intercarif" class="form-control" /><br>
        <button class="btn main-button mr-5" v-on:click="searchCatalogue()">Chercher</button>
        <strong v-if="formationNotExists===false">{{ intitule_formation }}</strong>
        <span v-if="formationNotExists===true" style="color:red">Aucune formation trouvée pour l'identifiant renseigné</span><br>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
21 22
		name: 'SimulateurStepFormation',
    props:["id_formation"],
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
    data: function () {
      return {
        formationNotExists: null,
        intitule_formation : null,
      }
    },
    methods : {
			searchCatalogue: function () {
        this.$http.get('/explore/catalog?id='+this.id_formation).then(response => {
          this.$parent.formation.numero = response.body.uid;
          this.intitule_formation  = response.status != 200 ? null:response.body.intitule;
          if(response.status != 200) {
            this.$parent.financement__accessible_salarie_formation = null
          } else {
            for(var i=0; i<response.body.sessions.length; i++) {
              var session = response.body.sessions[i]
              for (var j=0; j<session.financeurs.length; j++) {
                this.$parent.financement__accessible_salarie_formation = (session.financeurs[j].code == 0 || session.financeurs[j].code == 5 || session.financeurs[j].code == 10)
              }
            }
          }
          this.formationNotExists = response.status != 200;
        }, (response) => {
          this.formationNotExists = response.status != 200;
        }).created;
48
      },
49 50 51
    }
  }
</script>