File: /var/www/vhost/disk-apps/qas.sports-crowd.com/resources/views/coverages/coverages.blade.php
@extends('modules.head') @section('contenido')
<div class="box-header">
{{-- <form role="form" id="crearCanal" data-toggle="validator"> --}}
<button type="button" id="btn-crear-cliente" onclick="location.href='/coverages/create'" class="btn btnAdd pull-right"> <i style="margin-right:5px;" class="fa fa-plus"></i>{{ Lang::get('messages.coverages.title_1')}}</button>
{{-- </form> --}}
<a class="btn btn-app btnReportProducts" data-toggle="modal" data-target="#modalImportCoverages">
<i class="fa fa-cloud-upload"></i> {{ Lang::get('messages.modal_.title_1')}}
</a>
<a class="btn btn-app btnReportProducts" href="{{url('/coverages/all')}}">
<i class="fa fa-cloud-download"></i> {{ Lang::get('messages.modal_.title_5')}}
</a>
<a class="btn btn-app btnReportProducts" onclick="deleteCoverages()">
<i class="fa fa-trash"></i> Eliminar datos tabla coberturas
</a>
</div>
<!-- /.box-body -->
<!-- LISTADO lineas-->
<div class="box">
<div class="box-header">
<h3 class="box-title">{{ Lang::get('messages.coverages.title_2')}}</h3>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive ">
<table id="example2" class="table table-bordered table-hover dataTable" role="grid" aria-describedby="example2_info">
<thead>
<tr role="row">
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending">{{ Lang::get('messages.coverages.title_3')}}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending">{{ Lang::get('messages.coverages.title_4')}}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending">{{ Lang::get('messages.coverages.title_5')}}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending"></th>
</tr>
</thead>
</table>
</div>
<!-- /.box-body -->
</div>
@include('users.modal.modalImportCoverages')
<script src="{{ asset('js/jQuery/jquery-2.2.3.min.js') }}"></script>
<script src="{{ asset('js/bootstrap/js/bootstrap.min.js') }}"></script>
<script src="{{ asset('js/coverage.js') . '?v=' . time() }}"></script>
<script type="text/javascript">
$(document).ready(function() {
_table = $('#example2').DataTable({
responsive: true,
processing: true,
serverSide: true,
language: {
url: window.DATATABLES_LANGUAGE_URL,
},
ajax: "{{ route('coverages.table') }}",
columns: [{
data: 'name',
name: 'name'
},
{
data: 'active',
name: 'active'
},
{
data: 'cost_delivery',
name: 'cost_delivery'
},
{
data: 'actions',
name: 'actions'
},
]
});
var info = '<i class="fa fa-info-circle" id="btn-info-busqueda"></i><div class="dropdown-menu" id="menuBusqueda" style="left: 50%; padding: 5px; background-color: #f9fb8f;"><p data-toggle="modal">Busqueda por Nombre</p></div>';
$('#example2_filter').append(info);
$('#btn-info-busqueda').on('click', function() {
$('#menuBusqueda').toggle();
});
});
function chkCoverage(id) {
var state;
if ($('#Checkactive' + id).is(':checked')) {
state = 1;
} else {
state = 0;
}
var info = {
"id": id,
"state": state
};
$.ajax({
url: "/coverages/active",
type: "PUT",
contentType: 'application/json',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content'),
'Content-Type': 'application/json'
},
data: JSON.stringify(info),
success: function(r) {
if (r.r) {
swal('Registro actualizado exitosamente', {
icon: "success",
buttons: {
Ok: true,
},
});
} else {
swal("Error", r.m, "error");
}
},
error: function(e) {
swal("Error", "Error al cambiar estado", "error");
}
});
}
function editCoverage(id) {
$(location).attr('href', 'coverages/' + id + '/update');
}
/**Método para eliminar cobertura desde la tabla de admins y en editar */
function deleteCoverage(id) {
swal("¿Está seguro de eliminar esta Cobertura?", {
buttons: {
cancel: "No",
Ok: true,
},
}).then((val) => {
if (val == "Ok") {
var info = {
"id": id
};
$.ajax({
url: "/coverages/delete",
type: "POST",
contentType: 'application/json',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content'),
'Content-Type': 'application/json'
},
data: JSON.stringify(info),
success: function(r) {
console.log(r);
if (r.r) {
swal("Cobertura eliminada con éxito!", {
icon: "success",
buttons: {
Ok: true,
}
}).then((val) => {
if (val == "Ok") {
$(location).attr('href', url + '/coverages');
}
});
} else {
swal("Error", "¡Error al eliminar Cobertura", "error");
}
}
});
}
});
}
function setPageTable() {
localStorage.setItem("setPageTable", true);
$(location).attr('href', '/orders');
}
</script>
@endsection