

{if $tableName  == "follow_pre" }
<tr>
    <td>
        <input type="hidden" id="currentid" value="{$obj->id}pre"/>
        <select class="form-control select2me  updateElement " id="doctorid{$obj->id}pre"  data-placeholder="Select..." data-id="{$obj->id}"  data-colName="doctorid" data-tableName="follow_pre">
            <option></option>
            {foreach  $doctors as $data}
            <option value="{$data.user_id}" {if $data.user_id == $obj->doctorid} selected {/if}>{$data.name}</option>
            {/foreach}
        </select>
    </td>
    <td>
        <select class="form-control select2me  updateElement " id="nurseid{$obj->id}pre"   data-placeholder="Select..." data-id="{$obj->id}"  data-colName="nurseid" data-tableName="follow_pre">
            <option></option>
            {foreach  $nurses as $data}
            <option value="{$data.user_id}" {if $data.user_id == $obj->nurseid} selected {/if}>{$data.name}</option>
            {/foreach}
        </select>
    </td>
    <td>
        <select class="form-control select2me  updateElement " id="aborh{$obj->id}pre"   data-placeholder="Select..." data-id="{$obj->id}"  data-colName="aborh" data-tableName="follow_pre">
            <option></option>
            {foreach $bloodtypes as $data}
            <option value="{$data->id}" {if $obj->aborh ==  $data->id }selected{/if} > {$data->title} </option>
            {/foreach}
        </select>
    </td>
    <td>
        <input type="text" class="form-control updateElement" data-id="{$obj->id}" data-colName="hb" 
               data-tableName="follow_pre" value="{$obj->hb}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->hb}"/>
    </td>
    <td>
        <input type="text" class="form-control updateElement" data-id="{$obj->id}" data-colName="plt" 
               data-tableName="follow_pre" value="{$obj->plt}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->plt}"/>
    </td>
    <td>
        <input type="text" class="form-control updateElement" data-id="{$obj->id}" data-colName="rbs" 
               data-tableName="follow_pre" value="{$obj->rbs}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->rbs}"/>
    </td>
    <td>
        <input type="text" class="form-control bp_mask  updateElement" data-id="{$obj->id}" data-colName="bp" 
               data-tableName="follow_pre" value="{$obj->bp}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->bp}"/>
    </td>
    <td>
        <input type="text" class="form-control updateElement" data-id="{$obj->id}" data-colName="pulse" 
               data-tableName="follow_pre" value="{$obj->pulse}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->pulse}"/>
    </td>
    <td>
        <input type="text" class="form-control updateElement" data-id="{$obj->id}" data-colName="temp" 
               data-tableName="follow_pre" value="{$obj->temp}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->temp}"/>
    </td>
    <td>
        <input type="text" class="form-control updateElement" data-id="{$obj->id}" data-colName="so2" 
               data-tableName="follow_pre" value="{$obj->so2}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->so2}"/>
    </td>
    <td>
        <input type="text" class="form-control updateElement datetimepicker " data-id="{$obj->id}" data-colName="timing" 
               data-tableName="follow_pre" value="{$obj->timing}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->timing}" data-date-format="mm/dd HH:ii p" />
    </td>
    <td>
        <a class="btn grey-cascade btn-xs deletemsgEX" data-id="{$obj->id}" style=" float: left;" 
           href="#" data-link="ovumpickupembryotrans" data-fn="delPre" data-tableName="follow_pre">
            <i class="fa fa-close"></i>
        </a>
    </td>
</tr>


