Viewing file: 3a485a360dda68485939eac4b2485d955f43598e.php (9.81 KB) -rwxrwxrwx Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php $__env->startSection('content'); ?>
<?php echo $__env->make('users.partials.header', [
], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<div class="container-fluid mt--7">
<div class="row">
<div class="col">
<div class="card shadow">
<div class="card-header border-0">
<div class="row align-items-center">
<div class="col-8">
<h3 class="mb-0">Users</h3>
</div>
<div class="col-4 text-right">
<a href="<?php echo e(route('user.add')); ?> " class="btn btn-sm btn-primary">Add user</a>
</div>
</div>
</div>
<div class="col-lg-12">
<div class="table-responsive">
<table class="table align-items-center">
<thead class="thead-light">
<tr>
<!-- <th class="td_data">Id</th> -->
<th class="td_data">Name</th>
<th class="td_data">Phone</th>
<th class="td_data">Balance</th>
<th class="td_data">Role</th>
<th class="td_data">Due Amount</th>
<th class="td_data"></th>
</tr>
</thead>
<tbody>
<?php $__currentLoopData = $user; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<!-- <td class="td_data"><?php echo e($value['id']); ?></td> -->
<td class="td_data">
<?php echo e($value['name']); ?>
</td>
<td class="td_data"><?php echo e($value['phone']); ?></td>
<td class="td_data"><?php echo e($value['balance']); ?></td>
<td class="td_data"><?php echo e($value['role']); ?></td>
<td class="td_data"><?php echo e($value['amount_due']); ?></td>
<!-- <td class="text-right">
<div class="dropdown">
<a class="btn btn-sm btn-icon-only text-light" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v"></i>
</a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="">Edit</a>
</div>
</div>
</td> -->
<td><button type="button" class="btn btn-info btn" data-toggle="modal" data-target="#balance-modal" id="btn_balance" onclick="balance_modal_open('<?php echo e($value["id"]); ?>','<?php echo e(auth()->user()->role); ?>')" >Balance</button></td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
</div>
</div>
<!-- Start New Customer -->
<div id="balance-modal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" >
<h3 >Balance Form</h3>
<a class="close" data-dismiss="modal">×</a>
</div>
<form id="balanceForm" name="balance" role="form">
<div class="modal-body">
<div class="form-group" >
<?php if(auth()->user()->role!=="Admin"): ?>
<h2>Remaining Balance : <?php echo e(auth()->user()->balance); ?></h2>
<?php endif; ?>
<input type="hidden" id="reseler_balance" value="<?php echo e(auth()->user()->balance); ?>">
</div>
<div class="form-group">
<label for="add_balance">Balance</label>
<input type="text" name="add_balance" id="add_balance" class="form-control">
<p id="err_balance" style="display:none;">Please give some Balance..</p>
</div>
<div class="form-group">
<label for="add_amount">Amount</label>
<input type="text" name="add_amount" id="add_amount" class="form-control">
</div>
<div class="form-group">
<label for="name">Payment Method</label>
<select class="form-control" name="method" id="add_method">
<option value="Cash" selected>cash</option>
<option value="Bkash">Bkash</option>
<option value="Card">Card</option>
</select>
</div>
<p id="low_balance" style="display:none;">You don't Have sufficient Balance..</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<input type="submit" class="btn btn-success" id="submit" value="Add">
</div>
</form>
</div>
</div>
</div>
<!-- End New Customer Area -->
<!-- -->
<div class="card-footer py-4">
<nav class="d-flex justify-content-end" aria-label="...">
</nav>
</div>
</div>
</div>
</div>
<?php echo $__env->make('layouts.footers.auth', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
</div>
<?php $__env->stopSection(); ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
function balance_modal_open(user_id,reseller_role) {
console.log(user_id);
console.log(reseller_role);
$(document).ready(function(){
$("#balanceForm").submit(function(event){
submitForm(user_id,reseller_role);
return false;
// console.log(user_id);
});
});
function submitForm(user_id,reseller_role){
console.log(user_id);
var add_method=document.getElementById("add_method").value;
var add_balance=document.getElementById("add_balance").value;
var add_amount=document.getElementById("add_amount").value;
// console.log(add_balance);
// console.log(add_amount);
var reseler_balance=document.getElementById("reseler_balance").value;
if (add_balance==="" || add_balance==0) {
// $("#err_balance").value="Please give som Balance...."
// alert("Please give some Balance....");
$("#err_balance").show();
}
else if(add_balance>reseler_balance)
{
if (reseller_role!=="Admin") {
$("#low_balance").show();
}
else{
if (add_amount==="") {
add_amount="0";
console.log(add_method);
}
$.ajax({
type: "get",
url: "<?php echo e(url('Alluser')); ?>/"+user_id+"/"+add_balance+"/"+add_amount+"/"+add_method,
cache:false,
success: function(response){
console.log(response);
document.getElementById("balanceForm").reset();
$("#balance").html(response)
$("#balance-modal").modal('hide');
location.reload();
},
error: function(){
alert("Error");
}
});
}
}
}
}
// console.log($("#btn_balance"));
</script>
<?php echo $__env->make('layouts.app', ['title' => __('Add User')], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\reseller\resources\views/users/index.blade.php ENDPATH**/ ?>
|