
<div class="row">
 <div class="col-md-12">
  <div class="portlet light bordered" style="min-height:94px;">
   <div class="portlet-title">
    <div class="caption">
     <span class="caption-subject bold font-blue-hoki"> Attached Files </span>
    </div>
   </div>
   <div class="portlet-body">
    <div id="" class="slimScrollDiv" style="min-height: 244px;">
     <div class="mt-comments" style="cursor: pointer;">
      <?php
      $patient_files = mysql_query("SELECT * FROM patient_file_attachments WHERE process_claim_no = '$process_claim_no' AND old_folder='yes' ORDER BY id ASC");
      $count_files = mysql_num_rows($patient_files);
      $Picturepath = "../consultation/patients_consultation_uploads/";
      if($count_files > 0){
       $total_entry = $count_files;
       $file_identifier = 1;
       while($row_files = mysql_fetch_assoc($patient_files)){
        $path_info = pathinfo($row_files['file_path']);
        $ext = $path_info['extension'];
        $valid_formats = array("jpg","png","gif","bmp","icon");
        $valid_formats2 = array("docx","doc");
        $valid_formats3 = array("xlsx","xls");
        $valid_formats4 = array("pptx");
        $valid_formats5 = array("csv");
        $valid_formats6 = array("xml");
        $valid_formats7 = array("pdf");
        $valid_formats8 = array("txt"); ?>
        <div id="file_attachment_wrapper_<?php echo $file_identifier;?>" class="mt-comment" style="background-color: #FAFAFA;border: 1px solid #eee;">    
         <div class="mt-comment-img">
          <?php
          if(in_array(strtolower($ext),$valid_formats)) { ?>
           <img src="<?php echo $Picturepath.$row_files['filename']; ?>" style="height: 50px;width:50px;">
           <?php      
          }
          else if(in_array(strtolower($ext),$valid_formats2)) { ?>
           <img src="<?php echo '../'.FOLDER_NAME;?>images/word-iconx.png" style="width: 30px;height: 30px;">
           <?php      
          }
          else if(in_array(strtolower($ext),$valid_formats3)) { ?>
           <img src="<?php echo $Picturepath.$row_files['filename']; ?>" style="width: 30px;height: 30px;">
           <?php      
          }
          else if(in_array(strtolower($ext),$valid_formats4)) { ?>
           <img src="<?php echo '../'.FOLDER_NAME;?>images/pp-iconx.png" style="width: 30px;height: 30px;">
           <?php      
          }
          else if(in_array(strtolower($ext),$valid_formats5)) { ?>
           <img src="<?php echo $Picturepath.$row_files['filename']; ?>" style="width: 30px;height: 30px;">
           <?php      
          }
          else if(in_array(strtolower($ext),$valid_formats6)) { ?>
           <img src="<?php echo '../'.FOLDER_NAME;?>images/xml-iconx.png" style="width: 30px;height: 30px;">
           <?php      
          }
          else if(in_array(strtolower($ext),$valid_formats7)) { ?>
           <img src="<?php echo $Picturepath.$row_files['filename']; ?>" style="width: 30px;height: 30px;">
           <?php      
          }
          else if(in_array(strtolower($ext),$valid_formats8)) { ?>
           <img src="<?php echo $Picturepath.$row_files['filename']; ?>" style="width: 30px;height: 30px;">
           <?php      
          }else{ ?>
           <img src="<?php echo '../'.FOLDER_NAME;?>images/file-iconx.png" style="width: 30px;height: 30px;">
           Other File
          <?php } ?>
         </div>
         <div class="mt-comment-body">
          <div class="mt-comment-info">
           <span class="mt-comment-author"> 
            <a href="<?php echo $Picturepath.$row_files['filename'];?>" target="_blank">   FILE NAME : <?php echo $row_files['filename'];?> </a>
           </span>
           <span class="mt-comment-date"> <?php echo date('jS F, Y g:ia', strtotime($row_files['date_time'])); ?> </span>
          </div>
          <div class="mt-comment-text">TAGS : <?php echo $row_files['tags'];?></div>
          <div class="mt-comment-text">DATE : <?php echo $row_files['date'];?></div>
          <div class="mt-comment-text">TIME : <?php echo $row_files['time'];?></div>
          <div class="mt-comment-details">
           <ul class="mt-comment-actions" style="display: block">
            <li><a style="color:red;" onclick="DeleteFileAttachment('delete_file','file_attachment_wrapper_', '<?php echo $file_identifier;?>','<?php echo $row_files['id']; ?>')"> Delete File <i class="fa fa-remove"></i></a></li>
            <li><a onclick="AddNewRow('attach_another_file', 'file_attachment_wrapper_', '<?php echo $file_identifier;?>','<?php echo $patient_id.'@@@'.$medical_note_id.'@@@'.$process_claim_no?>')">Attach Another File <i class="fa fa-plus-circle"></i></a></li>
           </ul>
          </div>
         </div>
        </div>
        <?php $file_identifier++;  }  
       }
       else{ 
        $total_entry = 1;
        for ($index = $count_files + 1;$index <=1;$index++) { ?>
         <div id="file_attachment_wrapper_<?php echo $index;?>" class="mt-comment" style="background-color: #FAFAFA;border: 1px solid #eee;">
          <div class="mt-comment-img">
           <img style="width:50px;height: 50px;" src="<?php echo '../'.FOLDER_NAME;?>images/attach-2-icon.png"> 
          </div>
          <form name="document_form_<?php echo $index;?>" id="document_form_<?php echo $index;?>" method="post" enctype="multipart/form-data" action="Consultancy/ajaximage_add_document.php">
           <div class="mt-comment-body">
            <div class="mt-comment-info">
             <span class="mt-comment-author"> 
              <input type="file" name="documentname_<?php echo $index;?>" id="documentname_<?php echo $index;?>" onchange="UploadPatientFiles('<?php echo $index;?>');return false;"/>
              <input type="hidden" name="process_claim_no_<?php echo $index;?>" id="" value="<?php echo $process_claim_no;?>">
              <input type="hidden" name="medical_note_id_<?php echo $index;?>" id="" value="<?php echo $medical_note_id;?>">
              <input type="hidden" name="file_name_add" id="file_name_add_<?php echo $index;?>" value="<?php echo $index;?>">
             </span>
             <span id="loading_file_<?php echo $index;?>" class="mt-comment-date">  VIEW FILE </span>
            </div>
            <div class="mt-comment-text"> FILE NAME : N/A </div>
            <div class="mt-comment-details">
             <input placeholder="ENTER TAGS HERE BEFORE UPLOADING FILE" type="text" class="form-control" name="tags_<?php echo $index;?>"><br>
             <input placeholder="ENTER DATE ON FILE (DD-MM-YYYY)" type="text" class="form-control" name="date_<?php echo $index;?>"><br>
             <input placeholder="ENTER TIME ON FILE" type="text" class="form-control" name="time_<?php echo $index;?>">
             <ul class="mt-comment-actions" style="display: block">
              <li><a style="color:red;" onclick="RemoveNewRow('file_attachment_wrapper_', '<?php echo $index;?>')"> Remove <i class="fa fa-remove"></i></a></li>
              <li><a onclick="AddNewRow('attach_another_file', 'file_attachment_wrapper_', '<?php echo $index;?>','<?php echo $patient_id.'@@@'.$medical_note_id.'@@@'.$process_claim_no;?>')">Attach Another File <i class="fa fa-plus-circle"></i></a></li>
             </ul>
            </div>
           </div>
          </form>
         </div>
        <?php } } ?>
        <input type="hidden" name="total_entry" id="total_entry" value="<?php echo $total_entry;?>">
       </div>
      </div>
     </div>
    </div>
   </div>
  </div> 

  <!--<center><button id="save_patient_consultation" onclick="save_consultation('save_patient_consultation','<?php // echo $patient_no."@@@".$id;?>','','clash_appointment_div','<?php // echo $medical_note_id ?>');return false;" class="btn btn green"> Finish <i class="icon-ok"></i></button></center>-->
