fix form create update postcheck and precheck

This commit is contained in:
2025-09-19 20:44:28 +07:00
parent cab0d2e9a8
commit db4c586535
22 changed files with 4977 additions and 224 deletions

View File

@@ -320,7 +320,7 @@ use Illuminate\Support\Facades\Auth;
box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}
/* Claim tab specific styling */
/* Claim tab specific styling - Enhanced and Fixed */
#claimTransactionsTable {
font-size: 14px;
}
@@ -352,6 +352,186 @@ use Illuminate\Support\Facades\Auth;
font-weight: 600;
}
/* Fixed column widths for claim table */
#claimTransactionsTable th:nth-child(1),
#claimTransactionsTable td:nth-child(1) {
width: 12% !important;
min-width: 100px !important;
} /* Tanggal */
#claimTransactionsTable th:nth-child(2),
#claimTransactionsTable td:nth-child(2) {
width: 10% !important;
min-width: 80px !important;
} /* SPK */
#claimTransactionsTable th:nth-child(3),
#claimTransactionsTable td:nth-child(3) {
width: 12% !important;
min-width: 100px !important;
} /* No Polisi */
#claimTransactionsTable th:nth-child(4),
#claimTransactionsTable td:nth-child(4) {
width: 20% !important;
min-width: 150px !important;
} /* Pekerjaan */
#claimTransactionsTable th:nth-child(5),
#claimTransactionsTable td:nth-child(5) {
width: 8% !important;
min-width: 60px !important;
} /* Qty */
#claimTransactionsTable th:nth-child(6),
#claimTransactionsTable td:nth-child(6) {
width: 15% !important;
min-width: 120px !important;
} /* Service Advisor */
#claimTransactionsTable th:nth-child(7),
#claimTransactionsTable td:nth-child(7) {
width: 10% !important;
min-width: 80px !important;
} /* Status */
#claimTransactionsTable th:nth-child(8),
#claimTransactionsTable td:nth-child(8) {
width: 8% !important;
min-width: 80px !important;
} /* Aksi */
#claimTransactionsTable th:nth-child(9),
#claimTransactionsTable td:nth-child(9) {
width: 8% !important;
min-width: 100px !important;
} /* Pre Check */
#claimTransactionsTable th:nth-child(10),
#claimTransactionsTable td:nth-child(10) {
width: 8% !important;
min-width: 100px !important;
} /* Post Check */
/* Action column specific styling - Enhanced */
#claimTransactionsTable td:nth-child(8),
#claimTransactionsTable td:nth-child(9),
#claimTransactionsTable td:nth-child(10) {
text-align: center !important;
vertical-align: middle !important;
padding: 8px 4px !important;
}
/* Button alignment in action columns - Fixed */
#claimTransactionsTable td:nth-child(8) .btn,
#claimTransactionsTable td:nth-child(9) .btn,
#claimTransactionsTable td:nth-child(10) .btn {
margin: 1px 2px !important;
vertical-align: middle !important;
display: inline-block !important;
}
/* Specific button styling for different types */
#claimTransactionsTable .btn-success {
background-color: #28a745 !important;
border-color: #28a745 !important;
color: white !important;
}
#claimTransactionsTable .btn-warning {
background-color: #ffc107 !important;
border-color: #ffc107 !important;
color: #212529 !important;
}
#claimTransactionsTable .btn-primary {
background-color: #007bff !important;
border-color: #007bff !important;
color: white !important;
}
#claimTransactionsTable .btn-danger {
background-color: #dc3545 !important;
border-color: #dc3545 !important;
color: white !important;
}
/* Badge styling fixes */
#claimTransactionsTable .badge-warning {
background-color: #ffc107 !important;
color: #212529 !important;
}
#claimTransactionsTable .badge-success {
background-color: #28a745 !important;
color: white !important;
}
#claimTransactionsTable .badge-info {
background-color: #17a2b8 !important;
color: white !important;
}
#claimTransactionsTable .badge-danger {
background-color: #dc3545 !important;
color: white !important;
}
/* DataTable specific fixes */
#claimTransactionsTable_wrapper {
overflow-x: auto !important;
}
#claimTransactionsTable_wrapper .dataTables_scrollHead {
overflow: hidden !important;
}
#claimTransactionsTable_wrapper .dataTables_scrollBody {
overflow-x: auto !important;
}
/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
#claimTransactionsTable {
font-size: 12px !important;
}
#claimTransactionsTable th,
#claimTransactionsTable td {
padding: 8px 4px !important;
}
#claimTransactionsTable .btn {
font-size: 10px !important;
padding: 3px 6px !important;
min-width: 50px !important;
}
#claimTransactionsTable .badge {
font-size: 9px !important;
padding: 3px 6px !important;
}
/* Adjust column widths for mobile */
#claimTransactionsTable th:nth-child(4),
#claimTransactionsTable td:nth-child(4) {
width: 25% !important;
min-width: 120px !important;
} /* Pekerjaan - wider on mobile */
}
/* Additional fixes for DataTable rendering */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
color: #333 !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
padding: 0.5em 1em !important;
margin: 0 2px !important;
border-radius: 4px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
background: #007bff !important;
color: white !important;
border: 1px solid #007bff !important;
}
/* Tab claim specific styling */
#form-claim {
background-color: #fff;
@@ -737,9 +917,6 @@ use Illuminate\Support\Facades\Auth;
<input type="hidden" name="category" value="work">
<div class="work_multirow">
@if (old('work_id') && old('form') == 'work')
{{-- @php
dd($errors->all());
@endphp --}}
<input type="hidden" class="work_field_counter" value="{{ count(old('work_id')) }}">
@for ($i = 0; $i < count(old('work_id')); $i++)
<div class="form-group row" id="work_field{{ $i+1 }}">
@@ -957,20 +1134,21 @@ use Illuminate\Support\Facades\Auth;
<h6 class="mb-3">Daftar Pekerjaan yang Dapat Diklaim</h6>
<div class="table-responsive">
<table class="table table-bordered table-hover" id="claimTransactionsTable">
<thead class="thead-light">
<thead>
<tr>
<th width="10%">Tanggal</th>
<th width="15%">No. SPK</th>
<th width="15%">No. Polisi</th>
<th width="20%">Pekerjaan</th>
<th width="10%">Qty</th>
<th width="15%">Service Advisor</th>
<th width="10%">Status</th>
<th width="5%">Aksi</th>
<th>Tanggal</th>
<th>SPK</th>
<th>No Polisi</th>
<th>Pekerjaan</th>
<th>Qty</th>
<th>Service Advisor</th>
<th>Status</th>
<th>Aksi</th>
<th>Pre Check</th>
<th>Post Check</th>
</tr>
</thead>
<tbody>
<!-- Data will be loaded via DataTables AJAX -->
</tbody>
</table>
</div>
@@ -1180,6 +1358,73 @@ use Illuminate\Support\Facades\Auth;
</div>
</div>
<!-- Modal Edit Transaksi -->
<div class="modal fade" id="editTransactionModal" tabindex="-1" role="dialog" aria-labelledby="editTransactionModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="editTransactionModalLabel">Edit Transaksi</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form id="editTransactionForm" action="" method="POST">
@csrf
@method('PUT')
<input type="hidden" name="transaction_id" value="">
<input type="hidden" name="from_transaction_page" value="1">
<div class="modal-body">
<div class="form-group">
<label>No. SPK</label>
<input type="text" class="form-control" name="spk" placeholder="No. SPK" required>
</div>
<div class="form-group">
<label>Tanggal</label>
<input type="text" class="form-control" name="date" id="edit-transaction-date" placeholder="YYYY-MM-DD" required>
</div>
<div class="form-group">
<label>No. Polisi</label>
<input type="text" class="form-control" name="police_number" placeholder="No. Polisi" required>
</div>
<div class="form-group">
<label>Pekerjaan</label>
<select class="form-control" name="work_id" required>
<option value="" disabled>Pilih Pekerjaan</option>
@foreach ($work_works as $work)
<option value="{{ $work->id }}">{{ $work->name }}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label>Qty</label>
<input type="number" class="form-control" name="qty" min="1" placeholder="Qty" required>
</div>
<div class="form-group">
<label>Warranty</label>
<select class="form-control" name="warranty" required>
<option value="1">Ya</option>
<option value="0">Tidak</option>
</select>
</div>
<div class="form-group">
<label>Service Advisor</label>
<select class="form-control" name="user_sa_id" required>
<option value="">Pilih Service Advisor</option>
@foreach ($user_sas as $user_sa)
<option value="{{ $user_sa->id }}">{{ $user_sa->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<button type="submit" class="btn btn-success" id="editTransactionButton">Simpan</button>
</div>
</form>
</div>
</div>
</div>
<!-- Modal Detail Mutasi -->
<div class="modal fade" id="mutationDetailModal" tabindex="-1" role="dialog" aria-labelledby="mutationDetailModalLabel">
<div class="modal-dialog modal-xl" role="document">
@@ -1866,6 +2111,11 @@ use Illuminate\Support\Facades\Auth;
autoclose: true,
todayHighlight: true
});
$("#edit-transaction-date").datepicker({
format: 'yyyy-mm-dd',
autoclose: true,
todayHighlight: true
});
$("#date-opname").datepicker({
format: 'yyyy-mm-dd',
autoclose: true,
@@ -2508,19 +2758,21 @@ use Illuminate\Support\Facades\Auth;
}
},
columns: [
{data: 'date', name: 'date'},
{data: 'spk', name: 'spk'},
{data: 'police_number', name: 'police_number'},
{data: 'work_name', name: 'work_name'},
{data: 'qty', name: 'qty'},
{data: 'sa_name', name: 'sa_name'},
{data: 'status', name: 'status', orderable: false},
{data: 'action', name: 'action', orderable: false, searchable: false}
{data: 'date', name: 'date', title: 'Tanggal'},
{data: 'spk', name: 'spk', title: 'SPK'},
{data: 'police_number', name: 'police_number', title: 'No Polisi'},
{data: 'work_name', name: 'work_name', title: 'Pekerjaan'},
{data: 'qty', name: 'qty', title: 'Qty'},
{data: 'sa_name', name: 'sa_name', title: 'Service Advisor'},
{data: 'status', name: 'status', title: 'Status', orderable: false},
{data: 'action', name: 'action', title: 'Aksi', orderable: false, searchable: false},
{data: 'action_precheck', name: 'action_precheck', title: 'Pre Check', orderable: false, searchable: false},
{data: 'action_postcheck', name: 'action_postcheck', title: 'Post Check', orderable: false, searchable: false},
],
pageLength: 10,
responsive: true,
scrollX: true,
order: [[0, 'desc']], // Sort by date descending
order: [[0, 'desc']]
});
}
@@ -2934,49 +3186,71 @@ use Illuminate\Support\Facades\Auth;
}
function editTransaction(transactionId) {
// Redirect to edit page or show edit modal
window.location.href = '{{ route("transaction.edit", ":id") }}'.replace(':id', transactionId);
// Load transaction data and show modal with form
$('#editTransactionModal').modal('show');
const url = '{{ route("transaction.edit", ":id") }}'.replace(':id', transactionId);
const action = '{{ route("transaction.update", ":id") }}'.replace(':id', transactionId);
// Reset form
const form = document.getElementById('editTransactionForm');
form.reset();
form.action = action;
form.querySelector('input[name="transaction_id"]').value = transactionId;
// Fetch data
$.get(url, function(response) {
if (response && response.status === 200 && response.data) {
const trx = response.data;
form.querySelector('input[name="spk"]').value = trx.spk || '';
form.querySelector('input[name="date"]').value = trx.date || '';
form.querySelector('input[name="police_number"]').value = trx.police_number || '';
form.querySelector('select[name="work_id"]').value = trx.work_id || '';
form.querySelector('input[name="qty"]').value = trx.qty || 1;
form.querySelector('select[name="warranty"]').value = String(trx.warranty ?? '0');
form.querySelector('select[name="user_sa_id"]').value = trx.user_sa_id || '';
} else {
Swal.fire({ icon: 'error', title: 'Error', text: 'Gagal memuat data transaksi' });
}
}).fail(function() {
Swal.fire({ icon: 'error', title: 'Error', text: 'Terjadi kesalahan saat memuat data' });
});
}
function deleteTransaction(transactionId) {
Swal.fire({
title: 'Konfirmasi Hapus',
text: 'Apakah Anda yakin ingin menghapus transaksi ini?',
html: '<div class="text-left">Tindakan ini tidak dapat dibatalkan.<br>Hapus transaksi ini?</div>',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#d33',
cancelButtonColor: '#3085d6',
confirmButtonText: 'Ya, Hapus!',
cancelButtonColor: '#6c757d',
confirmButtonText: 'Ya, Hapus',
cancelButtonText: 'Batal'
}).then((result) => {
if (result.isConfirmed) {
// Send delete request
$.ajax({
url: '{{ route("transaction.destroy", ":id") }}'.replace(':id', transactionId),
method: 'DELETE',
method: 'POST',
data: {
_method: 'DELETE',
_token: '{{ csrf_token() }}'
},
success: function(response) {
Swal.fire({
icon: 'success',
title: 'Berhasil!',
text: 'Transaksi berhasil dihapus',
timer: 2000,
title: 'Berhasil',
text: response && response.message ? response.message : 'Transaksi berhasil dihapus',
timer: 1800,
showConfirmButton: false
}).then(() => {
// Refresh the table
if (claimTransactionsTable) {
claimTransactionsTable.ajax.reload();
claimTransactionsTable.ajax.reload(null, false);
}
});
},
error: function() {
Swal.fire({
icon: 'error',
title: 'Error',
text: 'Gagal menghapus transaksi'
});
error: function(xhr) {
const msg = (xhr.responseJSON && xhr.responseJSON.message) ? xhr.responseJSON.message : 'Gagal menghapus transaksi';
Swal.fire({ icon: 'error', title: 'Error', text: msg });
}
});
}
@@ -3274,6 +3548,51 @@ use Illuminate\Support\Facades\Auth;
initializePhysicalStock();
handleServerSideErrors();
initializeTabs();
// Handle edit transaction form submit via AJAX
$(document).on('submit', '#editTransactionForm', function(e) {
e.preventDefault();
const form = this;
const action = form.action;
const formData = $(form).serialize();
// Disable button to prevent double submit
const $btn = $('#editTransactionButton');
$btn.prop('disabled', true).html('<i class="fa fa-spinner fa-spin"></i> Menyimpan...');
$.ajax({
url: action,
method: 'POST',
data: formData,
success: function(response) {
$('#editTransactionModal').modal('hide');
Swal.fire({
icon: 'success',
title: 'Berhasil',
text: (response && response.message) ? response.message : 'Transaksi berhasil diperbarui',
timer: 1800,
showConfirmButton: false
}).then(() => {
if (claimTransactionsTable) {
claimTransactionsTable.ajax.reload(null, false);
}
});
},
error: function(xhr) {
let msg = 'Gagal memperbarui transaksi';
if (xhr.responseJSON && xhr.responseJSON.errors) {
const errors = xhr.responseJSON.errors;
msg = Object.values(errors).flat().join('\n');
} else if (xhr.responseJSON && xhr.responseJSON.message) {
msg = xhr.responseJSON.message;
}
Swal.fire({ icon: 'error', title: 'Error', text: msg });
},
complete: function() {
$btn.prop('disabled', false).text('Simpan');
}
});
});
});
// Handle sub-tab switching for transaksi tabs

View File

@@ -7,7 +7,6 @@
<a href="{{ route('transaction') }}" class="mt-4 btn btn-danger"><i class="fa fa-chevron-left"></i> Kembali</a>
</div>
<div class="col-8">
{{-- <h5 class="text-center mt-4">Cipta Kreasi Baru</h5> --}}
<a href="/"><img src="{{ asset('logo-ckb.png') }}" style="width: 100%" alt="LOGO CKB"></a>
</div>
</div>
@@ -294,17 +293,6 @@
$string .= "*TOTAL: ".$total_qty." Unit*\n\n";
$overall_total += $total_qty;
// Remove monthly data display since this is daily report
// if (isset($trx['total_body']) && is_array($trx['total_body'])) {
// foreach ($trx['total_body'] as $total) {
// $string .= $total;
// }
// }
// if (isset($trx['total_total'])) {
// $string .= $trx['total_total']."\n\n";
// }
}
} else {
$string .= "*Tidak ada data transaksi hari ini*\n\n";
@@ -385,6 +373,18 @@
<script>
$("#kt-table").DataTable()
function precheck(id) {
let url = $("#precheck"+id).attr("data-url")
console.log(url)
// window.open(url, "_blank")
}
function postcheck(id) {
let url = $("#postcheck"+id).attr("data-url")
console.log(url)
// window.open(url, "_blank")
}
// Check if Web Share API is supported
function isWebShareSupported() {
return navigator.share && typeof navigator.share === 'function';

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
@extends('layouts.frontapp')
@section('content')
@include('transaction.postchecks._form')
@endsection

View File

@@ -0,0 +1,5 @@
@extends('layouts.frontapp')
@section('content')
@include('transaction.postchecks._form')
@endsection

View File

@@ -0,0 +1,397 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Print Postcheck - {{ $postcheck->spk_number ?? '-' }}</title>
<style>
@media print {
@page {
margin: 0.5in;
size: A4;
}
body {
-webkit-print-color-adjust: exact;
color-adjust: exact;
}
.no-print {
display: none !important;
}
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
font-size: 12px;
line-height: 1.4;
color: #333;
background: white;
}
.container {
width: 100%;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.header {
border-bottom: 3px solid #2c5282;
padding-bottom: 20px;
margin-bottom: 30px;
}
.company-info {
text-align: center;
margin-bottom: 15px;
}
.company-name {
font-size: 24px;
font-weight: bold;
color: #2c5282;
margin-bottom: 5px;
}
.company-tagline {
font-size: 14px;
color: #666;
margin-bottom: 10px;
}
.document-title {
text-align: center;
font-size: 18px;
font-weight: bold;
color: #2c5282;
text-transform: uppercase;
letter-spacing: 1px;
}
.info-section {
display: flex;
justify-content: space-between;
margin-bottom: 30px;
flex-wrap: wrap;
}
.info-box {
flex: 1;
min-width: 250px;
margin-right: 20px;
}
.info-box:last-child {
margin-right: 0;
}
.info-title {
font-weight: bold;
color: #2c5282;
margin-bottom: 10px;
font-size: 14px;
border-bottom: 1px solid #e2e8f0;
padding-bottom: 5px;
}
.info-item {
display: flex;
justify-content: space-between;
padding: 4px 0;
border-bottom: 1px dotted #e2e8f0;
}
.info-label {
font-weight: 600;
color: #4a5568;
width: 45%;
}
.info-value {
color: #2d3748;
width: 50%;
text-align: right;
}
.section-title {
font-size: 16px;
font-weight: bold;
color: #2c5282;
margin: 20px 0 10px;
text-transform: uppercase;
}
.data-table {
width: 100%;
border-collapse: collapse;
border: 1px solid #e2e8f0;
margin-bottom: 20px;
}
.data-table th {
background-color: #2c5282;
color: white;
padding: 12px 8px;
text-align: left;
font-weight: bold;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.data-table td {
padding: 10px 8px;
border-bottom: 1px solid #e2e8f0;
vertical-align: top;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 15px;
}
.card {
background: #ffffff;
border: 1px solid #e2e8f0;
border-radius: 6px;
padding: 12px;
}
.image-box {
border: 1px solid #e2e8f0;
border-radius: 6px;
padding: 10px;
text-align: center;
background: #f7fafc;
}
.image-box img {
max-width: 100%;
max-height: 240px;
border-radius: 4px;
}
.notes-section {
background-color: #f7fafc;
border-left: 4px solid #2c5282;
padding: 15px;
margin: 20px 0;
}
.footer {
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #e2e8f0;
}
.signatures {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20px;
margin-top: 20px;
}
.signature-box {
text-align: center;
}
.signature-line {
margin-top: 60px;
border-top: 1px solid #2d3748;
padding-top: 4px;
font-size: 12px;
color: #2d3748;
}
.print-button {
position: fixed;
top: 20px;
right: 20px;
background-color: #2c5282;
color: white;
border: none;
padding: 12px 24px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: bold;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
z-index: 1000;
}
.print-button:hover {
background-color: #2a4365;
}
.text-right { text-align: right; }
.text-center { text-align: center; }
</style>
</head>
<body>
<button class="print-button no-print" onclick="window.print()">Print</button>
<div class="container">
<div class="header">
<div class="company-info">
<div class="company-name">PT. CIPTA KREASI BARU</div>
<div class="company-tagline">Postcheck Kendaraan</div>
</div>
<div class="document-title">Dokumen Postcheck</div>
</div>
<div class="info-section">
<div class="info-box">
<div class="info-title">Informasi Transaksi</div>
<div class="info-item">
<span class="info-label">No. Polisi</span>
<span class="info-value">{{ $postcheck->police_number ?? $postcheck->transaction->police_number ?? '-' }}</span>
</div>
<div class="info-item">
<span class="info-label">No. SPK</span>
<span class="info-value">{{ $postcheck->spk_number ?? $postcheck->transaction->spk ?? '-' }}</span>
</div>
<div class="info-item">
<span class="info-label">Tanggal Postcheck</span>
<span class="info-value">{{ optional($postcheck->postcheck_at)->format('d F Y H:i') }}</span>
</div>
<div class="info-item">
<span class="info-label">Dibuat oleh</span>
<span class="info-value">{{ $postcheck->postcheckBy->name ?? '-' }}</span>
</div>
</div>
<div class="info-box">
<div class="info-title">Parameter Utama</div>
<div class="info-item">
<span class="info-label">Kilometer</span>
<span class="info-value">{{ number_format((float)($postcheck->kilometer ?? 0), 2) }}</span>
</div>
<div class="info-item">
<span class="info-label">Tekanan High</span>
<span class="info-value">{{ number_format((float)($postcheck->pressure_high ?? 0), 2) }}</span>
</div>
<div class="info-item">
<span class="info-label">Tekanan Low</span>
<span class="info-value">{{ number_format((float)($postcheck->pressure_low ?? 0), 2) }}</span>
</div>
<div class="info-item">
<span class="info-label">Suhu Kabin</span>
<span class="info-value">{{ isset($postcheck->cabin_temperature) ? number_format((float)$postcheck->cabin_temperature, 2) : '-' }}</span>
</div>
</div>
</div>
<div class="section-title">Kondisi Komponen</div>
<table class="data-table">
<thead>
<tr>
<th style="width: 35%;">Komponen</th>
<th style="width: 25%;">Status Pekerjaan</th>
</tr>
</thead>
<tbody>
<tr>
<td>AC</td>
<td>{{ $postcheck->ac_condition ?? '-' }}</td>
</tr>
<tr>
<td>Blower</td>
<td>{{ $postcheck->blower_condition ?? '-' }}</td>
</tr>
<tr>
<td>Evaporator</td>
<td>{{ $postcheck->evaporator_condition ?? '-' }}</td>
</tr>
<tr>
<td>Compressor</td>
<td>{{ $postcheck->compressor_condition ?? '-' }}</td>
</tr>
</tbody>
</table>
<div class="section-title">Dokumentasi Foto</div>
<div class="grid">
<div class="card">
<div class="info-title" style="margin-bottom:8px;">Depan</div>
<div class="image-box">
@if($postcheck->front_image_url || $postcheck->front_image)
<img src="{{ $postcheck->front_image_url ?? asset('storage/' . ltrim($postcheck->front_image, '/')) }}" alt="Foto Depan">
@else
<div>Tidak ada gambar</div>
@endif
</div>
</div>
<div class="card">
<div class="info-title" style="margin-bottom:8px;">Suhu Kabin</div>
<div class="image-box">
@if($postcheck->cabin_temperature_image_url || $postcheck->cabin_temperature_image)
<img src="{{ $postcheck->cabin_temperature_image_url ?? asset('storage/' . ltrim($postcheck->cabin_temperature_image, '/')) }}" alt="Foto Suhu Kabin">
@else
<div>Tidak ada gambar</div>
@endif
</div>
</div>
<div class="card">
<div class="info-title" style="margin-bottom:8px;">AC</div>
<div class="image-box">
@if($postcheck->ac_image_url || $postcheck->ac_image)
<img src="{{ $postcheck->ac_image_url ?? asset('storage/' . ltrim($postcheck->ac_image, '/')) }}" alt="Foto AC">
@else
<div>Tidak ada gambar</div>
@endif
</div>
</div>
<div class="card">
<div class="info-title" style="margin-bottom:8px;">Blower</div>
<div class="image-box">
@if($postcheck->blower_image_url || $postcheck->blower_image)
<img src="{{ $postcheck->blower_image_url ?? asset('storage/' . ltrim($postcheck->blower_image, '/')) }}" alt="Foto Blower">
@else
<div>Tidak ada gambar</div>
@endif
</div>
</div>
<div class="card">
<div class="info-title" style="margin-bottom:8px;">Evaporator</div>
<div class="image-box">
@if($postcheck->evaporator_image_url || $postcheck->evaporator_image)
<img src="{{ $postcheck->evaporator_image_url ?? asset('storage/' . ltrim($postcheck->evaporator_image, '/')) }}" alt="Foto Evaporator">
@else
<div>Tidak ada gambar</div>
@endif
</div>
</div>
</div>
@if($postcheck->postcheck_notes)
<div class="notes-section">
<div class="info-title" style="border:0; padding:0; margin:0 0 6px 0;">Catatan</div>
<div>{{ $postcheck->postcheck_notes }}</div>
</div>
@endif
<div class="footer">
<div class="text-center" style="color:#666; font-size: 11px;">
Dicetak pada: {{ now()->format('d F Y H:i:s') }} | Sistem Postcheck PT. Cipta Kreasi Baru
</div>
</div>
</div>
<script>
document.addEventListener('keydown', function(e) {
if (e.ctrlKey && e.key === 'p') {
e.preventDefault();
window.print();
}
});
</script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
@extends('layouts.frontapp')
@section('content')
@include('transaction.prechecks._form')
@endsection

View File

@@ -0,0 +1,5 @@
@extends('layouts.frontapp')
@section('content')
@include('transaction.prechecks._form')
@endsection

View File

@@ -0,0 +1,397 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Print Precheck - {{ $precheck->spk_number ?? '-' }}</title>
<style>
@media print {
@page {
margin: 0.5in;
size: A4;
}
body {
-webkit-print-color-adjust: exact;
color-adjust: exact;
}
.no-print {
display: none !important;
}
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
font-size: 12px;
line-height: 1.4;
color: #333;
background: white;
}
.container {
width: 100%;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.header {
border-bottom: 3px solid #2c5282;
padding-bottom: 20px;
margin-bottom: 30px;
}
.company-info {
text-align: center;
margin-bottom: 15px;
}
.company-name {
font-size: 24px;
font-weight: bold;
color: #2c5282;
margin-bottom: 5px;
}
.company-tagline {
font-size: 14px;
color: #666;
margin-bottom: 10px;
}
.document-title {
text-align: center;
font-size: 18px;
font-weight: bold;
color: #2c5282;
text-transform: uppercase;
letter-spacing: 1px;
}
.info-section {
display: flex;
justify-content: space-between;
margin-bottom: 30px;
flex-wrap: wrap;
}
.info-box {
flex: 1;
min-width: 250px;
margin-right: 20px;
}
.info-box:last-child {
margin-right: 0;
}
.info-title {
font-weight: bold;
color: #2c5282;
margin-bottom: 10px;
font-size: 14px;
border-bottom: 1px solid #e2e8f0;
padding-bottom: 5px;
}
.info-item {
display: flex;
justify-content: space-between;
padding: 4px 0;
border-bottom: 1px dotted #e2e8f0;
}
.info-label {
font-weight: 600;
color: #4a5568;
width: 45%;
}
.info-value {
color: #2d3748;
width: 50%;
text-align: right;
}
.section-title {
font-size: 16px;
font-weight: bold;
color: #2c5282;
margin: 20px 0 10px;
text-transform: uppercase;
}
.data-table {
width: 100%;
border-collapse: collapse;
border: 1px solid #e2e8f0;
margin-bottom: 20px;
}
.data-table th {
background-color: #2c5282;
color: white;
padding: 12px 8px;
text-align: left;
font-weight: bold;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.data-table td {
padding: 10px 8px;
border-bottom: 1px solid #e2e8f0;
vertical-align: top;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 15px;
}
.card {
background: #ffffff;
border: 1px solid #e2e8f0;
border-radius: 6px;
padding: 12px;
}
.image-box {
border: 1px solid #e2e8f0;
border-radius: 6px;
padding: 10px;
text-align: center;
background: #f7fafc;
}
.image-box img {
max-width: 100%;
max-height: 240px;
border-radius: 4px;
}
.notes-section {
background-color: #f7fafc;
border-left: 4px solid #2c5282;
padding: 15px;
margin: 20px 0;
}
.footer {
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #e2e8f0;
}
.signatures {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20px;
margin-top: 20px;
}
.signature-box {
text-align: center;
}
.signature-line {
margin-top: 60px;
border-top: 1px solid #2d3748;
padding-top: 4px;
font-size: 12px;
color: #2d3748;
}
.print-button {
position: fixed;
top: 20px;
right: 20px;
background-color: #2c5282;
color: white;
border: none;
padding: 12px 24px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: bold;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
z-index: 1000;
}
.print-button:hover {
background-color: #2a4365;
}
.text-right { text-align: right; }
.text-center { text-align: center; }
</style>
</head>
<body>
<button class="print-button no-print" onclick="window.print()">Print</button>
<div class="container">
<div class="header">
<div class="company-info">
<div class="company-name">PT. CIPTA KREASI BARU</div>
<div class="company-tagline">Precheck Kendaraan</div>
</div>
<div class="document-title">Dokumen Precheck</div>
</div>
<div class="info-section">
<div class="info-box">
<div class="info-title">Informasi Transaksi</div>
<div class="info-item">
<span class="info-label">No. Polisi</span>
<span class="info-value">{{ $precheck->police_number ?? $precheck->transaction->police_number ?? '-' }}</span>
</div>
<div class="info-item">
<span class="info-label">No. SPK</span>
<span class="info-value">{{ $precheck->spk_number ?? $precheck->transaction->spk ?? '-' }}</span>
</div>
<div class="info-item">
<span class="info-label">Tanggal Precheck</span>
<span class="info-value">{{ optional($precheck->precheck_at)->format('d F Y H:i') }}</span>
</div>
<div class="info-item">
<span class="info-label">Dibuat oleh</span>
<span class="info-value">{{ $precheck->precheckBy->name ?? '-' }}</span>
</div>
</div>
<div class="info-box">
<div class="info-title">Parameter Utama</div>
<div class="info-item">
<span class="info-label">Kilometer</span>
<span class="info-value">{{ number_format((float)($precheck->kilometer ?? 0), 2) }}</span>
</div>
<div class="info-item">
<span class="info-label">Tekanan High</span>
<span class="info-value">{{ number_format((float)($precheck->pressure_high ?? 0), 2) }}</span>
</div>
<div class="info-item">
<span class="info-label">Tekanan Low</span>
<span class="info-value">{{ number_format((float)($precheck->pressure_low ?? 0), 2) }}</span>
</div>
<div class="info-item">
<span class="info-label">Suhu Kabin</span>
<span class="info-value">{{ isset($precheck->cabin_temperature) ? number_format((float)$precheck->cabin_temperature, 2) : '-' }}</span>
</div>
</div>
</div>
<div class="section-title">Kondisi Komponen</div>
<table class="data-table">
<thead>
<tr>
<th style="width: 35%;">Komponen</th>
<th style="width: 25%;">Kondisi</th>
</tr>
</thead>
<tbody>
<tr>
<td>AC</td>
<td>{{ $precheck->ac_condition ?? '-' }}</td>
</tr>
<tr>
<td>Blower</td>
<td>{{ $precheck->blower_condition ?? '-' }}</td>
</tr>
<tr>
<td>Evaporator</td>
<td>{{ $precheck->evaporator_condition ?? '-' }}</td>
</tr>
<tr>
<td>Compressor</td>
<td>{{ $precheck->compressor_condition ?? '-' }}</td>
</tr>
</tbody>
</table>
<div class="section-title">Dokumentasi Foto</div>
<div class="grid">
<div class="card">
<div class="info-title" style="margin-bottom:8px;">Depan</div>
<div class="image-box">
@if($precheck->front_image_url || $precheck->front_image)
<img src="{{ $precheck->front_image_url ?? asset('storage/' . ltrim($precheck->front_image, '/')) }}" alt="Foto Depan">
@else
<div>Tidak ada gambar</div>
@endif
</div>
</div>
<div class="card">
<div class="info-title" style="margin-bottom:8px;">Suhu Kabin</div>
<div class="image-box">
@if($precheck->cabin_temperature_image_url || $precheck->cabin_temperature_image)
<img src="{{ $precheck->cabin_temperature_image_url ?? asset('storage/' . ltrim($precheck->cabin_temperature_image, '/')) }}" alt="Foto Suhu Kabin">
@else
<div>Tidak ada gambar</div>
@endif
</div>
</div>
<div class="card">
<div class="info-title" style="margin-bottom:8px;">AC</div>
<div class="image-box">
@if($precheck->ac_image_url || $precheck->ac_image)
<img src="{{ $precheck->ac_image_url ?? asset('storage/' . ltrim($precheck->ac_image, '/')) }}" alt="Foto AC">
@else
<div>Tidak ada gambar</div>
@endif
</div>
</div>
<div class="card">
<div class="info-title" style="margin-bottom:8px;">Blower</div>
<div class="image-box">
@if($precheck->blower_image_url || $precheck->blower_image)
<img src="{{ $precheck->blower_image_url ?? asset('storage/' . ltrim($precheck->blower_image, '/')) }}" alt="Foto Blower">
@else
<div>Tidak ada gambar</div>
@endif
</div>
</div>
<div class="card">
<div class="info-title" style="margin-bottom:8px;">Evaporator</div>
<div class="image-box">
@if($precheck->evaporator_image_url || $precheck->evaporator_image)
<img src="{{ $precheck->evaporator_image_url ?? asset('storage/' . ltrim($precheck->evaporator_image, '/')) }}" alt="Foto Evaporator">
@else
<div>Tidak ada gambar</div>
@endif
</div>
</div>
</div>
@if($precheck->precheck_notes)
<div class="notes-section">
<div class="info-title" style="border:0; padding:0; margin:0 0 6px 0;">Catatan</div>
<div>{{ $precheck->precheck_notes }}</div>
</div>
@endif
<div class="footer">
<div class="text-center" style="color:#666; font-size: 11px;">
Dicetak pada: {{ now()->format('d F Y H:i:s') }} | Sistem Precheck PT. Cipta Kreasi Baru
</div>
</div>
</div>
<script>
document.addEventListener('keydown', function(e) {
if (e.ctrlKey && e.key === 'p') {
e.preventDefault();
window.print();
}
});
</script>
</body>
</html>