Browse Source

label peti

master
Gunawan19621 1 year ago
parent
commit
5702c1249c
  1. 16
      app/Http/Controllers/KondisiPetiController.php
  2. 63
      app/Http/Controllers/PetiController.php
  3. 11
      app/Models/Kondisi_Peti.php
  4. 27
      database/migrations/2023_11_06_022213_create_kondisi__petis_table.php
  5. 152
      resources/views/dashboard/Master_Data/Manajemen_Peti/Kondisi_Peti/index.blade.php
  6. 213
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/all_print.blade.php
  7. 4
      resources/views/dashboard/Master_Data/Role/index.blade.php
  8. 22
      resources/views/dashboard/Peminjaman/create.blade.php
  9. 41
      resources/views/dashboard/index.blade.php
  10. 3
      resources/views/layouts/sidebar.blade.php
  11. 12
      routes/web.php

16
app/Http/Controllers/KondisiPetiController.php

@ -0,0 +1,16 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class KondisiPetiController extends Controller
{
public function index()
{
$data = [
'active' => 'menu-kondisipeti'
];
return view('dashboard.Master_Data.Manajemen_Peti.Kondisi_Peti.index', $data);
}
}

63
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();

11
app/Models/Kondisi_Peti.php

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Kondisi_Peti extends Model
{
use HasFactory;
}

27
database/migrations/2023_11_06_022213_create_kondisi__petis_table.php

@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('kondisi__petis', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('kondisi__petis');
}
};

152
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')
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">
<div class="col-6">
<h5 class="m-0 font-weight-bold text-primary mt-2">Data Kondisi Peti</h5>
</div>
<div class="col-6 text-right">
<a href="#" class="btn btn-success btn-icon-split" data-toggle="modal" data-target="#tambahDataModal">
<span class="text">Tambah Kondisi Peti</span>
</a>
</div>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="tablebarang" width="100%" cellspacing="0">
<thead>
<tr>
<th class="text-center" style="width: 20px">No</th>
<th>Kondisi Peti</th>
<th>Deskripsi</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
{{-- @php
$notype = 1;
@endphp
@forelse ($typepeti as $data_typepeti)
<tr>
<td class="text-center">{{ $notype++ }}</td>
<td>{{ $data_typepeti->type }}</td>
<td>{{ $data_typepeti->size_peti }}</td>
<td>{{ $data_typepeti->description }}</td>
<td class="text-center">
<a href="{{ route('dashboard.typepeti.show', [$data_typepeti->id]) }}">
<i class="fa fa-eye mr-2" style="font-size: 20px"></i>
</a>
<a href="{{ route('dashboard.typepeti.edit', [$data_typepeti->id]) }}">
<i class="fa fa-edit mr-2" style="font-size: 20px"></i>
</a>
<form action="{{ route('dashboard.typepeti.destroy', $data_typepeti->id) }}"
method="POST" style="display: inline;">
@csrf
@method('DELETE')
<button type="submit"
onclick="return confirm('Apakah Anda yakin ingin menghapus data ini?')"
style="border: none; background: none; cursor: pointer;">
<i class="fa fa-trash text-danger" style="font-size: 20px"></i>
</button>
</form>
</td>
</tr>
@empty
<p>Data Kosong</p>
@endforelse --}}
</tbody>
</table>
</div>
</div>
</div>
<!-- Tambah Data Modal-->
<div class="modal fade" id="tambahDataModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Tambah Kondisi Peti</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="{{ route('dashboard.kondisipeti.store') }}" method="POST" enctype="multipart/form-data"
id="inputanForm">
@csrf
<div class="form-group">
<div class="form-group">
<label for="name" class="col-form-label">Kondisi Peti : <span
class="text-danger">*</span></label>
<input class="form-control" name="name" type="text" id="name"
value="{{ old('name') }}" placeholder="Masukan Kondisi Peti" pattern="[^0-9]+"
oninput="this.value=this.value.replace(/[0-9]/g,'');"
title="Hanya karakter selain huruf yang diperbolehkan" required>
<label for="description" class="col-form-label">Deskripsi: <span
class="text-danger">*</span></label>
<textarea class="form-control" name="description" id="description" placeholder="Masukkan Deskripsi Kondisi Peti"
required>{{ old('description') }}</textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<button type="submit" class="btn btn-primary" id="submitButton">Simpan</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Edit data Modal -->
{{-- @foreach ($role as $data)
<div class="modal fade" id="editDataModal{{ $data['id'] }}" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Edit Role</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="{{ route('dashboard.role.update', $data->id) }}" method="POST"
enctype="multipart/form-data" id="inputanForm">
@csrf
@method('PUT')
<div class="form-group">
<label for="name" class="col-form-label">Nama Hak Akses: <span
class="text-danger">*</span></label>
<input class="form-control" name="name" type="text" id="name"
value="{{ $data->name }}" placeholder="Masukan Nama Hak Akses" pattern="[^0-9]+"
oninput="this.value=this.value.replace(/[0-9]/g,'');"
title="Hanya karakter selain huruf yang diperbolehkan" required>
<label for="description" class="col-form-label">Deskripsi Hak Akses: <span
class="text-danger">*</span></label>
<textarea class="form-control" name="description" id="description" placeholder="Masukkan Deskripsi Hak Akses"
required>{{ $data->description }}</textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<button type="submit" class="btn btn-primary" id="submitButton">Simpan</button>
</div>
</form>
</div>
</div>
</div>
</div>
@endforeach --}}
<script>
document.getElementById('inputanForm').addEventListener('submit', function() {
document.getElementById('submitButton').setAttribute('disabled', 'true');
});
</script>
@endsection

