<?php 
	use App\Models\User; 
	use App\Models\Option; 
?>
@extends("backend/master")
@section('styles')
{!!HTML::style('backend/assets/css/theme-default/libs/DataTables/jquery.dataTables.css')!!}
{!!HTML::style('backend/assets/css/theme-default/libs/DataTables/extensions/dataTables.colVis.css')!!}
{!!HTML::style('backend/assets/css/theme-default/libs/DataTables/extensions/dataTables.tableTools.css')!!}
@stop
@section('maincontent')
	<!-- BEGIN CONTENT-->
	<div id="content">
		<section class="style-default-bright">
			<div class="section-header ">
				<ol class="breadcrumb">
					<li class="active">Home</li>
					<li class="active">All News Categories</li>
				</ol>
			</div>
			<div class="section-header">
				<div class="row">
					<div class="col-lg-6">
						<h2 class="text-primary">All News Categories</h2>
					</div>
					<div class="col-lg-6">
						{!! HTML::link("admin/news/category/add/get","Add New News Category",["class"=>"btn ink-reaction pull-right btn-primary"]) !!}
					</div>
				</div>
			</div>

			<div class="section-body">
				<div class="row">
					<div class="col-lg-12">
						<div class="table-responsive">
							<table id="myTable" class="table table-striped table-hover">
								<thead>
									<tr>
										<th>#</th>
										<th>Title</th>
										<th>Created By</th>
										<th>Created On</th>
										<th class="sort-numeric">Status</th>
										<th class="sort-alpha">Actions</th>
									</tr>
								</thead>
								<tbody>
									<?php $i = 1; ?>
									@foreach($categories as $category)
										<tr class="gradeX">
											<td>{!! $i !!}</td>
											<td>
												{!! $category->categoryName !!}
												<div class="newsCategoryModifyDiv" style="display:none">
													{!! Form::text("newsCategoryName", $category->categoryName,["class"=>"newsCategoryName","data-id"=>$category->id]) !!} <br>
													<button type="button" class="btn btn-xs ink-reaction btn-success postNewsCategoryName">Save</button>
													<button type="button" class="btn btn-xs ink-reaction btn-danger cancelNewsCategoryName">Cancel</button>
												</div>
											</td>
											<td>{!! ucwords($category->addedByName) !!}</td>
											<td>{!! date(Option::fetchDateFormat()." ".Option::fetchTimeFormat(),strtotime($category->created_at)) !!}</td>
											<?php
												$category->status == "active" ? $class = "success" : $class = "danger";
											?>
											<td><button type="button" class="btn ink-reaction btn-xs btn-{!! $class !!} newsCategoryStatus" data-id="{!! $category->id !!}">{!! ucfirst($category->status) !!}</button></td>
											<td>
												<a href="javascript:void(0)">
												<button type="button" class="btn btn-icon-toggle newsCategoryNameEdit" data-toggle="tooltip" data-placement="top" data-original-title="Modify Post Category Name" data-id="{!! $category->id !!}"><i class="fa fa-pencil"></i></button>
												</a>
												<button type="button" class="btn btn-icon-toggle newsCategoryDelete" data-toggle="tooltip" data-placement="top" data-original-title="Delete row" data-id="{!! $category->id !!}"><i class="fa fa-trash-o"></i></button>
											</td>
										</tr>
									<?php $i++; ?>
									@endforeach
								</tbody>
							</table>
						</div><!--end .table-responsive -->
					</div><!--end .col -->
				</div><!--end .row -->
				<!-- END DATATABLE 1 -->

			</div><!--end .section-body -->
		</section>
	</div><!--end #content-->
	<!-- END CONTENT -->
@stop

@section('script')
	{!!HTML::script('backend/assets/js/libs/DataTables/jquery.dataTables.min.js')!!}
	{!!HTML::script('backend/assets/js/libs/DataTables/extensions/ColVis/js/dataTables.colVis.min.js')!!}
	{!!HTML::script('backend/assets/js/libs/DataTables/extensions/TableTools/js/dataTables.tableTools.min.js')!!}
	{!!HTML::script('backend/assets/js/core/demo/DemoTableDynamic.js')!!}
	{!!HTML::script('backend/js/bala.js')!!}
	<script type="text/javascript">
	$(document).ready(function(){
    	$('#myTable').DataTable();
	});
	</script>
@stop