Merge branch 'branch-jagad' into 'main'

Branch jagad

See merge request fiqhpratama1/xpendify!7
This commit is contained in:
Jagad Raya
2025-01-02 11:32:54 +00:00
36 changed files with 1471 additions and 967 deletions
@@ -22,7 +22,8 @@ class AuditTrailController extends Controller
return view(
'backend.pages.audit_trail.index',
[
'data' => AuditTrail::orderBy('id', 'desc')->get(),
// sort by newest
'data' => AuditTrail::orderBy('created_at', 'desc')->get(),
'pageInfo' => $pageInfo,
]
);
@@ -63,7 +63,7 @@ class DashboardController extends Controller
// Sum the filtered queries
foreach ($forms as $key => $query) {
$forms[$key] = $query->sum('total');
$forms[$key] = $query->sum('approved_total');
}
return view(
@@ -20,6 +20,7 @@ use App\Mail\ExpenseRejected;
use App\Mail\FinalApprove;
use App\Helpers\WhatsappHelper;
use App\Helpers\AuditTrailHelper;
use App\Rules\FileType;
class FormEntertainmentPresentationController extends Controller
{
@@ -84,8 +85,8 @@ class FormEntertainmentPresentationController extends Controller
'alamat' => 'required',
'nik_or_npwp' => 'required',
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,heic,heif|max:51200',
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
'bukti3' => 'nullable|file|mimes:pdf',
'bukti2' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
'bukti3' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
]);
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
@@ -189,8 +190,8 @@ class FormEntertainmentPresentationController extends Controller
'alamat' => 'required',
'nik_or_npwp' => 'required',
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,heic,heif|max:51200',
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
'bukti3' => 'nullable|file|mimes:pdf',
'bukti2' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
'bukti3' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
]);
$form = FormEntertaimentPresentation::findOrfail($id);
@@ -20,6 +20,7 @@ use App\Mail\ExpenseRejected;
use App\Mail\FinalApprove;
use App\Helpers\WhatsappHelper;
use App\Helpers\AuditTrailHelper;
use App\Rules\FileType;
class FormMeetingSeminarController extends Controller
{
@@ -80,8 +81,8 @@ class FormMeetingSeminarController extends Controller
'transport_ankot' => 'required',
'hotel' => 'required',
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,heic,heif|max:51200',
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
'bukti3' => 'nullable|file|mimes:pdf',
'bukti2' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
'bukti3' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
]);
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
@@ -178,8 +179,8 @@ class FormMeetingSeminarController extends Controller
'transport_ankot' => 'required',
'hotel' => 'required',
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,heic,heif|max:51200',
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
'bukti3' => 'nullable|file|mimes:pdf',
'bukti2' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
'bukti3' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
]);
$form = FormMeetingSeminar::findOrfail($id);
@@ -20,6 +20,7 @@ use App\Mail\ExpenseRejected;
use App\Mail\FinalApprove;
use App\Helpers\WhatsappHelper;
use App\Helpers\AuditTrailHelper;
use App\Rules\FileType;
class FormOtherController extends Controller
{
@@ -83,8 +84,8 @@ class FormOtherController extends Controller
'keterangan' => 'required',
'total' => 'required',
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,heic,heif|max:51200',
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
'bukti3' => 'nullable|file|mimes:pdf',
'bukti2' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
'bukti3' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
]);
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
@@ -183,8 +184,8 @@ class FormOtherController extends Controller
'keterangan' => 'required',
'total' => 'required',
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,heic,heif|max:51200',
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
'bukti3' => 'nullable|file|mimes:pdf',
'bukti2' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
'bukti3' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
]);
$form = FormOthers::findOrfail($id);
@@ -12,7 +12,6 @@ use App\Models\Region;
use App\Models\Cabang;
use App\Models\UserHasCabang;
use App\Models\Kategori;
use App\Helpers\NextCloudHelper;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Mail;
use App\Mail\ExpenseApproved;
@@ -20,6 +19,8 @@ use App\Mail\ExpenseRejected;
use App\Mail\FinalApprove;
use App\Helpers\WhatsappHelper;
use App\Helpers\AuditTrailHelper;
use App\Helpers\NextCloudHelper;
use App\Rules\FileType;
class FormUpCountryController extends Controller
{
@@ -64,6 +65,17 @@ class FormUpCountryController extends Controller
]);
}
public function detail($id)
{
$this->checkAuthorization(auth()->user(), ['forms.country.view']);
$form = FormUpCountry::with(['rayon', 'user'])->findOrFail($id);
$form->bukti1 = $form->bukti1 ? NextCloudHelper::getFileUrl($form->bukti1) : null;
$form->bukti2 = $form->bukti2 ? NextCloudHelper::getFileUrl($form->bukti2) : null;
$form->bukti3 = $form->bukti3 ? NextCloudHelper::getFileUrl($form->bukti3) : null;
return response()->json($form);
}
public function create()
{
$this->checkAuthorization(auth()->user(), ['forms.country.create']);
@@ -86,8 +98,8 @@ class FormUpCountryController extends Controller
'transport_dalkot' => 'required',
'transport_ankot' => 'required',
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,heic,heif|max:51200',
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
'bukti3' => 'nullable|file|mimes:pdf',
'bukti2' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
'bukti3' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
]);
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
@@ -195,8 +207,8 @@ class FormUpCountryController extends Controller
'transport_ankot' => 'required',
'hotel' => 'required',
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,heic,heif|max:51200',
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
'bukti3' => 'nullable|file|mimes:pdf',
'bukti2' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
'bukti3' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
]);
$form = FormUpCountry::findOrfail($id);
@@ -272,15 +284,28 @@ class FormUpCountryController extends Controller
return redirect()->back();
}
public function approve($id)
public function approve(Request $request, $id)
{
$this->checkAuthorization(auth()->user(), ['approval.approve']);
$form = FormUpCountry::findOrfail($id);
$approved_data = [
'allowance' => $request->allowance ? $form->allowance : 0,
'transport_dalkot' => $request->transport_dalkot ? $form->transport_dalkot : 0,
'transport_ankot' => $request->transport_ankot ? $form->transport_ankot : 0,
'hotel' => $request->hotel ? $form->hotel : 0,
];
$form->update([
'approved_at' => now(),
'approved_by' => auth()->user()->id,
'status' => 'Approved'
'status' => 'Approved',
'approved_allowance' => $approved_data['allowance'],
'approved_transport_dalkot' => $approved_data['transport_dalkot'],
'approved_transport_ankot' => $approved_data['transport_ankot'],
'approved_hotel' => $approved_data['hotel'],
'approved_total' => array_sum($approved_data),
]);
$heads = $form->user->getCabangAndRegionHead();
@@ -20,6 +20,7 @@ use App\Mail\ExpenseRejected;
use App\Mail\FinalApprove;
use App\Helpers\WhatsappHelper;
use App\Helpers\AuditTrailHelper;
use App\Rules\FileType;
class FormVehicleController extends Controller
{
@@ -84,8 +85,8 @@ class FormVehicleController extends Controller
'nopol' => 'required',
'keterangan' => 'required',
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,heic,heif|max:51200',
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
'bukti3' => 'nullable|file|mimes:pdf',
'bukti2' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
'bukti3' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
]);
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
@@ -189,8 +190,8 @@ class FormVehicleController extends Controller
'nopol' => 'required',
'keterangan' => 'required',
'bukti1' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,heic,heif|max:51200',
'bukti2' => 'nullable|file|mimes:xlsx,xls,csv',
'bukti3' => 'nullable|file|mimes:pdf',
'bukti2' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
'bukti3' => ['nullable', 'file', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
]);
$form = FormVehicleRunningCost::findOrfail($id);
@@ -17,6 +17,7 @@ class FormEntertaimentPresentation extends Model
'jenis',
'keterangan',
'total',
'approved_total',
'name',
'alamat',
'nik_or_npwp',
+4
View File
@@ -17,6 +17,10 @@ class FormMeetingSeminar extends Model
'transport_ankot',
'hotel',
'total',
'approved_allowance',
'approved_transport_ankot',
'approved_hotel',
'approved_total',
'bukti1',
'bukti2',
'bukti3',
+1
View File
@@ -17,6 +17,7 @@ class FormOthers extends Model
'tanggal',
'keterangan',
'total',
'approved_total',
'bukti1',
'bukti2',
'bukti3',
+5
View File
@@ -22,6 +22,11 @@ class FormUpCountry extends Model
'transport_ankot',
'hotel',
'total',
'approved_allowance',
'approved_transport_dalkot',
'approved_transport_ankot',
'approved_hotel',
'approved_total',
'bukti1',
'bukti2',
'bukti3',
+1
View File
@@ -16,6 +16,7 @@ class FormVehicleRunningCost extends Model
'tanggal',
'liter',
'total',
'approved_total',
'jarak',
'tipe_bensin',
'nopol',
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class FileType implements ValidationRule
{
protected array $disallowedExtensions;
/**
* Constructor to initialize disallowed file extensions.
*
* @param array $disallowedExtensions
*/
public function __construct(array $disallowedExtensions)
{
$this->disallowedExtensions = $disallowedExtensions;
}
/**
* Run the validation rule.
*
* @param string $attribute
* @param mixed $value
* @param \Closure(string, ?string=): \Illuminate\Translation\PotentiallyTranslatedString $fail
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if ($value && $value->isValid()) {
// Get the file extension
$extension = strtolower($value->getClientOriginalExtension());
// Check if the extension is in the disallowed list
if (in_array($extension, $this->disallowedExtensions)) {
$fail("The file type '{$extension}' is not allowed.");
}
} else {
$fail("The uploaded file for '{$attribute}' is invalid.");
}
}
}
@@ -0,0 +1,36 @@
<?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::table('form_up_country', function (Blueprint $table) {
$table->integer('approved_allowance')->after('total')->nullable();
$table->integer('approved_transport_dalkot')->after('approved_allowance')->nullable();
$table->integer('approved_transport_ankot')->after('approved_transport_dalkot')->nullable();
$table->integer('approved_hotel')->after('approved_transport_ankot')->nullable();
$table->integer('approved_total')->after('approved_hotel')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('form_up_country', function (Blueprint $table) {
$table->dropColumn('approved_allowance');
$table->dropColumn('approved_transport_dalkot');
$table->dropColumn('approved_transport_ankot');
$table->dropColumn('approved_hotel');
$table->dropColumn('approved_total');
});
}
};
@@ -0,0 +1,28 @@
<?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::table('form_vehicle_running_cost', function (Blueprint $table) {
$table->integer('approved_total')->after('total')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('form_vehicle_running_cost', function (Blueprint $table) {
$table->dropColumn('approved_total');
});
}
};
@@ -0,0 +1,28 @@
<?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::table('form_entertainment_presentation', function (Blueprint $table) {
$table->integer('approved_total')->after('total')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('form_entertainment_presentation', function (Blueprint $table) {
$table->dropColumn('approved_total');
});
}
};
@@ -0,0 +1,34 @@
<?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::table('form_meeting_seminar', function (Blueprint $table) {
$table->integer('approved_allowance')->after('total')->nullable();
$table->integer('approved_transport_ankot')->after('approved_allowance')->nullable();
$table->integer('approved_hotel')->after('approved_transport_ankot')->nullable();
$table->integer('approved_total')->after('approved_hotel')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('form_meeting_seminar', function (Blueprint $table) {
$table->dropColumn('approved_allowance');
$table->dropColumn('approved_transport_ankot');
$table->dropColumn('approved_hotel');
$table->dropColumn('approved_total');
});
}
};
@@ -0,0 +1,28 @@
<?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::table('form_others', function (Blueprint $table) {
$table->integer('approved_total')->after('total')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('form_others', function (Blueprint $table) {
$table->dropColumn('approved_total');
});
}
};
File diff suppressed because it is too large Load Diff
@@ -40,58 +40,60 @@
<div class="clearfix"></div>
<div class="data-tables">
@include('backend.layouts.partials.messages')
<table id="dataTable" class="text-center">
<thead class="bg-light text-capitalize">
<tr>
<th width="5%">{{ __('Sl') }}</th>
<th width="10%">{{ __('Name') }}</th>
<th width="10%">{{ __('Email') }}</th>
<th width="20%">{{ __('Roles') }}</th>
<th width="5%">Region</th>
<th width="5%">Cabang</th>
<th width="15%">{{ __('Action') }}</th>
</tr>
</thead>
<tbody>
@foreach ($admins as $admin)
<div class="table-responsive">
<table id="dataTable" class="text-center">
<thead class="bg-light text-capitalize">
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $admin->name }}</td>
<td>{{ $admin->email }}</td>
<td>
@foreach ($admin->roles as $role)
<span class="badge badge-info mr-1">
{{ $role->name }}
</span>
@endforeach
</td>
<td>{{ $admin->getMyCabangAndRegion()['region'] }}</td>
<td>{{ $admin->getMyCabangAndRegion()['cabang'] }}</td>
<td>
<a class="btn btn-success text-white" href="{{ route('admin.admins.expense', $admin->id) }}">View Expense</a>
@if (auth()->user()->can('admin.edit'))
<a class="btn btn-success text-white"
href="{{ route('admin.admins.edit', $admin->id) }}">Edit</a>
@endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $admin->id }}').submit(); }">
{{ __('Delete') }}
</a>
<form id="delete-form-{{ $admin->id }}"
action="{{ route('admin.admins.destroy', $admin->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
</td>
<th width="5%">{{ __('Sl') }}</th>
<th width="10%">{{ __('Name') }}</th>
<th width="10%">{{ __('Email') }}</th>
<th width="20%">{{ __('Roles') }}</th>
<th width="5%">Region</th>
<th width="5%">Cabang</th>
<th width="15%">{{ __('Action') }}</th>
</tr>
@endforeach
</tbody>
</table>
</thead>
<tbody>
@foreach ($admins as $admin)
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $admin->name }}</td>
<td>{{ $admin->email }}</td>
<td>
@foreach ($admin->roles as $role)
<span class="badge badge-info mr-1">
{{ $role->name }}
</span>
@endforeach
</td>
<td>{{ $admin->getMyCabangAndRegion()['region'] }}</td>
<td>{{ $admin->getMyCabangAndRegion()['cabang'] }}</td>
<td>
<a class="btn btn-success text-white" href="{{ route('admin.admins.expense', $admin->id) }}">View Expense</a>
@if (auth()->user()->can('admin.edit'))
<a class="btn btn-success text-white"
href="{{ route('admin.admins.edit', $admin->id) }}">Edit</a>
@endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $admin->id }}').submit(); }">
{{ __('Delete') }}
</a>
<form id="delete-form-{{ $admin->id }}"
action="{{ route('admin.admins.destroy', $admin->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@@ -106,7 +108,7 @@
$(document).ready(function () {
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: true,
responsive: false,
dom: 'Bfrtip',
buttons: [
'excel', 'pdf', 'print'
@@ -33,48 +33,52 @@
<div class="clearfix"></div>
<div class="data-tables">
@include('backend.layouts.partials.messages')
<table id="dataTable" class="text-center">
<thead class="bg-light text-capitalize">
<tr>
<th width="5%">{{ __('User') }}</th>
<th width="5%">{{ __('Ip Address') }}</th>
<th width="5%">{{ __('Action') }}</th>
<th width="15%">{{ __('Activity') }}</th>
<th width="5%">Browser</th>
<th width="15%">User Agent</th>
<th width="5%">Time</th>
</tr>
</thead>
<tbody>
@foreach ($data as $item)
<div class="table-responsive">
<table id="dataTable" class="text-center">
<thead class="bg-light text-capitalize">
<tr>
<td>
{{ $item->user ? $item->user->username : preg_replace('/\).*$/', '', explode('(', $item->activity)[1]) }}
</td>
<td>{{ $item->ip_address }}</td>
<td>
@php
$color = 'info';
if ($item->action == 'Create') {
$color = 'success';
} elseif ($item->action == 'Update') {
$color = 'warning';
} elseif ($item->action == 'Delete') {
$color = 'danger';
}
@endphp
<div class="badge badge-{{ $color }} text-white">
{{ $item->action }}
</div>
</td>
<td>{{ $item->activity }}</td>
<td>{{ $item->browser }}</td>
<td>{{ $item->user_agent }}</td>
<td>{{ $item->created_at->diffForHumans() }}</td>
<th width="5%">{{ __('User') }}</th>
<th width="5%">{{ __('Ip Address') }}</th>
<th width="5%">{{ __('Action') }}</th>
<th width="15%">{{ __('Activity') }}</th>
<th width="5%">Browser</th>
<th width="15%">User Agent</th>
<th width="5%">Tanggal</th>
<th width="5%">Waktu</th>
</tr>
@endforeach
</tbody>
</table>
</thead>
<tbody>
@foreach ($data as $item)
<tr>
<td>
{{ $item->user ? $item->user->username : preg_replace('/\).*$/', '', explode('(', $item->activity)[1]) }}
</td>
<td>{{ $item->ip_address }}</td>
<td>
@php
$color = 'info';
if ($item->action == 'Create') {
$color = 'success';
} elseif ($item->action == 'Update') {
$color = 'warning';
} elseif ($item->action == 'Delete') {
$color = 'danger';
}
@endphp
<div class="badge badge-{{ $color }} text-white">
{{ $item->action }}
</div>
</td>
<td>{{ $item->activity }}</td>
<td>{{ $item->browser }}</td>
<td>{{ $item->user_agent }}</td>
<td>{{ $item->created_at }}</td>
<td>{{ $item->created_at->diffForHumans() }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@@ -89,11 +93,12 @@
$(document).ready(function () {
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: true,
responsive: false,
dom: 'Bfrtip',
buttons: [
'excel', 'pdf', 'print'
]
],
order: [[6, 'desc']]
});
}
});
@@ -246,7 +246,7 @@
$(document).ready(function () {
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: true,
responsive: false,
dom: 'Bfrtip',
buttons: [
'excel', 'pdf', 'print'
@@ -246,7 +246,7 @@
$(document).ready(function () {
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: true,
responsive: false,
dom: 'Bfrtip',
buttons: [
'excel', 'pdf', 'print'
@@ -244,7 +244,7 @@
$(document).ready(function () {
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: true,
responsive: false,
dom: 'Bfrtip',
buttons: [
'excel', 'pdf', 'print'
@@ -48,7 +48,7 @@
<input type="text" class="form-control" name="tujuan" required value="{{ old('tujuan') }}">
</div>
<div class="mb-3">
<label class="form-label">Jarak</label>
<label class="form-label">Jarak (km)</label>
<input type="number" class="form-control" name="jarak" required value="{{ old('jarak') }}">
</div>
<div class="mb-3">
@@ -5,6 +5,7 @@
@endsection
@section('admin-content')
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
@@ -48,27 +49,27 @@
<input type="text" class="form-control" name="tujuan" required value="{{ $form->tujuan }}">
</div>
<div class="mb-3">
<label class="form-label">Jarak</label>
<label class="form-label">Jarak (km)</label>
<input type="number" class="form-control" name="jarak" required value="{{ $form->jarak }}">
</div>
<div class="mb-3">
<label class="form-label">Allowance</label>
<input type="number" class="form-control" name="allowance" id="allowance" required value="{{ $form->allowance }}">
<input type="text" class="form-control" name="allowance" id="allowance" required value="{{ $form->allowance }}">
</div>
<div class="mb-3">
<label class="form-label">Transport Dalam Kota</label>
<input type="number" class="form-control" name="transport_dalkot" id="transport_dalkot" required value="{{ $form->transport_dalkot }}">
<input type="text" class="form-control" name="transport_dalkot" id="transport_dalkot" required value="{{ $form->transport_dalkot }}">
</div>
</div>
<div class="col-lg-6">
<div class="mb-3">
<label class="form-label">Transport Antar Kota</label>
<input type="number" class="form-control" name="transport_ankot" id="transport_ankot" required value="{{ $form->transport_ankot }}">
<input type="text" class="form-control" name="transport_ankot" id="transport_ankot" required value="{{ $form->transport_ankot }}">
</div>
<div class="mb-3">
<label class="form-label">Hotel</label>
<input type="number" class="form-control" name="hotel" id="hotel" required value="{{ $form->hotel }}">
<input type="text" class="form-control" name="hotel" id="hotel" required value="{{ $form->hotel }}">
</div>
<div class="mb-3">
<label class="form-label">Bukti 1</label>
@@ -91,4 +92,38 @@
</div>
</div>
</section>
<script>
new AutoNumeric('#allowance', {
digitGroupSeparator: '.', // Pemisah ribuan
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
currencySymbol: 'Rp.', // Simbol mata uang
decimalPlaces: 0, // Tidak ada angka desimal
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
});
new AutoNumeric('#transport_dalkot', {
digitGroupSeparator: '.', // Pemisah ribuan
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
currencySymbol: 'Rp.', // Simbol mata uang
decimalPlaces: 0, // Tidak ada angka desimal
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
});
new AutoNumeric('#transport_ankot', {
digitGroupSeparator: '.', // Pemisah ribuan
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
currencySymbol: 'Rp.', // Simbol mata uang
decimalPlaces: 0, // Tidak ada angka desimal
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
});
new AutoNumeric('#hotel', {
digitGroupSeparator: '.', // Pemisah ribuan
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
currencySymbol: 'Rp.', // Simbol mata uang
decimalPlaces: 0, // Tidak ada angka desimal
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
});
</script>
@endsection
@@ -39,7 +39,7 @@
<div class="col-lg-4 col-6">
<div class="small-box bg-success">
<div class="inner">
<h3>Rp {{ number_format($forms->whereIn('status', ['Approved', 'Closed'])->sum('total'), 0, ',', '.') }}</h3>
<h3>Rp {{ number_format($forms->whereIn('status', ['Approved', 'Closed'])->sum('approved_total'), 0, ',', '.') }}</h3>
<p>Approved Expenses</p>
</div>
<div class="icon">
@@ -90,6 +90,7 @@
<th>Tujuan</th>
<th>Jarak</th>
<th>Total</th>
<th>Total Approved</th>
<th>Bukti 1</th>
<th>Bukti 2</th>
<th>Bukti 3</th>
@@ -117,9 +118,16 @@
<td>{{ $item->tujuan }}</td>
<td>{{ $item->jarak }} km</td>
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
<td>
@if ($item->approved_total)
{{ number_format($item->approved_total, 0, ',', '.') }}
@else
-
@endif
</td>
<td>
@if ($item->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti1) }}" target="_blank">
<a href="{{ NextCloudHelper::getFileUrl($item->bukti1) }}">
Download
</a>
@else
@@ -128,7 +136,7 @@
</td>
<td>
@if ($item->bukti2)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti2) }}" target="_blank">
<a href="{{ NextCloudHelper::getFileUrl($item->bukti2) }}">
Download
</a>
@else
@@ -137,7 +145,7 @@
</td>
<td>
@if ($item->bukti3)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti3) }}" target="_blank">
<a href="{{ NextCloudHelper::getFileUrl($item->bukti3) }}">
Download
</a>
@else
@@ -158,15 +166,15 @@
<td>
{{-- approve / reject button --}}
@if ($item->status == 'On Progress')
<form action="{{ route('forms.up-country.approve', $item->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this item?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
<form action="javascript:void(0);" class="d-inline">
<button type="button"
class="btn btn-success btn-sm open-approve-modal"
data-id="{{ route('forms.up-country.approve', $item->id) }}">
Approve
</button>
</form>
<form action="{{ route('forms.up-country.reject', $item->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to reject this item?');">
<form action="{{ route('forms.up-country.reject', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to reject this item?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-danger btn-sm">
@@ -239,20 +247,211 @@
</div>
</div>
</section>
<section>
<div class="modal fade" id="approveModal" tabindex="-1" role="dialog" aria-labelledby="approveModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<form id="approveForm" method="POST" action="">
@csrf
@method('PUT')
<div class="modal-header">
<h5 class="modal-title" id="approveModalLabel">Approve Item</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<!-- Loading spinner -->
<div id="loadingSpinner" class="d-flex justify-content-center align-items-center" style="height: 200px;">
<div class="spinner-border text-primary" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
<!-- Modal content (hidden initially) -->
<div id="modalContent" class="d-none">
<p>Please review the details below:</p>
<ul class="list-group">
<li class="list-group-item">
<strong>Expense Number:</strong> <span id="expense_number"></span>
</li>
<li class="list-group-item">
<strong>User:</strong> <span id="user"></span>
</li>
<li class="list-group-item">
<strong>Tipe:</strong> Up Country
</li>
<li class="list-group-item">
<strong>Rayon:</strong> <span id="rayon"></span>
</li>
<li class="list-group-item">
<strong>Tanggal:</strong> <span id="tanggal"></span>
</li>
<li class="list-group-item">
<strong>Tujuan:</strong> <span id="tujuan"></span>
</li>
<li class="list-group-item">
<strong>Jarak:</strong> <span id="jarak"></span>
</li>
<li class="list-group-item">
<strong>Bukti 1:</strong> <span id="bukti1"></span>
</li>
<li class="list-group-item">
<strong>Bukti 2:</strong> <span id="bukti2"></span>
</li>
<li class="list-group-item">
<strong>Bukti 3:</strong> <span id="bukti3"></span>
</li>
</ul>
<p class="mt-2">Please select the items you want to approve:</p>
<ul class="list-group list-unstyled">
<li>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="allowance" name="allowance">
<label class="custom-control-label" for="allowance">Allowance (<span id="allowance_value"></span>)</label>
</div>
</div>
</li>
<li>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="transport_dalkot" name="transport_dalkot">
<label class="custom-control-label" for="transport_dalkot">Transport Dalkot (<span id="transport_dalkot_value"></span>)</label>
</div>
</div>
</li>
<li>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="transport_ankot" name="transport_ankot">
<label class="custom-control-label" for="transport_ankot">Transport Ankot (<span id="transport_ankot_value"></span>)</label>
</div>
</div>
</li>
<li>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="hotel" name="hotel">
<label class="custom-control-label" for="hotel">Hotel (<span id="hotel_value"></span>)</label>
</div>
</div>
</li>
<li>
<div class="form-group">
<label for="total">Total</label>
<input type="text" class="form-control" id="total" name="total" value="0" readonly>
</div>
</li>
</ul>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary">Approve</button>
</div>
</form>
</div>
</div>
</div>
</section>
@endsection
@section('scripts')
<script>
$(document).ready(function () {
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: true,
dom: 'Bfrtip',
buttons: [
'excel', 'pdf', 'print'
]
});
}
});
</script>
$(document).ready(function () {
// Uncheck all checkboxes on page refresh
$('.custom-control-input').prop('checked', false);
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: false,
dom: 'Bfrtip',
buttons: ['excel', 'pdf', 'print']
});
}
// Handle Approve Button Click
$('.open-approve-modal').on('click', function () {
const approveUrl = $(this).data('id');
// Show spinner and hide content initially
$('#loadingSpinner').show();
$('#modalContent').addClass('d-none');
$('#approveForm').attr('action', approveUrl); // Set the form action
$('#approveModal').modal('show'); // Show the modal
// Get detail from /forms/up-country/detail/{id}
$.get(approveUrl.replace('approve', 'detail'), function (data) {
const formatter = new Intl.NumberFormat('id-ID', {
style: 'currency',
currency: 'IDR',
minimumFractionDigits: 0
});
$('#allowance_value').text(formatter.format(data.allowance));
$('#transport_dalkot_value').text(formatter.format(data.transport_dalkot));
$('#transport_ankot_value').text(formatter.format(data.transport_ankot));
$('#hotel_value').text(formatter.format(data.hotel));
// Assign data values to checkboxes
$('#allowance').data('value', data.allowance);
$('#transport_dalkot').data('value', data.transport_dalkot);
$('#transport_ankot').data('value', data.transport_ankot);
$('#hotel').data('value', data.hotel);
// Detail data
$('#user').text(data.user.name);
$('#expense_number').text(data.expense_number);
$('#rayon').text(data.rayon.code);
$('#tanggal').text(new Date(data.tanggal).toLocaleDateString('id-ID', {
year: 'numeric',
month: 'long',
day: 'numeric'
}));
$('#tujuan').text(data.tujuan);
$('#jarak').text(data.jarak + ' km');
$('#bukti1').html(data.bukti1 ? '<a href="' + data.bukti1 + '" target="_blank">Download</a>' : '-');
$('#bukti2').html(data.bukti2 ? '<a href="' + data.bukti2 + '" target="_blank">Download</a>' : '-');
$('#bukti3').html(data.bukti3 ? '<a href="' + data.bukti3 + '" target="_blank">Download</a>' : '-');
// Hide spinner and show content
$('#loadingSpinner').hide();
$('#loadingSpinner').removeClass('d-flex');
$('#loadingSpinner').addClass('d-none');
$('#modalContent').removeClass('d-none');
// Reset the total to zero
$('#total').val(0);
});
});
// Update total dynamically
$('.custom-control-input').on('change', function () {
let total = 0;
// Calculate the total based on checked checkboxes
$('.custom-control-input:checked').each(function () {
total += parseFloat($(this).data('value') || 0);
});
// Update the total field with formatted value
const formatter = new Intl.NumberFormat('id-ID', {
style: 'currency',
currency: 'IDR',
minimumFractionDigits: 0
});
$('#total').val(formatter.format(total));
});
// Uncheck all checkboxes when the modal is closed
$('#approveModal').on('hidden.bs.modal', function () {
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
$('#total').val('0'); // Reset total to 0
});
});
</script>
@endsection
@@ -44,7 +44,7 @@
<input type="string" class="form-control" name="total" id="total" required value="{{ old('total') }}">
</div>
<div class="mb-3">
<label class="form-label">Jarak</label>
<label class="form-label">Jarak (km)</label>
<input type="number" class="form-control" name="jarak" id="jarak" required value="{{ old('jarak') }}">
</div>
<div class="mb-3">
@@ -44,7 +44,7 @@
<input type="string" class="form-control" name="total" id="total" required value="{{ $form->total }}">
</div>
<div class="mb-3">
<label class="form-label">Jarak</label>
<label class="form-label">Jarak (km)</label>
<input type="number" class="form-control" name="jarak" id="jarak" required value="{{ $form->jarak }}">
</div>
<div class="mb-3">
@@ -116,7 +116,7 @@
<td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('dddd, D MMMM Y HH:mm:ss') }}</td>
<td>{{ $item->liter }}</td>
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
<td>{{ $item->jarak }}</td>
<td>{{ $item->jarak }} km</td>
<td>{{ $item->tipe_bensin }}</td>
<td>{{ $item->nopol }}</td>
<td>
@@ -248,7 +248,7 @@
$(document).ready(function () {
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: true,
responsive: false,
dom: 'Bfrtip',
buttons: [
'excel', 'pdf', 'print'
@@ -35,45 +35,47 @@
<div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2">
@include('backend.layouts.partials.messages')
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Nama</th>
<th>Account Number</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($categories as $category)
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $category->name }}</td>
<td>{{ $category->account_number }}</td>
<td>
@if (auth()->user()->can('admin.edit'))
<a class="btn btn-success btn-sm text-white" href="{{ route('admin.category.edit', $category->id) }}">Edit</a>
@endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $category->id }}').submit(); }">
{{ __('Delete') }}
</a>
<div class="table-responsive">
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Nama</th>
<th>Account Number</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($categories as $category)
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $category->name }}</td>
<td>{{ $category->account_number }}</td>
<td>
@if (auth()->user()->can('admin.edit'))
<a class="btn btn-success btn-sm text-white" href="{{ route('admin.category.edit', $category->id) }}">Edit</a>
@endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $category->id }}').submit(); }">
{{ __('Delete') }}
</a>
<form id="delete-form-{{ $category->id }}"
action="{{ route('admin.category.destroy', $category->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
<form id="delete-form-{{ $category->id }}"
action="{{ route('admin.category.destroy', $category->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@@ -86,7 +88,7 @@
$(document).ready(function () {
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: true,
responsive: false,
dom: 'Bfrtip',
buttons: [
'excel', 'pdf', 'print'
@@ -35,45 +35,47 @@
<div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2">
@include('backend.layouts.partials.messages')
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Code</th>
<th>Nama</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($costs as $cost)
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $cost->code }}</td>
<td>{{ $cost->name }}</td>
<td>
@if (auth()->user()->can('admin.edit'))
<a class="btn btn-success btn-sm text-white" href="{{ route('admin.cost.edit', $cost->id) }}">Edit</a>
@endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $cost->id }}').submit(); }">
{{ __('Delete') }}
</a>
<div class="table-responsive">
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Code</th>
<th>Nama</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($costs as $cost)
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $cost->code }}</td>
<td>{{ $cost->name }}</td>
<td>
@if (auth()->user()->can('admin.edit'))
<a class="btn btn-success btn-sm text-white" href="{{ route('admin.cost.edit', $cost->id) }}">Edit</a>
@endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $cost->id }}').submit(); }">
{{ __('Delete') }}
</a>
<form id="delete-form-{{ $cost->id }}"
action="{{ route('admin.cost.destroy', $cost->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
<form id="delete-form-{{ $cost->id }}"
action="{{ route('admin.cost.destroy', $cost->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@@ -86,7 +88,7 @@
$(document).ready(function () {
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: true,
responsive: false,
dom: 'Bfrtip',
buttons: [
'excel', 'pdf', 'print'
@@ -35,45 +35,47 @@
<div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2">
@include('backend.layouts.partials.messages')
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Code</th>
<th>Nama</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($rayons as $rayon)
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $rayon->code }}</td>
<td>{{ $rayon->name }}</td>
<td>
@if (auth()->user()->can('admin.edit'))
<a class="btn btn-success btn-sm text-white" href="{{ route('admin.rayon.edit', $rayon->id) }}">Edit</a>
@endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $rayon->id }}').submit(); }">
{{ __('Delete') }}
</a>
<div class="table-responsive">
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Code</th>
<th>Nama</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($rayons as $rayon)
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $rayon->code }}</td>
<td>{{ $rayon->name }}</td>
<td>
@if (auth()->user()->can('admin.edit'))
<a class="btn btn-success btn-sm text-white" href="{{ route('admin.rayon.edit', $rayon->id) }}">Edit</a>
@endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $rayon->id }}').submit(); }">
{{ __('Delete') }}
</a>
<form id="delete-form-{{ $rayon->id }}"
action="{{ route('admin.rayon.destroy', $rayon->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
<form id="delete-form-{{ $rayon->id }}"
action="{{ route('admin.rayon.destroy', $rayon->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@@ -38,56 +38,58 @@
<div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4">
@include('backend.layouts.partials.messages')
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th width="5%">{{ __('Sl') }}</th>
<th width="10%">{{ __('Role Name') }}</th>
<th width="30%">{{ __('Permission List') }}</th>
<th width="10%">{{ __('Action') }}</th>
</tr>
</thead>
<tbody>
@foreach ($roles as $role)
<div class="table-responsive">
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $role->name }}</td>
<td>
@foreach ($role->permissions as $permission)
<span class="badge badge-info mr-1">
{{ $permission->name }}
</span>
@endforeach
</td>
<td>
@if (auth()->user()->can('admin.edit'))
<a class="btn btn-success btn-sm text-white"
href="{{ route('admin.roles.edit', $role->id) }}">Edit</a>
@endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $role->id }}').submit(); }">
{{ __('Delete') }}
</a>
<form id="delete-form-{{ $role->id }}"
action="{{ route('admin.roles.destroy', $role->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
<a class="btn btn-primary btn-sm text-white"
href="{{ route('auth.menurole.index', $role->id) }}">Assign
Menus</a>
</td>
<th width="5%">{{ __('Sl') }}</th>
<th width="10%">{{ __('Role Name') }}</th>
<th width="30%">{{ __('Permission List') }}</th>
<th width="10%">{{ __('Action') }}</th>
</tr>
@endforeach
</tbody>
</table>
</thead>
<tbody>
@foreach ($roles as $role)
<tr>
<td>{{ $loop->index + 1 }}</td>
<td>{{ $role->name }}</td>
<td>
@foreach ($role->permissions as $permission)
<span class="badge badge-info mr-1">
{{ $permission->name }}
</span>
@endforeach
</td>
<td>
@if (auth()->user()->can('admin.edit'))
<a class="btn btn-success btn-sm text-white"
href="{{ route('admin.roles.edit', $role->id) }}">Edit</a>
@endif
@if (auth()->user()->can('admin.delete'))
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $role->id }}').submit(); }">
{{ __('Delete') }}
</a>
<form id="delete-form-{{ $role->id }}"
action="{{ route('admin.roles.destroy', $role->id) }}"
method="POST" style="display: none;">
@method('DELETE')
@csrf
</form>
@endif
<a class="btn btn-primary btn-sm text-white"
href="{{ route('auth.menurole.index', $role->id) }}">Assign
Menus</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@@ -103,7 +105,7 @@
$(document).ready(function () {
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: true,
responsive: false,
dom: 'Bfrtip',
buttons: [
'excel', 'pdf', 'print'
@@ -25,6 +25,11 @@
<meta name="csrf-token" content="{{ csrf_token() }}">
<style type="text/css">
.table-responsive {
overflow-x: scroll;
white-space: nowrap;
}
/* Chart.js */
@keyframes chartjs-render-animation {
from {
+1
View File
@@ -76,6 +76,7 @@ Route::middleware(['auth:admin', 'menu'])->group(function () {
Route::prefix('forms')->group(function () {
// Up Country
Route::get('/up-country', [FormUpCountryController::class, 'index'])->name('forms.up-country');
Route::get('/up-country/detail/{id}', [FormUpCountryController::class, 'detail'])->name('forms.up-country.detail');
Route::get('/up-country/create', [FormUpCountryController::class, 'create'])->name('forms.up-country.create');
Route::post('/up-country/store', [FormUpCountryController::class, 'store'])->name('forms.up-country.store');
Route::get('/up-country/edit/{id}', [FormUpCountryController::class, 'edit'])->name('forms.up-country.edit');