
<div class="portlet box purple">
    <div class="portlet-title">
        <div class="caption">Past History </div>
        <div class="actions"></div>
        <div class="tools">
            <a href="#" class="collapse" title="تصغير / تكبير"></a>
        </div>
    </div>
    <div class="portlet-body">
        <div class="row">
            <div id="ultrasoundgynaDiv">
                <div class="row">
                    <div class="portlet-body form" >
                        <form>
                            <div class="form-body">
                                <input type="hidden" id="pastsurgical_itr" value="{$pastsurgicalcount}"/>
                                <input type="hidden" id="contract_itr" value="{$allcontractcount}" />
                                <input type="hidden" id="pastmedical_itr" value="{$phpastmedicalcount}" />

                                <table>
                                    <tbody>
                                        <tr>
                                            <th class="wds15">Medical
                                                <button type="button" class="btn btn-xs blue" id="pastmedical_btn" data-summary="1">
                                                    <i class="fa fa-plus"></i> </button>
                                            </th>
                                            <td> 
                                                <table>
                                                    <tr>
                                                        <th class="wds45">Disease </th>
                                                        <th> Note</th>
                                                        <th class="wds10"> Husband</th>
                                                        <th class="wds5"> </th>
                                                    </tr>
                                                </table>
                                                <table  id="pastmedical_div">
                                                    {assign var=i value=1}
                                                    {foreach $mypastmedical as $myallphpastmedical}
                                                    <tr>
                                                        <td class="wds45">
                                                            <select  class="form-control medicaldisease updateElement allupdateselect" id="medicaldisease{$i}" data-val="{$myallphpastmedical->medicaldisease}" data-itr="{$i}"  name="medicaldisease" data-colName="medicaldisease" select-tableName="phpastmedicaldisease" data-id="{$myallphpastmedical->id}" data-tableName="phpastmedical" >
                                                                <option value="">choose</option>
                                                                {foreach  $allphpastmedicaldisease as $myallphpastmedicaldisease}
                                                                <option value="{$myallphpastmedicaldisease->id}" {if {$myallphpastmedical->medicaldisease} eq  {$myallphpastmedicaldisease->id} } selected {/if}>{$myallphpastmedicaldisease->name} </option>
                                                                {/foreach}
                                                                <option value="-2" class="deleteoptincompo">Delete</option>
                                                            </select>
                                                        </td>
                                                        <td>
                                                            <input type="text" class="amrpop form-control updateElement"  
                                                                   name="medicalnote" data-colName="medicalnote" placeholder="Note" 
                                                                   value="{$myallphpastmedical->medicalnote}" 
                                                                   data-id="{$myallphpastmedical->id}" data-tableName="phpastmedical"/>
                                                        </td>
                                                        <td class="wds10">
                                                            <input type="checkbox"   id="for_husband" value="1" class="updateElementCheck" 
                                                                   data-id="{$myallphpastmedical->id}" data-tableName="phpastmedical" 
                                                                   data-colName="for_husband"  
                                                                   {if $myallphpastmedical->for_husband  == 1 } checked {/if}>
                                                        </td>
                                                        <td class="wds5">
                                                            <a class="btn grey-cascade btn-xs deletemsgEX2" data-id="{$myallphpastmedical->id}" 
                                                               data-link="{$controllname}"  data-fn="del" data-tableName="phpastmedical" data-colName="del">
                                                                <i class="fa fa-times"></i> </a>
                                                        </td>
                                                    </tr>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </table>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th> Surgical 
                                                <button type="button" class="btn btn-xs blue" id="pastsurgical_btn" data-summary="1">
                                                    <i class="fa fa-plus"></i> </button>
                                            </th>
                                            <td> 
                                                <table>
                                                    <tr>
                                                        <th class="wds45">Operation </th>
                                                        <th> Note</th>
                                                        <th class="wds10"> Husband</th>
                                                        <th class="wds5"> </th>
                                                    </tr>
                                                </table>
                                                <table  id="pastsurgical_div">
                                                    {assign var=i value=1}
                                                    {foreach $pastsurgical as $myallpastsurgical}
                                                    <tr>
                                                        <td class="wds45">
                                                            <select  class="form-control surgicaloperation updateElement allupdateselect" id="surgicaloperation{$i}" data-val="{$myallpastsurgical->surgicaloperation}" data-itr="{$i}"  name="surgicaloperation" select-tableName="phpastsurgicaloperation" data-colName="surgicaloperation" data-id="{$myallpastsurgical->id}" data-tableName="phpastsurgical" >
                                                                <option value="">choose</option>
                                                                {foreach  $allphpastsurgicaloperation as $myallphpastsurgicaloperation}
                                                                <option value="{$myallphpastsurgicaloperation->id}" {if {$myallpastsurgical->surgicaloperation} eq  {$myallphpastsurgicaloperation->id} } selected {/if}>{$myallphpastsurgicaloperation->name} </option>
                                                                {/foreach}
                                                                <option value="-2" class="deleteoptincompo">Delete</option>
                                                            </select>
                                                        </td>
                                                        <td>
                                                            <input type="text" class="amrpop form-control updateElement" 
                                                                   name="surgicalnote" data-colName="surgicalnote" placeholder="Note" 
                                                                   data-id="{$myallpastsurgical->id}" data-tableName="phpastsurgical" 
                                                                   value="{$myallpastsurgical->surgicalnote}"/>
                                                        </td>
                                                        <td class="wds10">
                                                            <input type="checkbox"   id="for_husband" value="1" class="updateElementCheck" 
                                                                   data-id="{$myallpastsurgical->id}" data-tableName="phpastsurgical"  
                                                                   data-colName="for_husband"   
                                                                   {if $myallpastsurgical->for_husband  == 1 } checked {/if}>
                                                        </td>
                                                        <td class="wds5">
                                                            <a class="btn grey-cascade btn-xs deletemsgEX2" data-id="{$myallpastsurgical->id}" 
                                                               data-link="{$controllname}"  data-fn="del" data-tableName="phpastsurgical" data-colName="del">
                                                                <i class="fa fa-times"></i> </a>
                                                        </td>
                                                    </tr>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </table>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>Contraception
                                                <button type="button" class="btn btn-xs blue" id="contraception_btn" data-summary="1">
                                                    <i class="fa fa-plus"></i> </button>
                                            </th>
                                            <td> 
                                                <table>
                                                    <tr>
                                                        <th class="wds16">Type </th>
                                                        <th class="wds16">Duration </th>
                                                        <th class="wds16">Stopped </th>
                                                        <th> Note</th>
                                                        <th class="wds5"> </th>
                                                    </tr>
                                                </table>
                                                <table  id="contraception_div">
                                                    {assign var=i value=1}
                                                    {foreach $allcontract as $myallcontract}
                                                    <tr>
                                                        <td class="wds16">
                                                            <select  class="form-control contype updateElement allupdateselect" id="contype{$i}" data-val="{$myallcontract->contype}" data-itr="{$i}" name="contype" data-colName="contype" select-tableName="phcontracttype"  data-id="{$myallcontract->id}"  data-tableName="phcontraception" >
                                                                <option value="">choose</option>
                                                                {foreach  $allphcontracttype as $myallphcontracttype}
                                                                <option value="{$myallphcontracttype->id}" {if {$myallcontract->contype} eq {$myallphcontracttype->id}} selected {/if} >{$myallphcontracttype->name} </option>
                                                                {/foreach}

                                                                <option value="-2" class="deleteoptincompo">Delete</option>
                                                            </select>
                                                        </td>
                                                        <td class="wds16">
                                                            <input type="text" class="form-control updateElement wds85" placeholder="Duration" 
                                                                   name="contduration" data-colName="contduration"  
                                                                   value="{$myallcontract->contduration}"  data-id="{$myallcontract->id}" 
                                                                   data-tableName="phcontraception"  style="display: inline;"/> Y
                                                        </td>
                                                        <td class="wds16">
                                                            <input type="text" class="form-control  updateElement wds85" placeholder="Stopped" 
                                                                   name="contstopped" data-colName="contstopped"  
                                                                   value="{$myallcontract->contstopped}"  data-id="{$myallcontract->id}" 
                                                                   data-tableName="phcontraception" style="display: inline;"/> Y
                                                        </td>

                                                        <td>
                                                            <input type="text" class="amrpop form-control updateElement" placeholder="Note" 
                                                                   name="contranote" data-colName="contranote"  
                                                                   value="{$myallcontract->contranote}"  data-id="{$myallcontract->id}" 
                                                                   data-tableName="phcontraception"/>
                                                        </td>


                                                        <td  class="wds5">
                                                            <a class="btn grey-cascade btn-xs deletemsgEX2" data-id="{$myallcontract->id}" 
                                                               data-link="{$controllname}"  data-fn="del" data-tableName="phcontraception" data-colName="del">
                                                                <i class="fa fa-times"></i> </a>
                                                        </td>
                                                    </tr>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </table>
                                            </td>
                                        </tr>

                                        <tr>
                                            <th>Drug Sensitivity</th>
                                            <td>
                                                <select multiple="" size="1" class="form-control select2me drug_sensitivity updateDiagnosis"
                                                        id="drug_sensitivity"   data-id="{$obstetric_case->id}" data-colName="drug_sensitivity" 
                                                        data-tableName="obstetric_case">
                                                    <option value="">choose</option>
                                                    {foreach $drug_sensitivity as $data}
                                                    <option value="{$data->id}" {if $data->id|in_array:$obstetric_case->drug_sensitivity}selected="selected"{/if}>{$data->name}</option>
                                                    {/foreach}
                                                    <option value="-1" class="addDiagnosis">Add</option>
                                                    <option value="-2" class="deleteoptincompo">Delete</option>
                                                </select>
                                            </td>
                                        </tr>

                                        <tr>
                                            <th>Blood transfusion</th>
                                            <td> 
                                                <select multiple="" size="1" class="form-control select2me blood_transfusion updateDiagnosis"
                                                        id="blood_transfusion"   data-id="{$obstetric_case->id}" data-colName="blood_transfusion" 
                                                        data-tableName="obstetric_case">
                                                    <option value="">choose</option>
                                                    {foreach $blood_transfusion as $data}
                                                    <option value="{$data->id}" {if $data->id|in_array:$obstetric_case->blood_transfusion}selected="selected"{/if}>{$data->name}</option>
                                                    {/foreach}
                                                    <option value="-1" class="addDiagnosis">Add</option>
                                                    <option value="-2" class="deleteoptincompo">Delete</option>
                                                </select>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
</div>



