<script type="text/javascript">

    $(document).ready(function() {
        $("#date, #date2,#date3,#date4").datepicker();
        $("#date,#date2,#date3,#date4 ").datepicker("option", "dateFormat", "yy/mm/dd");

        if ($("#date,#date2,#date3,#date4").val() == "") {
            var date_reg = "<?php echo date("Y/m/d", $patient->pi_date_reg) ?>"
            var pi_borndate = "<?php echo date("Y/m/d", $patient->pi_borndate) ?>"
            var pi_ocurdate = "<?php echo date("Y/m/d", $patient->pi_ocurdate) ?>"
            var pi_importance_date = "<?php echo date("Y/m/d", $patient->pi_importance_date) ?>"

            $("#date").val(date_reg);
            $("#date2").val(pi_borndate);
            $("#date3").val(pi_ocurdate);
            $("#date4").val(pi_importance_date);
        }
    });

</script>
<div class="block">
    <div class="title lightTextShadow">تسجيل إستمارة طبية</div>

    <div class="content">
        <?php echo form_open('patient/admin_patient/edit/' . $patient->pi_id, array('id' => 'patient_new')) ?>
        <fieldset class="form boxStyle">             
            <?php echo $this->template->flash_msg(); ?>

            <table class="dataGrid" cellspacing="0" cellpadding="0" border="0">
                <tbody>
                    <tr class="odd">                                  
                        <td colspan = "2">
                            <!-- /////////// 2 columns start /////////-->
                            <div>
                                <label class="label2">الرقم اليدوي:<span></span></label>
                                <input class="textBox sml rnd5" name="pi_num2" id="pi_num2" type="text"
                                       value="<?= set_value('pi_num2', $patient->pi_num2) ?>">
                            </div>
                            <div class="inlineBlock">
                                <label class="label2">رقم الحالة :<span> <?= $patient->pi_num ?></span></label>
                                <input type="hidden" name="pi_num" value="<?= set_value('pi_num', $patient->pi_num) ?>" />

                                <label for="pi_date_reg" class="label2">التاريخ :</label>
                                <input class="inputDate textBox rnd5" id="date" name="pi_date_reg" value="<?= set_value('pi_date_reg', $patient->pi_date_reg) ?>" />
                                <?php echo form_error('pi_date_reg'); ?>

                            </div>
                            <div class="inlineBlock">
                                <label class="label2">الفرع :</label>
                                <?php echo form_dropdown('pi_branch_id', $branch_category, $patient->pi_branch_id, 'class="select sml2 rnd5"'); ?>
                                <?php echo form_error('pi_branch_id'); ?>
                                <br />
                            </div><br/>
                            <!-- /////////// 2 columns end /////////-->
                        </td>
                    </tr>
                    <tr>
                        <td class="td">معلومات شخصية</td>
                        <td>
                            <!-- /////////// 4 columns start /////////-->
                            <div class="inlineBlock">
                                <label for="pi_name" class="label2">اسم المريض <em>*</em>:</label>
                                <input id="pi_name" class="textBox sml rnd5" name="pi_name" value="<?= set_value('pi_name', $patient->pi_name) ?>"  /><br />
                                <?php echo form_error('pi_name'); ?>

                                <label for="pi_passport" class="label2">رقم جواز السفر :</label>
                                <input id="pi_passport" class="textBox sml rnd5" name="pi_passport" value="<?= set_value('pi_passport', $patient->pi_passport) ?>"  /><br />
                                <?php echo form_error('pi_passport'); ?>

                            </div>
                            <div class="inlineBlock">
                                <label for="pi_father" class="label2">اسم الاب<em>*</em>:</label>
                                <input id="pi_father" class="textBox sml rnd5" name="pi_father" value="<?= set_value('pi_father', $patient->pi_father) ?>"  /><br />
                                <?php echo form_error('pi_father'); ?>

                                <label for="pi_borndate" class="label2">تاريخ الميلاد :</label>
                                <input class="inputDate2 textBox rnd5" id="date2" name="pi_borndate" value="<?= set_value('pi_borndate', $patient->pi_borndate) ?>" />
                                <?php echo form_error('pi_borndate'); ?>

                            </div>
                            <div class="inlineBlock">
                                <label for="pi_family" class="label2">العائلة<em>*</em>:</label>
                                <input id="pi_family" class="textBox sml rnd5" name="pi_family" value="<?= set_value('pi_family', $patient->pi_family) ?>"/><br />
                                <?php echo form_error('pi_family'); ?>

                                <label for="pi_bornplace" class="label2">مكان الميلاد :</label>
                                <input id="pi_bornplace" class="textBox sml rnd5" name="pi_bornplace" value="<?= set_value('pi_bornplace', $patient->pi_bornplace) ?>"/><br />
                                <?php echo form_error('pi_bornplace'); ?>

                            </div>
                            <div class="inlineBlock">
                                <label for="pi_mother" class="label2">اسم الام<em>*</em>:</label>
                                <input id="pi_mother" class="textBox sml rnd5" name="pi_mother" value="<?= set_value('pi_mother', $patient->pi_mother) ?>"/><br />
                                <?php echo form_error('pi_mother'); ?>

                                <label class="label2">النوع :</label>
                                <input type="radio" id="1" name="pi_gender" value="1" <?php echo set_radio('pi_gender', '1', $patient->pi_gender == '1'); ?>/><label for="1">ذكر</label>
                                <input type="radio"  id="0" name="pi_gender" value="0" <?php echo set_radio('pi_gender', '0', $patient->pi_gender == '0'); ?>/><label for="0">أنثى</label><br />

                                <?php echo form_error('pi_gender'); ?>

                            </div><br />
                            <!-- /////////// 4 columns end /////////-->
                        </td>
                    </tr>
                    <tr class="odd">
                        <td class="td">العنوان</td>
                        <td>
                            <!-- /////////// 2 columns start /////////-->
                            <div class="inlineBlock">
                                <label for="pi_turk_address" class="label2" >في تركيا :</label>
                                <input id="pi_turk_address" class="textBox lrg rnd5" name="pi_turk_address" value="<?= set_value('pi_turk_address', $patient->pi_turk_address) ?>"/><br />
                                <?php echo form_error('pi_turk_address'); ?>

                                <label for="pi_syr_address" class="label2">في سوريا :</label>
                                <input id="pi_syr_address" class="textBox lrg rnd5" name="pi_syr_address" value="<?= set_value('pi_syr_address', $patient->pi_syr_address) ?>"/><br />
                                <?php echo form_error('pi_syr_address'); ?>

                            </div>
                            <div class="inlineBlock">                           
                                <label for="pi_turk_phone" class="label2">رقم الهاتف :</label>
                                <input id="pi_turk_phone" class="textBox med2 rnd5" name="pi_turk_phone" value="<?= set_value('pi_turk_phone', $patient->pi_turk_phone) ?>"/><br />
                                <?php echo form_error('pi_turk_phone'); ?>

                                <label for="pi_syr_phone" class="label2">رقم الهاتف :</label>
                                <input id="pi_syr_phone" class="textBox med2 rnd5" name="pi_syr_phone" value="<?= set_value('pi_syr_phone', $patient->pi_syr_phone) ?>"/><br />
                                <?php echo form_error('pi_syr_phone'); ?>

                            </div><br/>
                            <!-- /////////// 2 columns end /////////-->
                        </td>
                    </tr>
                    <tr>
                        <td class="td">معرف او قريب</td>
                        <td>
                            <!-- /////////// 2 columns start /////////-->
                            <div class="inlineBlock">
                                <label for="pi_relative_name" class="label2">الاسم :</label>
                                <input id="pi_relative_name" class="textBox lrg rnd5"  name="pi_relative_name" value="<?= set_value('pi_relative_name', $patient->pi_relative_name) ?>"/><br />
                                <?php echo form_error('pi_relative_name'); ?>

                                <label for="pi_relative_address" class="label2">العنوان :</label>
                                <input id="pi_relative_address" class="textBox lrg rnd5"  name="pi_relative_address" value="<?= set_value('pi_relative_address', $patient->pi_relative_address) ?>"/><br />
                                <?php echo form_error('pi_relative_address'); ?>

                            </div>
                            <div class="inlineBlock">                           
                                <label for="pi_relative_type" class="label2">صلة القرابة :</label>
                                <input id="pi_relative_type" class="textBox med2 rnd5"  name="pi_relative_type" value="<?= set_value('pi_relative_type', $patient->pi_relative_type) ?>"/><br />
                                <?php echo form_error('pi_relative_type'); ?>

                                <label for="pi_relative_phone" class="label2">رقم الهاتف :</label>
                                <input id="pi_relative_phone" class="textBox med2 rnd5"  name="pi_relative_phone" value="<?= set_value('pi_relative_phone', $patient->pi_relative_phone) ?>"/><br />
                                <?php echo form_error('pi_relative_phone'); ?>

                            </div><br/>
                            <!-- /////////// 2 columns end /////////-->
                        </td>
                    </tr>
                    <tr class="odd">
                        <td class="td">معلومات عن الحالة</td>
                        <td>
                            <label for="pi_ocurdesc" class="label2">وصف مختصر للحالة :</label>
                            <input id="pi_ocurdesc" class="textBox lrg2 rnd5" name="pi_ocurdesc" value="<?= set_value('pi_ocurdesc', $patient->pi_ocurdesc) ?>"/><br />
                            <?php echo form_error('pi_ocurdesc'); ?>

                            <label for="pi_ocurdate" class="label2">تاريخ حدوثها :</label>
                            <input class="inputDate3 textBox rnd5" id="date3" name="pi_ocurdate"  value="<?= set_value('pi_ocurdate', $patient->pi_ocurdate) ?>" /><br />
                            <?php echo form_error('pi_ocurdate'); ?>


                            <label for="pi_ocurplace" class="label2">مكان حدوثها :</label>
                            <input id="pi_ocurplace" class="textBox med2 rnd5" name="pi_ocurplace" value="<?= set_value('pi_ocurplace', $patient->pi_ocurplace) ?>"/><br />
                            <?php echo form_error('pi_ocurplace'); ?>


                            <label class="pi_steps">إجراءات سابقة (مع ذكر الاماكن) :</label>
                            <textarea rows="6" cols="0" class="textArea lrg2 rnd5" name="pi_steps" ><?= set_value('pi_steps', $patient->pi_steps) ?></textarea><br /><br />
                            <?php echo form_error('pi_steps'); ?>

                            <label class="pi_current_sit">الوضع الحالى :</label>
                            <textarea rows="6" cols="0" class="textArea lrg2 rnd5" name="pi_current_sit" ><?= set_value('pi_current_sit', $patient->pi_current_sit) ?></textarea><br /><br />
                            <?php echo form_error('pi_current_sit'); ?>

                        </td>
                    </tr>
                </tbody>
            </table>                                                                                  
        </fieldset>
    </div></div>
