@php
$attribute = \App\Models\ServiceAtributes::where('name', 'LIKE', '%' . $field->field_label . '%')->where('service_id', $booking->service_id)->first();
$fieldLabel = $field->field_label;
if ($attribute ) {
// If label matches, fetch the value from ServiceAtributesValue
$attributeValue = \App\Models\ServiceAtributesValue::where('attribute_id', $attribute->id)
->where('id',$field->value)
->where('service_id', $booking->service_id) // Assuming the service_id is available from the booking
->first();
// If we have an attribute value, use that
if ($attributeValue) {
$fieldValue = $attributeValue->name;
if ($attributeValue->price > 0) {
$fieldValue .= " (Price : AED " . number_format($attributeValue->price, 2) . ")";
}
} else {
$fieldValue = $field->value; // Fallback to field value if no matching attribute value is found
}
} else {
// No match, just use the field value as it is
$fieldValue = $field->value;
}
@endphp
{{ $fieldLabel }} |
@php
$filePath = 'storage/' . $fieldValue;
$fileExtension = pathinfo($fieldValue, PATHINFO_EXTENSION);
@endphp
@if(Str::endsWith($fieldValue, ['.jpg', '.jpeg', '.png', '.gif', '.webp']))
@elseif(in_array($fileExtension, ['pdf', 'doc', 'docx']))
View File
@else
{{ $fieldValue }}
@endif
|
@endforeach