<script src="//code.jquery.com/jquery.js"></script>

<?php $__env->startSection('content'); ?>
<?php echo notifyCss(); ?>
 <?php echo notifyJs(); ?> 
 
<?php if($errors->any()): ?>
  <div class="alert alert-danger">
    <ul>
        <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <li><?php echo e($error); ?></li>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </ul>
  </div>
 <?php endif; ?>


<?php if(session('status')): ?>
  <div class="alert alert-success">
    <?php echo e(session('status')); ?>

  </div>
<?php endif; ?>
            
 <?php if(session('status1')): ?>
  <div class="alert alert-danger">
    <?php echo e(session('status1')); ?>

  </div>
<?php endif; ?>   

<?php echo $__env->make('notify::messages', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

 <div class="row tapalmail">
        <div class="col-md-2 pad_0 mail-sidebox">
          <a href="creation_of_file" class="btn compose btn-block margin-bottom">Creation of <?php echo e(request()->session()->get('session_fname')); ?></a>

          <div class="box box-solid">
            <div class="box-header with-border">
              <h3 class="box-title">Folders</h3>

              <div class="box-tools">
                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                </button>
              </div>
            </div>
            <div class="box-body no-padding">
              <ul class="nav nav-pills nav-stacked">
                <li class="active"><a href="inbox"><i class="fa fa-ticket "></i> Inward <?php echo e(request()->session()->get('session_tname')); ?>

                  <span class="label label-primary pull-right"><?php echo e($tapalinboxcount); ?></span></a></li>

                <li class="active"><a href="fileinbox"><i class="fa fa-ticket "></i> Inward <?php echo e(request()->session()->get('session_fname')); ?>s
                  <span class="label label-primary pull-right"><?php echo e($fileinboxcount); ?></span></a></li>

                  <li class="active"><a href="outbox"><i class="fa fa-ticket "></i> Sent <?php echo e(request()->session()->get('session_tname')); ?>

                  <span class="label label-primary pull-right"><?php echo e($tapaloutboxcount); ?></span></a></li>

                
               <li class="active"><a href="fileoutbox"><i class="fa fa-ticket "></i> Sent <?php echo e(request()->session()->get('session_fname')); ?>s
                  <span class="label label-primary pull-right"><?php echo e($fileoutboxcount); ?></span></a></li>

              </ul>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /. box -->
          <div class="box box-solid">
            <div class="box-header with-border">
              <h3 class="box-title">Icons</h3>

              <div class="box-tools">
                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                </button>
              </div>
            </div>
            <div class="box-body no-padding">
              <ul class="nav nav-pills nav-stacked">
                <li><a href="#"><i class="fa fa-bookmark text-red"></i> Immediate</a></li>
                <li><a href="#"><i class="fa  fa-bookmark text-yellow"></i> Urgent</a></li>
                <li><a href="#"><i class="fa  fa fa-bookmark-o"></i> Normal</a></li>
            <li><a href="#"><i class="fa fa-fw  fa-eye-slash text-red"></i> Confidential</a></li>
                    
              </ul>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>

        <div class="col-md-10 pad_0 mail-search " style="height: 100%; display: flex;">
          <div class="box box-primary mb-0">
            <div class="box-header with-border">
              <h3 class="box-title"><?php echo e(request()->session()->get('session_fname')); ?> Inbox</h3>

              <div class="box-tools pull-right">
                <div class="has-feedback">
                  <div class="pull-right">
                  1-50/200
                  <div class="btn-group">
                    <button type="button" class="btn btn-default btn-sm"><i class="fa fa-chevron-left"></i></button>
                    <button type="button" class="btn btn-default btn-sm"><i class="fa fa-chevron-right"></i></button>
                  </div>
                  <!-- /.btn-group -->
                </div>
                </div>
              </div>
              <!-- /.box-tools -->
            </div>
            <!-- /.box-header -->
            <div class="box-body no-padding  min70">
              
              <div class="table-responsive mailbox-messages">
                <table class="table table-hover table-striped" id="file_forward">
                  <tbody>
                  <tr>

                  </tr>
                

                  </tbody>
                </table>
                <!-- /.table -->
              </div>
              <!-- /.mail-box-messages -->
            </div>
            <!-- /.box-body -->
           
          </div>
          <!-- /. box -->
        </div>
        <!-- /.col -->
  </div>
   

<!--  template modal  -->
    
    <div class="modal fade" id="TemplateModal" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Edit Template</h4>
            </div>

        <div class="panel-body">

             <form action="<?php echo e(url('/edit_templatepost')); ?>" method="post" enctype="multipart/form-data" id="tapal_forward">

            <div class="modal-body">
                <div class="box-body">
                     <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
                <input type="hidden" name="fileview_template_id" id="fileview_template_id" value="">

                <input type="hidden" name="creation_of_file" id="creation_of_file" value="">

                
                       <div id="modfilediv"></div>

                           
                 <!--box body close-->               
                </div>
             
                <!--modal body close-->
            </div>
            <div class="modal-footer">
          <div class="row">
              <div class="col-md-3">
                <button id="edittemplate" type="submit" class="btn btn-info"  >Edit</button>
             
                 </form>
                 </div>
                 <form action="<?php echo e(url('/approve_templatepost')); ?>" method="post" enctype="multipart/form-data" id="tapal_forward">
                  <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">

                   <input type="hidden" name="fileview_templateapprove_id" id="fileview_templateapprove_id" value="">

                <input type="hidden" name="creation_of_file" id="creation_of_file" value="">
                <div class="col-md-3">
                <button id="approvetemplate" type="submit" class="btn btn-success"  >Approve</button>
                </div>
                </form>
                </div>
            </div>
            <!--panel body close-->
            </div>
        </div>
    </div>
</div>

    




    <!-- approve modal display --> 

    <div class="modal fade" id="ApproveModal" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">View Template</h4>
            </div>

        <div class="panel-body">

            <div class="modal-body">
                <div class="box-body">
                     <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
                <input type="hidden" name="fileview_template_id" id="fileview_template_id" value="">

                <input type="hidden" name="creation_of_file" id="creation_of_file" value="">

                    <div>

                        <div class="col-md-12" id="1topdiv"></div>
                        <div class="col-md-4" id="1top1div"></div>
                        <div class="col-md-4" id="1top2div"></div>
                        <div class="col-md-4" id="1top3div"></div>
                        <div class="col-md-12" id="1middiv"></div>
                        <div class="col-md-4" id="1mid1div"></div>
                        <div class="col-md-4" id="1mid2div"></div>
                        <div class="col-md-4" id="1mid3div"></div>
                        <div class="col-md-12" id="1bottomdiv"></div>
                        <div class="col-md-4" id="1bottom1div"></div>
                        <div class="col-md-4" id="1bottom2div"></div>
                        <div class="col-md-4" id="1bottom3div"></div>

                
                  </div>


                
                       <div id="appfilediv"></div>

                           
                 <!--box body close-->               
                </div>
             
                <!--modal body close-->
            </div>
            <div class="modal-footer">
          
             
                  <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">

                   <input type="hidden" name="wordfileview_template_id" id="wordfileview_template_id" value="">

                <input type="hidden" name="wordtemplate" id="wordtemplate" value="">
                 <div class="row">
              <div class="col-md-3">

                <button type="button" class="btn btn-warning" data-dismiss="modal">Close</button>
                </div>
                <div class="col-md-3">
                <button id="word" type="button" class="btn btn-success" onclick="showword();" >Export to Word</button>
                </div>
                <form action="<?php echo e(url('/pdftemppost')); ?>" method="post" enctype="multipart/form-data" id="tapal_forward">
                  <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
                 
                   <input type="hidden" name="pdffileview_template_id" id="pdffileview_template_id" value="">
                   <input type="hidden" name="pdftemplate" id="pdftemplate" value="">
                <div class="col-md-3">
                <button id="pdf" type="submit" class="btn btn-info">Export to PDF</button>
           </div>
             </form>
             </div>
            </div>
            <!--panel body close-->
            </div>
        </div>
    </div>
</div>







   <!-- new file modal view -->
<div id="modalfileview" class="cd-panel cd-panel--from-right js-cd-panel-main">
    <header class="cd-panel__header">
      <div class="mailbox-read-info" >
                <h3 id="fileno"></h3>
               
              </div>
      <a href="#0" class="cd-panel__close js-cd-close">Close</a>
    </header>

    <div class="cd-panel__container">
      <div class="cd-panel__content">
      
      <input type="hidden" name="active_flag" id="active_flag" value="">
           
             <input type='hidden' name='user_comment_flag' id='user_comment_flag' value=''>
                
      <div class="box">
            <div class="box-header with-border">
              

              <div class="box-tools">
              
                     <button type="button" disabled="disabled" class="btn btn-default btn-sm" data-toggle="modal" data-target="#AddModal" data-container="body" title="Forward" data-original-title="Forward" id="newforward">
                    <i class="fa fa-share"></i></button>

                   
                    <button type="button" class="btn btn-default btn-sm" data-toggle="tooltip" data-container="body" title="Print" data-original-title="Print">
                        <i class="fa fa-print"></i></button>
          
              </div>
            </div>

            
                        <!-- /.box-header -->
            <div class="box-body no-padding">
              <div class="mailbox-read-info" >
                <h3 id="title"></h3>
        <div class="row">
        
                               
                <div class="col-md-12" ><label>Forwarded By: </label> <span id="forwardedby">&nbsp;&nbsp;</span> <span class="mailbox-read-time " id="forwardedon"></span><br>
                <label >Created  By:</label><span id="createdby"></span>&nbsp;&nbsp;<span class="mailbox-read-time" id="createdat"></span>
                <input type="hidden" id="office_id" name="office_id"><input type="hidden" id="currentseatid" name="currentseatid">
                </div>
                
                <div class="col-md-6"></div>
                              </div>
                <div class="row file_details">
                 <!-- /.col -->
                
             
                <div class="col-sm-5 col-xs-8">
                  <div class="description-block border-right">
                    <span class="description-percentage text-yellow"><i class="fa fa-book"></i></span>
                    <h5 class="description-header"><?php echo e(request()->session()->get('session_fname')); ?> Group</h5>
                    <span class="description-text" id="file_group"></span>
                  </div>
                  <!-- /.description-block -->
                </div>
                <!-- /.col -->
                
               
           <div class="col-sm-2 col-xs-6">
                  <div class="description-block ">
                    <span class="description-percentage"><i class="fa  fa fa-bookmark-o"></i></span>
                    <h5 class="description-header">Priority</h5>
                    <span class="description-text" id="priority"></span>
                  </div>
                  <!-- /.description-block -->
                </div>
                <!-- /.col -->
              </div>
              
                             
                
              
        
              </div>
        </div>
        <div class="box-body">
             <b>Attachment</b>&nbsp;&nbsp;&nbsp;<i class="fa fa-plus-square" aria-hidden="true" onclick="attachmentview()"></i>
              <!-- /.mailbox-read-info -->
              <div class="mailbox-controls with-border">
               <ul class="mailbox-attachments clearfix" id="attachment">
                
              </ul>
             
              </div>

              <div class="panel-body" id="attachmentdisplay" style="display: none;">

                <form class="form-horizontal" name="attachmentmodalform"  method="post" enctype="multipart/form-data" id="attach" onsubmit="return attachmentvalidation2();">
                             <!-- CSRF Token -->
                             <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">

                           <!-- <input type="hidden" name="attachmenttapalid" id="attachmenttapalid" value="">  -->

                  <input type="hidden" name="creation_of_attachment" id="creation_of_attachment" value="">

                      <div class="form-group">
                          <label class="col-md-3 control-label" for="name">Add new Attachments</label>
                          <div class="col-md-9" id="uploaddiv">
                              <input id="upload" name="upload" type="file" class="form-control" onchange="check_extension1();" /><br><input type="text" name="filedesc" id="filedesc" placeholder="Enter description of file" class="form-control">
                              <input type="hidden" name="uploadcount1" id="uploadcount1" value="1">

                          </div>
                         
                      </div>

                      <!-- Form actions -->
                      <div class="form-position">
                          <div class="col-md-12 text-right">
                              <button type="submit" class="btn btn-responsive btn-primary btn-sm" id="attachbutn" >Save</button>
                          </div>
                      </div>
                 </form>
              </div>

              <!-- /.mailbox-controls -->
              <div class="mailbox-read-message">
                <p id="description"></p>
              </div>
              <!-- /.mailbox-read-message -->
        </div>

        <script>
             
              //////check the extension of upload////////////////////////
              function check_extension1()
              {
                  var file= document.getElementById('upload').value;
                  var reg = /(.*?)\.(jpg|pdf|jpeg|excel|xls|xlsx|doc|docx|odt|word)$/;
                  if(!file.match(reg))
                  {
                      alert("Invalid File format. Please upload correct format");
                      document.getElementById('upload').value='';
                      document.getElementById('upload').focus();
                      return false;
                  }
              }

              function attachmentview()
              {
                  
                      //document.getElementById('attachmentdisplay').value='';
                      document.getElementById('attachmentdisplay').style.display="block";
                    
              }
          </script>

          <script>
                function attachmentvalidation2()
                    {
                        
                       

                        return true;
                    }
          </script> 
          <script>
        $(function() {

                    $('#attachbutn').click(function() {

                       if(document.getElementById('upload').value=="")
                        {
                            alert(" Please select the Attachments");
                            document.getElementById('upload').focus();
                           
                            return false;
                        }
                        //document.getElementById("attachbutn").disabled='true';

                      $('#attach').submit(function(event) {
                    //  event.preventDefault();

                    
                     item = {};
                      var formData = new FormData($(this)[0]);
                         
                     
                        $.ajax({
                            url: "file_attachmentpost",
                            type: "POST",
                           data: formData,
                           dataType: 'JSON', 
                           processData: false,
                          contentType: false,
                          async: false,                     
                          success: function (data) { 

                          

                          var existingattachment=document.getElementById("attachment").innerHTML;

                            document.getElementById("attachment").innerHTML=data.attachment+existingattachment;

                            document.getElementById("filedesc").value="";
                            document.getElementById("upload").value="";

                            document.getElementById("attachbutn").disabled='false';

                            
                          
                        },
                       
                           
                        });

                        return false;

                      });

                    });
                });
      </script>
        
            <!-- /.box-body -->
      
      <div class="box-footer" style="">
             
        <form class="form-horizontal" action="<?php echo e(url('file_viewpost')); ?>" method="post" enctype="multipart/form-data" id="theform"  
             onsubmit="return validation();">
             <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
             
             <input type="hidden" name="creation_of_comment" id="creation_of_comment" value="">
             <input type='hidden' name='comment_type' id='comment_type' value=''>

                <!-- .img-push is used to add margin to elements next to floating images -->
                <div class="img-push">
                 
           
              <div class="input-group input-group-sm">
                <div class="input-group-btn">
                  <button type="button" class=" btn btn-success dropdown-toggle" data-toggle="dropdown">Comment Type
                    <span class="fa fa-caret-down" id="selected"></span></button>
                  <ul class="dropdown-menu" id="commentval">
                    <li><a href="#"><i class="fa fa-fw fa-globe "></i> Public</a></li>
                    <li><a href="#"><i class="fa fa-fw fa-sticky-note "></i>Private</a></li>
                    <li><a href="#"><i class="fa fa-fw fa-user-secret "></i>Yellow Notes</a></li>
                    
                  </ul>
                </div>
                <!-- /btn-group -->
                <input type="text" class="form-control input-sm" name="comment_description" id="comment_description" placeholder="Write a comment">
                <span class="input-group-btn">
                      <button type="button" id="commentbtnsubmit" class="btn btn-info btn-flat"><i class="fa fa-fw fa-send"></i></button>
                    </span>
              </div>
                </div>
        </form>    
      </div>
      <div class="box-footer box-comments" style="" id="comment">
              
              <!-- /.-comments -->
      </div>

      <script>
              $('#commentval a').click(function(){
                $('#selected').text($(this).text());
                $('#comment_type').val($(this).text());

              });
      </script>

      <script>
        $(function() {

                    $('#commentbtnsubmit').click(function() {

                       var file_id=document.getElementById("creation_of_comment").value;
                       var comment_type=document.getElementById("comment_type").value;
                       var description=document.getElementById("comment_description").value;

                      // alert(description);
                        $.ajax({
                            url: "file_viewpost",
                            type: "POST",
                           data: { "_token": "<?php echo e(csrf_token()); ?>",
                                   "creation_of_file": file_id,
                                   "comment_type": comment_type,
                                    "description": description },
                            dataType: 'JSON',

                             // here build JSON object with your form data
                            //success:function(data)
                        success: function (data) { 

                          document.getElementById("comment_description").value='';
                          $('#selected').text('');

                          var existingcomments=document.getElementById("comment").innerHTML;

                            document.getElementById("comment").innerHTML=data.comment+existingcomments;
                            document.getElementById("user_comment_flag").value=1;
                            //document.getElementById("active_flag").value=data['active_flag'];
                            //document.getElementById("file_id").value=data['file_id'];
                            //document.getElementById("user_comment_flag").value=data['user_comment_flag'];
                            var active_flag=document.getElementById("active_flag").value;
                            var fileid=document.getElementById("file_id").value;

                           

                            if((active_flag) && (document.getElementById("user_comment_flag").value == 1))
                            {
                              
                                document.getElementById("newforward").disabled = false;
                           }
                          else
                           {
                            document.getElementById("newforward").disabled = true;
                           
                           }
                          
                        }
                           
                        });
                    });
                });
      </script>
      
      <script>
                function validation()
                    {
                        //alert(document.getElementById('comment_type').value);
                        if(document.getElementById('comment_type').value=="")
                        {
                            alert(" Please select the Comment type");
                            document.getElementById('comment_type').focus();
                           
                            return false;
                        }

                        if(document.getElementById('description').value=="")
                        {
                            alert(" Please enter the Comment Description");
                            document.getElementById('description').focus();
                            return false;
                        }
                        document.getElementById("commentbtnsubmit").disabled='true';

                    
                        return true;
                    }
          </script> 


      <div class="box-footer" style="">
         <form class="form-horizontal" name="actionmodalform" action="<?php echo e(url('file_actionpost')); ?>" method="post" enctype="multipart/form-data" id="form" onsubmit="return actionvalidation();" >
                             <!-- CSRF Token -->
                             <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">

                          <!--  <input type="hidden" name="actiontapalid" id="actiontapalid" value="">  -->
                            <input type="hidden" name="creation_of_action" id="creation_of_action" value="">
                            <input type='hidden' name='action_type' id='action_type' value=''>
            
            <div class="input-group input-group-sm">
                <div class="input-group-btn">
                  <button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown" aria-expanded="false">Action
                    <span class="fa fa-caret-down" id="selectedaction"></span></button>
                  <ul class="dropdown-menu" id="actionval">
                    <?php $__currentLoopData = $actions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $action): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>                                                                    
                      <li><a href="#"><i class="fa fa-exclamation-circle"></i><?php echo e($action->actions); ?></a></li>
                   <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </ul>
                </div>
                <!-- /btn-group -->
                <input type="text" class="form-control input-sm" name="actdescription" id="actdescription" placeholder="Press enter to post Remarks">
                  <span class="input-group-btn">
                      <button type="button" id="actionsubmit" class="btn btn-info btn-flat"><i class="fa fa-fw fa-send"></i></button>
                    </span>
            </div>
               
          </form>
      </div>


      <div class="box-footer box-comments" style="" id="action">
             
              <!-- /.action -->
      </div>
            <!-- /.box-footer -->
           
            <!-- /.box-footer -->
          
      
      <script>
              $('#actionval a').click(function(){
                $('#selectedaction').text($(this).text());
                $('#action_type').val($(this).text());

              });
      </script>

       <script>
        $(function() {

                    $('#actionsubmit').click(function() {

                       var file_id=document.getElementById("creation_of_action").value;
                       var action_type=document.getElementById("action_type").value;
                       //alert(comment_type);
                       var description=document.getElementById("actdescription").value;

                       //alert("dsfsdf");
                        $.ajax({
                            url: "file_actionpost",
                            type: "GET",
                           data: { "_token": "<?php echo e(csrf_token()); ?>",
                                   "creation_of_action": file_id,
                                   "action_type": action_type,
                                    "actdescription": description },
                            dataType: 'JSON',

                             // here build JSON object with your form data
                            //success:function(data)
                        success: function (data) { 
                          //alert(data);
                          document.getElementById("actdescription").value='';
                          $('#selectedaction').text('');

                          var existingactions=document.getElementById("action").innerHTML;

                            document.getElementById("action").innerHTML=data.action+existingactions;

                            
                          
                        }
                           
                        });
                    });
                });
      </script>

      <script>
                function actionvalidation()
                    {
                        
                        if(document.getElementById('action_type').value=='')
                        {
                            alert(" Please select the Action type");
                            document.getElementById('actions').focus();
                           
                            return false;
                        }
                        //alert(document.getElementById('actdescription').value);
                        
                        if(document.getElementById('actdescription').value=="")
                        {
                            alert(" Please enter the Action Description");
                            document.getElementById('actdescription').focus();
                            return false;
                        }
                        document.getElementById("actionsubmit").disabled='true';

                        
                        return true;
                    }
          </script> 
      
      <!--Links ..tapals attached to this file-->
