Comment whe rejecting or canceling reservation
This commit is contained in:
@ -102,6 +102,7 @@
|
||||
</div>
|
||||
|
||||
@include('ventas.reservations.modal.add')
|
||||
@include('ventas.reservations.modal.comment')
|
||||
@endsection
|
||||
|
||||
@push('page_styles')
|
||||
@ -376,6 +377,9 @@
|
||||
hide() {
|
||||
this.component.style.display = 'none'
|
||||
}
|
||||
find(id) {
|
||||
return this.reservations.find(reservation => reservation.id === parseInt(id))
|
||||
}
|
||||
send = {
|
||||
get(url) {
|
||||
return APIClient.fetch(url).then(response => response.json()).then(json => {
|
||||
@ -392,14 +396,6 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
delete(url) {
|
||||
const method = 'delete'
|
||||
return APIClient.fetch(url, {method}).then(response => response.json()).then(json => {
|
||||
if (json.success) {
|
||||
window.location.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
actions = {}
|
||||
}
|
||||
@ -436,9 +432,12 @@
|
||||
},
|
||||
remove: event => {
|
||||
event.preventDefault()
|
||||
const id = event.currentTarget.dataset.id
|
||||
const url = `{{ $urls->api }}/ventas/reservation/${id}/remove`
|
||||
this.send.delete(url)
|
||||
const reservation_id = event.currentTarget.dataset.id
|
||||
const url = `{{ $urls->api }}/ventas/reservation/${reservation_id}/remove`
|
||||
const method = 'delete'
|
||||
const action = 'Cancelar'
|
||||
const reservation_data = this.find(reservation_id)
|
||||
reservations.components.modals.comment.show({reservation_id, action, url, method, reservation_data})
|
||||
return false
|
||||
}
|
||||
}
|
||||
@ -459,9 +458,12 @@
|
||||
},
|
||||
reject: event => {
|
||||
event.preventDefault()
|
||||
const id = event.currentTarget.dataset.id
|
||||
const url = `{{ $urls->api }}/ventas/reservation/${id}/reject`
|
||||
this.send.get(url)
|
||||
const reservation_id = event.currentTarget.dataset.id
|
||||
const url = `{{ $urls->api }}/ventas/reservation/${reservation_id}/reject`
|
||||
const method = 'delete'
|
||||
const action = 'Rechazar'
|
||||
const reservation_data = this.find(reservation_id)
|
||||
reservations.components.modals.comment.show({reservation_id, action, url, method, reservation_data})
|
||||
return false
|
||||
}
|
||||
}
|
||||
@ -505,7 +507,8 @@
|
||||
rejected: null
|
||||
},
|
||||
modals: {
|
||||
add: null
|
||||
add: null,
|
||||
comment: null,
|
||||
}
|
||||
},
|
||||
display: {
|
||||
@ -645,6 +648,7 @@
|
||||
this.show.projects()
|
||||
|
||||
this.components.modals.add = new AddReservationModal(configuration.ids.projects)
|
||||
this.components.modals.comment = new CommentModal()
|
||||
|
||||
const project_id = {{ $project_id ?? 'null' }};
|
||||
if (project_id !== null) {
|
||||
|
Reference in New Issue
Block a user