
{if $archive == 1  || $old == 1 }
<table class="table table-striped table-hover table-bordered">
    <thead>
        <tr>
            <th class="bold col-md-1"> <div align="center">Date </div></th>
            <th class="bold col-md-1"> <div align="center">For </div></th>
            <th colspan="3" class="bold"> <div align="center">Investigations </div></th>
            <th>Print</th>
            <!--th>Delete</th-->
        </tr>
    </thead>


    <tbody>
        {foreach $dates as $inv}
        {if $countWife[$inv["date"]] > 0 }
        <tr>
            {if $countHusband[$inv["date"]] > 0 }  <td rowspan="2"> {else} <td> {/if}
                {$inv["date"]}
            </td>
            <td>
                Wife
            </td>
            <td colspan="3">

                {foreach $inv.investsw as $invest}

                <div class="form-group " style=" width: 32%; float: left; ">
                    <label class="col-md-8 control-label bold" style=" font-size: 16px; margin-left: 4px;">{$invest->invname}:</label>
                    <label class="col-md-3 control-label" style=" font-size: 14px; ">{$invest->investresult}</label>

                </div>
                {/foreach}
            </td>
            <td><button type="button" class="btn green btn-block btn-xs printInv" data-for="wife" data-old="{$old}"  data-date="{$inv.date}"  data-controller="monitoring">  Print  </button></td>
            <!--td>
                <a class="btn grey-cascade btn-xs delNew" data-id="1" data-for="0" data-date="{$inv['date']}" style=" float: left;" href="#" data-link="gyna" data-fn="del" data-tableName="mointoringsheetinvestigation">
                    <i class="fa fa-close"></i>
                </a>
            </td-->
        </tr>
        {/if}
        {if $countHusband[$inv["date"]] > 0 }
        <tr>
            {if $countWife[$inv["date"]] > 0 }{else}  <td> {$inv["date"]}</td>{/if}
            <td>
                Husband
            </td>

            <td colspan="3">

                {foreach $inv.investsh as $invest}

                <div class="form-group " style=" width: 32%; float: left; ">
                    <label class="col-md-8 control-label bold" style=" font-size: 16px; margin-left: 4px;">{$invest->invname}:</label>
                    <label class="col-md-3 control-label" style=" font-size: 14px; ">{$invest->investresult}</label>
                </div>
                {/foreach}
            </td>
            <td><button type="button" class="btn green btn-block btn-xs printInv" data-for="husband"  data-old="{$old}"  data-date="{$inv.date}"  data-controller="monitoring">  Print  </button></td>
            <!--td>
                <a class="btn grey-cascade btn-xs delNew" data-id="1" data-for="1" data-old="{$old}" data-date="{$inv['date']}" style=" float: left;" href="#" data-link="gyna" data-fn="del" data-tableName="mointoringsheetinvestigation">
                    <i class="fa fa-close"></i>
                </a>
            </td-->
        </tr>
        {/if}

        {/foreach}
    </tbody>

</table>

{else}

<table class="table table-striped table-hover table-bordered">
    <thead>
        <tr>
            <th class="bold col-md-1"> <div align="center">Date </div></th>
            <th class="bold col-md-1"> <div align="center">For </div></th>
            <th colspan="3" class="bold"> <div align="center">Investigations </div></th>
            <th>Print</th>
            <th>Delete</th>
        </tr>
    </thead>


    <tbody>
        {foreach $dates as $inv}
        {if $countWife[$inv["date"]] > 0 }
        <tr>
            {if $countHusband[$inv["date"]] > 0 }  <td rowspan="2"> {else} <td> {/if}
                {$inv["date"]}
            </td>
            <td>
                Wife
            </td>
            <td colspan="3">

                {foreach $inv.investsw as $invest}

                <div class="form-group " style=" width: 32%; float: left; ">
                    <label class="col-md-8 control-label bold txtl" style=" font-size: 16px; margin-left: 4px;">{$invest->invname}:</label>
                    <div class="col-md-3">
                        <input type="text" class="form-control updateElement" data-colName="investresult" data-id="{$invest->id}"  data-tableName="mointoringsheetinvestigation" value="{$invest->investresult}">

                    </div>
                </div>
                {/foreach}
            </td>
            <td><button type="button" class="btn green btn-block btn-xs printInv" data-for="wife"  data-date="{$inv.date}"  data-controller="monitoring">  Print  </button></td>
            <td>
                <a class="btn grey-cascade btn-xs delNew" data-id="1" data-for="0" data-date="{$inv['date']}" style=" float: left;" href="#" data-link="gyna" data-fn="del" data-tableName="mointoringsheetinvestigation">
                    <i class="fa fa-close"></i>
                </a>
            </td>
        </tr>
        {/if}
        {if $countHusband[$inv["date"]] > 0 }
        <tr>
            {if $countWife[$inv["date"]] > 0 }{else}  <td> {$inv["date"]}</td>{/if}
            <td>
                Husband
            </td>

            <td colspan="3">

                {foreach $inv.investsh as $invest}

                <div class="form-group " style=" width: 32%; float: left; ">
                    <label class="col-md-8 control-label bold txtl" style=" font-size: 16px; margin-left: 4px;">{$invest->invname}:</label>
                    <div class="col-md-3">
                        <input type="text" class="form-control updateElement" data-colName="investresult" data-id="{$invest->id}"  data-tableName="mointoringsheetinvestigation" value="{$invest->investresult}">

                    </div>
                </div>
                {/foreach}
            </td>
            <td><button type="button" class="btn green btn-block btn-xs printInv" data-for="husband"  data-date="{$inv.date}"  data-controller="monitoring">  Print  </button></td>
            <td>
                <a class="btn grey-cascade btn-xs delNew" data-id="1" data-for="1" data-date="{$inv['date']}" style=" float: left;" href="#" data-link="gyna" data-fn="del" data-tableName="mointoringsheetinvestigation">
                    <i class="fa fa-close"></i>
                </a>
            </td>
        </tr>
        {/if}

        {/foreach}
    </tbody>

</table>


{/if}



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