{else if $tableName  == "follow_post" }
<tr>
    <td>
        <input type="hidden" id="currentid" value="{$obj->id}post"/>
        <input type="hidden" id="pItr" value="{$itr}"/>
        <select class="form-control select2me  updateElement " id="doctorid{$obj->id}post"  data-placeholder="Select..." data-id="{$obj->id}"  data-colName="doctorid" data-tableName="follow_post">
            <option></option>
            {foreach  $doctors as $data}
            <option value="{$data.user_id}" {if $data.user_id == $obj->doctorid} selected {/if}>{$data.name}</option>
            {/foreach}
        </select>
    </td>
    <td>
        <select class="form-control select2me  updateElement " id="nurseid{$obj->id}post"   data-placeholder="Select..." data-id="{$obj->id}"  data-colName="nurseid" data-tableName="follow_post">
            <option></option>
            {foreach  $nurses as $data}
            <option value="{$data.user_id}" {if $data.user_id == $obj->nurseid} selected {/if}>{$data.name}</option>
            {/foreach}
        </select>
    </td>
    <td>
        <select class="form-control  updateElement " id="uop{$itr}" data-itr="{$itr}"   name="uop" data-placeholder="Select..." data-id="{$obj->id}"  data-colName="uop" data-tableName="follow_post">
            <option></option>
            {foreach  $follow_uop as $data}
            <option value="{$data->id}" {if $data->id == $obj->uop} selected {/if}>{$data->name}</option>
            {/foreach}
            <option value="-2" class="deleteoptincompo">Delete</option>
        </select>
    </td>
    <td>
        <select class="form-control  updateElement " id="drain{$itr}" data-itr="{$itr}"   name="drain" data-placeholder="Select..." data-id="{$obj->id}"  data-colName="drain" data-tableName="follow_post">
            <option></option>
            {foreach  $follow_drain as $data}
            <option value="{$data->id}" {if $data->id == $obj->drain} selected {/if}>{$data->name}</option>
            {/foreach}
            <option value="-2" class="deleteoptincompo">Delete</option>
        </select>
    </td>
    <td>
        <select class="form-control  updateElement " id="vpack{$itr}" data-itr="{$itr}"   name="vpack" data-placeholder="Select..." data-id="{$obj->id}"  data-colName="vpack" data-tableName="follow_post">
            <option></option>
            {foreach  $follow_vpack as $data}
            <option value="{$data->id}" {if $data->id == $obj->vpack} selected {/if}>{$data->name}</option>
            {/foreach}
            <option value="-2" class="deleteoptincompo">Delete</option>
        </select>
    </td>
    <td>
        <input type="text" class="form-control updateElement" data-id="{$obj->id}" data-colName="rbs" 
               data-tableName="follow_post" value="{$obj->rbs}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->rbs}"/>
    </td>
    <td>
        <input type="text" class="form-control bp_mask updateElement" data-id="{$obj->id}" data-colName="bp" 
               data-tableName="follow_post" value="{$obj->bp}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->bp}"/>
    </td>
    <td>
        <input type="text" class="form-control updateElement" data-id="{$obj->id}" data-colName="pulse" 
               data-tableName="follow_post" value="{$obj->pulse}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->pulse}"/>
    </td>
    <td>
        <input type="text" class="form-control updateElement" data-id="{$obj->id}" data-colName="temp" 
               data-tableName="follow_post" value="{$obj->temp}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->temp}"/>
    </td>
    <td>
        <input type="text" class="form-control updateElement" data-id="{$obj->id}" data-colName="so2" 
               data-tableName="follow_post" value="{$obj->so2}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->so2}"/>
    </td>
    <td>
        <input type="text" class="form-control updateElement datetimepicker " data-id="{$obj->id}" data-colName="timing" 
               data-tableName="follow_post" value="{$obj->timing}" data-toggle="popover" data-trigger="hover" 
               data-placement="bottom" data-content="{$obj->timing}" data-date-format="mm/dd HH:ii p" />
    </td>
    <td>
        <a class="btn grey-cascade btn-xs deletemsgEX" data-id="{$obj->id}" style=" float: left;" 
           href="#" data-link="ovumpickupembryotrans" data-fn="delPre" data-tableName="follow_post">
            <i class="fa fa-close"></i>
        </a>
    </td>
</tr>

{/if}

