mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-23 08:03:49 +00:00
Merge remote-tracking branch 'origin/master' into cire16
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.js';
|
||||
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.ts';
|
||||
|
||||
const fetchHouseholdByAddressReference = async (reference) => {
|
||||
const url = `/api/1.0/person/household/by-address-reference/${reference.id}.json`
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import {createApp} from 'vue';
|
||||
import SetReferrer from 'ChillPersonAssets/vuejs/_components/AccompanyingPeriod/SetReferrer.vue';
|
||||
import {fetchResults} from 'ChillMainAssets/lib/api/apiMethods.js';
|
||||
import {fetchResults} from 'ChillMainAssets/lib/api/apiMethods.ts';
|
||||
|
||||
/**
|
||||
*
|
||||
|
22
src/Bundle/ChillPersonBundle/Resources/public/types.ts
Normal file
22
src/Bundle/ChillPersonBundle/Resources/public/types.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import {Address, Center, Civility, DateTime} from "../../../ChillMainBundle/Resources/public/types";
|
||||
|
||||
export interface Person {
|
||||
id: number;
|
||||
type: "person";
|
||||
text: string;
|
||||
textAge: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
current_household_address: Address | null;
|
||||
birthdate: DateTime | null;
|
||||
deathdate: DateTime | null;
|
||||
age: number;
|
||||
phonenumber: string;
|
||||
mobilenumber: string;
|
||||
email: string;
|
||||
gender: "woman" | "man" | "other";
|
||||
centers: Center[];
|
||||
civility: Civility | null;
|
||||
current_household_id: number;
|
||||
current_residential_addresses: Address[];
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.js';
|
||||
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.ts';
|
||||
|
||||
/*
|
||||
* Endpoint v.2 chill_api_single_accompanying_course__entity
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
import { dateToISO, ISOToDatetime} from 'ChillMainAssets/chill/js/date.js';
|
||||
import { dateToISO, ISOToDatetime} from 'ChillMainAssets/chill/js/date';
|
||||
import { mapState } from 'vuex';
|
||||
|
||||
export default {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import 'es6-promise/auto';
|
||||
import { createStore } from 'vuex';
|
||||
import { fetchScopes } from 'ChillMainAssets/lib/api/apiMethods.js';
|
||||
import { fetchScopes } from 'ChillMainAssets/lib/api/apiMethods.ts';
|
||||
import { getAccompanyingCourse,
|
||||
getReferrersSuggested,
|
||||
getUsers,
|
||||
@@ -8,7 +8,7 @@ import { getAccompanyingCourse,
|
||||
import { patchPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly";
|
||||
import { patchThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly";
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
import { datetimeToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date.js';
|
||||
import { datetimeToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date';
|
||||
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
|
@@ -127,7 +127,7 @@
|
||||
<script>
|
||||
import { mapState, mapActions, mapGetters } from 'vuex';
|
||||
import VueMultiselect from 'vue-multiselect';
|
||||
import { dateToISO, ISOToDate } from 'ChillMainAssets/chill/js/date.js';
|
||||
import { dateToISO, ISOToDate } from 'ChillMainAssets/chill/js/date';
|
||||
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
|
||||
|
||||
const i18n = {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
|
||||
import { createStore } from 'vuex';
|
||||
import { datetimeToISO, dateToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date.js';
|
||||
import { datetimeToISO, dateToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date';
|
||||
import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js';
|
||||
// import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
|
@@ -314,7 +314,7 @@
|
||||
|
||||
<script>
|
||||
import {mapState, mapGetters,} from 'vuex';
|
||||
import {dateToISO, ISOToDate, ISOToDatetime} from 'ChillMainAssets/chill/js/date.js';
|
||||
import {dateToISO, ISOToDate, ISOToDatetime} from 'ChillMainAssets/chill/js/date';
|
||||
import CKEditor from '@ckeditor/ckeditor5-vue';
|
||||
import ClassicEditor from 'ChillMainAssets/module/ckeditor5/index.js';
|
||||
import AddResult from './components/AddResult.vue';
|
||||
|
@@ -164,7 +164,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {dateToISO, ISOToDate, ISOToDatetime} from 'ChillMainAssets/chill/js/date.js';
|
||||
import {dateToISO, ISOToDate, ISOToDatetime} from 'ChillMainAssets/chill/js/date';
|
||||
import CKEditor from '@ckeditor/ckeditor5-vue';
|
||||
import ClassicEditor from 'ChillMainAssets/module/ckeditor5/index.js';
|
||||
import { mapGetters, mapState } from 'vuex';
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { createStore } from 'vuex';
|
||||
import { dateToISO, ISOToDate, datetimeToISO, ISOToDatetime, intervalDaysToISO, intervalISOToDays } from 'ChillMainAssets/chill/js/date.js';
|
||||
import { dateToISO, ISOToDate, datetimeToISO, ISOToDatetime, intervalDaysToISO, intervalISOToDays } from 'ChillMainAssets/chill/js/date';
|
||||
import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js';
|
||||
import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
|
||||
import { fetchResults, makeFetch } from 'ChillMainAssets/lib/api/apiMethods.js';
|
||||
import { fetchResults, makeFetch } from 'ChillMainAssets/lib/api/apiMethods.ts';
|
||||
import { fetchTemplates } from 'ChillDocGeneratorAssets/api/pickTemplate.js';
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
|
@@ -0,0 +1,381 @@
|
||||
<template>
|
||||
<teleport to="#export_filters_social_work_type_filter_form">
|
||||
|
||||
<fieldset class="mb-3" id="actionType">
|
||||
<div class="row">
|
||||
<legend class="col-sm-4 col-form-label">{{ $t('action.label')}}</legend>
|
||||
<div class="col-sm-8">
|
||||
|
||||
<VueMultiselect
|
||||
v-model="action"
|
||||
:options="actions.options"
|
||||
@select="selectAction"
|
||||
@remove="unselectAction"
|
||||
:multiple="true"
|
||||
:close-on-select="false"
|
||||
:placeholder="$t('action.placeholder')"
|
||||
label="text"
|
||||
track-by="id"
|
||||
:searchable="true"
|
||||
></VueMultiselect>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="mb-3" id="goal">
|
||||
<div class="row">
|
||||
<legend class="col-sm-4 col-form-label">{{ $t('goal.label')}}</legend>
|
||||
<div class="col-sm-8">
|
||||
|
||||
<VueMultiselect
|
||||
v-model="goal"
|
||||
:options="goals.options"
|
||||
@select="selectGoal"
|
||||
@remove="unselectGoal"
|
||||
:multiple="true"
|
||||
:close-on-select="false"
|
||||
:placeholder="$t('goal.placeholder')"
|
||||
label="title"
|
||||
:custom-label="transTitle"
|
||||
track-by="id"
|
||||
:searchable="true"
|
||||
></VueMultiselect>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="mb-3" id="result">
|
||||
<div class="row">
|
||||
<legend class="col-sm-4 col-form-label">{{ $t('result.label')}}</legend>
|
||||
<div class="col-sm-8">
|
||||
|
||||
<VueMultiselect
|
||||
v-model="result"
|
||||
:options="results.options"
|
||||
@select="selectResult"
|
||||
@remove="unselectResult"
|
||||
:multiple="true"
|
||||
:close-on-select="false"
|
||||
:placeholder="$t('result.placeholder')"
|
||||
label="title"
|
||||
:custom-label="transTitle"
|
||||
track-by="id"
|
||||
:searchable="true"
|
||||
></VueMultiselect>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
</teleport>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import VueMultiselect from 'vue-multiselect';
|
||||
import { getSocialActions, getGoalByAction, getResultByAction, getResultByGoal } from './api';
|
||||
|
||||
export default {
|
||||
name: "App",
|
||||
components: {
|
||||
VueMultiselect
|
||||
},
|
||||
i18n: {
|
||||
messages: {
|
||||
fr: {
|
||||
action: {
|
||||
label: 'Types d\'actions',
|
||||
placeholder: 'Choisissez une ou plusieurs actions',
|
||||
},
|
||||
goal: {
|
||||
label: 'Objectifs',
|
||||
placeholder: 'Choisissez un ou plusieurs objectifs',
|
||||
},
|
||||
result: {
|
||||
label: 'Résultats',
|
||||
placeholder: 'Choisissez un ou plusieurs résultats',
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
actions: {
|
||||
options: [], // array with multiselect options
|
||||
value: [], // array with selected values
|
||||
hiddenField: document.getElementById(
|
||||
'export_filters_social_work_type_filter_form_actionType'),
|
||||
},
|
||||
goals: {
|
||||
options: [],
|
||||
value: [],
|
||||
hiddenField: document.getElementById(
|
||||
'export_filters_social_work_type_filter_form_goal'),
|
||||
},
|
||||
results: {
|
||||
options: [],
|
||||
value: [],
|
||||
hiddenField: document.getElementById(
|
||||
'export_filters_social_work_type_filter_form_result'),
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
action: {
|
||||
get() {
|
||||
return this.actions.value;
|
||||
},
|
||||
set(value) {
|
||||
this.actions.value = value;
|
||||
this.rebuildHiddenFieldValues('actions');
|
||||
}
|
||||
},
|
||||
goal: {
|
||||
get() {
|
||||
return this.goals.value;
|
||||
},
|
||||
set(value) {
|
||||
this.goals.value = value;
|
||||
this.rebuildHiddenFieldValues('goals');
|
||||
}
|
||||
},
|
||||
result: {
|
||||
get() {
|
||||
return this.results.value;
|
||||
},
|
||||
set(value) {
|
||||
this.results.value = value;
|
||||
this.rebuildHiddenFieldValues('results');
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getSocialActionsList();
|
||||
|
||||
this.actions.hiddenField.value = '';
|
||||
this.goals.hiddenField.value = '';
|
||||
this.results.hiddenField.value = '';
|
||||
|
||||
//console.log(this.actions.hiddenField, this.goals.hiddenField, this.results.hiddenField);
|
||||
},
|
||||
methods: {
|
||||
async getSocialActionsList() {
|
||||
this.actions.options = await getSocialActions();
|
||||
},
|
||||
|
||||
/**
|
||||
* Select/unselect in Action Multiselect
|
||||
* @param value
|
||||
*/
|
||||
selectAction(value) {
|
||||
//console.log('----'); console.log('select action', value.id);
|
||||
let children = this.getChildrensFromParent(value);
|
||||
this.addSelectedElement('actions', children);
|
||||
|
||||
let parentAndChildren = [...[value], ...children];
|
||||
parentAndChildren.forEach(elem => {
|
||||
getGoalByAction(elem.id).then(response => new Promise((resolve, reject) => {
|
||||
this.addElementInData('goals', response.results);
|
||||
resolve();
|
||||
})).catch;
|
||||
getResultByAction(elem.id).then(response => new Promise((resolve, reject) => {
|
||||
this.addElementInData('results', response.results);
|
||||
resolve();
|
||||
})).catch;
|
||||
});
|
||||
},
|
||||
|
||||
unselectAction(value) {
|
||||
//console.log('----'); console.log('unselect action', value.id);
|
||||
getGoalByAction(value.id).then(response => new Promise((resolve, reject) => {
|
||||
[ this.goals.options, this.goals.value ] = this.removeElementInData('goals', response.results);
|
||||
resolve();
|
||||
})).catch;
|
||||
getResultByAction(value.id).then(response => new Promise((resolve, reject) => {
|
||||
[ this.results.options, this.results.value ] = this.removeElementInData('results', response.results);
|
||||
resolve();
|
||||
})).catch;
|
||||
},
|
||||
|
||||
/**
|
||||
* Select/unselect in Goal Multiselect
|
||||
* @param value
|
||||
*/
|
||||
selectGoal(value) {
|
||||
//console.log('----'); console.log('select goal', value.id);
|
||||
getResultByGoal(value.id).then(response => new Promise((resolve, reject) => {
|
||||
this.addElementInData('results', response.results);
|
||||
resolve();
|
||||
})).catch;
|
||||
},
|
||||
|
||||
unselectGoal(value) {
|
||||
//console.log('----'); console.log('unselect goal', value.id);
|
||||
getResultByGoal(value.id).then(response => new Promise((resolve, reject) => {
|
||||
[ this.results.options, this.results.value ] = this.removeElementInData('results', response.results);
|
||||
resolve();
|
||||
})).catch;
|
||||
},
|
||||
|
||||
/**
|
||||
* Select/unselect in Result Multiselect
|
||||
* @param value
|
||||
*/
|
||||
selectResult(value) {
|
||||
//console.log('----'); console.log('select result', value.id);
|
||||
},
|
||||
|
||||
unselectResult(value) {
|
||||
//console.log('----'); console.log('unselect result', value.id);
|
||||
},
|
||||
|
||||
/**
|
||||
* Choose parent action will involve retaining the "children" actions.
|
||||
* @param value
|
||||
* @return array
|
||||
*/
|
||||
getChildrensFromParent(value) {
|
||||
if (null === value.parent) {
|
||||
let excludeParent = this.actions.options.filter(o => o.parent !== null);
|
||||
let children = excludeParent.filter(o => o.parent.id === value.id);
|
||||
//console.log("get childrens", children.map(e => e.id));
|
||||
return children;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
|
||||
/**
|
||||
* Add response elements in data target
|
||||
* @param target string -> 'actions', 'goals' or 'results'
|
||||
* @param response array of objects with fetch results
|
||||
*/
|
||||
addElementInData(target, response) {
|
||||
let data = this[target];
|
||||
let dump = [];
|
||||
response.forEach(elem => {
|
||||
let found = data.options.some(e => e.id === elem.id);
|
||||
if (!found) {
|
||||
data.options.push(elem);
|
||||
dump.push(elem.id);
|
||||
}
|
||||
})
|
||||
if (dump.length > 0) {
|
||||
//console.log('push ' + dump.length + ' elems in', target, dump);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove response elements from data target
|
||||
* @param target string -> 'actions', 'goals' or 'results'
|
||||
* @param response array of objects with fetch results
|
||||
* @returns data.<target>.options
|
||||
*/
|
||||
removeElementInData(target, response) {
|
||||
let data = this[target];
|
||||
let dump = [];
|
||||
response.forEach(elem => {
|
||||
let found = data.options.some(e => e.id === elem.id);
|
||||
if (found) {
|
||||
data.options = data.options.filter(e => e.id !== elem.id);
|
||||
dump.push(elem.id);
|
||||
|
||||
this.removeSelectedElement(target, elem);
|
||||
}
|
||||
})
|
||||
if (dump.length > 0) {
|
||||
//console.log('remove ' + dump.length + ' elems from ' + target + ' options', dump);
|
||||
}
|
||||
return [ data.options, data.value ];
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* @param target
|
||||
* @param elements
|
||||
*/
|
||||
addSelectedElement(target, elements) {
|
||||
let data = this[target];
|
||||
let dump = [];
|
||||
elements.forEach(elem => {
|
||||
let selected = data.value.some(e => e.id === elem.id);
|
||||
if (!selected) {
|
||||
|
||||
data.value.push(elem);
|
||||
dump.push(elem.id);
|
||||
|
||||
// add in hiddenField
|
||||
this.rebuildHiddenFieldValues(target);
|
||||
}
|
||||
});
|
||||
if (dump.length > 0) {
|
||||
//console.log('add ' + dump.length + ' selected elems in', target, dump);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove element from selected and from hiddenField
|
||||
* @param target
|
||||
* @param elem
|
||||
*/
|
||||
removeSelectedElement(target, elem) {
|
||||
let data = this[target];
|
||||
let selected = data.value.some(e => e.id === elem.id);
|
||||
if (selected) {
|
||||
|
||||
// remove from selected
|
||||
data.value = data.value.filter(e => e.id !== elem.id);
|
||||
//console.log('remove ' + elem.id + ' from selected ' + target);
|
||||
|
||||
// remove from hiddenField
|
||||
this.rebuildHiddenFieldValues(target);
|
||||
|
||||
// in any cases, remove should be recursive
|
||||
this.unselectToNextField(target, elem);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* When unselect Action, it could remove elements in goals multiselect.
|
||||
* In that case, we have to unselect Goal to remove elements in results too.
|
||||
* @param target
|
||||
* @param elem
|
||||
*/
|
||||
unselectToNextField(target, elem) {
|
||||
if (target === 'goals') {
|
||||
//console.log('!!!! target is goal: unselect goal', elem.id);
|
||||
this.unselectGoal(elem);
|
||||
//console.log('!!!! done');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Rebuild values serie (string) in target HiddenField
|
||||
* @param target
|
||||
*/
|
||||
rebuildHiddenFieldValues(target) {
|
||||
let data = this[target];
|
||||
//console.log('rebuild hiddenFields ' + target + ' values :');
|
||||
data.hiddenField.value = ''; // reset
|
||||
data.value.forEach(elem => {
|
||||
data.hiddenField.value = this.addIdToValue(data.hiddenField.value, elem.id);
|
||||
})
|
||||
//console.log(data.hiddenField);
|
||||
},
|
||||
|
||||
addIdToValue(string, id) {
|
||||
let array = string ? string.split(',') : [];
|
||||
array.push(id.toString());
|
||||
let str = array.join();
|
||||
return str;
|
||||
},
|
||||
|
||||
transTitle ({ title }) {
|
||||
return title.fr //TODO multilang
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
@@ -0,0 +1,41 @@
|
||||
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
|
||||
const getSocialActions = () => fetchResults(
|
||||
'/api/1.0/person/social/social-action.json', {
|
||||
item_per_page: 200
|
||||
}
|
||||
);
|
||||
|
||||
const getGoalByAction = (id) => {
|
||||
let url = `/api/1.0/person/social-work/goal/by-social-action/${id}.json`;
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
};
|
||||
|
||||
const getResultByAction = (id) => {
|
||||
let url = `/api/1.0/person/social-work/result/by-social-action/${id}.json`;
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
};
|
||||
|
||||
const getResultByGoal = (id) => {
|
||||
let url = `/api/1.0/person/social-work/result/by-goal/${id}.json`;
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
};
|
||||
|
||||
export {
|
||||
getSocialActions,
|
||||
getGoalByAction,
|
||||
getResultByAction,
|
||||
getResultByGoal,
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
import { createApp } from "vue";
|
||||
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
|
||||
import App from './App.vue';
|
||||
|
||||
const i18n = _createI18n({});
|
||||
|
||||
const app = createApp({
|
||||
template: `<app></app>`,
|
||||
})
|
||||
.use(i18n)
|
||||
.component('app', App)
|
||||
.mount('#export_export')
|
||||
;
|
@@ -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');
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { createStore } from 'vuex';
|
||||
import { householdMove, fetchHouseholdSuggestionByAccompanyingPeriod, fetchAddressSuggestionByPerson} from './../api.js';
|
||||
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.js'
|
||||
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.ts'
|
||||
import { fetchHouseholdByAddressReference } from 'ChillPersonAssets/lib/household.js';
|
||||
import { datetimeToISO, dateToISO, ISOToDate } from 'ChillMainAssets/chill/js/date.js';
|
||||
import { datetimeToISO, dateToISO, ISOToDate } from 'ChillMainAssets/chill/js/date';
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
//console.log('AJAJAJA', window.addaddress);
|
||||
|
@@ -5,15 +5,12 @@
|
||||
<teleport to="#visgraph-legend">
|
||||
<div class="post-menu">
|
||||
<div class="list-group mt-4">
|
||||
<button type="button" class="list-group-item list-group-item-action btn btn-create" @click="createRelationship">
|
||||
{{ $t('visgraph.add_link') }}
|
||||
<button type="button" class="list-group-item list-group-item-action btn btn-misc" @click="createRelationship">
|
||||
<i class="fa fa-plus"></i> {{ $t('visgraph.add_link') }}
|
||||
</button>
|
||||
<a type="button" class="list-group-item list-group-item-action btn btn-misc" id="exportCanvasBtn" @click="exportCanvasAsImage">
|
||||
<i class="fa fa-camera fa-fw"></i> {{ $t('visgraph.screenshot') }}
|
||||
</a>
|
||||
<button type="button" class="list-group-item list-group-item-action btn btn-light" @click="refreshNetwork">
|
||||
<i class="fa fa-refresh fa-fw"></i> {{ $t('visgraph.refresh') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="displayHelpMessage" class="alert alert-info mt-3">
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { splitId } from './vis-network';
|
||||
import {makeFetch} from 'ChillMainAssets/lib/api/apiMethods.js';
|
||||
import {makeFetch} from 'ChillMainAssets/lib/api/apiMethods.ts';
|
||||
|
||||
/**
|
||||
* @function getFetch
|
||||
|
@@ -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,
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods.js';
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods.ts';
|
||||
|
||||
export default {
|
||||
name: "SetReferrer",
|
||||
|
@@ -303,7 +303,7 @@ export default {
|
||||
'id': responsePerson.id
|
||||
},
|
||||
'start_date': {
|
||||
// TODO: use date.js methods (low priority)
|
||||
// TODO: use date.ts methods (low priority)
|
||||
'datetime': `${new Date().toISOString().split('T')[0]}T00:00:00+02:00`
|
||||
},
|
||||
'holder': false,
|
||||
|
@@ -200,7 +200,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {dateToISO} from 'ChillMainAssets/chill/js/date.js';
|
||||
import {dateToISO} from 'ChillMainAssets/chill/js/date';
|
||||
import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue';
|
||||
import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue';
|
||||
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
|
||||
|
@@ -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: {
|
||||
@@ -255,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':
|
||||
@@ -296,23 +326,35 @@ export default {
|
||||
this.config.civilities = civilities.results;
|
||||
}
|
||||
});
|
||||
|
||||
if (this.action !== 'create') {
|
||||
this.loadData();
|
||||
} else {
|
||||
getCentersForPersonCreation()
|
||||
.then(params => {
|
||||
this.config.centers = params.centers;
|
||||
this.showCenters = params.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 !"
|
||||
|
@@ -24,7 +24,7 @@
|
||||
<td>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_crud_person_household_position_edit', { 'id': entity.id }) }}" class="btn btn-edit"></a>
|
||||
<a href="{{ chill_path_add_return_path('chill_crud_person_household_composition_type_edit', { 'id': entity.id }) }}" class="btn btn-edit"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
|
@@ -151,6 +151,24 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% set calendars = [] -%}
|
||||
{% for c in acp.nextCalendarsForPerson(person, 10) -%}
|
||||
{% if is_granted('CHILL_CALENDAR_CALENDAR_SEE', c) -%}
|
||||
{% set calendars = calendars|merge([c]) -%}
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
{% if calendars|length > 0 %}
|
||||
<div class="wl-row">
|
||||
<div class="wl-col title">
|
||||
<h3>{{ 'chill_calendar.Next calendars'|trans }}</h3>
|
||||
</div>
|
||||
<div class="wl-col list">
|
||||
{% for c in calendars %}<span>{{ c.startDate|format_datetime('long', 'short') }}</span>{% if not loop.last %}, {% endif %}{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if acp.step == 'CLOSED' and acp.closingMotive is not null %}
|
||||
<div class="wl-row">
|
||||
<div class="wl-col title">
|
||||
|
@@ -1,17 +1,23 @@
|
||||
<div class="flex-table accompanying_course_work-list">
|
||||
{% include '@ChillPerson/AccompanyingCourseWork/_item.html.twig' with {
|
||||
'w': work,
|
||||
'itemBlocClass': 'bg-chill-llight-gray'
|
||||
} %}
|
||||
</div>
|
||||
{% if work is null %}
|
||||
<div class="alert alert-warning">
|
||||
{{ 'workflow.SocialAction deleted'|trans }}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="flex-table accompanying_course_work-list">
|
||||
{% include '@ChillPerson/AccompanyingCourseWork/_item.html.twig' with {
|
||||
'w': work,
|
||||
'itemBlocClass': 'bg-chill-llight-gray'
|
||||
} %}
|
||||
</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 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