File: /var/www/vhost/disk-apps/agile-selling-orl/resources/views/discounts/discounts.blade.php
@extends('modules.head') @section('contenido')
<div class="box-header">
<a class="auxiliar-black" href="{{url('/discounts/add')}}"><button class="btn btnAdd pull-right">
<i class="fa fa-plus"></i>{{ Lang::get('messages.screen_discounts_tag2')}}
</button></a>
</div>
<!-- List banners-->
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ Lang::get('messages.screen_discounts_tag1')}}</h3>
</div>
<div class="box-tools boxTypeOrder">
<div class="row1-boxTypeOrder">
<label class="label-boxTypeOrder">Tipo Descuento:</label>
</div>
<div class="row2-boxTypeOrder">
<select class="form-control selectedTypeDiscount" name="select_type_discount" id="select_type_discount">
@foreach($discountTypes as $discountType)
@if($discountType->id == 1)
<option selected="selected" value="{{$discountType->id}}">{{$discountType->name}}</option>
@else
<option value="{{$discountType->id}}">{{$discountType->name}}</option>
@endif
@endforeach
</select>
</div>
</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="Browser: activate to sort column ascending">{{ Lang::get('messages.screen_discounts_tag3')}}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.screen_discounts_tag33')}}</th>
<th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">{{ Lang::get('messages.screen_discounts_tag34')}}</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.screen_discounts_tag4')}}</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.screen_discounts_tag5')}}</th>
</tr>
</thead>
</table>
</div>
<!-- /.box-body -->
</div>
@endsection
<script src="{{ asset('js/jQuery/jquery-2.2.3.min.js') }}"></script>
<script src="{{ asset('js/discounts.js') }}"></script>
<script src="{{ asset('js/bootstrap/js/bootstrap.min.js') }}"></script>
<script type="text/javascript">
$(document).ready(function () {
var discount_type_id = $("#select_type_discount").val();
_table = $('#example2').DataTable({
responsive: true,
processing: true,
serverSide: true,
"order" : [],
"language": {
url: 'https://cdn.datatables.net/plug-ins/1.10.19/i18n/Spanish.json'
},
ajax: '/discounts/filter/'+discount_type_id,
columns: [
{ data: 'name', name: 'name' },
{ data: 'current_winners', name: 'current_winners' },
{ data: 'max_winners', name: 'max_winners' },
{ data: 'active', name: 'active' },
{ data: 'actions', name: 'actions' },
]
});
setTimeout( function(){
$('#example2_filter > label > input').unbind();
$('#example2_filter > label > input').bind('keyup', function (e) {
if (e.keyCode == 13){
_table.search(this.value).draw();
}
});
},500);
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, Orden y Link</p></div>';
$('#example2_filter').append(info);
$('#btn-info-busqueda').on('click', function () {
$('#menuBusqueda').toggle();
});
// cargar dinamicamente los tipo de descuento
$( ".selectedTypeDiscount" ).change(function() {
var discount_type_id = $("#select_type_discount").val();
_table = $('#example2').DataTable({
responsive: true,
processing: true,
serverSide: true,
"bDestroy": true,
"order" : [],
"language": {
url: 'https://cdn.datatables.net/plug-ins/1.10.19/i18n/Spanish.json'
},
ajax: '/discounts/filter/'+discount_type_id,
columns: [
{ data: 'name', name: 'name' },
{ data: 'current_winners', name: 'current_winners' },
{ data: 'max_winners', name: 'max_winners' },
{ data: 'active', name: 'active' },
{ data: 'actions', name: 'actions' },
]
});
setTimeout( function(){
$('#example2_filter > label > input').unbind();
$('#example2_filter > label > input').bind('keyup', function (e) {
if (e.keyCode == 13){
_table.search(this.value).draw();
}
});
},500);
});
});
</script>