213
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/all_print.blade.php

@ -1,6 +1,217 @@
<!DOCTYPE html>
<html>
<head>
<title>Data PDF</title>
<style>
body {
font-family: Arial, sans-serif;
}
table {
width: 100%;
border-collapse: collapse;
}
table,
th,
td {
border: 1px solid black;
}
th,
td {
text-align: center;
}
th {
background-color: #f2f2f2;
}
/* Lanskap */
@page {
size: 15cm 8cm;
/* Perubahan lebar dan tinggi sesuai lanskap */
margin: 0;
}
body {
margin: 0.5cm;
}
/* Atur ukuran gambar logo */
.logo {
width: 100px;
height: 100px;
}
/* Atur ukuran gambar QR Code */
.qrcode {
width: 150px;
height: 150px;
}
</style>
</head>
<body>
@foreach ($peti as $item => $data)
<?php
$qrcode = base64_encode(
QrCode::format('svg')
->size(150)
->errorCorrection('H')
->generate($data->fix_lot . ';' . $data->id . ';' . $data->warehouse_id),
);
?>
<table style="width:100%; margin-top: 10px;" class="table table-bordered">
<tr>
<td rowspan="2">
<img src="data:image/jpeg;base64,<?= base64_encode(file_get_contents('assets/img/logo istw.jpg')) ?>"
alt="Logo ISTW" class="logo">
</td>
<td>PETI NUMBER</td>
<td>BARCODE</td>
</tr>
<tr>
<td>
{{ $data->fix_lot }}
</td>
<td rowspan="4">
<img src="data:image/svg+xml;base64,{{ $qrcode }}" alt="QR Code" class="qrcode">
</td>
</tr>
<tr>
<td>PT. ISTW</td>
<td>CUSTOMER</td>
</tr>
<tr>
<td>QTY PETI</td>
<td rowspan="2">PT. {{ $data->customer->name }}</td>
</tr>
<tr>
<td>1</td>
</tr>
</table>
<div class="page-break"></div> <!-- Halaman baru setelah setiap label -->
@endforeach
</body>
</html>
{{-- <!DOCTYPE html>
<html>
<head>
<title>Data PDF</title>
<style>
body {
font-family: Arial, sans-serif;
}
table {
width: 100%;
border-collapse: collapse;
}
table,
th,
td {
border: 1px solid black;
}
th,
td {
padding: 8px;
text-align: center;
}
th {
background-color: #f2f2f2;
}
/* Potret */
@page {
size: 7cm 14cm;
margin: 0;
}
body {
margin: 0.5cm;
}
/* Atur ukuran gambar logo */
.logo {
width: 100px;
height: 100px;
}
/* Atur ukuran gambar QR Code */
.qrcode {
width: 150px;
height: 150px;
}
/* Halaman baru setelah setiap label */
.page-break {
page-break-before: always;
}
</style>
</head>
<body>
@foreach ($peti as $item => $data)
<?php
$qrcode = base64_encode(
QrCode::format('svg')
->size(150)
->errorCorrection('H')
->generate($data->fix_lot . ';' . $data->id . ';' . $data->warehouse_id),
);
?>
<div class="page-break"></div> <!-- Halaman baru setelah setiap label -->
<table style="width:100%; margin-top: 10px;" class="table table-bordered">
<tr>
<td rowspan="2">
<img src="data:image/jpeg;base64,<?= base64_encode(file_get_contents('assets/img/logo istw.jpg')) ?>"
alt="Logo ISTW" class="logo">
</td>
<td>PETI NUMBER</td>
<td>BARCODE</td>
</tr>
<tr>
<td>
{{ $data->fix_lot }}
</td>
<td rowspan="4">
<img src="data:image/svg+xml;base64,{{ $qrcode }}" alt="QR Code" class="qrcode">
</td>
</tr>
<tr>
<td>PT. ISTW</td>
<td>CUSTOMER</td>
</tr>
<tr>
<td>QTY PETI</td>
<td rowspan="2">PT. {{ $data->customer->name }}</td>
</tr>
<tr>
<td>1</td>
</tr>
</table>
@endforeach
</body>
</html> --}}
{{-- <!DOCTYPE html>
<html>
<head>
<title>Data PDF</title>
<style>
@ -83,4 +294,4 @@
</body>
</html>
</html> --}}