<div class="box-body">
             <b>Links</b>
              <!-- /.mailbox-read-info -->
              <div class="mailbox-controls with-border">
	               <ul class="mailbox-attachments clearfix" id="link">
	                
	               </ul>
             
              </div>
</div>


<!--Links ..generate template-->

<div class="box-body" id="templatediv2">
             <b>Generate From Template</b>
              <!-- /.mailbox-read-info -->
             
              <div class="mailbox-controls with-border">
	               <ul class="mailbox-attachments clearfix" id="template">
	                <div class="panel-body">
                            
                            <form class="form-horizontal" action="<?php echo e(url('fileview_templatepost')); ?>" method="post" enctype="multipart/form-data" id="tempsave" onsubmit="return validationtemp();">
                             <!-- CSRF Token -->
                             <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">

                            <input type="hidden" name="filetemplate" id="filetemplate" value="">

                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="email">Template Title<span style="color: red;">*</span></label>
                                    <div class="col-md-9">
                                      <select name="title" id="title" class="form-control" onchange="getfiletemplate(this.value);">
                                        <option value="0">Select One</option>
                                       <?php $__currentLoopData = $template; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $title): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($title->id); ?>"><?php echo e($title->title); ?></option>

                                       <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                      </select>
                                      </div>

                                       
                                </div>
                                

                                <!-- Form actions -->
                                <div class="form-position">
                                <div id="templatediv">
                    				 </div>
                                    <div class="col-md-12 text-right">
                                        <button type="submit" class="btn btn-responsive btn-primary btn-sm" id="templatesave">Save</button>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <div class="col-md-12" >
                                   <label class="text-success"><u>DRAFT</u></label>
                                   <table class="table" width="100%" id="temp" >   

                                    
                                    </table>
                                    </div>

                                </div>

                                
                     </form>
                    </div>
	               </ul>

	               
             
              </div>
