<?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-fileinput/bootstrap-fileinput.css')); ?>"/>
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css')); ?>"/>
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/global/plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css')); ?>"/>
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/global/plugins/bootstrap-daterangepicker/daterangepicker-bs3.css')); ?>"/>
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css')); ?>"/>
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/global/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css')); ?>" />
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page-content-wrapper'); ?>
	<div class="page-content-wrapper" id="main">
		<div class="page-content">
			<!-- BEGIN PAGE HEADER-->
			<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')); ?>"><?php echo app('translator')->get('messages.homepage'); ?></a>
						<i class="fa fa-angle-right"></i>
					</li>
					<li>
						<a href="javascript:;"><?php echo app('translator')->get('messages.neighbor_hood'); ?></a>
						<i class="fa fa-angle-right"></i>
					</li>
					<li>
						<a href="<?php echo e(action('Manage\Interactive\MattersAssignedController@index')); ?>"><?php echo app('translator')->get('messages.matters_assigned'); ?></a>
					</li>
				</ul>
				<div class="page-toolbar">

				</div>
			</div>
			<!-- END PAGE HEADER-->
			<!-- BEGIN DASHBOARD STATS -->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN EXAMPLE TABLE PORTLET-->
					<div class="portlet light bordered">
						<div class="portlet-body">
							<div class="table-toolbar">
								<div class="row">
									<div class="col-md-6">
										<div class="btn-group">
											<a href="<?php echo e(action('Manage\Interactive\MattersAssignedController@create')); ?>"  class="btn green">
											<?php echo app('translator')->get('messages.add'); ?> <i class="fa fa-plus"></i>
											</a>
										</div>
										<button id="btn_mass_delete" class="btn red" style="display:none;"> <?php echo app('translator')->get('messages.del'); ?> <i class="fa fa-trash"></i></button>
										
									</div>
									<div  class="col-md-6">
										<button id="btn_tag" class="btn blue pull-right"> <?php echo app('translator')->get('messages.item_manage'); ?> <i class="fa fa-cog"></i></button>
									</div>

								</div>
							</div>
							<table class="table table-striped table-bordered table-hover" id="table_list">
							<thead>
							<tr>
								<th class="table-checkbox">
									<input type="checkbox" class="group-checkable" data-set="#table_list .checkboxes"/>
								</th>
								<th>
									<?php echo app('translator')->get('messages.response_time'); ?>
								</th>
								<th>
									<?php echo app('translator')->get('messages.matters_item'); ?>
								</th>
								<th>
									<?php echo app('translator')->get('messages.matters_important'); ?>
								</th>
								<th>
									<?php echo app('translator')->get('messages.matters_subject'); ?>
								</th>
								<th>
									<?php echo app('translator')->get('messages.matters_situation'); ?>
								</th>
								<th>
									<?php echo app('translator')->get('messages.response_user'); ?>
								</th>
								<th>
									<?php echo app('translator')->get('messages.status'); ?>
								</th>
								<th style="width:8%">
									 <?php echo app('translator')->get('messages.action'); ?>
								</th>
							</tr>
							</thead>
							<tbody>
							<?php foreach($matters_assigneds as $one): ?>
							<tr class="odd gradeX">
								<td>
									<input type="checkbox" class="checkboxes" value="<?php echo e($one->id); ?>"/>
								</td>
								<td>
									<?php echo e($one->time_report); ?>

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

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

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

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

								</td>
								<td>
									<?php echo e($one->user_name); ?>(<?php echo e($one->user_username); ?>)
								</td>
								<td>
									<?php if($one->status == '0'): ?>
									<span class="label label-sm label-warning"> <?php echo app('translator')->get('messages.not_process'); ?> </span>
									<?php elseif($one->status == '1'): ?>
									<span class="label label-sm label-success"> <?php echo app('translator')->get('messages.in_process'); ?> </span>
									<?php elseif($one->status == '2'): ?>
									<span class="label label-sm label-success"> <?php echo app('translator')->get('messages.processed'); ?> </span>
									<?php endif; ?>
								</td>
								<td>
									<div class="btn-group">
										<button class="btn btn-default btn-xs dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false">
										<?php echo app('translator')->get('messages.action'); ?> <i class="fa fa-angle-down"></i>
										</button>
										<ul class="dropdown-menu pull-right" role="menu">
											<li>
												<a href="<?php echo e(action('Manage\Interactive\MattersAssignedController@edit',['id' => $one->id])); ?>">
												<i class="fa fa-pencil"></i>
												<?php echo app('translator')->get('messages.edit'); ?> </a>
											</li>
											<li>
												<a href="<?php echo e(action('Manage\Interactive\MattersAssignedController@show',['id' => $one->id])); ?>">
												<i class="fa fa-pencil"></i>
												<?php echo app('translator')->get('messages.detail_data'); ?> </a>
											</li>
											<li class="divider">
											</li>
											<li>
												<a class="btn_delete_matters_assigned" url="<?php echo e(action('Manage\Interactive\MattersAssignedController@destroy',['id' => $one->id])); ?>" href="javascript:;">
												<i class="fa fa-trash-o"></i>
												<?php echo app('translator')->get('messages.del'); ?> </a>
											</li>
										</ul>
									</div>
								</td>
							</tr>
							<?php endforeach; ?>
							</tbody>
							</table>
						</div>
					</div>
					<!-- END EXAMPLE TABLE PORTLET-->
				</div>
			</div>
		</div>

	<input type="hidden" id="_token" name="_token" value="<?php echo e(csrf_token()); ?>">

