
<div class="page-content-wrapper">
    <div class="page-content">
        <div class="row">
            <div class="col-md-12 clinick invz" id="gprinModel">
                <!-- BEGIN EXAMPLE TABLE PORTLET-->
                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption">
                            <i class="fa fa-user"></i>Regions
                        </div>
                        <div class="actions">
                            <a href="#" class="btn btn-default btn-sm" id="addRegionControl"> Add </a>
                        </div>
                    </div>
                    <div class="portlet-body all">
                        <input type="hidden" id="controllName" value="{$controllname}"/>
                        <input type="hidden" id="regions" value="1"/>
                        <div class="row">
                            <div id="ultrasoundgynaDiv">
                                <div class="row">
                                    <div class="portlet-body form">
                                        <div class="form-body"  id="regionsContainer">
                                            {assign var=i value=1}
                                            {foreach $regions as $data}
                                            <table  class="table table-bordered rtl"  id="regionTable_{$data->id}">
                                                <tbody>
                                                    <tr>
                                                        <th class="txtc wds15">المنطقة الرئيسية  </th>
                                                        <td>
                                                            <input type="text" class="form-control updateElement"    data-tableName="regions"
                                                                   data-colName="name" data-id="{$data->id}"   value='{$data->name}'>
                                                        </td>
                                                        <td  class="txtc wds4">
                                                            <a href="#" class="btn red fleft delTarget" data-id="{$data->id}" 
                                                               data-link="regions"  data-tableName="regions" data-container="regionTable_{$data->id}"
                                                               data-fun="del" style="padding: 2px 0px;width: 100%">
                                                                <i class="fa fa-times" ></i>
                                                            </a>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th class="txtc">المناطق الفرعية 
                                                            <a href="#" class="btn green-haze btn-sm addSubRegion"  
                                                               data-regionId="{$data->id}"  > + </a>
                                                        </th>
                                                        <td class="txtc" colspan="2" style="padding: 5px;">
                                                            <div  class="row"   id="subRegionContainer_{$data->id}">
                                                                {foreach $data->subRegions as $one}
                                                                <div class="col-md-3" id="subRegionDiv{$one->id}">
                                                                    <a class="btn red btn-xs wds7 delTarget "  data-id="{$one->id}" 
                                                                       data-link="regions"  data-tableName="sub_regions"    data-fun="del"
                                                                       style="padding: 0; margin-left: -25px; margin-top: -11px;"  href="#"   
                                                                       data-container="subRegionDiv{$one->id}">
                                                                        <i class="fa fa-close"></i> 
                                                                    </a>
                                                                    <input type="text" class="form-control wds90 updateElement"    
                                                                           data-tableName="sub_regions"   data-colName="name" 
                                                                           data-id="{$one->id}"   value="{$one->name}" style="display: inline;">
                                                                </div>
                                                                {/foreach}
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                            {capture assign=i}{$i+1}{/capture}
                                            {/foreach}
                                        </div>
                                    </div>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>   
    </div> 
</div>