Mini Shell
<!doctype html>
<html lang="en">
<!-- head -->
<?php include 'head.php'; ?>
<?php
include 'function_date.php';
?>
<body>
<div class="wrapper">
<!-- เมนูด้านซ้าย -->
<?php include 'leftside.php'; ?>
<div class="main-panel">
<!-- ส่วนหัว -->
<?php include 'header.php'; ?>
<div class="content">
<div class="container-fluid">
<div class="col-md-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="home.php">หน้าหลัก</a></li>
<li class="breadcrumb-item active" aria-current="page">ข้อมูลห้องเรียน</li>
</ol>
</nav>
<a href="addclass.php">
<button type="button" class="btn btn-primary"><i class="fad fa-plus-circle fa-lg"></i> เพิ่มห้องเรียน</button>
<?php
$year1=(date("Y")+543-1);
?>
</a>
<a href="import_class_room.php?year1=<?php echo$year1; ?>">
<button type="button" class="btn btn-primary"><i class="fad fa-plus-circle fa-upload"></i> นำเข้าข้อมูลจากปี <?php echo $year1; ?></button>
</a>
</ul>
</div>
</div>
<?php
$year = $s_year;
?>
<div class="card">
<div class="card-header card-header-icon" data-background-color="rose">
<i class="fad fa-users-class fa-2x"></i>
</div>
<h4 class="card-title">ห้องเรียนปีการศึกษา <?php echo $year; ?> </h4>
<div class="card-content">
<div class="material-datatables">
<button id="remove" class="btn btn-danger" disabled>
<i class="fal fa-trash-alt fa-lg"></i> ลบรายการ
</button>
<table id="table" data-toggle="table" data-locale="th-TH" data-url="class_json.php"
data-pagination = "true"
data-page-size="10"
data-page-list ="[5,10,15,ALL]"
data-search ="true"
data-show-refresh ="true"
data-show-toggle ="true"
data-show-columns ="true"
data-show-export="true"
data-toolbar="#remove"
data-toolbar="#toolbar"
data-id-field="class_id"
>
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-formatter="runningFormatter" data-align="center">ลำดับที่</th>
<th data-field="class_name" data-align="center" data-sortable="true">ห้อง</th>
<th data-field="lc_name" data-align="center" data-sortable="true">ชั้น</th>
<th data-field="course_name" data-align="center" data-sortable="true">หลักสูตร</th>
<th data-field="operate" data-align="center" data-events="operateEvents" data-formatter="operateFormatter">เครื่องมือ</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- footer1 -->
<?php include 'footer1.php'; ?>
</div>
</div>
<!-- footer2 -->
<?php include 'footer2.php'; ?>
<!-- Latest compiled and minified JavaScript -->
<script src="assets/js/jquery.datatables.js"></script>
<script>
var $table = $('#table'),
$remove = $('#remove');
$(function () {
$table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {
$remove.prop('disabled', !$table.bootstrapTable('getSelections').length);
});
$remove.click(function () {
$.smkConfirm({text: 'แน่ใจว่าต้องการลบข้อมูล ?', accept: 'ตกลง', cancel: 'ยกเลิก'}, function (e) {
if (e) {
var ids = $.map($table.bootstrapTable('getSelections'), function (row) {
return row.class_id;
});
//alert(ids);
//ajax delete
$.get("del_class.php", {"class_id[]": ids})
.done(function (data) {
if (data.status === "success") {
$.smkAlert({text: data.message, type: data.status});
} else {
$.smkAlert({text: data.message, type: data.status});
}
$table.bootstrapTable('refresh');
});
$remove.prop('disabled', true);
//uncheck
$table.bootstrapTable('togglePagination').bootstrapTable('uncheckAll').bootstrapTable('togglePagination');
}
});
});
});
function priceFormatter(value) {
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
;
}
function operateFormatter(value, row, index) {
return [
'<a href="javascript:void(0)" title="แก้ไขข้อมูล">',
'<i class="fad fa-money-check-edit fa-lg"></i>',
'</a> '
].join('');
}
window.operateEvents = {
'click .fa-money-check-edit': function (e, value, row, index) {
var class_id = [row.class_id];
//alert('You click like action, row: ' + row.prodID);
$(location).attr('href', 'frm_editclass.php?class_id='+class_id); //redirect to your url
}
};
//ลำดับ1,2,3
function runningFormatter(value, row, index) {
return 1+index;
}
</script>
<!-- Mirrored from demos.creative-tim.com/material-dashboard-pro/examples/dashboard.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 20 Mar 2017 21:32:16 GMT -->
</html>
Zerion Mini Shell 1.0