<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"><?php echo app('translator')->get('messages.item_manage'); ?></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"><?php echo app('translator')->get('messages.matters_item'); ?></label>
                            <div class="col-md-9">
                                <input name="matters_item" class="tagsinput" type="text" value="<?php echo e($matters_items->tags); ?>" data-role="tagsinput"> 
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-3"><?php echo app('translator')->get('messages.matters_important'); ?></label>
                            <div class="col-md-9">
                                <input name="matters_important" class="tagsinput" type="text" value="<?php echo e($matters_importants->tags); ?>" data-role="tagsinput"> 
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-3"><?php echo app('translator')->get('messages.matters_subject'); ?></label>
                            <div class="col-md-9">
                                <input name="matters_subject" class="tagsinput" type="text" value="<?php echo e($matters_subjects->tags); ?>" data-role="tagsinput"> 
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-3"><?php echo app('translator')->get('messages.matters_situation'); ?></label>
                            <div class="col-md-9">
                                <input name="matters_situation" class="tagsinput" type="text" value="<?php echo e($matters_situations->tags); ?>" data-role="tagsinput"> 
                            </div>
                        </div>
						<input type="hidden" id="type" name="type" value="matters_assigned">
                        <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> <?php echo app('translator')->get('messages.save'); ?></button>
                                <button type="button" class="btn default" data-dismiss="modal"><?php echo app('translator')->get('messages.close'); ?></button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</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>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('js_page_level'); ?>
<script>
$(document).ready(function(){
	$('.tagsinput').tagsinput();

	$('#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": "<?php echo app('translator')->get('messages.datatable_no_data'); ?>",
		    "info": "<?php echo app('translator')->get('messages.display_from'); ?> _START_ <?php echo app('translator')->get('messages.display_to'); ?> _END_ <?php echo app('translator')->get('messages.then_total'); ?> _TOTAL_ <?php echo app('translator')->get('messages.records'); ?>",
		    "infoEmpty": "<?php echo app('translator')->get('messages.no_match'); ?>",
		    "infoFiltered": "(<?php echo app('translator')->get('messages.from'); ?> _MAX_ <?php echo app('translator')->get('messages.records_filter'); ?>)",
		    "lengthMenu": "<?php echo app('translator')->get('messages.show'); ?> _MENU_ <?php echo app('translator')->get('messages.records'); ?>",
		    "search": "<?php echo app('translator')->get('messages.quick_filter'); ?>:",
		    "zeroRecords": "<?php echo app('translator')->get('messages.no_data'); ?>",
		    "paginate": {
		        "previous":"<?php echo app('translator')->get('messages.last_page'); ?>",
		        "next": "<?php echo app('translator')->get('messages.next_page'); ?>",
		        "last": "<?php echo app('translator')->get('messages.lastest'); ?>",
		        "first": "<?php echo app('translator')->get('messages.most_previous'); ?>"
		    }
		},

		"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]
		}]
	});

	$('#table_list').find('.group-checkable').change(function () {
        var set = jQuery(this).attr("data-set");
        var checked = jQuery(this).is(":checked");
        jQuery(set).each(function () {
            if (checked) {
                $(this).attr("checked", true);
            } else {
                $(this).attr("checked", false);
            }
        });
        jQuery.uniform.update(set);
    });

    $(document).on('change','#table_list .checkboxes',function(){
    	var checkedNum = $('.checkboxes:checked').length;
		if(checkedNum>0){
			$('#btn_mass_delete').show();
		}else{
			$('#btn_mass_delete').hide();
		}
	});
	$(document).on('change','.group-checkable',function(){
		var checkedNum = $('.checkboxes:checked').length;
		if(checkedNum>0){
			$('#btn_mass_delete').show();
		}else{
			$('#btn_mass_delete').hide();
		}
	});

	$(document).on('click','#btn_mass_delete',function(){
		var ids = $.map($('input:checkbox:checked'), function(n, i){
		      return n.value;
		}).join(',');
		bootbox.confirm("<?php echo app('translator')->get('messages.sure_del'); ?>?", function(result) {
			if(result == true){
				$.ajax({
					type : 'DELETE',
					dataType : 'json',
					url  : "<?php echo e(action('Manage\Interactive\MattersAssignedController@destroy' , ['id'=>''])); ?>"+'/'+ids,
					data : {
						_token   : $('#_token').val()
					},
					success : function(sendback){
						toastr['success']('<?php echo app('translator')->get('messages.del_success'); ?>');
						window.location.reload();
					},
					error : function(sendback){
						toastr['error']('<?php echo app('translator')->get('messages.del_fail'); ?>');
					}
				});
			}
		});
	});

	$(document).on('click','.btn_delete_matters_assigned',function(){
		var url = $(this).attr('url');
		bootbox.confirm("<?php echo app('translator')->get('messages.sure_del_error_reply'); ?>?", function(result) {
			if(result == true){
				$.ajax({
					type : 'DELETE',
					dataType : 'json',
					url  : url,
					data : {
						_token   : $('#_token').val(),
					},
					success : function(sendback){
						window.location.reload();
					},
					error : function(sendback){
						toastr['error']('<?php echo app('translator')->get('messages.del_fail'); ?>');
					}
				})
			}
		}); 
	});

});

$(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('Manage\Interactive\MattersAssignedController@updateType')); ?>',
		data : $('#form_type').serialize(),
		success : function(sendback){
			toastr['success']('<?php echo app('translator')->get('messages.update_success'); ?>');
		},
		error : function(sendback){
			toastr['error']('<?php echo app('translator')->get('messages.update_fail_pls_retry'); ?>');
		}
	})
});

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