Viewing file: 6c49daf2934a66e9339bd13804a0a91a8f6ada42.php (23.21 KB) -rwxrwxrwx Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php $__env->startSection('title'); ?> Picked Up Order <?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<?php $__env->startComponent('components.breadcrumb'); ?>
<?php $__env->slot('li_1'); ?> Order <?php $__env->endSlot(); ?>
<?php $__env->slot('title'); ?>Picked Up List <?php $__env->endSlot(); ?>
<?php echo $__env->renderComponent(); ?>
<div class="row">
<div class="col-lg-12">
<div class="card">
<?php if($errors->any()): ?>
<div class="alert alert-danger">
<?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<span class="each-error"><?php echo e($error); ?> </span><br/>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<?php endif; ?>
<?php if(session()->has('message')): ?>
<div class="alert alert-success">
<?php echo e(session()->get('message')); ?>
</div>
<?php endif; ?>
<div class="card-header border-0">
<div class="d-flex align-items-center">
<h5 class="card-title mb-0 flex-grow-1">Picked Up Orders List</h5>
<!-- <div class="flex-shrink-0">
<button type="button" class="btn btn-success add-btn" data-bs-toggle="modal"
id="create-btn" data-bs-target="#addModal"><i
class="ri-add-line align-bottom me-1"></i> Create New
</button>
</div> -->
</div>
</div>
<div class="card-body border border-dashed border-end-0 border-start-0">
<form action="<?php echo e(route('picked_up_deliveries')); ?>" method="POST">
<?php echo csrf_field(); ?>
<div class="row g-3">
<div class="col-xxl-2 col-sm-3">
<div class="search-box">
<?php
$input_dt = (isset($search_input)) ? $search_input : "";
?>
<input type="text" id="search_input" name="search_input" value="<?php echo e($input_dt); ?>" class="form-control search"
placeholder="Search by order invoice no">
<i class="ri-search-line search-icon"></i>
</div>
</div>
<!--end col-->
<div class="col-xxl-2 col-sm-3">
<div>
<?php
$dt=date('d M, Y', strtotime("-1 month")) ." to ".date('d M, Y', strtotime("+0 days"));
$date_dt = (isset($date_range)) ? $date_range :$dt;
?>
<input type="text" class="form-control" data-provider="flatpickr"
data-date-format="d M, Y" data-range-date="true"
id="demo-datepicker" data-deafult-date="<?php echo e($date_dt); ?>" name="date_range" placeholder="Select date">
</div>
</div>
<!--end col-->
<div class="col-xxl-2 col-sm-3" style="max-height:40px;">
<div>
<select class="js-example-basic-single form-control"
name="shop" id="idShop">
<option value="" disabled>Select Shop</option>
<option value="all" selected>All Shop</option>
<?php
$shop_dt = (isset($shop)) ? $shop : "all";
?>
<?php if(isset($shops)): ?>
<?php $__currentLoopData = $shops; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $shop): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($shop->id); ?>"><?php echo e($shop->shop_name); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
</select>
</div>
</div>
<!--end col-->
<div class="col-xxl-1 col-sm-3">
<div>
<button type="submit" class="btn btn-primary w-100"> <i
class="ri-equalizer-fill me-1 align-bottom"></i>
Filters
</button>
</div>
</div>
<!--end col-->
</div>
<!--end row-->
</form>
</div>
<div class="card-body pt-3">
<div class="">
<table id="partnerTable" class="table dt-responsive align-middle table-hover table-bordered" style="width:100%">
<thead>
<tr>
<td>Order ID</td>
<th>Invoice No</th>
<th>Date</th>
<th>Receiver</th>
<th>Address</th>
<th>Shop</th>
<th>Address</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
?>
<?php if(isset($deliveries)): ?>
<?php $__currentLoopData = $deliveries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php
$customer= json_decode($data->customer,true);
$vendor= json_decode($data->vendor,true);
$date=date('d M, Y H:i', strtotime($data->statusData->dateTime));
?>
<tr>
<td>
<a href="<?php echo e(route('order_details',['order_id'=>$data->sale_id])); ?>" class="fw-medium link-primary">
<!-- <button class="btn btn-sm btn-soft-success text-uppercase"> -->
<?php echo e($data->saleData->order_id); ?>
<!-- </button> -->
</a>
</td>
<td><?php echo e($data->invoice_no); ?></td>
<td><?php echo e($date); ?></td>
<td><?php echo e($customer['receiver_name']); ?></td>
<td><?php echo e($customer['address']); ?></td>
<td><?php echo e($vendor['shop_name']); ?></td>
<td><?php echo e($vendor['address']); ?></td>
<td>
<li class="list-inline-item edit"
data-bs-toggle="tooltip" data-bs-trigger="hover"
data-bs-placement="top" title="Picked Up">
<button class="btn btn-sm btn-soft-success text-uppercase" onclick="Complete
(<?php echo e($data); ?>,'<?php echo e($date); ?>' )">
Complete
</button>
</li>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
<!-- Modal -->
<div class="modal fade modal-lg" id="changeStatus_Modal" tabindex="-1"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header bg-light p-3">
<h5 class="modal-title" id="exampleModalLabel">Update Status</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close" id="close-modal"></button>
</div>
<div class="col-lg-12">
<div class="card-body p-4">
<div class="row g-3">
<div class="col-lg-3 col-6">
<p class="text-muted mb-2 text-uppercase fw-semibold">Order Id</p>
<h5 class="fs-14 mb-0"><span id="order_id"></span> </h5>
</div>
<div class="col-lg-3 col-6">
<p class="text-muted mb-2 text-uppercase fw-semibold">Invoice No</p>
<h5 class="fs-14 mb-0">#INV<span id="inv_no"></span></h5>
</div>
<!--end col-->
<div class="col-lg-3 col-6">
<p class="text-muted mb-2 text-uppercase fw-semibold">Date</p>
<h5 class="fs-14 mb-0"><span id="invoice-date"></span> <small class="text-muted" id="invoice-time"></small></h5>
</div>
<!--end col-->
<div class="col-lg-3 col-6">
<p class="text-muted mb-2 text-uppercase fw-semibold">Payment Status</p>
<p id="payment-status"></p>
</div>
<!--end col-->
<div class="col-lg-3 col-6">
<p class="text-muted mb-2 text-uppercase fw-semibold">Total Amount</p>
<h5 class="fs-14 mb-0">৳<span id="total-amount"> </span></h5>
</div>
<!--end col-->
</div>
<!--end row-->
</div>
<!--end card-body-->
</div>
<div class="col-lg-12">
<div class="card-body p-4 border-top border-top-dashed">
<div class="row g-3">
<div class="col-6">
<h6 class="text-muted text-uppercase fw-semibold mb-3">Customer Info</h6>
<p class="fw-medium mb-2" id="customer-name"></p>
<p class="text-muted mb-1" id="customer-address"></p>
<p class="text-muted mb-1"><span>Phone: </span><span id="customer-phone"></span></p>
<!-- <p class="text-muted mb-0"><span>Tax: </span><span id="billing-tax-no">12-3456789</span> </p> -->
</div>
<!--end col-->
<div class="col-6">
<h6 class="text-muted text-uppercase fw-semibold mb-3">Shop Info</h6>
<p class="fw-medium mb-2" id="shop-name"></p>
<p class="text-muted mb-1" id="shop-address"></p>
<p class="text-muted mb-1"><span>Phone: +</span><span id="shop-phone"></span></p>
</div>
<!--end col-->
</div>
<!--end row-->
</div>
<!--end card-body-->
</div>
<form class="row p-3 needs-validation" id="complete_form" novalidate method="POST"
action="<?php echo e(route('update_status')); ?>">
<?php echo csrf_field(); ?>
<input type="hidden" id="delivery_id" name="delivery_id" />
<input type="hidden" id="ordered_quantity" name="ordered_quantity" />
<div class="col-md-6 mb-2">
<label for="status-field"
class="form-label">Status <span
class="text-danger">*</span></label>
<select class="js-example-basic-single form-control" data-minimum-results-for-search="Infinity" data-trigger id="status-field" name="status" required>
<option selected value="3">Full Delivered</option>
<option value="5">Partial Delivered</option>
<option value="6">Full Return</option>
</select>
</div>
<div class="col-md-6 mb-2">
<label for="received_amount" class="form-label">Received Amount <span
class="text-danger">*</span></label>
<div class="input-group has-validation">
<input type="number" class="form-control" id="received_amount" name="received_amount" min="1" placeholder="Enter received amount" required>
<span class="input-group-text" id="received_amountPrepend">BDT</span>
<div class="invalid-feedback">
Please provide a valid amount
</div>
</div>
</div>
<div class="col-md-6 mb-2">
<label for="no_of_items" class="form-label">No Of Items Delivered <span
class="text-danger">*</span></label>
<div class="input-group has-validation">
<input type="number" class="form-control" id="no_of_items" name="no_of_items" min="0" placeholder="Enter no. of items delivered" required>
<div class="invalid-feedback">
Please provide a valid amount
</div>
</div>
</div>
<div class="col-md-6 mb-2">
<label for="note" class="form-label">Note </label>
<div class="input-group has-validation">
<input type="text" class="form-control" id="note" name="note" placeholder="Any Comment" >
</div>
</div>
<div class="modal-footer">
<div class="hstack gap-2 justify-content-end">
<button type="button" class="btn btn-light"
data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-success"
id="add-btn" >Submit</button>
<!-- <button type="button" class="btn btn-success"
id="edit-btn">Update</button> -->
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!--end col-->
</div>
<!--end row-->
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
$(document).ready(function() {
new DataTable('#partnerTable', {
"columns": [
{"name": "Order ID", "orderable": "true"},
{"name": "Invoice No", "orderable": true},
{"name": "Date", "orderable": "true"},
{"name": "Receiver", "orderable": false},
{"name": "Address", "orderable": false},
{"name": "Shop", "orderable": false},
{"name": "Address", "orderable": false},
{"name": "Status", "orderable": false},
],
order:[],
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
var shop = "<?php echo $shop_dt; ?>";
$('#idShop').val(shop);
$('#idShop').trigger('change.select2');
});
let sale_data;
function Complete(data,date) {
var customer = JSON.parse(data.customer);
var vendor = JSON.parse(data.vendor);
sale_data=data.sale_data;
// console.log(sale_data);
invoice_no=data.invoice_no;
$('#inv_no').text(data.invoice_no);
$("#order_id").text(sale_data.order_id);
$('#invoice-date').text(date.slice(0,-6));
$('#invoice-time').text(date.slice(-5));
$('#customer-name').text(customer.receiver_name);
$('#customer-address').text(customer.address);
$('#customer-phone').text(customer.receiver_phone);
$('#shop-name').text(vendor.shop_name);
$('#shop-address').text(vendor.address);
$('#shop-phone').text(vendor.phone);
$('#total-amount').text(sale_data.grand_total);
$("#payment-status").empty();
if (sale_data.payment_status==1) {
$("#payment-status").append('<span class="badge badge-soft-success fs-11" >Paid</span>');
}else{
$("#payment-status").append('<span class="badge badge-soft-warning fs-11" >Pending</span>');
}
$('#delivery_id').val(data.id);
$('#received_amount').val(sale_data.grand_total);
$('#no_of_items').val(sale_data.total_items);
$("#no_of_items").prop('readonly', true);
$("#no_of_items").prop('max', sale_data.total_items);
$('#ordered_quantity').val(sale_data.total_items);
// if (sale_data.payment_status==1 || sale_data.payment_method==2) {
$("#received_amount").prop('readonly', true);
$("#received_amount").prop('max', sale_data.grand_total);
// }
// // $('#or_status').text("Picked Up");
// // $('#sale_id').val(data.sale_id);
$('#changeStatus_Modal').modal('toggle');
}
$("#status-field").change(function() {
// $("#no_of_items").prop('disabled', true);
// if ($(this).val()==3) {
// }
var status=$(this).val();
switch (parseInt(status)) {
case 5:
$('#no_of_items').val(sale_data.total_items);
$("#no_of_items").prop('readonly', false);
$('#received_amount').val(sale_data.grand_total);
$("#received_amount").prop('readonly', false);
break;
case 6:
$('#no_of_items').val(0);
$("#no_of_items").prop('readonly', true);
$('#received_amount').val(0);
$("#received_amount").prop('readonly', true);
break;
case 3:
$('#no_of_items').val(sale_data.total_items);
$("#no_of_items").prop('readonly', true);
$('#received_amount').val(sale_data.grand_total);
$("#received_amount").prop('readonly', true);
break;
}
if (sale_data.payment_status==1 || sale_data.payment_method==2) {
$('#received_amount').val(sale_data.grand_total);
$("#received_amount").prop('readonly', true);
}
// console.log(sale_data);
})
document.addEventListener('DOMContentLoaded', function() {
var form = document.getElementById('complete_form');
form.addEventListener('submit', function(event) {
event.preventDefault(); // Prevent the form from submitting automatically
var isValid = true;
// Iterate over each form control with Bootstrap's .form-control class
form.querySelectorAll('.form-control').forEach(function(input) {
// Check if the input field is required
if (input.required && !input.value.trim()) {
isValid = false;
return;
}
});
if ($('#no_of_items').val()<0 || $('#no_of_items').val()> sale_data.total_items) {
isValid = false;
}
if ($('#received_amount').val()<0 || $('#received_amount').val()> sale_data.grand_total) {
isValid = false;
}
if (isValid) {
submitForm();
}
});
function submitForm() {
Swal.fire({
title: `Are you sure? Order ${invoice_no} is Complete`,
text: "You won't be able to revert this!",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: "Yes, Complete!"
}).then((result) => {
if (result.isConfirmed) {
$("#complete_form").submit();
}
});
}
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/jiff_delivery/resources/views/pages/delivery/picked_up.blade.php ENDPATH**/ ?>
|