Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Commit

Permalink
Added Modal support
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothindir committed Jun 21, 2019
1 parent 07f8a5e commit 2b00b04
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/views/Planification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
editable="true"
selectable="true"
droppable="true"
event-limit="true"
v-on:select="selectionChanged"
v-on:dateClick="dateChanged"
:slot-label-format="slotLabelFormat"
Expand All @@ -30,7 +31,9 @@
:views="{
weekTimeGridView
}"
class="z-10"
/>
<AddEventModal ref="addEventModal" v-show="showModal" v-on:close="showModal = false"></AddEventModal>
</div>
</template>

Expand All @@ -41,16 +44,19 @@
import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import interactionPlugin, { Draggable } from '@fullcalendar/interaction';
import frLocale from '../assets/js/cm-fr'
import frLocale from '../assets/js/cm-fr';
import AddEventModal from "../components/AddEventModal";
const { ipcRenderer } = require('electron');
export default {
name: 'home',
directives: {
resize
},
components: {
AddEventModal,
FullCalendar
},
data() {
Expand All @@ -72,7 +78,7 @@
customButtons: {
addEventButton: {
text: "Nouvelle activité",
click: this.newEvent
click: this.showModalDialog
}
},
selectionInfo: null,
Expand Down Expand Up @@ -139,13 +145,26 @@
/* Stores the current selected dateTime */
dateChanged: function(dateInfo) {
this.selectionInfo = null;
this.newEvent({
this.showModalDialog({
start: dateInfo.date,
title: 'New event',
color: 'red',
allDay: dateInfo.allDay
});
},
showModalDialog: function(eventInfo){
this.showModal = true;
this.$refs.addEventModal.$once('submit', () => {
console.log('Modal submitted data');
this.showModal = false;
this.newEvent(eventInfo);
});
},
clearModalDialog: function(){
this.showModal = false;
this.selectionInfo = null;
this.selectedDate = null;
},
/* Creates a new event from the selection data */
newEvent: function (eventInfo) {
let event = {};
Expand Down

0 comments on commit 2b00b04

Please sign in to comment.