diff --git a/DataTables/CardboardOdnerDataTable.php b/DataTables/CardboardOdnerDataTable.php new file mode 100644 index 0000000..d69e5c7 --- /dev/null +++ b/DataTables/CardboardOdnerDataTable.php @@ -0,0 +1,125 @@ +with(['directorat', 'sub_directorat', 'job', 'job.sub_job', 'job.sub_job.sub_sub_job']); + + return (new EloquentDataTable($query)) + ->filter(function ($query) { + if (request()->has('search')) { + $search = request()->get('search'); + } + }) + ->addColumn('jumlah_halaman', function($model){ + $jumlah_halaman = DocumentDetail::where('document_id', $model->id)->sum('jumlah_halaman'); + + return $jumlah_halaman; + }) + ->addColumn('directorat', function ($model) { + return $model->directorat->kode . ' - ' . $model->directorat->name; + }) + ->addColumn('sub_directorat', function ($model) { + return $model->sub_directorat->kode . ' - ' . $model->sub_directorat->name; + }) + ->addColumn('job', function ($model) { + return $model->job->kode . ' - ' . $model->job->name; + }) + ->addColumn('sub_job', function ($model) { + return $model->sub_job->kode . ' - ' . $model->sub_job->name; + }) + ->addColumn('sub_sub_job', function ($model) { + return $model->sub_sub_job->kode . ' - ' . $model->sub_sub_job->name; + }) + ->addIndexColumn() + ->addColumn('checkbox', function ($item) { + return '
+ +
'; + }) + ->addColumn('action', 'cetaklabel::app.cardboard-detail._action') + ->rawColumns(['checkbox', 'action']) + ->setRowId('id'); + } + + /** + * Get the query source of dataTable. + */ + public function query(Document $model) + : QueryBuilder + { + return $model->newQuery(); + } + + /** + * Optional method if you want to use the html builder. + */ + public function html() + : HtmlBuilder + { + return $this->builder() + ->setTableId('cardboard-odner-table') + ->columns($this->getColumns()) + ->minifiedAjax() + ->stateSave(false) + ->responsive() + ->autoWidth(true) + ->orderBy(1) + ->parameters([ + 'scrollX' => false, + 'drawCallback' => 'function() { KTMenu.createInstances(); }', + ]) + ->addTableClass('align-middle table-row-dashed fs-6 gy-5'); + } + + /** + * Get the dataTable columns definition. + */ + public function getColumns() + : array + { + return [ + Column::make('checkbox')->title('')->orderable(false)->searchable(false)->printable(false)->exportable(false)->width(10), + Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false), + Column::make('kode_odner')->title('Kode Odner'), + Column::make('directorat')->title('Direktorat'), + Column::make('sub_directorat')->title('Sub Direktorat'), + Column::make('job')->title('Jenis Pekerjaan'), + Column::make('sub_job')->title('Sub Jenis Pekerjaan'), + Column::make('sub_sub_job')->title('Sub Sub Jenis Pekerjaan'), + Column::make('jumlah_halaman')->title('Jumlah Halaman'), + Column::make('sequence_odner')->title('Sequence'), + Column::computed('action') + ->exportable(false) + ->printable(false) + ->width(60) + ->addClass('text-center'), + ]; + } + + /** + * Get the filename for export. + */ + protected function filename() + : string + { + return 'Cardboard_' . date('YmdHis'); + } + } diff --git a/Resources/views/app/cardboard-detail/_list.blade.php b/Resources/views/app/cardboard-detail/_list.blade.php new file mode 100644 index 0000000..8b75172 --- /dev/null +++ b/Resources/views/app/cardboard-detail/_list.blade.php @@ -0,0 +1,98 @@ + +{{ $dataTable->table() }} + + +{{-- Inject Scripts --}} +@section('scripts') + {{ $dataTable->scripts() }} +@endsection + +@push('customscript') + @php + $route = explode('.', Route::currentRouteName()); + @endphp + + +@endpush + +@section('styles') + +@endsection diff --git a/Resources/views/app/cardboard-detail/odner.blade.php b/Resources/views/app/cardboard-detail/odner.blade.php new file mode 100644 index 0000000..f4faa4f --- /dev/null +++ b/Resources/views/app/cardboard-detail/odner.blade.php @@ -0,0 +1,91 @@ + + +
+ +
+
+
+ + + + + + + + + +
+ + +
+ + +
+ +
+ + + + + + + +
+ + +
+
+
+ @include('cetaklabel::app.cardboard-detail._list') +
+ +
+ +