51 lines
1.7 KiB
PHP
51 lines
1.7 KiB
PHP
|
@extends('layout.base')
|
||
|
|
||
|
@section('content')
|
||
|
<div class="row page-heading">
|
||
|
<h3>Agregar Inmobiliaria</h3>
|
||
|
</div>
|
||
|
<br />
|
||
|
<form method="post" class="form-horizontal" action="{{url('', ['p' => 'inmobiliarias', 'a' => 'agregar'])}}">
|
||
|
<div class="form-group">
|
||
|
<div class="col-md-2">RUT</div>
|
||
|
<div class="col-md-3"><input type="text" name="rut" class="form-control" /></div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<div class="col-md-2">Razón Social</div>
|
||
|
<div class="col-md-5"><input type="text" name="razon" class="form-control" /></div>
|
||
|
<div class="col-md-2">
|
||
|
<select name="sociedad" class="form-control">
|
||
|
@foreach ($sociedades as $sociedad)
|
||
|
<option value="{{$sociedad->id}}">{{$sociedad->abreviacion}}</option>
|
||
|
@endforeach
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<div class="col-md-2">Abreviación</div>
|
||
|
<div class="col-md-4"><input type="text" name="abrev" class="form-control" /></div>
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<div class="col-md-offset-2 col-md-2"><input type="submit" value="Agregar" class="form-control" /></div>
|
||
|
</div>
|
||
|
</form>
|
||
|
@endsection
|
||
|
|
||
|
@push('scripts')
|
||
|
<script type="text/javascript">
|
||
|
$(document).ready(function() {
|
||
|
$("input[name='rut']").rut({"formatOn": 'keyup', "validateOn": 'blur'}).on('rutInvalido', function(e) {
|
||
|
$(this).parent().next().remove();
|
||
|
$(this).parent().after($('<div></div>').attr('class', 'col-md-2 alert-danger').html('Rut inválido'));
|
||
|
}).on('rutValido', function(e, rut, dv) {
|
||
|
$(this).parent().next().remove();
|
||
|
|
||
|
$.post('{!!url('', ['p' => 'ajax', 'a' => 'inmobiliarias', 'ajax' => true])!!}', {'rut': rut}, function(data) {
|
||
|
$("input[name='razon']").val(data.razon);
|
||
|
$("input[name='abrev']").val(data.abreviacion);
|
||
|
}, 'json');
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
@endpush
|