|
|
@@ -0,0 +1,168 @@
|
|
|
+<template>
|
|
|
+ <div class="planning-view-container">
|
|
|
+ <div class="planning-view-panel">
|
|
|
+ <div
|
|
|
+ class="item"
|
|
|
+ :class="{ selected: view.uuid == currentPlanningView.uuid }"
|
|
|
+ v-for="view in planningViewList"
|
|
|
+ :key="view.uuid"
|
|
|
+ @click="loadView(view.uuid)"
|
|
|
+ >
|
|
|
+ {{ view.name }}
|
|
|
+ <i class="material-icons inline button" @click="showEdit = true">edit</i>
|
|
|
+ </div>
|
|
|
+ <div class="item" @click="newView">
|
|
|
+ <i class="material-icons inline">add</i> Ajouter une vue
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="planning-view-timeline" v-if="currentPlanningView != null">
|
|
|
+ <planning-view-renderer :planningView="currentPlanningView" />
|
|
|
+ </div>
|
|
|
+ <div v-else>Veuillez créer ou charge une vue</div>
|
|
|
+ </div>
|
|
|
+ <div v-if="showEdit && currentPlanningView != null" class="modal" @click="closeEdit">
|
|
|
+ <div class="modal-content" ref="edit">
|
|
|
+ <styled-input label="Titre" id="planning-view-title" v-model="currentPlanningView.name" />
|
|
|
+ <date-picker
|
|
|
+ label="Début"
|
|
|
+ id="planning-view-start"
|
|
|
+ lang="fr"
|
|
|
+ target="hour"
|
|
|
+ v-model="currentPlanningView.start"
|
|
|
+ />
|
|
|
+ <date-picker
|
|
|
+ label="Fin"
|
|
|
+ id="planning-view-end"
|
|
|
+ lang="fr"
|
|
|
+ target="hour"
|
|
|
+ v-model="currentPlanningView.end"
|
|
|
+ />
|
|
|
+ <select-chip-input
|
|
|
+ title="Ligne"
|
|
|
+ placeholder="Selectionner les lignes à afficher dans ce planning"
|
|
|
+ secondaryPlaceholder="Rajouter une ligne"
|
|
|
+ v-model="currentPlanningView.ressourceUuidList"
|
|
|
+ :autocompleteList="autocompleteList"
|
|
|
+ />
|
|
|
+ <button class="btn small error" v-on:click="deleteVue">
|
|
|
+ <i class="material-icons">delete_forever</i>Supprimer cette vue
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts">
|
|
|
+import { PlanningView } from "@/models/PlanningView";
|
|
|
+import DatePicker from "@/components/date-picker.vue";
|
|
|
+import styledInput from "@/components/input.vue";
|
|
|
+import SelectChipInput from "@/components/SelectChipInput.vue";
|
|
|
+
|
|
|
+import PlanningViewRenderer from "@/components/PlanningViewRenderer.vue";
|
|
|
+import { v4 as uuidv4 } from "uuid";
|
|
|
+import { defineComponent } from "vue";
|
|
|
+import AutocompleteValues from "@/models/AutocompleteOptions";
|
|
|
+
|
|
|
+const API_URL = process.env.VUE_APP_API_URL;
|
|
|
+
|
|
|
+export default defineComponent({
|
|
|
+ components: { PlanningViewRenderer, DatePicker, styledInput, SelectChipInput },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ showEdit: false,
|
|
|
+ currentPlanningView: null as null | PlanningView,
|
|
|
+ planningViewList: [] as Array<PlanningView>,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ autocompleteList(): Array<AutocompleteValues> {
|
|
|
+ return this.$store.state.creneauGroupList
|
|
|
+ .filter((r) => r.parentId == "")
|
|
|
+ .map((o) => {
|
|
|
+ return { id: o.id.toString(), name: o.title };
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ closeEdit(e: MouseEvent) {
|
|
|
+ if (!(this.$refs.edit as HTMLElement).contains(e.target as Node)) this.showEdit = false;
|
|
|
+ },
|
|
|
+ newView() {
|
|
|
+ const evt = this.$store.state.evenement;
|
|
|
+ const planning: PlanningView = {
|
|
|
+ uuid: uuidv4(),
|
|
|
+ planningUuid: evt.uuid,
|
|
|
+ name: "Nouvelle vue",
|
|
|
+ start: evt.start,
|
|
|
+ end: evt.end,
|
|
|
+ ressourceUuidList: [],
|
|
|
+ };
|
|
|
+ this.currentPlanningView = planning;
|
|
|
+ this.planningViewList.push(planning);
|
|
|
+ },
|
|
|
+ deleteVue() {
|
|
|
+ if (this.currentPlanningView && confirm("Êtes vous sûr de vouloir supprimer cette vue?")) {
|
|
|
+ const uuid = this.currentPlanningView.uuid;
|
|
|
+ this.planningViewList = this.planningViewList.filter((p) => p.uuid != uuid);
|
|
|
+ this.currentPlanningView = null;
|
|
|
+ this.showEdit = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ loadView(uuid: string) {
|
|
|
+ this.currentPlanningView = this.planningViewList.find((p) => uuid == p.uuid) ?? null;
|
|
|
+ },
|
|
|
+ },
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.planning-view-container {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+.planning-view-panel {
|
|
|
+ display: block;
|
|
|
+ width: 200px;
|
|
|
+ margin: -8px 0 0 -8px;
|
|
|
+}
|
|
|
+.planning-view-panel > .item {
|
|
|
+ padding: 16px;
|
|
|
+ white-space: nowrap;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+.planning-view-panel > .item.selected {
|
|
|
+ background: var(--color-accent-600);
|
|
|
+ color: var(--color-neutral-100);
|
|
|
+}
|
|
|
+.planning-view-panel > .item:hover {
|
|
|
+ background: var(--color-accent-900);
|
|
|
+}
|
|
|
+.planning-view-timeline {
|
|
|
+ padding: 0px 8px;
|
|
|
+ width: calc(100% - 200px);
|
|
|
+}
|
|
|
+@media print {
|
|
|
+ .planning-view-panel {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ .planning-view-timeline {
|
|
|
+ padding: 0;
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+}
|
|
|
+.material-icons.inline {
|
|
|
+ vertical-align: bottom;
|
|
|
+ font-size: 20px;
|
|
|
+}
|
|
|
+.material-icons.button {
|
|
|
+ position: relative;
|
|
|
+ padding: 0px 4px;
|
|
|
+}
|
|
|
+.material-icons.button:hover {
|
|
|
+ position: relative;
|
|
|
+ padding: 4px;
|
|
|
+ margin: -4px 0px;
|
|
|
+ border-radius: 4px;
|
|
|
+ background: var(--color-accent-800);
|
|
|
+}
|
|
|
+</style>
|