Merged in bugfix/addedit-job (pull request #230)

Bugfix/addedit job
This commit is contained in:
Ain Izazi Aziz
2025-01-02 04:22:08 +00:00
committed by Muhd hafifie
8 changed files with 228 additions and 59 deletions
+9 -5
View File
@@ -40,9 +40,10 @@ class CustomersController extends Controller
$idtype = 'nokp';
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
$bank = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/bank')->json();
$pekerjaan = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/pekerjaan')->json();
$blacklist_search = false;
return view('customers.' . $cawangan_info['version'] . '.index',compact('search','blacklist_search','cawangan_info','bank','api_url','idtype'));
return view('customers.' . $cawangan_info['version'] . '.index',compact('search','blacklist_search','cawangan_info','bank','api_url','idtype','pekerjaan'));
}
public function info(Request $request){
@@ -51,7 +52,8 @@ class CustomersController extends Controller
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
$customer_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/'. Session::get('noic'))->json();
// dd($customer_info);
$pekerjaan = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/pekerjaan')->json();
$komoditi = Komoditi::first();
$min_komoditi = $komoditi['min_komoditi'];
@@ -68,7 +70,7 @@ class CustomersController extends Controller
$request->session()->flash('activate_tab', 'SAG_baru');
}
return view($customer_page,compact('cawangan_info','api_url','customer_info','bakilelong','rugilelong','min_komoditi'));
return view($customer_page,compact('cawangan_info','api_url','customer_info','bakilelong','rugilelong','min_komoditi','pekerjaan'));
}
public function search(Request $request){
@@ -81,6 +83,7 @@ class CustomersController extends Controller
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
$bank = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/bank')->json();
$customer_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/'. $noic)->json();
$pekerjaan = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/pekerjaan')->json();
$blacklist = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customer/blacklist',[
'nokp' => $noic
@@ -105,9 +108,9 @@ class CustomersController extends Controller
}else{
if($blacklist){
$blacklist_search = true;
return view('customers.' . $cawangan_info['version'] . '.index',compact('blacklist_search','customer_info','search','noic','cawangan_info','bank','api_url','idtype'));
return view('customers.' . $cawangan_info['version'] . '.index',compact('blacklist_search','customer_info','search','noic','cawangan_info','bank','api_url','idtype','pekerjaan'));
}else{
return view('customers.' . $cawangan_info['version'] . '.index',compact('blacklist_search','customer_info','search','noic','cawangan_info','bank','api_url','idtype'));
return view('customers.' . $cawangan_info['version'] . '.index',compact('blacklist_search','customer_info','search','noic','cawangan_info','bank','api_url','idtype','pekerjaan'));
}
}
}
@@ -219,6 +222,7 @@ class CustomersController extends Controller
'nosiri' => $nosiri_latest,
'nota'=>$request->nota,
'kodkerja'=>$request->pekerjaan,
'nota_pekerjaan'=>$request->nota_pekerjaan,
'tujuangadai'=>$request->tujuan_gadai,
]);
+6 -4
View File
@@ -79,15 +79,17 @@ class KhazanahController extends Controller
Session::put('customer_info_khazanah',$customer_info);
if($auth_user->roles == 'admin'){
return redirect()->route('admin.customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info,'api_url'=>$api_url]);
}else{
return redirect()->route('khazanah.customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info,'api_url'=>$api_url]);
}
return redirect()->route('khazanah.customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info,'api_url'=>$api_url]);
// return redirect()->back()->with('failed','Maaf,Tiada Data Pelanggan...');
}else{
if($auth_user->roles == 'admin'){
return view('admin.customer_index',compact('search','noic','cawangan_info','bank','api_url','idtype'));
}else{
return view('khazanah.index',compact('search','noic','cawangan_info','bank','api_url','idtype'));
}
// return view('khazanah.index',compact('search','noic','cawangan_info','bank','api_url','idtype'));
return redirect()->back()->with('failed','Maaf, hanya taraf teller sahaja yang boleh mendaftar');
}
}
@@ -145,10 +145,10 @@
</div>
</div>
</div>
<div class="mr-5 form-group float-right">
{{-- <div class="mr-5 form-group float-right">
<button type="button" class="btn btn-primary" onclick="kemaskinifunc()" id="btnkemaskini">Kemaskini</button>
<button type="button" class="btn btn-primary" onclick="kemaskinipelanggan()" id="btnsave">Save</button>
</div>
</div> --}}
</form>
</div>
</div>
+8 -8
View File
@@ -56,14 +56,14 @@
</div>
</div>
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@elseif ($message = Session::get('failed'))
<div class="alert alert-danger">
<p>{{ $message }}</p>
</div>
@endif
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@elseif ($message = Session::get('failed'))
<div class="alert alert-danger">
<p>{{ $message }}</p>
</div>
@endif
</form>
</div>
@if($search == true )
+84 -17
View File
@@ -182,23 +182,24 @@
</select>
</div>
<div class="col-md-4">Pekerjaan</div>
@php
$pekerjaan = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/pekerjaan')->json();
@endphp
<div class="col-md-8">
<select class="form-control" name="pekerjaan" data-placeholder="Pilih Pekerjaan" id="pekerjaan">
<select class="form-control" name="pekerjaan" id="pekerjaan">
<option disabled selected value> -- Pilih Pekerjaan -- </option>
@foreach($pekerjaan as $kerja)
<option value="{{ $kerja['kodkerja'] }}">{{ $kerja['keterangan'] }}</option>
<option value="{{ $kerja['kodkerja'] }}">{{ $kerja['keterangan'] }}</option>
@endforeach
</select>
<div id="pekerjaan-lain-container" style="display: none; margin-top: 10px;">
<input type="text" class="form-control" id="pekerjaan-lain" name="nota_pekerjaan" placeholder="Masukkan pekerjaan lain"
oninput="this.value = this.value.replace(/[^a-zA-Z ]/g, '');">
</div>
</div>
<div class="col-md-4">Nota</div>
<div class="col-md-8"><input class="form-control" type="text" name="nota" id="nota" placeholder="Nota"></div>
<div class="col-md-8"><input class="form-control" type="text" name="nota" id="nota" placeholder="Nota"></div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<input type="text" hidden name="idtype" value="nokp">
@@ -321,16 +322,17 @@
</select>
</div>
<div class="col-md-4">Pekerjaan</div>
@php
$pekerjaan = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/pekerjaan')->json();
@endphp
<div class="col-md-8">
<select class="form-control" name="pekerjaan" data-placeholder="Pilih Pekerjaan" id="pekerjaan">
<select class="form-control" name="pekerjaan" id="pekerjaan">
<option disabled selected value> -- Pilih Pekerjaan -- </option>
@foreach($pekerjaan as $kerja)
<option value="{{ $kerja['kodkerja'] }}">{{ $kerja['keterangan'] }}</option>
<option value="{{ $kerja['kodkerja'] }}">{{ $kerja['keterangan'] }}</option>
@endforeach
</select>
<div id="pekerjaan-lain-container" style="display: none; margin-top: 10px;">
<input type="text" class="form-control" id="pekerjaan-lain" name="nota_pekerjaan" placeholder="Masukkan pekerjaan lain">
</div>
</div>
<div class="col-md-4">Nota</div>
<div class="col-md-8"><input class="form-control" type="text" name="nota" id="nota" placeholder="Nota"></div>
@@ -446,16 +448,17 @@
</select>
</div>
<div class="col-md-4">Pekerjaan</div>
@php
$pekerjaan = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/pekerjaan')->json();
@endphp
<div class="col-md-8">
<select class="form-control" name="pekerjaan" data-placeholder="Pilih Pekerjaan" id="passport_pekerjaan">
<select class="form-control" name="pekerjaan" id="pekerjaan">
<option disabled selected value> -- Pilih Pekerjaan -- </option>
@foreach($pekerjaan as $kerja)
<option value="{{ $kerja['kodkerja'] }}">{{ $kerja['keterangan'] }}</option>
<option value="{{ $kerja['kodkerja'] }}">{{ $kerja['keterangan'] }}</option>
@endforeach
</select>
<div id="pekerjaan-lain-container" style="display: none; margin-top: 10px;">
<input type="text" class="form-control" id="pekerjaan-lain" name="nota_pekerjaan" placeholder="Masukkan pekerjaan lain">
</div>
</div>
<div class="col-md-4">Nota</div>
<div class="col-md-8"><input class="form-control" type="text" name="nota" id="passport_nota" placeholder="Nota"></div>
@@ -527,6 +530,34 @@
function newcustomer(){
var id_type = $('#customerIDType').val();
var nokp = $('#noic').val();
const date = nokp.substring(0, 6);
const year = parseInt(date.substring(0, 2), 10);
const month = parseInt(date.substring(2, 4), 10) - 1;
const day = parseInt(date.substring(4, 6), 10);
const cutofYear = 20;
const fullYear = year < cutofYear ? 2000 + year : 1900 + year;
const dateconvert = new Date(fullYear, month, day);
const today = new Date();
const eighteenthBirthday = new Date(dateconvert);
eighteenthBirthday.setFullYear(dateconvert.getFullYear() + 18);
console.log(today,eighteenthBirthday);
if (today < eighteenthBirthday) {
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Pelanggan Ini Dibawah Umur!'
});
event.preventDefault();
return false;
}
if(id_type=='nokp'){
$('#daftar_pelanggan').modal('show');
}else if(id_type=='passport'){
@@ -1222,6 +1253,31 @@
var id_type = $('#customerIDType').val();
var nokp = $('#noic').val();
if(id_type=='nokp'){
const date = nokp.substring(0, 6);
const year = parseInt(date.substring(0, 2), 10);
const month = parseInt(date.substring(2, 4), 10) - 1;
const day = parseInt(date.substring(4, 6), 10);
const cutofYear = 20;
const fullYear = year < cutofYear ? 2000 + year : 1900 + year;
const dateconvert = new Date(fullYear, month, day);
const today = new Date();
const eighteenthBirthday = new Date(dateconvert);
eighteenthBirthday.setFullYear(dateconvert.getFullYear() + 18);
if (today < eighteenthBirthday) {
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Pelanggan Ini Dibawah Umur!'
});
event.preventDefault();
return false;
}
if($.isNumeric(nokp) == false){
if(nokp.substr(-1) != '*')
{
@@ -1281,6 +1337,17 @@
</script>
<script src="{{ asset('js/searchName.js') }}"></script>
<script>
$('#pekerjaan').on('change', function() {
var lainContainer = $('#pekerjaan-lain-container');
if ($(this).val() === '6') {
lainContainer.show();
} else {
$('#pekerjaan-lain').val('');
lainContainer.hide();
}
});
</script>
@push('additional_scripts')
<script>
// mycard-read endpoint initialization
@@ -347,6 +347,28 @@
<span id="errorkodbank" style="color:red;"></span>
</div>
</div>
<div class='form-group row col-md-12'>
<div class='col-md-5'>
Pekerjaan
</div>
<div class='col-md-7'>
@php
$pekerjaan = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/pekerjaan')->json();
@endphp
<select class="form-control" name="kodkerja" data-placeholder="Pilih Pekerjaan" id="kodkerja" disabled="true">
<option value="-" selected disabled>-</option>
@foreach($pekerjaan as $kerja)
<option value="{{ $kerja['kodkerja'] }}" {{ $kerja['kodkerja'] == $customer_info['kodkerja'] ? 'selected' : '' }}>
{{ $kerja['keterangan'] }}
</option>
@endforeach
</select>
<div id="pekerjaan-lain-container" style="display: {{ $customer_info['kodkerja'] == '6' ? 'block' : 'none' }}; margin-top: 10px;" >
<input type="text" class="form-control" id="nota_pekerjaan" name="nota_pekerjaan" placeholder="Sila Nyatakan" value="{{ $customer_info['nota_pekerjaan'] ?? '' }}" disabled="true"
oninput="this.value = this.value.replace(/[^a-zA-Z ]/g, '');">
</div>
</div>
</div>
<div class='form-group row col-md-12'>
<div class='col-md-5'>
No Akaun
@@ -2519,6 +2541,8 @@
$('#telefon').attr('readonly', false);
$('#telefon2').attr('readonly', false);
$('#kodbank').attr('disabled', false);
$('#kodkerja').attr('disabled', false);
$('#nota_pekerjaan').attr('disabled', false);
$('#noakaun').attr('readonly', false);
$('#nota').attr('readonly', false);
$('#alamat').attr('readonly', false);
@@ -2540,6 +2564,8 @@
$('#telefon').attr('readonly', true);
$('#telefon2').attr('readonly', true);
$('#kodbank').attr('disabled', true);
$('#kodkerja').attr('disabled', true);
$('#nota_pekerjaan').attr('disabled', true);
$('#noakaun').attr('readonly', true);
$('#nota').attr('readonly', true);
$('#alamat').attr('readonly', true);
@@ -2553,6 +2579,8 @@
var telefon1 = $('#telefon').val();
var telefon2 = $('#telefon2').val();
var kodbank = $('#kodbank').val();
var kodkerja = $('#kodkerja').val();
var nota_pekerjaan = $('#nota_pekerjaan').val();
var noakaun = $('#noakaun').val();
var nota = $('#nota').val();
var alamat = $('#alamat').val();
@@ -2566,6 +2594,8 @@
"telefon1": telefon1,
"telefon2": telefon2,
"kodbank":kodbank,
"kodkerja":kodkerja,
"nota_pekerjaan":nota_pekerjaan,
"noakaun":noakaun,
'nota':nota,
'alamat':alamat,
@@ -2650,6 +2680,8 @@
$('#telefon2').attr('readonly', true);
$('#noakaun').attr('readonly', true);
$('#kodbank').attr('disabled', true);
$('#kodkerja').attr('disabled', true);
$('#nota_pekerjaan').attr('disabled', true);
$('#nota').attr('readonly', true);
$('#alamat').attr('readonly', true);
$('#poskod').attr('readonly', true);
@@ -2934,4 +2966,15 @@
}
}
</script>
<script>
$('#kodkerja').on('change', function() {
var lainContainer = $('#pekerjaan-lain-container');
if ($(this).val() === '6') {
lainContainer.show();
} else {
$('#pekerjaan-lain').val('');
lainContainer.hide();
}
});
</script>
@endsection
+9
View File
@@ -40,6 +40,15 @@
<button class="btn btn-outline-primary" type="submit" id="button-addon2">Cari</button>
</div>
</div>
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@elseif ($message = Session::get('failed'))
<div class="alert alert-danger">
<p>{{ $message }}</p>
</div>
@endif
</div>
</div>
</form>
@@ -332,6 +332,28 @@
<span id="errorkodbank" style="color:red;"></span>
</div>
</div>
<div class='form-group row col-md-12'>
<div class='col-md-5'>
Pekerjaan
</div>
<div class='col-md-7'>
@php
$pekerjaan = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/pekerjaan')->json();
@endphp
<select class="form-control" name="kodkerja" data-placeholder="Pilih Pekerjaan" id="kodkerja" disabled="true">
<option value="-" selected disabled>-</option>
@foreach($pekerjaan as $kerja)
<option value="{{ $kerja['kodkerja'] }}" {{ $kerja['kodkerja'] == $customer_info['kodkerja'] ? 'selected' : '' }}>
{{ $kerja['keterangan'] }}
</option>
@endforeach
</select>
<div id="pekerjaan-lain-container" style="display: {{ $customer_info['kodkerja'] == '6' ? 'block' : 'none' }}; margin-top: 10px;" >
<input type="text" class="form-control" id="nota_pekerjaan" name="nota_pekerjaan" placeholder="Sila Nyatakan" value="{{ $customer_info['nota_pekerjaan'] ?? '' }}" disabled="true"
oninput="this.value = this.value.replace(/[^a-zA-Z ]/g, '');">
</div>
</div>
</div>
<div class='form-group row col-md-12'>
<div class='col-md-5'>
No Akaun
@@ -1383,6 +1405,8 @@ $.each(data,function(index,gadai_detail){
$('#telefon').attr('readonly', false);
$('#telefon2').attr('readonly', false);
$('#kodbank').attr('disabled', false);
$('#kodkerja').attr('disabled', false);
$('#nota_pekerjaan').attr('disabled', false);
$('#noakaun').attr('readonly', false);
$('#nota').attr('readonly', false);
$('#nama').attr('readonly', false);
@@ -1404,6 +1428,8 @@ $.each(data,function(index,gadai_detail){
$('#telefon').attr('readonly', true);
$('#telefon2').attr('readonly', true);
$('#kodbank').attr('disabled', true);
$('#kodkerja').attr('disabled', true);
$('#nota_pekerjaan').attr('disabled', true);
$('#noakaun').attr('readonly', true);
$('#nota').attr('readonly', true);
$('#nama').attr('readonly', true);
@@ -1427,6 +1453,8 @@ $.each(data,function(index,gadai_detail){
var telefon1 = $('#telefon').val();
var telefon2 = $('#telefon2').val();
var kodbank = $('#kodbank').val();
var kodkerja = $('#kodkerja').val();
var nota_pekerjaan = $('#nota_pekerjaan').val();
var noakaun = $('#noakaun').val();
var nota = $('#nota').val();
var nama = $('#nama').val();
@@ -1441,6 +1469,8 @@ $.each(data,function(index,gadai_detail){
"telefon1": telefon1,
"telefon2": telefon2,
"kodbank":kodbank,
"kodkerja":kodkerja,
"nota_pekerjaan":nota_pekerjaan,
"noakaun":noakaun,
'nota':nota,
'nama':nama,
@@ -1526,6 +1556,8 @@ $.each(data,function(index,gadai_detail){
$('#telefon2').attr('readonly', true);
$('#noakaun').attr('readonly', true);
$('#kodbank').attr('disabled', true);
$('#kodkerja').attr('disabled', true);
$('#nota_pekerjaan').attr('disabled', true);
$('#nota').attr('readonly', true);
$('#nama').attr('readonly', true);
$('#alamat').attr('readonly', true);
@@ -1580,4 +1612,16 @@ $.each(data,function(index,gadai_detail){
});
});
</script>
<script>
$('#kodkerja').on('change', function() {
var lainContainer = $('#pekerjaan-lain-container');
if ($(this).val() === '6') {
lainContainer.show();
} else {
$('#pekerjaan-lain').val('');
lainContainer.hide();
}
});
</script>
@endsection