Mathieu Jaumotte 648ec68cfb export SocialWorkTypeFilter: create dynamic Form Action-goal-result
- initiate new Vue component
- cleaning buildForm in Filter
- add HiddenType with ModelTransformer
- use ObjectToIdTransformer in HiddenType fields
- setting mount() and teleport
- list fetch url in api.js
- html/bootstrap form structure
- add Multiselect actionType
- i18n import
- add multiselect for goals and results
- add and remove options in multiselect (wip)
- fix basic vue add/remove element from data store
- vue cleaning
- add ids in value hiddenFields
- adapt Filter in AlterQuery (wip)
- improve code lisibility
2022-09-06 14:24:06 +02:00

41 lines
1.2 KiB
JavaScript

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,
}