ultimatepos/Modules/IndustrialEngineering/Resources/views/partials/datatable_index.blade.php

34 lines
1.2 KiB
PHP

@extends('layouts.app')
@section('title', $title ?? '')
@section('content')
@include('industrialengineering::layouts.nav')
<section class="content-header">
<h1>{{ $title }}
@if(!empty($createUrl) && !empty($createPerm) && auth()->user()->can($createPerm))
<a href="{{ $createUrl }}" class="btn btn-primary pull-right"><i class="fa fa-plus"></i> @lang('industrialengineering::lang.add')</a>
@endif
</h1>
</section>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<table class="table table-bordered table-striped" id="{{ $tableId }}" style="width:100%">
<thead><tr>
@foreach($columns as $col)<th>{{ $col['label'] }}</th>@endforeach
</tr></thead>
</table>
</div>
</div>
</section>
@endsection
@section('javascript')
<script>
$(function(){
$('#{{ $tableId }}').DataTable({
processing:true, serverSide:true, ajax:'{{ $ajaxUrl }}',
columns:@json(collect($columns)->map(fn($c)=>['data'=>$c['data'],'orderable'=>$c['orderable']??true,'searchable'=>$c['searchable']??true])->values())
});
});
</script>
@endsection