<?php $__env->startSection('css_page_level'); ?>
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css')); ?>"/>
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/global/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css')); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/global/plugins/bootstrap-fileinput/bootstrap-fileinput.css')); ?>"/>
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/global/plugins/select2/css/select2.css')); ?>"/>
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/global/plugins/select2/css/select2-bootstrap.min.css')); ?>"/>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page-content-wrapper'); ?>
	<div class="page-content-wrapper" id="main">
		<div class="page-content">
			<h3 class="page-title">
				<?php $setting = app('anlutro\LaravelSettings\Facade'); ?>
				<?php echo e($setting::get('system_name','全方位建築智慧化管理系統')); ?> <small><?php echo e($setting::get('company_name','新保科技')); ?></small>
			</h3>
			<div class="page-bar">
				<ul class="page-breadcrumb">
					<li>
						<i class="fa fa-home"></i>
						<a href="<?php echo e(route('manage::index')); ?>">首頁</a>
						<i class="fa fa-angle-right"></i>
					</li>
					<li>
						<a href="javascript:;"><?php echo app('translator')->get('messages.charge_system'); ?></a>
						<i class="fa fa-angle-right"></i>
					</li>
					<li>
						<a href="<?php echo e(route('manage::charge::article::article')); ?>"><?php echo app('translator')->get('messages.charge_article'); ?></a>
					</li>
				</ul>
				<div class="page-toolbar">
				</div>
			</div>
			<div class="row">
				<div class="col-md-12">
					<div class="portlet light bordered">
						<div class="portlet-body">
							<div class="table-toolbar">
								<div class="row">
									<div class="col-md-6">
										<a href="<?php echo e(action('ChargeArticleController@create')); ?>" class="btn green">新增 <i class="fa fa-plus"></i></a>
										<button id="btn_tag" class="btn blue"> 項目管理 <i class="fa fa-cog"></i></button>
									</div>
									<div class="col-md-6 text-right">
										<a class="btn btn-info" href="<?php echo e(action('ChargeArticleController@index')); ?>">全部</a>
										<a class="btn btn-primary" href="<?php echo e(action('ChargeArticleController@index')); ?>?filter=0">未借出</a>
										<a class="btn btn-success" href="<?php echo e(action('ChargeArticleController@index')); ?>?filter=1">借用中</a>
										<a class="btn btn-danger" href="<?php echo e(action('ChargeArticleController@index')); ?>?filter=2">註銷中</a>
									</div>
								</div>
							</div>
							<table class="table table-striped table-bordered table-hover" id="table_list">
								<thead>
									<tr>
										<th>
											#
										</th>
										<th>
											財產編號
										</th>
										<th>
											設備名稱
										</th>
										<th>
											保管人
										</th>
										<th>
											放置位置
										</th>
										<th>
											狀態
										</th>
										<th>
											動作
										</th>
									</tr>
								</thead>
								<tbody>
									<?php foreach($data as $one): ?>
									<tr class="odd gradeX">
										<td>
											<?php echo e($one->id); ?>

										</td>
										<td>
											<?php echo e($one->no); ?>

										</td>
										<td>
											<?php echo e($one->name); ?>

										</td>
										<td>
											<?php echo e($one->custodian_name); ?>

										</td>
										<td>
											<?php echo e($one->placement); ?>

										</td>
										<td>
											<?php if($one->status == '0'): ?>
											<span class="label label-success"> 未借出 </span>
											<?php elseif($one->status == '1'): ?>
											<span class="label label-danger"> 借用中 </span>
											<?php elseif($one->status == '2'): ?>
											<span class="label label-default gray"> 註銷中 </span>
											<?php endif; ?>
										</td>
										<td>
											<?php if($one->status != '2'): ?>
											<div class="btn-group">
												<button class="btn btn-default btn-xs dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false"> 動作 <i class="fa fa-angle-down"></i></button>
												<ul class="dropdown-menu pull-right" role="menu">
													<?php if( $one->status == '1' ): ?>
													<li>
														<a href="<?php echo e(action('ChargeArticleController@remand',['id'=>$one->id])); ?>">
														<i class="fa fa-check"></i>
														快速歸還 </a>
													</li>
													<?php elseif( $one->status == '0'): ?>
													<li>
														<a href="<?php echo e(action('ChargeArticleController@borrow',['id'=>$one->id])); ?>">
														<i class="fa fa-check"></i>
														快速借物 </a>
													</li>
													<?php endif; ?>
													<li>
														<a href="<?php echo e(action('ChargeArticleController@edit',['id'=>$one->id])); ?>">
															<i class="fa fa-pencil"></i> 編輯 
														</a>
													</li>
													<li class="divider">
													</li>
													<li>
														<a href="<?php echo e(action('ChargeArticleController@del',['id'=>$one->id])); ?>">
															<i class="fa fa-trash-o"></i> 註銷
														</a>
													</li>
												</ul>
											</div>
											<?php endif; ?>
										</td>
									</tr>
								<?php endforeach; ?>
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<div class="modal fade" id="modal_tag" tabindex="-1" role="basic" aria-hidden="true">
		<div class="modal-dialog">
	        <div class="modal-content">
	            <div class="modal-header">
	                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
	                <h4 class="modal-title">項目管理</h4>
	            </div>
	            <div class="modal-body">
	            	<form id="form_type" class="form-horizontal form-bordered ">
	                    <div class="form-body">
	                        <div class="form-group">
	                            <label class="control-label col-md-3">放置位置</label>
	                            <div class="col-md-9">
	                                <input name="charge_placement" class="tagsinput" type="text" value="<?php echo e($placement->tags); ?>" data-role="tagsinput"> 
	                            </div>
	                        </div>
	                        <input type="hidden" id="_token" name="_token" value="<?php echo e(csrf_token()); ?>">
	                    </div>
	                    <div class="form-actions">
	                        <div class="row">
	                            <div class="col-md-offset-3 col-md-9">
	                                <button id="btn_type_submit" type="button" class="btn green">
	                                    <i class="fa fa-check"></i> 儲存</button>
	                                <button type="button" class="btn default" data-dismiss="modal">關閉</button>
	                            </div>
	                        </div>
	                    </div>
	                </form>
	            </div>
	        </div>
	    </div>
	</div>

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

<?php $__env->startSection('plugins_page_level'); ?>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/datatables/media/js/jquery.dataTables.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/bootbox/bootbox.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/bootstrap-tagsinput/bootstrap-tagsinput.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/jquery-validation/js/jquery.validate.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/bootstrap-fileinput/additional-methods.js')); ?>"></script>
<script src="<?php echo e(asset('assets/global/plugins/moment.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/bootstrap-fileinput/bootstrap-fileinput.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/select2/js/select2.min.js')); ?>"></script>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('js_page_level'); ?>
<script>
$(document).ready(function(){
	
    
	$('.show-popover').popover({
		html:true
	})
	$('.show-tooltip').tooltip();
	$('#table_list').dataTable({
		// Internationalisation. For more info refer to http://datatables.net/manual/i18n
		"language": {
		    "aria": {
		        "sortAscending": ": activate to sort column ascending",
		        "sortDescending": ": activate to sort column descending"
		    },
		    "emptyTable": "此列表目前沒有資料",
		    "info": "顯示第 _START_ 到第 _END_ 則 共有 _TOTAL_ 則",
		    "infoEmpty": "沒有找到符合的資料",
		    "infoFiltered": "(從 _MAX_ 筆資料中過濾)",
		    "lengthMenu": "顯示 _MENU_ 則",
		    "search": "快速篩選:",
		    "zeroRecords": "目前沒有任何資料",
		    "paginate": {
		        "previous":"上一頁",
		        "next": "下一頁",
		        "last": "最後",
		        "first": "最前"
		    }
		},


		"lengthMenu": [
		    [10, 20, 50, -1],
		    [10, 20, 50, "All"] // change per page values here
		],
		// set the initial value
		"pageLength": 10,            
		"pagingType": "bootstrap_full_number",
		"columnDefs": [{  // set default column settings
		    'orderable': false,
		    'targets': [0]
		}, {
		    "searchable": false,
		    "targets": [0]
		}]
	});

	$(document).on('click','#btn_tag',function(){
		$('#modal_tag').modal('show');
	});

	$(document).on('click','#btn_type_submit',function(){
		$.ajax({
			type : 'POST',
			dataType: 'json',
			url  : '<?php echo e(action('ChargeArticleController@updateTag')); ?>',
			data : $('#form_type').serialize(),
			success : function (sendback) {
				toastr['success']('更新成功!');
			},
			error : function (sendback) {
				toastr['error']('更新失敗，請重新整理後再嘗試');
			}
		})
	});
});

</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.manage', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>