
<tr>
    <td>
        <input type="hidden"  id="newFrozenId" value="{$record->id}"/>
        <input type="text" class="form-control  datepicker updateElement" data-id="{$record->id}" 
               data-colName="try_date" data-tableName="icsi_frozen" 
               value="{$record->try_date}" readonly />
    </td>
    <td>
        <input type="text" class="form-control  datepicker updateElement" data-id="{$record->id}" 
               data-colName="lmp" data-tableName="icsi_frozen" 
               value="{$record->lmp}" readonly />
    </td>
    <td>
        <input type="text" class="form-control  updateElement" data-id="{$record->id}" 
               data-colName="ttt" data-tableName="icsi_frozen" 
               value="{$record->ttt}"  />
    </td>
    <td>
        <input type="text" class="form-control  updateElement" data-id="{$record->id}" 
               data-colName="end_size" data-tableName="icsi_frozen" 
               value="{$record->end_size}"  />
    </td>
    <td>
        <input type="text" class="form-control  updateElement" data-id="{$record->id}" 
               data-colName="end_shape" data-tableName="icsi_frozen" 
               value="{$record->end_shape}"  />
    </td>
    <td>
        <input type="text" class="form-control  updateElement" data-id="{$record->id}" 
               data-colName="end_trigg" data-tableName="icsi_frozen" 
               value="{$record->end_trigg}"  />
    </td>
    <td>
        <select class="form-control  updateElement select2h"data-colName="trans_diff" 
                data-id="{$record->id}"  data-tableName="icsi_frozen"   id="trans_diff{$record->id}">
            <option value=""></option>
            <option value="1" {if $record->trans_diff eq  1}selected{/if}>Easy</option>
            <option value="2" {if $record->trans_diff eq  2}selected{/if}>Difficult</option>
            <option value="3" {if $record->trans_diff eq  3}selected{/if}>Traction</option>
        </select>
    </td>
    <td>
        <select class="form-control  updateElement select2h"data-colName="trans_location" 
                data-id="{$record->id}"  data-tableName="icsi_frozen"   id="trans_location{$record->id}">
            <option value=""></option>
            <option value="1" {if $record->trans_diff eq  1}selected{/if}>Mid</option>
            <option value="2" {if $record->trans_diff eq  2}selected{/if}>Fundal</option>
            <option value="3" {if $record->trans_diff eq  3}selected{/if}>Low</option>
            <option value="4" {if $record->trans_diff eq  4}selected{/if}>Ostial</option>
        </select>
    </td>
    <td>
        <select class="form-control  updateElement editModelSel  trans_cather"data-colName="trans_cather" 
                data-id="{$record->id}"  data-tableName="icsi_frozen"    id="trans_cather{$record->id}">
            <option value=""></option>
            {foreach $cathers as $data}
            <option value="{$data->id}" {if $record->trans_cather eq  $data->id}selected{/if}>{$data->name}</option>
            {/foreach}
            <option value="0" class="deleteoptincompo">حذف</option>
        </select>
    </td>
    <td>
        <select class="form-control  updateElement editModelSel  trans_no"data-colName="trans_no" 
                data-id="{$record->id}"  data-tableName="icsi_frozen"    id="trans_no{$record->id}">
            <option value=""></option>
            {foreach $numbers as $data}
            <option value="{$data->id}" {if $record->trans_no eq  $data->id}selected{/if}>{$data->name}</option>
            {/foreach}
            <option value="0" class="deleteoptincompo">حذف</option>
        </select>
    </td>
    <td>
        <input type="checkbox"  value="1" class="updateElementCheck" 
               data-id="{$record->id}" data-tableName="icsi_frozen" data-colName="pregnancy"  
               {if {$record->pregnancy}  == 1 } checked {/if}>
    </td>
    <td>
        <input type="text" class="form-control  updateElement" data-id="{$record->id}" 
               data-colName="delivery" data-tableName="icsi_frozen" 
               value="{$record->delivery}"  />
    </td>
    <td>
        <textarea class="form-control updateElement txtc" rows="1" data-id="{$record->id}" 
                  data-colName="notes" data-tableName="icsi_frozen" placeholder="Enter more text" 
                  data-toggle="popover" data-trigger="hover" data-placement="bottom" 
                  data-content="{$record->notes}" 
                  >{$record->notes}</textarea>
    </td>
    <td>
        <button class="btn btn-xs red-intense deleteelement " type="button"  data-id="{$record->id}"
                data-link="gyna"  data-fun="deldata" data-tableName="icsi_frozen" 
                ><i class="fa fa-close"></i></button>
    </td>
</tr>




{literal}
<script>
    var id = $('#newFrozenId').val();
    $('#newFrozenId').remove();

    $('.datepicker').datepicker();

    $("#trans_diff" + id).select2({placeholder: "Select", allowClear: true});
    $("#trans_location" + id).select2({placeholder: "Select", allowClear: true});

    $("#trans_cather" + id).select2({
//   width: '240px',
        allowClear: true,
        formatNoMatches: function (term) {
            /* customize the no matches output */
            var thisId = $(this).attr("id");
            return "<input class='form-control' id='newtrans_catherSelectTerm' value='" + term + "'><a href='#' id='addNewtrans_catherSelect' data-id='" + thisId + "' class='btn blue custombtnstyle'>ADD</a>"
        }
    }).parent().find('.select2-with-searchbox').on('click', '#addNewtrans_catherSelect', function () {
        /* add the new term */
        var Protocol = $('#newtrans_catherSelectTerm').val();
        var thisId = $(this).attr("data-id");
        $.post(hosturl + "/controllers/embryoslab.php?ac=addRow", {value: Protocol, table: 'icsi_cather'}, function (data) {

            $('.trans_cather > .deleteoptincompo').before('<option value="' + Number(data) + '" >' + Protocol + '</option>');
            $('#' + thisId + '').select2('val', Number(data)); // select the new term
            $('.trans_cather').select2('close'); // close the dropdown

            $('.updateElement[id=' + thisId + ']').trigger("change");
        });
    });


    $("#trans_no" + id).select2({
//   width: '240px',
        allowClear: true,
        formatNoMatches: function (term) {
            /* customize the no matches output */
            var thisId = $(this).attr("id");
            return "<input class='form-control' id='newtrans_noSelectTerm' value='" + term + "'><a href='#' id='addNewtrans_noSelect' data-id='" + thisId + "' class='btn blue custombtnstyle'>ADD</a>"
        }
    }).parent().find('.select2-with-searchbox').on('click', '#addNewtrans_noSelect', function () {
        /* add the new term */
        var Protocol = $('#newtrans_noSelectTerm').val();
        var thisId = $(this).attr("data-id");
        $.post(hosturl + "/controllers/embryoslab.php?ac=addRow", {value: Protocol, table: 'icsi_number'}, function (data) {

            $('.trans_no > .deleteoptincompo').before('<option value="' + Number(data) + '" >' + Protocol + '</option>');
            $('#' + thisId + '').select2('val', Number(data)); // select the new term
            $('.trans_no').select2('close'); // close the dropdown

            $('.updateElement[id=' + thisId + ']').trigger("change");
        });
    });
</script>
{/literal}