From 5702c1249cc015e7807879599072608fb28f68fd Mon Sep 17 00:00:00 2001 From: Gunawan19621 Date: Mon, 6 Nov 2023 09:59:39 +0700 Subject: [PATCH] label peti --- .../Controllers/KondisiPetiController.php | 16 ++ app/Http/Controllers/PetiController.php | 63 +++++- app/Models/Kondisi_Peti.php | 11 + ..._06_022213_create_kondisi__petis_table.php | 27 +++ .../Kondisi_Peti/index.blade.php | 152 +++++++++++++ .../Manajemen_Peti/Peti/all_print.blade.php | 213 +++++++++++++++++- .../Master_Data/Role/index.blade.php | 4 +- .../dashboard/Peminjaman/create.blade.php | 22 +- resources/views/dashboard/index.blade.php | 41 +++- resources/views/layouts/sidebar.blade.php | 3 + routes/web.php | 12 + 11 files changed, 541 insertions(+), 23 deletions(-) create mode 100644 app/Http/Controllers/KondisiPetiController.php create mode 100644 app/Models/Kondisi_Peti.php create mode 100644 database/migrations/2023_11_06_022213_create_kondisi__petis_table.php create mode 100644 resources/views/dashboard/Master_Data/Manajemen_Peti/Kondisi_Peti/index.blade.php diff --git a/app/Http/Controllers/KondisiPetiController.php b/app/Http/Controllers/KondisiPetiController.php new file mode 100644 index 0000000..dd459aa --- /dev/null +++ b/app/Http/Controllers/KondisiPetiController.php @@ -0,0 +1,16 @@ + 'menu-kondisipeti' + ]; + return view('dashboard.Master_Data.Manajemen_Peti.Kondisi_Peti.index', $data); + } +} diff --git a/app/Http/Controllers/PetiController.php b/app/Http/Controllers/PetiController.php index 1f5000f..9938c2f 100644 --- a/app/Http/Controllers/PetiController.php +++ b/app/Http/Controllers/PetiController.php @@ -211,6 +211,43 @@ class PetiController extends Controller } } + // public function AllPdf(Request $request) + // { + // $peti_ids = $request->input('peti_ids'); + // $selectedIds = explode(',', $peti_ids); + + // // Mengambil data dari database berdasarkan ID yang dipilih + // $peti = Peti::whereIn('id', $selectedIds)->get(); + + // // $peti = Peti::all(); + // // Inisialisasi Dompdf + // $options = new Options(); + // $options->set('isHtml5ParserEnabled', true); + // $options->set('isRemoteEnabled', true); + // $options->set('defaultFont', 'Arial'); + // $dompdf = new Dompdf($options); + + // // Load HTML dari view + // $html = view('dashboard.Master_Data.Manajemen_Peti.Peti.all_print', compact('peti'))->render(); + // $dompdf->loadHtml($html); + + // // Render PDF (portrait A4) + // $dompdf->setPaper('A4', 'portrait'); + // $dompdf->render(); + // $output = $dompdf->output(); + + // // Download file PDF dengan nama yang sesuai + // return response()->stream( + // function () use ($output) { + // echo $output; + // }, + // 200, + // [ + // 'Content-Type' => 'application/pdf', + // 'Content-Disposition' => 'inline; filename="label_Peti.pdf"', + // ] + // ); + // } public function AllPdf(Request $request) { $peti_ids = $request->input('peti_ids'); @@ -219,12 +256,32 @@ class PetiController extends Controller // Mengambil data dari database berdasarkan ID yang dipilih $peti = Peti::whereIn('id', $selectedIds)->get(); - // $peti = Peti::all(); - // Inisialisasi Dompdf + // Inisialisasi Dompdf dengan opsi $options = new Options(); $options->set('isHtml5ParserEnabled', true); $options->set('isRemoteEnabled', true); $options->set('defaultFont', 'Arial'); + + // Mengatur ukuran kertas sesuai dengan printer Zebra JT230 + $options->set('isPhpEnabled', true); // Diperlukan agar perubahan ukuran kertas berfungsi + $options->set('isHtml5ParserEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $options->set('isPhpEnabled', true); + $dompdf = new Dompdf($options); // Load HTML dari view @@ -232,7 +289,7 @@ class PetiController extends Controller $dompdf->loadHtml($html); // Render PDF (portrait A4) - $dompdf->setPaper('A4', 'portrait'); + $dompdf->setPaper([0, 0, 198.5, 396], 'portrait'); // Ukuran kertas lebar 7cm dan tinggi 14cm $dompdf->render(); $output = $dompdf->output(); diff --git a/app/Models/Kondisi_Peti.php b/app/Models/Kondisi_Peti.php new file mode 100644 index 0000000..3122248 --- /dev/null +++ b/app/Models/Kondisi_Peti.php @@ -0,0 +1,11 @@ +id(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('kondisi__petis'); + } +}; diff --git a/resources/views/dashboard/Master_Data/Manajemen_Peti/Kondisi_Peti/index.blade.php b/resources/views/dashboard/Master_Data/Manajemen_Peti/Kondisi_Peti/index.blade.php new file mode 100644 index 0000000..da3869f --- /dev/null +++ b/resources/views/dashboard/Master_Data/Manajemen_Peti/Kondisi_Peti/index.blade.php @@ -0,0 +1,152 @@ +@extends('layouts.main') +@section('content') + @include('layouts.components.alert-prompt') +
+
+
+
+
Data Kondisi Peti
+
+ +
+
+
+
+ + + + + + + + + + + {{-- @php + $notype = 1; + @endphp + @forelse ($typepeti as $data_typepeti) + + + + + + + + @empty +

Data Kosong

+ @endforelse --}} + +
NoKondisi PetiDeskripsiAction
{{ $notype++ }}{{ $data_typepeti->type }}{{ $data_typepeti->size_peti }}{{ $data_typepeti->description }} + + + + + + +
+ @csrf + @method('DELETE') + +
+
+
+
+
+ + + + + + {{-- @foreach ($role as $data) + + @endforeach --}} + + +@endsection diff --git a/resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/all_print.blade.php b/resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/all_print.blade.php index 75dc222..5b7a444 100644 --- a/resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/all_print.blade.php +++ b/resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/all_print.blade.php @@ -1,6 +1,217 @@ + + Data PDF + + + + + + @foreach ($peti as $item => $data) + size(150) + ->errorCorrection('H') + ->generate($data->fix_lot . ';' . $data->id . ';' . $data->warehouse_id), + ); + ?> + + + + + + + + + + + + + + + + + + + + + +
+ + PETI NUMBERBARCODE
+ {{ $data->fix_lot }} + + QR Code +
PT. ISTWCUSTOMER
QTY PETIPT. {{ $data->customer->name }}
1
+ +
+ @endforeach + + + + + + +{{-- + + + + Data PDF + + + + + + @foreach ($peti as $item => $data) + size(150) + ->errorCorrection('H') + ->generate($data->fix_lot . ';' . $data->id . ';' . $data->warehouse_id), + ); + ?> +
+ + + + + + + + + + + + + + + + + + + + + +
+ + PETI NUMBERBARCODE
+ {{ $data->fix_lot }} + + QR Code +
PT. ISTWCUSTOMER
QTY PETIPT. {{ $data->customer->name }}
1
+ @endforeach + + + + --}} + +{{-- + + Data PDF