|
@@ -73,11 +73,24 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="col-md-9">
|
|
|
- <div class="d-flex align-items-center mb-2">
|
|
|
+ <div class="d-flex align-items-end mb-3">
|
|
|
<b class="large">@{{ selectedDate }}</b>
|
|
|
- <div class="ml-auto">Tabs</div>
|
|
|
+ <div class="ml-auto">
|
|
|
+ <label class="text-secondary">Filter by status:</label>
|
|
|
+ <select v-model="filterStatus"
|
|
|
+ class="form-control form-control-sm"
|
|
|
+ v-on:change="updateNumEventsForDate()">
|
|
|
+ <option value="">ALL</option>
|
|
|
+ <option value="CREATED">CREATED</option>
|
|
|
+ <option value="CONFIRMED">CONFIRMED</option>
|
|
|
+ <option value="CANCELLED">CANCELLED</option>
|
|
|
+ <option value="COMPLETED">COMPLETED</option>
|
|
|
+ <option value="ABANDONED">ABANDONED</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div v-for="event in events" class="align-items-start p-3 border" :class="event.dateYMD === selectedDate ? 'd-flex' : 'd-none'">
|
|
|
+ <div v-for="event in events" class="align-items-end p-3 border rounded mb-3"
|
|
|
+ :class="event.dateYMD === selectedDate && (filterStatus === '' || filterStatus === event.status) ? 'd-flex' : 'd-none'">
|
|
|
<div class="patient-avatar mr-3">@{{ event.clientInitials }}</div>
|
|
|
<div>
|
|
|
<div class="font-weight-bold pb-1">
|
|
@@ -93,6 +106,25 @@
|
|
|
Status: <b class="text-secondary">@{{ event.status }}</b>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="ml-auto">
|
|
|
+ <select v-model="event.newStatus"
|
|
|
+ class="form-control form-control-sm"
|
|
|
+ v-on:change="updateStatus(event)">
|
|
|
+ <option value="CREATED">CREATED</option>
|
|
|
+ <option value="CONFIRMED">CONFIRMED</option>
|
|
|
+ <option value="CANCELLED">CANCELLED</option>
|
|
|
+ <option value="COMPLETED">COMPLETED</option>
|
|
|
+ <option value="ABANDONED">ABANDONED</option>
|
|
|
+ </select>
|
|
|
+ <div v-if="selectedDate === '{{ date('Y-m-d') }}'"
|
|
|
+ class="pt-1 text-right" :class="event.started ? 'text-danger': 'text-secondary'">
|
|
|
+ @{{ event.inHowManyHours }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-if="numEventsForDate === 0" class="bg-light p-3 text-secondary border bounded">
|
|
|
+ <span v-if="filterStatus === ''">You have no appointments on <b>@{{ selectedDate }}</b></span>
|
|
|
+ <span v-if="filterStatus !== ''">You have no appointments on <b>@{{ selectedDate }}</b> with status <b>@{{ filterStatus }}</b></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -108,12 +140,14 @@
|
|
|
selectedDate: '{{ date('Y-m-d') }}',
|
|
|
selectedStatus: 'CREATED',
|
|
|
events: {!! json_encode($appointments) !!},
|
|
|
+ numEventsForDate: 0,
|
|
|
+ filterStatus: '',
|
|
|
},
|
|
|
methods: {
|
|
|
onDateChange: function (_newDate) {
|
|
|
this.highlightDatesWithEvents();
|
|
|
this.selectedDate = _newDate;
|
|
|
- console.log('Showing events for ' + _newDate);
|
|
|
+ this.updateNumEventsForDate();
|
|
|
},
|
|
|
selectToday: function () {
|
|
|
$('.pro-dashboard-inline-calendar table td[data-date]').removeClass('active');
|
|
@@ -127,6 +161,34 @@
|
|
|
$('.pro-dashboard-inline-calendar table td[data-date="' + this.events[i].milliseconds + '"]')
|
|
|
.attr('has-events', 1);
|
|
|
}
|
|
|
+ },
|
|
|
+ updateNumEventsForDate: function() {
|
|
|
+ this.numEventsForDate = 0;
|
|
|
+ for (let i = 0; i < this.events.length; i++) {
|
|
|
+ if(this.events[i].dateYMD === this.selectedDate &&
|
|
|
+ (this.filterStatus === '' || this.filterStatus === this.events[i].status)) {
|
|
|
+ this.numEventsForDate++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateStatus: function(_event) {
|
|
|
+ $.post('/api/appointment/updateStatus', {
|
|
|
+ uid: _event.uid,
|
|
|
+ status: _event.newStatus
|
|
|
+ }, function(_data) {
|
|
|
+ if(!_data) {
|
|
|
+ toastr.error('Unable to update appointment status!');
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if(!_data.success) {
|
|
|
+ toastr.error(_data.message);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ _event.status = _event.newStatus;
|
|
|
+ toastr.success('The appointment has been updated');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 'json')
|
|
|
}
|
|
|
},
|
|
|
mounted: function () {
|
|
@@ -138,6 +200,7 @@
|
|
|
self.onDateChange(calendarElem.datepicker('getFormattedDate'));
|
|
|
});
|
|
|
self.selectToday();
|
|
|
+ self.updateNumEventsForDate();
|
|
|
console.log(this.events)
|
|
|
}
|
|
|
});
|