Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mcoil.corals.io/storage/framework/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mcoil.corals.io/storage/framework/views/12976a59b222745e51a204c07a9583d1.php
<?php $__env->startSection('css'); ?>
<link href="<?php echo e(asset('css/sweetalert2.min.css')); ?>" rel="stylesheet" type="text/css" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker.css" rel="stylesheet" type="text/css" />
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<div class="row">
    <div class="col-md-12">
        <section class="content">
        <?php echo $__env->make('layouts.errors-and-messages', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
            <div class="box">
                <div class="box-body">
                    <div class="col-md-12">
                        <h3 class="bold">Customers Details</h3>    
                        <div class="jumbotron">
                            <div class="row">
                                <div class="col-md-4 col-xs-12 col-sm-6 col-lg-4">
                                    <div class="col-md-12 initialsadded">
                                        <div class="kt-widget__media">
                                            <span class="kt-badge kt-badge--username kt-badge--unified-success kt-badge--lg kt-badge--rounded kt-badge--bold"><?php if(!empty($customer->fname)): ?><?php echo e(strtoupper($customer->fname[0].$customer->lname[0])); ?><?php endif; ?></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-5 col-xs-12 col-sm-6 col-lg-5">
                                    <div class="container" style="border-bottom:1px solid #ccc">
                                        <h2><a href="<?php echo e(route('admin.customers.show', $customer->id)); ?>"><?php echo e($customer->name); ?></a></h2>
                                    </div>
                                    <ul class="container details">
                                        <li><p><span class="fa fa-phone one" style="width:50px;"></span><?php if($customer->phone): ?><?php echo e($customer->phone); ?><?php elseif($orderAddress->phone): ?><?php echo e($orderAddress->phone); ?><?php else: ?><?php echo e(('n/a')); ?><?php endif; ?></p></li>
                                        <li><p><span class="fa fa-envelope one" style="width:50px;"></span><?php echo e($customer->email); ?></p></li>
                                        <li><p><span class="fa fa-calendar one" style="width:50px;"></span>Order Date: <?php echo e(date('d/m/Y @ h:i a', strtotime($order['created_at']))); ?></p></li>
                                        <?php if($order): ?> <?php if( $order->oil_type_order == 1 ): ?>
                                        <li><p><span class="fa fa-truck one" style="width:50px;"></span>Delivery Date: <span class="delivery-date-update"><?php echo e($delivery_date); ?></span></p></li>
                                        <li><p><span class="fa fa-user one" style="width:50px;"></span>Driver: <?php echo e($driver->name ?? 'n/a'); ?></p></li>
                                        <?php endif; ?> <?php endif; ?>
                                        <li><p><span class="fa fa-bell one" style="width:50px;"></span>Payment Status: <span class="badge font-badge <?php if($currentStatus->name == 'paid'): ?> badge-success <?php elseif($currentStatus->name == 'pending'): ?> badge-warning <?php elseif($currentStatus->name == 'awaiting payment'): ?> badge-awaiting <?php elseif($currentStatus->name == 'error'): ?> badge-danger <?php else: ?> <?php endif; ?>"><?php echo e($currentStatus->name); ?></span></p></li>
                                        <li><p><span class="fa fa-eur one" style="width:50px;"></span>Payment Type: <span class="badge font-badge"><?php echo e($order->payment_option); ?></span></p></li>
                                        <li><p><span class="fa fa-bell one" style="width:50px;"></span>Order Status: <span class="badge font-badge <?php if($order->order_status == '1'): ?> badge-success <?php else: ?> badge-warning <?php endif; ?>"><?php echo e(($order->order_status == '1')? 'Delivered' : 'Pending'); ?></span></span></p></li>
                                    </ul>
                                </div>
                                <div class="col-md-3 col-xs-12 col-sm-12 col-lg-3">
                                    <div class="container margin-top-30">
                                        <div class="btn-margin-top"><button type="button" class="btn btn-primary btn-block btn-with-icon" data-toggle="modal" data-target="#payNowModal" <?php echo e(($currentStatus->name == 'awaiting payment' && $order->payment_option == 'Credit Card') ? '': 'disabled'); ?>><i class="fa fa-credit-card"></i> Pay Now</button>
                                        <div class="btn-margin-top"><button class="btn btn-warning btn-with-icon btn-block" id="btn_change_delivery_date_modal"><i class="fa fa-calendar"></i> Change Delivery Date</button></div>
                                        <?php if( $order->oil_type_order == 1 ): ?>
                                        <div class="btn-margin-top">
                                            <?php if($order->driver_id): ?>
                                                <button class="btn btn-purple btn-with-icon btn-block unassign-driver" data-id="<?php echo e($order->id); ?>"><i class="fa fa-user"></i> Unassign Driver</button>
                                            <?php else: ?>
                                                <button class="btn btn-purple btn-with-icon btn-block" id="btn_show_assign_driver_modal"><i class="fa fa-user"></i> Assign Driver</button>
                                            <?php endif; ?>
                                        </div>
                                        <?php endif; ?>
                                        <div class="btn-margin-top"><a href="<?php echo e(route('admin.orders.invoice.generate', $order['id'])); ?>" target="_blank" class="btn btn-dark btn-block btn-with-icon"><i class="fa fa-download"></i> Download Invoice</a></div>
                                        <div class="btn-margin-top"><a href="javascript:void(0);" id="btn_show_invoice" class="btn btn-success btn-block btn-with-icon"><i class="fa fa-eye"></i> View Invoice</a></div>
                                        <?php if($user->hasPermission('update-order')): ?>
                                        <div class="btn-margin-top">
                        	                <form action="<?php echo e(route('admin.order.destroy', [$order->id])); ?>"  id="remove-from-form" class="form-horizontal">
                        	                    <input type="hidden" name="id" value="<?php echo e($order->id); ?>">
                        	                    <?php echo e(csrf_field()); ?>

                        	                    <input type="hidden" name="_method" value="delete">
                        	                    <button id="<?php echo e($order->id); ?>" type="submit" title="Delete" class="btn btn-danger btn-block delete_submit btn-with-icon" <?php echo e(( $currentStatus->name == 'pending' || $currentStatus->name == 'awaiting payment' ) ? '': 'disabled'); ?>><i class="fa fa-trash"></i> Delete Order</button>
                        	            	</form>
                                        </div>
                                        <?php else: ?>
                                        <div class="btn-margin-top">
                        	                <form action="<?php echo e(route('admin.order.destroy', [$order->id])); ?>" method="post" id="remove-from-form" class="form-horizontal">
                        	                    <input type="hidden" name="id" value="<?php echo e($order->id); ?>">
                        	                    <?php echo e(csrf_field()); ?>

                        	                    <input type="hidden" name="_method" value="delete">
                        	                    <button id="<?php echo e($order->id); ?>" type="submit" title="Delete" class="btn btn-danger btn-block delete_submit btn-with-icon" <?php echo e(( $currentStatus->name == 'pending' || $currentStatus->name == 'awaiting payment' ) ? '': 'disabled'); ?>><i class="fa fa-trash"></i> Delete Order</button>
                        	            	</form>
                                        </div>
                                        <?php endif; ?>
                                        <div class="btn-margin-top">
                                            <div class="form-group">
                    	                       	<select name="order_status" id="order_status" class="form-control custom-select input-lg">
                    	                    		<?php if( $orderStatuses ): ?>
                    									<?php $__currentLoopData = $orderStatuses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $orderStatus): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    										<option value="<?php echo e($orderStatus->id); ?>" <?php echo e(( $currentStatus->name == $orderStatus->name ) ? 'selected': ''); ?>><?php echo e(ucwords($orderStatus->name)); ?></option>
                    									<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            		<?php endif; ?>
                	                        	</select>
                    	                       	<select name="payment_option" id="payment_option" class="form-control custom-select input-lg btn-margin-top" <?php echo e(( $currentStatus->name == 'paid' ) ? 'disabled': ''); ?>>
                    	                       		<option value="Cash" <?php echo e(( $order->payment_option == 'Cash' ) ? 'selected': ''); ?>>Cash</option>
                    	                       		<option value="Cheque" <?php echo e(( $order->payment_option == 'Cheque' ) ? 'selected': ''); ?>>Cheque</option>
                    	                       		<option value="Credit Account" <?php echo e(( $order->payment_option == 'Credit Account' ) ? 'selected': ''); ?>>Credit Account</option>
                    	                       		<option value="Credit Card" <?php echo e(( $order->payment_option == 'Credit Card' ) ? 'selected': ''); ?>>Credit Card</option>
                    	                       	</select>

                                                <select name="o_status" id="o_status" class="form-control custom-select input-lg btn-margin-top">
                                                    <option value="0" <?php echo e(( $order->order_status == '0' ) ? 'selected': ''); ?>>Pending</option>
                                                    <option value="1" <?php echo e(( $order->order_status == '1' ) ? 'selected': ''); ?>>Delivered</option>
                                                </select>
                                        	</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        <section class="content">    
            <div class="box">
                <div class="box-body">
                    <div class="col-md-12">
                        <h3 class="bold">Order <span class="font-black">#<?php echo e($order->id); ?></span> <?php if( $order->oil_type_order == '0' ): ?><span class="font-black">|</span> <button class="btn btn-dark" id="btn_add_order_product">+ Add Product</button><?php endif; ?></h3>
                        <h4 class="bold order-ref font-black"><div class="delivery-address">Reference Number: <?php echo e($order->reference); ?></div></h4>
                         <?php if(!empty($order->delivery_note)): ?>
                        <div class="alert alert-primary" role="alert">
                            <h4 class="alert-heading">Customer Notes <a href="javascript:void(0);" class="margin-left-10 edit_customer_notes" title="Edit"><i class="fa fa-pencil font-red"></i></a></h4>
                            <span id="delivery_notes_text"><?php echo e($order->delivery_note); ?></span>
                        </div>
                        <?php else: ?>
                            <button class="btn btn-dark btn-with-icon edit_customer_notes" ><i class="fa fa-file"></i> Add Customer Notes</button>
                        <?php endif; ?>
                        <table class="table table-striped table-hover table-checkable dataTable table-responsive table-responsive-md responsive" id="order_table">
                            <thead class="thead-dark">
                                <th scope="col" class="all">SKU</th>
                                <th scope="col" class="min-mobile-l">Product</th>
                                <th scope="col" class="min-mobile-l">Quantity</th>
                                <th scope="col" class="min-mobile-l"></th>
                                <th scope="col" class="min-mobile-l">Price</th>
                            </thead>
                            <tbody class="tbl_orders">
                            	<?php $initialProductId = ''; $initialProductQty = ''; $itemCount = 1; ?>
                                <?php if(!$items->isEmpty()): ?>
                                <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td class="dtr-control container_order_product_sku"><?php echo e($item->sku); ?></td>
                                    <td>
                                    	<div class="container_order_product_name" id="<?php echo e($item->id); ?>"><?php echo e($item->name); ?></div>
                                    	<div class="container_order_product_list" style="display: none;">
                                    		<select name="order_product" id="order_product" class="form-control custom-select" style="width: 200px;">
                                    			<option value="">Select</option>
                                    			<?php if($order->oil_type_order == '1'): ?>
	                                    			<?php if($products): ?>
	                                    				<?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
	                                    					<option value="<?php echo e($product->id); ?>" <?php echo e(( $item->id == $product->id ) ? 'selected': ''); ?>><?php echo e($product->name); ?></option>
	                                    				<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
	                                    			<?php endif; ?>
	                                    		<?php else: ?>
	                                    			<?php if($products): ?>
	                                    				<?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
	                                    					<option value="<?php echo e($product->id); ?>" <?php if($product->quantity <= 0): ?> disabled="disabled" <?php endif; ?> <?php echo e(( $item->id == $product->id ) ? 'selected': ''); ?>><?php echo e($product->name); ?></option>
	                                    				<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
	                                    			<?php endif; ?>
                                    			<?php endif; ?>
                                    		</select>
                                    	</div>
                                    </td>
                                    <td>
                                    		<div class="container_order_product_qty">
                                    	    <?php if($order->oil_type_order == '1'): ?>
                                    	        <?php if($order->fill_the_tank_status == '1' ): ?>
                                    	            <?php if($order->fill_the_tank_quantity != '' || $order->fill_the_tank_quantity > 0): ?>
                                    	            <?php echo e($order->fill_the_tank_quantity); ?> 
                                    	            <?php else: ?>
                                    	            <?php echo e(('Fill the Tank')); ?> 
                                    	            <?php endif; ?>
                                    	       <?php else: ?> 
                                    	        <?php echo e($item->pivot->quantity); ?> 
                                    	       <?php endif; ?>
                                    	
                                    	    <?php else: ?> 
                                    	        <?php echo e($item->pivot->quantity); ?> 
                                    	    <?php endif; ?></div>
                                    	<div class="container_order_product_qty_list" style="display: none;">
                                    		<?php if($order->oil_type_order == '1'): ?>
										          <input type="text" name="fill_the_tank_quantity" id="order_product_qty" value="<?php echo e($order->fill_the_tank_quantity); ?>" class="form-control input-lg" style="font-size: 13px;" />
											<?php else: ?>
                                            <select name="order_product_qty" id="order_product_qty" class="form-control custom-select" style="width: 200px;">
                                                <option value="">Select</option>
                                    			<?php for($qty = 1; $qty <= 10; $qty++): ?>
													<option value="<?php echo e($qty); ?>" data-qty="<?php echo e($qty); ?>" <?php echo e(($item->pivot->quantity == $qty) ? 'selected' : ''); ?>><?php echo e($qty); ?></option>
                                    			<?php endfor; ?>
                                    		</select>
                                    		<?php endif; ?>
                                    	</div>
                                    </td>
                                    <td></td>
                                    <td>
                                    	<?php echo e(config('cart.currency_symbol')); ?><span class="container_product_price" id="display_price"><?php if($order->oil_type_order == '1'): ?><?php echo e(number_format(($item->price), 2)); ?><?php else: ?><?php echo e(number_format(($item->price * $item->pivot->quantity), 2)); ?><?php endif; ?></span>
                                    	<span class="container_product_price" id="price_display" style="display: none;">
                                    	    <?php if($order->oil_type_order == '1'): ?>
                                    	        <input type="text" name="item_price" value="<?php echo e(number_format(($item->price), 2)); ?>" id="item_price" class="form-control input-lg" style="font-size: 13px; width:80px">
                                    	   <?php else: ?>
                                    	        <input type="text" name="item_price" value="<?php echo e(number_format(($item->price * $item->pivot->quantity), 2)); ?>" id="item_price" class="form-control input-lg" style="font-size: 13px; width:80px">
                                    	   <?php endif; ?>    
                                    	</span>
                                    	<?php if( $currentStatus->name == 'pending' || $currentStatus->name == 'awaiting payment' ): ?>
                                    	<span class="container_action_edit_order">
                                    		<a href="javascript:void(0);" class="margin-left-10 edit_order_product" title="Edit"><i class="fa fa-pencil"></i></a> 
                                    		
                                    		<?php if( $order->oil_type_order == 0 ): ?>
	                                    		<a href="javascript:void(0);" data-product="<?php echo e($item->id); ?>" class="margin-left-10 delete_order_product" style="display: <?php echo e(($itemCount == 1) ? 'none': ''); ?>" title="Delete"><i class="fa fa-trash"></i></a>
                                    		<?php endif; ?>
                                    	</span>
                                    	<span class="container_action_update_order" style="display: none;">
                                    		<a href="javascript:void(0);" data-product="<?php echo e($item->id); ?>" data-product-qty="<?php echo e($item->pivot->quantity); ?>" class="margin-left-10 update_order" title="Save"><i class="fa fa-save"></i></a> 
                                    		<a href="javascript:void(0);" class="margin-left-10 cancel_update_order" title="Cancel"><i class="fa fa-times"></i></a>
                                    	</span>
                                    	<?php endif; ?>
                                    </td>
                                </tr>
                                <?php $itemCount++; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <?php $initialProductId = $item->id; $initialProductQty = $item->pivot->quantity; ?>
                                <?php endif; ?>
                            </tbody>
							<?php if($order->oil_type_order == 0): ?>
							<tbody class="tbl_add_order_product" style="display: none;">
								
								<tr class="tbl_row_add_order_product">
									<td></td>
									<td>
										<select name="new_order_product" id="new_order_product" class="form-control custom-select" style="width: 200px;">
											<?php if($products): ?>
												<?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
													<option value="<?php echo e($product->id); ?>"><?php echo e($product->name); ?></option>
												<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
											<?php endif; ?>
										</select>
									</td>
									<td>
                                        <select name="new_order_product_qty" id="new_order_product_qty" class="form-control custom-select" style="width: 200px;">
                                			<?php for( $qty=1; $qty<=10; $qty++ ): ?>
												<option value="<?php echo e($qty); ?>"><?php echo e($qty); ?></option>
                                			<?php endfor; ?>
                                		</select>
									</td>
									<td>&nbsp;</td>
									<td>
										<span class="container_add_order_product">
											<a href="javascript:void(0);" class="margin-left-10 add_order_product" title="Save"><i class="fa fa-save"></i></a> 
											<a href="javascript:void(0);" class="margin-left-10 cancel_add_order_product" title="Cancel"><i class="fa fa-times"></i></a>
										</span>
									</td>
								</tr>
							</tbody>
							<?php endif; ?>
                            <tbody>
                                <tr>
                                    <td class="border-top-tot bg-white"></td>
                                    <td class="border-top-tot bg-white"></td>
                                    <td class="border-top-tot bg-white"></td>
                                    <td class="text-bold border-top-tot border-left-tot">Subtotal</td>
                                    <td class="text-bold border-top-tot">
                                    	<?php echo e(config('cart.currency_symbol')); ?><span id="holder_subtotal"><?php echo e($order['total_products']); ?></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="bg-white border-top-totw"></td>
                                    <td class="bg-white border-top-totw"></td>
                                    <td class="bg-white border-top-totw"></td>
                                    <td class="text-bold border-left-tot">Vat</td>
                                    <td class="text-bold">
                                    	<?php echo e(config('cart.currency_symbol')); ?><span id="holder_vat"><?php echo e($order['tax']); ?></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="bg-white border-top-totw"></td>
                                    <td class="bg-white border-top-totw"></td>
                                    <td class="bg-white border-top-totw"></td>
                                    <td class="text-bold border-left-tot container_label_update_discount">Discount</td>
                                    <td class="text-bold">
                                    	<span class="container_discount_value">
                                    		<?php echo e(config('cart.currency_symbol')); ?><span id="holder_discount"><?php echo e($order['discounts']); ?>

                                    		<input type="hidden" name="discount_value" id="discount_value" value="<?php echo e($order['discounts']); ?>">
                                    		</span>
                                    	</span>
                                    	<span class="container_discount_list" style="display: none;">
                                    		<select name="order_discount" id="order_discount" class="form-control custom-select" style="width: 100px;">
                                    			<option value="0">Select</option>
                                    			<?php if( $discountCoupons ): ?>
                                    				<?php $__currentLoopData = $discountCoupons; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $discountCoupon): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    					<option value="<?php echo e($discountCoupon->id); ?>" <?php echo e(( $order['discount_coupon_code'] == $discountCoupon->coupon_code ) ? 'selected': ''); ?> <?php echo e(in_array($discountCoupon->coupon_code, $appliedDiscounts) ? 'disabled': ''); ?>><?php echo e($discountCoupon->coupon_code); ?></option>
                                    				<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    			<?php endif; ?>
                                    		</select>
                                    	</span>
                                    	<?php if( $currentStatus->name == 'pending' || $currentStatus->name == 'awaiting payment' ): ?>
                                    	<span class="container_action_edit_discount">
	                                    	<a href="javascript:void(0);" class="margin-left-10 edit_order_discount" title="Edit"><i class="fa fa-pencil"></i></a>
	                                    </span>
                                    	<span class="container_action_update_discount" style="display: none;">
                                    		<a href="javascript:void(0);" class="margin-left-10 update_discount" title="Save"><i class="fa fa-save"></i></a> 
                                    		<a href="javascript:void(0);" class="margin-left-10 cancel_update_discount" title="Cancel"><i class="fa fa-times"></i></a>
                                    	</span>
                                    	<?php endif; ?>
                                    </td>
                                </tr>
                            	<tr>
                                    <td class="bg-white border-top-totw"></td>
                                    <td class="bg-white border-top-totw"></td>
                                    <td class="bg-white border-top-totw"></td>
                                    <td class="text-bold border-top-tot border-left-tot">GRAND TOTAL</td>
                                    <td class="text-bold border-top-tot">
                                    	<?php echo e(config('cart.currency_symbol')); ?><span id="holder_grand_total"><?php echo e($order['total_paid']); ?></span>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </section>
    </div>
