mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 15:43:51 +00:00
Merge add_toasters: handle 422 method and add toaster into course editor
See https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/221
Squashed commit of the following:
commit 4f68f83aba74a88898779037aeb24d45c622759e
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date: Thu Nov 25 12:07:37 2021 +0100
scope in course editor: show toast when error, instead of restoring the
previous state
commit fdca8c1c87a4972bb6107bb16ab76844a28cae72
Merge: 53d6e68f8 b97f49782
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date: Wed Nov 24 17:39:27 2021 +0100
Merge remote-tracking branch 'origin/add_toasters' into add_toasters
commit 53d6e68f8c5e158ac1848403d18146690ffeacf2
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date: Wed Nov 24 17:38:52 2021 +0100
better validation messages
commit b97f497822fa6f6057e3b1cf3697044192ea9052
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 24 17:36:59 2021 +0100
methods added to api.js again so they can be imported in other bundles still. To be refactored later with general makeFetch method?
commit e6089f75b4f66669cbd84f496c3b867901de9c8c
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date: Wed Nov 24 17:20:05 2021 +0100
fix validator for participation overlaps
commit e47e6741b9f179dae63f39a596b7ba7410b3ac88
Merge: 25a80fcb2 05385509e
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date: Wed Nov 24 16:31:50 2021 +0100
Merge remote-tracking branch 'origin/master' into add_toasters
commit 25a80fcb26cfb3ab7afab0abc1fcb6c0d0af7a6d
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 23 18:22:35 2021 +0100
error object/message changed if not 422 or 403
commit 0c602cee8c127ab7f0723819a691a98c4e0615e2
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 23 17:13:47 2021 +0100
Toasts displayed with differentiation between different errors
error objects created accordingly
commit 252e57a06da1101e4ebc025974b247c472b8c2ed
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 23 17:12:55 2021 +0100
generic makeFetch implemented almost everywhere
api.js file no longer needs to contain a separate function to make an api call.
commit 8532eeee7656f6f9761168fb5e2102778ee932b7
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 23 17:10:48 2021 +0100
Moved generic api methods into one file apiMethods.js
imports adapted throughout bundles
commit c44bd5e75b32d5fbc8951247324ebf5fb85f3b37
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 23 11:27:24 2021 +0100
migration deleted
commit dbeee090f46b3653c306a1825dcb05637e1f9b31
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 23 11:27:13 2021 +0100
toast plugin initialized with options in the root
commit ec3919e357ee26f6c5016360d2083d19688217f4
Merge: 1ab401b5d b8889ed58
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 23 10:52:24 2021 +0100
merge conflicts fixed
commit 1ab401b5d55a28f9c027ee539da58ef1da3d797c
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 23 10:40:02 2021 +0100
add options when vue toast plugin is loaded
commit ad4e630bdd87c8ec16455bab0c2b053c1d838050
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Mon Nov 22 18:58:44 2021 +0100
fixes to throw and catch error
commit 1c19748866d738bcb9e336f1035d9d78c6941d34
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 20:22:06 2021 +0100
toast added to banner
commit 35949b90532b60161e14e815a78b3b69b053b62d
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 20:16:35 2021 +0100
few more actions using makeFetch
commit e94c13e396f496565955294aec360db37f92374b
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 19:48:58 2021 +0100
For accompanyingcourse app general makeFetch + displayToast implemented
commit 35eac75edf2c8d39ee2a04f119bb99a946fe3ea9
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 17:12:31 2021 +0100
general makeFetch method implemented + toasts displayed in progress
commit 541bb10547bd7b96815a22a755ecf7f809d8cc87
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 12:36:20 2021 +0100
general fetch method adjusted and tested on addParticipation: works
commit b7f27e8079bc815d88ffc925ec7a4fae3fba5f02
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 11:50:09 2021 +0100
changelog updated
commit 028519ee3e93991aeb3131656e5f17e728ebdb1c
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 11:42:55 2021 +0100
adjustment of error message using templating render
commit 508139b4476a46028a40b0b5300a8c65f79414a9
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 11:41:52 2021 +0100
toast display for 422 errors on participations, requestor, resources + bugfix in requestor component (display of 'remove' btn if non-anonymous
commit 3e5d4862fcbbf5708f52c0038bf030dc0cbae5bb
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 16 15:38:03 2021 +0100
debugging fetch method
commit 8b971a2357aac952ea6cd9487da20f4064c26a8d
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 16 14:31:45 2021 +0100
general fetch method in _abstratAPI and testcase implementation; still needs to take care of commit into store
commit 05488740ab138ed279a4626310c5427d9f732793
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 16 11:13:28 2021 +0100
testcase: toaster working when adding a resource to an accompanying course. Needs to be generalized
commit 5050e8a516107710216fa11aafcf852c52e1eb03
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 16 09:22:36 2021 +0100
start of toaster popup
commit b8889ed58d3abb68d1c2859b31bf7428addda36e
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Mon Nov 22 18:58:44 2021 +0100
fixes to throw and catch error
commit 0c017eb908e65919876d3bed69d3daa27699f2cc
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 20:22:06 2021 +0100
toast added to banner
commit 80d8c5f12be4b0cfcded2948f385b4e3627e9afb
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 20:16:35 2021 +0100
few more actions using makeFetch
commit 9cfcc61d995f75651902af97fe640f00f994ce9b
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 19:48:58 2021 +0100
For accompanyingcourse app general makeFetch + displayToast implemented
commit 2855b0293a4a3fef2baf22fa035316bac13abf3f
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 17:12:31 2021 +0100
general makeFetch method implemented + toasts displayed in progress
commit febbc8b9cdd9ec811546ce2948e2e1bded7c2116
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 12:36:20 2021 +0100
general fetch method adjusted and tested on addParticipation: works
commit 16b59681b97cf995689aa464ae2a310c3efbb603
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 11:50:09 2021 +0100
changelog updated
commit 41df29bdef84af010892708bfd0e37ff826f7aee
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 11:42:55 2021 +0100
adjustment of error message using templating render
commit 8c98fe602c26e61285f12f5f7d58d646655f4caa
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Wed Nov 17 11:41:52 2021 +0100
toast display for 422 errors on participations, requestor, resources + bugfix in requestor component (display of 'remove' btn if non-anonymous
commit 689ca8aa0ac249d577fe2ead5b3fcc0298dbad90
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 16 15:38:03 2021 +0100
debugging fetch method
commit 07234c5fa996fb9f0352719ee366b34b093807eb
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 16 14:31:45 2021 +0100
general fetch method in _abstratAPI and testcase implementation; still needs to take care of commit into store
commit 2a482516e952aa720b5aa8b4cb68ab33f93ce47b
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 16 11:13:28 2021 +0100
testcase: toaster working when adding a resource to an accompanying course. Needs to be generalized
commit b7dcc5e7d4b1489a8edc175a0c2c1b0d649c6c0f
Author: Julie Lenaerts <julielenaerts@gmail.com>
Date: Tue Nov 16 09:22:36 2021 +0100
start of toaster popup
This commit is contained in:
@@ -53,13 +53,34 @@ export default {
|
||||
//temporaire (modif backend)
|
||||
value = "occasional";
|
||||
}
|
||||
this.$store.dispatch('toggleIntensity', value);
|
||||
this.$store.dispatch('toggleIntensity', value)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
toggleEmergency() {
|
||||
this.$store.dispatch('toggleEmergency', (!this.isEmergency));
|
||||
this.$store.dispatch('toggleEmergency', (!this.isEmergency))
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
toggleConfidential() {
|
||||
this.$store.dispatch('toggleConfidential', (!this.isConfidential));
|
||||
this.$store.dispatch('toggleConfidential', (!this.isConfidential))
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -59,7 +59,15 @@ export default {
|
||||
locationStatusTo: 'person',
|
||||
personId: this.person.id
|
||||
};
|
||||
this.$store.dispatch('updateLocation', payload);
|
||||
this.$store.dispatch('updateLocation', payload)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
|
||||
window.location.assign('#section-20');
|
||||
this.modal.showModal = false;
|
||||
}
|
||||
|
@@ -83,12 +83,24 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
submitform() {
|
||||
//console.log('submit');
|
||||
this.$store.dispatch('postFirstComment', this.formdata);
|
||||
this.$store.dispatch('postFirstComment', this.formdata)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
removeComment() {
|
||||
//console.log('remove');
|
||||
this.$store.dispatch('postFirstComment', {});
|
||||
this.$store.dispatch('postFirstComment', {})
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -115,9 +115,14 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
confirmCourse() {
|
||||
//console.log('@@ CLICK confirmCourse');
|
||||
this.$store.dispatch('confirmAccompanyingCourse');
|
||||
//console.log('confirm last');
|
||||
this.$store.dispatch('confirmAccompanyingCourse')
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -187,7 +187,14 @@ export default {
|
||||
locationStatusTo: 'none'
|
||||
};
|
||||
//console.log('remove address');
|
||||
this.$store.dispatch('updateLocation', payload);
|
||||
this.$store.dispatch('updateLocation', payload)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
displayErrors() {
|
||||
return this.$refs.addAddress.errorMsg;
|
||||
@@ -195,7 +202,15 @@ export default {
|
||||
submitTemporaryAddress(payload) {
|
||||
//console.log('@@@ click on Submit Temporary Address Button', payload);
|
||||
payload['locationStatusTo'] = 'address'; // <== temporary, not none, not person
|
||||
this.$store.dispatch('updateLocation', payload);
|
||||
this.$store.dispatch('updateLocation', payload)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
|
||||
this.$store.commit('setEditContextTrue', payload);
|
||||
}
|
||||
},
|
||||
|
@@ -29,7 +29,7 @@
|
||||
|
||||
<script>
|
||||
import VueMultiselect from 'vue-multiselect';
|
||||
import { getListOrigins } from '../api';
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
import { mapState, mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
@@ -53,14 +53,26 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getOptions() {
|
||||
getListOrigins().then(response => new Promise((resolve, reject) => {
|
||||
this.options = response.results;
|
||||
resolve();
|
||||
}));
|
||||
const url = `/api/1.0/person/accompanying-period/origin.json`;
|
||||
makeFetch('GET', url)
|
||||
.then(response => {
|
||||
this.options = response.results;
|
||||
return response;
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
this.$toast.open({message: error.txt})
|
||||
})
|
||||
},
|
||||
updateOrigin(value) {
|
||||
console.log('value', value);
|
||||
this.$store.dispatch('updateOrigin', value);
|
||||
this.$store.dispatch('updateOrigin', value)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
transText ({ text }) {
|
||||
const parsedText = JSON.parse(text);
|
||||
|
@@ -17,7 +17,7 @@
|
||||
<button class="btn btn-update" type="submit">{{ $t('persons_associated.update_household') }}</button>
|
||||
</div>
|
||||
<p class="mb-3">{{ $t('persons_associated.person_without_household_warning') }}</p>
|
||||
<div class="form-check" v-for="p in participationWithoutHousehold">
|
||||
<div class="form-check" v-for="p in participationWithoutHousehold" :key="p.id">
|
||||
<input type="checkbox"
|
||||
class="form-check-input"
|
||||
v-model="hasNoHousehold"
|
||||
@@ -66,8 +66,8 @@
|
||||
|
||||
<script>
|
||||
import {mapGetters, mapState} from 'vuex';
|
||||
import ParticipationItem from "./PersonsAssociated/ParticipationItem.vue"
|
||||
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue'
|
||||
import ParticipationItem from "./PersonsAssociated/ParticipationItem.vue";
|
||||
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
||||
|
||||
export default {
|
||||
name: 'PersonsAssociated',
|
||||
@@ -110,17 +110,35 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
removeParticipation(item) {
|
||||
//console.log('@@ CLICK remove participation: item', item);
|
||||
this.$store.dispatch('removeParticipation', item);
|
||||
this.$store.dispatch('removeParticipation', item)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
closeParticipation(item) {
|
||||
//console.log('@@ CLICK close participation: item', item);
|
||||
this.$store.dispatch('closeParticipation', item);
|
||||
this.$store.dispatch('closeParticipation', item)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
addNewPersons({ selected, modal }) {
|
||||
//console.log('@@@ CLICK button addNewPersons', selected);
|
||||
selected.forEach(function(item) {
|
||||
this.$store.dispatch('addParticipation', item);
|
||||
this.$store.dispatch('addParticipation', item)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
}, this
|
||||
);
|
||||
this.$refs.addPersons.resetSearch(); // to cast child method
|
||||
|
@@ -110,7 +110,14 @@ export default {
|
||||
saveFormOnTheFly(payload) {
|
||||
console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
|
||||
payload.target = 'participation';
|
||||
this.$store.dispatch('patchOnTheFly', payload);
|
||||
this.$store.dispatch('patchOnTheFly', payload)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@
|
||||
|
||||
<script>
|
||||
import VueMultiselect from 'vue-multiselect';
|
||||
import { getUsers, whoami } from '../api';
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
import { mapState } from 'vuex';
|
||||
import UserRenderBoxBadge from "ChillMainAssets/vuejs/_components/Entity/UserRenderBoxBadge";
|
||||
|
||||
@@ -77,14 +77,26 @@ export default {
|
||||
methods: {
|
||||
updateReferrer(value) {
|
||||
//console.log('value', value);
|
||||
this.$store.dispatch('updateReferrer', value);
|
||||
this.$store.dispatch('updateReferrer', value)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
assignMe() {
|
||||
//console.log('assign me');
|
||||
whoami().then(me => new Promise((resolve, reject) => {
|
||||
this.$store.dispatch('updateReferrer', me);
|
||||
resolve();
|
||||
}));
|
||||
const url = `/api/1.0/main/whoami.json`;
|
||||
makeFetch('GET', url)
|
||||
.then(response => {
|
||||
this.$store.dispatch('updateReferrer', response);
|
||||
return response;
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
this.$toast.open({message: error.body})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -117,6 +117,16 @@
|
||||
</ul>
|
||||
</template>
|
||||
</person-render-box>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button class="btn btn-remove"
|
||||
:title="$t('action.remove')"
|
||||
@click="removeRequestor">
|
||||
{{ $t('action.remove') }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
@@ -183,18 +193,40 @@ export default {
|
||||
methods: {
|
||||
removeRequestor() {
|
||||
//console.log('@@ CLICK remove requestor: item');
|
||||
this.$store.dispatch('removeRequestor');
|
||||
this.$store.dispatch('removeRequestor')
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
addNewPersons({ selected, modal }) {
|
||||
//console.log('@@@ CLICK button addNewPersons', selected);
|
||||
this.$store.dispatch('addRequestor', selected.shift());
|
||||
this.$store.dispatch('addRequestor', selected.shift())
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
|
||||
this.$refs.addPersons.resetSearch(); // to cast child method
|
||||
modal.showModal = false;
|
||||
},
|
||||
saveFormOnTheFly(payload) {
|
||||
console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
|
||||
payload.target = 'requestor';
|
||||
this.$store.dispatch('patchOnTheFly', payload);
|
||||
this.$store.dispatch('patchOnTheFly', payload)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -62,12 +62,26 @@ export default {
|
||||
methods: {
|
||||
removeResource(item) {
|
||||
//console.log('@@ CLICK remove resource: item', item);
|
||||
this.$store.dispatch('removeResource', item);
|
||||
this.$store.dispatch('removeResource', item)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
addNewPersons({ selected, modal }) {
|
||||
//console.log('@@@ CLICK button addNewPersons', selected);
|
||||
selected.forEach(function(item) {
|
||||
this.$store.dispatch('addResource', item);
|
||||
this.$store.dispatch('addResource', item)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: violations})
|
||||
}
|
||||
});
|
||||
}, this
|
||||
);
|
||||
this.$refs.addPersons.resetSearch(); // to cast child method
|
||||
|
@@ -60,7 +60,14 @@ export default {
|
||||
saveFormOnTheFly(payload) {
|
||||
console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
|
||||
payload.target = 'resource';
|
||||
this.$store.dispatch('patchOnTheFly', payload);
|
||||
this.$store.dispatch('patchOnTheFly', payload)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,8 +3,8 @@
|
||||
<h2><a id="section-60"></a>{{ $t('scopes.title') }}</h2>
|
||||
|
||||
<div class="mb-4">
|
||||
<div class="form-check" v-for="s in scopes">
|
||||
<input class="form-check-input" type="checkbox" v-model="checkedScopes" :value="s" />
|
||||
<div class="form-check" v-for="s in scopes" :key="s.id">
|
||||
<input class="form-check-input" type="checkbox" v-model="checkedScopes" :value="s"/>
|
||||
<label class="form-check-label">
|
||||
{{ s.name.fr }}
|
||||
</label>
|
||||
@@ -37,10 +37,22 @@ export default {
|
||||
return this.$store.state.accompanyingCourse.scopes;
|
||||
},
|
||||
set: function(v) {
|
||||
this.$store.dispatch('setScopes', v);
|
||||
this.$store.dispatch('setScopes', v)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
restore() {
|
||||
console.log('restore');
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@@ -30,7 +30,7 @@
|
||||
|
||||
<script>
|
||||
import VueMultiselect from 'vue-multiselect';
|
||||
import { getSocialIssues } from '../api';
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
import {mapGetters, mapState} from 'vuex';
|
||||
|
||||
export default {
|
||||
@@ -54,14 +54,26 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getOptions() {
|
||||
getSocialIssues().then(response => new Promise((resolve, reject) => {
|
||||
//console.log('get socialIssues', response.results);
|
||||
this.options = response.results;
|
||||
resolve();
|
||||
})).catch(error => this.$store.commit('catchError', error));
|
||||
const url = `/api/1.0/person/social-work/social-issue.json`;
|
||||
makeFetch('GET', url)
|
||||
.then(response => {
|
||||
this.options = response.results;
|
||||
return response;
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
this.$toast.open({message: error.txt})
|
||||
})
|
||||
},
|
||||
updateSocialIssues(value) {
|
||||
this.$store.dispatch('updateSocialIssues', this.transformValue(value));
|
||||
this.$store.dispatch('updateSocialIssues', this.transformValue(value))
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
transformValue(updated) {
|
||||
let stored = this.value;
|
||||
@@ -70,8 +82,6 @@ export default {
|
||||
let method = (typeof removed === 'undefined') ? 'POST' : 'DELETE';
|
||||
let changed = (typeof removed === 'undefined') ? added : removed;
|
||||
let body = { type: "social_issue", id: changed.id };
|
||||
//console.log('body', body);
|
||||
//console.log('@@@', method, changed.text);
|
||||
let payload = updated;
|
||||
return { payload, body, method };
|
||||
}
|
||||
|
Reference in New Issue
Block a user