{{-- Displaying Laravel Validation Errors: https://laravel.com/docs/9.x/validation#quick-displaying-the-validation-errors --}}
{{-- Determining If An Item Exists In The Session (using has() method): https://laravel.com/docs/9.x/session#determining-if-an-item-exists-in-the-session --}}
@if (Session::has('error_message'))
@if (!empty($orderDetails['coupon_code']))
@endif
@if (!empty($userDetails['address']))
@endif
@if (!empty($userDetails['city']))
@endif
@if (!empty($userDetails['state']))
@endif
@if (!empty($userDetails['country']))
@endif
@if (!empty($userDetails['pincode']))
@endif
@if (!empty($orderDetails['address']))
@endif
@if (!empty($orderDetails['city']))
@endif
@if (!empty($orderDetails['state']))
@endif
@if (!empty($orderDetails['country']))
@endif
@if (!empty($orderDetails['pincode']))
@endif
{{-- Show the "Update Order Status" History/Log in admin/orders/order_details.blade.php --}} @foreach ($orderLog as $key => $log) @php // echo '
Courier Name: {{ $getItemDetails['courier_name'] }} @endif @if (!empty($getItemDetails['tracking_number']))
Tracking Number: {{ $getItemDetails['tracking_number'] }} @endif @endif
{{ date('Y-m-d h:i:s', strtotime($log['created_at'])) }}
@endforeach @else {{-- If the authenticated/logged-in user is 'vendor', restrict the "Update Order Status" feature --}} This feature is restricted. @endif
{{-- Footer --}}
@include('admin.layout.footer')
Error: {{ Session::get('error_message') }}
@endif
{{-- Displaying Laravel Validation Errors: https://laravel.com/docs/9.x/validation#quick-displaying-the-validation-errors --}}
@if ($errors->any())
{{-- Error: {{ Session::get('error_message') }} --}}
@foreach ($errors->all() as $error)
{{ $error }}
@endforeach
@endif
{{-- Displaying The Validation Errors: https://laravel.com/docs/9.x/validation#quick-displaying-the-validation-errors AND https://laravel.com/docs/9.x/blade#validation-errors --}}
{{-- Determining If An Item Exists In The Session (using has() method): https://laravel.com/docs/9.x/session#determining-if-an-item-exists-in-the-session --}}
{{-- Our Bootstrap success message in case of updating admin password is successful: --}}
{{-- Displaying Success Message --}}
@if (Session::has('success_message'))
Success: {{ Session::get('success_message') }}
@endif
Order Details
Back to Orders
Order Details
Customer Details
Delivery Address
Update Order Status
{{-- determined by 'admin'-s ONLY, not 'vendor'-s --}} {{-- Allowing the general "Update Order Status" feature for 'admin'-s ONLY, and restricting it from 'vendor'-s ('vendor'-s can update their Ordered Products item statuses ONLY (at this page bottom)) --}} @if (Auth::guard('admin')->user()->type != 'vendor') {{-- If the authenticated/logged-in user is 'admin', allow "Update Order Status" feature --}} {{-- Accessing Specific Guard Instances: https://laravel.com/docs/9.x/authentication#accessing-specific-guard-instances --}} {{-- Retrieving The Authenticated User: https://laravel.com/docs/9.x/authentication#retrieving-the-authenticated-user --}} {{-- Note: The `order_statuses` table contains all kinds of order statuses (that can be updated by 'admin'-s ONLY in `orders` table) like: pending, in progress, shipped, canceled, ...etc. In `order_statuses` table, the `name` column can be: 'New', 'Pending', 'Canceled', 'In Progress', 'Shipped', 'Partially Shipped', 'Delivered', 'Partially Delivered' and 'Paid'. 'Partially Shipped': If one order has products from different vendors, and one vendor has shipped their product to the customer while other vendor (or vendors) didn't!. 'Partially Delivered': if one order has products from different vendors, and one vendor has shipped and DELIVERED their product to the customer while other vendor (or vendors) didn't! // The `order_item_statuses` table contains all kinds of order statuses (that can be updated by both 'vendor'-s and 'admin'-s in `orders_products` table) like: pending, in progress, shipped, canceled, ...etc. --}}{{-- Show the "Update Order Status" History/Log in admin/orders/order_details.blade.php --}} @foreach ($orderLog as $key => $log) @php // echo '
', var_dump($log), ''; // echo '
', var_dump($log['orders_products']), ''; // echo '
', var_dump($key), ''; // echo '
', var_dump($log['orders_products'][$key]), ''; // echo '
', var_dump($log['orders_products'][$key]['product_code']), ''; @endphp {{ $log['order_status'] }} {{-- Shiprocket API integration --}} @if ($orderDetails['is_pushed'] == 1) {{-- If the Order has been pushed to Shiprocket, state this --}} (Order Pushed to Shiprocket) @endif {{-- Note: There are two types of Shipping Process: "manual" and "automatic". "Manual" is in the case like small businesses, where the courier arrives at the owner warehouse to to pick up the order for shipping, and the small business owner takes the shipment details (like courier name, tracking number, ...) from the courier, and inserts those details themselves in the Admin Panel when they "Update Order Status" Section (by an 'admin') or "Update Item Status" Section (by a 'vendor' or 'admin') (in admin/orders/order_details.blade.php). With "automatic" shipping process, we're integrating third-party APIs and orders go directly to the shipping partner, and the updates comes from the courier's end, and orders are automatically delivered to customers --}} {{-- Show if the order status previewed in "Update Order Status" Section in admin/orders/order_details.blade.php is whether updated from "Update Item Status" Section (which can updated by either `vendor`-s or `admin`-s) (in case the `order_item_id` column is NOT zero 0 (it is 0 zero in case of updated by `admin`-s only in the "Update Order Status" Section)) or from "Update Order Status" Section (can be updated by `admin`-s ONLY). Check updateOrderItemStatus() method in Admin/OrderController.php --}} @if (isset($log['order_item_id']) && $log['order_item_id'] > 0) {{-- In case the "Item Status" Section is updated by a 'vendor' or 'admin', the `order_item_id` column in `orders_logs` table references (is a foreign key to) the `id` column in `orders_products` table, otherwise, it takes 0 zero as a value (in case of 'admin'). Check updateOrderItemStatus() method in Admin/OrderController.php --}} @php $getItemDetails = \App\Models\OrdersLog::getItemDetails($log['order_item_id']); @endphp - for item {{ $getItemDetails['product_code'] }} @if (!empty($getItemDetails['courier_name']))
Courier Name: {{ $getItemDetails['courier_name'] }} @endif @if (!empty($getItemDetails['tracking_number']))
Tracking Number: {{ $getItemDetails['tracking_number'] }} @endif @endif
{{ date('Y-m-d h:i:s', strtotime($log['created_at'])) }}
@endforeach @else {{-- If the authenticated/logged-in user is 'vendor', restrict the "Update Order Status" feature --}} This feature is restricted. @endif
Ordered Products
{{-- Order products info table --}}
Product Image | Code | Name | Size | Color | Unit Price | Product Qty | Total Price | @if (\Illuminate\Support\Facades\Auth::guard('admin')->user()->type != 'vendor') {{-- If the authenticated/logged-in user is an 'admin', 'superadmin' or 'subadmin', NOT 'vendor' --}} {{-- Accessing Specific Guard Instances: https://laravel.com/docs/9.x/authentication#accessing-specific-guard-instances --}}Product by | @endifCommission | {{-- Vendor's Commission percentage must be paid on every product sold to the Website Owner --}}Final Amount | {{-- Vendor's profit after paying (deducting) the Commission percentage --}}Item Status | {{-- can be updated by both 'vendor'-s and 'admin'-s. This is in contrast to 'Update Order Status' which can be updated by 'admin'-s ONLY --}} {{-- Note: The `order_statuses` table contains all kinds of order statuses (that can be updated by 'admin'-s ONLY in `orders` table) like: pending, in progress, shipped, canceled, ...etc. In `order_statuses` table, the `name` column can be: 'New', 'Pending', 'Canceled', 'In Progress', 'Shipped', 'Partially Shipped', 'Delivered', 'Partially Delivered' and 'Paid'. 'Partially Shipped': If one order has products from different vendors, and one vendor has shipped their product to the customer while other vendor (or vendors) didn't!. 'Partially Delivered': if one order has products from different vendors, and one vendor has shipped and DELIVERED their product to the customer while other vendor (or vendors) didn't! // The `order_item_statuses` table contains all kinds of order statuses (that can be updated by both 'vendor'-s and 'admin'-s in `orders_products` table) like: pending, in progress, shipped, canceled, ...etc. --}}|||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@php $getProductImage = \App\Models\Product::getProductImage($product['product_id']); @endphp | {{ $product['product_code'] }} | {{ $product['product_name'] }} | {{ $product['product_size'] }} | {{ $product['product_color'] }} | {{ $product['product_price'] }} | {{ $product['product_qty'] }} | @if ($product['vendor_id'] > 0) {{-- if the product belongs to a 'vendor', not 'admin' --}} @if ($orderDetails['coupon_amount'] > 0) {{-- If there's a Coupon Code used --}} @if (\App\Models\Coupon::couponDetails($orderDetails['coupon_code'])['vendor_id'] > 0) {{-- if a Coupon Code has been used, and this Coupon Code belongs to a 'vendor', not 'admin' (Because in `coupons` table, if the `vendor_id` column is 1 one, this means that the Coupon Code is added by a 'vendor', not 'admin', and if the `vendor_id` column is 0 zero, this means that the Coupon Code is added by an 'admin', not 'vendor') --}} @php // dd(\App\Models\Coupon::couponDetails($orderDetails['coupon_code'])['vendor_id']); @endphp {{ $total_price = ($product['product_price'] * $product['product_qty']) - $item_discount }} @else {{-- if a Coupon Code has been used, and this Coupon Code belongs to an 'admin', not 'vendor' (Because in `coupons` table, if the `vendor_id` column is 1 one, this means that the Coupon Code is added by a 'vendor', not 'admin', and if the `vendor_id` column is 0 zero, this means that the Coupon Code is added by an 'admin', not 'vendor') --}} {{ $total_price = $product['product_price'] * $product['product_qty'] }} @endif @else {{-- If there isn't a Coupon Code used --}} {{ $total_price = $product['product_price'] * $product['product_qty'] }} @endif @else {{-- if the product belongs to an 'admin', not 'vendor' --}} {{ $total_price = $product['product_price'] * $product['product_qty'] }} @endif | {{-- Total Price = Unit Price * Quantity --}} @if (\Illuminate\Support\Facades\Auth::guard('admin')->user()->type != 'vendor') {{-- If the authenticated/logged-in user is an 'admin', 'superadmin' or 'subadmin', NOT 'vendor' --}} {{-- Accessing Specific Guard Instances: https://laravel.com/docs/9.x/authentication#accessing-specific-guard-instances --}} @if ($product['vendor_id'] > 0) {{-- if the product belongs to a 'vendor' --}}Vendor | @elseAdmin | @endif @endif @if ($product['vendor_id'] > 0) {{-- if the product belongs to a 'vendor' --}}{{ $commission = round($total_price * $product['commission'] / 100, 2) }} | {{ $total_price - $commission }} | @else0 | {{ $total_price }} | @endif{{-- Note: The `order_statuses` table contains all kinds of order statuses (that can be updated by 'admin'-s ONLY in `orders` table) like: pending, in progress, shipped, canceled, ...etc. In `order_statuses` table, the `name` column can be: 'New', 'Pending', 'Canceled', 'In Progress', 'Shipped', 'Partially Shipped', 'Delivered', 'Partially Delivered' and 'Paid'. 'Partially Shipped': If one order has products from different vendors, and one vendor has shipped their product to the customer while other vendor (or vendors) didn't!. 'Partially Delivered': if one order has products from different vendors, and one vendor has shipped and DELIVERED their product to the customer while other vendor (or vendors) didn't! // The `order_item_statuses` table contains all kinds of order statuses (that can be updated by both 'vendor'-s and 'admin'-s in `orders_products` table) like: pending, in progress, shipped, canceled, ...etc. --}} |