Planning List Table

Planning List

@php $row_index =0; @endphp @forelse ($order_details as $key =>$order_detail) @php $prev_level_ids =\App\Models\CourseLevel::find($order_detail->course_level_id)->product->course_levels()->where("level_order" ,"<", \App\Models\CourseLevel::find($order_detail->course_level_id)->level_order)->pluck("id"); // skip if the customer has previous levels waiting or open $first_od =\App\Models\OrderDetail::where("customer_id",$order_detail->customer_id) ->whereIn("status" ,["waiting"])->whereIn("course_level_id" , $prev_level_ids)->first(); $first_od_open_ids =\App\Models\OrderDetail::where("customer_id",$order_detail->customer_id) ->whereIn("status" ,["open"])->whereIn("course_level_id" , $prev_level_ids)->pluck("id"); // to remove not Confirmed open course customers $course_customer_prev_open_not_sure =null; if ( $first_od_open_ids->count()>0){ // Log::info("first_od_open_ids:" . json_encode( $first_od_open_ids)); $course_customer_prev_open_not_sure = \App\Models\CourseCustomer::whereIn("order_detail_id" , $first_od_open_ids ) ->where("customer_id",$order_detail->customer_id) ->where("confirmation", "!=" ,"Confirmed") ->first(); // Log::info("course_customer_prev_open_not_sure:" . json_encode( $course_customer_prev_open_not_sure)); if ( $course_customer_prev_open_not_sure) continue; } if ($first_od){ continue; }else{ $row_index++; } $the_direct_prev_level = \App\Models\CourseLevel::find($order_detail->course_level_id)->product->course_levels()->where("level_order" , \App\Models\CourseLevel::find($order_detail->course_level_id)->level_order -1)->first(); $course_customer_prev =null; if ( $the_direct_prev_level){ $the_prev_level_order_detail =\App\Models\OrderDetail::where("customer_id",$order_detail->customer_id)->where("status" ,"open")->where("course_level_id" , $the_direct_prev_level->id)->first(); // course_customer if ( $the_prev_level_order_detail) { $course_customer_prev = \App\Models\CourseCustomer::where("order_detail_id" , $the_prev_level_order_detail->id ) ->where("customer_id",$order_detail->customer_id) ->where("status","Open") ->first(); } } @endphp @if ($course_customer_prev) @php $bgc= ""; //Not Yet ,Not Sure not working now i will remove it if ($course_customer_prev->confirmation == 'Confirmed') { if ($course_customer_prev->course->course_sessions()->where("status" ,"completed")->count() >= $course_customer_prev->course->course_sessions->count()/2 ) { $bgc="background-color: lightgreen"; }else{ $bgc="background-color: lightcoral"; } } elseif ($course_customer_prev->confirmation == 'Not Yet') $bgc="background-color: lightsalmon" ; elseif ($course_customer_prev->confirmation == 'Not Sure') $bgc="background-color: lightblue"; @endphp @else @endif @empty @endforelse

#

Branch

Period

Course Level

Created At

Name

Code

Mobile

Course End

{{$row_index}}

{{($order_detail->branch_id)? \App\Models\Branch::find($order_detail->branch_id)->name : '-'}}

{{($order_detail->period_id)? $order_detail->period->name :"" }}

{{($order_detail->course_level_id)? \App\Models\CourseLevel::find($order_detail->course_level_id)->product->name .'-'. \App\Models\CourseLevel::find($order_detail->course_level_id)->name : '-'}}

{{($order_detail->created_at)? date_format(date_create($order_detail->created_at),'Y-m-d') : '-'}}

{{($order_detail->customer_id)? \App\Models\Customer::find($order_detail->customer_id)->name : '-'}}

{{($order_detail->customer_id)? \App\Models\Customer::find($order_detail->customer_id)->code : '-'}}

{{($order_detail->customer_id) ? \App\Models\Customer::find($order_detail->customer_id)->mobile : '-'}}

{{($course_customer_prev)?$course_customer_prev->course->end_date : '-'}}

{{$row_index}}

{{($order_detail->branch_id)? \App\Models\Branch::find($order_detail->branch_id)->name : '-'}}

{{($order_detail->period_id)? $order_detail->period->name :"" }}

{{($order_detail->course_level_id)? \App\Models\CourseLevel::find($order_detail->course_level_id)->product->name .'-'. \App\Models\CourseLevel::find($order_detail->course_level_id)->name : '-'}}

{{($order_detail->created_at)? date_format(date_create($order_detail->created_at),'Y-m-d') : '-'}}

{{($order_detail->customer_id)? \App\Models\Customer::find($order_detail->customer_id)->name : '-'}}

{{($order_detail->customer_id)? \App\Models\Customer::find($order_detail->customer_id)->code : '-'}}

{{($order_detail->customer_id) ? \App\Models\Customer::find($order_detail->customer_id)->mobile : '-'}}

Empty Result