@extends('adminlte::page')

@section('content_header')
    <h1>{{request()->session()->get('session_fname')}} View</h1>
@stop
@notifyCss
 @notifyJs
<script src="//code.jquery.com/jquery.js"></script>




@section('content')

@if (session('status'))
<div class="alert alert-success">
    {{ session('status') }}
</div>
@endif
            
  @if (session('status1'))
<div class="alert alert-danger">
    {{ session('status1') }}
</div>
@endif   

@if($act_flg_status==1)
<button class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#AddModal" {{ $user_comment_flag==0 ? 'disabled=true' : '' }}>Forward</button>
</br>
<?php
if($user_comment_flag==0)
{
?>
<span class="text-danger pull-right" style="text-align: right;"> * Forward button will be enabled, if alteast one note is entered by the current seat.</span>
<?php
}
?>
@endif
 @include('notify::messages')

  <div class="row">
            <!--row starts-->

            <div class="col-md-12">
               
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title">
                        
                           {{$creation_of_file->file_no}} &nbsp&nbspCurrent Owner:{{$currentuseroffile}},{{$currentseatofile}}&nbsp&nbsp&nbsp&nbsp{{ $creation_of_file->confidential == 1 ? 'Confidential' : '' }} 
                        </h3>
                    </div>

                <div class="panel-body">
                      

                            <!-- CSRF Token -->
                             <input type="hidden" name="_token" value="{{csrf_token()}}">

                             <!--Office ID Hidden value-->
                            
                            <input type="hidden" name="file_id" value="{{$creation_of_file->id}}">
                             

                                <!-- Message body -->
                                <div class="form-group">

                                   <!-- <div class="col-md-6">
                                    <label >Tapal Number</label>
                                   
                                        &nbsp {{$creation_of_file->file_no}}
                                    </div>-->
                                    <div class="col-md-6">
                                    <label >{{request()->session()->get('session_fname')}} Title</label>
                                   
                                        &nbsp {{$creation_of_file->title}}
                                    </div>
                                     <div class="col-md-6">
                                    <label >Description</label>
                                   
                                        &nbsp {{$creation_of_file->file_description}}
                                    </div>
                                </div>





                                <!-- Message body -->
                                <div class="form-group">

                                <div class="col-md-6">
                                    <label >Reference Number</label>
                                    
                                      &nbsp {{$creation_of_file->reference_number}}
                                </div>
                                    <div class="col-md-6">
                                    <label>Priority</label>
                                                                     
                                                                        
                                       &nbsp {{$priority->priority}}       
                                </div>
                                </div>

                                                    

                                <div class="form-group">

                                
                                <div class="col-md-6">
                                          <label>{{request()->session()->get('session_fname')}} Group</label>
                                                           
                                        &nbsp {{$file_group->file_group}}
                                    

                                    </div>
                                    <div class="col-md-6">
                                    
                                        <label>Attachments</label>
                                    
                                       &nbsp {{$attachmentcount}}
                                </div>

                                </div>


                            <!-- file comment display-->
                                
                            <input type="hidden" name="_token" value="{{csrf_token()}}">

                             <!--ID Hidden value-->
                            
                              @foreach($values as $comment)

                              @if(($comment->comment_type == 1) && ($comment->seat_id == $seatid_new))

                              <div class="form-group">
                              <div class="col-md-6">
               
                                <div class="panel panel-danger">
                                    <div class="panel-heading" >
                                         {{$comment->seat->seat_name}} noted at {{$comment->created_at->format("d-m-Y H:i:s")}}
                                       </div>

                                <div class="panel-body">
                              
                                <!-- Message body -->
                                <div class="form-group">

                                <div class="col-md-6">
                                    
                                        {{$comment->comment_description}}
                                </div>
                                </div>


                             
            </div>

</div><!-- panel panel-primary end-->


