<?php	
/** ensure this file is being included by a parent file */
defined( '_VALID_' ) or die( 'Direct Access to this location is not allowed.' );

foreach($_REQUEST as $key=>$value)
{
  $$key=$value;
}
$sqlID = "SELECT * FROM `idocument_main` Where id = '$id'";
$dbqueryID = mysqli_query($connect,$sqlID);
$dataID = mysqli_fetch_assoc($dbqueryID);

?>
<br>
<div class="container">
  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title"><span class='glyphicon glyphicon-list-alt' aria-hidden='true'> </span> รายละเอียดบันทึกข้อความ</h3>
    </div>
    <div class="panel-body">
      <form data-toggle="validator" role="form" enctype="multipart/form-data" class="form-horizontal" method="POST" action="?option=<?php echo $_REQUEST['option'];?>&task=save&action=insert">

        <div class="form-group">
          <label for="workgroup" class="col-sm-2 control-label">ส่วนราชการ</label>
          <div class="col-sm-10">
              <input class = "form-control" value="<?php echo $dataID['workgroup_txt'];?>" readonly>
          </div>
        </div>
        <div class="form-group">
          <label for="bookNoText" class="col-sm-2 control-label">ที่</label>
          <div class="col-sm-4">
            <input type="text" class="form-control" name="bookNoText" id="bookNoText" placeholder="เลขที่ออกอัตโนมัติ" disabled="true" value="<?php echo $dataID['book_no'];?>">
          </div>
          <label for="bookdate" class="col-sm-2 control-label">วันที่</label>
          <div class="col-sm-2">
            <input class = "form-control" value="<?php echo $dataID['book_date'];?>" readonly>
          </div>
        </div>
        <div class="form-group">
          <label for="subject" class="col-sm-2 control-label">เรื่อง</label>
          <div class="col-sm-10">
            <input type="text" class="form-control" name="subject" id="subject" placeholder="ส่วนสำหรับพิมพ์ชื่อเรื่อง" readonly value="<?php echo $dataID['subject'];?>">
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">ร่างหนังสือส่ง</label>
          <div class="col-sm-8">
            <input type="text" class="form-control " name="prebooktxt" id="prebooktxt" placeholder="" readonly >
            <input type="hidden" class="form-control " name="predoc_id" id="predoc_id" value="">
          </div>
          <div class="col-sm-2">
            <input type="button" class="form-control btn-primary" name="btn_predoc" id="btn_predoc" value="ร่างหนังสือราชการ" data-toggle="modal" data-target="#SelectPreDoc">
          </div>
        </div>
        <div class="form-group">
          <label for="book_to" class="col-sm-2 control-label">เรียน</label>
          <div class="col-sm-10">
            <input type="text" class="form-control " name="book_to" id="book_to" placeholder="" value="<?php echo $dataID['book_to'];?>">
          </div>
        </div>
        <div class="form-group">
          <label for="bookdetail" class="col-sm-2 control-label">ย่อหน้า 1</label>
          <div class="col-sm-10">
            <textarea class="form-control" rows="6" name="content1" id="content1" placeholder="ส่วนสำหรับพิมพ์เนื้อหา" readonly><?php echo trim($dataID['content1']);?></textarea>
          </div>
        </div>
        <div class="form-group">
          <label for="bookdetail" class="col-sm-2 control-label">ย่อหน้า 2</label>
          <div class="col-sm-10">
            <textarea class="form-control" rows="6" name="content2" id="content2" placeholder="ส่วนสำหรับพิมพ์เนื้อหา" readonly><?php echo trim($dataID['content2']);?></textarea>
          </div>
        </div>
        <div class="form-group">
          <label for="bookdetail" class="col-sm-2 control-label">ย่อหน้า 3</label>
          <div class="col-sm-10">
            <textarea class="form-control" rows="6" name="content3" id="content3" placeholder="ส่วนสำหรับพิมพ์เนื้อหา" readonly><?php echo trim($dataID['content3']);?></textarea>
          </div>
        </div>
        <div class="form-group">
          <input name="cntrow" type="hidden" id="cntrow" value="0">
          <label for="file" class="col-sm-2 control-label">เอกสารแนบ</label>
            <div class="col-sm-10">


            </div>
        </div>
        <hr>
        <!--div class="form-group">      
          <label class="col-sm-2 control-label"></label>
          <div>
            <input type='checkbox'  name='no_comment' id='no_comment' value='1'>&nbsp;&nbsp;<label for="no_comment">  ไม่ต้องผ่านผู้บังคับบัญชาขั้นต้น (เลือกกรณีผู้บังคับบัญชาขั้นต้นไม่ได้ปฏิบัติราชการ)</label>
          </div>
        </div-->        
        <div class="form-group">      
          <label class="col-sm-2 control-label">ส่งบันทึกข้อความถึง</label>
          <div class="col-sm-4">
            <input type="text" class="form-control" name="booktotxt" id="booktotxt" placeholder="เลือกบุคคลพิจารณา/เห็นชอบ" value="<?php echo trim($dataID['content2']);?>" readonly>
          </div>
          <div class="col-sm-4">
            
          </div>
        </div> 
        <hr>
        <div class="form-group">
          <label for="post_personname" class="col-sm-2 control-label">บันทึกโดย</label>
          <div class="col-sm-3">
            <input type="text" class="form-control" id="post_personname" value="<?php echo trim($dataID['officer_name']);?>"  name="officer_name" readonly>

          </div>
        </div>        
        <div class="form-group">
          <label for="post_position" class="col-sm-2 control-label">ตำแหน่ง</label>
          <div class="col-sm-3">
            <input type="text" class="form-control" id="post_position" value="<?php echo trim($dataID['officer_position']);?>"  name="officer_position" readonly>
          </div>
        </div>
        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-10">
            <button type="button" class="btn btn-info pull-right" onClick="history.go(-1);return true;"><span class="glyphicon glyphicon-arrow-left"></span>&nbsp;ย้อนกลับ</button>
          </div>
        </div>
      </form>
    </div>
  </div>
</div> 

<!-- Modal -->
<div class="modal fade" id="SelectPreDoc" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLongTitle">ร่างหนังสือราชการ</h5>
      </div>
      <div class="modal-body">


      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>

<?php
//print_r($_SESSION);
?>