</div>
<?php if($order): ?>
<div class="row">
    <div class="col-md-12">
        <section class="content">
            <div class="box">
                <div class="box-body">
                    <div class="col-md-12">
                        <h3 class="bold">Delivery Address</h3>
                        <?php if( $order->oil_type_order == 1 ): ?>
                        <h4 class="bold driver-date font-black">
                            <div class="delivery-address">
                                <form action="<?php echo e(route('admin.order.sendEmail', [$order->id])); ?>"  id="email-form" class="form-horizontal">
                                    <span style="display: <?php echo e(($order->is_email_sent_customer == 1) ? 'inline-block' : 'none'); ?>" class="badge font-badge badge-success" id="badge-email"><i class="fa fa-check"></i>  Email Sent</span>
                                
                                    <input type="hidden" name="id" value="<?php echo e($order->id); ?>">
                                    <?php echo e(csrf_field()); ?>

                                    <button data-id="<?php echo e($order->id); ?>" class="btn btn-dark btn-with-icon btn-send-email"><i class="fa fa-envelope"></i> Email Delivery Details to Customer</button>
                                </form>
                            </div>
                        </h4>
                        <?php endif; ?>
                        <table class="table table-striped table-hover table-checkable dataTable table-responsive table-responsive-md responsive" id="addresses_table">
                            <thead class="thead-dark">
                                <th scope="col" class="all">Address</th>
                                <th scope="col" class="min-tablet-l">Town</th>
                                <th scope="col" class="min-mobile-l">County</th>
                                <th scope="col" class="min-mobile-l">Eircode</th>
                                <th scope="col" class="min-tablet-l">Phone</th>
                            </thead>
                            <tbody>
                            <tr>
                                <td class="dtr-control">
                                	<?php echo e($orderAddress->address_1 ?? ''); ?> <?php echo e(isset( $orderAddress->address_2 ) ? ', ' . $orderAddress->address_2: ''); ?>

                                </td>
                                <td><?php echo e($orderAddress->town ?? ''); ?></td>
                                <td><?php echo e($orderAddress->county ?? ''); ?></td>
                                <td><?php echo e($orderAddress->zip ?? ''); ?></td>
                                <td><?php echo e($orderAddress->phone ?? ''); ?></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </section>
    </div>