</div> <!-- col6 end-->
</div>
@elseif($comment->comment_type == 0)
    
                            <div class="col-md-6">
               
                                <div class="panel panel-success">
                                    <div class="panel-heading">
                                           {{$comment->seat->seat_name}} noted at {{$comment->created_at->format("d-m-Y H:i:s")}}
                                         </div>

                                <div class="panel-body">
                                              
                                <!-- Message body -->
                                <div class="form-group">

                                <div class="col-md-6">
                                   
                                        {{$comment->comment_description}}
                                </div>
                                </div>

                             
            </div>

</div><!-- panel panel-primary end-->


</div> <!-- col6 end-->

@elseif(($comment->comment_type == 2) && ($comment->disgard_flag==0))

  <div class="col-md-6">
               
                <div class="panel panel-warning">
                    <div class="panel-heading">
                           {{$comment->seat->seat_name}} noted at {{$comment->created_at->format("d-m-Y H:i:s")}} 
                           <form class="form-horizontal" action="{{ url('filepostit_comment') }}" method="post" enctype="multipart/form-data">
                             <!-- CSRF Token -->
                             <input type="hidden" name="_token" value="{{csrf_token()}}">

                            <input type="hidden" name="creation_of_file" id="creation_of_file" value="{{$creation_of_file->id}}">
                            <input type="hidden" name="comment_id" id="comment_id" value="{{$comment->id}}">
                            @if($act_flg_status==1)
                           <button type="submit" class="btn btn-default btn-xm">
                            <span class="glyphicon glyphicon-trash"></span> Trash 
                           </button>
                           @endif
                           </form>
                         </div>

                <div class="panel-body">
                   
                                <!-- Message body -->
                                <div class="form-group">

                                <div class="col-md-6">
                                    
                                    {{$comment->comment_description}}
                                </div>
                                </div>
                
            </div>

</div><!-- panel panel-primary end-->


</div>

 @endif
 @endforeach

    <!-- tapal comments  -->

                <input type="hidden" name="_token" value="{{csrf_token()}}">

                             <!--ID Hidden value-->
      @if($commentscount > 0)
        @foreach($tapalcomments_arr as $tapalcommentarr)
            @foreach($comments[$tapalcommentarr->tapal_id] as $tapalcomment)

              @if(($tapalcomment->comment_type == 1) && ($tapalcomment->seat_id == $seatid_new))


                        <div class="form-group">
                              <div class="col-md-6">
               
                                <div class="panel panel-danger">
                                        <div class="panel-heading" >
                                        {{$tapalcomment->seat->seat_name}} noted at {{$tapalcomment->created_at}} {{$tapalcommentarr->tapal->tapal_no}}

                                        </div>

                                        <div class="panel-body">
                                          <!-- Message body -->
                                          <div class="form-group">

                                            <div class="col-md-6">
                                              
                                                  {{$tapalcomment->comment_description}}
                                            </div>
                                          </div>

                                        </div>

                                </div><!-- panel panel-primary end-->
                              </div> <!-- col6 end-->
                        </div>
              @elseif($tapalcomment->comment_type == 0)
    
                        <div class="col-md-6">
               
                                <div class="panel panel-success">
                                            <div class="panel-heading">
                                            {{$tapalcomment->seat->seat_name}} noted at {{$tapalcomment->created_at}} {{$tapalcommentarr->tapal->tapal_no}}
                                            </div>

                                       <div class="panel-body">
                                              
                                <!-- Message body -->
                                            <div class="form-group">

                                                  <div class="col-md-6">
                                                         
                                                              {{$tapalcomment->comment_description}}
                                                  </div>
                                            </div>
                 
                                        </div>
                              </div><!-- panel panel-primary end-->
                        </div> <!-- col6 end-->

              @elseif(($tapalcomment->comment_type == 2) && ($tapalcomment->disgard_flag==0))

                      <div class="col-md-6">

                            <div class="panel panel-warning">
                                  <div class="panel-heading">
                                  {{$tapalcomment->seat->seat_name}} noted at {{$tapalcomment->created_at->format("d-m-Y H:i:s")}} 
                                      <form class="form-horizontal" action="{{ url('filepostit_comment') }}" method="post" enctype="multipart/form-data">
                                      <!-- CSRF Token -->
                                      <input type="hidden" name="_token" value="{{csrf_token()}}">

                                      <input type="hidden" name="creation_of_file" id="creation_of_file" value="{{$creation_of_file->id}}">
                                      <input type="hidden" name="comment_id" id="comment_id" value="{{$tapalcomment->id}}">
                                      @if($act_flg_status==1)
                                      <button type="submit" class="btn btn-default btn-xm">
                                      <span class="glyphicon glyphicon-trash"></span> Trash 
                                      </button>
                                      @endif
                                      </form>
                                  </div>

                                  <div class="panel-body">
                                  <!-- Message body -->
                                        <div class="form-group">
                                              <div class="col-md-6">

                                              {{$tapalcomment->comment_description}}
                                              </div>
                                        </div>               
                                  </div>
                            </div><!-- panel panel-primary end-->
                      </div>

              @endif
        @endforeach
      @endforeach
    @endif
