Changed the way that we define end dates.
This commit is contained in:
@@ -6,6 +6,13 @@ if ( in_array("cmd", array_keys($_GET)) and $_GET["cmd"] == "get" ) {
|
||||
$ret = getEvents();
|
||||
} elseif ( $_POST["cmd"] == "put" ) {
|
||||
$json = base64_decode($_POST["payload"]);
|
||||
$events = json_decode($json, true);
|
||||
for ( $i = 0; $i < count($events); $i++ ) {
|
||||
foreach ( array( "hours", "agenda", "minutes" ) as $field ) {
|
||||
unset($events[$i][$field]);
|
||||
}
|
||||
}
|
||||
$json = json_encode($events, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
||||
file_put_contents("dat/events.json", $json);
|
||||
$ret = getEvents();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ Vue.createApp({
|
||||
if (now.isSameOrAfter(next7pm)) {
|
||||
next7pm.add(1, 'day');
|
||||
}
|
||||
const twoHoursLater = moment(next7pm).add(2, 'hours');
|
||||
event.hours = 2.5;
|
||||
const twoHoursLater = moment(next7pm).add(event.hours, 'hours');
|
||||
event.start = next7pm.format('YYYY-MM-DDTHH:mm');
|
||||
event.end = twoHoursLater.format('YYYY-MM-DDTHH:mm');
|
||||
this.events.unshift(event);
|
||||
@@ -63,6 +64,9 @@ Vue.createApp({
|
||||
validateEvents: function() {
|
||||
var faults = [];
|
||||
for ( var e in this.events ) {
|
||||
var start = moment(this.events[e].start);
|
||||
var end = start.add(this.events[e].hours, 'hours');
|
||||
this.events[e].end = end.format('YYYY-MM-DDTHH:mm');
|
||||
for ( var k in this.fields ) {
|
||||
var value = this.events[e][k];
|
||||
value = ( value == undefined ? '' : value );
|
||||
@@ -117,7 +121,7 @@ Vue.createApp({
|
||||
this.validateEvents();
|
||||
},
|
||||
modalCancel: function() {
|
||||
frm.modal = null;
|
||||
this.frm.modal = null;
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
|
||||
@@ -62,10 +62,14 @@
|
||||
<input type="text" disabled class="form-control" :value="formatDate(events[frm.e].start)" v-on:keyup="validateEvents">
|
||||
<button class="btn btn-outline-secondary" type="button" v-on:click="modal('start')">...</button>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text">Duration</span>
|
||||
<input type="number" min="0.5" step="0.5" class="form-control" v-model="events[frm.e].hours" v-on:keyup="validateEvents" v-on:change="validateEvents" style="text-align: right;">
|
||||
<span class="input-group-text">hrs</span>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text">End</span>
|
||||
<input type="text" disabled class="form-control" :value="formatDate(events[frm.e].end)" v-on:keyup="validateEvents">
|
||||
<button class="btn btn-outline-secondary" type="button" v-on:click="modal('end')">...</button>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text">Location</span>
|
||||
|
||||
Reference in New Issue
Block a user