Skip to content

Commit

Permalink
Merge pull request #733 from rufener/bugfix
Browse files Browse the repository at this point in the history
Bugfix and small improvments
  • Loading branch information
rufener authored Jun 12, 2023
2 parents f02c23e + 46c12ce commit 61ed8b9
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 127 deletions.
1 change: 1 addition & 0 deletions back/infolica/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def includeme(config):
config.add_route('loadfile_bf_rp', '/infolica/api/loadfile_bf_rp')
config.add_route('save_bf_rp', '/infolica/api/save_bf_rp')
config.add_route('activer_affaire', '/infolica/api/activer_affaire')
config.add_route('affaire_mpd', '/infolica/api/affaire_mpd')
config.add_route('affaire_cloture', '/infolica/api/affaire_cloture')
#Factures
config.add_route('factures', '/infolica/api/factures')
Expand Down
31 changes: 31 additions & 0 deletions back/infolica/views/affaire.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,37 @@ def affaires_search_view(request):

return results

@view_config(route_name='affaire_mpd', request_method='GET', renderer='json')
def affaire_mpd_view(request):
"""
Search affaire mpd
"""
# Check connected
if not check_connected(request):
raise exc.HTTPForbidden()

cadastre_id = request.params['cadastre_id'] if 'cadastre_id' in request.params else None
plan_no = request.params['plan_no'] if 'plan_no' in request.params else None

affaire_type_mpd_id = request.registry.settings['affaire_type_mpd_id']

affaires = request.dbsession.query(
Affaire
).filter(
Affaire.type_id==affaire_type_mpd_id,
Affaire.cadastre_id==cadastre_id,
Affaire.date_cloture==None
).all()

affaire = None
regexp = r"\b{}\b".format(plan_no)
for aff in affaires:
if re.search(regexp, aff.nom) is not None:
affaire = aff
break

return Utils.serialize_one(affaire)


@view_config(route_name='affaire_dashboard_layout', request_method='POST', renderer='json')
def affaire_dashboard_layout_view(request):
Expand Down
1 change: 1 addition & 0 deletions front/.env
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ VUE_APP_RESERVATION_NUMEROS_ENDPOINT = "/reservation_numeros/"

#Affaires
VUE_APP_AFFAIRES_ENDPOINT = "/affaires/"
VUE_APP_AFFAIRE_MPD_BY_CADPLAN_ENDPOINT = "/affaire_mpd"

#Fonctions / roles
VUE_APP_CURRENT_USERS_FUNCTIONS_ENDPOINT = "/fonctions_roles_current_user"
Expand Down
1 change: 0 additions & 1 deletion front/src/components/Affaires/Affaires.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export default {
etape: null,
limitNbResults: true,
},
searchClientsListe: [],
showProgressBar: false,
types_affaires: []
}),
Expand Down
240 changes: 117 additions & 123 deletions front/src/components/Affaires/InfosGenerales/infosGenerales.html

Large diffs are not rendered by default.

35 changes: 32 additions & 3 deletions front/src/components/Affaires/NewAffaire/NewAffaire.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export default {
urgent_echeance: null,
},
lastRecord: null,
msg_mpd: {
data: null,
show: false
},
numerosReferences: [],
operateurs_list: [],
permission: {
Expand Down Expand Up @@ -837,6 +841,7 @@ export default {
*/
defaultCompleteClients(client_id) {
if (this.form.client_envoi_id === null) {
this.form.client_envoi_id = client_id;
this.client_moral_personnes.envoi = this.client_moral_personnes.commande;
this.$refs.ref_client_envoi.getClientById(client_id);
Expand All @@ -845,6 +850,7 @@ export default {
}, 200);
}
if (this.affaireTypeRequirements.section_facture && this.client_facture_id === null) {
this.form.client_facture_id = client_id;
this.$refs.ref_client_facture.getClientById(client_id);
}
},
Expand Down Expand Up @@ -984,8 +990,8 @@ export default {
if (tmp.date_envoi) {
// L'affaire a bien une date d'envoi
if (!tmp.date_cloture) {
// L'affaire n'est pas clôturée
if (!tmp.date_cloture || tmp.type_id === Number(process.env.VUE_APP_TYPE_AFFAIRE_SERVITUDE)) {
// L'affaire n'est pas clôturée ou l'affaire est clôturée mais est de type servitude
_this.selectedModificationAffaire = response.data;
Expand Down Expand Up @@ -1289,13 +1295,36 @@ export default {
updateAffaireName(val) {
if (this.form.type && this.form.type.id == this.typesAffaires_conf.mpd) {
if (val) {
this.form.nom = "Mise à jour périodique - Plan " + val;
this.form.nom = "Mise à jour périodique - Plan " + val;
this.checkAvailableAffaireMPD(this.form.cadastre.id, val);
} else {
this.form.nom = "Mise à jour périodique";
}
}
},
async checkAvailableAffaireMPD(cadastre_id, plan_no) {
this.$http.get(
process.env.VUE_APP_API_URL + process.env.VUE_APP_AFFAIRE_MPD_BY_CADPLAN_ENDPOINT + '?cadastre_id=' + cadastre_id + '&plan_no=' + plan_no,
{
withCredentials: true,
headers: {Accept: "application/json"}
}
).then(response => {
if (response && response.data) {
this.msg_mpd.data = response.data;
this.msg_mpd.show = true;
this.form.plan = null;
} else {
this.msg_mpd.show = false;
this.msg_mpd.data = null;
}
}).catch(err => this.handleException(err, this));
},
selectedClient(client_id, client_type) {
if (client_type === 'client_facture') {
this[client_type + '_id'] = client_id;
Expand Down
5 changes: 5 additions & 0 deletions front/src/components/Affaires/NewAffaire/newAffaire.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ <h1 style="flex: 1;">Nouvelle affaire</h1>
</md-select>
</md-field>
</div>
<div class="md-layout-item md-size-50">
<p style="color: red" id="mpd_msg" v-if="msg_mpd.show === true">
L'affaire <router-link :to="{ name: 'AffairesDashboard', params: { id: msg_mpd.data.id }}">{{ msg_mpd.data.id }}</router-link> ({{ msg_mpd.data.nom }}) existe déjà et n'est pas encore clôturée.
</p>
</div>
</div>

<!-- Description de l'affaire -->
Expand Down

0 comments on commit 61ed8b9

Please sign in to comment.