<table  width="100%">
<tr><td width="90%" align="right">  
 @if(($act_flg_status==0) && ($readflag==0))
<form class="form-horizontal" action="{{ url('move_to_inboxfile') }}" method="post" enctype="multipart/form-data" id="theform"">
                             <!-- CSRF Token -->
<input type="hidden" name="_token" value="{{csrf_token()}}">
<input type="hidden" name="creation_of_file" id="creation_of_file" value="{{$creation_of_file->id}}">
    <div class="form-position">
    <div class="col-md-12 text-right">
    <button type="submit" class="btn btn-responsive btn-info btn-sm">Move to Inbox</button>
    </div>
    </div>
</form>
@endif
</td>
<td width="10%">
 @if(($act_flg_status==0) && ($enablecapture==1))
<form class="form-horizontal" action="{{ url('capture') }}" method="post" enctype="multipart/form-data" id="theform"">
                             <!-- CSRF Token -->
<input type="hidden" name="_token" value="{{csrf_token()}}">
<input type="hidden" name="creation_of_file" id="creation_of_file" value="{{$creation_of_file->id}}">
    <div class="form-position">
    <div class="col-md-12 text-right">
    <button type="submit" class="btn btn-responsive btn-success btn-sm">Capture this {{request()->session()->get('session_fname')}}</button>
    </div>
    </div>
</form>
@endif
</td>
</tr>
</table>
         </div>

</div><!-- panel panel-primary end-->


</div> <!-- col12 end-->

@if($act_flg_status==1)

            <div class="col-md-12">
               
                  <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title">
                           Enter Your Comments
                        </h3>
                   </div>

                      <div class="panel-body">
                            
                            <form class="form-horizontal" action="{{ url('filecapture_viewpost') }}" method="post" enctype="multipart/form-data" id="theform" onsubmit="return validation();">
                             <!-- CSRF Token -->
                             <input type="hidden" name="_token" value="{{csrf_token()}}">

                            <input type="hidden" name="creation_of_file" id="creation_of_file" value="{{$creation_of_file->id}}">
                            
                                <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="description" name="description" 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>
               

            </div>



            @endif
            <!--md-12 ends-->

            <!-- comment displaying in each box-->
 

              <script>
                function validation()
                    {
                        
                        if(document.getElementById('comment_type').value=="")
                        {
                            alert(" Please select the Comment type");
                            document.getElementById('comment_type').focus();
                           
                            return false;
                        }
                        //alert(comment_type);
                        if(document.getElementById('description').value=="")
                        {
                            alert(" Please enter the Comment Description");
                            document.getElementById('description').focus();
                            return false;
                        }

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

                         
                    
                        return true;
                    }
          </script> 