{literal}
<script type="text/javascript" >

    var currentid = $('#currentid').val();
    $('#currentid').remove();


    $(".datetimepicker").datetimepicker({
        autoclose: true
    });

    $('#doctorid' + currentid).select2();
    $('#nurseid' + currentid).select2();
    $('#aborh' + currentid).select2();

    $(".bp_mask").inputmask("999/999", {
        autoUnmask: true});

    var i = $('#pItr').val();
    $('#pItr').remove();

    $('#uop' + i).select2({
        width: '170px',
        allowClear: true,
        formatNoMatches: function (term) {
            /* customize the no matches output */
            $id = $(this).attr('data-id');
            $thisitr = $(this).attr('data-itr');
            return "<input class='form-control' id='newuopTerm" + $thisitr + "' value='" + term + "' data-itr='" + $thisitr + "'   data-id='" + $id + "'><a href='#' id='adduopNew" + $thisitr + "' data-itr='" + $thisitr + "'  data-id='" + $id + "' class='btn btn-default adduopselected'>Add</a>"
        }
    }).parent().find('.select2-with-searchbox').on('click', '.adduopselected', function () {
        $thisitr = $(this).attr('data-itr');
        var selectid = $(this).attr('data-id');
        var newitem = $('#newuopTerm' + $thisitr).val();
        $.post(hosturl + '/controllers/ovumpickupembryotrans.php?ac=addnewoRecord', {selectedoperation: newitem, id: selectid, inline: 2, tableName: "follow_uop", colName: "uop"}, function (data) {
            $('select[name="uop"] > .deleteoptincompo').before('<option value="' + Number(data) + '" >' + newitem + '</option>');
            $('#uop' + $thisitr).select2('val', Number(data)); // select the new term
            $('#uop' + $thisitr).select2('close'); // close the dropdown
        });
    });

    $('#drain' + i).select2({
        width: '170px',
        allowClear: true,
        formatNoMatches: function (term) {
            /* customize the no matches output */
            $id = $(this).attr('data-id');
            $thisitr = $(this).attr('data-itr');
            return "<input class='form-control' id='newdrainTerm" + $thisitr + "' value='" + term + "' data-itr='" + $thisitr + "'   data-id='" + $id + "'><a href='#' id='adddrainNew" + $thisitr + "' data-itr='" + $thisitr + "'  data-id='" + $id + "' class='btn btn-default adddrainselected'>Add</a>"
        }
    }).parent().find('.select2-with-searchbox').on('click', '.adddrainselected', function () {
        $thisitr = $(this).attr('data-itr');
        var selectid = $(this).attr('data-id');
        var newitem = $('#newdrainTerm' + $thisitr).val();
        $.post(hosturl + '/controllers/ovumpickupembryotrans.php?ac=addnewoRecord', {selectedoperation: newitem, id: selectid, inline: 2, tableName: "follow_drain", colName: "drain"}, function (data) {
            $('select[name="drain"] > .deleteoptincompo').before('<option value="' + Number(data) + '" >' + newitem + '</option>');
            $('#drain' + $thisitr).select2('val', Number(data)); // select the new term
            $('#drain' + $thisitr).select2('close'); // close the dropdown
        });
    });

    $('#vpack' + i).select2({
        width: '170px',
        allowClear: true,
        formatNoMatches: function (term) {
            /* customize the no matches output */
            $id = $(this).attr('data-id');
            $thisitr = $(this).attr('data-itr');
            return "<input class='form-control' id='newvpackTerm" + $thisitr + "' value='" + term + "' data-itr='" + $thisitr + "'   data-id='" + $id + "'><a href='#' id='addvpackNew" + $thisitr + "' data-itr='" + $thisitr + "'  data-id='" + $id + "' class='btn btn-default addvpackselected'>Add</a>"
        }
    }).parent().find('.select2-with-searchbox').on('click', '.addvpackselected', function () {
        $thisitr = $(this).attr('data-itr');
        var selectid = $(this).attr('data-id');
        var newitem = $('#newvpackTerm' + $thisitr).val();
        $.post(hosturl + '/controllers/ovumpickupembryotrans.php?ac=addnewoRecord', {selectedoperation: newitem, id: selectid, inline: 2, tableName: "follow_vpack", colName: "vpack"}, function (data) {
            $('select[name="vpack"] > .deleteoptincompo').before('<option value="' + Number(data) + '" >' + newitem + '</option>');
            $('#vpack' + $thisitr).select2('val', Number(data)); // select the new term
            $('#vpack' + $thisitr).select2('close'); // close the dropdown
        });
    });


</script>
{/literal}