4
resources/views/dashboard/Master_Data/Role/index.blade.php

@ -64,7 +64,7 @@
@include('pages.user.Master_Data.Role.index')
@endif
<!-- Edit Data Modal-->
<!-- Tambah Data Modal-->
<div class="modal fade" id="tambahDataModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
@ -103,7 +103,7 @@
</div>
</div>
<!-- Modal Edit -->
<!-- Edit data Modal -->
@foreach ($role as $data)
<div class="modal fade" id="editDataModal{{ $data['id'] }}" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel" aria-hidden="true">

22
resources/views/dashboard/Peminjaman/create.blade.php

@ -19,14 +19,16 @@
<select class="form-control" name="peti_id" type="text" id="peti_id" required>
<option disabled selected>Pilih Detail Peti</option>
@foreach ($peti_block as $data_peti)
<option value="{{ $data_peti->id }}" data-warehouse-id="{{ $data_peti->warehouse_id }}">
<option value="{{ $data_peti->id }}" data-warehouse-id="{{ $data_peti->warehouse_id }}"
data-customer-name="{{ $data_peti->customer->name }}">
{{ $data_peti->fix_lot }}
</option>
@endforeach
</select>
<label for="name" class="col-form-label">Customer: <span class="text-danger">*</span></label>
<input class="form-control" name="name" type="name" id="name"
value="{{ $data_peti->customer->name }}" readonly>
<label for="name" class="col-form-label">Customer:</label>
<input class="form-control" name="name" type="text" id="name" placeholder="Nama Customer"
readonly>
<label for="exit_at" class="col-form-label">Tanggal Peminjaman: <span
class="text-danger">*</span></label>
@ -83,7 +85,7 @@
});
</script>
<!-- otomatis asal gudang berdasarkan detail peti -->
<!-- otomatis asal gudang dan asal gudang berdasarkan detail peti -->
<script>
// Mendapatkan elemen select detail peti
const petiSelect = document.getElementById('peti_id');
@ -91,14 +93,24 @@
// Mendapatkan elemen select asal gudang
const exitWarehouseSelect = document.getElementById('exit_warehouse');
// Mendapatkan elemen input Customer
const nameInput = document.getElementById('name');
// Menambahkan event listener ke select detail peti
petiSelect.addEventListener('change', function() {
// Mendapatkan data-warehouse-id dari option yang dipilih
const selectedOption = this.options[this.selectedIndex];
const warehouseId = selectedOption.getAttribute('data-warehouse-id');
// Mendapatkan data-customer-name dari option yang dipilih
const customerName = selectedOption.getAttribute('data-customer-name');
// Memilih asal gudang berdasarkan data-warehouse-id
exitWarehouseSelect.value = warehouseId;
// Mengisi input Customer dengan nama pelanggan
nameInput.value = customerName;
});
</script>
@endsection

41
resources/views/dashboard/index.blade.php