@if($act_flg_status==1)
            <!-- action box  -->

            <div class="col-md-12">
               
                  <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title">
                           Actions
                        </h3>
                   </div>

                      <div class="panel-body">
                            
                            <form class="form-horizontal" action="{{ url('filecapture_actionpost') }}" method="post" enctype="multipart/form-data" id="form" onsubmit="return validation1();">
                             <!-- CSRF Token -->
                             <input type="hidden" name="_token" value="{{csrf_token()}}">

                            <input type="hidden" name="creation_of_action" id="creation_of_action" value="{{$creation_of_file->id}}">

                                <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="action_type" id="action_type" class="form-control">
                                        <option value="0">Select One</option>
                                         @foreach ($actions as $action)
                                        <option value="{{$action->id}}">{{$action->actions}}</option>

                                       @endforeach
  

                                      </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="actdescription" name="actdescription" 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>
               

            </div>
 @endif
            <script>
                       function validation1()
                                    {
                        
                        if(document.getElementById('actions').value=="0")
                        {
                            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("submit").disabled='true';

                        return true;
                    }
            </script> 

<!-- Attachements -->
@if($act_flg_status==1)
            <!-- attachment box  -->

            <div class="col-md-12">
               
                  <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title">
                           Attachments
                        </h3>
                   </div>

                      <div class="panel-body">
                            
                            <form class="form-horizontal" action="{{ url('filecapture_attachmentpost') }}" method="post" enctype="multipart/form-data" id="form" >
                             <!-- CSRF Token -->
                             <input type="hidden" name="_token" value="{{csrf_token()}}">

                            <input type="hidden" name="creation_of_file" value="{{$creation_of_file->id}}">

                                <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-group">
                                    <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>
               

            </div>
 @endif
  <script>
   //////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|png)$/;
        if(!file.match(reg))
        {
            alert("Invalid File format. Please upload correct format");
            document.getElementById('upload1').value='';
            document.getElementById('upload1').focus();
            return false;
        }
    }
            </script> 
<!--- end attachment -->
<!-- show saved comments -->              
            <input type="hidden" name="_token" value="{{csrf_token()}}">

                             <!--ID Hidden value-->
                            
                              @foreach($values1 as $action)

                              
                               <div class="col-md-12">
               
                <div class="panel panel-info">
                    <div class="panel-heading">
                        <h3 class="panel-title">
                           {{$action->seat->seat_name}}  created a {{$action->action->actions}} on {{$action->created_at->format("d-m-Y H:i:s")}}
                        </h3>
                    </div>

                <div class="panel-body">
                              

                                <!-- Message body -->
                                <div class="form-group">
                              
                                <div class="col-md-6">
                                   
                                    
                                       &nbsp {{$action->action_description}}
                                </div>
                                </div>
                             
                </div>

                </div><!-- panel panel-primary end-->
                </div> 

@endforeach

                <!-- tapal actions -->
                        <input type="hidden" name="_token" value="{{csrf_token()}}">

                             <!--ID Hidden value-->
                             @if($tapalactionscount > 0)
                              @foreach($tapalactions_arr as $tapalactionarr)

                              @php $tapalactiontapalid=$tapalactionarr->tapal_id; @endphp

                              @foreach($tapalactions[$tapalactiontapalid] as $tapalaction)

                              
                               <div class="col-md-12">
               
                <div class="panel panel-info">
                    <div class="panel-heading">
                        <h3 class="panel-title">
                           {{$tapalaction->seat->seat_name}} created a {{$tapalaction->action->actions}} on {{$tapalaction->created_at->format("d-m-Y H:i:s")}} from {{$tapalactionarr->tapal->tapal_no}}  
                        </h3>
                    </div>

                <div class="panel-body">
                              

                                <!-- Message body -->
                                <div class="form-group">
                              
                                <div class="col-md-6">
                                    
                                    
                                       &nbsp {{$tapalaction->action_description}}
                                </div>
                                </div>
                             
                </div>

                </div><!-- panel panel-primary end-->
                </div> 

