create feature sa create list claim and price to work per dealer

This commit is contained in:
2025-07-07 19:11:04 +07:00
parent fa554446ca
commit 956df5cfe6
16 changed files with 3062 additions and 404 deletions

View File

@@ -0,0 +1,322 @@
@extends('layouts.backapp')
@section('content')
<style type="text/css">
/* Action button flex layout */
.d-flex.flex-row.gap-1 {
display: flex !important;
flex-direction: row !important;
gap: 0.25rem !important;
align-items: center;
flex-wrap: nowrap;
}
.d-flex.flex-row.gap-1 .btn {
white-space: nowrap;
margin: 0;
padding: 0.375rem 0.75rem;
font-size: 0.875rem;
line-height: 1.5;
border-radius: 0.2rem;
}
.d-flex.flex-row.gap-1 .btn i {
margin-right: 0.25rem;
}
/* Ensure DataTables doesn't break flex layout */
.dataTables_wrapper .dataTables_scrollBody .d-flex {
display: flex !important;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.d-flex.flex-row.gap-1 {
flex-direction: column !important;
gap: 0.125rem !important;
}
.d-flex.flex-row.gap-1 .btn {
width: 100%;
margin-bottom: 0.125rem;
}
}
/* Form control styling */
.form-control {
border-radius: 0.375rem;
border: 1px solid #ced4da;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.form-control:focus {
border-color: #007bff;
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
.btn {
border-radius: 0.375rem;
font-weight: 500;
transition: all 0.15s ease-in-out;
}
.btn i {
font-size: 0.875rem;
}
/* Status text styling */
.status-text {
font-weight: 600;
transition: color 0.15s ease-in-out;
}
.status-text.active {
color: #28a745;
}
.status-text.inactive {
color: #dc3545;
}
/* Input group styling */
.input-group-text {
background-color: #e9ecef;
border: 1px solid #ced4da;
color: #495057;
font-weight: 500;
}
/* Table styling */
.table th {
background-color: #f8f9fa;
border-color: #dee2e6;
font-weight: 600;
color: #495057;
}
.table td {
vertical-align: middle;
}
/* Price input styling */
.price-input {
text-align: right;
font-weight: 500;
font-size: 1.15rem;
}
.price-input:focus {
border-color: #80bdff;
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
/* Status label styling */
.custom-control-label {
font-size: 0.875rem;
font-weight: 500;
}
/* Table styling */
.table th {
background-color: #f8f9fa;
border-color: #dee2e6;
font-weight: 600;
color: #495057;
}
.table td {
vertical-align: middle;
}
/* Status label styling */
.custom-control-label {
font-size: 0.875rem;
font-weight: 500;
}
/* Alert styling */
.alert {
border-radius: 0.5rem;
border: none;
}
.alert-info {
background-color: #d1ecf1;
color: #0c5460;
}
.alert-warning {
background-color: #fff3cd;
color: #856404;
}
/* Button loading state */
.btn.loading {
opacity: 0.7;
cursor: not-allowed;
}
.btn:disabled {
opacity: 0.6;
cursor: not-allowed;
}
/* Loading overlay */
#loading-overlay {
backdrop-filter: blur(2px);
}
#loading-overlay .spinner-border {
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
<div class="kt-portlet kt-portlet--mobile" id="kt_blockui_datatable">
<div class="kt-portlet__head kt-portlet__head--lg">
<div class="kt-portlet__head-label">
<span class="kt-portlet__head-icon">
<i class="kt-font-brand flaticon2-line-chart"></i>
</span>
<h3 class="kt-portlet__head-title">
Set Harga Pekerjaan: <strong>{{ $work->name }}</strong>
</h3>
</div>
<div class="kt-portlet__head-toolbar">
<div class="kt-portlet__head-wrapper">
<div class="kt-portlet__head-actions">
<button type="button" class="btn btn-bold btn-label-brand" id="btn-save-all">
Simpan Semua Harga
</button>
</div>
</div>
</div>
</div>
<div class="kt-portlet__body">
<div class="table-responsive">
<!--begin: Datatable -->
<table class="table table-striped table-bordered table-hover table-checkable" id="dealers-table">
<thead>
<tr>
<th width="5%">No</th>
<th width="25%">Nama Dealer</th>
<th width="15%">Kode Dealer</th>
<th width="20%">Harga (IDR)</th>
<th width="10%">Status</th>
<th width="15%">Aksi</th>
</tr>
</thead>
<tbody>
@foreach($dealers as $index => $dealer)
@php
$existingPrice = $work->getPriceForDealer($dealer->id);
@endphp
<tr data-dealer-id="{{ $dealer->id }}">
<td>{{ $index + 1 }}</td>
<td>{{ $dealer->name }}</td>
<td>{{ $dealer->dealer_code }}</td>
<td>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">Rp</span>
</div>
<input type="text"
class="form-control price-input"
name="price_{{ $dealer->id }}"
value="{{ $existingPrice ? number_format($existingPrice->price, 0, ',', '.') : '0' }}"
placeholder="0"
data-dealer-id="{{ $dealer->id }}"
data-original-value="{{ $existingPrice ? $existingPrice->price : '0' }}">
</div>
</td>
<td>
<input type="checkbox"
class="status-input"
id="status_{{ $dealer->id }}"
name="status_{{ $dealer->id }}"
data-dealer-id="{{ $dealer->id }}"
{{ $existingPrice && $existingPrice->is_active ? 'checked' : '' }}>
<label for="status_{{ $dealer->id }}" style="margin-left: 0.5rem; font-weight: 500;">Aktif</label>
</td>
<td>
<div class="d-flex flex-row gap-1">
<button type="button"
class="btn btn-sm {{ $existingPrice ? 'btn-warning' : 'btn-success' }} save-single"
data-dealer-id="{{ $dealer->id }}"
title="{{ $existingPrice ? 'Update Harga' : 'Simpan Harga' }}">
{{ $existingPrice ? 'Update' : 'Simpan' }}
</button>
@if($existingPrice)
<button type="button"
class="btn btn-sm btn-danger delete-price"
data-price-id="{{ $existingPrice->id }}"
data-dealer-id="{{ $dealer->id }}"
title="Hapus Harga">
Hapus
</button>
@endif
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
<!--end: Datatable -->
</div>
@if($dealers->count() == 0)
<div class="row">
<div class="col-12">
<div class="alert alert-warning text-center">
<i class="fa fa-exclamation-triangle mr-2"></i>
Tidak ada dealer yang tersedia.
</div>
</div>
</div>
@endif
</div>
</div>
<!--begin::Modal-->
<div class="modal fade" id="confirmModal" tabindex="-1" role="dialog" aria-labelledby="confirmModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="confirmModalLabel">
<i class="fa fa-question-circle mr-2"></i>
Konfirmasi
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p id="confirmMessage"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
<i class="fa fa-times mr-1"></i>
Batal
</button>
<button type="button" class="btn btn-primary" id="confirmAction">
<i class="fa fa-check mr-1"></i>
Ya, Lanjutkan
</button>
</div>
</div>
</div>
</div>
<!--end::Modal-->
@endsection
@section('javascripts')
<script src="{{ url('js/pages/back/master/work-prices.js') }}" type="text/javascript"></script>
@endsection

View File

@@ -24,22 +24,24 @@
</div>
<div class="kt-portlet__body">
<!--begin: Datatable -->
<table class="table table-responsive table-striped table-bordered table-hover table-checkable" id="kt_table">
<thead>
<tr>
<th>No</th>
<th>Dealer</th>
<th>Role</th>
<th style="width: 35%;">Nama Pengguna</th>
<th>Email</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<!--end: Datatable -->
<div class="table-responsive">
<!--begin: Datatable -->
<table class="table table-striped table-bordered table-hover table-checkable" id="kt_table">
<thead>
<tr>
<th>No</th>
<th>Dealer</th>
<th>Role</th>
<th style="width: 35%;">Nama Pengguna</th>
<th>Email</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<!--end: Datatable -->
</div>
</div>
</div>