<br/>
<div class="block">
    <div class="title lightTextShadow">لإستعمال الإدارة الطبية</div>
    <div class="content">
        <fieldset class="form boxStyle">

            <table class="dataGrid" cellspacing="0" cellpadding="0" border="0">
                <tbody>                                
                    <tr>
                        <td class="td">الأهمية</td>
                        <td>                                                                                
                            <label for="pi_importance_date" class="label2">التاريخ :</label>

                            <input class="inputDate4 textBox rnd5" id="date4" name="pi_importance_date" value="<?= set_value('pi_importance_date', $patient->pi_importance_date) ?>" />
                            <?php echo form_error('pi_importance_date'); ?>

                            <input type="radio" id="im1" name="pi_importance" value="0" <?php echo set_radio('pi_importance', '0', $patient->pi_importance == '0'); ?> /><label for="0">طارئ</label>
                            <input type="radio"  id="im2" name="pi_importance" value="1" <?php echo set_radio('pi_importance', '1', $patient->pi_importance == '1'); ?> /><label for="1">مستعجل</label>
                            <input type="radio"  id="im3" name="pi_importance" value="2" <?php echo set_radio('pi_importance', '2', $patient->pi_importance == '2'); ?> /><label for="2">عادى</label>
                            <input type="radio"  id="im4" name="pi_importance" value="3" <?php echo set_radio('pi_importance', '3', $patient->pi_importance == '3'); ?> /><label for="3">أخرى</label>
                        </td>
                        <?php echo form_error('pi_importance'); ?>

                    </tr>
                    <tr class="odd">
                        <td class="td">الفرقة الطبية</td>
                        <td>
                            <textarea rows="4" cols="0" class="textArea lrg2 rnd5" name="pi_med_team" ><?= set_value('pi_med_team', $patient->pi_med_team) ?></textarea><br /><br />
                            <?php echo form_error('pi_med_team'); ?>

                        </td>
                    </tr>

                    <tr>
                        <td class="td">التوجية الطبى</td>
                        <td>
                            <textarea rows="4" cols="0" class="textArea lrg2 rnd5"  name="pi_guide_team"><?= set_value('pi_guide_team', $patient->pi_guide_team) ?></textarea><br /><br />
                            <?php echo form_error('pi_guide_team'); ?>

                        </td>
                    </tr>
                    <tr class="odd">
                        <td class="td">الإيواء</td>
                        <td>                                        
                            <label for="pi_housing_date" class="label2">المدة :</label>
                            <input id="pi_housing_date" class="textBox med rnd5" name="pi_housing_date" value="<?= set_value('pi_housing_date', $patient->pi_housing_date) ?>"/>
                            <?php echo form_error('pi_housing_date'); ?>

                            <br />
                            <label for="pi_housing_follow" class="label2">المرافقة :</label>
                            <input id="pi_housing_follow" class="textBox med rnd5"  name="pi_housing_follow" value="<?= set_value('pi_housing_follow', $patient->pi_housing_follow) ?>"/>
                            <?php echo form_error('pi_housing_follow'); ?>

                            <br />

                        </td>
                    </tr>
                </tbody>
            </table>
            <div class="center">
                <input id="print" type="submit" name="action" value="حفظ" class="button sml inlineBlock rnd5 drkTextShadow" />
                <input id="savePrint" type="submit" name="action" value="طباعة" class="button sml inlineBlock rnd5 drkTextShadow" />
                <input id="list" type="submit" name="action" value="القائمة" class="button sml inlineBlock rnd5 drkTextShadow" />


            </div>
        </fieldset>
        </form>
    </div>
</div><!-- Form End -->
<!-- Form Start -->