<script src="//code.jquery.com/jquery.js"></script>
<?php $__env->startSection('content'); ?>
<?php echo notifyCss(); ?>
<?php echo notifyJs(); ?>
<style>
  td 
  {
    padding: 4px !important;
  }
</style>
<?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_tapal" class="btn compose btn-block margin-bottom">Creation of <?php echo e(request()->session()->get('session_tname')); ?></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>
          <li><a href="#"><i class="fa fa-star text-yellow"></i>Has Valuables</a></li>
        </ul>
      </div>
      <!-- /.box-body -->
    </div>
    <!-- /.box -->
  </div>
  <!-- /.col -->
  <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">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="tapal_forward">
            <tbody>
            <tr>
            </tr>
            </tbody>
          </table>
          <!-- /.table -->
        </div>
        <!-- /.mail-box-messages -->
      </div>
      <!-- /.box-body -->
    </div>
    <!-- /. box -->
  </div>
  <!-- /.col -->
</div>
<!-- /.new modal tapal view -->
<div id="modaltapalview" class="cd-panel cd-panel--from-right js-cd-panel-main">
  <header class="cd-panel__header">
    <div class="mailbox-read-info" >
        <h3 id="tapalno"></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='file_id' id='file_id' value=''>
      <input type='hidden' name='user_comment_flag' id='user_comment_flag' value=''>  
      <div class="box">
        <div class="box-header with-border">
          <h3 class="box-title" id="internal_external" >.</h3>
            <div class="box-tools pull-right" style="justify-content: flex-end; align-items: center;   display: flex; flex-wrap: wrap; column-gap: 10px;">
              <button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#AddModal" data-container="body" title="Forward" data-original-title="Forward" id="newforward" disabled="disabled" >
              <i class="fa fa-share"></i></button>
              <button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#Modal" data-container="body" title="Attach to new file" data-original-title="" id="newfile" onclick="attachnewfile()">
              <i class="fa fa-file"></i></button>
              <button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#Modal1" data-container="body" title="Attach to Existing File" data-original-title="" id="oldfile" onclick="existfile()">
              <i class="fa fa-file-text"></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>
              </div>
              <div class="col-md-6"></div>
            </div>
            <div class="row tapal_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">Subject</h5>
                  <span class="description-text" id="subject"></span>
                </div>
                <!-- /.description-block -->
              </div>
              <!-- /.col -->
              <div class="col-sm-3 col-xs-6">
                <div class="description-block border-right">
                  <span class="description-percentage text-green"><i class="fa  fa-tag"></i></span>
                  <h5 class="description-header">Mode of Receipt</h5>
                  <span class="description-text" id="mode"> </span>
                </div>
                <!-- /.description-block -->
              </div>
              <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').style.display="block";  
          }
          function attachmentvalidation2()
          {
              return true;
          }
          $(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: "tapal_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('tapal_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">Comments
                  <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="description" id="comment_description" placeholder="Write a comment" required>
                <span class="input-group-btn">
                      <button type="button" id="commentbtnsubmit" class="btn btn-info btn-flat" title="Send Comment"><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());
            });
          $(function() {
            $('#commentbtnsubmit').click(function() {
              var tapal_id=document.getElementById("creation_of_comment").value;
              var comment_type=document.getElementById("comment_type").value;
              var description=document.getElementById("comment_description").value;
              $.ajax({
                  url: "tapal_viewpost",
                  type: "POST",
                  data: { "_token": "<?php echo e(csrf_token()); ?>",
                  "creation_of_tapalcomment": tapal_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;
                      //alert(fileid);
                      if((active_flag) && (!fileid))
                      {
                        if(document.getElementById("user_comment_flag").value == 1)
                        {
                          // alert(active_flag+"...."+fileid);
                          document.getElementById("newforward").disabled = false;
                        }
                        else
                        {
                          document.getElementById("newforward").disabled = true;
                        }
                      } 
                  }   
              });
            });
          });
          
          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('tapal_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" required>
              <span class="input-group-btn">
                      <button type="button" id="actionsubmit" class="btn btn-info btn-flat" title="Send Action"><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 -->
      </div>
      <script>
        $('#actionval a').click(function(){
          $('#selectedaction').text($(this).text());
          $('#action_type').val($(this).text());
        });
        $(function() {
          $('#actionsubmit').click(function() {
            var tapal_id=document.getElementById("creation_of_action").value;
            var action_type=document.getElementById("action_type").value;
            var description=document.getElementById("actdescription").value;
            $.ajax({
                url: "tapal_actionpost",
                type: "GET",
                data: { "_token": "<?php echo e(csrf_token()); ?>",
                "creation_of_action": tapal_id,
                "action_type": action_type,
                "actdescription": description },
                dataType: 'JSON',
                // here build JSON object with your form data
                //success:function(data)
                success: function (data) { 
                    document.getElementById("actdescription").value='';
                    $('#selectedaction').text('');
                    var existingactions=document.getElementById("action").innerHTML;
                    document.getElementById("action").innerHTML=data.action+existingactions;
                }          
            });
          });
        });
        function actionvalidation()
        {
          if(document.getElementById('action_type').value=='')
          {
            alert(" Please select the Action type");
            document.getElementById('actions').focus();
            return false;
          }
          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> 
    </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() {
    $('#tapal_forward').DataTable({
        processing: true,
        serverSide: true,
        "lengthChange": false,
        ajax: '<?php echo url('inboxjson'); ?>',
        
               '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 if(full.valuables)
                   return "<i class='fa fa-star text-yellow' 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;'>T</span><div class='search_list'><a href='#0' onClick='tapal_view("+full.tapalid+")' class='search-item js-cd-panel-trigger' data-panel='main'>Tapal No:<b>"+full.tapal_no+"</b><span class='label label-tags pull-right' style='font-size: 75%;'><b>"+full.subject_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: 11px;'>"+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: 11px; '> "+full.created_at+"</span></a>";
               }
            },

            {
               '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='puttapalno("+full.tapalid+")' 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='getAttachmenttype("+full.tapalid+")' 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.tapalattachmentcount+"</a><a href='#HistoryModal ' data-toggle='modal' data-target='#HistoryModal' onClick='getHistory("+full.tapalid+")' 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='getActiontype("+full.tapalid+")' 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.tapalactioncount+"</a><a href='#CommentModal ' data-toggle='modal' data-target='#CommentModal' onClick='getMessage("+full.tapalid+")' 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.tapalcommentcount+"</a>    <a href='showcreation_of_tapaldata/"+full.tapalid+"' 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();
          }
    });
  });
  
  //////////////////////////////////////////////////////////
  function tapal_view(id)
  {   
    document.getElementById("creation_of_tapal").value=id;
    $.ajax({
      type:'GET',
      url:"modaltapalview/"+id+"",
      success:function(data)
      {
          document.getElementById("tapalno").innerHTML=data['tapal_no'];
          document.getElementById("internal_external").innerHTML=data['internal_external']; 
          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("subject").innerHTML=data['subject'];
          document.getElementById("mode").innerHTML=data['mode_of_receipt'];
          document.getElementById("priority").innerHTML=data['priority'];
          document.getElementById("description").innerHTML=data['tapal_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("creation_of_attachment").value=data['id'];
          document.getElementById("creation_of_action").value=data['id'];
          document.getElementById("active_flag").value=data['active_flag'];
          document.getElementById("file_id").value=data['file_id'];
          document.getElementById("creation_of_tapal_id").value=data['id'];
          document.getElementById("user_comment_flag").value=data['user_comment_flag'];
          if((data['active_flag']==1) && (!data['file_id']))
          {
            if(data['user_comment_flag'] == 1)
            {
              document.getElementById("newforward").disabled = false;
            }
            else
            {
              document.getElementById("newforward").disabled = true;
            }
          }
          else
          {
            document.getElementById("newforward").disabled = true;
          }
          
          if((data['active_flag']==1) && (!data['file_id']))
          {
            document.getElementById('newfile').style.display="block";
            document.getElementById('oldfile').style.display="block";
            document.getElementById('comment').style.display="block";
            document.getElementById('action').style.display="block";
            document.getElementById('attachment').style.display="block";

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

  //////////////////////////////////////////////////////////////////
  function existfile()
  {
    $.ajax({
      type:'GET',
      url:"modaloldfile/",
      success:function(data)
      {
        var tapal_id=document.getElementById("creation_of_tapal").value;
        document.getElementById("tapal_id").value=tapal_id;
        data['filegroup'].forEach(function(item){
          //alert(item.id);
          var select = document.getElementById('filegroup');
          var opt = document.createElement('option');
          opt.value = item.id;
          opt.innerHTML = item.file_group;
          select.appendChild(opt);
        });
      }
    });
  }
</script>

<div class="modal fade" id="Modal1" 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">Attach to Existing File</h4>
            </div>

        <div class="panel-body">

             <form action="<?php echo e(url('/file_existpost')); ?>" method="post" id="existfile" onsubmit="return validatefile1();">

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

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

                               <div class="form-group">
                                    <label class="col-md-3 control-label" for="email">File Group<span style="color: red;">*</span></label>
                                    <div class="col-md-9">
                                     <select name="filegroup" id="filegroup" 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">File<span style="color: red;">*</span></label>
                                    <div class="col-md-9">
                                     <select name="fileinhand" id="fileinhand" class="form-control selectpicker" data-live-search="true">
                                        <option value="0">Select One</option>
                                       

                                      </select>
                                      </div>
                                </div>
                                    
                                <!-- Message body -->
                               
                                  
                                </div>

                </div>
            </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="exfile" onclick=" " >Save</button>
                
            </div>
            </form>
            </div>
        </div>
    </div>
</div>

<script>
  $(document).ready(function($){
     
    $('#filegroup').change(function(){
      $.get("<?php echo e(url('getfile')); ?>",
      { option: $(this).val() },
      function(data) 
      {
        $('#fileinhand').empty();
        $('#fileinhand').append("<option value='0'>Select a file</option>");
        $.each(data, function(key,element) {
            $('#fileinhand').append("<option value='" + element.file.id +"'>" + element.file.file_no + "--"+ element.file.title+ "</option>");
        });
         $('#fileinhand').selectpicker('refresh');
      });
    });
  });
  ////////autocomplete/////////////////////////
  /* $('#filegroup').autocomplete({
        source : '<?php echo e(url('getfile')); ?>',
        minlenght:1,
        autoFocus:true,
        select:function(e,ui){
          alert(ui);
        }
      });*/
  function attachnewfile()
  {
    $.ajax({
      type:'GET',           
      url:"modalnewfile/",
      success:function(data)
      {
        var tapalid=document.getElementById("creation_of_tapal").value;
        document.getElementById("tapalid").value=tapalid;
        document.getElementById("filenodisplay").innerHTML=data['fileno'];
        document.getElementById("fileno").value=data['fileno'];
        data['file_group'].forEach(function(item){
          //alert(item.id);
          var select = document.getElementById('file_group');
          var opt = document.createElement('option');
          opt.value = item.id;
          opt.innerHTML = item.file_group;
          select.appendChild(opt);
        });

        data['priority'].forEach(function(obj){
          //alert(obj.id);
          var key = document.getElementById('prioritynewfile');
          var opt1 = document.createElement('option');
          opt1.value = obj.id;
          opt1.innerHTML = obj.priority;
          key.appendChild(opt1);
        });             
      }
    });
  }
</script>

<div class="modal fade" id="Modal" 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">Attach to New File</h4>
            </div>
            <div class="panel-body">
              <form action="<?php echo e(url('/file_createpost')); ?>" method="post" id="newfile" onsubmit="return validatefile();">
                <div class="modal-body">
                  <div class="box-body">
                    
                      <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
                      <input type="hidden" name="tapalid" id="tapalid" value="">
                      <div class="form-group">
                      <label class="col-md-3 control-label" for="name">File Number</label>
                      <div class="col-md-9" id="filenodisplay">
                      
                      </div>
                      <input id="fileno" name="fileno" type="hidden" class="form-control" value=""></div>
                 </div>

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

                      <div class="form-group">
                      <label class="col-md-3 control-label" for="addr">Reference<span style="color: red;">*</span></label>
                      <div class="col-md-9">
                      <input id="referencenumber" name="referencenumber" class="form-control">
                      </div>
                      </div>  

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

                      <div class="form-group">  
                      <label class="col-md-3 control-label" for="name">&nbsp;</label>                          
                      <div class="sub1 col-md-9">
                      <div class="checkbox">
                      <label> <input type="checkbox" name="confidential" id="confidential"  value="1">Confidential</label> <!-- function to hide radio buttons(toggleupload) -->
                      </div>
                      </div>
                      </div>


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

          </div>

                      <div class="form-group">
                      <div class="modal-footer">
                      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                      <button type="submit" class="btn btn-success" id="nwfile"  >Save</button>
                      </div>
                      </div>

                  </div>
                </div>
                
              </form>
            </div>
      </div>
    </div>
</div>
<!-------------------------- Forward Details Modal------------------>
<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('/tapal_forwardpost')); ?>" name="forwardform" method="post" id="tapal_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_tapal_id" name="creation_of_tapal_id">
                         <div class="form-group">
                          <label class="col-md-3 control-label" for="">Route</label>
                          <div class="col-md-9">
                            <select name="TapalRoute" id="TapalRoute" class="form-control">
                              <option value="0">Select One</option>
                              <?php $__currentLoopData = $troutarr; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $trouts): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($trouts['id']); ?>"><?php echo e($trouts['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>

                                <!--section name-->

                          <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-9" 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>
<!-----------------------------------------Forward Deatils Modal scripts----------------->
<script>
  function validateform()
  {
      if(document.getElementById('officename').value=="0")
      {
          alert(" Please select the Office");
          document.getElementById('officename').focus();
          return false;
      }
      document.getElementById("for").disabled='true';
      // return true;
  }

  /////tapal route/////////////////////
  $(document).ready(function($)
  {
      $('#TapalRoute').change(function()
      {
        $.get("<?php echo e(url('getseatfromtroute')); ?>",
        { 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);
            
              }
        });

        //route loading
        $.get("<?php echo e(url('getofficeroute')); ?>",
            { 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>");
            });
        });
      });
  });

  $(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);
            
            }
        });*/

        //department loading
          $.get("<?php echo e(url('getofficedept')); ?>",
            { 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>");
            });
          });
      });
      ///////////////////
      $('#deptname').change(function(){
        //section loading
        $.get("<?php echo e(url('getsectiondept')); ?>",
        { 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>
<!-------------------------------------------Forward Modal Ends------------------>
<!--History Modal-->
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">      </script>
<script>
  function getHistory(id)
  {
    document.historymodalform.creation_of_tapal.value=id;
    $.ajax({
      type:'GET',
      url:"gethistory/"+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('tapal_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="creation_of_tapal" id="creation_of_tapal" 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>
            <!--panel body close-->
        </div>
    </div>
</div>
<!-- end history modal -->
<!--  Comment Modal -->
<!--tapal comment-->
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">     </script>
<script>
  function puttapalno(id)
  {
    document.getElementById("creation_of_tapal_id").value=id;
  }
  function getMessage(id)
  {
    document.getElementById("creation_of_tapalcomment").value=id;
    $.ajax({
      type:'GET',
      url: "getcomment/"+id+"",
      success:function(data){
      alert(data);
      $("#commentdiv").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" action="<?php echo e(url('tapal_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="commenttapalid" id="commenttapalid" value="">  -->

                             <input type="hidden" name="creation_of_tapalcomment" id="creation_of_tapalcomment" 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="btnsubmitt" >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="commentdiv"></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()
    {
        //alert(document.getElementById('comment_type').value);
        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("btnsubmitt").disabled='true';

    
        return true;
    }
</script> 

<!--tapal action modal-->
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">  </script>
<script>
  function getActiontype(id)
  {
    document.getElementById("creation_of_tapalaction").value=id;
    $.ajax({
         type:'GET',
         url:"getaction/"+id+"",
         success:function(data){
            $("#actiondiv").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="actionmodalform" action="<?php echo e(url('tapal_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="actiontapalid" id="actiontapalid" value="">  -->

                            <input type="hidden" name="creation_of_tapalaction" id="creation_of_tapalaction" 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="actiondiv"></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;
      }
      //alert(document.getElementById('actdescription').value);
      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> 
<!--tapal attachment modal-->
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"> </script>
<script>
  function getAttachmenttype(id)
  {
    document.getElementById("creation_of_tapalattachment").value=id;
    $.ajax({ 
       type:'GET',
       url:"getattachment/"+id,
       success:function(data){
          $("#attachmentdiv").html(data);                
       }
    });
  }
  ///////////////////////////////////////////
  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="attachmentmodalform" action="<?php echo e(url('tapal_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="attachmenttapalid" id="attachmenttapalid" value="">  -->

                            <input type="hidden" name="creation_of_tapalattachment" id="creation_of_tapalattachment" 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="attachmentdiv"></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(); ?>