Anons79 Mini Shell

Directory : /home/proudlyafrican/public_html/resources/views/admin/orders/
Upload File :
Current File : /home/proudlyafrican/public_html/resources/views/admin/orders/list.blade.php

@extends('admin.head')
@section('middle')
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<section class="content">
    @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: {{ Session::get('msg') }} </p>
    </div>
    <br>
    @endif

    @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: {{ Session::get('msg2') }} </p>
    </div>
    <br>
    @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">&times;</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="{{ 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; ?>
                        @foreach($orders as $order)
                        <tr>
                            <td style="width: 5%">{{ $count }}</td>
                            <td style="font-weight: bold;color: #0000ff; width: 5%">{{ $order->invoice_number}}</td>
                            <td style="width: 5%" >{{ $order->first_name }}</td>

                            <td style="width: 5%">{{ $order->email }}</td>
                            <td style="width: 5%">
                                @if($order->type=='user')
                                <span style="color: #008000; font-weight: bold">{{ $order->type }}</span>
                                @else
                                <span style="color:#0000ff; font-weight: bold">{{ $order->type }}</span>
                                @endif
                            </td>
                            <td style="width: 30%;">
                                {{ $order->address1}},{{ $order->address2}},{{ $order->country_name }}
                            </td>
                            <td>£<?php echo  number_format((float)$order->subtotal, 2, '.', ''); ?></td>
                            <td>£{{ $order->shipping_charge }}</td>
                            <td>£{{ $order->tax_amount }}</td>
                            <td>
                               <?php $discount=  number_format((float)$order->discount, 2, '.', ''); ?>
                                <span style="color: red; font-weight: bold">£{{$discount}}</span>
                            </td>
                            <td><span style="color: red; font-weight: bold">£</span> <span style="color: red; font-weight: bold;" id="refunded_amount_span{{ $order->order_id }}"><?php echo  number_format((float)$order->refunded_amount, 2, '.', ''); ?></span></td>
                            <td>£<span id="grandtotal_span{{ $order->order_id }}"><?php echo  number_format((float)$order->grandtotal, 2, '.', ''); ?></span></td>
                            <td style="width: 40% !important;">

                                <a  style="margin: 5px;" href="{{ url('view_order_detail') }}/{{ $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({{ $order->order_id }})"><i class="glyphicon glyphicon-refresh"></i> </a>
                               </td>


                        </tr>
                        <?php $count=$count+1; ?>
                        @endforeach
                        </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: "{{ url('order_refund_form') }}",
            type: 'post',
            data: {"order_id":$('#refund_order_id').val(), "_token": "{{ 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>
@endsection

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]