Merge branch 'develop' into feature/cierres
This commit is contained in:
62
app/resources/views/ventas/pies/bonos/edit.blade.php
Normal file
62
app/resources/views/ventas/pies/bonos/edit.blade.php
Normal file
@ -0,0 +1,62 @@
|
||||
@extends('ventas.base')
|
||||
|
||||
@section('venta_subtitle')
|
||||
Editar Bono - Pie
|
||||
@endsection
|
||||
|
||||
@section('venta_content')
|
||||
<div class="ui compact segment">
|
||||
<p>Valor Promesa {{$format->ufs($venta->valor)}}</p>
|
||||
@if (isset($venta->formaPago()->pie))
|
||||
<p>Valor Anticipo {{$format->ufs($venta->formaPago()->pie->valor)}}</p>
|
||||
@endif
|
||||
<p>Valor 10% {{$format->ufs($venta->valor * 0.1)}}</p>
|
||||
</div>
|
||||
<form class="ui form" id="add_bono">
|
||||
<div class="three wide field">
|
||||
<label for="fecha">Fecha</label>
|
||||
<div class="ui calendar" id="fecha">
|
||||
<div class="ui left icon input">
|
||||
<i class="calendar icon"></i>
|
||||
<input type="text" placeholder="Fecha" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="three wide field">
|
||||
<label for="valor">Valor</label>
|
||||
<div class="ui right labeled input">
|
||||
<input type="text" name="valor" id="valor" value="{{ round($venta->formaPago()->bonoPie->pago->valor(), 2) }}" />
|
||||
<div class="ui basic label">UF</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="ui button">Editar</button>
|
||||
</form>
|
||||
@endsection
|
||||
|
||||
@push('page_scripts')
|
||||
<script>
|
||||
$(document).ready(() => {
|
||||
const fecha = $('#fecha')
|
||||
fecha.calendar(calendar_date_options)
|
||||
fecha.calendar('set date', new Date({{$venta->formaPago()->bonoPie->pago->fecha->format('Y, m-1, j')}}))
|
||||
|
||||
$('#add_bono').submit(submitEvent => {
|
||||
submitEvent.preventDefault()
|
||||
const url = '{{$urls->api}}/venta/{{$venta->id}}/bono_pie/edit'
|
||||
const data = new FormData()
|
||||
data.set('fecha', $('#fecha').calendar('get date').toISOString())
|
||||
data.set('valor', $('#valor').val())
|
||||
return APIClient.fetch(url, {method: 'post', body: data}).then(response => {
|
||||
if (response.ok) {
|
||||
return response.json()
|
||||
}
|
||||
}).then(json => {
|
||||
if (!json.success) {
|
||||
return
|
||||
}
|
||||
window.location = '{{$urls->base}}/venta/{{$venta->id}}'
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@endpush
|
@ -4,7 +4,7 @@
|
||||
@if ($bonoPie !== null)
|
||||
<sub>
|
||||
<a href="{{$urls->base}}/venta/{{$venta->id}}/bono_pie">
|
||||
<i class="edit button"></i>
|
||||
<i class="edit icon"></i>
|
||||
</a>
|
||||
</sub>
|
||||
@else
|
||||
|
Reference in New Issue
Block a user