MINI Sh3ll
@extends('layouts.main')
@section('title', 'Panel')
@section('content')
<div class="m-content">
<!-- <div class="row" >
<div class="m-portlet m-portlet--mobile filter_row">
<div class="m-portlet__head">
<div class="m-portlet__head-caption">
<div class="m-portlet__head-title">
<h3 class="m-portlet__head-text">
Planels Filter
</h3>
</div>
</div>
</div>
<form class="m-form m-form--fit m-form--label-align-right" autocomplete="off" id="searchForm" method="POST" role="form" data-parsley-validate="parsley">
{{ csrf_field() }}
<div class="m-portlet__body">
<div class="row">
<div class="col-md-6">
<div class="form-group m-form__group">
<label class="show_status"> Select comapny </label>
<select class="form-control m-input" id="companyName">
<option value="" >All</option>
@if(!empty($companies_name))
@foreach($companies_name as $name)
<option value="{{$name->id}}" >{{$name->company_name}}</option>
@endforeach
@else
<option value="" >Company not found.</option>
@endif
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group m-form__group">
<label class="show_status"> Select API </label>
<select class="form-control m-input" id="status">
<option value="" >All</option>
@if(!empty($regApi))
@foreach($regApi as $api)
<option value="{{$api->id}}" >{{$api->name}}</option>
@endforeach
@else
<option value="" >APIs not found.</option>
@endif
</select>
</div>
</div>
</div><br>
<div class="row">
<div class="col-md-6">
<div class="form-group m-form__group">
<label class="show_status"> Select Chart Type</label>
<select class="form-control m-input" id="chartType">
<option value="" >All</option>
<option value="1">Graph</option>
<option value="2">Numeric</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group m-form__group">
<label class="show_status"> Select Graph type </label>
<select class="form-control m-input" id="status">
<option value="" >All</option>
@if(!empty($graphDuration))
@foreach ($graphDuration as $key => $duration)
<option value="{{$key}}">{{ucfirst($duration)}}</option>
@endforeach
@else
<option value="" >Graph duration not found.</option>
@endif
</select>
</div>
</div>
</div><br>
</div>
<div class="m-portlet__foot m-portlet__foot--fit">
<div class="m-form__actions">
<button type="button" id="searchBtn" name="submit" class="btn btn-sm btn-accent m-btn m-btn--custom m-btn--icon m-btn--air search_plant">
Search <i class="la la-search"></i>
</button>
</div>
</div>
</form>
</div>
</div> -->
<div class="row" >
<div class="m-portlet m-portlet--mobile filter_row">
<div class="m-portlet__head">
<div class="m-portlet__head-caption">
<div class="m-portlet__head-title">
<h3 class="m-portlet__head-text">
Panel List
</h3>
</div>
</div>
<div class="m-portlet__head-tools">
<a href="{{ route('panels.create') }}" class="btn btn-sm btn-accent m-btn m-btn--custom m-btn--icon m-btn--air">
<span>
<i class="la la-plus"></i>
<span>
Add Panel
</span>
</span>
</a>
</div>
</div>
<div class="m-portlet__body">
<!--begin: Datatable -->
<div class="m_datatable" id="local_data">
<table id="company_data" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>API name</th>
<th>Company Name</th>
<th>Chart Type</th>
<th>Display Type</th>
<th>Action</th>
</tr>
</thead>
</table>
</div>
<!--end: Datatable -->
</div>
</div>
</div>
</div>
@endsection
@section('script')
<script>
var base_url = window.location.origin;
var url = "{{ route('panelList') }}";
loadDataTable(url);
function loadDataTable(url){
$('#company_data').DataTable({
"order": [],
"bAutoWidth": false,
"processing": false,
"serverSide": false,
"bDestroy": true,
"scrollX": true,
"aLengthMenu": [[10, 20, 50, -1], [10, 20, 50, "All"]],
"pageLength": 10,
"columnDefs": [{
"targets": 'no-sort',
"orderable": false,
}],
"ajax": url,
language: {
search: "_INPUT_",
searchPlaceholder: "Search...",
"lengthMenu": "Show _MENU_"
}
})
}
$(document).on('click', '.delete_panel', function(event) {
var id = $(this).attr("data-id");
var deleteUrl = '{{ route("deletePanel") }}';
$('#deleteModal').modal('show');
$(".delete").click(function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: deleteUrl,
dataType: "json",
data: {
"id": id,
"_token": "{{ csrf_token() }}",
},
success: function (response){
console.log(response);
if(response.status == 1) {
$('#deleteModal').modal('hide');
location.reload(true);
toastr.success(response.success);
}
}
});
});
});
$(document).on("click","#searchBtn", function() {
$('#searchForm').submit();
var status = $('#status').val();
var id = $('#companyName').val();
var url = '{{ route('getCompany') }}';
url = url+"?comapny="+id;
loadDataTable(url);
});
</script>
@endsection
OHA YOOOO