added pengguna,kurir page, with socket.io,need to switch this to node.js first
This commit is contained in:
56
routes/user_ui/404.html
Normal file
56
routes/user_ui/404.html
Normal file
@ -0,0 +1,56 @@
|
||||
<!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>404 Halaman Tidak Ditemukan</title>
|
||||
<link rel="stylesheet" href="/styles/style.min.css">
|
||||
|
||||
<!-- Waves Effect -->
|
||||
<link rel="stylesheet" href="/plugin/waves/waves.min.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="page-404">
|
||||
<div class="content">
|
||||
<div class="title-on-desktop">
|
||||
<svg style="width: 600px; height: 200px" alignment-baseline="middle">
|
||||
<defs>
|
||||
<clipPath id="clip2">
|
||||
<path d="M 0 0 L 600 0 L 600 80 L 0 80 L 0 0 L 0 125 L 600 125 L 600 200 L 0 200 Z" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<text x="300" y="190" style="width: 600px; height: 200px" text-anchor="middle" font-family="Lato" font-weight="700" font-size="250" fill="#505458" clip-path="url(#clip2)">4<tspan fill="#35b8e0">0</tspan>4</text>
|
||||
</svg>
|
||||
<div class="title">Halaman Tidak Ditemukan</div>
|
||||
</div>
|
||||
<h1 class="title-on-mobile">Error 404: Halaman Tidak Ditemukan</h1>
|
||||
<p>Kamu sepertinya salah ambil belokan. Jangan khawatir... itu terjadi pada yang terbaik. Kamu mungkin ingin memeriksa koneksi internetmu. Berikut tips kecil yang mungkin membantumu kembali ke jalur yang benar.</p>
|
||||
<a href="#" onclick="history.back(); return false;" class="btn btn-info">Kembali</a>
|
||||
|
||||
</div>
|
||||
</div><!--/#single-wrapper -->
|
||||
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="/script/html5shiv.min.js"></script>
|
||||
<script src="/script/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<!--
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="/scripts/jquery.min.js"></script>
|
||||
<script src="/scripts/modernizr.min.js"></script>
|
||||
<script src="/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="/plugin/nprogress/nprogress.js"></script>
|
||||
<script src="/plugin/waves/waves.min.js"></script>
|
||||
|
||||
<script src="/scripts/main.min.js"></script>
|
||||
</body>
|
||||
</html>
|
210
routes/user_ui/daftar.html
Normal file
210
routes/user_ui/daftar.html
Normal file
@ -0,0 +1,210 @@
|
||||
<!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>Pendaftaran Penguna</title>
|
||||
<link rel="stylesheet" href="/styles/style.min.css">
|
||||
|
||||
<!-- Waves Effect -->
|
||||
<link rel="stylesheet" href="/plugin/waves/waves.min.css">
|
||||
<!-- Toastr -->
|
||||
<link rel="stylesheet" href="/plugin/toastr/toastr.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="single-wrapper">
|
||||
<form action="#" class="frm-single">
|
||||
<div class="inside">
|
||||
<div class="title"><strong>Shenior</strong> Kurir</div>
|
||||
<!-- /.title -->
|
||||
<div class="frm-title">Pendaftaran Pengguna</div>
|
||||
<!-- /.frm-title -->
|
||||
<div class="frm-input"><input id="no_telpon" type="text" placeholder="No Telpon" class="frm-inp"
|
||||
oninput="numberOnly(this)" maxlength="13" minlength="11"><i class="fa fa-phone frm-ico"></i>
|
||||
</div>
|
||||
<!-- /.frm-input -->
|
||||
<div class="frm-input"><input id="nama" type="text" placeholder="Nama" class="frm-inp"><i
|
||||
class="fa fa-user frm-ico"></i></div>
|
||||
<!-- /.frm-input -->
|
||||
<div class="frm-input"><input id="password" type="password" placeholder="Password" class="frm-inp"><i
|
||||
class="fa fa-lock frm-ico"></i></div>
|
||||
<!-- /.frm-input -->
|
||||
<div class="frm-input"><input id="konfirmasi_password" type="password" placeholder="Konfirmasi Password"
|
||||
class="frm-inp"><i class="fa fa-lock frm-ico"></i></div>
|
||||
<!-- /.frm-input -->
|
||||
|
||||
<button type="button" class="frm-submit" onclick="daftar()">Mendaftar<i
|
||||
class="fa fa-arrow-circle-right"></i></button>
|
||||
<a href="/" class="a-link"><i class="fa fa-home"></i>Kembali Ke Halaman Utama.</a>
|
||||
|
||||
|
||||
|
||||
<div class="frm-footer">Arifuddin Naawi Amanah © 2025.</div>
|
||||
<!-- /.footer -->
|
||||
</div>
|
||||
<!-- .inside -->
|
||||
</form>
|
||||
<!-- /.frm-single -->
|
||||
</div><!--/#single-wrapper -->
|
||||
|
||||
<div class="modal fade" id="modal-otp" tabindex="-1" role="dialog" aria-labelledby="myModalLabel-2">
|
||||
<div class="modal-dialog modal-sm" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||
aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel-2">Kode OTP</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="modal-kurir-nama">Kode OTP</label>
|
||||
<input type="text" class="form-control" id="kode_otp" oninput="numberOnly(this)" maxlength="6"
|
||||
placeholder="Masukkan Kode OTP ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default btn-sm waves-effect waves-light"
|
||||
data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary btn-sm waves-effect waves-light" onclick="verifikasi()">Verifikasi</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="/script/html5shiv.min.js"></script>
|
||||
<script src="/script/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<!--
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="/scripts/jquery.min.js"></script>
|
||||
<script src="/scripts/modernizr.min.js"></script>
|
||||
<script src="/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="/plugin/nprogress/nprogress.js"></script>
|
||||
<script src="/plugin/waves/waves.min.js"></script>
|
||||
|
||||
<!-- Toastr -->
|
||||
<script src="/plugin/toastr/toastr.min.js"></script>
|
||||
|
||||
<script src="/block/jquery.blockUI.js"></script>
|
||||
|
||||
<script src="/scripts/main.min.js"></script>
|
||||
<script src="/my-js.js"></script>
|
||||
<script>
|
||||
function daftar() {
|
||||
const no_telpon = $("#no_telpon").val();
|
||||
const nama = $("#nama").val();
|
||||
const password = $("#password").val();
|
||||
const konfirmasi_password = $("#konfirmasi_password").val();
|
||||
|
||||
if (no_telpon === "" || nama === "" || password === "" || konfirmasi_password === "") {
|
||||
toastr.error("Form Harus Diisi Semua");
|
||||
return;
|
||||
}
|
||||
|
||||
// if (password.length < 8) {
|
||||
// toastr.error("Password Minimal 8 Karakter");
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (no_telpon.length < 11) {
|
||||
toastr.error("No Telpon Minimal 11 Karakter");
|
||||
return;
|
||||
}
|
||||
|
||||
if (password !== konfirmasi_password) {
|
||||
toastr.error("Password Tidak Sama");
|
||||
return;
|
||||
}
|
||||
|
||||
const data = {
|
||||
no_telpon,
|
||||
nama,
|
||||
password
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/daftar",
|
||||
type: "POST",
|
||||
data: JSON.stringify(data),
|
||||
contentType: "application/json",
|
||||
beforeSend: function () {
|
||||
// blockUI('Pendaftaran Sedang Diproses...');
|
||||
},
|
||||
success: function (response) {
|
||||
// buka modal
|
||||
$.unblockUI();
|
||||
toastr.info("Silahkan Lakukan Verifikasi OTP<br>Kode OTP Telah Terkirim Ke Whatsapp Nomor Telpon Anda");
|
||||
$('#modal-otp').modal('show');
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.log(xhr.responseJSON);
|
||||
toastr.error(xhr.responseJSON !== undefined ? xhr.responseJSON : "Terjadi Kesalahan Server");
|
||||
$.unblockUI();
|
||||
// $('#modal-otp').modal('show');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function verifikasi() {
|
||||
const no_telpon = $("#no_telpon").val();
|
||||
const kode_otp = $("#kode_otp").val();
|
||||
|
||||
if(kode_otp === "") {
|
||||
toastr.error("Kode OTP Harus Diisi");
|
||||
// point to input
|
||||
$("#kode_otp").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
const data = {
|
||||
no_telpon,
|
||||
kode_otp
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/verifikasi",
|
||||
type: "POST",
|
||||
data: JSON.stringify(data),
|
||||
contentType: "application/json",
|
||||
beforeSend: function () {
|
||||
// close modal
|
||||
$('#modal-otp').modal('hide');
|
||||
blockUI('Verifikasi Sedang Diproses...');
|
||||
|
||||
},
|
||||
success: function (response) {
|
||||
$.unblockUI();
|
||||
toastr.success("Verifikasi Berhasil<br>Silahkan Login");
|
||||
// 2 sec the to halaman login
|
||||
setTimeout(() => {
|
||||
window.location.href = "/login";
|
||||
}, 2500);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
toastr.error(xhr.responseJSON !== undefined ? xhr.responseJSON : "Terjadi Kesalahan Server");
|
||||
$.unblockUI();
|
||||
// 1 sec then show modal
|
||||
setTimeout(() => {
|
||||
$('#modal-otp').modal('show');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
235
routes/user_ui/index.html
Normal file
235
routes/user_ui/index.html
Normal file
@ -0,0 +1,235 @@
|
||||
<!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>Shenior Kurir | Halaman Utama</title>
|
||||
|
||||
<!-- Main Styles -->
|
||||
<link rel="stylesheet" href="/styles/style.min.css">
|
||||
|
||||
<!-- mCustomScrollbar -->
|
||||
<link rel="stylesheet" href="/plugin/mCustomScrollbar/jquery.mCustomScrollbar.min.css">
|
||||
|
||||
<!-- Waves Effect -->
|
||||
<link rel="stylesheet" href="/plugin/waves/waves.min.css">
|
||||
|
||||
<!-- Sweet Alert -->
|
||||
<link rel="stylesheet" href="/plugin/sweet-alert/sweetalert.css">
|
||||
|
||||
<link rel="stylesheet" href="/fonts/fontello/fontello.css">
|
||||
|
||||
<link rel="stylesheet" href="/fonts/material-design-iconic-font/css/material-design-iconic-font.min.css">
|
||||
<link rel="stylesheet" href="/fonts/material-design/css/materialdesignicons.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main-menu">
|
||||
<header class="header">
|
||||
<a href="/admin" class="logo">Shenior Kurir</a>
|
||||
<button type="button" class="button-close fa fa-times js__menu_close"></button>
|
||||
<div class="user">
|
||||
<a href="#" class="avatar"><img src="/images/person.png" alt=""><span class="status online"></span></a>
|
||||
<h5 class="name"><a href="#">Visitor</a></h5>
|
||||
<h5 class="position">Belum Login</h5>
|
||||
|
||||
</div>
|
||||
<!-- /.user -->
|
||||
</header>
|
||||
<!-- /.header -->
|
||||
<div class="content">
|
||||
|
||||
<div class="navigation">
|
||||
<h5 class="title">Navigasi</h5>
|
||||
<!-- /.title -->
|
||||
<ul class="menu js__accordion">
|
||||
<li class="current active">
|
||||
<a class="waves-effect" href="/"><i class="menu-icon fa fa-home"></i><span>Halaman
|
||||
Utama</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
<a class="waves-effect" href="/login"><i
|
||||
class="menu-icon ico icon-login"></i><span>Login</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<!-- /.navigation -->
|
||||
</div>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.main-menu -->
|
||||
|
||||
<div class="fixed-navbar">
|
||||
<div class="pull-left">
|
||||
<button type="button"
|
||||
class="menu-mobile-button glyphicon glyphicon-menu-hamburger js__menu_mobile"></button>
|
||||
<h1 class="page-title">Halaman Utama</h1>
|
||||
<!-- /.page-title -->
|
||||
</div>
|
||||
<!-- /.pull-left -->
|
||||
<div class="pull-right">
|
||||
|
||||
|
||||
<a href="/login" class="ico-item ico icon-login"></a>
|
||||
</div>
|
||||
<!-- /.pull-right -->
|
||||
</div>
|
||||
<!-- /.fixed-navbar -->
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<img src="/images/habibie.jpg" alt="" style="width: 100%; border-radius: 30px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4 col-md-4 col-xs-12">
|
||||
<div class="box-content">
|
||||
<h4 class="box-title">Jumlah Kurir</h4>
|
||||
<!-- /.box-title -->
|
||||
|
||||
<!-- /.dropdown js__dropdown -->
|
||||
<div class="content">
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-6">
|
||||
<img src="/images/kurir.png" alt="" style="width: 100%;">
|
||||
|
||||
</div>
|
||||
<!-- show this icon ico icon-users-1 -->
|
||||
|
||||
<div class="col-xs-6">
|
||||
<div class="right-content">
|
||||
<h2 class="guru-counter"></h2>
|
||||
<!-- /.counter -->
|
||||
<p class="text">Orang</p>
|
||||
<!-- /.text -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.right-content -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-xs-12">
|
||||
<div class="box-content">
|
||||
<h4 class="box-title">Jumlah User</h4>
|
||||
<!-- /.box-title -->
|
||||
|
||||
<!-- /.dropdown js__dropdown -->
|
||||
<div class="content">
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-6">
|
||||
<img src="/images/kiriman.png" alt="" style="width: 100%;">
|
||||
</div>
|
||||
<!-- show this icon ico icon-users-1 -->
|
||||
|
||||
<div class="col-xs-6">
|
||||
<div class="right-content">
|
||||
<h2 class="murid-counter"></h2>
|
||||
<!-- /.counter -->
|
||||
<p class="text">Orang</p>
|
||||
<!-- /.text -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.right-content -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-xs-12">
|
||||
<div class="box-content">
|
||||
<h4 class="box-title">Jumlah Kiriman</h4>
|
||||
<!-- /.box-title -->
|
||||
|
||||
<!-- /.dropdown js__dropdown -->
|
||||
<div class="content">
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-6">
|
||||
<img src="/images/kiriman2.png" alt="" style="width: 100%;">
|
||||
</div>
|
||||
<!-- show this icon ico icon-users-1 -->
|
||||
|
||||
<div class="col-xs-6">
|
||||
<div class="right-content">
|
||||
<h2 class="staf-counter"></h2>
|
||||
<!-- /.counter -->
|
||||
<p class="text">Orang</p>
|
||||
<!-- /.text -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.right-content -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
</div>
|
||||
<footer class="footer">
|
||||
<ul class="list-inline">
|
||||
<li>Arifuddin Naawi Amanah © 2025.</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="/script/html5shiv.min.js"></script>
|
||||
<script src="/script/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<!--
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="/scripts/jquery.min.js"></script>
|
||||
<script src="/scripts/modernizr.min.js"></script>
|
||||
<script src="/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="/plugin/mCustomScrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
|
||||
<script src="/plugin/nprogress/nprogress.js"></script>
|
||||
<script src="/plugin/sweet-alert/sweetalert.min.js"></script>
|
||||
<script src="/plugin/waves/waves.min.js"></script>
|
||||
<!-- Full Screen Plugin -->
|
||||
<script src="/plugin/fullscreen/jquery.fullscreen-min.js"></script>
|
||||
|
||||
<script src="/scripts/main.min.js"></script>
|
||||
<script src="/my-js.js"></script>
|
||||
<script src="/socket-io/client-dist/socket.io.js"></script>
|
||||
<script>
|
||||
console.log('hello');
|
||||
const socket = io(); // Connects to your server
|
||||
|
||||
socket.emit('scan_dia', 'Hello from client!');
|
||||
|
||||
socket.on('connect', () => {
|
||||
console.log('Connected to server:', socket.id);
|
||||
});
|
||||
|
||||
socket.on('scan_dia_lagi', (data) => {
|
||||
alert(data);
|
||||
console.log('Received scan_dia_lagi event:', data); // ✅ Make sure you're logging the variable
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
105
routes/user_ui/login.html
Normal file
105
routes/user_ui/login.html
Normal file
@ -0,0 +1,105 @@
|
||||
<!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>Halaman Login Pengguna</title>
|
||||
<link rel="stylesheet" href="/styles/style.min.css">
|
||||
|
||||
<!-- Waves Effect -->
|
||||
<link rel="stylesheet" href="/plugin/waves/waves.min.css">
|
||||
|
||||
<!-- Toastr -->
|
||||
<link rel="stylesheet" href="/plugin/toastr/toastr.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="single-wrapper">
|
||||
<form action="#" class="frm-single">
|
||||
<div class="inside">
|
||||
<div class="title"><strong>Shenior</strong> Kurir</div>
|
||||
<!-- /.title -->
|
||||
<div class="frm-title">Login Pengguna</div>
|
||||
<!-- /.frm-title -->
|
||||
<div class="frm-input"><input type="text" id="username" placeholder="No Telpon" class="frm-inp"><i class="fa fa-user frm-ico"></i></div>
|
||||
<!-- /.frm-input -->
|
||||
<div class="frm-input"><input type="password" id="password" placeholder="Password" class="frm-inp"><i class="fa fa-lock frm-ico"></i></div>
|
||||
<!-- /.frm-input -->
|
||||
|
||||
<button type="button" class="frm-submit" onclick="login()">Login<i class="fa fa-arrow-circle-right"></i></button>
|
||||
|
||||
<a href="/daftar" class="a-link"><i class="fa fa-user-plus"></i>Belum Menjadi Pengguna? Mendaftar.</a>
|
||||
<br><br>
|
||||
<a href="/kurir/login" class="a-link"><i class="fa fa-motorcycle"></i>Login Kurir.</a>
|
||||
|
||||
<div class="frm-footer">Arifuddin Naawi Amanah © 2025.</div>
|
||||
<!-- /.footer -->
|
||||
</div>
|
||||
<!-- .inside -->
|
||||
</form>
|
||||
<!-- /.frm-single -->
|
||||
</div><!--/#single-wrapper -->
|
||||
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="/script/html5shiv.min.js"></script>
|
||||
<script src="/script/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<!--
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<script src="/scripts/jquery.min.js"></script>
|
||||
<script src="/scripts/modernizr.min.js"></script>
|
||||
<script src="/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="/plugin/nprogress/nprogress.js"></script>
|
||||
<script src="/plugin/waves/waves.min.js"></script>
|
||||
|
||||
<!-- Toastr -->
|
||||
<script src="/plugin/toastr/toastr.min.js"></script>
|
||||
|
||||
<script src="/block/jquery.blockUI.js"></script>
|
||||
|
||||
<script src="/scripts/main.min.js"></script>
|
||||
<script src="/my-js.js"></script>
|
||||
<script>
|
||||
function login() {
|
||||
var username = $("#username").val();
|
||||
var password = $("#password").val();
|
||||
|
||||
$.ajax({
|
||||
url: "/login",
|
||||
type: "POST",
|
||||
data: {
|
||||
no_telpon: username,
|
||||
password: password
|
||||
},
|
||||
beforeSend: function () {
|
||||
blockUI('Login Sedang Diproses...');
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
$.unblockUI();
|
||||
toastr.success("Login Berhasil");
|
||||
// create local storage
|
||||
localStorage.setItem('user', JSON.stringify(data));
|
||||
localStorage.setItem('role', 'user');
|
||||
// 2 sec the to halaman login
|
||||
setTimeout(() => {
|
||||
window.location.href = "/user";
|
||||
}, 2500);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
$.unblockUI();
|
||||
toastr.error(xhr.responseJSON !== undefined ? xhr.responseJSON : "Terjadi Kesalahan Server");
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user