raspberry-pi-absensi/templates/tambah_karyawan.html

223 lines
6.6 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Sistem Absensi - Halaman Tambah Karyawan</title>
<!-- Main Styles -->
<link rel="stylesheet" href="assets/styles/style-horizontal.min.css">
<!-- mCustomScrollbar -->
<link rel="stylesheet" href="assets/plugin/mCustomScrollbar/jquery.mCustomScrollbar.min.css">
<!-- Waves Effect -->
<link rel="stylesheet" href="assets/plugin/waves/waves.min.css">
<!-- Sweet Alert -->
<link rel="stylesheet" href="assets/plugin/sweet-alert/sweetalert.css">
<!-- Color Picker -->
<link rel="stylesheet" href="assets/color-switcher/color-switcher.min.css">
<!-- Data Tables -->
<link rel="stylesheet" href="assets/plugin/datatables/media/css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="assets/plugin/datatables/extensions/Responsive/css/responsive.bootstrap.min.css">
</head>
<body>
<header class="fixed-header">
<div class="header-top">
<div class="container">
<div class="pull-left">
<a href="" class="logo">Sistem Absensi</a>
</div>
<!-- /.pull-left -->
<!-- /.pull-right -->
</div>
<!-- /.container -->
</div>
<!-- /.header-top -->
<!-- /.nav-horizontal -->
</header>
<!-- /.fixed-header -->
<div id="wrapper">
<div class="main-content container">
<div class="row small-spacing">
<div class="col-lg-4 col-md-4 col-xs-6">
<div class="box-content bg-success text-white" style="background :grey;cursor: pointer;"
onclick="goto('home')">
<h4 class="box-title">Halaman Utama</h4>
</div>
<!-- /.box-content -->
</div>
<div class="col-lg-4 col-md-4 col-xs-6">
<div class="box-content bg-info text-white" style="background :grey;cursor: pointer"
onclick="goto('tambah_karyawan')"">
<h4 class=" box-title">Tambah Data Karyawan</h4>
</div>
<!-- /.box-content -->
</div>
</div>
<!-- create a button on center of this -->
<div class="row small-spacing">
<div class="col-lg-4 col-md-4 col-xs-2"></div>
<div class="col-lg-4 col-md-4 col-xs-8">
<div class="box-content ">
<h4 class="box-title">Informasi Karyawan</h4>
<div class="card-content">
<form>
<div class="form-group">
<label for="nik">Nomor Induk Karyawan</label>
<input type="text" class="form-control" id="nik" name="nik"
placeholder="Masukkan Nomor Induk Karyawan">
</div>
<div class="form-group">
<label for="nik">Nama Karyawan</label>
<input type="text" class="form-control" id="nama" name="nama"
placeholder="Masukkan Nama Karyawan">
</div>
<div class="form-group text-center">
<button type="button" onclick="tambah_data()"
class="btn btn-primary btn-sm waves-effect waves-light">
Submit
</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-xs-2"></div>
</div>
<div class="row small-spacing">
<div class="col-xs-2 col-md-2"></div>
<div class="col-xs-8 col-md-8">
<div class="box-content card">
<h4 class="box-title">Jumlah Karyawan : {{length}} Orang</h4>
<div class="card-content">
<table id="example" class="table table-striped table-bordered display" style="width:100%">
<thead>
<tr>
<td><b>No</b></td>
<td><b>NIK</b></td>
<td><b>Nama</b></td>
</tr>
</thead>
<tbody>
{%if data %}
{% for i in range(0, length) %}
<tr>
<td>{{i+1}}</td>
<td>{{data[i]['nik']}}</td>
<td>{{data[i]['name']}}</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
</div>
</div>
</div>
<div class="col-xs-2 col-md-2"></div>
</div>
<footer class="footer">
<ul class="list-inline">
<li>2023 © Naufal.</li>
<!-- <li><a href="#">Privacy</a></li>
<li><a href="#">Terms</a></li>
<li><a href="#">Help</a></li> -->
</ul>
</footer>
</div>
<!-- /.main-content -->
</div><!--/#wrapper -->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="assets/script/html5shiv.min.js"></script>
<script src="assets/script/respond.min.js"></script>
<![endif]-->
<!--
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="assets/scripts/jquery.min.js"></script>
<script src="assets/scripts/modernizr.min.js"></script>
<script src="assets/plugin/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/plugin/mCustomScrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
<script src="assets/plugin/nprogress/nprogress.js"></script>
<script src="assets/plugin/sweet-alert/sweetalert.min.js"></script>
<script src="assets/plugin/waves/waves.min.js"></script>
<!-- Full Screen Plugin -->
<script src="assets/plugin/fullscreen/jquery.fullscreen-min.js"></script>
<!-- Data Tables -->
<script src="assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
<script src="assets/scripts/main.min.js"></script>
<script>
function goto(stat) {
if (stat == 'home') {
window.location.href = "{{url_for('home')}}";
} else if (stat == 'tambah_karyawan') {
window.location.href = "{{url_for('tambah_karyawan')}}";
}
}
function tambah_data() {
var nik = $('#nik').val();
var nama = $('#nama').val();
if (nik == '' || nama == '') {
swal({
title: "Gagal",
text: "Data tidak boleh kosong",
type: "error",
confirmButtonClass: "btn-danger",
confirmButtonText: "Ok",
closeOnConfirm: false
});
} else {
$.ajax({
url: "http://127.0.0.1:5000/tambah_karyawan",
type: "POST",
data: {
nik: nik,
nama: nama
},
success: function (data) {
// console.log(data)
window.location.href = "{{url_for('scan_face2')}}";
},
error: function (jqXhr, textStatus, errorThrown) {
console.log(errorThrown);
}
});
}
}
</script>
</body>
</html>