Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/sitn/infolica into parcel…
Browse files Browse the repository at this point in the history
…Histo
  • Loading branch information
rufener committed Aug 18, 2023
2 parents 8f9d5b6 + b95403b commit 09eeefa
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 56 deletions.
3 changes: 2 additions & 1 deletion back/development.ini.template
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ affaire_type_cadastration_id = 2
affaire_type_ppe_id = 3
affaire_type_revision_abornement_id = 4
affaire_type_mpd_id = 8
affaire_remaniement_parcellaire_id = 9
affaire_type_remaniement_parcellaire_id = 9
affaire_type_retablissement_pfp3_id = 12
affaire_type_autre_id = 7
affaire_type_part_copropriete_id = 10
affaire_type_modification_ppe_id = 20
affaire_type_retour_etat_juridique_id = 21
affaire_type_modification_ordre_separation = 100

# ID Numéros-types biens-fonds
Expand Down
4 changes: 2 additions & 2 deletions back/infolica/scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,8 @@ def affaireUpdatePermission(cls, request, affaire_type):
# Affaire autre
elif affaire_type == request.registry.settings['affaire_type_autre_id']:
permission = request.registry.settings['affaire_autre_edition']
# Affaire affaire_remaniement_parcellaire_id
elif affaire_type == request.registry.settings['affaire_remaniement_parcellaire_id']:
# Affaire affaire_type_remaniement_parcellaire_id
elif affaire_type == request.registry.settings['affaire_type_remaniement_parcellaire_id']:
permission = request.registry.settings['affaire_remaniement_parcellaire_edition']

return permission
Expand Down
2 changes: 1 addition & 1 deletion back/infolica/views/affaire.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def affaire_cockpit_view(request):
etape_datetime = datetime.strftime(affaire.etape_datetime, '%Y-%m-%d %H:%M:%S')
etape_days_elapsed = (datetime.now().date() - affaire.etape_datetime.date()).days
etape_days_elapsed_text = "aujourd'hui" if etape_days_elapsed == 0 else ("hier" if etape_days_elapsed == 1 else str(etape_days_elapsed) + " jours")
title = affaire.technicien_initiales + " — Affaire " + str(affaire.id) + " — " + affaire.cadastre + " — " + affaire.nom + " — Dans cette étape depuis " + etape_days_elapsed_text
title = affaire.technicien_initiales + " — Affaire " + str(affaire.id) + " — " + affaire.cadastre + " — " + (affaire.nom if affaire.nom is not None else "~ Aucune description ~") + " — Dans cette étape depuis " + etape_days_elapsed_text

nb_preavis = request.dbsession.query(func.count(Preavis.affaire_id)).filter(Preavis.affaire_id == affaire.id).scalar()
nb_closed_preavis = request.dbsession.query(func.count(Preavis.affaire_id)).filter(Preavis.affaire_id == affaire.id, Preavis.date_reponse != None).scalar()
Expand Down
3 changes: 2 additions & 1 deletion back/production.ini.template
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ affaire_type_cadastration_id = 2
affaire_type_ppe_id = 3
affaire_type_revision_abornement_id = 4
affaire_type_mpd_id = 8
affaire_remaniement_parcellaire_id = 9
affaire_type_remaniement_parcellaire_id = 9
affaire_type_retablissement_pfp3_id = 12
affaire_type_autre_id = 7
affaire_type_part_copropriete_id = 10
affaire_type_modification_ppe_id = 20
affaire_type_retour_etat_juridique_id = 21
affaire_type_modification_ordre_separation = 100