</div>
<?php endif; ?>
<?php if($currentStatus->name == 'awaiting payment' && $order->payment_option == 'Credit Card'): ?>
<div id="payNowModal" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title"></h4>
            </div>
            <div class="modal-body">
       	        <div class="form-group">
       	            <div id="errorDiv" style="display:none;">
                            <p class="alert alert-error alert-dismissible" id="errorMessage">
                                Error
                            </p>
                        </div>
       	            <form id="frmStripePayment" action="<?php echo e(route('admin.order.payment')); ?>" method="post">
       	                <input type="hidden" value="<?php echo e(base64_encode($order->id)); ?>" name="order_id">
       	                <div id="cardpayment" class="card_payment_type">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="name">Card Holder Name <span class="text-danger">*</span></label>
                                        <input type="text" id="name" name="name" class="form-control input-lg" data-card-details="cardholder-name" />
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="email">Email Address <span class="text-danger">*</span></label>
                                        <input type="text" id="email" name="email" class="form-control input-lg" readonly value="<?php echo e($customer->email); ?>" />
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label for="card-number">Card Number <span class="text-danger">*</span></label>
                                        <input type="text" id="card-number" name="card-number" class="form-control input-lg" data-card-details="card-number" />
                                       
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="month">Expiry Month / Year <span class="text-danger">*</span></label>
                                        <div class="row">
                                            <div class="col-md-6">
                                                <select name="month" id="month" class="form-control custom-select input-lg">
                                                    <option value="01">01</option>
                                                    <option value="02">02</option>
                                                    <option value="03">03</option>
                                                    <option value="04">04</option>
                                                    <option value="05">05</option>
                                                    <option value="06">06</option>
                                                    <option value="07">07</option>
                                                    <option value="08">08</option>
                                                    <option value="09">09</option>
                                                    <option value="10">10</option>
                                                    <option value="11">11</option>
                                                    <option value="12">12</option>
                                                </select>
                                            </div>
                                            <div class="col-md-6">
                                                <select name="year" id="year" class="form-control custom-select input-lg">
                                                    <option value="20">2020</option>
                                                    <option value="21">2021</option>
                                                    <option value="22">2022</option>
                                                    <option value="23">2023</option>
                                                    <option value="24">2024</option>
                                                    <option value="25">2025</option>
                                                    <option value="26">2026</option>
                                                    <option value="27">2027</option>
                                                    <option value="28">2028</option>
                                                    <option value="29">2029</option>
                                                    <option value="30">2030</option>
                                                    <option value="31">2031</option>
                                                    <option value="32">2032</option>
                                                    <option value="33">2033</option>
                                                    <option value="34">2034</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="cvc">CVC <span class="text-danger">*</span></label>
                                        <input type="text" name="cvc" id="cvc" class="form-control input-lg cvv-input" data-card-details="security-code">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12">
                                    <img class="img-fluid m-1" src="<?php echo e(URL::asset('/images/opayo.png')); ?>" alt="Opayo Secure Payment" />
                                </div>
                            </div>
                        </div>
                        <input type='hidden' name='currency_code' value='EUR'>
                        <?php echo e(csrf_field()); ?>

                        <input type="submit" name="pay_now" value="Pay Now" id="submit-btn card_pay_Now" class="btn btn-lg btn-block btn-send" onClick="stripePay(event);" id="card_pay_Now" />
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<?php endif; ?>
<div id="modal_assign_driver" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h3 class="modal-title bold">Assign a Driver</h3>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-12">
                        <p>Please choose a driver that you want assigned to this order.</p>
                    </div>
                    <div class="col-md-12">
                        <select name="driver_list" id="driver_list" class="form-control custom-select input-lg">
                            <option value="">Select Driver</option>
                        </select>
                    </div>
                    <div class="col-md-6 btn-margin-top"><br>
                        <button type="submit" class="btn btn-lg btn-block btn-success" id="btn_assign_driver">Assign Driver</button>
                    </div>
                    <div class="col-md-6 btn-margin-top"><br>
                        <a href="javascript:void(0);" data-dismiss="modal" class="btn btn-lg btn-block btn-send " data-value="no">Back</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="modal_change_ddate" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h3 class="modal-title bold">Change Delivery Date</h3>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-12">
                        <p>Please choose a new delivery date that you want assigned to this order.</p>
                    </div>
                    <div class="col-md-12">
                        <?php 
                        /*$created_date = strtotime($order->delivery_date);
                        $day = date('D', $created_date);
                        if ($day == 'Sat' || $day == 'Fri' || $day == 'Sun') {
                            $delivery_date =  date('Y-m-d', strtotime('next monday', strtotime($order->delivery_date)));
                        } else {
                            $delivery_date = date('Y-m-d', strtotime($order->delivery_date));
                        }*/
                        $delivery_date = date('d-m-Y', strtotime($order->delivery_date));
                        ?>
                        <input type="text" name="delivery_date" id="delivery_date" class="form-control input-lg">
                    </div>
                    <div class="col-md-6 btn-margin-top"><br>
                        <button type="submit" class="btn btn-lg btn-block btn-success" id="btn_update_delivery_date">Change Date</button>
                    </div>
                    <div class="col-md-6 btn-margin-top"><br>
                        <a href="javascript:void(0);" data-dismiss="modal" class="btn btn-lg btn-block btn-send " data-value="no">Back</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="modal_show_invoice" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="MyOrders">
    <div class="modal-dialog invoice-modal" role="document">
        <div class="modal-content">
            <div class="modal-header toolbar hidden-print">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            </div>
    		<div class="modal-body table-responsive-md" id="modal_body_show_invoice"></div>
    	</div>
	</div>
