@extends('layouts.app') @section('breadcrumb') Ecompk Connector / Sales Orders / {{ $sales_order->order_name }} @endsection @section('content')
@if($sales_order_address_shipping->country_code != 'PK' && $sales_order->gateway == 'Cash on Delivery (COD)') @endif @php $has_addons = false; $allowed_edit_address_users = [ 'najam@ecompk.com', 'saqib@ecompk-connector.com', 'admin@ecompk.com', ]; $can_edit_address = in_array(strtolower(trim(Auth::user()->email)), $allowed_edit_address_users); foreach($sales_order_items as $sales_order_item){ if($sales_order_item->addons){ $has_addons = true; break; } } @endphp @php $assigned_courier = []; $courierQuery = App\BrandCourier::where('brand_id',$sales_order->brand_id) ->join('couriers','couriers.id','brand_couriers.courier_id') ->select('brand_couriers.*','couriers.name') ->get()->toArray(); $userCity = strtolower($sales_order_address_shipping->city); foreach($courierQuery as $key => $courierData) { $cityName = strtolower($courierData['assign_cities']); $cityArray = explode(",",$cityName); if( in_array($userCity,$cityArray) ){ $assigned_courier['courier_id'] = $courierData['courier_id']; $assigned_courier['name'] = $courierData['name']; } } @endphp @if($itemsMissed != true)
@if(is_null($sales_order->previous_order_name))

{{ $sales_order->order_name }}

@else

{{ $sales_order->previous_order_name }}   {{ $sales_order->order_name }}

@endif @if(Auth::user()->role_id != 16) @php $unverify_btn_status = array('Verified'); $verify_btn_status = array('Unverified', 'SMS Verified', 'IVR Verified'); $cancel_btn_status = array('In Process', 'Canceled', 'Shipped'); $ship_btn_status = array('In Process', 'Partially Shipped'); $paid_order_status = array('Credit Card', 'Credit Card (MCB)', 'Credit Card (Gateway 1)', 'Credit Card (Gateway 2)', 'Credit Card / Debit Card (JazzCash)'); $customer_reasons = array('No Answer','Cancelled by Cust','Wrong Contact','Powered Off','SOP Cancelled'); $update_reason_brands = [2,3,4]; @endphp @if(in_array($sales_order->gateway, $paid_order_status)) @if(!session()->has('message')) @if($sales_order->tags == 'Not Paid') @if($sales_order_address_shipping->country_code == 'PK')
@csrf
@endif @endif @endif @if($sales_order->tags != 'Canceled') @if(!in_array($sales_order->brand_id,$update_reason_brands)) Cancel Order @else @endif @endif @if($sales_order->tags == 'On Hold') Un Hold @else @if($sales_order->tags != 'Canceled') Hold @endif @endif @else @if(!in_array($sales_order->tags, $cancel_btn_status)) @if(!in_array($sales_order->brand_id,$update_reason_brands)) Cancel Order @else @endif @endif @if(in_array($sales_order->brand_id , $update_reason_brands)) @if(in_array($sales_order->tags, $customer_reasons))
@csrf
Verify Order @endif @endif @if($sales_order_address_shipping->country_code != 'PK' && $sales_order->gateway == 'Cash on Delivery (COD)') @else @if(in_array($sales_order->tags, $verify_btn_status)) @if(!$has_addons) @if($orderCouponCheck) Verify Order @endif @if(in_array($sales_order->brand_id , $update_reason_brands))
@csrf
@endif @else Recreate Order @endif @endif @php $brand_details = \App\Brand::where('id', $sales_order->brand_id)->first(); @endphp @if($sales_order->tags == 'Unverified' && $brand_details->ivr_trigger == 'Yes') Send IVR Call @endif @if(in_array($sales_order->tags, $unverify_btn_status)) Unverify Order @endif @endif @endif @php $allowed_to_book = [1,6, 10, 11, 12, 15, 3]; @endphp @if(in_array(Auth::user()->role_id, $allowed_to_book)) @if(in_array($sales_order->tags, $ship_btn_status)) @php $direct_booked_orders = DB::table('direct_booked_orders')->where([['brand_id', $sales_order->brand_id], ['order_name', $sales_order->order_name]])->first(); @endphp @if(is_null($direct_booked_orders)) @if(isset($assigned_courier['courier_id'])) @endif @endif @endif @endif
@else @endif
@if(session()->has('message'))