@extends('seller/layout')
@section('title')
{{ labels('admin_labels.order_manage', 'Order Manage') }}
@endsection
@section('content')
@php
use App\Models\OrderItems;
use App\Services\MediaService;
use App\Services\ShiprocketService;
use App\Services\OrderService;
@endphp
{{ labels('admin_labels.order_number', 'Order Number') }}
#{{ $order_detls[0]->id }}
{{ labels('admin_labels.order_date', 'Order Date') }} :
{{ date('d M, Y', strtotime($order_detls[0]->created_at)) }}
{{ labels('admin_labels.order_note', 'Order Note') }} :
{{ $order_detls[0]->notes ?? '' }}
@if ($is_customer_privacy_permission == 1)
{{ labels('admin_labels.customer_info', 'Customer Info') }}
{{ labels('admin_labels.name', 'Name') }}:
{{ $order_detls[0]->user_name }}
{{ labels('admin_labels.mobile', 'Contact') }}:
@if (!empty($order_detls[0]->mobile))
{{ $order_detls[0]->mobile }}
@else
{{ !empty($mobile_data[0]->mobile) ? $mobile_data[0]->mobile : '' }}
@endif
{{ labels('admin_labels.email', 'Email') }}:
{{ $order_detls[0]->email }}
@endif
{{ labels('admin_labels.shipping_info', 'Shipping Info') }}
{{ labels('admin_labels.name', 'Name') }}:
{{ $order_detls[0]->user_name }}
{{-- @dd($mobile_data); --}}
{{ labels('admin_labels.mobile', 'Contact') }}:
@if ($order_detls[0]->mobile != '' && isset($order_detls[0]->mobile))
{{ $order_detls[0]->mobile }}
@else
{{ $mobile_data->isNotEmpty() ? $mobile_data[0]->mobile : '' }}
@endif
{{ labels('admin_labels.address', 'Address') }}:
{{ $order_detls[0]->address }}
{{-- @dd($sellers[0]); --}}
{{ labels('admin_labels.seller_info', 'Seller Info') }}
{{ labels('admin_labels.seller_name', 'Seller Name') }}:
{{ $sellers[0]['seller_name'] }}
{{ labels('admin_labels.mobile', 'Contact') }}:
{{ $sellers[0]['seller_mobile'] }}
{{ labels('admin_labels.email', 'Email') }}:
{{ $sellers[0]['seller_email'] }}
{{-- @dd($items); --}}
@if ($items[0]['product_type'] == 'digital_product')
@endif
{{ labels('admin_labels.id', 'Id') }}
{{ labels('admin_labels.name', 'Name') }}
{{ labels('admin_labels.image', 'Image') }}
{{ labels('admin_labels.attachment', 'Attachment') }}
{{ labels('admin_labels.quantity', 'Quantity') }}
{{ labels('admin_labels.product_type', 'Product Type') }}
{{ labels('admin_labels.variations', 'Variant') }}
{{ labels('admin_labels.discount', 'Discounted Price') }}
{{ labels('admin_labels.sub_total', 'Sub Total') }}
{{ labels('admin_labels.active_status', 'Active Status') }}
@php
$total = 0;
$tax_amount = 0;
$item_subtotal = 0;
@endphp
@foreach ($items as $index => $item)
@php
$is_allow_to_ship_order = true;
@endphp
@if ($item['active_status'] == 'draft' || $item['active_status'] == 'awaiting')
@php
$is_allow_to_ship_order = false;
@endphp
@endif
@php
$selected = '';
$item['discounted_price'] =
$item['discounted_price'] == '' ? 0 : $item['discounted_price'];
$total += $subtotal =
$item['quantity'] != 0 &&
($item['discounted_price'] != '' &&
$item['discounted_price'] > 0) &&
$item['price'] > $item['discounted_price']
? $item['price'] - $item['discounted_price']
: $item['price'] * $item['quantity'];
$tax_amount += $item['tax_amount'];
$total += $subtotal = $tax_amount;
$item_subtotal += (float) $item['item_subtotal'];
@endphp
@if ($items[0]['product_type'] == 'digital_product')
@endif
{{ $index + 1 }}
@php
$product_name = json_decode($item['pname'], true);
$product_name = $product_name['en'] ?? '';
@endphp
@if (!empty($item['attachment']))
@endif
{{ $item['quantity'] }}
{{ str_replace('_', ' ', ucfirst($item['product_type'])) }}
{{ isset($item['product_variants']) && !empty($item['product_variants'][0]['variant_values'])
? str_replace(',', ' | ', $item['product_variants'][0]['variant_values'])
: '-' }}
{{ $item['discounted_price'] > 0 ? $item['discounted_price'] : $item['price'] }}
{{ $item['item_subtotal'] }}
@php
$badges = [
'awaiting' => 'secondary',
'received' => 'primary',
'processed' => 'info',
'shipped' => 'warning',
'delivered' => 'success',
'returned' => 'danger',
'cancelled' => 'danger',
'return_request_approved' => 'success',
'return_request_decline' => 'danger',
'return_request_pending' => 'warning',
'return_pickedup' => 'success',
];
if ($item['active_status'] == 'return_request_pending') {
$status = 'Return Requested';
} elseif ($item['active_status'] == 'return_request_approved') {
$status = 'Return Approved';
} elseif ($item['active_status'] == 'return_request_decline') {
$status = 'Return Declined';
} else {
$status = $item['active_status'];
}
@endphp
{{ $status }}
{!! json_encode([
'id' => $item['id'],
'unit_price' => $item['price'],
'quantity' => $item['quantity'],
'delivered_quantity' => $item['delivered_quantity'],
'active_status' => $item['active_status'],
]) !!}
@endforeach
@if ($items[0]['product_type'] == 'digital_product')
Select Status
Received
Delivered
Submit
@endif
@if ($items[0]['product_type'] != 'digital_product' && empty($order_tracking_data[0]['shipment_id']))
Create A
Parcel
{{ labels('admin_labels.id', 'Id') }}
{{ labels('admin_labels.order_id', 'Order Id') }}
{{ labels('admin_labels.name', 'Name') }}
{{ labels('admin_labels.status', 'Status') }}
{{ labels('admin_labels.otp', 'OTP') }}
{{ labels('admin_labels.date_created', 'Date Created') }}
{{ labels('admin_labels.action', 'Action') }}
@endif
{{-- modal for create parcel --}}
@if ($is_allow_to_ship_order == true)
@endif
{{-- shiprocket order parcel modal --}}
@method('POST')
@csrf
@php
$total_items = count($items);
@endphp
{{ json_encode($items, JSON_FORCE_OBJECT) }}
Note: Make your pickup location associated with the order is
verified from Shiprocket
Dashboard and then in admin panel
. If it is not verified you will not be able to generate AWB
later on.
{{ labels(
'admin_labels.total_weight_of_parcel',
'Total Weight Of Parcel',
) }}
{{-- modal for show parcel product details --}}
#
Name
Image
Quantity
Status
{{-- modal for update parcel items status --}}
@if (isset($items[0]['product_type']) && $items[0]['product_type'] != 'digital_product')
Select status which you want to update
@endif
@if ($order_detls[0]->is_shiprocket_order == 0)
Local Shipping
@else
Standard Shipping (Shiprocket)
Cancelled Shiprocket Order Details
If the Order Status Does Not Change Automatically, Please Refresh
Cancel Shiprocket
Order
@php
$seller_order = app(OrderService::class)->getOrderDetails(
['o.id' => $order_detls[0]->order_id, 'oi.seller_id' => $sellers[0]['id']],
'',
'',
$store_id,
);
$pickup_location = collect($seller_order)
->pluck('pickup_location')
->unique()
->values()
->all();
@endphp
@if (!empty($pickup_location[0]))
@foreach ($pickup_location as $location)
@php
$ids = '';
@endphp
@foreach ($seller_order as $row)
@if ($row->pickup_location == $location)
@php
$ids .= $row->order_item_id . ',';
@endphp
@endif
@endforeach
@php
$order_item_ids = explode(',', trim($ids, ','));
$order_tracking_data = app(ShiprocketService::class)->getShipmentId(
$order_item_ids[0],
$order_detls[0]->order_id,
);
$shiprocket_order =
$order_tracking_data && is_array($order_tracking_data)
? app(ShiprocketService::class)->getShiprocketOrder($order_tracking_data[0]['shiprocket_order_id'])
: '';
@endphp
@foreach ($order_item_ids as $id)
@php
$active_status = fetchDetails(
\App\Models\OrderItems::class,
['id' => $id, 'seller_id' => $sellers[0]['id']],
'active_status',
)[0]->active_status;
@endphp
@if ($shiprocket_order != '')
@if ($shiprocket_order['data']['status'] == 'PICKUP SCHEDULED' && $active_status != 'shipped')
@php
app(OrderService::class)->updateOrder(
['active_status' => 'shipped'],
['id' => $id, 'seller_id' => $sellers[0]['id']],
false,
'order_items',
false,
0,
OrderItems::class,
);
app(OrderService::class)->updateOrder(
['status' => 'shipped'],
['id' => $id, 'seller_id' => $sellers[0]['id']],
true,
'order_items',
false,
0,
OrderItems::class,
);
$type = ['type' => 'customer_order_shipped'];
$order_status = 'shipped';
@endphp
@endif
@endif
@if (isset($shiprocket_order['data']) &&
($shiprocket_order['data']['status'] == 'CANCELED' ||
$shiprocket_order['data']['status'] == 'CANCELLATION REQUESTED') &&
$active_status != 'cancelled')
@php
app(OrderService::class)->updateOrder(
['active_status' => 'cancelled'],
['id' => $id, 'seller_id' => $sellers[0]['id']],
false,
'order_items',
false,
0,
OrderItems::class,
);
app(OrderService::class)->updateOrder(
['status' => 'cancelled'],
['id' => $id, 'seller_id' => $sellers[0]['id']],
true,
'order_items',
false,
0,
OrderItems::class,
);
$type = ['type' => 'customer_order_cancelled'];
$order_status = 'cancelled';
@endphp
@endif
@if (isset($shiprocket_order['data']) &&
strtolower($shiprocket_order['data']['status']) == 'delivered' &&
$active_status != 'delivered')
@php
app(OrderService::class)->updateOrder(
['active_status' => 'delivered'],
['id' => $id, 'seller_id' => $sellers[0]['id']],
false,
'order_items',
false,
0,
OrderItems::class,
);
app(OrderService::class)->updateOrder(
['status' => 'delivered'],
['id' => $id, 'seller_id' => $sellers[0]['id']],
true,
'order_items',
false,
0,
OrderItems::class,
);
$type = ['type' => 'customer_order_delivered'];
$order_status = 'delivered';
@endphp
@endif
@if (isset($shiprocket_order['data']) &&
$shiprocket_order['data']['status'] == 'READY TO SHIP' &&
$active_status != 'processed')
@php
app(OrderService::class)->updateOrder(
['active_status' => 'processed'],
['id' => $id, 'seller_id' => $sellers[0]['id']],
false,
'order_items',
false,
0,
OrderItems::class,
);
app(OrderService::class)->updateOrder(
['status' => 'processed'],
['id' => $id, 'seller_id' => $sellers[0]['id']],
true,
'order_items',
false,
0,
OrderItems::class,
);
$type = ['type' => 'customer_order_processed'];
$order_status = 'processed';
@endphp
@endif
@endforeach
@endforeach
@endif
@if (isset($location) && !empty($location) && $location != 'NULL')
@if (
!empty($shiprocket_order) &&
isset($shiprocket_order['data']) &&
!empty($shiprocket_order['data']) &&
isset($order_tracking_data[0]['shipment_id']) &&
!empty($order_tracking_data[0]['shipment_id']) &&
$order_tracking_data[0]['is_canceled'] != 1 &&
$shiprocket_order['data']['status'] != 'CANCELED')
Order created
@endif
@if (isset($items[0]['product_type']) && $items[0]['product_type'] != 'digital_product')
@if (empty($order_tracking_data[0]['shipment_id']))
Order not created
@endif
@endif
@if (
(!empty($shiprocket_order) &&
isset($shiprocket_order['data']) &&
!empty($shiprocket_order['data']) &&
(isset($order_tracking_data[0]['is_canceled']) && $order_tracking_data[0]['is_canceled'] != 0)) ||
(isset($shiprocket_order['data']) && $shiprocket_order['data']['status'] == 'CANCELED'))
Order cancelled
@endif
@if (isset($order_tracking_data[0]) &&
isset($order_tracking_data[0]['shipment_id']) &&
$order_tracking_data[0]['shipment_id'] != 0)
@if (empty($order_tracking_data[0]['awb_code']) || $order_tracking_data[0]['awb_code'] == 'NULL')
@if (isset($shiprocket_order['data']) && $shiprocket_order['data']['status'] != 'CANCELED')
AWB
@endif
@else
@if (
!empty($shiprocket_order) &&
empty($order_tracking_data[0]['pickup_scheduled_date']) &&
($shiprocket_order['data']['status_code'] != 4 ||
$shiprocket_order['data']['status'] !=
'PICKUP
SCHEDULED') &&
$shiprocket_order['data']['status'] != 'CANCELED' &&
$shiprocket_order['data']['status'] != 'CANCELLATION REQUESTED')
@endif
@if (isset($order_tracking_data[0]['is_canceled']) && $order_tracking_data[0]['is_canceled'] == 0)
{{-- @if (isset($order_tracking_data[0]['is_canceled']) && $order_tracking_data[0]['is_canceled'] == 1) --}}
@endif
@if (isset($order_tracking_data[0]['label_url']) && !empty($order_tracking_data[0]['label_url']))
Label
@else
@endif
@if (isset($order_tracking_data[0]['invoice_url']) && !empty($order_tracking_data[0]['invoice_url']))
Invoice
@else
@endif
@if (isset($order_tracking_data[0]['awb_code']) && !empty($order_tracking_data[0]['awb_code']))
@endif
@endif
@endif
@endif
@endif
@if ($order_detls[0]->is_shiprocket_order == 0)
Select Status
Received
Processed
Shipped
Delivered
@endif
@if ($order_detls[0]->is_shiprocket_order == '0')
Select Delivery Boy
@foreach ($delivery_res as $row)
delivery_boy_id == $row->id ? 'selected' : '' }}>
{{ $row->username }}
@endforeach
@else
@csrf
@php
$total_items = count($items);
@endphp
{{ json_encode($items, JSON_FORCE_OBJECT) }}
Note: Make your pickup location associated with the order is
verified from Shiprocket
Dashboard and then in admin panel
. If it is not verified you will not be able to generate AWB
later on.
is not verified, you will not be able to generate AWB later on.
@endif
@if ($order_detls[0]->is_shiprocket_order == 0)
Update
@endif
@endsection