Washing Reservation dynamic content
This commit is contained in:
Vendored
-57
@@ -1,8 +1,3 @@
|
||||
/**
|
||||
* First we will load all of this project's JavaScript dependencies which
|
||||
* includes Vue and other libraries. It is a great starting point when
|
||||
* building robust, powerful web applications using Vue and Laravel.
|
||||
*/
|
||||
//Bootstrap
|
||||
require('./bootstrap');
|
||||
|
||||
@@ -17,58 +12,6 @@ require('./sites/menuplan');
|
||||
//Webapp hamburger menu
|
||||
import { toggleMenu } from './navmenu/menu';
|
||||
|
||||
// require("./calendar/calendar");
|
||||
|
||||
// import { nextMonth, previousMonth, countDays, createCalendar, months, month, currentMonth, days, calendar } from "./calendar/calendar";
|
||||
|
||||
// window.Vue = require('vue');
|
||||
|
||||
import { generateCalendar } from "./calendar/calendar";
|
||||
|
||||
// createCalendar();
|
||||
//
|
||||
// document.getElementById("month-next").onclick = nextMonth;
|
||||
// document.getElementById("month-previous").onclick = previousMonth;
|
||||
|
||||
/**
|
||||
* The following block of code may be used to automatically register your
|
||||
* Vue components. It will recursively scan this directory for the Vue
|
||||
* components and automatically register them with their "basename".
|
||||
*
|
||||
* Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
|
||||
*/
|
||||
|
||||
// const files = require.context('./', true, /\.vue$/i)
|
||||
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
|
||||
|
||||
// Vue.component('example-component', require('./components/ExampleComponent.vue').default);
|
||||
|
||||
/**
|
||||
* Next, we will create a fresh Vue application instance and attach it to
|
||||
* the page. Then, you may begin adding components to this application
|
||||
* or customize the JavaScript scaffolding to fit your unique needs.
|
||||
*/
|
||||
|
||||
// const app = new Vue({
|
||||
// el: '#app',
|
||||
// });
|
||||
|
||||
let weekOffset = 0;
|
||||
|
||||
if(document.getElementById("calendar")) {
|
||||
generateCalendar();
|
||||
|
||||
document.getElementById("week-previous").onclick = function () {
|
||||
weekOffset--;
|
||||
generateCalendar(weekOffset);
|
||||
}
|
||||
|
||||
document.getElementById("week-next").onclick = function () {
|
||||
weekOffset++;
|
||||
generateCalendar(weekOffset);
|
||||
}
|
||||
}
|
||||
|
||||
if(document.getElementById("toggle"))
|
||||
document.getElementById("toggle").onclick = function () {
|
||||
toggleMenu('menu');
|
||||
|
||||
+74
-84
@@ -1,34 +1,5 @@
|
||||
// class Calendar {
|
||||
// constructor() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// nextMonth() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// previousMonth() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// addEvent() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// removeEvent() {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
const moment = require("moment");
|
||||
|
||||
// const calendar = document.getElementById("calendar");
|
||||
// const title = document.getElementById("month");
|
||||
|
||||
|
||||
|
||||
// calendar.innerHTML = "";
|
||||
|
||||
function generateCalendar(weekOffset = 0) {
|
||||
const week = (moment().week() + weekOffset);
|
||||
|
||||
@@ -107,73 +78,96 @@ function onDateSelect(date, dayHolder) {
|
||||
|
||||
dayHolder.classList.add("selected");
|
||||
|
||||
if(document.getElementById("washing-machines") != undefined)
|
||||
machinez = document.getElementById("washing-machines");
|
||||
else {
|
||||
let span = document.createElement("span");
|
||||
span.classList.add("events__title");
|
||||
span.innerText = "Maskiner";
|
||||
|
||||
let select = document.createElement("select");
|
||||
select.classList.add("events__title");
|
||||
select.id = "washing-machines";
|
||||
axios({
|
||||
method: 'get',
|
||||
url: '/washing-reservationsapi',
|
||||
data: { date: date }
|
||||
}).then(function (response) {
|
||||
var data = response.data();
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
container.appendChild(span);
|
||||
container.appendChild(select);
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: "/washing-reservationsapi",
|
||||
data: {'date': date},
|
||||
success:function (data) {
|
||||
console.log(data);
|
||||
|
||||
machinez = document.getElementById("washing-machines");
|
||||
}
|
||||
if(document.getElementById("events") != undefined)
|
||||
events = document.getElementById("events");
|
||||
else {
|
||||
let span = document.createElement("span");
|
||||
span.classList.add("events__title");
|
||||
span.innerText = "Tider";
|
||||
/*if(document.getElementById("washing-machines") != undefined)
|
||||
machinez = document.getElementById("washing-machines");
|
||||
else {
|
||||
let span = document.createElement("span");
|
||||
span.classList.add("events__title");
|
||||
span.innerText = "Maskiner";
|
||||
|
||||
let select = document.createElement("select");
|
||||
select.classList.add("events__title");
|
||||
select.id = "events";
|
||||
let select = document.createElement("select");
|
||||
select.classList.add("events__title");
|
||||
select.id = "washing-machines";
|
||||
|
||||
container.appendChild(span);
|
||||
container.appendChild(select);
|
||||
container.appendChild(span);
|
||||
container.appendChild(select);
|
||||
|
||||
events = document.getElementById("events");
|
||||
}
|
||||
if(document.getElementById("create-reservation") != undefined)
|
||||
buttonz = document.getElementById("create-reservation");
|
||||
else {
|
||||
let button = document.createElement("button");
|
||||
machinez = document.getElementById("washing-machines");
|
||||
}
|
||||
if(document.getElementById("events") != undefined)
|
||||
events = document.getElementById("events");
|
||||
else {
|
||||
let span = document.createElement("span");
|
||||
span.classList.add("events__title");
|
||||
span.innerText = "Tider";
|
||||
|
||||
button.id = "create-reservation";
|
||||
button.innerText = "Reserver";
|
||||
let select = document.createElement("select");
|
||||
select.classList.add("events__title");
|
||||
select.id = "events";
|
||||
|
||||
container.appendChild(button);
|
||||
container.appendChild(span);
|
||||
container.appendChild(select);
|
||||
|
||||
buttonz = document.getElementById("events");
|
||||
}
|
||||
events = document.getElementById("events");
|
||||
}
|
||||
if(document.getElementById("create-reservation") != undefined)
|
||||
buttonz = document.getElementById("create-reservation");
|
||||
else {
|
||||
let button = document.createElement("button");
|
||||
|
||||
const machines = [
|
||||
"Maskine 1",
|
||||
"Maskine 2"
|
||||
]
|
||||
button.id = "create-reservation";
|
||||
button.innerText = "Reserver";
|
||||
|
||||
machinez.innerHTML = "";
|
||||
for (let i = 0; i < machines.length; i++) {
|
||||
let option = document.createElement("option");
|
||||
option.text = machines[i];
|
||||
container.appendChild(button);
|
||||
|
||||
machinez.appendChild(option);
|
||||
}
|
||||
buttonz = document.getElementById("events");
|
||||
}
|
||||
|
||||
const machines = [
|
||||
"Maskine 1",
|
||||
"Maskine 2"
|
||||
]
|
||||
|
||||
machinez.innerHTML = "";
|
||||
for (let i = 0; i < machines.length; i++) {
|
||||
let option = document.createElement("option");
|
||||
option.text = machines[i];
|
||||
|
||||
machinez.appendChild(option);
|
||||
}
|
||||
|
||||
|
||||
events.innerHTML = "";
|
||||
for (let hour = 8; hour <= 20; hour++) {
|
||||
events.innerHTML = "";
|
||||
for (let hour = 8; hour <= 20; hour++) {
|
||||
|
||||
let option = document.createElement("option");
|
||||
option.text = prependZero(hour);
|
||||
let option = document.createElement("option");
|
||||
option.text = prependZero(hour);
|
||||
|
||||
events.appendChild(option);
|
||||
}
|
||||
events.appendChild(option);
|
||||
}*/
|
||||
},
|
||||
error:function (data) {
|
||||
console.log("FEJL");
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function prependZero(value) {
|
||||
@@ -181,7 +175,3 @@ function prependZero(value) {
|
||||
return "0" + value;
|
||||
return value;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
generateCalendar
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user