Commit 00ca3138 authored by David Foucher's avatar David Foucher

Merge branch 'fix-sonarQube-bugs' into 'master'

Fix sonar qube bugs

See merge request !77
parents 46329101 70dfca7a
Pipeline #3649 passed with stage
in 2 minutes and 1 second
......@@ -13,18 +13,10 @@
<div id="financement-create-financement" class="col-md-6 col-sm-12 col-xs-12 my-auto">
<div class="form-inline pull-right">
<div class="form-group mx-sm-3 mb-2">
<!--<input type="button" href="#" class="btn main-button form-control" value="Créer un financement" disabled />-->
</div>
</div>
</div>
</div>
<!--
<div class="row">
<div id="financement-last-update" class="col-md-12">
Dernière mise à jour le __ à __
</div>
</div>
-->
</div>
</div>
<hr class="financement-horizontal-separator">
......@@ -83,13 +75,6 @@
</span>
</span>
</span>
<!--
<span class="col-md-1 col-sm-1 pull-right">
<button href="https://git.beta.pole-emploi.fr/open-source/trefle/edit/master/trefle/config/financements.yml" target="_blank" class="text-dark btn btn-outline-light" disabled>
<i class="icon" style="vertical-align: baseline;">edit</i>
</button>
</span>
-->
</li>
</ul>
</div>
......@@ -143,8 +128,7 @@
this.financements = response.body;
this.filteredFinancements = response.body;
this.isLoading = false;
})
.created;
});
},
setSearchTag: function (tag) {
this.search = tag;
......@@ -160,7 +144,7 @@
isCaseSensitive ? searchRegExp = new RegExp(searchWithoutAccents,"g") : searchRegExp = new RegExp(searchWithoutAccents,'ig')
return searchType != "input" ? this.filterable("", financement.tags).match(searchRegExp) : this.filterable(financement.intitule, financement.tags).match(searchRegExp)
}
return true
return true;
})
},
filterable: function (intitule,tags) {
......
......@@ -43,8 +43,7 @@
this.resultsIsEmpty = this.isEmpty(this.results);
}, () => {
this.resultsIsEmpty = this.isEmpty(this.results);
})
.created;
});
},
isEmpty: function (obj) {
for(var key in obj) {
......
......@@ -43,8 +43,7 @@
.then(response => {
this.results = response.body;
this.resultsIsEmpty = this.isEmpty(this.results);
})
.created;
});
},
isEmpty: function (obj) {
for(var key in obj) {
......
......@@ -44,8 +44,7 @@
.then(response => {
this.results = response.body;
this.resultsIsEmpty = this.isEmpty(this.results);
})
.created;
});
},
isEmpty: function (obj) {
for(var key in obj) {
......
......@@ -43,8 +43,7 @@
.then(response => {
this.results = response.body;
this.resultsIsEmpty = this.isEmpty(this.results);
})
.created;
});
},
isEmpty: function (obj) {
for(var key in obj) {
......
......@@ -133,8 +133,7 @@
.then(response => {
this.rules = response.body;
this.isLoading = false;
})
.created;
});
},
forceRerender: function () {
this.rerenderKey +=1;
......
......@@ -279,7 +279,7 @@
email: '',
password: '',
file: this.path
},
};
this.isEditMode=false;
if(this.modification_count!=0) this.viewModification = true;
this.error_flags = {
......
<template>
<div id="Simulateur">
<div class="container form-group pt-5">
<div class="container form-group pt-5 pb-3">
<div v-if="!resultats">
<div class="row">
<div class="col-md-12">
......@@ -10,7 +10,7 @@
<hr class="simulateur-horizontal-separator">
<!---------------- STEP FORMATION ---------------->
<div class="formation-step step" :class="{step_completed_class: formation_step_completed}">
<SimulateurStepFormation :id_formation="formation.numero"/>
<SimulateurStepFormation :id_formation_parent="formation.numero"/>
</div>
<hr v-if="formation_step_completed" class="simulateur-horizontal-separator">
<!---------------- STEP ONE ---------------->
......@@ -35,7 +35,7 @@
<hr v-if="step_four_completed" class="simulateur-horizontal-separator">
<!---------------- STEP FIVE ---------------->
<div v-if="step_four_completed" class="form-step step-five" :class="{step_completed_class: step_five_completed}">
<SimulateurStepFive id="SimulateurStepFive"/>
<SimulateurStepFive id="SimulateurStepFive" :id_naf_parent="naf" :id_idcc_parent="idcc"/>
</div>
<!---------------- STEP FIVE ---------------->
<div v-if="step_five_completed" class="form-step">
......@@ -282,7 +282,7 @@
a_travaille_six_mois: this.situation_6moissur12,
a_travaille_douze_mois: this.situation_6moissur12,
entreprise : {
naf: this.naf.match(/^\d{2}\.?\d{2}[a-zA-Z]$/gi) == null ? null : this.naf.match(/^\d{2}\.?\d{2}[a-zA-Z]$/gi),
naf: this.naf.match(/^\d{2}\.?\d{2}[a-zA-Z]$/gi) == null ? null : this.naf.match(/^\d{2}\.?\d{2}[a-zA-Z]$/gi).pop(),
idcc: this.idcc,
commune: this.commune_entreprise,
opco: null,
......@@ -306,24 +306,28 @@
})
},
simulateFromUrl: function() {
if(window.location.hash.substr(1).match(/^simulate/))
var simulate_link = window.location.hash.substr(9)
if(simulate_link.includes('labonneformation'))
if(window.location.hash.substr(1).match(/^simulate/)) {
var simulate_link = window.location.hash.substr(9);
if(simulate_link != undefined && simulate_link != null) {
if(simulate_link.includes('labonneformation')) {
this.$http.get('/explore/decode-lbf-url?url='+simulate_link)
.then(response => {
this.context = response.body
this.$http.get('/explore/catalog?id='+this.context['formation.numero']).then(response => {
if(response.status == 200) {
this.$http.get('/explore/catalog?id='+this.context['formation.numero']).then(response_catalog => {
if(response_catalog.status == 200) {
this.simulate()
}
})
})
});
}
}
}
},
prepareRequest: function() {
if (this.situation_inscrit == 1) {
if (this.allocation_type == 'non') {
this.allocation_type = null;
this.allocation_dateend = null;
this.allocation_type = "";
this.allocation_dateend = "";
}
this.salaire = null;
this.moistravailleencdd = null;
......@@ -335,8 +339,8 @@
this.commune_entreprise_autocomplete = '';
} else if (this.situation_inscrit == 2) {
this.allocation_type = null;
this.allocation_dateend = null;
this.allocation_type = "";
this.allocation_dateend = "";
this.situation_inscritcumuldureeinscriptionsur12mois = null;
this.allocation_cost = null;
this.commune_beneficiaire_autocomplete = '';
......@@ -386,7 +390,7 @@
this.scenario = response.body.scenario;
this.context = response.body.context;
this.isLoading = false;
}).created
});
this.resultats = true;
},
objectIsEmpty: function (obj) {
......
......@@ -9,16 +9,16 @@
<br>
<input class="form-control" type="text" id="filterContext" name="filterContext" v-model="filterContext" placeholder="Filtre..."/>
<br>
<table class="table-responsive table table-striped table-hover">
<table class="table-responsive table table-hover">
<caption> Contexte de simulation </caption>
<thead>
<tr>
<th>Nom</th>
<th>Valeur</th>
<th id="context_keys">Nom</th>
<th id="context_values">Valeur</th>
</tr>
</thead>
<tbody>
<tr v-for="(value, key) in this.filteredContext" :key="key">
<tr v-for="(value, key) in this.filteredContext" :key="key" :class="{'non_specifiee':!(value != null && value != '')}">
<td> {{ renderLabel(key) }} </td>
<td> {{ renderValue(key,value,schema[key]) }} </td>
</tr>
......@@ -38,14 +38,26 @@
methods: {
renderValue: function (key, value, schema_tmp) {
schema_tmp = schema_tmp || this.schema[key]
if (schema_tmp['type'] === 'array') return value.map(v => this.renderValue(key, v, schema_tmp['items'])).join(', ')
if (schema_tmp['type'] === "boolean") return value ? 'oui' : 'non'
if (schema_tmp['format'] === 'date') return (new Date(value * 1000)).toLocaleDateString()
if (schema_tmp['enum']) return schema_tmp === undefined ? schema_tmp['enum'][value]+' ('+value+')' : ''
return value
if(value != null && value != "") {
if (schema_tmp['type'] === 'string' || schema_tmp['type'] === 'integer') return value;
if (schema_tmp['type'] === 'array') return value.map(v => this.renderValue(key, v, schema_tmp['items'])).join(', ');
if (schema_tmp['type'] === "boolean") return value ? 'oui' : 'non';
if (schema_tmp['format'] === 'date') {
if(key == "beneficiaire.naissance") {
if (value != null && value != undefined) {
var dateParts = value.split("/");
return (new Date(+dateParts[2], dateParts[1]-1, +dateParts[0])).toLocaleDateString("fr");
} else return "Non spécifiée";
}
if(value != null && value != "") return (new Date(value * 1000)).toLocaleDateString("fr");
else return "Non spécifiée";
}
if (schema_tmp['enum']) return schema_tmp == undefined ? schema_tmp['enum'][value]+' ('+value+')' : '';
return value;
} else return "Non spécifiée";
},
renderLabel: function (key) {
return this.schema[key]['label'].charAt(0).toUpperCase() + this.schema[key]['label'].slice(1)
return this.schema[key]['label'].charAt(0).toUpperCase() + this.schema[key]['label'].slice(1);
},
},
computed: {
......@@ -75,4 +87,9 @@
width:100%;
table-layout:fixed;
}
.non_specifiee {
background-color: #ececec;
color: #b9b9b9;
}
</style>
......@@ -16,30 +16,31 @@
<ul>
<li v-for="(financement, financement_id) in this.financements" :key="financement_id" class="result" :class="{hide:showFinancement(financement)}">
<br>
<h5 :class="{passed: financement.eligible, failed: !financement.eligible}" data-toggle="collapse" :data-target="'#details_'+financement_id" aria-expanded="false" aria-controls="explain" style="cursor:pointer;" >{{ financement.intitule }}
<h5 :class="{passed: financement.eligible, failed: !financement.eligible}" data-toggle="collapse" :data-target="'#details_'+financement_id" aria-expanded="false" aria-controls="explain" style="cursor:pointer;" >
{{ financement.intitule }}
<div class="pull-right">
<label v-for="(tag, tag_id) in financement.tags" :key="tag_id" class="label">{{ tag }}</label>
</div>
</h5>
<div :id="'details_'+financement_id" class="collapse">
<p><strong>Description</strong> {{ financement.description }}</p>
<p><strong>Démarches</strong> {{ financement.demarches }}</p>
<p v-if="financement.description"><strong>Description :</strong> {{ financement.description }}</p>
<p v-if="financement.demarches"><strong>Démarches :</strong> {{ financement.demarches }}</p>
<div v-if="financement.eligible">
<p><strong>Prise en charge</strong> {{ financement.prise_en_charge }}</p>
<p v-if="financement.prise_en_charge_texte"><strong>Prise en charge</strong> {{ financement.prise_en_charge_texte }}</p>
<p><strong>Plafond de prise en charge</strong> {{ financement.plafond_prise_en_charge }}</p>
<p><strong>Plafond de prix horaire</strong> {{ financement.plafond_prix_horaire }}</p>
<p><strong>Nombre d'heures prises en charge</strong> {{ financement.heures }}</p>
<p><strong>Rémunération</strong> {{ financement.remuneration }}</p>
<p v-if="financement.remuneration_texte"><strong>Rémunération</strong> {{ financement.remuneration_texte }}</p>
<p v-if="financement.fin_remuneration"><strong>Fin de la rémunération</strong> {{ renderValue('financement.fin_remuneration', financement.fin_remuneration,schema) }}</p>
<p v-if="financement.rff"><strong>RFF</strong> {{ financement.rff }}</p>
<p v-if="financement.debut_rff"><strong>Début de la RFF</strong> {{ renderValue('financement.debut_rff', financement.debut_rff,schema) }}</p>
<p v-if="financement.fin_rff"><strong>Fin de la RFF</strong> {{ renderValue('financement.fin_rff', financement.fin_rff,schema) }}</p>
<p v-if="financement.organisme"><strong>Organisme</strong> {{ financement.organisme.nom }}</p>
<p v-if="financement.prise_en_charge"><strong>Prise en charge :</strong> {{ financement.prise_en_charge }}</p>
<p v-if="financement.prise_en_charge_texte"><strong>Prise en charge :</strong> {{ financement.prise_en_charge_texte }}</p>
<p v-if="financement.plafond_prise_en_charge"><strong>Plafond de prise en charge :</strong> {{ financement.plafond_prise_en_charge }}</p>
<p v-if="financement.plafond_prix_horaire"><strong>Plafond de prix horaire :</strong> {{ financement.plafond_prix_horaire }}</p>
<p v-if="financement.heures"><strong>Nombre d'heures prises en charge :</strong> {{ financement.heures }}</p>
<p v-if="financement.remuneration"><strong>Rémunération :</strong> {{ financement.remuneration }}</p>
<p v-if="financement.remuneration_texte"><strong>Rémunération :</strong> {{ financement.remuneration_texte }}</p>
<p v-if="financement.fin_remuneration"><strong>Fin de la rémunération :</strong> {{ renderValue('financement.fin_remuneration', financement.fin_remuneration,schema) }}</p>
<p v-if="financement.rff"><strong>RFF :</strong> {{ financement.rff }}</p>
<p v-if="financement.debut_rff"><strong>Début de la RFF :</strong> {{ renderValue('financement.debut_rff', financement.debut_rff,schema) }}</p>
<p v-if="financement.fin_rff"><strong>Fin de la RFF :</strong> {{ renderValue('financement.fin_rff', financement.fin_rff,schema) }}</p>
<p v-if="financement.organisme"><strong>Organisme :</strong> {{ financement.organisme.nom }}</p>
</div>
<p>
<strong>Règles de gestion</strong><br><br>
<strong>Règles de gestion :</strong><br><br>
<eligibilite :conditions="financement.explain" :schema="schema"/>
</p>
</div>
......@@ -116,8 +117,8 @@
schema_tmp = schema_tmp || this.schema[key]
if (schema_tmp['type'] === 'array') return value.map(v => this.renderValue(key, v, schema_tmp['items'])).join(', ')
if (schema_tmp['type'] === "boolean") return value ? 'oui' : 'non'
if (schema_tmp['format'] === 'date') return (new Date(value * 1000)).toLocaleDateString()
if (schema_tmp['enum']) return schema_tmp === undefined ? schema_tmp['enum'][value]+' ('+value+')' : ''
if (schema_tmp['format'] === 'date' && value != null && value != "") return (new Date(value * 1000)).toLocaleDateString("fr")
if (schema_tmp['enum']) return schema_tmp == undefined ? schema_tmp['enum'][value]+' ('+value+')' : ''
return value
},
renderLabel: function (key) {
......
......@@ -94,28 +94,27 @@
<hr class="simulateur-horizontal-separator">
</div>
</div>
<div id="explainCollapseGroup">
<div id="explainCollapseGroup" class="container">
<div class="row" id="explainButtonsGroup">
<div class="col-md-4">
<span class="ml-5" data-toggle="collapse" data-target="#scenario" aria-expanded="false" aria-controls="scenario" style="cursor:pointer;" v-on:click="scenarioToggled=!scenarioToggled">
<span class="ml-5" data-toggle="collapse" data-target="#scenario" aria-expanded="false" aria-controls="scenario" style="cursor:pointer;" v-on:click="toggle('scenario');">
<button v-if="!scenarioToggled" class="btn main-button-primary">Voir le scénario de simulation</button>
<button v-else class="btn main-button-primary">Masquer le scénario de simulation</button>
<button v-else class="btn main-button">Masquer le scénario de simulation</button>
</span>
</div>
<div class="col-md-4">
<span class="ml-5" data-toggle="collapse" data-target="#context" aria-expanded="false" aria-controls="context" style="cursor:pointer;" v-on:click="contextToggled=!contextToggled">
<span class="ml-5" data-toggle="collapse" data-target="#context" aria-expanded="false" aria-controls="context" style="cursor:pointer;" v-on:click="toggle('context');">
<button v-if="!contextToggled" class="btn main-button-primary">Voir le contexte de simulation</button>
<button v-else class="btn main-button-primary">Masquer le contexte de simulation</button>
<button v-else class="btn main-button">Masquer le contexte de simulation</button>
</span>
</div>
<div class="col-md-4">
<span class="ml-5" data-toggle="collapse" data-target="#explain" aria-expanded="false" aria-controls="explain" style="cursor:pointer;" v-on:click="explainToggled=!explainToggled">
<span class="ml-5" data-toggle="collapse" data-target="#explain" aria-expanded="false" aria-controls="explain" style="cursor:pointer;" v-on:click="toggle('explain');">
<button v-if="!explainToggled" class="btn main-button-primary">Voir l'explication de simulation</button>
<button v-else class="btn main-button-primary">Masquer l'explication de simulation</button>
<button v-else class="btn main-button">Masquer l'explication de simulation</button>
</span>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<div id="scenario" data-parent="#explainCollapseGroup" class="collapse">
......@@ -139,7 +138,6 @@
</div>
</div>
</div>
</div>
</template>
<script>
......@@ -170,6 +168,24 @@
this.$parent.resultats = false;
this.$parent.financements_eligibles = [];
this.$parent.formation.numero = this.id_formation;
if(this.$parent.allocation_type == "") this.$parent.allocation_type="non";
},
toggle: function (toggle_source) {
console.log(toggle_source);
if (toggle_source == "scenario") {
this.scenarioToggled = !this.scenarioToggled;
this.contextToggled = false;
this.explainToggled = false;
} else if (toggle_source == "context") {
this.scenarioToggled = false;
this.contextToggled = !this.contextToggled;
this.explainToggled = false;
} else if (toggle_source == "explain") {
this.scenarioToggled = false;
this.contextToggled = false;
this.explainToggled = !this.explainToggled;
}
}
}
......
......@@ -102,13 +102,13 @@
<script>
export default {
name: 'SimulateurStepFive',
props:[],
props:["id_naf_parent", "id_idcc_parent"],
data: function () {
return {
id_naf: null,
id_naf: this.id_naf_parent,
nafNotExists: null,
intitule_naf: null,
id_idcc: null,
id_idcc: this.id_idcc_parent,
idccNotExists: null,
intitule_idcc: null,
}
......@@ -128,7 +128,7 @@
this.nafNotExists = this.objectIsEmpty(response.body);
}, (response) => {
this.nafNotExists = this.objectIsEmpty(response.body);
}).created;
});
},
searchIDCC: function () {
this.$http.get('/idcc?q='+this.id_idcc).then(response => {
......@@ -137,7 +137,7 @@
this.idccNotExists = this.objectIsEmpty(response.body);
}, (response) => {
this.idccNotExists = this.objectIsEmpty(response.body);
}).created;
});
},
objectIsEmpty: function (obj) {
for(var key in obj) {
......
......@@ -8,7 +8,7 @@
<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>
<input v-model="numero_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>
......@@ -19,16 +19,17 @@
<script>
export default {
name: 'SimulateurStepFormation',
props:["id_formation"],
props:["id_formation_parent"],
data: function () {
return {
formationNotExists: null,
intitule_formation : null,
numero_formation: this.id_formation_parent,
}
},
methods : {
searchCatalogue: function () {
this.$http.get('/explore/catalog?id='+this.id_formation).then(response => {
this.$http.get('/explore/catalog?id='+this.numero_formation).then(response => {
this.$parent.formation.numero = response.body.uid;
this.intitule_formation = response.status != 200 ? null:response.body.intitule;
if(response.status != 200) {
......@@ -44,7 +45,7 @@
this.formationNotExists = response.status != 200;
}, (response) => {
this.formationNotExists = response.status != 200;
}).created;
});
},
}
}
......
......@@ -4,4 +4,4 @@ module.exports = {
devServer: {
proxy: 'https://trefle.beta.pole-emploi.fr/0.8/'
}
}
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment