147 lines
4.9 KiB
PHP
147 lines
4.9 KiB
PHP
@extends('layouts.master')
|
|
@section('page_title')
|
|
@if(isset($page_title))
|
|
{{ $page_title }}
|
|
@endif
|
|
@endsection
|
|
@section('css')
|
|
<link href="{!! url('public/assets/vendors/tabulator/css/bootstrap/tabulator_bootstrap.css') !!}" type="text/css" rel="stylesheet">
|
|
@endsection
|
|
@section('content')
|
|
<input type="hidden" name="branch_id" value="{{ $branch_id }}">
|
|
<div class="">
|
|
<div class="page-title">
|
|
<div class="title_left">
|
|
<div class="title_left">
|
|
<ol class="breadcrumb">
|
|
<li><a href="{!! url('dashboard') !!}">Dashboard</a></li>
|
|
<li><a href="{!! url('officelocations') !!}">Branches</a></li>
|
|
<li class="active">Documents</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="title_right">
|
|
<div class="row">
|
|
<form method="GET" action="{!! url('officelocations') !!}">
|
|
<div class="col-md-5 col-sm-5 col-xs-12 form-group">
|
|
<div style="margin-top:1px; margin-right:-90px;" class="top_search">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search" style="margin-top: -2px;">
|
|
<div class="input-group">
|
|
<input type="text" name="keyword" class="form-control" id="keywordField" placeholder="Keyword here...">
|
|
<span class="input-group-btn">
|
|
<button type="submit" class="btn btn-primary" style="color: #fff;" type="button">Go!</button>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<div class="pull-right"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="clearfix"></div>
|
|
<div class="row">
|
|
@include('commons.notifications')
|
|
<div class="col-md-12 col-sm-12 col-xs-12">
|
|
<div class="x_panel">
|
|
<div class="x_title">
|
|
<h2> Branch Documents </h2>
|
|
<div class="pull-right">
|
|
<a class="btn btn-primary btn-sm" href="{!! url('officelocations/createfiles', $branch_id) !!}"><i class="fa fa-plus-circle"></i> Upload New Documents</a>
|
|
</div>
|
|
<div class="clearfix"></div>
|
|
</div>
|
|
|
|
<div class="x_content">
|
|
<div id="branchDocumentsTable"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<input type="hidden" id="branchID" value="{{ $branch_id }}" name="branch_id">
|
|
@endsection
|
|
|
|
@section('javascript')
|
|
<script src="{!! url('public/assets/vendors/tabulator/js/tabulator.js') !!}"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
var theBranch = $("[name='branch_id']").val();
|
|
console.log(theBranch);
|
|
function link(cell, formatterParams){
|
|
var url = cell.getValue();
|
|
var rowID = cell.getData().id
|
|
return "<a href='"+ base_url + "/officelocations/editfile/"+rowID+"' title='Edit Document' class='btn btn-link'>"+url+"</a>";
|
|
}
|
|
function downloadlink(cell, formatterParams){
|
|
var url = cell.getValue();
|
|
var rowID = cell.getData().id
|
|
return "<a href='"+ base_url + "/officelocations/download/"+rowID+"' title='Download File' class='btn btn-link'>"+url+"</a>";
|
|
}
|
|
|
|
//var category = $('#categoryID').val();
|
|
|
|
var table = new Tabulator("#branchDocumentsTable", {
|
|
ajaxURL: base_url + "/officelocations/allfiles?branch_id=" + theBranch,
|
|
paginationSize: 15,
|
|
layout: "fitColumns",
|
|
pagination: "remote",
|
|
selectable: false,
|
|
printAsHtml: true,
|
|
ajaxLoaderLoading: $('#logo_spinner').html(),
|
|
columns: [
|
|
{
|
|
title: "Name",
|
|
field: "name",
|
|
sorter: "string",
|
|
formatter:link,
|
|
},
|
|
{
|
|
title: "Validity Date",
|
|
field: "validity_period",
|
|
sorter: "string",
|
|
},
|
|
{
|
|
title: "File",
|
|
field: "file_reff",
|
|
sorter: "string",
|
|
formatter:downloadlink,
|
|
},
|
|
{
|
|
title: "Uploaded By",
|
|
field: "UploadedBy",
|
|
sorter: "string",
|
|
},
|
|
{
|
|
title: "Date",
|
|
field: "created_at",
|
|
sorter: "string",
|
|
}
|
|
],
|
|
rowClick:function(e, row){
|
|
var userID = row.getData().id;
|
|
console.log(userID);
|
|
//$('#userEditModal').modal('show');
|
|
},
|
|
});
|
|
|
|
$('#keywordField').on('keyup', function(){
|
|
console.log('up');
|
|
var keyword = $(this).val();
|
|
table.setData(base_url + "/officelocations/allfiles?keyword=" + keyword);
|
|
//table.setData("officelocations/filesindex/json?keyword=" + keyword + "&category=api");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
@endsection
|