@ -100,17 +100,32 @@
$chartData = app('App\Http\Controllers\HomeController')->generateChartData();
@endphp
<div class="card-body">
{{-- <div class="card-body">
<label for="yearFilter">Pilih Tahun:</label>
<select id="yearFilter" class="form-control">
<option value="" selected disabled>-- pilih tahun --</option>
@foreach ($chartData['years'] as $year)
<option value="{{ $year }}">{{ $year }}</option>
@if ($chartData['exitData'][$loop->index] || $chartData['enterData'][$loop->index])
<option value="{{ $year }}">{{ $year }}</option>
@endif
@endforeach
</select>
<canvas id="ChartAssetStatus" style="max-height: 500px;"></canvas> <!-- Atur tinggi chart -->
</div> --}}
<div class="card-body">
<label for="yearFilter">Pilih Tahun:</label>
<select id="yearFilter" class="form-control">
@foreach ($chartData['years'] as $year)
@if ($chartData['exitData'][$loop->index] || $chartData['enterData'][$loop->index])
<option value="{{ $year }}">{{ $year }}</option>
@endif
@endforeach
</select>
<canvas id="ChartAssetStatus" style="max-height: 500px;"></canvas>
</div>
</div>
</div>
@ -171,9 +186,9 @@
var updatedEnterData = chartData.enterData[selectedYearIndex];
// Memperbarui chart hanya dengan data tahun yang dipilih
myChart.data.labels = chartData.monthNames; // Menggunakan label bulan
myChart.data.datasets[0].data = updatedExitData; // Menggunakan data peminjaman
myChart.data.datasets[1].data = updatedEnterData; // Menggunakan data pengembalian
myChart.data.labels = chartData.monthNames;
myChart.data.datasets[0].data = updatedExitData;
myChart.data.datasets[1].data = updatedEnterData;
myChart.update();
}
@ -181,16 +196,18 @@
myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: chartData.monthNames, // Menggunakan label bulan
labels: chartData.monthNames, // Menggunakan nama bulan sebagai label
datasets: [{
label: 'Peminjaman',
data: chartData.exitData, // Menggunakan data peminjaman
data: chartData.exitData[
0], // Menggunakan data tahun saat ini sebagai awalan
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 1
}, {
label: 'Pengembalian',
data: chartData.enterData, // Menggunakan data pengembalian
data: chartData.enterData[
0], // Menggunakan data tahun saat ini sebagai awalan
backgroundColor: 'rgba(255, 159, 64, 0.2)',
borderColor: 'rgba(255, 159, 64, 1)',
borderWidth: 1
@ -221,9 +238,9 @@
updateChart(selectedYear);
} else {
// Jika tidak ada tahun yang disimpan, pilih tahun saat ini
var currentYear = new Date().getFullYear();
yearFilter.value = currentYear;
updateChart(currentYear);
selectedYear = new Date().getFullYear();
yearFilter.value = selectedYear;
updateChart(selectedYear);
}
});
</script>

3
resources/views/layouts/sidebar.blade.php

@ -84,6 +84,9 @@
<div class="bg-white py-2 collapse-inner rounded">
<a class="collapse-item {{ $active == 'menu-typepeti' ? 'active' : '' }}"
href="{{ route('dashboard.typepeti.index') }}">Tipe Peti</a>
<a class="collapse-item {{ $active == 'menu-kondisipeti' ? 'active' : '' }}"
href="{{ route('dashboard.kondisipeti.index') }}">Kondisi
Peti</a>
<a class="collapse-item {{ $active == 'menu-peti' ? 'active' : '' }}"
href="{{ route('dashboard.peti.index') }}">Peti</a>
</div>

12
routes/web.php

@ -10,6 +10,7 @@ use App\Http\Controllers\CustomerController;
use App\Http\Controllers\TypePetiController;
use App\Http\Controllers\WarehouseController;
use App\Http\Controllers\PeminjamanController;
use App\Http\Controllers\KondisiPetiController;
use App\Http\Controllers\PengembalianController;
use App\Http\Controllers\PetternLotPetiController;
@ -96,6 +97,17 @@ Route::prefix('dashboard')->name('dashboard.')->middleware(['auth'])->group(func
Route::delete('customer/delete/{id}', 'destroy')->name('customer.destroy');
});
Route::controller(KondisiPetiController::class)->group(function () {
Route::get('kondisipeti', 'index')->name('kondisipeti.index');
// Route::get('kondisipeti/create', 'create')->name('kondisipeti.create');
Route::post('kondisipeti/store', 'store')->name('kondisipeti.store');
// Route::get('kondisipeti/{id}', 'show')->name('kondisipeti.show');
// Route::get('kondisipeti/{id}/edit', 'edit')->name('kondisipeti.edit');
Route::put('kondisipeti/{id}', 'update')->name('kondisipeti.update');
Route::delete('kondisipeti/delete/{id}', 'destroy')->name('kondisipeti.destroy');
});
//Halaman Type Peti
Route::controller(TypePetiController::class)->group(function () {
Route::get('typepeti', 'index')->name('typepeti.index');

Loading…
Cancel
Save