<?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-datepicker/css/bootstrap-datepicker3.min.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')); ?>"/>
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/global/plugins/bootstrap-select/1.12.2/bootstrap-select.min.css')); ?>"/>
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/global/plugins/bootstrap-select/bootstrap-select.min.css')); ?>"/>
<link href="<?php echo e(asset('assets/global/plugins/bootstrap-editable/bootstrap-editable/css/bootstrap-editable.css')); ?>" rel="stylesheet" type="text/css" media="screen"/>
<link href="<?php echo e(asset('assets/global/plugins/bootstrap-editable/inputs-ext/address/address.css')); ?>" rel="stylesheet" type="text/css" media="screen"/>
<?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>
			<?php $Setting = app('anlutro\LaravelSettings\SettingStore'); ?>
			</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="<?php echo e(route('manage::energy::index')); ?>"><?php echo app('translator')->get('messages.energy_setting'); ?></a>
					</li>
				</ul>
			</div>
			<!-- END PAGE HEADER-->
			<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>
							</div>
							<table class="table table-striped table-bordered table-hover" id="table_energy">
								<thead>
									<tr>
										<th>
											序
										</th>
										
										<th>
											年月
										</th>
<!--                                         <th>
                                            夏120度以下
                                        </th>
										<th>
											夏121-330度
										</th>
										<th>
											夏331-500度
										</th>
										<th>
											夏501-700度
										</th>
										<th>
											夏701-1000度
										</th>
										<th>
											夏1000度以上
										</th>
										<th>
                                            非120度以下
                                        </th>
										<th>
											非121-330度
										</th>
										<th>
											非331-500度
										</th>
										<th>
											非501-700度
										</th>
										<th>
											非701-1000度
										</th>
										<th>
											非1000度以上
										</th> -->
										<th>
                                            120度以下
                                        </th>
										<th>
											121-330度
										</th>
										<th>
											331-500度
										</th>
										<th>
											501-700度
										</th>
										<th>
											701-1000度
										</th>
										<th>
											1000度以上
										</th>
										<th>
											動作
										</th>
									</tr>
								</thead>
								<tbody>
									<tr class="odd gradeX">
									<?php foreach($energys as $energy): ?>
										<td>
											<input name="chk" class='chk_check' type="checkbox" value="<?php echo e($energy->date); ?>"><!-- ID  -->
										</td>
										
										<td>
											<?php echo e($energy->date); ?>

										</td>

										<?php foreach($energy as $one): ?>
											<td>
												<?php echo e($one->cost); ?>

											</td>
										<?php endforeach; ?>

										<td>
											<button class="btn btn-default btn-xs action" type="button" aria-expanded="false" date="<?php echo e($energy->date); ?>">
											<?php echo app('translator')->get('messages.action'); ?> <i class="fa fa-angle-down"></i>
											</button>
										</td>

									</tr>
									<?php endforeach; ?>
								</tbody>
							</table>
						</div>
					</div>
					<!-- END EXAMPLE TABLE PORTLET-->
				</div>
			</div>
	    </div>
	</div>
	<div class="modal fade draggable-modal" id="modal_query" tabindex="-1" role="basic" aria-hidden="true">
	    <div class="modal-dialog modal-lg" style="width: 80%;">
	        <div class="modal-content " >
	            <div class="modal-header bg-blue-madison">
	                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
	                <h4 class="modal-title font-white">電費單價輸入</h4>
	            </div>
	            <table class="table table-striped table-bordered table-hover" id="table_energy">
									<thead>
										<tr>
											<th>
												年月日
											</th>
	                                        <th>
	                                            120度以下
	                                        </th>
											<th>
												121-330度
											</th>
											<th>
												331-500度
											</th>
											<th>
												501-700度
											</th>
											<th>
												701-1000度
											</th>
											<th>
												1000度以上
											</th>
										</tr>
									</thead>
									<tbody>
										<tr class="odd gradeX">
											<td>
												<label id="date"> </label>
											</td>
								            <td>
								            	<a href="javascript:;" id="edit1"> </a>
								            </td>
								            <td>
								            	<a href="javascript:;" id="edit2"> </a>
								            </td>
								            <td>
								            	<a href="javascript:;" id="edit3"> </a>
								            </td>
								            <td>
								            	<a href="javascript:;" id="edit4"> </a>
								            </td>
								            <td>
								            	<a href="javascript:;" id="edit5"> </a>
								            </td>
								            <td>
								            	<a href="javascript:;" id="edit6"> </a>
								            </td>
										</tr>
									</tbody>
								</table>

	            	<div class="modal-body">
	                    <div class="form-body">
	                    </div>
	            	</div>
		            <div class="modal-footer">
		            	<input type="hidden" id="_token" name="_token" value="<?php echo e(csrf_token()); ?>">
		            	<button id="session-timeout-dialog-keepalive" type="button" class="btn btn-primary" data-dismiss="modal" onClick="window.location.reload()"><?php echo app('translator')->get('messages.submit'); ?></button>
		            </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/jquery-validation/js/jquery.validate.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/jquery-validation/js/additional-methods.min.js')); ?>"></script>
