@foreach($tagReports as $tagReport)
@php $untagged_asset_ids = DB::table('monitor_and_report')->where('id', $tagReport->id)->value('untagged_asset_ids'); $asset_ids = DB::table('monitor_and_report')->where('id', $tagReport->id)->value('asset_ids'); $total_tagged = count(json_decode($asset_ids)); $job_date = DB::table('job_log')->where('id', $tagReport->job_log_id)->value('job_date'); if($tagReport->asset_type === 'LIVESTOCK') $asset_name = DB::table('livestock_lists')->where('id', $tagReport->asset_list_id)->value('animal_name'); else $asset_name = DB::table('crop_lists')->where('id', $tagReport->asset_list_id)->value('plant_name'); if($tagReport->untagged_asset_ids === null) $total_untagged = 0; else $total_untagged = count(json_decode($untagged_asset_ids)); @endphp
@endforeach
@if($total_tagged === $total_untagged)
DELETE
@else
@endif