<form role="form" id="form-add-bike"> <div class="form-body"> <div class="row"> <div class="col-md-6"> <div class="form-group"><label>Chọn nhà<span class="required" aria-required="true"> (*) </span></label> <select class="form-control" name="hostel_id" id="hostel_id" required> <option value="">Vui lòng chọn</option> <?php $__currentLoopData = $hostels; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $hostel): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option <?php if(isset($item)): ?> <?php if($item->room->hostel_id == $hostel->id): ?> selected <?php endif; ?> <?php endif; ?> value="<?php echo e($hostel->id); ?>"><?php echo e($hostel->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> </div> <div class="col-md-6"> <div class="form-group"><label>Chọn phòng<span class="required" aria-required="true"> (*) </span></label> <select class="form-control" name="room_id" id="room_id" required> <?php if(isset($item)): ?> <?php $rooms = \App\Models\Room::query()->where('hostel_id', $item->room->hostel_id)->get()?> <?php $__currentLoopData = $rooms; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $room): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($room->id); ?>"><?php echo e($room->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endif; ?> </select> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="form-group"><label>Chọn khách<span class="required" aria-required="true"> (*) </span></label> <select class="form-control" name="renter_id" id="renter_id"> <?php if(isset($item)): ?> <?php $renters = \App\Models\Renter::query()
->where('room_id', $item->room_id)->where('status', \App\Models\Renter::LIVING)
->get()?> <?php $__currentLoopData = $renters; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $renter): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($renter->id); ?>"><?php echo e($renter->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endif; ?> </select> </div> <div class="form-group"><label>Loại xe<span class="required" aria-required="true"> (*) </span></label> <select class="form-control" name="type" id="type"> <option <?php if(isset($item)): ?> <?php if($item->type == \App\Models\RenterRoom::BICYCLE ): ?> selected <?php endif; ?> <?php endif; ?> value="<?php echo e(\App\Models\RenterRoom::BICYCLE); ?>">Xe đạp</option> <option <?php if(isset($item)): ?> <?php if($item->type == \App\Models\RenterRoom::ELECTRIC_BIKE): ?> selected <?php endif; ?> <?php endif; ?> value="<?php echo e(\App\Models\RenterRoom::ELECTRIC_BIKE); ?>">Xe điện</option> <option <?php if(isset($item)): ?> <?php if($item->type == \App\Models\RenterRoom::MOTORBIKE): ?> selected <?php endif; ?> <?php endif; ?> value="<?php echo e(\App\Models\RenterRoom::MOTORBIKE); ?>">Xe máy</option> <option <?php if(isset($item)): ?> <?php if($item->type == \App\Models\RenterRoom::CAR): ?> selected <?php endif; ?> <?php endif; ?> value="<?php echo e(\App\Models\RenterRoom::CAR); ?>">Xe ô tô</option> </select> </div> <div class="form-group"><label>Tên xe<span class="required" aria-required="true"> (*) </span></label> <input name="name" <?php if(isset($item)): ?> value="<?php echo e($item->name); ?>" <?php endif; ?> class="form-control" required> </div> <div class="form-group"><label>Biển kiểm soát<span class="required" aria-required="true"> (*) </span></label> <input name="bks" <?php if(isset($item)): ?> value="<?php echo e($item->bks); ?>" <?php endif; ?> class="form-control" required > </div> <div class="form-group"> <label class="">Ảnh</label> <div class=""> <div class="fileinput fileinput-new" data-provides="fileinput" style="width: 300px"> <div class="fileinput-new thumbnail" style="width: 250px; height: 200px;"> <?php if(isset($item)): ?> <img src="/files/<?php echo e($item->image); ?>" alt=""> <?php else: ?> <img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&amp;text=no+image" alt=""> <?php endif; ?> </div> <div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 10px;"></div> <div> <span class="btn default btn-file"> <span class="fileinput-new"> Chọn ảnh </span> <span class="fileinput-exists"> Thay đổi </span> <input type="file" name="image"> </span> <a href="javascript:;" class="btn red fileinput-exists" id="clear-input-file" data-dismiss="fileupload"> Xóa </a> </div> </div> </div> </div> </div> </div> </div> <?php if(isset($item)): ?> <input type="hidden" name="id" value="<?php echo e($item->id); ?>"> <?php endif; ?> </form>