|
@@ -74,6 +74,7 @@ import toast from "@/utils/Toast";
|
|
|
import dayjs from "dayjs";
|
|
import dayjs from "dayjs";
|
|
|
import "dayjs/locale/fr";
|
|
import "dayjs/locale/fr";
|
|
|
import ContextMenu, { MenuAction } from "@/components/Utils/ContextMenu.vue";
|
|
import ContextMenu, { MenuAction } from "@/components/Utils/ContextMenu.vue";
|
|
|
|
|
+import commit from "@/mixins/commit";
|
|
|
dayjs.locale("fr");
|
|
dayjs.locale("fr");
|
|
|
|
|
|
|
|
type changePayload = {
|
|
type changePayload = {
|
|
@@ -87,6 +88,7 @@ export default defineComponent({
|
|
|
EditeurLigne,
|
|
EditeurLigne,
|
|
|
ContextMenu,
|
|
ContextMenu,
|
|
|
},
|
|
},
|
|
|
|
|
+ mixins: [commit],
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
contextActions: [] as Array<MenuAction>,
|
|
contextActions: [] as Array<MenuAction>,
|
|
@@ -149,7 +151,7 @@ export default defineComponent({
|
|
|
isMeal: false,
|
|
isMeal: false,
|
|
|
fixedAttendee: false,
|
|
fixedAttendee: false,
|
|
|
});
|
|
});
|
|
|
- this.$store.commit(MutationTypes.addCreneau, creneau);
|
|
|
|
|
|
|
+ this.commit(MutationTypes.addCreneau, creneau);
|
|
|
|
|
|
|
|
this.currentCreneau = this.$store.getters.getCreneauById(creneau.id);
|
|
this.currentCreneau = this.$store.getters.getCreneauById(creneau.id);
|
|
|
this.currentCreneauGroup = undefined;
|
|
this.currentCreneauGroup = undefined;
|
|
@@ -167,7 +169,7 @@ export default defineComponent({
|
|
|
this.currentCreneauGroup = this.timeline.addRessource(ressource, pos);
|
|
this.currentCreneauGroup = this.timeline.addRessource(ressource, pos);
|
|
|
this.currentCreneauGroup.selected = true;
|
|
this.currentCreneauGroup.selected = true;
|
|
|
|
|
|
|
|
- this.$store.commit(MutationTypes.addCreneauGroupAt, {
|
|
|
|
|
|
|
+ this.commit(MutationTypes.addCreneauGroupAt, {
|
|
|
pos: this.timeline.getRessources().indexOf(this.currentCreneauGroup),
|
|
pos: this.timeline.getRessources().indexOf(this.currentCreneauGroup),
|
|
|
r: this.currentCreneauGroup,
|
|
r: this.currentCreneauGroup,
|
|
|
});
|
|
});
|
|
@@ -179,7 +181,7 @@ export default defineComponent({
|
|
|
});
|
|
});
|
|
|
newCreneau.title = "Copie de " + newCreneau.title;
|
|
newCreneau.title = "Copie de " + newCreneau.title;
|
|
|
this.timeline.addEvent(newCreneau.event);
|
|
this.timeline.addEvent(newCreneau.event);
|
|
|
- this.$store.commit(MutationTypes.addCreneau, newCreneau);
|
|
|
|
|
|
|
+ this.commit(MutationTypes.addCreneau, newCreneau);
|
|
|
this.currentCreneau = newCreneau;
|
|
this.currentCreneau = newCreneau;
|
|
|
},
|
|
},
|
|
|
duplicateCurrentRessource() {
|
|
duplicateCurrentRessource() {
|
|
@@ -196,12 +198,10 @@ export default defineComponent({
|
|
|
},
|
|
},
|
|
|
deleteRessource(ressource: Ressource): void {
|
|
deleteRessource(ressource: Ressource): void {
|
|
|
const contentRemoved = this.timeline.removeRessourceById(ressource.id);
|
|
const contentRemoved = this.timeline.removeRessourceById(ressource.id);
|
|
|
- contentRemoved.ressources.map((r) =>
|
|
|
|
|
- this.$store.commit(MutationTypes.removeCreneauGroup, r.id)
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ contentRemoved.ressources.map((r) => this.commit(MutationTypes.removeCreneauGroup, r.id));
|
|
|
contentRemoved.items.map((e) => {
|
|
contentRemoved.items.map((e) => {
|
|
|
const crenenau = this.$store.getters.getCreneauById(e.id);
|
|
const crenenau = this.$store.getters.getCreneauById(e.id);
|
|
|
- if (crenenau) this.$store.commit(MutationTypes.removeCreneau, crenenau.id);
|
|
|
|
|
|
|
+ if (crenenau) this.commit(MutationTypes.removeCreneau, crenenau.id);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
deleteCurrentRessource(): void {
|
|
deleteCurrentRessource(): void {
|
|
@@ -209,7 +209,7 @@ export default defineComponent({
|
|
|
},
|
|
},
|
|
|
deleteCreneau(creneau: Creneau) {
|
|
deleteCreneau(creneau: Creneau) {
|
|
|
this.timeline.removeEventById(creneau.id);
|
|
this.timeline.removeEventById(creneau.id);
|
|
|
- this.$store.commit(MutationTypes.removeCreneau, creneau.id);
|
|
|
|
|
|
|
+ this.commit(MutationTypes.removeCreneau, creneau.id);
|
|
|
},
|
|
},
|
|
|
deleteCurrentCreneau(): void {
|
|
deleteCurrentCreneau(): void {
|
|
|
if (this.currentCreneau) this.deleteCreneau(this.currentCreneau);
|
|
if (this.currentCreneau) this.deleteCreneau(this.currentCreneau);
|
|
@@ -238,17 +238,17 @@ export default defineComponent({
|
|
|
|
|
|
|
|
for (let index = 0; index < jcEvents.length; index++) {
|
|
for (let index = 0; index < jcEvents.length; index++) {
|
|
|
const element = jcEvents[index];
|
|
const element = jcEvents[index];
|
|
|
- this.$store.commit(MutationTypes.editCreneau, {
|
|
|
|
|
|
|
+ this.commit(MutationTypes.editCreneau, {
|
|
|
id: element.id,
|
|
id: element.id,
|
|
|
field: "start",
|
|
field: "start",
|
|
|
value: element.start,
|
|
value: element.start,
|
|
|
});
|
|
});
|
|
|
- this.$store.commit(MutationTypes.editCreneau, {
|
|
|
|
|
|
|
+ this.commit(MutationTypes.editCreneau, {
|
|
|
id: element.id,
|
|
id: element.id,
|
|
|
field: "end",
|
|
field: "end",
|
|
|
value: element.end,
|
|
value: element.end,
|
|
|
});
|
|
});
|
|
|
- this.$store.commit(MutationTypes.editCreneau, {
|
|
|
|
|
|
|
+ this.commit(MutationTypes.editCreneau, {
|
|
|
id: element.id,
|
|
id: element.id,
|
|
|
field: "ressourceId",
|
|
field: "ressourceId",
|
|
|
value: element.ressourceId,
|
|
value: element.ressourceId,
|
|
@@ -257,7 +257,7 @@ export default defineComponent({
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
ressourceChangeHandler(ev: CustomEvent<{ ressources: Array<Ressource> }>) {
|
|
ressourceChangeHandler(ev: CustomEvent<{ ressources: Array<Ressource> }>) {
|
|
|
- this.$store.commit(
|
|
|
|
|
|
|
+ this.commit(
|
|
|
MutationTypes.reorderCreneauGroup,
|
|
MutationTypes.reorderCreneauGroup,
|
|
|
ev.detail.ressources.map((o) => o.id)
|
|
ev.detail.ressources.map((o) => o.id)
|
|
|
);
|
|
);
|
|
@@ -273,11 +273,11 @@ export default defineComponent({
|
|
|
if (r) {
|
|
if (r) {
|
|
|
payload.value = r[payload.field];
|
|
payload.value = r[payload.field];
|
|
|
}
|
|
}
|
|
|
- this.$store.commit(MutationTypes.editCreneauGroup, payload);
|
|
|
|
|
|
|
+ this.commit(MutationTypes.editCreneauGroup, payload);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
updateCreneau<K extends keyof Creneau>(payload: { id: string; field: K; value: Creneau[K] }) {
|
|
updateCreneau<K extends keyof Creneau>(payload: { id: string; field: K; value: Creneau[K] }) {
|
|
|
- this.$store.commit(MutationTypes.editCreneau, payload);
|
|
|
|
|
|
|
+ this.commit(MutationTypes.editCreneau, payload);
|
|
|
const creneau = this.$store.getters.getCreneauById(payload.id);
|
|
const creneau = this.$store.getters.getCreneauById(payload.id);
|
|
|
if (creneau) {
|
|
if (creneau) {
|
|
|
this.timeline.removeEventById(payload.id);
|
|
this.timeline.removeEventById(payload.id);
|
|
@@ -410,7 +410,7 @@ export default defineComponent({
|
|
|
this.timeline.setAttribute("start", this.start.toISOString());
|
|
this.timeline.setAttribute("start", this.start.toISOString());
|
|
|
this.timeline.setAttribute("end", this.end.toISOString());
|
|
this.timeline.setAttribute("end", this.end.toISOString());
|
|
|
this.timeline.addRessources(this.creneauGroupList);
|
|
this.timeline.addRessources(this.creneauGroupList);
|
|
|
- this.$store.commit(
|
|
|
|
|
|
|
+ this.commit(
|
|
|
MutationTypes.reorderCreneauGroup,
|
|
MutationTypes.reorderCreneauGroup,
|
|
|
this.timeline.getRessources().map((o) => o.id)
|
|
this.timeline.getRessources().map((o) => o.id)
|
|
|
);
|
|
);
|