</div>
<div id="cutomer_note_modal_box" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h3 class="modal-title bold">Update Customer Note</h3>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-12">
                        <p>Please edit the customer note below.</p>
                    </div>
                    <div class="col-md-12">
                        <textarea id="disp_customer_note" class="form-control input-lg" name="customer_notes"><?php echo e($order->delivery_note); ?></textarea>
                    </div>
                    <div class="col-md-6 btn-margin-top"><br>
                        <button type="submit" class="btn btn-lg btn-block btn-success" id="btn_update_customer_note">Change Notes</button>
                    </div>
                    <div class="col-md-6 btn-margin-top"><br>
                        <a href="javascript:void(0);" data-dismiss="modal" class="btn btn-lg btn-block btn-send " data-value="no">Back</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
<script src="<?php echo e(asset('js/sweetalert2.all.min.js')); ?>"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script>
<script src="<?php echo e(config('constants.evalon_url')); ?>/api/v1/js/sagepay.js"></script>

<script type="text/javascript">
function cardValidation () {
    var valid = true;
    var name = $('#name').val();
    var cardNumber = $('#card-number').val();
    var month = $('#month').val();
    var year = $('#year').val();
    var cvc = $('#cvc').val();
    $("#error-message").html("").hide();
    if (name.trim() == "") {
        valid = false;
    }
    if (cardNumber.trim() == "") {
       valid = false;
    }
    if (month.trim() == "") {
        valid = false;
    }
    if (year.trim() == "") {
        valid = false;
    }
    if (cvc.trim() == "") {
        valid = false;
    }
    if (valid == false) {
        $("#error-message").html("All Fields are required").show();
    }
    return valid;
}


