<?php $__env->startSection('middle'); ?>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<section class="content">
<?php if(Session::has('msg')): ?>
<div class="alert alert-success" id="success-alert">
<button type="button" class="close" data-dismiss="alert">x</button>
<p align="center" style="font-weight: bold; font-size: 13px; color: white"> Success: <?php echo e(Session::get('msg')); ?> </p>
</div>
<br>
<?php endif; ?>
<?php if(Session::has('msg2')): ?>
<div class="alert alert-danger" id="success-alert">
<button type="button" class="close" data-dismiss="alert">x</button>
<p align="center" style="font-weight: bold; font-size: 13px; color: white"> Success: <?php echo e(Session::get('msg2')); ?> </p>
</div>
<br>
<?php endif; ?>
<div class="print-modal modal fade" id="modal_refund" role="dialog" data-keyboard="false" data-backdrop="static">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title" id="modal_one_title">Enter Refund Amount</h4>
</div>
<div class="modal-body" id="modal_refund_content_goes_here">
<form action="<?php echo e(url('order_refund_form')); ?>" method="POST" id="form_refund">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
<input type="hidden" name="order_id" id="refund_order_id" value="">
<div class="form-group">
<input oninput="return NumAndTwoDecimals(event,this)" onkeydown="return NumAndTwoDecimals(event,this)" type="number" name="amount" id="amount" class="field" step="any" placeholder="(gbp) Enter Amount" required autofocus="">
<span class="text-danger"> <nobr>Note: Charges are not refunded if a refund is made.</nobr></span>
</div>
<button type="submit" class="btn btn-success btn-sm" id="payBtn">Refund</button>
</form>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">Orders List</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>SR #</th>
<th>Invoice #</th>
<th>First Name</th>
<th>Email</th>
<th>Type</th>
<th style="width: 30%">Address</th>
<th>Total</th>
<th>Shipping<br>Charges</th>
<th>Tax<br>Amount</th>
<th>Coupen/<br>Discount</th>
<th>Refunded/<br>Amount</th>
<th>Grand Total</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $count=1; ?>
<?php $__currentLoopData = $orders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td style="width: 5%"><?php echo e($count); ?></td>
<td style="font-weight: bold;color: #0000ff; width: 5%"><?php echo e($order->invoice_number); ?></td>
<td style="width: 5%" ><?php echo e($order->first_name); ?></td>
<td style="width: 5%"><?php echo e($order->email); ?></td>
<td style="width: 5%">
<?php if($order->type=='user'): ?>
<span style="color: #008000; font-weight: bold"><?php echo e($order->type); ?></span>
<?php else: ?>
<span style="color:#0000ff; font-weight: bold"><?php echo e($order->type); ?></span>
<?php endif; ?>
</td>
<td style="width: 30%;">
<?php echo e($order->address1); ?>,<?php echo e($order->address2); ?>,<?php echo e($order->country_name); ?>
</td>
<td>£<?php echo number_format((float)$order->subtotal, 2, '.', ''); ?></td>
<td>£<?php echo e($order->shipping_charge); ?></td>
<td>£<?php echo e($order->tax_amount); ?></td>
<td>
<?php $discount= number_format((float)$order->discount, 2, '.', ''); ?>
<span style="color: red; font-weight: bold">£<?php echo e($discount); ?></span>
</td>
<td><span style="color: red; font-weight: bold">£</span> <span style="color: red; font-weight: bold;" id="refunded_amount_span<?php echo e($order->order_id); ?>"><?php echo number_format((float)$order->refunded_amount, 2, '.', ''); ?></span></td>
<td>£<span id="grandtotal_span<?php echo e($order->order_id); ?>"><?php echo number_format((float)$order->grandtotal, 2, '.', ''); ?></span></td>
<td style="width: 40% !important;">
<a style="margin: 5px;" href="<?php echo e(url('view_order_detail')); ?>/<?php echo e($order->order_id); ?>" class="btn btn-primary"><i class="glyphicon glyphicon-eye-open"></i></a>
<a class="btn btn-primary" title="Refund" class="" onClick="refund(<?php echo e($order->order_id); ?>)"><i class="glyphicon glyphicon-refresh"></i> </a>
</td>
</tr>
<?php $count=$count+1; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
$('#khan').click();
});
function refund(order_id)
{
$("#refund_order_id").val(order_id);
// $(".refund_error").remove();
$("#amount").val("");
$('#modal_refund').modal('show');
}
</script>
<script>
$("#form_refund").on("submit",function(e){
e.preventDefault();
var order_id=$("#refund_order_id").val();
if($("#amount").val()<=0)
{
$("#payBtn").after('<br><span class="text-danger refund_error"> Amount must be greater than 0.</span>');
return false;
}
$.ajax({
url: "<?php echo e(url('order_refund_form')); ?>",
type: 'post',
data: {"order_id":$('#refund_order_id').val(), "_token": "<?php echo e(csrf_token()); ?>","amount":$('#amount').val()},
success: function(data){
console.log(data);
obj = $.parseJSON(data);
if(obj.refund_status==true)
{
$('#modal_refund').modal('hide');
$("#refunded_amount_span"+order_id).html(obj.refunded_amount);
$("#grandtotal_span"+order_id).html(obj.net_amount);
swal("Done","Amount Refunded successfully.");
}
else
{
$('#modal_refund').modal('hide');
swal("Sorry!","Something went wrong.Please try again.",'warning');
}
},
error:function (data) {
// alert(" :s"+data);
}
});
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.head', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]