DONE: use flexible name for api call in frontend
This commit is contained in:
@@ -138,6 +138,19 @@
|
||||
<a href="{{ route('kakitangan.tukartaraf',['id'=>$staff->id]) }}" class="btn btn-warning" title="Tukar Taraf"><i class="material-icons">edit</i></a>
|
||||
<a href="{{ route('kakitangan.tukarcawangan',['id'=>$staff->id]) }}" class="btn btn-info" title="Tukar Cawangan"><i class="material-icons">work</i></a>
|
||||
<a href="{{ route('operasi.kakitangan.edit',['id'=>$staff->id]) }}" class="btn btn-success" title="Edit Maklumat"><i class="material-icons">settings</i></a>
|
||||
@if(
|
||||
app()->environment('local')
|
||||
&&
|
||||
in_array($auth_user->roles, ['admin'])
|
||||
&& $staff->roles != 'admin'
|
||||
&& $staff->id != $auth_user->id
|
||||
&& !(Auth::check() && method_exists(Auth::user(), 'isImpersonated') && Auth::user()->isImpersonated())
|
||||
)
|
||||
<form method="post" action="{{ route('impersonate.start', ['id' => $staff->id]) }}" style="display:inline;">
|
||||
@csrf
|
||||
<button type="button" class="btn btn-secondary btn-impersonate" data-staff-name="{{ $staff->name }}" title="Impersonate"><i class="material-icons">supervised_user_circle</i></button>
|
||||
</form>
|
||||
@endif
|
||||
<button type="button" class="btn btn-danger btn-delete" data-roles="{{ $auth_user->roles }}" data-staff-id="{{ $staff->id }}" data-token="{{ csrf_token() }}" title="Delete Kakitangan"><i class="material-icons">delete</i></button>
|
||||
@elseif($auth_user->roles == 'admin')
|
||||
{{-- <form method="post" action="{{ route('admin.kakitangan.delete') }}">
|
||||
@@ -147,6 +160,18 @@
|
||||
<a href="{{ route('admin.kakitangan.tukarcawangan',['id'=>$staff->id]) }}" class="btn btn-info" title="Tukar Cawangan"><i class="material-icons">work</i></a>
|
||||
<a href="{{ route('admin.kakitangan.edit',['id'=>$staff->id]) }}" class="btn btn-success" title="Edit Maklumat"><i class="material-icons">settings</i></a>
|
||||
<a href="{{ route('admin.kakitangan.resetcredentials',['id'=>$staff->id]) }}" class="btn btn-primary" title="Reset Password"><i class="material-icons">restore</i></a>
|
||||
@if(
|
||||
app()->environment('local')
|
||||
&&
|
||||
$staff->roles != 'admin'
|
||||
&& $staff->id != $auth_user->id
|
||||
&& !(Auth::check() && method_exists(Auth::user(), 'isImpersonated') && Auth::user()->isImpersonated())
|
||||
)
|
||||
<form method="post" action="{{ route('impersonate.start', ['id' => $staff->id]) }}" style="display:inline;">
|
||||
@csrf
|
||||
<button type="button" class="btn btn-secondary btn-impersonate" data-staff-name="{{ $staff->name }}" title="Impersonate"><i class="material-icons">supervised_user_circle</i></button>
|
||||
</form>
|
||||
@endif
|
||||
<button type="button" class="btn btn-danger btn-delete" data-staff-id="{{ $staff->id }}" data-token="{{ csrf_token() }}" title="Delete Kakitangan"><i class="material-icons">delete</i></button>
|
||||
{{-- </form> --}}
|
||||
@endif
|
||||
@@ -223,6 +248,27 @@
|
||||
}).catch(swal.noop)
|
||||
});
|
||||
|
||||
$("#rekod_kakitangan").on('click', ".btn-impersonate", function(){
|
||||
var form = $(this).closest('form');
|
||||
var staffName = $(this).data('staff-name');
|
||||
|
||||
Swal.fire({
|
||||
title: 'Menyamar sebagai Kakitangan?',
|
||||
text: "Anda akan log masuk sebagai " + staffName + ".",
|
||||
type: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonClass: 'btn btn-secondary',
|
||||
cancelButtonClass: 'btn btn-warning',
|
||||
confirmButtonText: 'Ya, menyamar',
|
||||
cancelButtonText: 'Batal!',
|
||||
buttonsStyling: false
|
||||
}).then(function(result) {
|
||||
if (result.isConfirmed) {
|
||||
form.submit();
|
||||
}
|
||||
}).catch(swal.noop)
|
||||
});
|
||||
|
||||
function verifyregister(){
|
||||
var cawangan = $('#cawangan').val();
|
||||
var role = $('#role').val();
|
||||
|
||||
@@ -85,7 +85,7 @@ $(document).ready(function() {
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: '{{ config("api.url") }}/api/maxmutuemas/update',
|
||||
url: '{{ api_url_for_browser() }}/api/maxmutuemas/update',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
success: function(response) {
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
</div>
|
||||
<script>
|
||||
|
||||
let api_url = "{{ $api_url }}";
|
||||
let api_url = "{{ api_url_for_browser() }}";
|
||||
|
||||
var tableemas = $('#table-emas').DataTable({
|
||||
"scrollX": true
|
||||
|
||||
@@ -236,8 +236,8 @@
|
||||
"scrollX": true
|
||||
});
|
||||
|
||||
let api = "{{ config('api.url') }}";
|
||||
|
||||
let api = "{{ api_url_for_browser() }}";
|
||||
|
||||
const formatter = new Intl.NumberFormat('en-US', {
|
||||
minimumFractionDigits: 2
|
||||
});
|
||||
|
||||
@@ -237,7 +237,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
let api_url = "{{ $api_url }}";
|
||||
let api_url = "{{ api_url_for_browser() }}";
|
||||
|
||||
var tablerekod = $('#rekod_komuditi').DataTable( {
|
||||
"pageLength": 1000,
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let api_url = "{{ $api_url }}";
|
||||
let api_url = "{{ api_url_for_browser() }}";
|
||||
var tablerekod = $('#rekod_komoditi').DataTable();
|
||||
$('#tarikh_rekod').datepicker({
|
||||
format: 'dd/mm/yyyy',
|
||||
|
||||
Reference in New Issue
Block a user