mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-23 08:03:49 +00:00
Merge branch 'master' into VSR-issues
This commit is contained in:
@@ -164,7 +164,8 @@ export default {
|
||||
id: this.accompanyingCourse.id
|
||||
},
|
||||
edit: false,
|
||||
addressId: null
|
||||
addressId: null,
|
||||
defaults: window.addaddress
|
||||
}
|
||||
if (this.accompanyingCourse.location) {
|
||||
context['edit'] = true;
|
||||
|
@@ -360,7 +360,7 @@ export default {
|
||||
;
|
||||
},
|
||||
buildEditLink(storedObject) {
|
||||
return `/wopi/edit/${storedObject.uuid}?returnPath=` + encodeURIComponent(
|
||||
return `/chill/wopi/edit/${storedObject.uuid}?returnPath=` + encodeURIComponent(
|
||||
window.location.pathname + window.location.search + window.location.hash);
|
||||
},
|
||||
submitBeforeGenerate({template}) {
|
||||
|
@@ -2,6 +2,8 @@ import { createApp } from 'vue';
|
||||
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
|
||||
import { appMessages } from './js/i18n';
|
||||
import { store } from './store';
|
||||
import VueToast from 'vue-toast-notification';
|
||||
import 'vue-toast-notification/dist/theme-sugar.css';
|
||||
|
||||
import App from './App.vue';
|
||||
|
||||
@@ -12,5 +14,11 @@ const app = createApp({
|
||||
})
|
||||
.use(store)
|
||||
.use(i18n)
|
||||
.use(VueToast, {
|
||||
position: "bottom-right",
|
||||
type: "error",
|
||||
duration: 5000,
|
||||
dismissible: true
|
||||
})
|
||||
.component('app', App)
|
||||
.mount('#household_members_editor');
|
||||
|
@@ -5,6 +5,7 @@ import { fetchHouseholdByAddressReference } from 'ChillPersonAssets/lib/househol
|
||||
import { datetimeToISO, dateToISO, ISOToDate } from 'ChillMainAssets/chill/js/date';
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
//console.log('AJAJAJA', window.addaddress);
|
||||
|
||||
const concerned = window.household_members_editor_data.persons.map(p => {
|
||||
return {
|
||||
@@ -115,6 +116,7 @@ const store = createStore({
|
||||
name: state.household.type,
|
||||
id: state.household.id
|
||||
},
|
||||
defaults: window.addaddress,
|
||||
suggestions: state.addressesSuggestion
|
||||
};
|
||||
} else {
|
||||
@@ -125,6 +127,7 @@ const store = createStore({
|
||||
name: state.household.type,
|
||||
id: state.household.id
|
||||
},
|
||||
defaults: window.addaddress,
|
||||
};
|
||||
}
|
||||
},
|
||||
|
@@ -1,3 +1,5 @@
|
||||
import {makeFetch} from 'ChillMainAssets/lib/api/apiMethods';
|
||||
|
||||
/*
|
||||
* GET a person by id
|
||||
*/
|
||||
@@ -22,6 +24,8 @@ const getCivilities = () =>
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
|
||||
const getCentersForPersonCreation = () => makeFetch('GET', '/api/1.0/person/creation/authorized-centers', null);
|
||||
|
||||
/*
|
||||
* POST a new person
|
||||
*/
|
||||
@@ -59,6 +63,7 @@ const patchPerson = (id, body) => {
|
||||
};
|
||||
|
||||
export {
|
||||
getCentersForPersonCreation,
|
||||
getPerson,
|
||||
getPersonAltNames,
|
||||
getCivilities,
|
||||
|
@@ -87,6 +87,18 @@
|
||||
<label>{{ $t('person.gender.title') }}</label>
|
||||
</div>
|
||||
|
||||
<div class="form-floating mb-3" v-if="showCenters && config.centers.length > 1">
|
||||
<select
|
||||
class="form-select form-select-lg"
|
||||
id="center"
|
||||
v-model="center"
|
||||
>
|
||||
<option selected disabled>{{ $t('person.center.placeholder') }}</option>
|
||||
<option v-for="c in config.centers" :value="c" :key="c.id" >{{ c.name }}</option>
|
||||
</select>
|
||||
<label>{{ $t('person.center.title') }}</label>
|
||||
</div>
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
<select
|
||||
class="form-select form-select-lg"
|
||||
@@ -166,7 +178,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCivilities, getPerson, getPersonAltNames } from '../../_api/OnTheFly';
|
||||
import { getCentersForPersonCreation, getCivilities, getPerson, getPersonAltNames } from '../../_api/OnTheFly';
|
||||
import PersonRenderBox from '../Entity/PersonRenderBox.vue';
|
||||
import AddAddress from "ChillMainAssets/vuejs/Address/components/AddAddress.vue";
|
||||
|
||||
@@ -182,13 +194,18 @@ export default {
|
||||
return {
|
||||
person: {
|
||||
type: 'person',
|
||||
lastName: '',
|
||||
firstName: '',
|
||||
altNames: [],
|
||||
addressId: null
|
||||
addressId: null,
|
||||
center: null,
|
||||
},
|
||||
config: {
|
||||
altNames: [],
|
||||
civilities: []
|
||||
civilities: [],
|
||||
centers: [],
|
||||
},
|
||||
showCenters: false, // NOTE: must remains false if the form is not in create mode
|
||||
showAddressFormValue: false,
|
||||
addAddress: {
|
||||
options: {
|
||||
@@ -201,7 +218,8 @@ export default {
|
||||
context: {
|
||||
target: {}, // boilerplate for getting the address id
|
||||
edit: false,
|
||||
addressId: null
|
||||
addressId: null,
|
||||
defaults: window.addaddress
|
||||
}
|
||||
},
|
||||
errors: []
|
||||
@@ -254,6 +272,19 @@ export default {
|
||||
set(value) { this.showAddressFormValue = value; },
|
||||
get() { return this.showAddressFormValue; }
|
||||
},
|
||||
center: {
|
||||
set(value) {
|
||||
console.log('will set center', value);
|
||||
this.person.center = {id: value.id, type: value.type};
|
||||
},
|
||||
get() {
|
||||
const center = this.config.centers.find(c => this.person.center !== null && this.person.center.id === c.id);
|
||||
|
||||
console.log('center get', center);
|
||||
|
||||
return typeof center === 'undefined' ? null : center;
|
||||
},
|
||||
},
|
||||
genderClass() {
|
||||
switch (this.person.gender) {
|
||||
case 'woman':
|
||||
@@ -295,23 +326,36 @@ export default {
|
||||
this.config.civilities = civilities.results;
|
||||
}
|
||||
});
|
||||
|
||||
if (this.action !== 'create') {
|
||||
this.loadData();
|
||||
} else {
|
||||
console.log('show centers', this.showCenters);
|
||||
getCentersForPersonCreation()
|
||||
.then(params => {
|
||||
this.config.centers = params.centers;
|
||||
this.showCenters = params.showCenters;
|
||||
console.log('show centers inside', this.showCenters);
|
||||
if (this.showCenters && this.config.centers.length === 1) {
|
||||
this.person.center = this.config.centers[0];
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkErrors(e) {
|
||||
this.errors = [];
|
||||
if (!this.person.lastName) {
|
||||
if (this.person.lastName === "") {
|
||||
this.errors.push("Le nom ne doit pas être vide.");
|
||||
}
|
||||
if (!this.person.firstName) {
|
||||
if (this.person.firstName === "") {
|
||||
this.errors.push("Le prénom ne doit pas être vide.");
|
||||
}
|
||||
if (!this.person.gender) {
|
||||
this.errors.push("Le genre doit être renseigné");
|
||||
}
|
||||
if (this.showCenters && this.person.center === null) {
|
||||
this.errors.push("Le centre doit être renseigné");
|
||||
}
|
||||
},
|
||||
loadData() {
|
||||
getPerson(this.id)
|
||||
|
@@ -47,6 +47,10 @@ const personMessages = {
|
||||
create_address: "Ajouter une adresse",
|
||||
show_address_form: "Ajouter une adresse pour un usager non suivi et seul dans un ménage",
|
||||
warning: "Un nouveau ménage va être créé. L'usager sera membre de ce ménage."
|
||||
},
|
||||
center: {
|
||||
placeholder: "Choisissez un centre",
|
||||
title: "Centre",
|
||||
}
|
||||
},
|
||||
error_only_one_person: "Une seule personne peut être sélectionnée !"
|
||||
|
@@ -1,9 +1,5 @@
|
||||
{% extends "@ChillMain/layoutWithVerticalMenu.html.twig" %}
|
||||
|
||||
{% block head_custom %}
|
||||
<link rel="preload" href="{{ preload(path('chill_api_single_accompanying_course__entity', {'id': accompanyingCourse.id, '_format': 'json' }), {as: 'fetch'}) }}" as="fetch" />
|
||||
{% endblock %}
|
||||
|
||||
{% block top_banner %}
|
||||
{{ include('@ChillPerson/AccompanyingCourse/banner.html.twig', { title: block('title') }) }}
|
||||
{% endblock %}
|
||||
|
@@ -8,15 +8,19 @@
|
||||
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
||||
|
||||
{% block crud_content_form_rows %}
|
||||
{% for f in form %}
|
||||
{% if f.vars.name == 'parent' %}
|
||||
{{ form_row(f, { 'attr':{'disabled':'disabled'}}) }}
|
||||
{% else %}
|
||||
{{ form_row(f) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ form_row(form.title) }}
|
||||
<div class="mb-3 row">
|
||||
<label class="col-form-label col-sm-4">
|
||||
{{ 'Parent'|trans }}
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
{{ entity.parent|chill_entity_render_box }}
|
||||
</div>
|
||||
</div>
|
||||
{{ form_row(form.ordering) }}
|
||||
{{ form_row(form.desactivationDate) }}
|
||||
{% endblock crud_content_form_rows %}
|
||||
|
||||
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock admin_content %}
|
||||
{% endblock admin_content %}
|
||||
|
@@ -1,19 +1,16 @@
|
||||
<div class="flex-table accompanying-course-work">
|
||||
{% include '@ChillPerson/AccompanyingCourseWork/_item.html.twig' with {
|
||||
'w': work,
|
||||
'displayAction': false,
|
||||
'displayContent': 'short',
|
||||
'itemBlocClass': 'uniq colored'
|
||||
} %}
|
||||
</div>
|
||||
|
||||
{% if display_action is defined and display_action == true %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a class="btn btn-update"
|
||||
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': work.id }) }}">
|
||||
{{ 'Edit'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if work is null %}
|
||||
<div class="alert alert-warning">
|
||||
{{ 'workflow.SocialAction deleted'|trans }}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if display_action is defined and display_action == true %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a class="btn btn-update"
|
||||
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': work.id }) }}">
|
||||
{{ 'Edit'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
Reference in New Issue
Block a user