|
|
@@ -12,16 +12,13 @@ const keyofEvent: Array<keyof Evenement> = ["name", "uuid", "start", "end"];
|
|
|
|
|
|
export default defineComponent({
|
|
|
methods: {
|
|
|
- commit<K extends keyof Mutations>(key: K, payload: Parameters<Mutations[K]>[1]): void {
|
|
|
- this.$store.dispatch(ActionTypes.superCommit, { mutation: key, payload });
|
|
|
- },
|
|
|
importJsonState(obj: EvenementStateJSON, preserve = false) {
|
|
|
// Remove previous content and load the main event title
|
|
|
if (preserve == false) {
|
|
|
- this.commit(MutationTypes.resetState, undefined);
|
|
|
+ this.$store.commit(MutationTypes.resetState, undefined);
|
|
|
const e = Evenement.fromJSON(obj.evenement);
|
|
|
for (const k of keyofEvent) {
|
|
|
- this.commit(MutationTypes.editEvenement, {
|
|
|
+ this.$store.commit(MutationTypes.editEvenement, {
|
|
|
field: k,
|
|
|
value: e[k],
|
|
|
});
|
|
|
@@ -29,11 +26,11 @@ export default defineComponent({
|
|
|
}
|
|
|
// Import constraint
|
|
|
obj.competences.forEach((c) => {
|
|
|
- this.commit(MutationTypes.addConstraint, Competence.fromJSON(c));
|
|
|
+ this.$store.commit(MutationTypes.addConstraint, Competence.fromJSON(c));
|
|
|
});
|
|
|
// Import Benevoles
|
|
|
obj.benevoles.forEach((b) => {
|
|
|
- this.commit(MutationTypes.addBenevole, Benevole.fromJSON(b));
|
|
|
+ this.$store.commit(MutationTypes.addBenevole, Benevole.fromJSON(b));
|
|
|
});
|
|
|
// Import creneau group
|
|
|
const dict: { [k: string]: Ressource } = {};
|
|
|
@@ -55,18 +52,18 @@ export default defineComponent({
|
|
|
});
|
|
|
// Push the items to the store
|
|
|
creneauGroups.forEach((r, pos) => {
|
|
|
- this.commit(MutationTypes.addCreneauGroupAt, { r, pos });
|
|
|
+ this.$store.commit(MutationTypes.addCreneauGroupAt, { r, pos });
|
|
|
});
|
|
|
|
|
|
// Import Creneau
|
|
|
for (const c of obj.creneaux) {
|
|
|
const creneau = Creneau.fromJSON(c);
|
|
|
- this.commit(MutationTypes.addCreneau, creneau);
|
|
|
+ this.$store.commit(MutationTypes.addCreneau, creneau);
|
|
|
// add the creneau to the corresponding benevole
|
|
|
for (const id of creneau.benevoleIdList) {
|
|
|
const b = this.$store.getters.getBenevoleById(id);
|
|
|
if (b) {
|
|
|
- this.commit(MutationTypes.editBenevole, {
|
|
|
+ this.$store.commit(MutationTypes.editBenevole, {
|
|
|
id: id,
|
|
|
field: "creneauIdList",
|
|
|
value: Array.from(new Set([...b.creneauIdList, creneau.id])),
|