47 lines
1.7 KiB
PHP
47 lines
1.7 KiB
PHP
|
@extends('layout.base')
|
||
|
|
||
|
@section('page_content')
|
||
|
<div class="ui container">
|
||
|
<h2 class="ui header">
|
||
|
Pie -
|
||
|
{{$venta->proyecto()->descripcion}} -
|
||
|
<a href="{{$urls->base}}/venta/{{$venta->id}}">{{$venta->propiedad()->summary()}}</a>
|
||
|
</h2>
|
||
|
<form class="ui form" id="edit_pie">
|
||
|
<div class="three wide field">
|
||
|
<label for="valor">Valor</label>
|
||
|
<div class="ui right labeled input">
|
||
|
<input type="text" name="valor" id="valor" value="{{$venta->formaPago()->pie->valor}}" />
|
||
|
<div class="ui basic label">UF</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="three wide field">
|
||
|
<label for="cuotas"># Cuotas</label>
|
||
|
<input type="number" name="cuotas" id="cuotas" value="{{$venta->formaPago()->pie->cuotas}}" />
|
||
|
</div>
|
||
|
<button class="ui button">Editar</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
@endsection
|
||
|
|
||
|
@push('page_scripts')
|
||
|
<script>
|
||
|
$(document).ready(() => {
|
||
|
$('#edit_pie').submit(event => {
|
||
|
event.preventDefault()
|
||
|
const data = new FormData(event.currentTarget)
|
||
|
fetchAPI('{{$urls->api}}/ventas/pie/{{$venta->formaPago()->pie->id}}/edit', {method: 'post', body: data}).then(response => {
|
||
|
if (response.ok) {
|
||
|
return response.json()
|
||
|
}
|
||
|
}).then(json => {
|
||
|
if (json.edited) {
|
||
|
window.location = '{{$urls->base}}/venta/{{$venta->id}}'
|
||
|
}
|
||
|
})
|
||
|
return false
|
||
|
})
|
||
|
})
|
||
|
</script>
|
||
|
@endpush
|