# ID Numéros-types biens-fonds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,14 @@ export default {
});
},
/**
* open create contact
*/
openCreateContact(client_id) {
let routeData = this.$router.resolve({name: "ClientsEdit", params: {id: client_id}});
window.open(routeData.href, "_blank");
},
},
mounted: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
md-dense>
<label>Personne de contact</label>
<template slot="md-autocomplete-empty" slot-scope="{ term }">
Le contact "{{ term }}" n'existe pas dans la base. <a @click="openCreateContact(form.client_commande.id)">Le créer !</a>
Le contact "{{ term }}" n'existe pas dans la base. <a @click="openCreateContact(form.client_commande_id)">Le créer !</a>
</template>
</md-autocomplete>
</div>
Expand Down Expand Up @@ -192,7 +192,7 @@
md-dense>
<label>À l'attention de...</label>
<template slot="md-autocomplete-empty" slot-scope="{ term }">
Le contact "{{ term }}" n'existe pas dans la base. <a @click="openCreateContact(form.client_envoi.id)">Le créer !</a>
Le contact "{{ term }}" n'existe pas dans la base. <a @click="openCreateContact(form.client_envoi_id)">Le créer !</a>
</template>
</md-autocomplete>
</div>
Expand Down
15 changes: 8 additions & 7 deletions front/src/components/Affaires/NewAffaire/NewAffaire.vue
Original file line number Diff line number Diff line change
Expand Up @@ -907,22 +907,23 @@ export default {
}
// is facture required?
await this.getAffaireTypeRequirements(selectedType.id)
await this.getAffaireTypeRequirements(selectedType.id);
let client_cadastration_id = Number(process.env.VUE_APP_CLIENT_CADASTRATION_ID);
if (this.form.type.id === this.typesAffaires_conf.cadastration) {
this.showClientsForm = false;
this.form.client_commande_id = process.env.VUE_APP_CLIENT_CADASTRATION_ID;
this.form.client_envoi_id = process.env.VUE_APP_CLIENT_CADASTRATION_ID;
this.form.client_commande_id = client_cadastration_id;
this.form.client_envoi_id = client_cadastration_id;
this.form.client_envoi_complement = null;
this.client_facture_id = process.env.VUE_APP_CLIENT_CADASTRATION_ID;
this.client_facture_id = client_cadastration_id;
this.client_facture_premiere_ligne = null;
this.form.nom = "Cadastration sur ";
} else if (this.form.type.id === this.typesAffaires_conf.mpd) {
this.form.client_commande_id = process.env.VUE_APP_CLIENT_CADASTRATION_ID;
this.form.client_envoi_id = process.env.VUE_APP_CLIENT_CADASTRATION_ID;
this.form.client_commande_id = client_cadastration_id;
this.form.client_envoi_id = client_cadastration_id;
this.form.client_envoi_complement = null;
this.client_facture_premiere_ligne = null;
this.client_facture_id = process.env.VUE_APP_CLIENT_CADASTRATION_ID;
this.client_facture_id = client_cadastration_id;
this.client_facture_premiere_ligne = null;
this.form.nom = "Mise à jour périodique";
} else {
Expand Down
7 changes: 2 additions & 5 deletions front/src/components/Affaires/NewAffaire/newAffaire.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ <h1 style="flex: 1;">Nouvelle affaire</h1>
<ClientSearch id="client_commande"
:client_id="form.client_commande_id"
@update:client_id="client_id => selectedClient(client_id, 'client_commande')"
:initial_client_id="form.client_commande_id"
:permission_createClient="permission.editClientAllowed"
:old_clients="false"
validation_error_msg="Le client qui a commandé l'affaire doit être renseigné ici"
Expand Down Expand Up @@ -264,7 +263,6 @@ <h1 style="flex: 1;">Nouvelle affaire</h1>
<ClientSearch id="client_envoi"
:client_id="form.client_envoi_id"
@update:client_id="client_id => selectedClient(client_id, 'client_envoi')"
:initial_client_id="form.client_envoi_id"
:permission_createClient="permission.editClientAllowed"
:old_clients="false"
validation_error_msg="Le client à qui l'on doit envoyer les documents doit être renseigné ici"
Expand Down Expand Up @@ -299,10 +297,9 @@ <h1 style="flex: 1;">Nouvelle affaire</h1>
</div>

<div class="md-layout-item md-small-size-100 md-size-100">
<ClientSearch id="client_envoi"
:client_id="form.client_facture_id"
<ClientSearch id="client_facture"
:client_id="client_facture_id"
@update:client_id="client_id => selectedClient(client_id, 'client_facture')"
:initial_client_id="form.client_facture_id"
:permission_createClient="permission.editClientAllowed"
:old_clients="false"
validation_error_msg="Le client à qui sera adressée la facture de l'affaire doit être renseigné ici"
Expand Down
2 changes: 1 addition & 1 deletion front/src/components/Affaires/SuiviMandat/SuiviMandat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export default {
for (const elem of fields[x].children) {
if (elem.className === 'md-checkbox-container') {
elem.click();
break
break;
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions front/src/components/Affaires/SuiviMandat/suiviMandat.html
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@
<div class="md-layout md-gutter">
<div class="md-layout-item md-size-30">
<div class="md-subhead">Général</div>
<md-button style="margin-left: 30px; background-color: lightgrey;" class="md-raised md-dense" @click="selectAll('gen_')">Tout cocher</md-button>
<div id="gen_">
<md-button style="margin-left: 30px; background-color: lightgrey;" class="md-raised md-dense" @click="selectAll('ctrl_coord-mpd-gen_')">Tout cocher</md-button>
<div id="ctrl_coord-mpd-gen_">
<md-checkbox class="md-primary" v-model="suiviMandat.ap_21">Répertoire de travail (bon endroit, bonne structure)</md-checkbox>
<md-checkbox class="md-primary" v-model="suiviMandat.gen_pdf_travaux">Fichier PDF après MPD figurant les travaux en couleur</md-checkbox>
<md-checkbox class="md-primary" v-model="suiviMandat.gen_scan_croquis">Scan du croquis terrain</md-checkbox>
Expand All @@ -372,8 +372,8 @@

<div class="md-layout-item md-size-30">
<div class="md-subhead">Base de données</div>
<md-button style="margin-left: 30px; background-color: lightgrey;" class="md-raised md-dense" @click="selectAll('geos_')">Tout cocher</md-button>
<div id="geos_">
<md-button style="margin-left: 30px; background-color: lightgrey;" class="md-raised md-dense" @click="selectAll('ctrl_coord-mpd-geos_')">Tout cocher</md-button>
<div id="ctrl_coord-mpd-geos_">
<md-checkbox class="md-primary" v-model="suiviMandat.geos_couleur_pastilles">Toutes les pastilles sont vertes ou grises</md-checkbox>
<md-checkbox class="md-primary" v-model="suiviMandat.geos_couvsol_numerotation_pt_particuliers">Réservation des numéros de points particuliers (660)</md-checkbox>
<md-checkbox class="md-primary" v-model="suiviMandat.geos_couvsol_numerotation_bat">Réservation des numéros de bâtiments</md-checkbox>
Expand All @@ -385,8 +385,8 @@

<div class="md-layout-item md-size-30">
<div class="md-subhead">Normes</div>
<md-button style="margin-left: 30px; background-color: lightgrey;" class="md-raised md-dense" @click="selectAll('normes_')">Tout cocher</md-button>
<div id="normes_">
<md-button style="margin-left: 30px; background-color: lightgrey;" class="md-raised md-dense" @click="selectAll('ctrl_coord-mpd-normes_')">Tout cocher</md-button>
<div id="ctrl_coord-mpd-normes_">
<md-checkbox class="md-primary" v-model="suiviMandat.normes_respect_petits_objects">Les objets du type : balcons, petits bâtiments, petites surfaces de nature respectent les normes (ne pas en saisir trop)</md-checkbox>
<md-checkbox class="md-primary" v-model="suiviMandat.normes_bat_couv_digitalises">Pas de bâtiments ni de couverts digitalisés</md-checkbox>
</div>
Expand Down
6 changes: 3 additions & 3 deletions front/src/components/Login/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ export default {
if (process.env.VUE_APP_SERVICE_MO === response.data.service) {
this.$router.push(this.$route.query.redirect || { name: "Cockpit"});
} else {
this.$router.push(this.$route.query.redirect || { name: "Preavis"});
this.$router.push(this.$route.query.redirect || { name: "Preavis"});
}
} else {
this.showProgess = false;
this.$refs.userpass.value = "";
}
})
//Error
.catch(err => {
.catch(() => {
this.showProgess = false;
handleException(err, this);
this.$root.$emit('ShowError', "Le nom d'utilisateur ou le mot de passe est incorrect")
});
},
Expand Down
47 changes: 28 additions & 19 deletions front/src/components/Utils/ClientSearch/ClientSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export default {
type: Number,
default: null
},
client_id: {
type: Number,
default: null
},
label: {
type: String,
default: 'Client'
Expand Down Expand Up @@ -51,7 +55,6 @@ export default {
return {
client: null,
liste_clients: [],
searchTerm: null
};
},
Expand Down Expand Up @@ -107,6 +110,11 @@ export default {
async getClientById(client_id) {
if (client_id === null) {
this.client = '';
return;
}
this.$http.get(
process.env.VUE_APP_API_URL + process.env.VUE_APP_CLIENT_AGGREGATED_BY_ID_ENDPOINT + '/' + client_id,
{
Expand Down Expand Up @@ -154,31 +162,32 @@ export default {
},
computed: {
value: {
get() {
return this.client_id;
},
set(value) {
if (value && value.id) {
this.client_id = value.id;
this.$emit('update:client_id', value.id);
}
if (value === null || value === '') {
this.client_id = value;
this.$emit('update:client_id', value);
}
}
}
},
mounted: function() {
if (this.initial_client_id !== null) {
this.getClientById(this.initial_client_id);
}
this.$root.$on('resetSearchClientTerm', () => { document.querySelector('#clientSearchAutocomplete > button').click(); });
},
watch: {
client_id: function() {
if (this.client_id !== null) {
this.getClientById(this.client_id);
} else {
this.client = '';
}
},
client: function() {
if (this.client && this.client.id) {
this.$emit('update:client_id', this.client.id);
} else {
this.client_id = null;
this.$emit('update:client_id', null);
}
}
}
};
Expand Down
9 changes: 2 additions & 7 deletions front/src/services/exceptionsHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ export const handleException = function (error, component) {
}
//Not authorized
else if(code === 403){
if(component.$router && component.$router.currentRoute && component.$router.currentRoute.name != 'Login') {
component.$router.push({name: "Login", query: { redirect: component.$router.currentRoute.path }});
component.$root.$emit("ShowError", "Veuillez vous connecter pour continuer");
} else {
component.$root.$emit("ShowError", "Le nom d'utilisateur ou le mot de passe est incorrect");
}
let a = component.$router.push({name: "Login", query: { redirect: component.$router.currentRoute.path }});
a.then(() => { component.$root.$emit("ShowError", "Veuillez vous connecter pour continuer") });
}
//Custom error
else if(error && error.msg){
Expand All @@ -38,4 +34,3 @@ export const handleException = function (error, component) {
component.$root.$emit("ShowError", "Une erreur est survenue, contacter l'administrateur.");
}
};

5 changes: 4 additions & 1 deletion front/src/services/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ export const checkLogged = function () {
var session_user = JSON.parse(localStorage.getItem('infolica_user')) || null;

//Set current user functions
if(session_user)
if(session_user){
setCurrentUserFunctions();
} else {
alert("Veuillez vous connecter pour continuer");
}

return session_user !== null;
};
Expand Down

0 comments on commit 09eeefa

Please sign in to comment.