<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false" 
     id="upVisitsModel" style="min-width:1000px;">
    <div class="modal-dialog  modal-lg wds90">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close closeDrug" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title txtc">  </h4>
            </div>
            <div class="modal-body">
                <div class="portlet-body form">
                    <form class="form-horizontal" role="form" action="" method="post" id="gynaDrugs" enctype="multipart/form-data">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet blue-hoki box">

                                    <div class="portlet-body  scroll_y showNum isheight">
                                        <table class="table table-striped table-hover table-bordered" style="margin: 1%; width: 98%;">
                                            <thead>
                                                <tr>
                                                    <th class="wds9 txtc">#</th>
                                                    <th>   Patient Name</th>
                                                    <th>   Patient No.</th>
                                                    <th>   Visit Date</th>
                                                    <th>    User</th>
                                                    {if $showBranchCol  == 1}   <th> Branch </th>{/if} 
                                                    <th>   Edit Date</th>
                                                    <th>    Notes</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                {assign var=i value=0}
                                                {foreach $visitsUpdates as $row}


                                                <tr>
                                                    <td> {if $i == 0 } Original {else } Update {$i} {/if}</td>
                                                    <td>
                                                        <a href="{$hosturl}/controllers/patienthistory.php?ac=show&patientid={$row.patientid}" target="_new">
                                                            {if  $row.for_husband == 1 }
                                                            {$row.husdandname}
                                                            {else if  $row.for_husband == 2}
                                                            طفل    /  {$row.wifename}
                                                            {else}
                                                            {$row.wifename}
                                                            {/if}
                                                        </a>
                                                    </td>
                                                    <td> {$row.statusno}</td>
                                                    <td> {$row.visitdate} </td>
                                                    <td> {$row.userName}</td>
                                                    {if $showBranchCol  == 1}    <td>  {$row.branchName}</td>{/if} 
                                                    <td> {$row.editDate}</td>
                                                    <td> {$row.notes}</td>
                                                </tr>
                                                {capture assign=i}{$i+1}{/capture}
                                                {/foreach}

                                                {if $i > 0 }
                                                <tr>
                                                    <td>  Update {$i}</td>
                                                    <td>
                                                        <a href="{$hosturl}/controllers/patienthistory.php?ac=show&patientid={$lastRecord.patientid}" target="_new">
                                                            {if  $lastRecord.for_husband == 1 }
                                                            {$lastRecord.husdandname}
                                                            {else if  $lastRecord.for_husband == 2}
                                                            طفل    /  {$lastRecord.wifename}
                                                            {else}
                                                            {$lastRecord.wifename}
                                                            {/if}
                                                        </a>
                                                    </td>
                                                    <td> {$lastRecord.statusno}</td>
                                                    <td> {$lastRecord.visitdate} </td>
                                                    <td> {$lastRecord.userName}</td>
                                                    {if $showBranchCol  == 1}    <td>  {$lastRecord.branchName}</td>{/if} 
                                                    <td> {$lastRecord.editDate}</td>
                                                    <td> {$lastRecord.notes}</td>
                                                </tr>
                                                {/if}


                                                {if  $lastRecord.deleted == 1  }
                                                <tr style="    background-color: #f6bfc4;">
                                                    <td>  Delete</td>
                                                    <td>
                                                        <a href="{$hosturl}/controllers/patienthistory.php?ac=show&patientid={$lastRecord.patientid}" target="_new">
                                                            {if  $lastRecord.for_husband == 1 }
                                                            {$lastRecord.husdandname}
                                                            {else if  $lastRecord.for_husband == 2}
                                                            طفل    /  {$lastRecord.wifename}
                                                            {else}
                                                            {$lastRecord.wifename}
                                                            {/if}
                                                        </a>
                                                    </td>
                                                    <td> {$lastRecord.statusno}</td>
                                                    <td> {$lastRecord.visitdate} </td>
                                                    <td> {$lastRecord.deleteUsName}</td>
                                                    {if $showBranchCol  == 1}    <td> </td>{/if} 
                                                    <td> {$lastRecord.date_delete}</td>
                                                    <td></td>
                                                </tr>
                                                {/if}

                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>