@endforeach
@endforeach
@endif


            

          <div class="col-md-12">
               
              <div class="panel panel-info">
                <div class="panel-heading">
                    <h3 class="panel-title">
                      Attachments
                    </h3>
                </div>

                <div class="panel-body">
                  <div class="col-md-10">
                   
                    <?php
                     if(($attachmentcount==0) && ($tapalattachmentscount==0))
                     {
                    ?>
                     <span class="primary">No Attachments uploaded yet !!!</span>
                     <?php
                      }
                      else
                      {
                     ?>
                    @if($attachmentcount)

                      @foreach($attachments as $attachment)

                        <div onclick="showdocument('{{$attachment->document_path}}');">{{$userseatattachment->seat->seat_name}} created an attachment <span class="text-info">{{$attachment->document_name}}::View File</span> on {{$attachment->created_at->format("d-m-Y H:i:s")}} </div>
                      @endforeach     
                    @endif
                    @if($tapalattachmentscount > 0)
                     @foreach($tapalattachments_arr as $tapalattachmentarr)
                      @foreach($tapalattachments[$tapalattachmentarr->tapal_id] as $tplattachment)

                        <div onclick="showdocument('{{$tplattachment->document_path}}');">{{$tplattachment->user->name}} created an attachment <span class="text-info">{{$tplattachment->document_name}} ::View File </span> on {{$tplattachment->created_at->format("d-m-Y H:i:s")}} from <span class="text-success">{{$tapalattachmentarr->tapal->tapal_no}}</span></div>
                      @endforeach
                      @endforeach
                    @endif
                    <?php
                  }
                  ?>
                    <div class="col-md-10" align="center">
                       <iframe src="" id="documentframe" width="700" height="400" style="display: none;"></iframe>
                    </div>
                  </div>
                </div>
              </div>

          </div> 


          <!-- LINK -->

          <div class="col-md-12">
               
              <div class="panel panel-info">
                <div class="panel-heading">
                    <h3 class="panel-title">
                      LINKS
                    </h3>
                </div>

                <div class="panel-body">
                    <div class="col-md-10">
                    <?php
                     if($tapallinkscount=='')
                     {
                    ?>
                     <span class="primary">No {{request()->session()->get('session_tname')}}s attached yet !!!</span>
                     <?php
                      }
                      else
                      {
                     ?>
                     @foreach($tapallinks as $tapallink)
                     {{$tapallink->tapal->tapal_no}} attached to this file on {{$tapallink->created_at->format("d-m-Y H:i:s")}} by {{$tapallinkseat->seat->seat_name}}<br>
                     @endforeach
                     <?php
                   }
                   ?>
                  </div>
                </div>
              </div>

          </div> 

    

<script>
    function showdocument(path)
    {
        
        document.getElementById("documentframe").src="../../storage/app/"+path;
        document.getElementById("documentframe").style.display="block";
    }
</script>


        <!-- template view  -->
@if($act_flg_status==1)
<div class="col-md-12">
               
                  <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title">
                           Generate From Template 
                        </h3>
                   </div>

                      <div class="panel-body">
                            
                            <form class="form-horizontal" action="{{ url('fileview_templatepost') }}" method="post" enctype="multipart/form-data" id="temp" onsubmit="return validationtemp();">
                             <!-- CSRF Token -->
                             <input type="hidden" name="_token" value="{{csrf_token()}}">

                            <input type="hidden" name="filetemplate" id="filetemplate" value="{{$creation_of_file->id}}">

                                <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>
                                       @foreach ($template as $title)
                                        <option value="{{$title->id}}">{{$title->title}}</option>

                                       @endforeach

                                      </select>
                                      </div>
                                </div>
                                 <div id="templatediv">
                                 </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="sub">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%">            
                                     @foreach ($ftemplate as $titledisp)
                                     <tr><td width="75%">
                                     @php $fileviewtemplateid=$titledisp->id; @endphp
                                     <b>{{$titledisp->template->title}}</b> last modified by {{$titledisp->user->name}} on {{$titledisp->created_at->format("d-m-Y H:i:s")}}
                                    @if($titledisp->approval_flag==1)
                                         approved by {{$fileviewtemplatearr[$fileviewtemplateid]}}
                                    @endif
                                    <br>
                                      </td>
                                      <td>
                                      @if($titledisp->approval_flag==0)
                                      <button data-toggle="modal" data-target='#TemplateModal' class="btn btn-success pull-right btn-sm" type="button" onclick=getModaltemp('{{$titledisp->id}}');>Edit this Document</button>
                                      @endif

                                      @if($titledisp->approval_flag==1)
                                      <button data-toggle="modal" data-target='#ApproveModal' class="btn btn-warning pull-right btn-sm" type="button" onclick=getApprovetemp('{{$titledisp->id}}');>View this Document</button>
                                      @endif
                                        </td>
                                      </tr>
                                       @endforeach
                                        </table>
                                    </div>

                                </div>

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

            </div>