function stripePay(e) {
        e.preventDefault();
        var valid = cardValidation();
        if (valid == true) {
            var month = $('#month').val();
            var year = $('#year').val();
            $("#submit-btn").hide();
            $( "#loader" ).css("display", "inline-block");
            var merchant_key = "<?php echo $merchantSessionKey; ?>";
            sagepayOwnForm({ 
            merchantSessionKey: "<?php echo $merchantSessionKey; ?>" })
             .tokeniseCardDetails({
                cardDetails: { 
                            cardholderName: document.querySelector('[data-card-details="cardholder-name"]').value, 
                            cardNumber: document.querySelector('[data-card-details="card-number"]').value,
                            expiryDate: month.trim()+year.trim(), 
                            securityCode: document.querySelector('[data-card-details="security-code"]').value },
                            onTokenised : function(result) { 
                                if (result.success) {
                                    
                                         
                                       
                                        $("#frmStripePayment").append("<input type='hidden' name='card-identifier' value='" + result.cardIdentifier + "' />");
                                         $("#frmStripePayment").append("<input type='hidden' name='merchent_key' value='" + merchant_key + "' />");
                                
                                        $("#frmStripePayment").submit();
                                } 
                                else { 
                                    var x = document.getElementById('errorDiv');
                                    x.style.display = "block";
                                   
                                    document.getElementById("errorMessage").innerHTML = result.errors[0].message;
                                } 
                            } 
                        });
            return false;
        } else {
            alert("Invalid Entries"); return false;
        }
    }
