- prerobenie settings handleru - presunutie do ~/data folderu - odstranenie starych suborov - pridanie parsovania settings.json - obsluha SPFFS
136 lines
6.1 KiB
HTML
136 lines
6.1 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
|
|
|
|
|
<!-- <link rel="stylesheet" type="text/css" href="css/bootstrap-datetimepicker.css"> -->
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/css/bootstrap-datetimepicker.min.css">
|
|
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/css/bootstrap-datetimepicker-standalone.css">
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/js/bootstrap-datetimepicker.min.js"></script>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/vue-bootstrap-datetimepicker@5"></script>
|
|
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
|
|
<!-- Optional JavaScript -->
|
|
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
|
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>
|
|
|
|
<div id="app" class="container">
|
|
<h1 align="center">Budík</h1>
|
|
<div v-for="(setting,index) in settings" :key="setting.kedy" class="row">
|
|
<div data-form-number=0 class='form-row'>
|
|
<template v-if="setting.edit === true">
|
|
<div class="form-group col-sm-3">
|
|
<select v-model="setting.kedy" class="form-control mr-sm-2" id="inlineFormCustomSelect">
|
|
<option v-for="(item, key, index) in w" v-bind:value="key" >{{ item }}</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group col-sm-3">
|
|
<div class='input-group time' id='datetimepicker2'>
|
|
<date-picker :config="{format: 'HH:mm'}" v-model="setting.cas" ></date-picker>
|
|
<span class="input-group-addon">
|
|
<span class="glyphicon glyphicon-time"></span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
<div class='input-group time' id='datetimepicker3'>
|
|
<date-picker v-model="setting.datum" :config="{format: 'D.M.YYYY'}" class="form-control"></date-picker>
|
|
<span class="input-group-addon">
|
|
<span class="glyphicon glyphicon-calendar"></span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<template v-else>
|
|
<div class="form-group col-sm-3">
|
|
{{ when[setting.kedy] }}
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
{{ setting.cas }}
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
{{ setting.datum }}
|
|
</div>
|
|
</template>
|
|
<div class="btn-toolbar col-sm-3" role="toolbar" aria-label="Toolbar with button groups">
|
|
<div class="btn-group mr-2" role="group" aria-label="First group">
|
|
<button v-on:click="changePlus(index)" type="button" class="btn btn-secondary glyphicon glyphicon-plus"></button>
|
|
<button v-on:click="changeMinus(index)" type="button" class="btn btn-secondary glyphicon glyphicon-minus"></button>
|
|
<button v-on:click="changeEdit(index)" type="button" class="btn btn-secondary glyphicon glyphicon-edit"></button>
|
|
<button v-on:click="changeSave(index)" type="button" class="btn btn-secondary glyphicon glyphicon-save"></button>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<button v-on:click="postChanges" type="button" class="btn btn-primary btn-lg">Ulož</button>
|
|
</div>
|
|
<script type="text/javascript">
|
|
|
|
$(function () {
|
|
|
|
settings = %%SETTINGS%%;
|
|
settings = settings["data"];
|
|
|
|
when = { 0 : "Pracovne dni",
|
|
1 : "Vikendy",
|
|
2 : "Zajtra",
|
|
3 : "Iba raz"
|
|
};
|
|
|
|
Vue.component('date-picker', VueBootstrapDatetimePicker);
|
|
|
|
var app = new Vue({
|
|
el: '#app',
|
|
data: {
|
|
settings: settings,
|
|
w: when,
|
|
cas: null
|
|
},
|
|
methods: {
|
|
changePlus: function (index) {
|
|
this.settings.push({ "kedy": 0, "cas": "", "datum":"", "edit": true});
|
|
},
|
|
changeMinus: function(index) {
|
|
this.settings.splice(index,1);
|
|
},
|
|
changeEdit: function (index) {
|
|
this.settings[index].edit = true;
|
|
},
|
|
changeSave: function (index) {
|
|
this.settings[index].edit = false;
|
|
},
|
|
postChanges: function () {
|
|
console.log("SAVE CHANGES TO ESP");
|
|
|
|
axios.post('/settings', {
|
|
data: this.settings
|
|
})
|
|
.then(function (response) {
|
|
console.log(response);
|
|
})
|
|
.catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html> |