add banned & status

pengurusan pengguna - admin
This commit is contained in:
faiqahzaman
2022-03-02 14:45:13 +08:00
parent 029af07d5b
commit c72fcae6e0
6 changed files with 207 additions and 30 deletions
+71 -17
View File
@@ -9,8 +9,9 @@
<p>{{ $message }}</p>
</div>
@endif
<form action="{{ route('pembida.update',$user->id) }}" method="POST" id="formkemaskini">
<form action="{{ route('pembida.update') }}" method="POST" id="formkemaskini">
@csrf
<input type="hidden" value="{{$user->id}}" class="form-control" name="userid" id="userid" readonly>
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputEmail4">Nama</label>
@@ -32,13 +33,24 @@
</div>
</div>
<div class="d-flex form-group">
<div class="d-flex col-md-6">
<div style="margin-right:2%;">
<label for="status1">Status</label>
</div>
<div class="custom-control custom-switch" >
<input type="checkbox" class="custom-control-input" id="customSwitch1" name="status" onchange="showstatus(this)">
<label class="custom-control-label" for="customSwitch1" ><input data-status="{{ $user->status }}" type="text" id="txtstatus" style="border: none;" readonly></label>
<input type="checkbox" class="custom-control-input" name="status" id="customSwitch1" onchange="showstatus(this)">
<label class="custom-control-label" for="customSwitch1" data-status="{{ $user->status }}" id="txtstatus"></lable>
</div>
</div>
<div class="d-flex col-md-6">
<div style="margin-right:2%;">
<label for="status1">Ban</label>
</div>
<div class="custom-control custom-switch" >
<input type="checkbox" class="custom-control-input" style="background-color:red !important" name="statusban" id="customSwitch2" onchange="showban(this)">
<label class="custom-control-label" for="customSwitch2" id="txtstatusban"></lable>
</div>
</div>
</div>
<div class="form-row">
<h4 class="col-md-3">Identity Card/Passport Picture</h4>
@@ -52,8 +64,8 @@
</div>
<div class="text-right pt-4">
<input type="hidden" name="userid" value="{{$user->id}}">
<a href="{{url('pembida/senaraipembida')}}" class="btn btn-primary">Kembali</a>
<button type="button" class="btn btn-success" data-toggle="modal" data-target=".bd-example-modal-sm" onclick="kemaskini()" >Kemaskini</button>
<a href="{{url('pembida/senaraipembidakeseluruhan')}}" class="btn btn-primary">Kembali</a>
<button type="button" class="btn btn-success" onclick="kemaskini()" >Kemaskini</button>
</div>
</form>
@@ -61,27 +73,69 @@
</div>
</div>
<script>
var status = $('#txtstatus').data('status');
console.log(status);
if(status == 'active'){
$('#customSwitch1').prop('checked',true) ;
$('#customSwitch2').prop('checked',false) ;
$('#txtstatus').text('Active');
}
else if(status == 'banned')
{
$('#customSwitch1').prop('checked',false) ;
$('#customSwitch2').prop('checked',true) ;
$('#txtstatusban').text('Banned');
}
else{
$('#customSwitch1').prop('checked',false) ;
$('#customSwitch2').prop('checked',false) ;
$('#txtstatus').text('Inactive');
}
function kemaskini() {
// console.log($('#txtstatus').val());
$("#formkemaskini").submit();
}
let status = $('#txtstatus').data('status');
console.log(status);
if(status == 'active'){
var value = $('#customSwitch1').prop('checked',true) ;
$('#txtstatus').val('Active');
}
else{
var value = $('#customSwitch1').prop('checked',false) ;
$('#txtstatus').val('Inactive');
function showban(e){
var value = $(e).prop('checked') ;
if( value == true){
$('#txtstatus').text('Inactive');
$('#txtstatusban').text('Banned');
$('#customSwitch1').prop('checked',false) ;
}
else{
if(status == 'active'){
$('#customSwitch1').prop('checked',true) ;
$('#txtstatus').text('Active');
$('#txtstatusban').text('');
}
else
{
$('#txtstatusban').text('');
$('#txtstatus').text('Inactive');
}
}
}
function showstatus(e){
var value = $(e).prop('checked') ;
if( value == true){
$('#txtstatus').val('Active');
if( value == true)
{
$('#txtstatusban').text('');
$('#txtstatus').text('Active');
$('#customSwitch2').prop('checked',false) ;
}
else{
$('#txtstatus').val('Inactive');
if(status == 'banned'){
$('#customSwitch2').prop('checked',true) ;
$('#txtstatus').text('Inactive');
$('#txtstatusban').text('Banned');
}
else
{
$('#txtstatusban').text('');
$('#txtstatus').text('Inactive');
}
}
console.log(value);
}
@@ -40,6 +40,8 @@
<button class="btn btn-success btn-sm hovernone-success" disabled>{{$user->status}}</button>
@elseif ($user->status =='banned')
<button class="btn btn-danger btn-sm hovernone-danger" disabled>{{$user->status}}</button>
@elseif ($user->status == 'inactive')
<button class="btn btn-danger btn-sm hovernone-danger" disabled>{{$user->status}}</button>
@else ($user->status == null)
Menunggu Pengesahan Operasi
@endif
@@ -33,6 +33,28 @@
@endforeach
</div>
</div>
@if($user->user_type == 2)
<div class="d-flex form-group">
<div class="d-flex col-md-6">
<div style="margin-right:2%;">
<label for="status1">Status</label>
</div>
<div class="custom-control custom-switch" >
<input type="checkbox" class="custom-control-input" name="status" id="customSwitch1" onchange="showstatus(this)">
<label class="custom-control-label" for="customSwitch1" data-status="{{ $user->status }}" id="txtstatus"></lable>
</div>
</div>
<div class="d-flex col-md-6">
<div style="margin-right:2%;">
<label for="status1">Ban</label>
</div>
<div class="custom-control custom-switch" >
<input type="checkbox" class="custom-control-input" style="background-color:red !important" name="statusban" id="customSwitch2" onchange="showban(this)">
<label class="custom-control-label" for="customSwitch2" id="txtstatusban"></lable>
</div>
</div>
</div>
@endif
<div class="text-right pt-4">
<input type="hidden" name="userid" value="{{$user->id}}">
<a href="{{url('pengguna/listpengguna')}}" class="btn btn-primary">Kembali</a>
@@ -66,5 +88,71 @@
});
}
var status = $('#txtstatus').data('status');
console.log(status);
if(status == 'active'){
$('#customSwitch1').prop('checked',true) ;
$('#customSwitch2').prop('checked',false) ;
$('#txtstatus').text('Active');
}
else if(status == 'banned')
{
$('#customSwitch1').prop('checked',false) ;
$('#customSwitch2').prop('checked',true) ;
$('#txtstatusban').text('Banned');
}
else{
$('#customSwitch1').prop('checked',false) ;
$('#customSwitch2').prop('checked',false) ;
$('#txtstatus').text('Inactive');
}
function kemaskini() {
// console.log($('#txtstatus').val());
$("#formkemaskini").submit();
}
function showban(e){
var value = $(e).prop('checked') ;
if( value == true){
$('#txtstatus').text('Inactive');
$('#txtstatusban').text('Banned');
$('#customSwitch1').prop('checked',false) ;
}
else{
if(status == 'active'){
$('#customSwitch1').prop('checked',true) ;
$('#txtstatus').text('Active');
$('#txtstatusban').text('');
}
else
{
$('#txtstatusban').text('');
$('#txtstatus').text('Inactive');
}
}
}
function showstatus(e){
var value = $(e).prop('checked') ;
if( value == true)
{
$('#txtstatusban').text('');
$('#txtstatus').text('Active');
$('#customSwitch2').prop('checked',false) ;
}
else{
if(status == 'banned'){
$('#customSwitch2').prop('checked',true) ;
$('#txtstatus').text('Inactive');
$('#txtstatusban').text('Banned');
}
else
{
$('#txtstatusban').text('');
$('#txtstatus').text('Inactive');
}
}
console.log(value);
}
</script>
@endsection