</div>
<script>
        $(function() {

                    $('#templatesave').click(function() {

                       var file_id=document.getElementById("filetemplate").value;
                       var title=document.getElementById("title").value;
                       //alert(comment_type);
                       var topdiv=document.getElementById("topdiv").value;
                       var top1div=document.getElementById("top1div").value;
                       var top2div=document.getElementById("top2div").value;
                       var top3div=document.getElementById("top3div").value;
                       var middiv=document.getElementById("middiv").value;
                       var mid1div=document.getElementById("mid1div").value;
                       var mid2div=document.getElementById("mid2div").value;
                       var mid3div=document.getElementById("mid3div").value;
                       var bottomdiv=document.getElementById("bottomdiv").value;
                       var bottom1div=document.getElementById("bottom1div").value;
                       var bottom2div=document.getElementById("bottom2div").value;
                       var bottom3div=document.getElementById("bottom3div").value;

                       //alert("dsfsdf");
                        $.ajax({
                            url: "fileview_templatepost",
                            type: "POST",
                           data: { "_token": "<?php echo e(csrf_token()); ?>",
                                   "filetemplate": file_id,
                                   "title": title,
                                    "topdiv": topdiv,
                                    "top1div": top1div,
                                    "top2div": top2div,
                                    "top3div": top3div,
                                    "middiv": middiv,
                                    "mid1div": mid1div,
                                    "mid2div": mid2div,
                                    "mid3div": mid3div,
                                    "bottomdiv": bottomdiv,
                                    "bottom1div": bottom1div,
                                    "bottom2div": bottom2div,
                                    "bottom3div": bottom3div },
                            dataType: 'JSON',

                             // here build JSON object with your form data
                            //success:function(data)
                        success: function (data) { 

                          //document.getElementById("actdescription").value='';
                          //$('#selectedaction').text('');

                          var existingdraft=document.getElementById("templatediv").innerHTML;
                            document.getElementById("templatediv").innerHTML=data.draftdetails+existingdraft;

                            
                          
                        }
                           
                        });
                    });
                });
      </script>
