@php $quarters = isset($quarters) ? $quarters : [1, 2] @endphp @php $quarterTargets = isset($quarterTargets) ? $quarterTargets : false @endphp @foreach($quarters as $quarter) @php $id = 'target_q'.$quarter @endphp @php $name = $id @endphp @php $value = null @endphp @if ($quarterTargets && isset($quarterTargets[$quarter])) @php $quarterObj = $quarterTargets[$quarter] @endphp @php $name = 'target_q'.$quarterObj->id @endphp @php $value = number_format($quarterObj->target) @endphp @php $months = $quarterObj->children @endphp @php $months = $months->keyBy('month') @endphp @endif @php $label_id = 'label_target_q'.$quarter @endphp
Quarter {{ $quarter }}
{!! Form::text($name, $value, ['class'=>'form-control', 'onkeyup' => "this.value=AddCommasAndSplitTarget(this.value, 'quarterly', {$quarter}, 'check');", 'placeholder'=>'Target', 'id'=> $id, 'required' => 'required']) !!}
@for ($i = 1; $i <= 3; $i++) @php $month_no = ($quarter - 1) * 3 + $i @endphp @php $id = 'target_m'.$month_no @endphp @php $label_id = 'label_target_m'.$month_no @endphp @php $name = $id @endphp @php $value = null @endphp @if (isset($months) && isset($months[$month_no])) @php $monthsObj = $months[$month_no] @endphp @php $name = 'target_m'.$monthsObj->id @endphp @php $value = $monthsObj->target @endphp @endif
Month {{ $month_no }}
{!! Form::text($name, $value, ['class'=>'form-control', 'onkeyup' => "this.value=AddCommasAndSplitTarget(this.value, 'monthly', {$quarter}, 'check');", 'placeholder'=>'Target', 'id'=> $id, 'required' => 'required']) !!}
@endfor @endforeach