

<button type="button" class="btn btn-xs blue fright" id="addRowOrg" data-notAll="{$notAll}"
        data-tableName="organizations" data-selectId="organization"><i class="fa fa-plus"></i> إضافة</button>
<input type="hidden" id="orgItr" value="{count($alldata)}">
<div class="clearfix"></div>

<table  dir="rtl" class="wds100">
    <thead>
        <tr>
            <th class="txtc" rowspan="2">الاسم</th>
            {if $notAll != 1 }
            <th class=" txtc wds20" rowspan="2"> الخصم  </th>
            <th class="txtc wds20" rowspan="2">نسبة المركز </th>
            <th class="txtc wds15" colspan="2">نوع  الخصم</th>
            {/if}
            <th class="txtc wds7" rowspan="2">حذف</th>
        </tr>
        {if $notAll != 1 }
        <tr>
            <th class="txtc">قيمة  </th>
            <th class="txtc"> %  </th>
        </tr>
        {/if}
    </thead>
    <tbody  id="orgContainer">
        {assign var=i value=1}
        {foreach $alldata as $mydata}
        <tr>
            <td >
                <input type="text" class="form-control updateElement"  id="organization_name{$i}" 
                       data-itr="{$i}" data-id="{$mydata->id}"  value='{$mydata->organization_name}' 
                       data-colName="organization_name" data-tableName="organizations" >
            </td>
            {if $notAll != 1 }
            <td >
                <input type="text" class="form-control updateElement"  id="organization_discount{$i}" 
                       data-itr="{$i}" data-id="{$mydata->id}"  value='{$mydata->organization_discount}' 
                       data-colName="organization_discount" data-tableName="organizations" >
            </td>
            <td >
                <input type="text" class="form-control updateElement"  id="center_discount{$i}" 
                       data-itr="{$i}" data-id="{$mydata->id}"  value='{$mydata->center_discount}' 
                       data-colName="center_discount" data-tableName="organizations" >
            </td>
            <td class="txtc" > 
                <input type="radio"  name="discountType{$i}"   value="0"  data-itr="{$i}" data-id="{$mydata->id}"
                       {if $mydata->discount_type != 1 }checked {/if}  class=" updateElement"
                data-colName="discount_type" data-tableName="organizations">  
            </td>
            <td class="txtc" > 
                <input type="radio"  name="discountType{$i}"  value="1" data-itr="{$i}" data-id="{$mydata->id}"
                       {if $mydata->discount_type == 1 }checked {/if}    class=" updateElement"
                data-colName="discount_type" data-tableName="organizations">   
            </td>
            {/if}
            <td>
                <a href="#" class="btn red fleft deleteelement" data-id="{$mydata->id}" data-link="visits" 
                   data-fun="delAjax" data-tableName="organizations"  style="padding: 2px 0px;width: 100%">
                    <i class="fa fa-times" ></i>
                </a>

            </td>
        </tr>

        {capture assign=i}{$i+1}{/capture}
        {/foreach}
    </tbody>
</table>