<script>
function validationtemp()
    {
        
        if(document.getElementById('title').value=="")
        {
            alert(" Please enter the Title");
            document.getElementById('title').focus();
           
            return false;
        }

        document.getElementById("templatesave").disabled='true';

        
        return true;
    }
</script>
 <div id="divtest">

                <div class="col-md-12" id="topdiv"></div>
                <div class="col-md-4" id="top1div"></div>
                <div class="col-md-4" id="top2div"></div>
                <div class="col-md-4" id="top3div"></div>
                <div class="col-md-12" id="middiv"></div>
                <div class="col-md-4" id="mid1div"></div>
                <div class="col-md-4" id="mid2div"></div>
                <div class="col-md-4" id="mid3div"></div>
                <div class="col-md-12" id="bottomdiv"></div>
                <div class="col-md-4" id="bottom1div"></div>
                <div class="col-md-4" id="bottom2div"></div>
                <div class="col-md-4" id="bottom3div"></div>

                
</div>


           


    


<script>

         function getfiletemplate(id){
          //alert(id);
          
             //document.actionmodalform.creation_of_tapal.value=id;
            $.ajax({
               
               type:'GET',
              // url:"/fileflow/public/index.php/gettitle/"+id+"",
               url: "<?php echo e(asset('/index.php/gettitle')); ?>"+"/"+id,
               success:function(data){

               // alert(data.top);
                var txt='';
                if(data.top)
                {   
                    if(data.top_type==1)
                    {
                    txt = txt+data.top+"<input id='top' name='top' type='date' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.top_type==2)
                    {
                    txt = txt+data.top+"<input id='top' name='top' type='number' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.top_type==3)
                    {
                    txt = txt+data.top+"<input id='top' name='top' type='text' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.top_type==4)
                    {
                    txt = txt+data.top+"<textarea class='form-control resize_vertical' id='top' name='top' placeholder='Please enter value' rows='3'></textarea>";

                    }
                }

                if(data.top1)
                {
                    if(data.top1_type==1)
                    {
                    txt = txt+data.top1+"<input id='top1' name='top1' type='date' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.top1_type==2)
                    {
                    txt = txt+data.top1+"<input id='top1' name='top1' type='number' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.top1_type==3)
                    {
                    txt = txt+data.top1+"<input id='top1' name='top1' type='text' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.top1_type==4)
                    {
                    txt = txt+data.top1+"<textarea class='form-control resize_vertical' id='top1' name='top1' placeholder='Please enter value' rows='3'></textarea>";
                    
                    }
                }

                if(data.top2)
                {
                    if(data.top2_type==1)
                    {
                    txt = txt+data.top2+"<input id='top2' name='top2' type='date' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.top2_type==2)
                    {
                    txt = txt+data.top2+"<input id='top2' name='top2' type='number' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.top2_type==3)
                    {
                    txt = txt+data.top2+"<input id='top2' name='top2' type='text' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.top2_type==4)
                    {
                    txt = txt+data.top2+"<textarea class='form-control resize_vertical' id='top2' name='top2' placeholder='Please enter value' rows='3'></textarea>";
                    
                    }
                }

                if(data.top3)
                {
                    if(data.top3_type==1)
                    {
                    txt = txt+data.top3+"<input id='top3' name='top3' type='date' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.top3_type==2)
                    {
                    txt = txt+data.top3+"<input id='top3' name='top3' type='number' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.top3_type==3)
                    {
                    txt = txt+data.top3+"<input id='top3' name='top3' type='text' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.top3_type==4)
                    {
                    txt = txt+data.top3+"<textarea class='form-control resize_vertical' id='top3' name='top3' placeholder='Please enter value' rows='3'></textarea>";
                    
                    }
                }

                if(data.mid)
                {
                    if(data.mid_type==1)
                    {
                    txt = txt+data.mid+"<input id='mid' name='mid' type='date' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.mid_type==2)
                    {
                    txt = txt+data.mid+"<input id='mid' name='mid' type='number' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.mid_type==3)
                    {
                    txt = txt+data.mid+"<input id='mid' name='mid' type='text' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.mid_type==4)
                    {
                    txt = txt+data.mid+"<textarea class='form-control resize_vertical' id='mid' name='mid' placeholder='Please enter value' rows='3'></textarea>";

                    }
                }

                if(data.mid1)
                {
                    if(data.mid1_type==1)
                    {
                    txt = txt+data.mid1+"<input id='mid1' name='mid1' type='date' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.mid1_type==2)
                    {
                    txt = txt+data.mid1+"<input id='mid1' name='mid1' type='number' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.mid1_type==3)
                    {
                    txt = txt+data.mid1+"<input id='mid1' name='mid1' type='text' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.mid1_type==4)
                    {
                    txt = txt+data.mid1+"<textarea class='form-control resize_vertical' id='mid1' name='mid1' placeholder='Please enter value' rows='3'></textarea>";

                    }
                }

                if(data.mid2)
                {
                    if(data.mid2_type==1)
                    {
                    txt = txt+data.mid2+"<input id='mid2' name='mid2' type='date' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.mid2_type==2)
                    {
                    txt = txt+data.mid2+"<input id='mid2' name='mid2' type='number' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.mid2_type==3)
                    {
                    txt = txt+data.mid2+"<input id='mid2' name='mid2' type='text' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.mid2_type==4)
                    {
                    txt = txt+data.mid2+"<textarea class='form-control resize_vertical' id='mid2' name='mid2' placeholder='Please enter value' rows='3'></textarea>";

                    }
                }

                if(data.mid3)
                {
                    if(data.mid3_type==1)
                    {
                    txt = txt+data.mid3+"<input id='mid3' name='mid3' type='date' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.mid3_type==2)
                    {
                    txt = txt+data.mid3+"<input id='mid3' name='mid3' type='number' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.mid3_type==3)
                    {
                    txt = txt+data.mid3+"<input id='mid3' name='mid3' type='text' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.mid3_type==4)
                    {
                    txt = txt+data.mid3+"<textarea class='form-control resize_vertical' id='mid3' name='mid3' placeholder='Please enter value' rows='3'></textarea>";

                    }
                }

                if(data.bottom)
                {
                    if(data.bottom_type==1)
                    {
                    txt = txt+data.bottom+"<input id='bottom' name='bottom' type='date' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.bottom_type==2)
                    {
                    txt = txt+data.bottom+"<input id='bottom' name='bottom' type='number' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.bottom_type==3)
                    {
                    txt = txt+data.bottom+"<input id='bottom' name='bottom' type='text' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.bottom_type==4)
                    {
                    txt = txt+data.bottom+"<textarea class='form-control resize_vertical' id='bottom' name='bottom' placeholder='Please enter value' rows='3'></textarea>";

                    }
                }

                if(data.bottom1)
                {
                    if(data.bottom1_type==1)
                    {
                    txt = txt+data.bottom1+"<input id='bottom1' name='bottom1' type='date' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.bottom1_type==2)
                    {
                    txt = txt+data.bottom1+"<input id='bottom1' name='bottom1' type='number' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.bottom1_type==3)
                    {
                    txt = txt+data.bottom1+"<input id='bottom1' name='bottom1' type='text' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.bottom1_type==4)
                    {
                    txt = txt+data.bottom1+"<textarea class='form-control resize_vertical' id='bottom1' name='bottom1' placeholder='Please enter value' rows='3'></textarea>";

                    }
                }

                if(data.bottom2)
                {
                    if(data.bottom2_type==1)
                    {
                    txt = txt+data.bottom2+"<input id='bottom2' name='bottom2' type='date' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.bottom2_type==2)
                    {
                    txt = txt+data.bottom2+"<input id='bottom2' name='bottom2' type='number' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.bottom2_type==3)
                    {
                    txt = txt+data.bottom2+"<input id='bottom2' name='bottom2' type='text' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.bottom2_type==4)
                    {
                    txt = txt+data.bottom2+"<textarea class='form-control resize_vertical' id='bottom2' name='bottom2' placeholder='Please enter value' rows='3'></textarea>";

                    }
                }

                if(data.bottom3)
                {
                    if(data.bottom3_type==1)
                    {
                    txt = txt+data.bottom3+"<input id='bottom3' name='bottom3' type='date' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.bottom3_type==2)
                    {
                    txt = txt+data.bottom3+"<input id='bottom3' name='bottom3' type='number' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.bottom3_type==3)
                    {
                    txt = txt+data.bottom3+"<input id='bottom3' name='bottom3' type='text' placeholder='Enter the value' class='form-control' >";
                    }
                    if(data.bottom3type==4)
                    {
                    txt = txt+data.bottom3+"<textarea class='form-control resize_vertical' id='bottom3' name='bottom3' placeholder='Please enter value' rows='3'></textarea>";

                    }
                }

                  $("#templatediv").html(txt);                
               }
            });

         }


      </script>
       <script>
  
             function getModaltemp(id){
                //alert("clicked"+id);
                document.getElementById("fileview_template_id").value=id;
                document.getElementById("fileview_templateapprove_id").value=id;

                $.ajax({

                   type:'GET',
                   //url: "/fileflow/public/index.php/getfiletemp/"+id+"",
                   url: "<?php echo e(asset('/index.php/getfiletemp')); ?>"+"/"+id,
                   success:function(data){
                    //alert(data);
                      $("#modfilediv").html(data); 


                      if(data.approval_flag==1)
                      {
                        document.getElementById("edittemplate").style.display="none";
                        document.getElementById("approvetemplate").style.display="none";
                      } 
                      else 
                      {
                        document.getElementById("edittemplate").style.display="block";
                        document.getElementById("approvetemplate").style.display="block";
                      }              
                   }
                });

             }


        </script>


        <script>
  
             function getApprovetemp(id){
                //alert("clicked"+id);
                document.getElementById("fileview_template_id").value=id;
                document.getElementById("fileview_templateapprove_id").value=id;
                 document.getElementById("pdffileview_template_id").value=id;

                $.ajax({

                   type:'GET',
                   //url: <?php echo e(url('/index.php/getapprovetemp/"+id+"')); ?>,
                   url: "<?php echo e(asset('/index.php/getapprovetemp')); ?>"+"/"+id,
                   success:function(data){
                   // alert(data[0].top1);

                   

                     document.getElementById("1topdiv").innerHTML='';
                     document.getElementById("1top1div").innerHTML='';
                     document.getElementById("1top2div").innerHTML='';
                     document.getElementById("1top3div").innerHTML='';
                     document.getElementById("1middiv").innerHTML='';
                     document.getElementById("1mid1div").innerHTML='';
                     document.getElementById("1mid2div").innerHTML='';
                     document.getElementById("1mid3div").innerHTML='';
                     document.getElementById("1bottomdiv").innerHTML='';
                     document.getElementById("1bottom1div").innerHTML='';
                     document.getElementById("1bottom2div").innerHTML='';
                     document.getElementById("1bottom3div").innerHTML='';

                    if(data.top)
                        {
                            var test=document.getElementById("1topdiv");
                            
                            test.innerHTML=data.toplabel+": "+data.top;
                        }

                        if(data.top1)
                        {
                           // alert(data.top1);
                            document.getElementById("1top1div").innerHTML=data.top1label+": "+data.top1;
                        }

                        if(data.top2)
                        {
                            document.getElementById("1top2div").innerHTML=data.top2label+": "+data.top2;
                        }

                        if(data.top3)
                        {
                            document.getElementById("1top3div").innerHTML=data.top3label+': '+data.top3;
                        }

                        if(data.mid)
                        {
                            document.getElementById("1middiv").innerHTML=data.midlabel+': '+data.mid;
                        }

                        if(data.mid1)
                        {
                            document.getElementById("1mid1div").innerHTML=data.mid1label+': '+data.mid1;
                        }

                        if(data.mid2)
                        {
                            document.getElementById("1mid2div").innerHTML=data.mid2label+': '+data.mid2;
                        }

                        if(data.mid3)
                        {
                            document.getElementById("1mid3div").innerHTML=data.mid3label+': '+data.mid3;
                        }

                        if(data.bottom)
                        {
                            document.getElementById("1bottomdiv").innerHTML=data.bottomlabel+': '+data.bottom;
                        }

                        if(data.bottom1)
                        {
                            document.getElementById("1bottom1div").innerHTML=data.bottom1label+': '+data.bottom1
                        }

                        if(data.bottom2)
                        {
                            document.getElementById("1bottom2div").innerHTML=data.bottom2label+': '+data.bottom2;
                        }

                        if(data.bottom3)
                        {
                            document.getElementById("1bottom3div").innerHTML=data.bottom3label+': '+data.bottom3;
                        }        
                   }
                });

             }

             function showword()
             {
               var fileviewtemplateid= document.getElementById("fileview_template_id").value;

               //window.location="/fileflow/public/index.php/word/"+fileviewtemplateid;
               window.location="<?php echo e(asset('/index.php/word')); ?>"+"/"+fileviewtemplateid;

            }

            
        </script>

      
      </div>
      
      </div> <!-- cd-panel__content -->
    </div> <!-- cd-panel__container -->

</div>
               
                    


<style type="text/css">
    

  .spacing-table{ border-spacing: 0 5px!important;    border: 0px!important;  }
  .spacing-table td {    background: #fff;cursor: pointer;
    
    padding: 5px;
    border-radius: 5px;
 
   background-color: rgb(255, 255, 255);
    box-shadow: 0px 0px 5px rgb(51, 51, 51);
    box-shadow: 0px 0px 5px rgba(51, 51, 51, 0.7);
  
border: 1px solid #2673a3 !important;
    border-bottom-color: #C14646 !important;
}
.table-hover>tbody>tr:hover td {
   background-color: #edf6fb;
}
.fromspan{color: #5e819d;
    font-size: 13px;}

.greenspan{color: #007f00;
    font-size: 13px;}

.redspan{color: #EA1F09;
    font-size: 13px;}
  


</style>
<script>

$(function() {

    $('#file_forward').DataTable({
        processing: true,
        serverSide: true,
        ajax: '<?php echo url('fileinboxjson'); ?>',
       
               'columnDefs': [{
               'targets': 0,
               'searchable':false,
               'orderable':false,
               'className': 'dt-body-center',
               'render': function (data, type, full, meta){

                if(full.priority == 'Immediate')
                   return "<i class='fa fa-bookmark text-red' style='font-size: 12.6px;'></i>";
                else if(full.priority == 'Urgent')
                   return "<i class='fa fa-bookmark text-yellow' style='font-size: 12.6px;'></i>";
                else if(full.priority == 'Normal')
                   return "<i class='fa  fa fa-bookmark-o' style='font-size: 12.6px;'></i>";
                else
                   return "";
               }
            },
            {
               'targets': 1,
               'searchable':false,
               'orderable':false,
               'className': 'dt-body-left',
               'render': function (data, type, full, meta){
                if(full.confidential)
                   return "<i class='fa fa-fw  fa-eye-slash text-red' style='font-size: 12.6px;'></i>";
                else
                	return "";
                
               }
            },
            {
               'targets': 2,
               'searchable':false,
               'orderable':false,
               'className': 'dt-body-left',
               'render': function (data, type, full, meta){
                   return "<span class='round' style='font-size: 12.6px;'>F</span><div class='search_list'><a href='#0' onClick='file_view("+full.fileid+")' class='search-item js-cd-panel-trigger' data-panel='main'>File No:<b>"+full.file_no+"</b><span class='label label-tags pull-right' style='font-size: 12.6px;'><b>"+full.file_group+"</b></span></a><span class='search-description ' style='font-size: 12.6px;'> "+full.title+" </span></div></i>";
               }
            },
            {
               'targets': 3,
               'searchable':false,
               'orderable':false,
               'className': 'dt-body-left',
               'render': function (data, type, full, meta){

                   return "<a class='mail-forwarded'><i class='fa fa-fw fa-mail-forward' aria-hidden='true'></i>"+full.from_seat+"<span class='date_generated pull-right' style='font-size: 12.6px;'>"+full.forwardedon+"</span></a><a class='mail-creater'><i class='fa fa-fw fa-plus-circle'></i>"+full.createdby+"<span class='date_generated pull-right' style='font-size: 12.6px; '> "+full.created_at+"</span></a><input type='hidden' id='office_id' name='office_id' value="+full.office_id+"><input type='hidden' id='currentseatid' name='currentseatid' value="+full.currentseatid+">";
               }
            },

            {
               'targets': 4,
               'searchable':false,
               'orderable':false,
               'className': 'dt-body-right',
               'render': function (data, type, full, meta){
                   return "<div class='mail_btns'><a href='#AddModal' data-toggle='modal' data-target='#AddModal' onClick='putfileno("+full.fileid+")' class='btn btn-default btn-xs margin-r-5' data-toggle='tooltip' data-container='body' title='Forward'><i class='fa fa-share margin-r-5'></i>&nbsp</a>&nbsp;<a href='#AttachmentModal' data-toggle='modal' data-target='#AttachmentModal' onClick='getAttachmenttype1("+full.fileid+")' class='btn btn-default btn-xs margin-r-5' data-toggle='tooltip' data-container='body' title='Attachments' data-original-title='Attachments'><i class='fa fa-paperclip margin-r-5'></i>"+full.fileattachmentcount+"</a><a href='#HistoryModal ' data-toggle='modal' data-target='#HistoryModal' onClick='getFileHistory("+full.fileid+")' class='btn btn-default btn-xs   ' data-toggle='tooltip' data-container='body' title='History' data-original-title='History'><i class='fa fa-history margin-r-5 margin-l-5'></i>&nbsp</a><a href='#ActionModal' data-toggle='modal' data-target='#ActionModal' onClick='getActiontype1("+full.fileid+")' class='btn btn-default btn-xs  margin-r-5' data-toggle='tooltip' data-container='body' title='Actions' data-original-title='Actions'><i class='fa fa-legal margin-r-5'></i>"+full.fileactioncount+"</a><a href='#CommentModal ' data-toggle='modal' data-target='#CommentModal' onClick='getMessage1("+full.fileid+")' class='btn btn-default btn-xs  margin-r-5' data-toggle='tooltip' data-container='body' title='Comments' data-original-title='Comments'><i class='fa fa-comments-o margin-r-5'></i>"+full.filecommentcount+"</a><a href='showcreation_of_filedata/"+full.fileid+"' class='btn btn-default btn-xs  margin-r-5' data-toggle='tooltip' data-container='body' title='Details' data-original-title=''><i class='fa fa-pencil-square-o margin-r-5'></i>&nbsp</a></div>";
               }
            },

            

            ],

            "fnDrawCallback": function (oSettings) {
          //alert( 'DataTables has redrawn the table' );
          paneltriggerfn();
          }
    });
});


</script>

<script>
function file_view(id)
{
  //alert(id);
 
  document.getElementById("creation_of_file").value=id;
  $.ajax({

    type:'GET',
    url:"modalfileview/"+id+"",

    success:function(data)
    {

      
        document.getElementById("fileno").innerHTML=data['file_no'];
        document.getElementById("creation_of_file_id").value=data['id'];
        document.getElementById("title").innerHTML=data['title'];
        document.getElementById("forwardedby").innerHTML=data['from_seat'];
        document.getElementById("forwardedon").innerHTML=data['created_at'];
        document.getElementById("createdby").innerHTML=data['name'];
        document.getElementById("createdat").innerHTML=data['created_at'];
        document.getElementById("file_group").innerHTML=data['file_group'];
        
        document.getElementById("priority").innerHTML=data['priority'];
        document.getElementById("description").innerHTML=data['file_description'];       
        document.getElementById("attachment").innerHTML=data['document_path'];
        document.getElementById("comment").innerHTML=data['comment_description'];
        document.getElementById("action").innerHTML=data['action_description'];
        document.getElementById("creation_of_comment").value=data['id'];
        document.getElementById("filetemplate").value=data['id'];
        document.getElementById("wordtemplate").value=data['id'];
        document.getElementById("pdftemplate").value=data['id'];
        document.getElementById("office_id").value=data['office_id'];
        document.getElementById("currentseatid").value=data['currentseatid'];
        document.getElementById("temp").innerHTML=data['temp'];

        document.getElementById("link").innerHTML=data['link'];

        document.getElementById("creation_of_attachment").value=data['id'];

        document.getElementById("creation_of_action").value=data['id'];
        
        document.getElementById("active_flag").value=data['active_flag'];
       
        document.getElementById("user_comment_flag").value=data['user_comment_flag'];
        if((data['active_flag']==1) && (data['user_comment_flag'] == 1))
        {
         
            document.getElementById("newforward").disabled = false;
        }
        else
         {
            document.getElementById("newforward").disabled = true;
           
         }
          
        
       
        
        if(data['active_flag']==1) 
        {
         
          document.getElementById('comment').style.display="block";
          document.getElementById('action').style.display="block";
          document.getElementById('attachment').style.display="block";
          document.getElementById('template').style.display="block";

        }
        else
        {
         
          document.getElementById('comment').style.display="none";
          document.getElementById('action').style.display="none";
          document.getElementById('attachment').style.display="none";
          document.getElementById('template').style.display="none";
        }


    }
  });

}
</script>
<!--Modal for File Forward -->

<div class="modal fade" id="AddModal" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Forward Details</h4>
            </div>

        <div class="panel-body">

             <form action="<?php echo e(url('/file_forwardpost')); ?>" name="forwardform" method="post" id="file_forward" onsubmit="return validateform();">

            <div class="modal-body">
                <div class="box-body">
                     <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">  
                            <input type="hidden" id="creation_of_file_id" name="creation_of_file_id" value="">
                            <div class="form-group">
                                    <label class="col-md-3 control-label" for="email">File Route<span style="color: red;">*</span></label>
                                    <div class="col-md-9">
                                      <select name="fileroute" id="fileroute" class="form-control">
                                        <option value="">Select Route</option>
                                       <?php $__currentLoopData = $troutfilearr; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $filearr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($filearr['id']); ?>"><?php echo e($filearr['name']); ?></option>
                                          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                      </select>
                                      </div>
                                    </div>

                            <!--<div class="form-group">
                                    <label class="col-md-3 control-label" for="email">Office Name<span style="color: red;">*</span></label>
                                    <div class="col-md-9">
                                      <select name="officename" id="officename" class="form-control">
                                        <option value="0">Select One</option>
                                    
                                      </select>
                                      </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="email">Department<span style="color: red;">*</span></label>
                                    <div class="col-md-9">
                                      <select name="deptname" id="deptname" class="form-control">
                                        <option value="0">Select One</option>
                                       
                                      </select>
                                      </div>
                                </div>

                                

                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="email">Section</label>
                                    <div class="col-md-9">
                                      <select name="secname" id="secname" class="form-control">
                                        <option value="0">Select One</option>
                                       

                                      </select>
                                      </div>
                                </div> -->
  
                                <div class="form-group">
                                    
                                    <div class="col-md-12" id="seatdiv" style="display: none;">
                                        <table id="seattable" width="100%" border="1" cellpadding="0" cellspacing="0" align="center">
                                        <thead><td>&nbsp;</td><td>Seat</td></thead></table>
                                    </div>
                                </div>


                               
                                 

                 <!--box body close-->               
                </div>
             
                <!--modal body close-->
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="submit" class="btn btn-success" id="for" >Forward</button>
                
            </div>
            </form>
            <!--panel body close-->
            </div>
        </div>
    </div>
</div>
<!------ validation for office-------->
<script>
                function validateform()
                    {
                        
                        if(document.getElementById('fileroute').value=="0")
                        {
                            alert(" Please select the Route");
                            document.getElementById('fileroute').focus();
                            return false;
                        }
                        document.getElementById("for").disabled='true';

                      
                        return true;
                    }
            </script>
<!--script for file route---------------------------->
<script>

  $(document).ready(function($)
  {
    $('#fileroute').change(function()
    {
        var office_id=$("#office_id").val();
        var currentseatid=$("#currentseatid").val();
        $.get("<?php echo e(url('getseatfromfroute')); ?>",
        { option: $(this).val(), office_id:office_id, currentseatid:currentseatid },

        function(data) 
        {
              var cnt = data.length;
              $("#seattable tr").remove(); 
              for(i=0;i<cnt;i++)
              {
                document.getElementById("seatdiv").style.display="block";

                var table = document.getElementById("seattable");

                var tr = document.createElement("tr");
                var td = document.createElement("td");
                var txt = document.createElement("input");
                txt.type='checkbox';
                txt.name=data[i]['id'];
                txt.value=1;

                td.appendChild(txt);
                tr.appendChild(td);
                  
                var td = document.createElement("td");
                var txt = document.createTextNode(data[i]['name']);

                td.appendChild(txt);
                tr.appendChild(td);

                table.appendChild(tr);
            
              }
        });

        //office from-route loading
        /*$.get("<?php echo e(url('getofficefroute')); ?>",
            { option: $(this).val() },
            function(data) {
            $('#officename').empty();
            $('#officename').append("<option value='0'>Select an office</option>");
            $.each(data, function(key, element) {
                $('#officename').append("<option value='" + element.id +"'>" + element.name + "</option>");
            });
        });*/

      });
  });

      
        </script>     


<!----------------------------------------------------------->
                        
  <!-- script for Office dept and section loading with seats---------->                     

<script>

         $(document).ready(function($){

          $('#officename').change(function(){
      
       /* $.get("<?php echo e(url('getseatfromoffice')); ?>",
        { option: $(this).val() },
        function(data) {
             var cnt = data.length;
            $("#seattable tr").remove(); 
          for(i=0;i<cnt;i++)
              {
                document.getElementById("seatdiv").style.display="block";

                var table = document.getElementById("seattable");

                var tr = document.createElement("tr");
                var td = document.createElement("td");
                var txt = document.createElement("input");
                txt.type='checkbox';
                txt.name=data[i]['id'];
                txt.value=1;

                td.appendChild(txt);
                tr.appendChild(td);

                var td = document.createElement("td");
                var txt = document.createTextNode("Seat: "+data[i]['name']);

                td.appendChild(txt);
                tr.appendChild(td);

                table.appendChild(tr);
            
            }
          });*/

            //section loading
          /*$.get("<?php echo e(url('getofficedept1')); ?>",
            { option: $(this).val() },
            function(data) {
            $('#deptname').empty();
            $('#deptname').append("<option value='0'>Select a Department</option>");
            $.each(data, function(key, element) {
                $('#deptname').append("<option value='" + key +"'>" + element + "</option>");
            });
          });*/
        
    });

          //////////////////////////////////////////////////dept seat loading

    $('#deptname').change(function(){
      
        /*$.get("<?php echo e(url('getseatfromdept')); ?>",
        { option: $(this).val() },
        function(data) {
             var cnt = data.length;
            $("#seattable tr").remove(); 
            for(i=0;i<cnt;i++)
             {
                document.getElementById("seatdiv").style.display="block";

                var table = document.getElementById("seattable");

                var tr = document.createElement("tr");
                var td = document.createElement("td");
                var txt = document.createElement("input");
                txt.type='checkbox';
                txt.name=data[i]['id'];
                txt.value=1;

                td.appendChild(txt);
                tr.appendChild(td);

                var td = document.createElement("td");
                var txt = document.createTextNode("Seat: "+data[i]['name']);

                td.appendChild(txt);
                tr.appendChild(td);

                table.appendChild(tr);
            
            }
          });*/

            //section loading
          /*$.get("<?php echo e(url('getsectiondept1')); ?>",
            { option: $(this).val() },
            function(data) {
            $('#secname').empty();
            $('#secname').append("<option value='0'>Select a Section</option>");
            $.each(data, function(key, element) {
                $('#secname').append("<option value='" + key +"'>" + element + "</option>");
            });
          });*/
        
    });

/////////////////////////////////////////////////////

        /*$('#secname').change(function(){
      
       /* $.get("<?php echo e(url('getseat1')); ?>",
        { option: $(this).val() },
        function(data) {
                 var cnt = data.length;
                $("#seattable tr").remove(); 
                for(i=0;i<cnt;i++)
                {
                document.getElementById("seatdiv").style.display="block";

                var table = document.getElementById("seattable");

                var tr = document.createElement("tr");
                var td = document.createElement("td");
                var txt = document.createElement("input");
                txt.type='checkbox';
                txt.name=data[i]['id'];
                txt.value=1;

                td.appendChild(txt);
                tr.appendChild(td);

                var td = document.createElement("td");
                var txt = document.createTextNode("Seat: "+data[i]['name']);

                td.appendChild(txt);
                tr.appendChild(td);

                table.appendChild(tr);
           
            }
        });
    });*/


$('#seatname').change(function()
{
  document.getElementById("seattable").innerHTML='';
      
        /*$.get("<?php echo e(url('getseattable')); ?>",
        { option: $(this).val() },
        function(data) 
        {
          //alert(data);
              
            
            document.getElementById("seattable").innerHTML=data;
        });
    });*/

});
});

</script>
<!------------------------------File Forward modal ends------------------------->


<!--History Modal-->
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">      </script>
<script>
function getFileHistory(id)
{
  document.historymodalform.creation_of_file.value=id;
  $.ajax({

    type:'GET',
    url:"getfilehistory/"+id+"",
    success:function(data)
    {
        $("#historydiv").html(data); 
    }
  });
}
</script>
<div class="modal fade" id="HistoryModal" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content" style="width: 800px;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">History</h4>
            </div>                            
            <form class="form-horizontal" name="historymodalform" action="<?php echo e(url('file_viewhistory')); ?>" method="post" enctype="multipart/form-data" id="form">
                <!-- CSRF Token -->
                <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">

                <!--  <input type="hidden" name="actiontapalid" id="actiontapalid" value="">  -->

                <input type="hidden" name="creation_of_file" id="creation_of_file" value="">

                <div class="form-group">
                </div>

            </form>

            <div class="modal-body">
                <div class="box-body" id="msg">
                     <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">


                            <div id="historydiv"></div>

                 <!--box body close-->               
                </div>
             
                <!--modal body close-->
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    
            </div>
            
        </div>
    </div>
</div>
<!--- end history modal -->

<!--comment Modal-->
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
<script>

 function putfileno(id)
         {
                document.getElementById("creation_of_file_id").value=id;
               // alert(id);
                //  document.forwardform.creation_of_file_id.value=id;
        }
         function getMessage1(id){
         document.getElementById("creation_of_filecomment").value=id;
            //alert("clicked"+id);
            $.ajax({

               type:'GET',
               url: "getcomment1/"+id+"",
               success:function(data){
               // alert(data);
                  $("#commentdiv1").html(data);                
               }
            });

         }


      </script>

<div class="modal fade" id="CommentModal" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Comments</h4>
            </div>

        <div class="panel-body">

            <div class="panel-body">
                            
                            <form class="form-horizontal" name="filecommentmodalform" action="<?php echo e(url('file_viewcommentpost')); ?>" method="post" enctype="multipart/form-data" id="theform" onsubmit="return validation1();">
                             <!-- CSRF Token -->
                             <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">

                            <!-- <input type="hidden" name="commenttapalid1" id="commenttapalid1" value="">  -->

                             <input type="hidden" name="creation_of_filecomment" id="creation_of_filecomment" value="">

                               <div class="form-group">
                                    <label class="col-md-3 control-label" for="email">Comment Type<span style="color: red;">*</span></label>
                                    <div class="col-md-9">
                                      <select name="comment_type" id="comment_type" class="form-control">
                                       <option value="">Select One</option>
                                        <option value="0">Public</option>
                                        <option value="1">Private</option>
                                        <option value="2">Yellow Notes</option>  

                                      </select>
                                      </div>
                                </div>


                                 <div class="form-group">
                                    <label class="col-md-3 control-label" for="remarks">Comment Description<span style="color: red;">*</span></label>
                                    <div class="col-md-9">
                                        <textarea class="form-control resize_vertical" id="description1" name="description1" placeholder="Please enter description here..." rows="3"></textarea>
                                    </div>
                                </div>

                              
                                <!-- Form actions -->
                                <div class="form-position">
                                    <div class="col-md-12 text-right">
                                        <button type="submit" class="btn btn-responsive btn-primary btn-sm" id="btnsubmit" >Save</button>
                                    </div>
                                </div>
                                
                     </form>
                    </div>

            <div class="modal-body">
                <div class="box-body" id="msg">
                     <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">


                            <div id="commentdiv1"></div>

                 <!--box body close-->               
                </div>
             
                <!--modal body close-->
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    
            </div>
            <!--panel body close-->
            </div>
        </div>
    </div>
</div>

<script>
                function validation1()
                    {
                        
                        if(document.getElementById('comment_type').value=="0")
                        {
                            alert(" Please select the Comment type");
                            document.getElementById('comment_type').focus();
                            return false;
                        }

                        if(document.getElementById('description1').value=="")
                        {
                            alert(" Please enter the Comment Description");
                            document.getElementById('description1').focus();
                            return false;
                        }
                        document.getElementById("btnsubmit").disabled='true';

                        return true;
                    }
          </script> 

<!--action-->

<script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
<script>
         function getActiontype1(id){
          document.getElementById("creation_of_fileaction").value=id;
            $.ajax({

               type:'GET',
               url:"getaction1/"+id+"",
               
               success:function(data){
                  $("#actiondiv1").html(data);                
               }
            });

         }


      </script>

<div class="modal fade" id="ActionModal" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Actions</h4>
            </div>

        <div class="panel-body">

          <div class="panel-body">
                            
                            <form class="form-horizontal" name="fileactionmodalform" action="<?php echo e(url('file_action')); ?>" method="post" enctype="multipart/form-data" id="form" onsubmit="return validationaction();">
                             <!-- CSRF Token -->
                             <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">

                           <!-- <input type="hidden" name="actiontapalid1" id="actiontapalid1" value="">  -->

                            <input type="hidden" name="creation_of_fileaction" id="creation_of_fileaction" value="">

                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="email">Action type<span style="color: red;">*</span></label>
                                    <div class="col-md-9">
                                      <select name="actions" id="actions" class="form-control">
                                        <option value="0">Select One</option>
                                         <?php $__currentLoopData = $actions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $action): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($action->id); ?>"><?php echo e($action->actions); ?></option>

                                       <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
  

                                      </select>
                                      </div>
                                </div>


                                 <div class="form-group">
                                    <label class="col-md-3 control-label" for="remarks">Action Description<span style="color: red;">*</span></label>
                                    <div class="col-md-9">
                                        <textarea class="form-control resize_vertical" id="actdescription1" name="actdescription1" placeholder="Please enter description here..." rows="3"></textarea>
                                    </div>
                                </div>

                              
                                <!-- Form actions -->
                                <div class="form-position">
                                    <div class="col-md-12 text-right">
                                        <button type="submit" class="btn btn-responsive btn-primary btn-sm" id="submit" >Save</button>
                                    </div>
                                </div>
                                
                     </form>
                    </div>

            <div class="modal-body">
                <div class="box-body" id="msg">
                     <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">


                            <div id="actiondiv1"></div>

                 <!--box body close-->               
                </div>
             
                <!--modal body close-->
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    
            </div>
            <!--panel body close-->
            </div>
        </div>
    </div>
</div>

<script>
                function validationaction()
                    {
                        
                        if(document.getElementById('actions').value=='')
                        {
                            alert(" Please select the Action type");
                            document.getElementById('actions').focus();
                           
                            return false;
                        }

                        if(document.getElementById('actdescription1').value=='')
                        {
                            alert(" Please enter the Action Description");
                            document.getElementById('actdescription1').focus();
                            return false;
                        }
                        document.getElementById("submit").disabled='true';

                      
                        return true;
                    }
          </script> 



<!--attachment-->

<script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
<script>
         function getAttachmenttype1(id){
             document.getElementById("creation_of_fileattachment").value=id;
            $.ajax({

               type:'GET',
               url:"getattachment1/"+id,
              
               success:function(data){
                  $("#attachmentdiv1").html(data);                
               }
            });

         }


      </script>
      <script>
    function showdocument(path)
    {
        //alert("htuytu");
        document.getElementById("documentframe").src="../../storage/app/"+path;
        document.getElementById("documentframe").style.display="block";
    }
    //////check the extension of upload////////////////////////
    function check_extension()
    {
        var file= document.getElementById('upload1').value;
        var reg = /(.*?)\.(jpg|pdf|jpeg|excel|xls|xlsx|doc|docx|odt|word)$/;
        if(!file.match(reg))
        {
            alert("Invalid File format. Please upload correct format");
            document.getElementById('upload1').value='';
            document.getElementById('upload1').focus();
            return false;
        }
    }
</script>

<div class="modal fade" id="AttachmentModal" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Attachments</h4>
            </div>

        <div class="panel-body">
              <form class="form-horizontal" name="fileattachmentmodalform" action="<?php echo e(url('file_attachmentpostdata')); ?>" method="post" enctype="multipart/form-data" id="attach" onsubmit="return validation2();">
                             <!-- CSRF Token -->
                             <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">

                         <!--   <input type="hidden" name="attachmenttapalid1" id="attachmenttapalid1" value="">  -->

                            <input type="hidden" name="creation_of_fileattachment" id="creation_of_fileattachment" value="">



                  <div class="form-group">
                                    <label class="col-md-3 control-label" for="name">Attachments</label>
                                    <div class="col-md-9" id="uploaddiv">
                                        <input id="upload1" name="upload1" type="file" class="form-control" onchange="check_extension();" /><br><input type="text" name="filedesc1" id="filedesc1" placeholder="Enter description of file" class="form-control">
                                        <input type="hidden" name="uploadcount" id="uploadcount" value="1">

                                    </div>
                                   
                                </div>

                                <!-- Form actions -->
                                <div class="form-position">
                                    <div class="col-md-12 text-right">
                                        <button type="submit" class="btn btn-responsive btn-primary btn-sm" id="attbutn" >Save</button>
                                    </div>
                                </div>
                                 </form>
                    </div>
                

            <div class="modal-body">
                <div class="box-body" id="msg">
                     <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">


                            <div id="attachmentdiv1"></div>
                            <div class="col-md-10" align="center">
                           <iframe src="" id="documentframe" width="300" height="400" style="display: none;"></iframe>
                        </div>

                 <!--box body close-->               
                </div>
             
                <!--modal body close-->
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    
            </div>
            <!--panel body close-->
            </div>
        </div>
    </div>

     <script>
                function validation2()
                    {
                        
                        if(document.getElementById('upload1').value=="")
                        {
                            alert(" Please select the Attachments");
                            document.getElementById('upload1').focus();
                           
                            return false;
                        }
                        document.getElementById("attbutn").disabled='true';

                      
                        return true;
                    }
          </script> 

                
              
</div>
<script>
function paneltriggerfn() {
(function(){

    // Slide In Panel - by CodyHouse.co
  var panelTriggers = document.getElementsByClassName('js-cd-panel-trigger');
  //alert(panelTriggers.length);
  if( panelTriggers.length > 0 ) {
    for(var i = 0; i < panelTriggers.length; i++) {
      (function(i){
        var panelClass = 'js-cd-panel-'+panelTriggers[i].getAttribute('data-panel'),
          panel = document.getElementsByClassName(panelClass)[0];
          //alert(panel);
        // open panel when clicking on trigger btn
        panelTriggers[i].addEventListener('click', function(event){
          
          event.preventDefault();
          addClass(panel, 'cd-panel--is-visible');
        });
        //close panel when clicking on 'x' or outside the panel
        panel.addEventListener('click', function(event){
          if( hasClass(event.target, 'js-cd-close') || hasClass(event.target, panelClass)) {
            event.preventDefault();
            removeClass(panel, 'cd-panel--is-visible');
          }
        });
      })(i);
    }
  }
  
  //class manipulations - needed if classList is not supported
  //https://jaketrent.com/post/addremove-classes-raw-javascript/
  function hasClass(el, className) {
      if (el.classList) return el.classList.contains(className);
      else return !!el.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'));
  }
  function addClass(el, className) {
    if (el.classList) el.classList.add(className);
    else if (!hasClass(el, className)) el.className += " " + className;
  }
  function removeClass(el, className) {
      if (el.classList) el.classList.remove(className);
      else if (hasClass(el, className)) {
        var reg = new RegExp('(\\s|^)' + className + '(\\s|$)');
        el.className=el.className.replace(reg, ' ');
      }
  }
})();
}
</script>




<?php $__env->stopSection(); ?>

<?php echo $__env->make('adminlte::page', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>