{{-- @foreach ($rooms as $room) @php $error = null; if($room->getBedPlannings->count() > 0){ $error = __('obs.planning_exist_from').' '.date('d-m-Y', strtotime($room->getBedPlannings->first()->from_date)).' '.__('obs.to').' '.date('d-m-Y', strtotime($room->getBedPlannings->first()->to_date)); } @endphp @endforeach
{{ __('obs.sl') }} {{ __('obs.room_no') }} {{ __('obs.room_type') }} {{ __('obs.system_no_of_beds') }} {{ __('obs.no_of_beds') }}
{{ $loop->iteration }} {{ $room->room_number }} {{ $room->roomType->name }} {{ $room->number_of_beds }} @if($error) {!! $error !!} @else @endif
--}}
@foreach ($rooms as $room)
{{ $room->room_number }} @php $beds_of_the_room = $room->childRooms; $exclude_bed_ids = $plannings->where('from_room_id', $room->id)->where('bed_status', 1)->pluck('bed_id')->toArray(); $beds_of_the_room = $beds_of_the_room->whereNotIn('id', $exclude_bed_ids); $include_beds = $plannings->where('room_id', $room->id)->where('bed_status', 1)->pluck('getBed'); $include_bed_ids = $include_beds->pluck('id')->toArray(); $beds_of_the_room = $beds_of_the_room->merge($include_beds); $total_inactive = $plannings->where('from_room_id', $room->id)->where('bed_status', 0)->count(); @endphp {{ $beds_of_the_room->count()-$total_inactive }}
@foreach ($beds_of_the_room as $child_room) @php $common_bg_class = 'bg-primary'; $draggable_class = $transaction_type == 2 ? 'not-draggable' : ''; $is_inactive = $plannings->where('bed_id', $child_room->id)->where('bed_status', 0)->first(); if(in_array($child_room->id, $include_bed_ids)){ $draggable_class = 'not-draggable'; $common_bg_class = 'bg-secondary'; } if($is_inactive){ $common_bg_class = 'bg-dark'; $draggable_class = 'not-draggable'; } @endphp
id }} data-bed-no={{ $child_room->room_number }} from-room-id={{ $room->id }} from-room-no={{ $room->room_number }} style="cursor: pointer">
{{ $child_room->room_number }} @if($transaction_type == 2 && !in_array($child_room->id, $include_bed_ids) && !$is_inactive) @endif
@endforeach
@endforeach