@endif

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

        document.getElementById("sub").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>


           


    <!--  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="{{ 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="{{ csrf_token() }}">
                <input type="hidden" name="fileview_template_id" id="fileview_template_id" value="">

                <input type="hidden" name="creation_of_file_id" id="creation_of_file_id" value="{{$creation_of_file->id}}">

                
                       <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="{{ url('/approve_templatepost') }}" method="post" enctype="multipart/form-data" id="tapal_forward">
                  <input type="hidden" name="_token" value="{{ csrf_token() }}">

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

                <input type="hidden" name="creation_of_file_id" id="creation_of_file_id" value="{{$creation_of_file->id}}">
                <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="{{ csrf_token() }}">
                <input type="hidden" name="fileview_template_id" id="fileview_template_id" value="">

                <input type="hidden" name="creation_of_file_id" id="creation_of_file_id" value="{{$creation_of_file->id}}">

                    <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="{{ csrf_token() }}">

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

                <input type="hidden" name="creation_of_file_id" id="creation_of_file_id" value="{{$creation_of_file->id}}">
                 <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="{{ url('/pdftemppost') }}" method="post" enctype="multipart/form-data" id="tapal_forward">
                  <input type="hidden" name="_token" value="{{ csrf_token() }}">
                 
                   <input type="hidden" name="pdffileview_template_id" id="pdffileview_template_id" value="">
                   <input type="hidden" name="creation_of_file_id" id="creation_of_file_id" value="{{$creation_of_file->id}}">
                <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>


    <!--end of approve modal -->       


        <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: "{{ 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: {{ url('/index.php/getapprovetemp/"+id+"') }},
                   url: "{{ 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="{{ asset('/index.php/word')}}"+"/"+fileviewtemplateid;

            }

            
        </script>



<script>
         function getfiletemplate(id){
          //alert(id);
          
             //document.actionmodalform.creation_of_tapal.value=id;
            $.ajax({
               
               type:'GET',
              // url:"/fileflow/public/index.php/gettitle/"+id+"",
               url: "{{ 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>


    </div><!--row end-->



   

<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="{{ url('/file_forwardpost') }}" method="post" id="tapal_forward" onsubmit="return validateform();">

            <div class="modal-body">
                <div class="box-body">
                     <input type="hidden" name="_token" value="{{ csrf_token() }}">

                            <input type="hidden" name="creation_of_file_id" id="creation_of_file_id" value="{{$creation_of_file->id}}">

                            <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>
                                       @foreach ($office as $officename)
                                        <option value="{{$officename->id}}">{{$officename->office_name}}</option>

                                       @endforeach

                                      </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>

            <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;
                    }
            </script>

                       


<script>

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

           $('#officename').change(function(){
      
        $.get("{{ 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("{{ 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(){
      
        $.get("{{ 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("{{ 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("{{ 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("{{ url('getseattable')}}",
        { option: $(this).val() },
        function(data) {
          //alert(data);
              
            
            document.getElementById("seattable").innerHTML=data;
        });
    });

});




</script>

@stop