$(function(){
    var day = new Date().getDay();
     var d = new Date();
     if(day == '0' || day == '6'){
        d.setDate(d.getDate() + (1 + 7 - d.getDay()) % 7); 
     }else{
        d.setDate(new Date().getDate());
     }
    $( "#delivery_date" ).datepicker({  autoclose: true, 
        todayHighlight: true,
        daysOfWeekDisabled: [0,6],
        //startDate:d,
        format: 'dd/mm/yyyy',
    }).datepicker("setDate", "<?php echo e($delivery_date); ?>");

    $.fn.DataTable.ext.pager.numbers_length = 5;
    $('#order_status').change(function(e) {
    	var status = $(this).val();
    	var orderId= '<?php echo e($order->id); ?>';
    	e.preventDefault();
		Swal.fire({
            title: 'Updated!',
	        text: "New status has been assigned.",
            type: 'success',
            showConfirmButton: false,
            timer: 1500
        });
    	$.ajax({
            url:"<?php echo e(route('admin.orders.status.update')); ?>",
            method: "POST",
            data: {
            	"_token": "<?php echo e(csrf_token()); ?>",
            	orderId: orderId,
            	status: status
            },
            success:function(response) {
                setTimeout(function() {
                    window.location.reload();
                }, 1500);
            }
        });
    });
    $('#payment_option').change(function(e) {
    	var orderId= '<?php echo e($order->id); ?>';
    	var paymentOption = $(this).val()
    	Swal.fire({
            title: 'Updated!',
	        text: "New payment option has been assigned.",
            type: 'success',
            showConfirmButton: false,
            timer: 1500
        });
    	$.ajax({
            url:"<?php echo e(route('admin.orders.paymentoption.update')); ?>",
            method: "POST",
            data: {
            	"_token": "<?php echo e(csrf_token()); ?>",
            	orderId: orderId,
            	paymentOption: paymentOption
            },
            success:function(response) {
	    		setTimeout(function() {
                    window.location.reload();
                }, 1500);
            }
        });
    });
	$('#btn_add_order_product').click(function() {
		$('.tbl_add_order_product').show();
		$('.tbl_row_add_order_product').addClass("bg-yellow-color");
	});
	$('.cancel_add_order_product').click(function() {
		$('.tbl_add_order_product').hide();
		$('.tbl_row_add_order_product').removeClass("bg-yellow-color");
	});
	$('.add_order_product').click(function() {
		var refer = $(this);
		var orderId = '<?php echo e($order->id); ?>';
		var productId = $('#new_order_product').val();
		var productQty = $('#new_order_product_qty').val();
		$.ajax({
	        url:"<?php echo e(route('admin.orders.addproduct')); ?>",
	        method: "POST",
	        data: {
	        	"_token": "<?php echo e(csrf_token()); ?>",
	        	orderId: orderId,
	        	productId: productId,
	        	productQty: productQty
	        },
	        success:function(response) {
	            if (response.status == 1) {
	            	$('#holder_subtotal').html(response.data.subtotal);
	            	$('#holder_vat').html(response.data.vat);
	            	$('#holder_discount').html(response.data.discount);
	            	$('#holder_grand_total').html(response.data.grandtotal);
	            	var lastRow = $('.tbl_orders tr:last').clone();
	            	$(lastRow).find('.container_order_product_sku').html(response.data.product_sku);
	            	$(lastRow).find('.container_order_product_name').html(response.data.product_name);
	            	$(lastRow).find('.container_order_product_name').attr('id', response.data.product_id);
	            	$(lastRow).find('.container_order_product_qty').html(response.data.product_qty);
	            	$(lastRow).find('.container_product_price').html(response.data.product_price);
	            	$(lastRow).find('.delete_order_product').show();
	            	$(lastRow).find('.delete_order_product').attr('data-product', response.data.product_id);
	            	$(lastRow).find('.update_order').attr('data-product', response.data.product_id);
	            	var newRow = '<tr>' + $(lastRow).html() + '</tr>';
	            	$('.tbl_orders tr:last').after(newRow);
	            	$('.cancel_add_order_product').click();
	            } else {
	            	Swal.fire({
	            	    title: 'Error!',
	            	    text: response.msg,
	            	    type: 'error',
	            	    showConfirmButton: false,
	            	    timer: 3000
	            	});
	            }
	        }
	    });
	});
	$(document).on('click', '.delete_order_product', function(e) {
		var refer = $(this);
		var orderId = '<?php echo e($order->id); ?>';
		var productId = $(refer).attr('data-product');
		console.log('orderId: '+orderId);
		console.log('productId: '+productId);
		if (orderId != '' && productId != '') {
			e.preventDefault();
			Swal.fire({
                title: 'Are you sure?',
                text: "You won't be able to revert this!",
    	        type: 'warning',
    	        showCancelButton: true,
                confirmButtonColor: '#3085d6',
    	        cancelButtonColor: '#d33',
    	        confirmButtonText: 'Yes, delete it!'
            }).then((result) => {
    	        if (result.value) {
    	            Swal.fire({
                        title: 'Deleted!',
            	        text: "Your product has been deleted.",
            	        type: 'success',
                        showConfirmButton: false,
                        timer: 1500
    	            });
                    $.ajax({
    			        url:"<?php echo e(route('admin.orders.deleteorder')); ?>",
    			        method: "POST",
        		        data: {
        		        	"_token": "<?php echo e(csrf_token()); ?>",
    			        	orderId: orderId,
    			        	productId: productId
        		        },
        		        success:function(response) {
    			            if (response.status == 1) {
        		            	$('#holder_subtotal').html(response.data.subtotal);
        		            	$('#holder_vat').html(response.data.vat);
        		            	$('#holder_discount').html(response.data.discount);
    			            	$('#holder_grand_total').html(response.data.grandtotal);
        		            	$(refer).closest('tr').remove();
        		            }
    			        }
    			    });
                }
            });
		}
	});
	$('.edit_order_discount').click(function() {
		$('.container_discount_value').hide();
		$('.container_discount_list').show();
		$('.container_action_edit_discount').hide();
		$('.container_action_update_discount').show();
		$('.container_label_update_discount').closest('td').addClass("bg-yellow-color");
		$('.container_action_update_discount').closest('td').addClass("bg-yellow-color");
	});
	$('.cancel_update_discount').click(function() {
		$('.container_discount_value').show();
		$('.container_discount_list').hide();
		$('.container_action_edit_discount').show();
		$('.container_action_update_discount').hide();
		$('.container_label_update_discount').closest('td').removeClass("bg-yellow-color");
		$('.container_action_update_discount').closest('td').removeClass("bg-yellow-color");
	});
	$('.update_discount').click(function() {
		var refer = $(this);
		var orderId = '<?php echo e($order->id); ?>';
		var orderType = '<?php echo e(( $order->oil_type_order == 1 ) ? "oil": "shop"); ?>';
		var discountId = $('#order_discount').val();
		if (discountId || discountId == '0') {
			$.ajax({
		        url:"<?php echo e(route('admin.orders.updatediscount')); ?>",
		        method: "POST",
		        data: {
		        	"_token": "<?php echo e(csrf_token()); ?>",
		        	orderId: orderId,
		        	orderType: orderType,
		        	discountId: discountId
		        },
		        success:function(response) {
		            if( response.status == 1 ) {
		            	$('#holder_discount').html(response.data.discount);
		            	$('#holder_grand_total').html(response.data.grandtotal);
		            	$(refer).closest('tr').find('.cancel_update_discount').click();
		            } else {
		            	Swal.fire({
		            	    title: 'Error!',
		            	    text: response.msg,
		            	    type: 'error',
		            	    showConfirmButton: false,
		            	    timer: 3000
		            	});
		            }
		        }
		    });
		} else {
			$('.container_discount_value').show();
			$('.container_discount_list').hide();
			$('.container_action_edit_discount').show();
			$('.container_action_update_discount').hide();
			$('.container_label_update_discount').closest('td').removeClass("bg-yellow-color");
		    $('.container_action_update_discount').closest('td').removeClass("bg-yellow-color");
		}
	});
	$(document).on('click', '.edit_order_product', function(){
		var refer = $(this);
		$(refer).closest('tr').find('.container_order_product_name').hide();
		
		$(refer).closest('tr').find('#display_price').hide();
		$(refer).closest('tr').find('#price_display').show();
		
		$(refer).closest('tr').find('.container_order_product_list').show();
		$(refer).closest('tr').find('.container_order_product_list').show();
		$(refer).closest('tr').find('.container_order_product_qty').hide();
		$(refer).closest('tr').find('.container_order_product_qty_list').show();
		$(refer).closest('tr').find('.container_action_edit_order').hide();
		$(refer).closest('tr').find('.container_action_update_order').show();
		var orderType = '<?php echo e(( $order->oil_type_order == 1 ) ? "oil": "shop"); ?>';
		if (orderType == 'shop') {
			var productId = $(refer).closest('tr').find('.container_order_product_name').attr('id');
			$(refer).closest('tr').find('#order_product').val(productId);
			//var qty = $(refer).closest('tr').find('.container_order_product_qty').html();
			//$(refer).closest('tr').find('#order_product_qty').val(qty);
		}
		$(refer).closest('tr').addClass("bg-yellow-color");
	});
// 	$(document).on('keyup','#order_product_qty',function(){
// 	    var qty = $(this).val();
// 	    var product_id = $('#order_product').val();
// 	    $.ajax({
// 		        url:"<?php echo e(route('admin.orders.updateqty')); ?>",
// 		        method: "POST",
// 		        data: {
// 		        	"_token": "<?php echo e(csrf_token()); ?>",
// 		            qty : qty,
// 		            order_id : "<?php echo e($order->id); ?>",
// 		        	product_id :product_id
// 		        },
// 		        success:function(data) {
// 		          $('#item_price').val(data);
// 		        }
// 		    });
// 	})
// 	$(document).on('keyup','#item_price',function(){
// 	    var product_id = $('#order_product').val();
// 	    var price = $('#item_price').val();
// 	    $.ajax({
// 		        url:"<?php echo e(route('admin.orders.updateprice')); ?>",
// 		        method: "POST",
// 		        data: {
// 		        	"_token": "<?php echo e(csrf_token()); ?>",
// 		            price : price,
// 		            order_id : "<?php echo e($order->id); ?>",
// 		        	product_id :product_id
// 		        },
// 		        success:function(data) {
// 		          $('#order_product_qty').val(data);
// 		        }
// 		    });
// 	})
	$(document).on('click', '.cancel_update_order', function(){
		var refer = $(this);
		// Product
		$(refer).closest('tr').find('.container_order_product_name').show();
		$(refer).closest('tr').find('.container_order_product_list').hide();
		// Quantity
		$(refer).closest('tr').find('.container_order_product_qty').show();
		$(refer).closest('tr').find('.container_order_product_qty_list').hide();
		// Action
		$(refer).closest('tr').find('.container_action_edit_order').show();
		$(refer).closest('tr').find('.container_action_update_order').hide();
		$(refer).closest('tr').removeClass("bg-yellow-color");
		$('#display_price').show();
    	$('#price_display').css('display','none');
	});
	$(document).on('click', '.update_order', function() {
	    
		var orderType = '<?php echo e(( $order->oil_type_order == 1 ) ? "oil": "shop"); ?>';
		if (orderType == 'oil') {
		  
			var initialProductId = $(this).attr('data-product');
			var initialProductQty = $(this).attr('data-product-qty');
			console.log(initialProductId)
			console.log(initialProductQty)
			var orderId = '<?php echo e($order->id); ?>';
			var refer = $(this);
			var productId = $('#order_product').val();
			var productAttrId = $('#order_product_qty').val();
			var productQty = $('#order_product_qty').val();
			var price = $('#item_price').val();
			if (productId != '' && productAttrId != '') {
			     
			      
				
				    
					$.ajax({
			            url:"<?php echo e(route('admin.orders.updateorder')); ?>",
			            method: "POST",
			            data: {
			            	"_token": "<?php echo e(csrf_token()); ?>",
			            	orderId: orderId,
			            	orderType: orderType,
			            	productId: productId,
			            	productQty: productQty,
			            	productAttrId: productAttrId,
			            	price : price
			            },
			            success:function(response) {
			                
			                if (response.status == 1) {
			                	$('#holder_subtotal').html(response.data.subtotal);
			                	$('#holder_vat').html(response.data.vat);
			                	$('#holder_discount').html(response.data.discount);
			                	$('#holder_grand_total').html(response.data.grandtotal);
			                	
			                	$(refer).closest('tr').find('#display_price').html(response.data.subtotal);
			                	$(refer).closest('tr').find('.container_order_product_name').html(response.data.product_name);
			                	$(refer).closest('tr').find('#display_price').html(response.data.product_price);
			                	$('#display_price').show();
			                	$('#price_display').css('display','none');
		                	    if (productQty == 0) {
		                	        $(refer).closest('tr').find('.container_order_product_qty').html('Fill the Tank');
		                	    } else {
		                	        $(refer).closest('tr').find('.container_order_product_qty').html(productQty);
		                	    }
			                	$(refer).closest('tr').find('.update_order').attr('data-product', response.data.product_id);
			                	$(refer).attr('data-product-qty', productQty);
			                	$(refer).closest('tr').find('.cancel_update_order').click();
			                } else {
			                	Swal.fire({
			                	    title: 'Error!',
			                	    text: response.msg,
			                	    type: 'error',
			                	    showConfirmButton: false,
			                	    timer: 3000
			                	});
			                }
			            }
			        });
				
			} else {
				$('.cancel_update_order').click();
			}
		} else {
			var initialProductId = $(this).attr('data-product');
			var initialProductQty = $(this).attr('data-product-qty');
			var orderId = '<?php echo e($order->id); ?>';
			var refer = $(this);
			var productId = $(refer).closest('tr').find('#order_product').val();
			var productQty = $(refer).closest('tr').find('#order_product_qty').val();
			var existingProductId = initialProductId;
			if (initialProductId != productId || productQty != initialProductQty) {
				$.ajax({
		            url:"<?php echo e(route('admin.orders.updateorder')); ?>",
		            method: "POST",
		            data: {
		            	"_token": "<?php echo e(csrf_token()); ?>",
		            	orderId: orderId,
		            	orderType: orderType,
		            	productId: productId,
		            	productQty: productQty,
		            	existingProductId: existingProductId
		            },
		            success:function(response) {
		                if (response.status == 1) {
		                	$('#holder_subtotal').html(response.data.subtotal);
		                	$('#holder_vat').html(response.data.vat);
		                	$('#holder_discount').html(response.data.discount);
		                	$('#holder_grand_total').html(response.data.grandtotal);
		                	$(refer).closest('tr').find('.container_order_product_sku').html(response.data.product_sku);
		                	$(refer).closest('tr').find('.container_order_product_name').html(response.data.product_name);
		                	$(refer).closest('tr').find('.container_order_product_name').attr('id', response.data.product_id);
		                	$(refer).closest('tr').find('.container_product_price').html(response.data.product_price);
		                	$(refer).closest('tr').find('.container_order_product_qty').html(productQty);
		                	$(refer).closest('tr').find('.delete_order_product').attr('data-product', response.data.product_id);
		                	$(refer).closest('tr').find('.update_order').attr('data-product', response.data.product_id);
		                	$(refer).attr('data-product-qty', productQty);
		                	$(refer).closest('tr').find('.cancel_update_order').click();
		                } else {
		                	Swal.fire({
		                	    title: 'Error!',
		                	    text: response.msg,
		                	    type: 'error',
		                	    showConfirmButton: false,
		                	    timer: 3000
		                	});
		                }
		            }
		        });
			} else {
				$(this).closest('tr').find('.cancel_update_order').click();
			}
		}
	});
    $('#order_table').DataTable({
		"responsive": true,
		"bPaginate": false,
        "bLengthChange": false,
        "bFilter": false,
        "bInfo": false,
        "bSort": false,
		"order": [[ 0, "desc" ]],
        "bAutoWidth": false,
        "columnDefs": [
            { "orderable": false, "targets": [0, 1, 2, 3, 4] }
        ],
        "aaSorting": [],
        "columnDefs": [
          { "width": "150px", "targets": 3 },
          { "width": "150px", "targets": 4 }
        ]
	});
    $('#addresses_table').DataTable({
		"responsive": true,
		"bPaginate": false,
        "bLengthChange": false,
        "bFilter": false,
        "bInfo": false,
        "bSort": false,
		"order": [[ 0, "desc" ]],
        "bAutoWidth": false,
        "columnDefs": [
            { "orderable": false, "targets": [0, 1, 2, 3] }
        ],"aaSorting": []
	});
    $('.delete_submit').on('click',function(e) {
        var refer = $(this).attr("id");
		var step_remove_url = $(this).closest("#remove-from-form").attr('action');
		e.preventDefault();
		e.stopPropagation();
		if (refer != '') {
			Swal.fire({
                title: 'Are you sure?',
                text: "You won't be able to revert this!",
    	        type: 'warning',
    	        showCancelButton: true,
                confirmButtonColor: '#3085d6',
    	        cancelButtonColor: '#d33',
    	        confirmButtonText: 'Yes, delete it!'
            }).then((result) => {
    	        if (result.value) {
    	            Swal.fire({
                        title: 'Deleted!',
            	        text: "Your order has been deleted.",
            	        type: 'success',
                        showConfirmButton: false,
                        timer: 1500
    	            });
                    $.ajax({
    			        url: step_remove_url,
    			        method: "POST",
        		        data: {
        		        	"_token": "<?php echo e(csrf_token()); ?>",
        		        	"_method": "delete",
    			        	id: refer
        		        },
        		        success:function(response){
    			            setTimeout(function(){
                                window.location.replace("<?php echo e(url('admin/orders')); ?>");
                            }, 1500);
    			        }
    			    });
                }
            });
        }
    });
	$('#btn_show_invoice').click(function() {
    	var orderId= '<?php echo e($order->id); ?>';
    	$.ajax({
            url:"<?php echo e(route('admin.orders.invoice.details')); ?>",
            method: "POST",
            data: {
            	"_token": "<?php echo e(csrf_token()); ?>",
            	orderId: orderId
            },
            success:function(response) {
                $('#modal_body_show_invoice').html(response);
                $("#modal_show_invoice").modal('show');
            }
        });
    });
    $('#btn_show_assign_driver_modal').click(function() {
        var order_id = $(this).attr('data-id');
        $('#popup_order_id').val(order_id);
        $.ajax({
            url:"<?php echo e(route('admin.driver.alldriver')); ?>",
            method: "POST",
            data: {"_token": "<?php echo e(csrf_token()); ?>"},
            success:function(data){
                data = JSON.parse(data);
                $("#driver_list").html(data);
                $("#modal_assign_driver").modal('show');
            }
        });
    });
    $('#btn_assign_driver').click(function(e) {
        var popup_driver_id = $("#driver_list").val();
        var popup_order_id 	= '<?php echo e($order->id); ?>';
        if(popup_driver_id != ''){
            $('#modal_assign_driver').hide();
            e.preventDefault();
			Swal.fire({
                title: 'Updated!',
    	        text: "A driver has been assigned.",
    	        type: 'success',
                showConfirmButton: false,
                timer: 1500
            });
            $.ajax({
                url:"<?php echo e(route('admin.driver.assignorder')); ?>",
                method: "POST",
                data: {'popup_driver_id':popup_driver_id, 'popup_order_id':popup_order_id ,"_token": "<?php echo e(csrf_token()); ?>"},
                success:function(data){
                    setTimeout(function(){
                        window.location.reload();
                    }, 1500);
                }
            });
        }   
    });
    $('#btn_change_delivery_date_modal').click(function() {
        $("#modal_change_ddate").modal('show');
    });
	$('#btn_update_delivery_date').click(function(e) {
		var refer = $(this);
		var orderId = '<?php echo e($order->id); ?>';
		var deliveryDate = '<?php echo e($delivery_date); ?>';
		var updatedDeliveryDate = $('#delivery_date').val();
		if (updatedDeliveryDate != '') {
		    e.preventDefault();
			Swal.fire({
                title: 'Updated!',
    	        text: "A delivery date has been assigned.",
    	        type: 'success',
                showConfirmButton: false,
                timer: 1500
            });
			$.ajax({
		        url:"<?php echo e(route('admin.orders.updatedeliverydate')); ?>",
		        method: "POST",
		        data: {
		        	"_token": "<?php echo e(csrf_token()); ?>",
		        	orderId: orderId,
		        	updatedDeliveryDate: updatedDeliveryDate
		        },
		        success:function(response){
		            if( response.status == 1 ) {
		            	$('#delivery_date').val(response.formated_delivery_date);
		            	$('#container_delivery_date').html(response.formated_delivery_date);
		            	$('.delivery-date-update').html(response.formated_delivery_date);
		            	$("#modal_change_ddate").modal('hide');
		            }
		        }
			});
		}
	});
    $('.btn-send-email').on('click',function(e) {
        var refer = $(this).data("id");
        var step_remove_url = $(this).closest("#email-form").attr('action');
        var obj = $(this);
        e.preventDefault();
        e.stopPropagation();
        if (refer != '') {
            Swal.fire({
                title: 'Are you sure?',
                text: "You want to sent email!!",
                type: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Yes, Send!'
            }).then((result) => {
                if (result.value) {
                    $(this).attr("disabled",true);
                    $.ajax({
                        url: step_remove_url,
                        method: "POST",
                        data: {
                            "_token": "<?php echo e(csrf_token()); ?>",
                            "_method": "post",
                            id: refer
                        },
                        success:function(response){
                            if (response.status == 1) {
                                $("#badge-email").show();
                                obj.attr("disabled",false);
                                Swal.fire({
                                    title: 'Success!!',
                                    text: response.msg,
                                    type: 'success',
                                    showConfirmButton: false,
                                    timer: 1500
                                });
                            } else {
                                obj.attr("disabled",false);
                                Swal.fire({
                                    title: 'Opps!!',
                                    text: response.msg,
                                    type: 'error',
                                    showConfirmButton: false,
                                    timer: 1500
                                });
                            }
                        }
                    });
                }
            });
        }
    });
    $('#o_status').change(function(e) {
        var status = $(this).val();
        var orderId= '<?php echo e($order->id); ?>';
        e.preventDefault();
        Swal.fire({
            title: 'Updated!',
            text: "New status has been assigned.",
            type: 'success',
            showConfirmButton: false,
            timer: 1500
        });
        $.ajax({
            url:"<?php echo e(route('admin.orders.status.update')); ?>",
            method: "POST",
            data: {
                "_token": "<?php echo e(csrf_token()); ?>",
                orderId: orderId,
                status: status,
                order_main_status: 1
            },
            success:function(response) {
                setTimeout(function() {
                    window.location.reload();
                }, 1500);
            }
        });
    });

    $('.unassign-driver').on('click',function(e) {
        var id = $(this).data("id");
        var obj = $(this);
        e.preventDefault();
        e.stopPropagation();
        if (id != '') {
            Swal.fire({
                title: 'Are you sure?',
                text: "The driver will be unassigned from this order",
                type: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Yes!'
            }).then((result) => {
                if (result.value) {
                    $(this).attr("disabled",true);
                    $.ajax({
                        url: "<?php echo e(route('admin.driver.unassignDriver')); ?>",
                        method: "POST",
                        data: {
                            "_token": "<?php echo e(csrf_token()); ?>",
                            "_method": "get",
                            id: id
                        },
                        success:function(response){
                            setTimeout(function() {
                                window.location.reload();
                            }, 1500);
                        }
                    });
                }
            });
        }
    });
    $('.edit_customer_notes').click(function(){
     
        $('#cutomer_note_modal_box').modal('show');
    });
    $('#btn_update_customer_note').click(function(){
        var refer = $(this);
        var orderId = '<?php echo e($order->id); ?>';
        var customer_notes = $('#disp_customer_note').val();
        $.ajax({
            url:"<?php echo e(route('admin.orders.updateCustomerNotes')); ?>",
		        method: "POST",
 		        data: {
		        	"_token": "<?php echo e(csrf_token()); ?>",
		        	orderId: orderId,
		        	customer_notes: customer_notes
 		        },
 		        success:function(response){
                	if( response == 1 ) {
                	$('#delivery_notes_text').text(customer_notes);
                
                	$("#cutomer_note_modal_box").modal('hide');
                	location.reload();
                	}
                }
        });
        
    });
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.admin.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/corals/mcoil.corals.io/resources/views/admin/orders/show.blade.php ENDPATH**/ ?>

Spamworldpro Mini