

{if $archive == 1 }
<table class="table table-striped table-hover table-bordered" id="presTable">
    <thead>
        <tr>
            <th class="col-md-1">
                Date
            </th>
            <th  class="col-md-1">
                Drug For
            </th>
            <th>
                Drug Name
            </th>

            <th class="col-md-1">
                Print
            </th>

        </tr>
    </thead>

    <tbody>
        {assign var=i value=1}
        {foreach  $dates as $date}
        {if $countWife[$date["date"]] > 0 }
        <tr>
            {if $countHusband[$date["date"]] > 0 }  <td rowspan="2"> {else} <td> {/if}
                {$date["date"]}
            </td>
            <td>
                Patient
            </td>
            <td>
                {$date["drugdos"]}
            </td>


            <td>
                <a href="javascript:;"  class="btn green btn-block btn-xs printPre" data-for="0" data-date="{$date['date']}" data-controller="antenalvisit"> Print </a>
            </td>

        </tr>
        {/if}
        {if $countHusband[$date["date"]] > 0 }
        <tr>
            {if $countWife[$date["date"]] > 0 }{else}  <td> {$date["date"]}</td>{/if}
            <td>
                Husband
            </td>
            <td>
                {$date["drugtype"]}
            </td>
            <td>
                <a href="javascript:;"  class="btn green btn-block btn-xs printPre" data-for="1" data-date="{$date['date']}" data-controller="antenalvisit"> Print </a>
            </td>

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

</table>




<!--{literal}
<script type="text/javascript" >
    $('#presTable').dataTable({"pageLength": 50,"order": [[0, "asc"]]});
</script>
{/literal}-->


{else}
<table class="table table-striped table-hover table-bordered" id="presTable">
    <thead>
        <tr>
            <th class="col-md-1">
                Date
            </th>
            <th  class="col-md-1">
                Drug For
            </th>
            <th>
                Drug Name
            </th>

            <th class="col-md-1">
                Edit
            </th>
            <th class="col-md-1">
                Print
            </th>
            <th class="col-md-1">
                Delete
            </th>

        </tr>
    </thead>

    <tbody>
        {assign var=i value=1}
        {foreach  $dates as $date}
        {if $countWife[$date["date"]] > 0 }
        <tr>
            {if $countHusband[$date["date"]] > 0 }  <td rowspan="2"> {else} <td> {/if}
                {$date["date"]}
            </td>
            <td>
                Patient
            </td>
            <td>
                {$date["drugdos"]}
            </td>

            <td>
                <a href="javascript:;"  class="btn green btn-block btn-xs editPre" data-for="0"  data-date="{$date['date']}" data-controller="antenalvisit"> Edit </a>
            </td>
            <td>
                <a href="javascript:;"  class="btn green btn-block btn-xs printPre" data-for="0" data-date="{$date['date']}" data-controller="antenalvisit"> Print </a>
            </td>
            <td>
                <a class="btn grey-cascade btn-xs delNew" data-id="1" data-for="0" data-date="{$date['date']}" style=" float: left;" href="#" data-link="gyna" data-fn="del" data-tableName="mainantenentaldrugs">
                    <i class="fa fa-close"></i>
                </a>
            </td>

        </tr>
        {/if}
        {if $countHusband[$date["date"]] > 0 }
        <tr>
            {if $countWife[$date["date"]] > 0 }{else}  <td> {$date["date"]}</td>{/if}
            <td>
                Husband
            </td>
            <td>
                {$date["drugtype"]}
            </td>

            <td>
                <a href="javascript:;"  class="btn green btn-block btn-xs editPre" data-for="1" data-date="{$date['date']}" data-controller="antenalvisit"> Edit </a>
            </td>
            <td>
                <a href="javascript:;"  class="btn green btn-block btn-xs printPre" data-for="1" data-date="{$date['date']}" data-controller="antenalvisit"> Print </a>
            </td>
            <td>
                <a class="btn grey-cascade btn-xs delNew" data-id="1" data-for="1" data-date="{$date['date']}" style=" float: left;" href="#" data-link="gyna" data-fn="del" data-tableName="mainantenentaldrugs">
                    <i class="fa fa-close"></i>
                </a>
            </td>

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

</table>




<!--{literal}
<script type="text/javascript" >
    $('#presTable').dataTable({"pageLength": 50,"order": [[0, "asc"]]});
</script>
{/literal}-->

{/if}