<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-datepicker/js/bootstrap-datepicker.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.zh-TW.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/bootstrap-fileinput/additional-methods.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/select2/js/select2.min.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/bootstrap-select/1.12.2/bootstrap-select.min.js')); ?>"></script>

<!-- BEGIN X-EDITABLE PLUGIN-->
<script src="<?php echo e(asset('assets/global/plugins/bootstrap-editable/bootstrap-editable/js/bootstrap-editable.min.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/global/plugins/bootstrap-editable/inputs-ext/address/address.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/global/plugins/bootstrap-editable/inputs-ext/wysihtml5/wysihtml5.js')); ?>" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/bootstrap-fileinput/bootstrap-fileinput.js')); ?>"></script>
<!-- END X-EDITABLE PLUGIN-->
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js_page_level'); ?>
<script>
	$(document).ready(function(){

	$.ajax({
		type : 'post',
		url  : "<?php echo e(route('manage::energy::annualFees')); ?>",
		data : {
			_token:$('#_token').val(),
		},
		success: function(sendback){
			console.log(sendback);
		},
		error: function(){
			console.log("ff");
		}
	});
	var table = $('#table_energy');
    var oTable = table.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'); ?>"
            }
        },
        "aaSorting": [[0,'asc']],
        "lengthMenu": [
            [12, 24, 60, -1],
            [12, 24, 60, "All"] // change per page values here
        ],
        // set the initial value
        "pageLength": 12,            
        "pagingType": "bootstrap_full_number",
    });

    
	$.fn.editable.defaults.inputclass = 'form-control1';
    $.fn.editable.defaults.url = '<?php echo e(route("manage::energy::edit")); ?>';
    $.fn.editable.defaults.mode = 'inline';
  	$.fn.editable.defaults.params = function (params) {
	    params._token = $("#_token").val();
	    return params;
	};  



});

$(document).on('click','.action',function(){
	var date = $(this).attr('date');
	$.ajax({
		type : 'POST',
		url  : "<?php echo e(route('manage::energy::get')); ?>",
		dataType : 'json',
		data : {
			date     : date,
			_token : $('#_token').val(),
		},
		success: function(sendback){
			$("#date").text(sendback.date);
			$("#edit1").text(sendback.result[0].cost);
			$("#edit1").attr("data-pk",sendback.result[0].id);

			$("#edit2").text(sendback.result[1].cost);
			$("#edit2").attr("data-pk",sendback.result[1].id);

			$("#edit3").text(sendback.result[2].cost);
			$("#edit3").attr("data-pk",sendback.result[2].id);

			$("#edit4").text(sendback.result[3].cost);
			$("#edit4").attr("data-pk",sendback.result[3].id);

			$("#edit5").text(sendback.result[4].cost);
			$("#edit5").attr("data-pk",sendback.result[4].id);

			$("#edit6").text(sendback.result[5].cost);
			$("#edit6").attr("data-pk",sendback.result[5].id);

		    $("#edit1").editable();
		    $("#edit2").editable();
		    $("#edit3").editable();
		    $("#edit4").editable();
		    $("#edit5").editable();
		    $("#edit6").editable();

			$('#modal_query').modal('show');
		},
		error: function(){
			toastr['error']("<?php echo app('translator')->get('messages.error_need_refresh'); ?>");
		}
	});

	
});


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