add claim tab to all users
This commit is contained in:
@@ -1085,15 +1085,6 @@ class TransactionController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function getClaimTransactions(Request $request)
|
public function getClaimTransactions(Request $request)
|
||||||
{
|
{
|
||||||
// Only allow mechanics to access this endpoint
|
|
||||||
if (Auth::user()->role_id != 3) {
|
|
||||||
return response()->json([
|
|
||||||
'draw' => intval($request->input('draw')),
|
|
||||||
'recordsTotal' => 0,
|
|
||||||
'recordsFiltered' => 0,
|
|
||||||
'data' => []
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'dealer_id' => 'required|exists:dealers,id'
|
'dealer_id' => 'required|exists:dealers,id'
|
||||||
@@ -1290,25 +1281,21 @@ class TransactionController extends Controller
|
|||||||
<i class="fas fa-trash"></i> Hapus
|
<i class="fas fa-trash"></i> Hapus
|
||||||
</button>';
|
</button>';
|
||||||
|
|
||||||
// Only show claim buttons for mechanics
|
// Claim button - show only if not claimed yet
|
||||||
if (Auth::user()->role_id == 3) {
|
if (empty($transaction->claimed_at) && empty($transaction->claimed_by)) {
|
||||||
|
$buttons .= '<button class="btn btn-sm btn-success mr-1" onclick="claimTransaction(' . $transaction->id . ')" title="Klaim Pekerjaan" style="font-size: 11px; padding: 4px 8px;">';
|
||||||
|
$buttons .= '<i class="fas fa-hand-paper"></i> Klaim';
|
||||||
|
$buttons .= '</button>';
|
||||||
|
} else {
|
||||||
|
if ($transaction->claimed_by == Auth::user()->id) {
|
||||||
|
$precheck = Precheck::where('transaction_id', $transaction->id)->first();
|
||||||
|
$postcheck = Postcheck::where('transaction_id', $transaction->id)->first();
|
||||||
|
|
||||||
// Claim button - show only if not claimed yet
|
if ($precheck && $postcheck) {
|
||||||
if (empty($transaction->claimed_at) && empty($transaction->claimed_by)) {
|
$buttons .= '<span class="badge badge-success" style="font-size: 10px;"><i class="fas fa-check"></i> Selesai</span>';
|
||||||
$buttons .= '<button class="btn btn-sm btn-success mr-1" onclick="claimTransaction(' . $transaction->id . ')" title="Klaim Pekerjaan" style="font-size: 11px; padding: 4px 8px;">';
|
|
||||||
$buttons .= '<i class="fas fa-hand-paper"></i> Klaim';
|
|
||||||
$buttons .= '</button>';
|
|
||||||
} else {
|
|
||||||
if ($transaction->claimed_by == Auth::user()->id) {
|
|
||||||
$precheck = Precheck::where('transaction_id', $transaction->id)->first();
|
|
||||||
$postcheck = Postcheck::where('transaction_id', $transaction->id)->first();
|
|
||||||
|
|
||||||
if ($precheck && $postcheck) {
|
|
||||||
$buttons .= '<span class="badge badge-success" style="font-size: 10px;"><i class="fas fa-check"></i> Selesai</span>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$buttons .= '<span class="badge badge-info" style="font-size: 10px;"><i class="fas fa-check-circle"></i> Sudah Diklaim</span>';
|
|
||||||
}
|
}
|
||||||
|
$buttons .= '<span class="badge badge-info" style="font-size: 10px;"><i class="fas fa-check-circle"></i> Sudah Diklaim</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $buttons;
|
return $buttons;
|
||||||
@@ -1318,27 +1305,25 @@ class TransactionController extends Controller
|
|||||||
{
|
{
|
||||||
$buttons = '';
|
$buttons = '';
|
||||||
|
|
||||||
if (Auth::user()->role_id == 3) {
|
$precheck = Precheck::where('transaction_id', $transaction->id)->first();
|
||||||
$precheck = Precheck::where('transaction_id', $transaction->id)->first();
|
|
||||||
|
|
||||||
if ($precheck) {
|
if ($precheck) {
|
||||||
$buttons .= '<a href="' . route('prechecks.edit', [$transaction->id, $precheck->id]) . '"
|
$buttons .= '<a href="' . route('prechecks.edit', [$transaction->id, $precheck->id]) . '"
|
||||||
class="btn btn-sm btn-warning mr-1" title="Edit Precheck" style="font-size: 11px; padding: 4px 8px;">
|
class="btn btn-sm btn-warning mr-1" title="Edit Precheck" style="font-size: 11px; padding: 4px 8px;">
|
||||||
<i class="fas fa-edit"></i> Edit
|
<i class="fas fa-edit"></i> Edit
|
||||||
|
</a>';
|
||||||
|
$buttons .= '<a href="' . route('prechecks.print', $transaction->id) . '"
|
||||||
|
class="btn btn-sm btn-primary mr-1" title="Lihat Precheck" target="_blank" style="font-size: 11px; padding: 4px 8px;">
|
||||||
|
<i class="fas fa-eye"></i> Lihat
|
||||||
|
</a>';
|
||||||
|
} else {
|
||||||
|
if (empty($transaction->claimed_at) && empty($transaction->claimed_by)) {
|
||||||
|
$buttons .= '<span class="badge badge-danger" style="font-size: 10px;">Transaksi Belum Diklaim</span>';
|
||||||
|
}else{
|
||||||
|
$buttons .= '<a href="' . route('prechecks.create', $transaction->id) . '"
|
||||||
|
class="btn btn-sm btn-success mr-1" title="Tambah Precheck" style="font-size: 11px; padding: 4px 8px;">
|
||||||
|
<i class="fas fa-plus"></i> Tambah
|
||||||
</a>';
|
</a>';
|
||||||
$buttons .= '<a href="' . route('prechecks.print', $transaction->id) . '"
|
|
||||||
class="btn btn-sm btn-primary mr-1" title="Lihat Precheck" target="_blank" style="font-size: 11px; padding: 4px 8px;">
|
|
||||||
<i class="fas fa-eye"></i> Lihat
|
|
||||||
</a>';
|
|
||||||
} else {
|
|
||||||
if (empty($transaction->claimed_at) && empty($transaction->claimed_by)) {
|
|
||||||
$buttons .= '<span class="badge badge-danger" style="font-size: 10px;">Transaksi Belum Diklaim</span>';
|
|
||||||
}else{
|
|
||||||
$buttons .= '<a href="' . route('prechecks.create', $transaction->id) . '"
|
|
||||||
class="btn btn-sm btn-success mr-1" title="Tambah Precheck" style="font-size: 11px; padding: 4px 8px;">
|
|
||||||
<i class="fas fa-plus"></i> Tambah
|
|
||||||
</a>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1348,30 +1333,27 @@ class TransactionController extends Controller
|
|||||||
private function getActionButtonsPostcheck($transaction)
|
private function getActionButtonsPostcheck($transaction)
|
||||||
{
|
{
|
||||||
$buttons = '';
|
$buttons = '';
|
||||||
|
$postcheck = Postcheck::where('transaction_id', $transaction->id)->first();
|
||||||
|
$precheck = Precheck::where('transaction_id', $transaction->id)->first();
|
||||||
|
|
||||||
if (Auth::user()->role_id == 3) {
|
if($precheck){
|
||||||
$postcheck = Postcheck::where('transaction_id', $transaction->id)->first();
|
if ($postcheck) {
|
||||||
$precheck = Precheck::where('transaction_id', $transaction->id)->first();
|
$buttons .= '<a href="' . route('postchecks.edit', [$transaction->id, $postcheck->id]) . '"
|
||||||
|
class="btn btn-sm btn-warning mr-1" title="Edit Postcheck" style="font-size: 11px; padding: 4px 8px;">
|
||||||
if($precheck){
|
<i class="fas fa-edit"></i> Edit
|
||||||
if ($postcheck) {
|
</a>';
|
||||||
$buttons .= '<a href="' . route('postchecks.edit', [$transaction->id, $postcheck->id]) . '"
|
$buttons .= '<a href="' . route('postchecks.print', $transaction->id) . '"
|
||||||
class="btn btn-sm btn-warning mr-1" title="Edit Postcheck" style="font-size: 11px; padding: 4px 8px;">
|
class="btn btn-sm btn-primary mr-1" title="Lihat Postcheck" target="_blank" style="font-size: 11px; padding: 4px 8px;">
|
||||||
<i class="fas fa-edit"></i> Edit
|
<i class="fas fa-eye"></i> Lihat
|
||||||
</a>';
|
</a>';
|
||||||
$buttons .= '<a href="' . route('postchecks.print', $transaction->id) . '"
|
} else {
|
||||||
class="btn btn-sm btn-primary mr-1" title="Lihat Postcheck" target="_blank" style="font-size: 11px; padding: 4px 8px;">
|
$buttons .= '<a href="' . route('postchecks.create', $transaction->id) . '"
|
||||||
<i class="fas fa-eye"></i> Lihat
|
class="btn btn-sm btn-success mr-1" title="Tambah Postcheck" style="font-size: 11px; padding: 4px 8px;">
|
||||||
</a>';
|
<i class="fas fa-plus"></i> Tambah
|
||||||
} else {
|
</a>';
|
||||||
$buttons .= '<a href="' . route('postchecks.create', $transaction->id) . '"
|
|
||||||
class="btn btn-sm btn-success mr-1" title="Tambah Postcheck" style="font-size: 11px; padding: 4px 8px;">
|
|
||||||
<i class="fas fa-plus"></i> Tambah
|
|
||||||
</a>';
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$buttons .= '<span class="badge badge-danger" style="font-size: 10px;">Precheck Belum Disimpan</span>';
|
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$buttons .= '<span class="badge badge-danger" style="font-size: 10px;">Precheck Belum Disimpan</span>';
|
||||||
}
|
}
|
||||||
return $buttons;
|
return $buttons;
|
||||||
}
|
}
|
||||||
|
|||||||
11167
public/css/app.css
11167
public/css/app.css
File diff suppressed because one or more lines are too long
1211
public/js/app.js
1211
public/js/app.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -820,11 +820,9 @@ use Illuminate\Support\Facades\Auth;
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link @if(old('form') == 'wash') active @endif" href="#form-cuci">Form Cuci</a>
|
<a class="nav-link @if(old('form') == 'wash') active @endif" href="#form-cuci">Form Cuci</a>
|
||||||
</li>
|
</li>
|
||||||
@if(Auth::user()->role_id == 3)
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link @if(old('form') == 'claim') active @endif" href="#form-claim">Klaim</a>
|
<a class="nav-link @if(old('form') == 'claim') active @endif" href="#form-claim">Klaim</a>
|
||||||
</li>
|
</li>
|
||||||
@endif
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content mt-3">
|
<div class="tab-content mt-3">
|
||||||
@@ -1128,7 +1126,6 @@ use Illuminate\Support\Facades\Auth;
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Form Klaim - Hanya untuk Mekanik -->
|
<!-- Form Klaim - Hanya untuk Mekanik -->
|
||||||
@if(Auth::user()->role_id == 3)
|
|
||||||
<div class="tab-pane @if(old('form') == 'claim') active @endif" id="form-claim" role="tabpanel">
|
<div class="tab-pane @if(old('form') == 'claim') active @endif" id="form-claim" role="tabpanel">
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<h6 class="mb-3">Daftar Pekerjaan yang Dapat Diklaim</h6>
|
<h6 class="mb-3">Daftar Pekerjaan yang Dapat Diklaim</h6>
|
||||||
@@ -1154,7 +1151,6 @@ use Illuminate\Support\Facades\Auth;
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -112,7 +112,7 @@
|
|||||||
<b class="font-weight-bold text-dark">x{{ $transaction->qty }}</b>
|
<b class="font-weight-bold text-dark">x{{ $transaction->qty }}</b>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="kt-portlet__foot text-right mt-4" style="background: none !important; padding-right: 0 !important; padding-left: 0 !important; padding-bottom: 0; margin-bottom: 0;">
|
{{-- <div class="kt-portlet__foot text-right mt-4" style="background: none !important; padding-right: 0 !important; padding-left: 0 !important; padding-bottom: 0; margin-bottom: 0;">
|
||||||
@if ($transaction->status == 1)
|
@if ($transaction->status == 1)
|
||||||
<span class="badge badge-success">Closed</span>
|
<span class="badge badge-success">Closed</span>
|
||||||
@else
|
@else
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
@method('DELETE')
|
@method('DELETE')
|
||||||
</form>
|
</form>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div> --}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -171,35 +171,35 @@ Route::group(['middleware' => 'auth'], function() {
|
|||||||
// Stock Management Routes
|
// Stock Management Routes
|
||||||
Route::post('/transaction/check-stock', [TransactionController::class, 'checkStockAvailability'])->name('transaction.check-stock');
|
Route::post('/transaction/check-stock', [TransactionController::class, 'checkStockAvailability'])->name('transaction.check-stock');
|
||||||
Route::get('/transaction/stock-prediction', [TransactionController::class, 'getStockPrediction'])->name('transaction.stock-prediction');
|
Route::get('/transaction/stock-prediction', [TransactionController::class, 'getStockPrediction'])->name('transaction.stock-prediction');
|
||||||
|
|
||||||
// Claim Transactions Route
|
|
||||||
Route::get('/transaction/get-claim-transactions', [TransactionController::class, 'getClaimTransactions'])->name('transaction.get-claim-transactions');
|
|
||||||
Route::post('/transaction/claim/{id}', [TransactionController::class, 'claim'])->name('transaction.claim');
|
|
||||||
|
|
||||||
Route::prefix('transaction/{transaction}')->group(function () {
|
|
||||||
// Prechecks
|
|
||||||
Route::prefix('prechecks')->name('prechecks.')->group(function () {
|
|
||||||
Route::get('create', [PrechecksController::class, 'create'])->name('create');
|
|
||||||
Route::post('store', [PrechecksController::class, 'store'])->name('store');
|
|
||||||
Route::get('{precheck}/edit', [PrechecksController::class, 'edit'])->name('edit');
|
|
||||||
Route::put('{precheck}', [PrechecksController::class, 'update'])->name('update');
|
|
||||||
Route::get('print', [PrechecksController::class, 'print'])->name('print');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Postchecks
|
|
||||||
Route::prefix('postchecks')->name('postchecks.')->group(function () {
|
|
||||||
Route::get('create', [PostchecksController::class, 'create'])->name('create');
|
|
||||||
Route::post('store', [PostchecksController::class, 'store'])->name('store');
|
|
||||||
Route::get('{postcheck}/edit', [PostchecksController::class, 'edit'])->name('edit');
|
|
||||||
Route::put('{postcheck}', [PostchecksController::class, 'update'])->name('update');
|
|
||||||
Route::get('print', [PostchecksController::class, 'print'])->name('print');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// KPI Data Route - accessible to all authenticated users
|
// KPI Data Route - accessible to all authenticated users
|
||||||
Route::get('/transaction/get-kpi-data', [TransactionController::class, 'getKpiData'])->name('transaction.get-kpi-data');
|
Route::get('/transaction/get-kpi-data', [TransactionController::class, 'getKpiData'])->name('transaction.get-kpi-data');
|
||||||
|
|
||||||
|
// Claim Transactions Route
|
||||||
|
Route::get('/transaction/get-claim-transactions', [TransactionController::class, 'getClaimTransactions'])->name('transaction.get-claim-transactions');
|
||||||
|
Route::post('/transaction/claim/{id}', [TransactionController::class, 'claim'])->name('transaction.claim');
|
||||||
|
|
||||||
|
Route::prefix('transaction/{transaction}')->group(function () {
|
||||||
|
// Prechecks
|
||||||
|
Route::prefix('prechecks')->name('prechecks.')->group(function () {
|
||||||
|
Route::get('create', [PrechecksController::class, 'create'])->name('create');
|
||||||
|
Route::post('store', [PrechecksController::class, 'store'])->name('store');
|
||||||
|
Route::get('{precheck}/edit', [PrechecksController::class, 'edit'])->name('edit');
|
||||||
|
Route::put('{precheck}', [PrechecksController::class, 'update'])->name('update');
|
||||||
|
Route::get('print', [PrechecksController::class, 'print'])->name('print');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Postchecks
|
||||||
|
Route::prefix('postchecks')->name('postchecks.')->group(function () {
|
||||||
|
Route::get('create', [PostchecksController::class, 'create'])->name('create');
|
||||||
|
Route::post('store', [PostchecksController::class, 'store'])->name('store');
|
||||||
|
Route::get('{postcheck}/edit', [PostchecksController::class, 'edit'])->name('edit');
|
||||||
|
Route::put('{postcheck}', [PostchecksController::class, 'update'])->name('update');
|
||||||
|
Route::get('print', [PostchecksController::class, 'print'])->name('print');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Route::group(['prefix' => 'admin', 'middleware' => 'adminRole'], function() {
|
Route::group(['prefix' => 'admin', 'middleware' => 'adminRole'], function() {
|
||||||
Route::get('/dashboard2', [AdminController::class, 'dashboard2'])->name('dashboard2');
|
Route::get('/dashboard2', [AdminController::class, 'dashboard2'])->name('dashboard2');
|
||||||
Route::post('/dealer_work_trx', [AdminController::class, 'dealer_work_trx'])->name('dealer_work_trx');
|
Route::post('/dealer_work_trx', [AdminController::class, 'dealer_work_trx'])->name('dealer_work_trx');
|
||||||
|
|||||||
Reference in New Issue
Block a user