diff --git a/app/resources/views/layout/head.blade.php b/app/resources/views/layout/head.blade.php index 9d6c07f..c3969fd 100644 --- a/app/resources/views/layout/head.blade.php +++ b/app/resources/views/layout/head.blade.php @@ -5,6 +5,6 @@ @else Incoviba @endif - + @include('layout.head.styles') diff --git a/app/resources/views/ventas/reservations.blade.php b/app/resources/views/ventas/reservations.blade.php index 7048c79..3f7819d 100644 --- a/app/resources/views/ventas/reservations.blade.php +++ b/app/resources/views/ventas/reservations.blade.php @@ -101,6 +101,12 @@ + @include('layout.body.scripts.rut') + @include('ventas.reservations.modal.common.scripts.promotions') + @include('ventas.reservations.modal.common.scripts.units') + @include('ventas.reservations.modal.common.scripts.payments') + @include('ventas.reservations.modal.common.scripts.modal') + @include('ventas.reservations.modal.add') @include('ventas.reservations.modal.edit') @include('ventas.reservations.modal.comment') @@ -295,6 +301,7 @@ return this } } + get columnsData() { const columnValues = { id: reservation => reservation.id, @@ -321,6 +328,7 @@ return data }) } + draw() { return { tbody: () => { @@ -355,20 +363,46 @@ this.watch() }, actions: id => { - return ` - - - - ` + return [ + '', + this.draw().actionButtons().edit(id), + this.draw().actionButtons().approve(id), + this.draw().actionButtons().reject(id), + '' + ].join("\n") + }, + actionButtons: () => { + return { + edit: id => { + return [ + `' + ].join("\n") + }, + approve: id => { + return [ + `' + ].join("\n") + }, + reject: id => { + return [ + `' + ].join("\n") + } + } }, tooltip: () => { return { oferta: reservation => { - const formatter = new Intl.NumberFormat('es-CL', {minimumFractionDigits: 2, maximumFractionDigits: 2}) + const formatter = new Intl.NumberFormat('es-CL', { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) const output = [] const table = [''] @@ -401,7 +435,10 @@ return output.join("
") }, cliente: reservation => { - const formatter = new Intl.NumberFormat('es-CL', {minimumFractionDigits: 0, maximumFractionDigits: 0}) + const formatter = new Intl.NumberFormat('es-CL', { + minimumFractionDigits: 0, + maximumFractionDigits: 0 + }) return [ `RUT: ${formatter.format(reservation.buyer.rut)}-${reservation.buyer.digito}` ].join("
") @@ -410,6 +447,7 @@ } } } + watch() { if (Object.keys(this.actions).length === 0) { return @@ -427,6 +465,7 @@ }) }) } + empty() { const tbody = this.component.querySelector('tbody') tbody.innerHTML = '' @@ -437,15 +476,19 @@ this.show() } + show() { this.component.style.display = this.display.reservations } + 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 => { @@ -474,30 +517,49 @@ get columnsData() { const data = super.columnsData; return data.map(row => { - delete(row['valida']) + delete (row['valida']) return row }) } + draw() { const draw = super.draw() + const actionButtons = draw.actionButtons() + draw.actionButtons = () => { + actionButtons['promise'] = id => { + return [ + `' + ].join("\n") + } + actionButtons['remove'] = id => { + return [ + `' + ].join("\n") + } + return actionButtons + } draw.actions = (id) => { - return ` - ` + return [ + '' + ].join("\n") } return draw } + actions = { edit: event => { event.preventDefault() const id = event.currentTarget.dataset.id - reservations.components.modals.edit.load(id) + const project_id = {{ $project_id ?? 'null' }}; + reservations.components.modals.edit.load({project_id, type: 'active', reservation_id: id}) return false }, remove: event => { @@ -522,7 +584,10 @@ const draw = super.draw() const tooltip = draw.tooltip() tooltip['valida'] = reservation => { - const formatter = new Intl.NumberFormat('es-CL', {minimumFractionDigits: 2, maximumFractionDigits: 2}) + const formatter = new Intl.NumberFormat('es-CL', { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) const output = [] const table = [ @@ -590,7 +655,15 @@ } return draw } + actions = { + edit: event => { + event.preventDefault() + const id = event.currentTarget.dataset.id + const project_id = {{ $project_id ?? 'null' }}; + reservations.components.modals.edit.load({project_id, type: 'pending', reservation_id: id}) + return false + }, approve: event => { event.preventDefault() const id = event.currentTarget.dataset.id @@ -624,6 +697,7 @@ return data[idx] }) } + draw() { const draw = super.draw() draw.actions = (id) => { @@ -631,7 +705,9 @@ } return draw } - watch() {} + + watch() { + } mapState(state) { return { @@ -794,7 +870,7 @@ this.show.projects() this.components.modals.add = new AddReservationModal(configuration.ids.projects) - this.components.modals.edit = new EditReservationModal() + this.components.modals.edit = new EditReservationModal(configuration.ids.projects) this.components.modals.comment = new CommentModal() const project_id = {{ $project_id ?? 'null' }}; diff --git a/app/resources/views/ventas/reservations/modal/add.blade.php b/app/resources/views/ventas/reservations/modal/add.blade.php index 69109be..e47224d 100644 --- a/app/resources/views/ventas/reservations/modal/add.blade.php +++ b/app/resources/views/ventas/reservations/modal/add.blade.php @@ -1,534 +1,87 @@ - - -@include('layout.body.scripts.rut') +@include('ventas.reservations.modal.common.modal', ['prefix' => 'add', 'modalTitle' => 'Agregar Cierre', 'okText' => 'Agregar']) @push('page_scripts') @endpush diff --git a/app/resources/views/ventas/reservations/modal/common/form.blade.php b/app/resources/views/ventas/reservations/modal/common/form.blade.php new file mode 100644 index 0000000..7bda042 --- /dev/null +++ b/app/resources/views/ventas/reservations/modal/common/form.blade.php @@ -0,0 +1,164 @@ + + +
+ +
+
+ + +
+
+
+
+
+ +
+ +
-
+
+
+
+ +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ +
+ +
@
+ +
+
+
+
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+
+
+
+ + +
+
+ + +
+
+

Unidades

+
+
+

Forma de Pago

+
+
+
+ + +
+
+
+ +
+ +
UF
+
+
+
+ + +
+
+
+
+
+ + +
+
+
+ +
+ +
UF
+
+
+
+ diff --git a/app/resources/views/ventas/reservations/modal/common/modal.blade.php b/app/resources/views/ventas/reservations/modal/common/modal.blade.php new file mode 100644 index 0000000..af0d9c4 --- /dev/null +++ b/app/resources/views/ventas/reservations/modal/common/modal.blade.php @@ -0,0 +1,16 @@ + diff --git a/app/resources/views/ventas/reservations/modal/common/scripts/modal.blade.php b/app/resources/views/ventas/reservations/modal/common/scripts/modal.blade.php new file mode 100644 index 0000000..533d348 --- /dev/null +++ b/app/resources/views/ventas/reservations/modal/common/scripts/modal.blade.php @@ -0,0 +1,380 @@ +@push('page_scripts') + +@endpush diff --git a/app/resources/views/ventas/reservations/modal/common/scripts/payments.blade.php b/app/resources/views/ventas/reservations/modal/common/scripts/payments.blade.php new file mode 100644 index 0000000..d0406e1 --- /dev/null +++ b/app/resources/views/ventas/reservations/modal/common/scripts/payments.blade.php @@ -0,0 +1,112 @@ +@push('page_scripts') + +@endpush diff --git a/app/resources/views/ventas/reservations/modal/common/scripts/promotions.blade.php b/app/resources/views/ventas/reservations/modal/common/scripts/promotions.blade.php new file mode 100644 index 0000000..d12588a --- /dev/null +++ b/app/resources/views/ventas/reservations/modal/common/scripts/promotions.blade.php @@ -0,0 +1,100 @@ +@push('page_scripts') + +@endpush diff --git a/app/resources/views/ventas/reservations/modal/common/scripts/units.blade.php b/app/resources/views/ventas/reservations/modal/common/scripts/units.blade.php new file mode 100644 index 0000000..5801111 --- /dev/null +++ b/app/resources/views/ventas/reservations/modal/common/scripts/units.blade.php @@ -0,0 +1,167 @@ +@push('page_scripts') + +@endpush diff --git a/app/resources/views/ventas/reservations/modal/edit.blade.php b/app/resources/views/ventas/reservations/modal/edit.blade.php index 4caf26d..b9c7a7d 100644 --- a/app/resources/views/ventas/reservations/modal/edit.blade.php +++ b/app/resources/views/ventas/reservations/modal/edit.blade.php @@ -1,289 +1,52 @@ - - +@include('ventas.reservations.modal.common.modal', ['prefix' => 'edit', 'modalTitle' => 'Editar Reserva', 'okText' => 'Guardar Cambios']) @push('page_scripts') @endpush diff --git a/app/setup/settings/urls.php b/app/setup/settings/urls.php index 01b7b7d..7709d52 100644 --- a/app/setup/settings/urls.php +++ b/app/setup/settings/urls.php @@ -18,6 +18,14 @@ return [ $urls['assets'], 'images' ]); + $urls['scripts'] = implode('/', [ + $urls['assets'], + 'js' + ]); + $urls['styles'] = implode('/', [ + $urls['assets'], + 'css' + ]); return (object) $urls; }, 'apiUrls' => function(ContainerInterface $container) {
- - - ', + this.draw().actionButtons().edit(id), + this.draw().actionButtons().promise(id), + this.draw().actionButtons().remove(id), + '