
<div class="page-content-wrapper">
    <div class="page-content all">
        <div class="row">
            <div class="col-md-12">
                <div class="portlet box blue">
                    <div class="portlet-title" style="height: 5px">
                        <div class="caption">
                            <i class="fa fa-edit"></i> Devices
                        </div>
                        <div class="actions">

                            <a href="javascript:;" class="btn btn-default btn-sm" id="deviceAdd">
                                <i class="fa fa-plus"></i> Add New  </a>


                        </div>

                    </div>
                    <div class="portlet-body" >
                        <div class="table-toolbar">

                        </div>
                        <table class="table table-striped table-hover table-bordered rtl">
                            <thead>
                                <tr>
                                    <th class="wds20">   رقم الجهاز  </th>
                                    <th class="wds35">     اسم الخدمة  </th>
                                    <th class="wds20">     الدور </th>
                                    <th class="wds20">   رقم الغرفة   </th>
                                    <th>     Delete   </th>
                                </tr>
                            </thead>
                            <tbody  id="devicesContainer" >

                                {foreach $devices as $device}
                                <tr>
                                    <td>
                                        <input type="text" class="form-control updateElement positiveNo"  id="device_name{$device->id}" 
                                               data-id="{$device->id}"  data-colName="device_name" 
                                               data-tableName="devices"  value="{$device->device_name}"/>
                                    </td>
                                    <td>
                                        <select class="form-control select2h updateElement deviceLocation " data-placeholder="اختر "
                                                id="location{$device->id}" data-id="{$device->id}" 
                                                data-colName="location"   data-tableName="devices" >
                                            <option value="">اختر</option>
                                            {foreach $locations as $location }
                                            <option value="{$location->id}" {if $device->location eq $location->id}selected{/if} > 
                                                {$location->name}</option>
                                            {/foreach}
                                        </select>
                                    </td>
                                    <td>
                                        <select class="form-control select2h updateElement " data-placeholder="اختر دور"
                                                id="floor_no{$device->id}" data-id="{$device->id}" 
                                                data-colName="floor_no"   data-tableName="devices" >
                                            <option value="">اختر</option>
                                            {foreach $floors as $floor }
                                            <option value="{$floor->id}" {if $device->floor_no eq $floor->id}selected{/if} > 
                                                {$floor->name}</option>
                                            {/foreach}
                                        </select>
                                    </td>
                                    <td>
                                        <div id="roomNoDiv{$device->id}"  {if $device->location !=  2}   style="display: none;" {/if} >
                                            <select class="form-control select2h updateElement " data-placeholder="اختر دور"
                                                    id="room_no{$device->id}" data-id="{$device->id}"   data-colName="room_no"
                                                    data-tableName="devices" >
                                                <option value="">اختر</option>
                                                {foreach $rooms as $room }
                                                <option value="{$room->id}" {if $device->room_no eq $room->id}selected{/if} > 
                                                    {$room->name}</option>
                                                {/foreach}
                                            </select>
                                        </div>
                                    </td>
                                    <td>
                                        <a class="btn grey-cascade btn-xs deletemsgEX" data-id="{$device->id}" 
                                           style=" float: left;" href="#" data-link="addinvestigation" 
                                           data-fn="del" data-tableName="devices">
                                            <i class="fa fa-close"></i>
                                        </a>
                                    </td>
                                </tr> 

                                {/foreach}
                            </tbody>
                        </table>



                    </div>
                </div>
            </div>
        </div>
    </div>

</div>

<input type="hidden" id="controllName" value="adddevices"/>



