
<div class="row">
    <div class="col-lg-6">
        <h3 style="text-align:center;">الملاك </h3>
        <table class="table table-bordered">
          {foreach $srealestateunitspaids as $srealestateunitspaid}
          <thead>
            <tr>
              <th scope="col">المالك</th>
              <th scope="col">العقار</th>
              <th scope="col">الايجار</th>
              <th scope="col">المدفوع</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td >{$srealestateunitspaid->supplier.suppliername}</td>
              <td>{$srealestateunitspaid->realestate->realestatename}</td>
              <td>{$srealestateunitspaid->valuerents}</td>
              <td>{$srealestateunitspaid->totalpaid}</td>
            </tr>
            <tr>
              <th>الاقسط</th>
              <th>المدفوع</th>
              <th>التاريخ</th>
              <th>الدفع</th>
            </tr>
             {foreach $srealestateunitspaid->realestateunitpaidinstallments as $realestateunitpaidinstallment}
            <tr>
              <td >{$realestateunitpaidinstallment->valuerent}</td>
              <td >{$realestateunitpaidinstallment->totalpaid}</td>
              <td >{$realestateunitpaidinstallment->installmentdate}</td>
              <td >{if $realestateunitpaidinstallment->payed gt 1}
                    تم الدفع
                   {else}
                    <button type="button" class="btn btn-primary payednow"
                    data-continer="realestateunitsowners" 
                    data-clientid=""  
                    data-clientname=""  
                    data-supplierid="{$realestateunitpaidinstallment->supplierid}"
                    data-suppliername="{$srealestateunitspaid->supplier.suppliername}"  
                    data-realestateunitspaidid="{$realestateunitpaidinstallment->realestateunitpaidid}"  
                    data-realestatename="{$srealestateunitspaid->realestate->realestatename}"  
                    data-unitname=""  
                    data-realestateunitpaidinstallmentid="{$realestateunitpaidinstallment->id}" 
                    data-value="{$realestateunitpaidinstallment->valuerent}" 
                    data-paid="{$realestateunitpaidinstallment->totalpaid}" 
                    data-rem="{$realestateunitpaidinstallment->valuerent - $realestateunitpaidinstallment->totalpaid}">الدفع</button>
                   {/if}
              </td>
            </tr>
            

            {/foreach}
            <tr>
                <td colspan="4" style="background:#ccc">.</td>
            </tr>
          </tbody>
           {/foreach}
        </table>
    </div>
    <div class="col-lg-6">
        <h3 style="text-align:center;">المستأجرين</h3>
        <table class="table table-bordered">
          {foreach $crealestateunitspaids as $crealestateunitspaid}
          <thead>
            <tr>
              <th scope="col">المستاجر</th>
              <th scope="col">العقار</th>
              <th scope="col">الايجار</th>
              <th scope="col">المدفوع</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td >{$crealestateunitspaid->client.clientname}</td>
              <td>{$crealestateunitspaid->realestate->realestatename}</td>
              <td>{$crealestateunitspaid->valuerents}</td>
              <td>{$crealestateunitspaid->totalpaid}</td>
            </tr>
            <tr>
              <th>الاقسط</th>
              <th>المدفوع</th>
              <th>التاريخ</th>
              <th>الدفع</th>
            </tr>
             {foreach $crealestateunitspaid->realestateunitpaidinstallments as $realestateunitpaidinstallment}
            <tr>
              <td >{$crealestateunitspaid->realestatesunit->unitname} / {$realestateunitpaidinstallment->valuerent}</td>
              <td >{$realestateunitpaidinstallment->totalpaid}</td>
              <td >{$realestateunitpaidinstallment->installmentdate}</td>
              <td >{if $realestateunitpaidinstallment->payed gt 1}
                    تم الدفع
                   {else}
                   <button type="button" class="btn btn-primary payednow"
                    data-continer="realestateunitsrenters" 
                    data-clientid="{$realestateunitpaidinstallment->clientid}"
                    data-clientname="{$crealestateunitspaid->client.clientname}"  
                    data-supplierid=""
                    data-suppliername=""
                    data-realestateunitspaidid="{$realestateunitpaidinstallment->realestateunitpaidid}"  
                    data-realestatename="{$crealestateunitspaid->realestate->realestatename}"  
                    data-unitname="{$crealestateunitspaid->realestatesunit->unitname}"  
                    data-realestateunitpaidinstallmentid="{$realestateunitpaidinstallment->id}" 
                    data-value="{$realestateunitpaidinstallment->valuerent}" 
                    data-paid="{$realestateunitpaidinstallment->totalpaid}" 
                    data-rem="{$realestateunitpaidinstallment->valuerent - $realestateunitpaidinstallment->totalpaid}">الدفع</button>
                   {/if}
              </td>
            </tr>
            {/foreach}
             <tr>
                <td colspan="4" style="background:#ccc">.</td>
            </tr>
          </tbody>
           {/foreach}
        </table>
    </div>
</div>
