@php
$price = $config['form']['navbar']['price']['input'];
$k_last = array_key_last($price);
@endphp
@foreach ($price as $k_p => $p)
@if (empty($p['status']))
@continue
@endif
@if (str_contains($k_p, 'row_'))
@foreach ($p as $k_i => $i)
@if (empty($i['status']))
@continue
@endif
@php
$chk_req = !empty($i['validate']);
$label = $i['label'] ?? __("field.{$k_i}");
$readonly = !empty($i['readonly']);
$split_key = explode('_', $k_i);
$member_type_id = [
'general' => 1,
'wholesale' => 2,
'pharmacy' => 3,
];
@endphp
@if (in_array($i['type'], ['input', 'number']))
@php
$price_name = $type_name[$split_key[1]] ?? '';
$label .= $price_name;
if (!empty($data)) {
$value =
$data
->prices()
->where('member_type_id', $member_type_id[$split_key[1]])
->first()->{$split_key[0]} ?? null;
} else {
$value = null;
}
@endphp
@elseif ($i['type'] == 'selection')
@php
if (!empty($data)) {
$chk_option =
$data
->prices()
->where('member_type_id', $member_type_id[$split_key[2]])
->first()->discount_type ?? null;
} else {
$chk_option = null;
}
@endphp
@if (!empty($i['options']))
@foreach ($i['options'] as $k_o => $o)
@endforeach
@endif
@endif
@endforeach
@endif
@endforeach