@php $scopeOfWorks = \App\Models\ScopeOfWork::all(); $areas = \App\Models\Area::all(); $setting = \App\Models\Setting::where('name', 'IfAddTierManually')->first(); $uoms = \App\Models\Uom::select('id', 'name')->get(); $scopeOfWorkItems = ''; $areaItems = ''; foreach ($scopeOfWorks as $item){ $scopeOfWorkItems .= ''; } foreach ($areas as $item){ $areaItems .= ''; } $template_quotation = \App\Models\TemplateQuotation::find(request()->route('id')); $template_quotationItem = \App\Models\TemplateQuotationItem::where('template_quotation_id', $template_quotation->id) ->where('revision', 'like', '%REV%') ->orderBy('created_at', 'desc')->first(); $template_quotationItemList = \App\Models\TemplateQuotationItemList::where('template_quotation_id', $template_quotation->id)->where('template_quotation_item_id', $template_quotationItem->id)->orderBy('id', 'asc')->get(); $totalCur = $template_quotationItemList->count(); $curItems = ''; $rowRT1IdxTemp = 0; $rowRT2IdxTemp = 0; $rowRT1Idx = 1; $rowRT2Idx = 1; $rowRT3Idx = 1; $rowRT4Idx = 1; $rowStepNum = 1; $itTier1 = 0; $itTier2 = 0; $itTier3 = 0; $endOfTier3 = 0; $marginIndex = 0; $amountTotal = 0; function mapItemMargin($margins, $rowRT3Idx, $sales_item_children_id, $marginIndex, $quantity, $isAmount=false){ $total = 0; $getTotalSum = 0; $getTotalSumWithMargin = 0; $marginChillIndex = 0; $html = null; $iMargin = 1; $html .= '
'; if ($margins->count() > 0) { foreach ($margins as $margin) { $getTotalSum += $margin->price; $getTotalSumWithMargin += ($margin->price / ( 1 - $margin->margin_percentage / 100 )) * $margin->quantity; $html .= '
is_from_system ? 'readonly': '').'/>
'; $marginChillIndex++; $iMargin++; } } else { if ($isAmount) { $getTotalSum = $isAmount; $getTotalSumWithMargin = $isAmount; } $html .= '

Item not found, please add material first.

'; } $getTotalSum = $quantity * round($getTotalSum); $getTotalSumWithMargin = $quantity * round($getTotalSumWithMargin); $html .= '
'; return $html; } function mapUomFunc($uoms, $selected=false) { $htmlUom = ''; if ($uoms && $uoms->count() > 0){ foreach ($uoms as $uom) { $htmlUom .= ''; } } return $htmlUom; } if($template_quotationItemList->count()>0){ $i = 0; foreach ($template_quotationItemList as $key => $current){ if ($current->tier_level==1 && $current->is_area != true) { $rowStepNum++; if ($rowRT1IdxTemp > 0) { $curItems .= ''; $curItems .= ''; $rowRT1IdxTemp = 0; } if ($rowRT2IdxTemp > 0) { $curItems .= ''; $curItems .= ''; $rowRT2IdxTemp = 0; } } if ($current->tier_level==1 && $current->is_area != true) { $amountTotal += $current->amount; $curItems .= '
'; $curItems .= '
Amount ($)
'; $curItems .= '
'; $curItems .= '
'; $rowRT1IdxTemp++; $rowRT1Idx++; } if ($current->tier_level==2 && $current->is_area != true) { if ($rowRT2IdxTemp > 0) { $curItems .= '
'; $curItems .= ''; $rowRT2IdxTemp = 0; } } if ($current->tier_level==2 && $current->is_area != true) { $curItems .= '
'; $curItems .= '
Amount ($)
is_modified? 'checked' : '').'>
'; $curItems .= '
'; $curItems .= '
'; $rowRT2IdxTemp++; $rowRT2Idx++; } if ($current->tier_level==3 && $current->is_area != true) { $curItems .= '
UOM
QTY
Amount ($)
'.mapItemMargin(\App\Models\TemplateQuotationItemMargin::where('template_quotation_item_list_id', $current->id)->get(), $rowRT3Idx, $current->template_quotation_item_id, $marginIndex, $current->quantity, $current->amount).'
'; $rowRT3Idx++; } if ($current->is_area) { $attrIdArea = ($current->tier_level == 1 ? 'areaT1' : ($current->tier_level == 2 ? 'areaT2' : 'areaT3')); $curItems .= '
'; $curItems .= '
This is Area section
'; $curItems .= '
'; } if(++$i === $template_quotationItemList->count()) { $curItems .= '
'; $curItems .= '
'; $rowRT2IdxTemp = 0; $curItems .= ''; $curItems .= '
'; $rowRT1IdxTemp = 0; $rowStepNum++; } $marginIndex++; } } else { $curItems .= '

Item Not Found

click add new item button below to add new requirement field
'; } @endphp

Requirement

{{$template_quotation->status != 'draft' ? 'Current Version: '.$template_quotationItem->revision : ''}}
{{-- Items --}}