<?php echo $header; ?><?php echo $column_left; ?>
<div id="content">
	<div class="page-header">
		<div class="container-fluid">
			<h1><?php echo $heading_title; ?></h1>
			<ul class="breadcrumb">
				<?php foreach ($breadcrumbs as $breadcrumb) { ?>
					<li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
				<?php } ?>
			</ul>
		</div>
	</div>
	<div class="container-fluid">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title"><i class="fa fa-bar-chart"></i> <?php echo $heading_title; ?></h3>
			</div>
			<div class="panel-body">
				<form method="get" id="form-filter">
					<input type="hidden" name="route" value="<?= $route; ?>" />
					<input type="hidden" name="token" value="<?= $token; ?>" />
				<div class="well">
					<div class="row">
						<div class="col-sm-4">
							<div class="form-group">
								<label class="control-label" for="input-category"><?= $entry_category; ?></label>
								<select name="category" id="input-category" class="form-control">
									<?php foreach ($categories as $key => $value) {
										$selected = '';//($category === $key) ? 'selected="selected"' : '';
										echo "<option value={$key} {$selected}>{$value}</option>";
									} ?>
								</select>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="control-label" for="input-start_date"><?= $entry_start_date; ?></label>
								<div class="input-group date">
									<input type="text" name="start_date" value="<?= $start_date; ?>" placeholder="<?= $entry_start_date; ?>" data-date-format="YYYY-MM-DD" id="input-start_date" class="form-control" />
									<span class="input-group-btn">
										<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
									</span>
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="control-label" for="input-end_date"><?= $entry_end_date; ?></label>
								<div class="input-group date">
									<input type="text" name="end_date" value="<?= $end_date; ?>" placeholder="<?= $entry_end_date; ?>" data-date-format="YYYY-MM-DD" id="input-end_date" class="form-control" />
									<span class="input-group-btn">
										<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
									</span>
								</div>
							</div>
							<button type="submit" class="btn btn-primary pull-right"><i class="fa fa-filter"></i> <?= $button_filter; ?></button>
						</div>
					</div>
				</div>
				</form>
				<table id="example" class="display" width="100%" cellspacing="0">
					<thead>
						<tr>
							<th><?= $column_name ?></th>
							<th><?= $column_group ?></th>
							<th><?= $column_date ?></th>
							<th><?= $column_service ?></th>
							<th><?= $column_price ?></th>
							<th><?= $column_time ?></th>
							<th><?= $column_quantity ?></th>
							<th><?= $column_pay_free ?></th>
							<th><?= $column_pay_cod ?></th>
							<th><?= $column_pay_card ?></th>
							<th><?= $column_admin ?></th>
						</tr>
					</thead>
				</table>
			</div>
		</div>
	</div>

<script type="text/javascript">
	$('.date').datetimepicker({
		pickTime: false
	});
	
	$(document).ready(function () {
		$('#example').DataTable({
			dom: 'Bfrtip',
			buttons: [
				'excel',
				'pdf',
				'print'
			],
			ajax: {
				"url": "index.php",
				"data": {
					route:      "report/brech_spa/orders",
					token:      $('input[name="token"]').val(),
					category:   $('select[name="category"]').val(),
					start_date: $('input[name="start_date"]').val(),
					end_date:   $('input[name="end_date"]').val()
				}
			},
			columns: [
				{ "data": "client_name" },
				{ "data": "client_group" },
				{ "data": "date" },
				{ "data": "service" },
				{ "data": "price" },
				{ "data": "option_time" },
				{ "data": "quantity" },
				{ "data": "payment_free" },
				{ "data": "payment_cod" },
				{ "data": "payment_card" },
				{ "data": "admin" }
			]
		});
		
	});
</script></div>
<?php echo $footer; ?>