minor fixes

This commit is contained in:
Jagad R R
2025-01-02 18:21:03 +07:00
parent 8255a530af
commit 0c052f379a
8 changed files with 935 additions and 913 deletions
@@ -12,7 +12,6 @@ use App\Models\Region;
use App\Models\Cabang; use App\Models\Cabang;
use App\Models\UserHasCabang; use App\Models\UserHasCabang;
use App\Models\Kategori; use App\Models\Kategori;
use App\Helpers\NextCloudHelper;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use App\Mail\ExpenseApproved; use App\Mail\ExpenseApproved;
@@ -20,6 +19,7 @@ use App\Mail\ExpenseRejected;
use App\Mail\FinalApprove; use App\Mail\FinalApprove;
use App\Helpers\WhatsappHelper; use App\Helpers\WhatsappHelper;
use App\Helpers\AuditTrailHelper; use App\Helpers\AuditTrailHelper;
use App\Helpers\NextCloudHelper;
use App\Rules\FileType; use App\Rules\FileType;
class FormUpCountryController extends Controller class FormUpCountryController extends Controller
@@ -70,9 +70,9 @@ class FormUpCountryController extends Controller
$this->checkAuthorization(auth()->user(), ['forms.country.view']); $this->checkAuthorization(auth()->user(), ['forms.country.view']);
$form = FormUpCountry::with(['rayon', 'user'])->findOrFail($id); $form = FormUpCountry::with(['rayon', 'user'])->findOrFail($id);
$form->bukti1 = NextCloudHelper::getFileUrl($form->bukti1); $form->bukti1 = $form->bukti1 ? NextCloudHelper::getFileUrl($form->bukti1) : null;
$form->bukti2 = NextCloudHelper::getFileUrl($form->bukti2); $form->bukti2 = $form->bukti2 ? NextCloudHelper::getFileUrl($form->bukti2) : null;
$form->bukti3 = NextCloudHelper::getFileUrl($form->bukti3); $form->bukti3 = $form->bukti3 ? NextCloudHelper::getFileUrl($form->bukti3) : null;
return response()->json($form); return response()->json($form);
} }
File diff suppressed because it is too large Load Diff
@@ -40,58 +40,60 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="data-tables"> <div class="data-tables">
@include('backend.layouts.partials.messages') @include('backend.layouts.partials.messages')
<table id="dataTable" class="text-center"> <div class="table-responsive">
<thead class="bg-light text-capitalize"> <table id="dataTable" class="text-center">
<tr> <thead class="bg-light text-capitalize">
<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)
<tr> <tr>
<td>{{ $loop->index + 1 }}</td> <th width="5%">{{ __('Sl') }}</th>
<td>{{ $admin->name }}</td> <th width="10%">{{ __('Name') }}</th>
<td>{{ $admin->email }}</td> <th width="10%">{{ __('Email') }}</th>
<td> <th width="20%">{{ __('Roles') }}</th>
@foreach ($admin->roles as $role) <th width="5%">Region</th>
<span class="badge badge-info mr-1"> <th width="5%">Cabang</th>
{{ $role->name }} <th width="15%">{{ __('Action') }}</th>
</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> </tr>
@endforeach </thead>
</tbody> <tbody>
</table> @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> </div>
</div> </div>
@@ -106,7 +108,7 @@
$(document).ready(function () { $(document).ready(function () {
if ($('#dataTable').length) { if ($('#dataTable').length) {
$('#dataTable').DataTable({ $('#dataTable').DataTable({
responsive: true, responsive: false,
dom: 'Bfrtip', dom: 'Bfrtip',
buttons: [ buttons: [
'excel', 'pdf', 'print' 'excel', 'pdf', 'print'
@@ -33,50 +33,52 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="data-tables"> <div class="data-tables">
@include('backend.layouts.partials.messages') @include('backend.layouts.partials.messages')
<table id="dataTable" class="text-center"> <div class="table-responsive">
<thead class="bg-light text-capitalize"> <table id="dataTable" class="text-center">
<tr> <thead class="bg-light text-capitalize">
<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>
</thead>
<tbody>
@foreach ($data as $item)
<tr> <tr>
<td> <th width="5%">{{ __('User') }}</th>
{{ $item->user ? $item->user->username : preg_replace('/\).*$/', '', explode('(', $item->activity)[1]) }} <th width="5%">{{ __('Ip Address') }}</th>
</td> <th width="5%">{{ __('Action') }}</th>
<td>{{ $item->ip_address }}</td> <th width="15%">{{ __('Activity') }}</th>
<td> <th width="5%">Browser</th>
@php <th width="15%">User Agent</th>
$color = 'info'; <th width="5%">Tanggal</th>
if ($item->action == 'Create') { <th width="5%">Waktu</th>
$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> </tr>
@endforeach </thead>
</tbody> <tbody>
</table> @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> </div>
</div> </div>
@@ -91,7 +93,7 @@
$(document).ready(function () { $(document).ready(function () {
if ($('#dataTable').length) { if ($('#dataTable').length) {
$('#dataTable').DataTable({ $('#dataTable').DataTable({
responsive: true, responsive: false,
dom: 'Bfrtip', dom: 'Bfrtip',
buttons: [ buttons: [
'excel', 'pdf', 'print' 'excel', 'pdf', 'print'
@@ -35,45 +35,47 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2"> <div class="dataTables_wrapper dt-bootstrap4 mt-2">
@include('backend.layouts.partials.messages') @include('backend.layouts.partials.messages')
<table id="dataTable" <div class="table-responsive">
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline" <table id="dataTable"
style="width:100%"> class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
<thead class="bg-light text-capitalize"> style="width:100%">
<tr> <thead class="bg-light text-capitalize">
<th>#</th> <tr>
<th>Nama</th> <th>#</th>
<th>Account Number</th> <th>Nama</th>
<th>Aksi</th> <th>Account Number</th>
</tr> <th>Aksi</th>
</thead> </tr>
<tbody> </thead>
@foreach ($categories as $category) <tbody>
<tr> @foreach ($categories as $category)
<td>{{ $loop->index + 1 }}</td> <tr>
<td>{{ $category->name }}</td> <td>{{ $loop->index + 1 }}</td>
<td>{{ $category->account_number }}</td> <td>{{ $category->name }}</td>
<td> <td>{{ $category->account_number }}</td>
@if (auth()->user()->can('admin.edit')) <td>
<a class="btn btn-success btn-sm text-white" href="{{ route('admin.category.edit', $category->id) }}">Edit</a> @if (auth()->user()->can('admin.edit'))
@endif <a class="btn btn-success btn-sm text-white" href="{{ route('admin.category.edit', $category->id) }}">Edit</a>
@if (auth()->user()->can('admin.delete')) @endif
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);" @if (auth()->user()->can('admin.delete'))
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $category->id }}').submit(); }"> <a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
{{ __('Delete') }} onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $category->id }}').submit(); }">
</a> {{ __('Delete') }}
</a>
<form id="delete-form-{{ $category->id }}" <form id="delete-form-{{ $category->id }}"
action="{{ route('admin.category.destroy', $category->id) }}" action="{{ route('admin.category.destroy', $category->id) }}"
method="POST" style="display: none;"> method="POST" style="display: none;">
@method('DELETE') @method('DELETE')
@csrf @csrf
</form> </form>
@endif @endif
</td> </td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -86,7 +88,7 @@
$(document).ready(function () { $(document).ready(function () {
if ($('#dataTable').length) { if ($('#dataTable').length) {
$('#dataTable').DataTable({ $('#dataTable').DataTable({
responsive: true, responsive: false,
dom: 'Bfrtip', dom: 'Bfrtip',
buttons: [ buttons: [
'excel', 'pdf', 'print' 'excel', 'pdf', 'print'
@@ -35,45 +35,47 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2"> <div class="dataTables_wrapper dt-bootstrap4 mt-2">
@include('backend.layouts.partials.messages') @include('backend.layouts.partials.messages')
<table id="dataTable" <div class="table-responsive">
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline" <table id="dataTable"
style="width:100%"> class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
<thead class="bg-light text-capitalize"> style="width:100%">
<tr> <thead class="bg-light text-capitalize">
<th>#</th> <tr>
<th>Code</th> <th>#</th>
<th>Nama</th> <th>Code</th>
<th>Aksi</th> <th>Nama</th>
</tr> <th>Aksi</th>
</thead> </tr>
<tbody> </thead>
@foreach ($costs as $cost) <tbody>
<tr> @foreach ($costs as $cost)
<td>{{ $loop->index + 1 }}</td> <tr>
<td>{{ $cost->code }}</td> <td>{{ $loop->index + 1 }}</td>
<td>{{ $cost->name }}</td> <td>{{ $cost->code }}</td>
<td> <td>{{ $cost->name }}</td>
@if (auth()->user()->can('admin.edit')) <td>
<a class="btn btn-success btn-sm text-white" href="{{ route('admin.cost.edit', $cost->id) }}">Edit</a> @if (auth()->user()->can('admin.edit'))
@endif <a class="btn btn-success btn-sm text-white" href="{{ route('admin.cost.edit', $cost->id) }}">Edit</a>
@if (auth()->user()->can('admin.delete')) @endif
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);" @if (auth()->user()->can('admin.delete'))
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $cost->id }}').submit(); }"> <a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
{{ __('Delete') }} onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $cost->id }}').submit(); }">
</a> {{ __('Delete') }}
</a>
<form id="delete-form-{{ $cost->id }}" <form id="delete-form-{{ $cost->id }}"
action="{{ route('admin.cost.destroy', $cost->id) }}" action="{{ route('admin.cost.destroy', $cost->id) }}"
method="POST" style="display: none;"> method="POST" style="display: none;">
@method('DELETE') @method('DELETE')
@csrf @csrf
</form> </form>
@endif @endif
</td> </td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -86,7 +88,7 @@
$(document).ready(function () { $(document).ready(function () {
if ($('#dataTable').length) { if ($('#dataTable').length) {
$('#dataTable').DataTable({ $('#dataTable').DataTable({
responsive: true, responsive: false,
dom: 'Bfrtip', dom: 'Bfrtip',
buttons: [ buttons: [
'excel', 'pdf', 'print' 'excel', 'pdf', 'print'
@@ -35,45 +35,47 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2"> <div class="dataTables_wrapper dt-bootstrap4 mt-2">
@include('backend.layouts.partials.messages') @include('backend.layouts.partials.messages')
<table id="dataTable" <div class="table-responsive">
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline" <table id="dataTable"
style="width:100%"> class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
<thead class="bg-light text-capitalize"> style="width:100%">
<tr> <thead class="bg-light text-capitalize">
<th>#</th> <tr>
<th>Code</th> <th>#</th>
<th>Nama</th> <th>Code</th>
<th>Aksi</th> <th>Nama</th>
</tr> <th>Aksi</th>
</thead> </tr>
<tbody> </thead>
@foreach ($rayons as $rayon) <tbody>
<tr> @foreach ($rayons as $rayon)
<td>{{ $loop->index + 1 }}</td> <tr>
<td>{{ $rayon->code }}</td> <td>{{ $loop->index + 1 }}</td>
<td>{{ $rayon->name }}</td> <td>{{ $rayon->code }}</td>
<td> <td>{{ $rayon->name }}</td>
@if (auth()->user()->can('admin.edit')) <td>
<a class="btn btn-success btn-sm text-white" href="{{ route('admin.rayon.edit', $rayon->id) }}">Edit</a> @if (auth()->user()->can('admin.edit'))
@endif <a class="btn btn-success btn-sm text-white" href="{{ route('admin.rayon.edit', $rayon->id) }}">Edit</a>
@if (auth()->user()->can('admin.delete')) @endif
<a class="btn btn-danger text-white btn-sm" href="javascript:void(0);" @if (auth()->user()->can('admin.delete'))
onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $rayon->id }}').submit(); }"> <a class="btn btn-danger text-white btn-sm" href="javascript:void(0);"
{{ __('Delete') }} onclick="event.preventDefault(); if(confirm('Are you sure you want to delete?')) { document.getElementById('delete-form-{{ $rayon->id }}').submit(); }">
</a> {{ __('Delete') }}
</a>
<form id="delete-form-{{ $rayon->id }}" <form id="delete-form-{{ $rayon->id }}"
action="{{ route('admin.rayon.destroy', $rayon->id) }}" action="{{ route('admin.rayon.destroy', $rayon->id) }}"
method="POST" style="display: none;"> method="POST" style="display: none;">
@method('DELETE') @method('DELETE')
@csrf @csrf
</form> </form>
@endif @endif
</td> </td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -38,56 +38,58 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4"> <div class="dataTables_wrapper dt-bootstrap4">
@include('backend.layouts.partials.messages') @include('backend.layouts.partials.messages')
<table id="dataTable" <div class="table-responsive">
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline" <table id="dataTable"
style="width:100%"> class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
<thead class="bg-light text-capitalize"> style="width:100%">
<tr> <thead class="bg-light text-capitalize">
<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)
<tr> <tr>
<td>{{ $loop->index + 1 }}</td> <th width="5%">{{ __('Sl') }}</th>
<td>{{ $role->name }}</td> <th width="10%">{{ __('Role Name') }}</th>
<td> <th width="30%">{{ __('Permission List') }}</th>
@foreach ($role->permissions as $permission) <th width="10%">{{ __('Action') }}</th>
<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> </tr>
@endforeach </thead>
</tbody> <tbody>
</table> @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> </div>
</div> </div>
@@ -103,7 +105,7 @@
$(document).ready(function () { $(document).ready(function () {
if ($('#dataTable').length) { if ($('#dataTable').length) {
$('#dataTable').DataTable({ $('#dataTable').DataTable({
responsive: true, responsive: false,
dom: 'Bfrtip', dom: 'Bfrtip',
buttons: [ buttons: [
'excel', 'pdf', 'print' 'excel', 'pdf', 'print'