<style>
    table {
        font-family: arial, sans-serif;
        border-collapse: collapse;
        width: 100%;
        table-layout: fixed
    }

    td, th {
        border: 1px solid #000000;
        text-align: center;
        padding: 2px;
    }

    tr:nth-child(even) {
        background-color: #dddddd;
    }
</style>
<div class="page-content-wrapper">
    <div class="page-content">
        <div class="row">
            <div class="col-md-12">
                <!-- BEGIN EXAMPLE TABLE PORTLET-->
                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption">
                            <i class="fa fa-user"></i>Sperm Freezing Report
                        </div>
                        <div class="actions">

                            {if $patientId}

                            <a href="{$hosturl}/controllers/{$controllname}.php?ac=show&&patientid={$patientId}"
                                class="btn btn-default btn-sm">
                                Show Reports </a>
                            {else}
                            <a href="{$hosturl}/controllers/{$controllname}.php?ac=show" class="btn btn-default btn-sm">
                                Show Reports </a>
                            {/if}

                        </div>
                    </div>
                    <div class="portlet-body">

                        <!--Begin Semen-->

                        <div class="row">


                            <div class="portlet-title tbox">
                                <div class="caption font-blue-haze col-md-6">
                                    <span class="caption-subject bold uppercase">Add</span>
                                </div>

                            </div>

                            <div class="clearfix"></div>

                            {if $patientId}
                            <form action="{$hosturl}/controllers/{$controllname}.php?ac=addit&patientid={$patientId}"
                                method="post" class="clinick">
                                {else}
                                <form action="{$hosturl}/controllers/{$controllname}.php?ac=addit" method="post"
                                    class="clinick">
                                    {/if}
                                    <div class="form-body">


                                        <div class="form-group ">
                                            <label class="col-md-2 txtl" for="form_control_1">Ref. by Prof. Dr :</label>
                                            <div class="col-md-3">
                                                <input type="text" class="form-control " readonly required="required"
                                                    value="{if !empty($ref_dr['name'])}{$ref_dr['name']}{else}{$ref_dr}{/if}"
                                                    name="ref_by" />
                                                <input type="hidden"
                                                    value="{if !empty($ref_dr['user_id'])}{$ref_dr['user_id']}{else}0{/if}"
                                                    name="ref_by_dr_id" />
                                            </div>
                                        </div>
                                        <div class="clearfix"></div>
                                        <div class="form-group ">
                                            <label class="col-md-2 txtl" for="form_control_1">Visit Date:</label>
                                            <div class="col-md-3">
                                                <input class="form-control patientvisitidCheckDate  edited" readonly
                                                    type="text" id="visitdate" name="visitdate" required
                                                    value="{$today}">
                                            </div>
                                        </div>
                                        <div class="clearfix"></div>
                                        <div class="form-group ">
                                            <div class="col-md-6">
                                                <label class="col-md-4 control-label" for="form_control_1">
                                                    Sperm Source
                                                </label>
                                                <div class="col-md-8">

                                                    <div class="col-md-5">
                                                        <div class="md-radio-list">
                                                            <div class="md-radio">
                                                                <input type="radio" id="Ejaculate" name="sperm_source"
                                                                    class="md-radiobtn sradio" data-val="0" value="0"
                                                                    checked>
                                                                <label for="Ejaculate">
                                                                    <span></span>
                                                                    <span class="check"></span>
                                                                    <span class="box"></span>
                                                                    Ejaculate </label>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-5">
                                                        <div class="md-radio-list">
                                                            <div class="md-radio">
                                                                <input type="radio" id="Aspiration" name="sperm_source"
                                                                    class="md-radiobtn sradio" data-val="1" value="1">
                                                                <label for="Aspiration">
                                                                    <span></span>
                                                                    <span class="check"></span>
                                                                    <span class="box"></span>
                                                                    Test. Aspiration </label>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-5">
                                                        <div class="md-radio-list">
                                                            <div class="md-radio">
                                                                <input type="radio" id="EpidAspiration"
                                                                    name="sperm_source" class="md-radiobtn sradio"
                                                                    data-val="2" value="2">
                                                                <label for="EpidAspiration">
                                                                    <span></span>
                                                                    <span class="check"></span>
                                                                    <span class="box"></span>
                                                                    Epid. Aspiration </label>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-5">
                                                        <div class="md-radio-list">
                                                            <div class="md-radio">
                                                                <input type="radio" id="TestBiopsy" name="sperm_source"
                                                                    class="md-radiobtn sradio" data-val="3" value="3">
                                                                <label for="TestBiopsy">
                                                                    <span></span>
                                                                    <span class="check"></span>
                                                                    <span class="box"></span>
                                                                    Test. Biopsy </label>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group ">
                                            <div class="col-md-12">
                                                <label class="col-md-2 control-label" for="form_control_1">
                                                    Sperm Parameters
                                                </label>
                                                <div class="col-md-8">
                                                    <div class="col-md-12">
                                                        <label class="col-md-4 control-label" for="form_control_1">
                                                            Count:
                                                        </label>
                                                        <div class="col-md-4">
                                                            <input type="text" name="count"
                                                                class="form-control input-sm " id="form_control_1"
                                                                placeholder="">
                                                            <div class="form-control-focus">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-12">
                                                        <label class="col-md-4 control-label" for="form_control_1">
                                                            Motility:
                                                        </label>
                                                        <div class="col-md-4">
                                                            <input type="text" name="motility"
                                                                class="form-control input-sm " id="form_control_1"
                                                                placeholder="">
                                                            <div class="form-control-focus">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-12">
                                                        <label class="col-md-4 control-label" for="form_control_1">
                                                            Progressive motility:
                                                        </label>
                                                        <div class="col-md-4">
                                                            <input type="text" name="a_plus_b"
                                                                class="form-control input-sm updateElement"
                                                                id="form_control_1" placeholder="">
                                                            <div class="form-control-focus">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-12">
                                                        <label class="col-md-4 control-label" for="form_control_1">
                                                            Morphology(Abn.):
                                                        </label>
                                                        <div class="col-md-4">
                                                            <input type="text" name="morphology"
                                                                class="form-control input-sm updateElement"
                                                                id="form_control_1" placeholder="">
                                                            <div class="form-control-focus">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-12">
                                                        <label class="col-md-4 control-label" for="form_control_1">
                                                            Comment:
                                                        </label>
                                                        <div class="col-md-8">
                                                            <textarea class="form-control updateElement" name="comment"
                                                                rows="3" placeholder="Enter more text"></textarea>
                                                            <div class="form-control-focus">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-12">
                                                        <label class="col-md-4 control-label" for="form_control_1">
                                                            No. Of Samples:
                                                        </label>
                                                        <div class="col-md-4">
                                                            <input type="text" name="samples_no"
                                                                class="form-control input-sm updateElement"
                                                                id="form_control_1" placeholder="">
                                                            <div class="form-control-focus">
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-12">
                                                        <label class="col-md-4 control-label" for="form_control_1">
                                                            Freezing Media:
                                                        </label>
                                                        <div class="col-md-4">

                                                            <select
                                                                class="form-control frmedia allupdateselect freezingmedia"
                                                                id="frmedia" name="media"
                                                                select-tableName="freezingmedia" data-colName="media">
                                                                <option value="">choose</option>
                                                                {foreach $freezing_media as $one}
                                                                <option value="{$one->id}">{$one->media}</option>
                                                                {/foreach}

                                                                <option value="-2" class="deleteMedia deleteoptincompo">
                                                                    Delete</option>
                                                            </select>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-12">
                                                        <label class="col-md-4 control-label" for="form_control_1">
                                                            Freezing Protocol:
                                                        </label>
                                                        <div class="col-md-4">
                                                            <select class="form-control protocol freezingprotocol"
                                                                id="protocol" name="protocol" data-colName="protocol"
                                                                select-tableName="freezingprotocol">
                                                                <option value="">choose</option>
                                                                {foreach $freezingprotocol as $one}
                                                                <option value="{$one->id}">{$one->protocol}</option>
                                                                {/foreach}

                                                                <option value="-2"
                                                                    class="deleteProtocol deleteoptincompo">Delete
                                                                </option>
                                                            </select>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group ">
                                            <div class="col-md-6">
                                                <label class="col-md-4 control-label" for="form_control_1">
                                                    Purpose Of Freezing:
                                                </label>
                                                <div class="col-md-8">

                                                    <div class="col-md-3">
                                                        <div class="md-radio-list">
                                                            <div class="md-radio">
                                                                <input type="radio" id="IUI" name="purpose"
                                                                    class="md-radiobtn sradio" data-val="0" value="0"
                                                                    checked>
                                                                <label for="IUI">
                                                                    <span></span>
                                                                    <span class="check"></span>
                                                                    <span class="box"></span>
                                                                    IUI </label>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-3">
                                                        <div class="md-radio-list">
                                                            <div class="md-radio">
                                                                <input type="radio" id="ICSI" name="purpose"
                                                                    class="md-radiobtn sradio" data-val="1" value="1">
                                                                <label for="ICSI">
                                                                    <span></span>
                                                                    <span class="check"></span>
                                                                    <span class="box"></span>
                                                                    ICSI </label>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-3">
                                                        <div class="md-radio-list">
                                                            <div class="md-radio">
                                                                <input type="radio" id="Preservation" name="purpose"
                                                                    class="md-radiobtn sradio" data-val="2" value="2">
                                                                <label for="Preservation">
                                                                    <span></span>
                                                                    <span class="check"></span>
                                                                    <span class="box"></span>
                                                                    Preservation </label>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <!-- <div class="col-md-12">
                                            <label class="col-md-2 control-label" for="form_control_1">
                                                Location:
                                            </label>
                                            <div class="col-md-5">
                                                <input type="text" name="location"
                                                    class="form-control input-sm updateElement bp_location2"
                                                    id="form_control_1" placeholder="">
                                                <div class="form-control-focus">
                                                </div>
                                            </div>
                                        </div> -->
                                        <div class="col-md-12">
                                            {if $programesetting->tanks_view == 1 }
                                            <div class=" col-md-2">
                                                <button type="button" class="btn btn-primary" id="tankLocationBtn">
                                                    Tank Location
                                                </button>
                                            </div>

                                            <div class=" col-md-5 wds35">
                                                <table>
                                                    <tbody>
                                                        <tr>
                                                            <th>Locations</th>
                                                        </tr>
                                                        <tr style="background-color: #ffffff;" id='cellsContainer'>
                                                            <td>
                                                                {foreach $cells as $cell}
                                                                <span class="tankLocationSpan btn  btn-danger"
                                                                    data-location="{$cell.location}"
                                                                    data-no="{$cell.btn_no}">
                                                                    Can {$cell.location}{$cell.btn_no}
                                                                    ({$cell.rows_letter}{$cell.row_no} -
                                                                    {$cell.col_no} -
                                                                    cell{$cell.cell_no})
                                                                </span>
                                                                {/foreach}
                                                            </td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                            {elseif $programesetting->tanks_view == 2 }
                                            <div class=" col-md-2">
                                                <button type="button" class="btn btn-primary" data-toggle="modal"
                                                    data-target="#addTankLocation">
                                                    Add location in tank
                                                </button>
                                            </div>

                                            <div class=" col-md-5 wds35">
                                                <table>
                                                    <tbody>
                                                        <tr>
                                                            <th>Locations</th>
                                                        </tr>
                                                        <tr style="background-color: #ffffff;" id='cellsContainer'>
                                                            <td>
                                                                {foreach $tank_cells as $cell}
                                                                <label id="location_value_for_patient"
                                                                    style="display: block;">{$cell.name}-{$cell.up_level_name}-{$cell.cell_name}</label>
                                                                {/foreach}
                                                                {foreach $tank_cells_2 as $cell}
                                                                <label
                                                                    style="display: block;">{$cell.name}-{$cell.up_level_name}-{$cell.cell_name}-{$cell.cell_part_name}</label>
                                                                {/foreach}
                                                                {foreach $tank_cells_3 as $cell}
                                                                <label
                                                                    style="display: block;">{$cell.name}-{$cell.up_level_name}-{$cell.cell_name}-{$cell.cell_part_name}</label>
                                                                {/foreach}
                                                            </td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                            {/if}
                                        </div>

                                        <div class="col-md-12">
                                            <label class="col-md-2 control-label" for="form_control_1">
                                                Color Of Pen:
                                            </label>
                                            <div class="col-md-5">
                                                <input type="text" name="color_of_pen"
                                                    class="form-control input-sm updateElement" id="form_control_1"
                                                    placeholder="">
                                                <div class="form-control-focus">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group ">
                                            <div class="col-md-12">


                                                <div class="col-md-12">
                                                    <label class="col-md-2 control-label" for="form_control_1">
                                                        Embryologist :
                                                    </label>
                                                    <div class="col-md-5">
                                                        <select class="form-control" id="embryology1" name="embryology1"
                                                            data-colName="name" select-tableName="awusers"
                                                            data-id="{$one.user_id}">
                                                            <option value="">choose</option>
                                                            {foreach $embryologist as $one}
                                                            <option value="{$one.user_id}">{$one.name}</option>
                                                            {/foreach}

                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="col-md-12">
                                                    <label class="col-md-2 control-label" for="form_control_1">
                                                        Consultant :
                                                    </label>
                                                    <div class="col-md-5">
                                                        <select class="form-control" id="embryology2" name="embryology2"
                                                            data-colName="name" select-tableName="awusers"
                                                            data-id="{$one.user_id}">
                                                            <option value="">choose</option>
                                                            {foreach $embryologist as $one}
                                                            <option value="{$one.user_id}">{$one.name}</option>
                                                            {/foreach}

                                                        </select>
                                                    </div>

                                                </div>
                                            </div>
                                        </div>
                                    </div>




                                    <div class="form-actions">
                                        <div class="row">
                                            <div class="col-md-offset-2 col-md-10">
                                                {if $patientId}
                                                <a class="btn default"
                                                    href="{$hosturl}/controllers/{$controllname}.php?ac=show&patientid={$patientId}">Cancel</a>
                                                {else}
                                                <a class="btn default"
                                                    href="{$hosturl}/controllers/{$controllname}.php?ac=show">Cancel</a>
                                                {/if}

                                                <button type="submit" class="btn blue">Submit</button>

                                            </div>
                                        </div>
                                    </div>
                                </form>

                        </div>
                    </div>
                </div>
            </div>

            <div class="bootbox modal fade bootbox-alert in" tabindex="-1" role="dialog" aria-hidden="false"
                id="edit_model">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                            <h4 class="modal-title"> Edit </h4>
                        </div>
                        <div class="modal-body">
                            <div class="portlet-body form">
                                <form action="" method="post" class="form-horizontal emptyform">
                                    <div class="form-body">
                                        <!------===========================================------->
                                        <div>
                                            <div id="alldatadiv" class=""> </div>
                                        </div>

                                        <!------===========================================------->
                                        <!--                            <div class="form-group">
                                                                        <label class="col-md-3 control-label"> Name</label>
                                                                        <div class="col-md-8">
                                                                            <input type="hidden" class="form-control"  id="newitem_id" name="newamount_id" >
                                                                            <input type="text" class="form-control"  id="newitem_name" name="newamount_name" style="text-align:left;" >
                                                                            <div id="divsucess1" style="color:red; display:none;"></div>
                                                                        </div>
                                                                    </div>-->
                                        <!------===========================================------->
                                        <div class="modal-footer">
                                            <!--                                <button type="button" class="btn green" id="editmodel_submit"> Update </button>-->
                                            <button type="button" id="amountcloseinput" class="btn default"
                                                data-dismiss="modal">Close</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <!-- /.modal-content -->
                    </div>
                </div>
            </div>

            <input type="hidden" id="spermfreez" value="1">


        </div>
    </div>
</div>

<div class="modal fade" id="addTankLocation" tabindex="-1" role="dialog" aria-labelledby="addTankLocationLabel"
    aria-hidden="true">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <form action="" class="form-horizontal" id="tank_lab_locations" method="post">
                <div class="modal-header">
                    <h5 class="modal-title" id="addTankLocationLabel">Choose location in tank</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body" style="padding: 2em 1em 1em;">

                    <label class="col-md-5 control-label" for="form_control_1">
                        Tanks
                    </label>
                    <select class="form-control select2me" id="lab_tank_id" name="lab_tank_id"
                        data-placeholder="Select...">
                        <option value="">choose</option>
                        {foreach $tanks as $tank}
                        <option value="{$tank->id}">{$tank->name}</option>
                        {/foreach}
                    </select>

                    <input type="hidden" name="lab_patient_id" value="{$patientid}">
                    <input type="hidden" id="up_level_name" name="up_level_name" value="0">
                    <input type="hidden" id="cell_name" name="cell_name" value="0">

                    <hr />

                    <div id="tankCellsContainer">
                        Choose tank to load cells
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary" id="save_tank_lab_cell_patient">Save changes</button>
                </div>
            </form>
        </div>
    </div>
</div>