added pengguna,kurir page, with socket.io,need to switch this to node.js first
This commit is contained in:
@ -105,10 +105,11 @@ router.post('/kurir', async (req: Request, res: Response) => {
|
||||
|
||||
// Save to MongoDB
|
||||
const newKurir = new KurirModel({
|
||||
dd_motor,
|
||||
nama,
|
||||
no_telpon,
|
||||
password : no_telpon,
|
||||
nama,
|
||||
jenis_kelamin,
|
||||
dd_motor,
|
||||
gambar_kurir: `${no_telpon}_kurir_${random_5_char}.jpg`,
|
||||
gambar_motor: `${no_telpon}_motor_${random_5_char}.jpg`,
|
||||
});
|
||||
|
@ -25,6 +25,9 @@
|
||||
|
||||
<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">
|
||||
|
||||
<!-- Toastr -->
|
||||
<link rel="stylesheet" href="/plugin/toastr/toastr.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -214,8 +217,35 @@
|
||||
<!-- Full Screen Plugin -->
|
||||
<script src="/plugin/fullscreen/jquery.fullscreen-min.js"></script>
|
||||
|
||||
<!-- Toastr -->
|
||||
<script src="/plugin/toastr/toastr.min.js"></script>
|
||||
|
||||
<script src="/scripts/main.min.js"></script>
|
||||
<script src="/my-js.js"></script>
|
||||
<script src="/socketnya/client-dist/socket.io.js"></script>
|
||||
<script>
|
||||
const socket = io(); // Connects to your server
|
||||
|
||||
// function sendScanDia() {
|
||||
// const data = "Hello from client!";
|
||||
// socket.emit('scan_dia', data);
|
||||
// console.log('scan_dia sent:', data);
|
||||
// }
|
||||
|
||||
// sendScanDia();
|
||||
|
||||
socket.on('connect', () => {
|
||||
console.log('Connected to server:', socket.id);
|
||||
});
|
||||
|
||||
socket.on('pengiriman_baru1', (data) => {
|
||||
console.log('Received scan_dia event:', "data");
|
||||
toastr.info("Ada Pengiriman Baru Terdaftar");
|
||||
// console.log('Received scan_dia event:', data);
|
||||
// Do something with the received data
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -116,9 +116,13 @@
|
||||
<button type="button" class="btn btn-sm btn-info btn-rounded waves-effect waves-light"
|
||||
onclick="addKurirOpenModal()">Pendaftaran Kurir Baru</button>
|
||||
</div>
|
||||
<table id="tb-kurir" class="table table-striped table-bordered display" style="width:100%">
|
||||
<div class="form-group" style="overflow-x: auto;">
|
||||
<table id="tb-kurir" class="table table-striped table-bordered display"
|
||||
style="width:100%">
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -253,7 +257,8 @@
|
||||
// destroy table
|
||||
// $('#tb-kurir').DataTable().destroy();
|
||||
$('#tb-kurir').DataTable({
|
||||
responsive: true,
|
||||
// responsive: true,
|
||||
scrollX: true,
|
||||
// order: [
|
||||
// [0, 'asc']
|
||||
// ],
|
||||
@ -282,6 +287,13 @@
|
||||
return data
|
||||
}
|
||||
},
|
||||
{
|
||||
"mData": "status",
|
||||
"title": "Status",
|
||||
"render": function (data, type, row) {
|
||||
return data == null || data == "" || data == undefined ? "Tersedia" : data
|
||||
}
|
||||
},
|
||||
{
|
||||
"mData": null,
|
||||
"title": "Aksi",
|
||||
@ -443,7 +455,7 @@
|
||||
$("#btn-update-kurir").hide()
|
||||
$('#modal-kurir').modal('show')
|
||||
var img = document.createElement('img');
|
||||
img.src = 'kurir/gambar/' + data.no_telpon + '/'+ data.gambar_kurir;
|
||||
img.src = 'kurir/gambar/' + data.no_telpon + '/' + data.gambar_kurir;
|
||||
img.style.maxWidth = '100%'; // Make the image fit the width of the div
|
||||
img.style.maxHeight = '100%'; // Make the image fit the height of the div
|
||||
|
||||
@ -457,7 +469,7 @@
|
||||
previewDiv.appendChild(img);
|
||||
|
||||
var img = document.createElement('img');
|
||||
img.src = 'kurir/gambar/' + data.no_telpon + '/'+ data.gambar_motor;
|
||||
img.src = 'kurir/gambar/' + data.no_telpon + '/' + data.gambar_motor;
|
||||
img.style.maxWidth = '100%'; // Make the image fit the width of the div
|
||||
img.style.maxHeight = '100%'; // Make the image fit the height of the div
|
||||
|
||||
|
79
routes/kurir_router.ts
Normal file
79
routes/kurir_router.ts
Normal file
@ -0,0 +1,79 @@
|
||||
import express from 'express';
|
||||
import type { Request, Response } from 'express';
|
||||
import PendafaranBaruModel from '../models/pendaftaran_baru_model';
|
||||
import KurirModel from '../models/kurir_model';
|
||||
import type { UploadedFile } from 'express-fileupload';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
router.get('/', (req: Request, res: Response) => {
|
||||
res.sendFile(__dirname + '/kurir_ui/index.html');
|
||||
});
|
||||
|
||||
router.get('/login', (req: Request, res: Response) => {
|
||||
res.sendFile(__dirname + '/kurir_ui/login.html');
|
||||
});
|
||||
|
||||
router.post('/login', async (req: Request, res: Response) => {
|
||||
const { no_telpon, password } = req.body;
|
||||
|
||||
try {
|
||||
const user = await KurirModel.findOne({ no_telpon, password });
|
||||
if (user) {
|
||||
res.status(200).json(user);
|
||||
return;
|
||||
}
|
||||
res.status(400).json('Nomor Telpon atau Password Salah');
|
||||
return;
|
||||
} catch (error) {
|
||||
console.log("error di kurir login",error);
|
||||
res.status(500).json('Terjadi Kesalahan Server');
|
||||
return;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
router.get('/:jenis/:gambar', (req: Request, res: Response) => {
|
||||
const { jenis, gambar } = req.params;
|
||||
const imagePath = path.join(__dirname, `../images/${jenis}/${gambar}`);
|
||||
|
||||
if (fs.existsSync(imagePath)) {
|
||||
res.sendFile(imagePath);
|
||||
} else {
|
||||
res.status(404).send('Image not found');
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
router.post('/check', async (req: Request, res: Response) => {
|
||||
if (!req.body) {
|
||||
res.status(400).json('Bad Request');
|
||||
return;
|
||||
}
|
||||
const { _id, no_telpon, password, createdAt } = req.body;
|
||||
console.log(_id , no_telpon , password , createdAt);
|
||||
|
||||
// console.log(_id , no_telpon , password , createdAt);
|
||||
try {
|
||||
// check the user by _id , no_telpon , password , createdAt
|
||||
const user = await KurirModel.findOne({ _id, no_telpon, password, createdAt });
|
||||
if (!user) {
|
||||
res.status(400).json('User not found');
|
||||
return;
|
||||
}
|
||||
|
||||
res.status(200).json('Success');
|
||||
return;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
res.status(500).json('Terjadi Kesalahan Server');
|
||||
return
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
export default router;
|
306
routes/kurir_ui/index.html
Normal file
306
routes/kurir_ui/index.html
Normal file
@ -0,0 +1,306 @@
|
||||
<!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">
|
||||
<script src="/auth.js"></script>
|
||||
</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/admin.png" id="img-avatar" alt=""><span
|
||||
class="status online"></span></a>
|
||||
<h5 class="name"><a href="#" id="h5-title">...</a></h5>
|
||||
<h5 class="position">Kurir</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="/kurir"><i class="menu-icon fa fa-home"></i><span>Halaman
|
||||
Utama</span></a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="waves-effect" href="/kurir/penghantaran"><i
|
||||
class="menu-icon ico mdi mdi-motorbike"></i><span>Pengiriman Paket</span></a>
|
||||
</li>
|
||||
|
||||
<!-- <li>
|
||||
<a class="waves-effect" href="#" onclick="notAvailable()"><i
|
||||
class="menu-icon fa fa-users"></i><span>List User</span></a>
|
||||
</li> -->
|
||||
|
||||
<li>
|
||||
<a class="waves-effect" href="#" onclick="notAvailable()"><i
|
||||
class="menu-icon ico icon-table"></i><span>Log Penghantaran</span></a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="waves-effect" href="/kurir/profil"><i
|
||||
class="menu-icon fa fa-unlock-alt"></i><span>Ganti Password</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<a class="waves-effect" href="#" onclick="logout()"><i
|
||||
class="menu-icon ico icon-logout"></i><span>Logout</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="#" class="ico-item ico icon-logout" onclick="logout()"></a>
|
||||
</div>
|
||||
<!-- /.pull-right -->
|
||||
</div>
|
||||
<!-- /.fixed-navbar -->
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-xs-6">
|
||||
<div class="box-content">
|
||||
<h4 class="box-title">Jumlah Pengguna</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-6 col-md-6 col-xs-6">
|
||||
<div class="box-content">
|
||||
<h4 class="box-title">Jumlah Kiriman Dilakukan</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 class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<img src="/images/habibie.jpg" alt="" style="width: 100%; border-radius: 30px;">
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="row small-spacing">
|
||||
<div class="col-lg-2 col-md-2 col-xs-12"></div>
|
||||
<div class="col-lg-8 col-md-8 col-xs-12">
|
||||
<div class="box-content card white">
|
||||
<h4 class="box-title">Profil Kurir</h4>
|
||||
<form class="card-content" id="form-kurir">
|
||||
<div class="form-group">
|
||||
<!-- show the upload -->
|
||||
<div id="show-upload-gambar-kurir">
|
||||
<center>
|
||||
<div id="preview-gambar-kurir" style="height: 200px; width: 150px"></div>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group" id="form-gambar-kurir">
|
||||
<label for="modal-kurir-nama">Photo Kurir</label>
|
||||
<input type="file" class="form-control" id="gambar-kurir" accept="image/*"
|
||||
onchange="showUpload(this, 'gambar-kurir')">
|
||||
</div> -->
|
||||
|
||||
<div class="form-group">
|
||||
<label for="modal-kurir-nama">Nama</label>
|
||||
<input type="text" class="form-control" id="nama" placeholder="Masukkan Nama">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="modal-kurir-nama">Status</label>
|
||||
<input type="text" class="form-control" id="status" placeholder="Masukkan Status">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="modal-kurir-nama">No Telpon/HP</label>
|
||||
<input type="text" class="form-control" id="no_telpon" oninput="numberOnly(this)"
|
||||
maxlength="13" placeholder="Masukkan No Telpon/HP">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="modal-kurir-nama">Jenis Kelamin</label>
|
||||
<select class="form-control" id="jenis-kelamin">
|
||||
<option value="" disabled selected>-Pilih Jenis Kelamin</option>
|
||||
<option value="Laki-laki">Laki-laki</option>
|
||||
<option value="Perempuan">Perempuan</option>
|
||||
</select>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div id="show-upload-gambar-motor">
|
||||
<center>
|
||||
<div id="preview-gambar-motor" style="height: 200px; width: 150px"></div>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group" id="form-gambar-motor">
|
||||
<label for="modal-kurir-nama">Photo Motor</label>
|
||||
<input type="file" class="form-control" id="gambar-motor" accept="image/*"
|
||||
onchange="showUpload(this, 'gambar-motor')">
|
||||
</div> -->
|
||||
<div class="form-group">
|
||||
<label for="modal-kurir-dd-motor">DD Motor</label>
|
||||
<input type="text" class="form-control" id="dd-motor" placeholder="Masukkan DD Motor">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-xs-12"></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="/socketnya/client-dist/socket.io.js"></script>
|
||||
<script>
|
||||
const global_data = JSON.parse(localStorage.getItem('user'));
|
||||
console.log(global_data);
|
||||
|
||||
const form = document.querySelector('#form-kurir');
|
||||
form.querySelectorAll('input, select, textarea, button').forEach(el => {
|
||||
el.disabled = true;
|
||||
});
|
||||
|
||||
let img = document.createElement('img');
|
||||
img.src = 'kurir/motor/' + global_data.gambar_motor;
|
||||
img.width = 200;
|
||||
img.height = 200;
|
||||
document.getElementById('preview-gambar-motor').appendChild(img);
|
||||
let img2 = document.createElement('img');
|
||||
img2.src = 'kurir/kurir/' + global_data.gambar_kurir;
|
||||
img2.width = 200;
|
||||
img2.height = 200;
|
||||
document.getElementById('preview-gambar-kurir').appendChild(img2);
|
||||
|
||||
document.getElementById('h5-title').innerHTML = global_data.nama;
|
||||
|
||||
$("#nama").val(global_data.nama);
|
||||
$("#no_telpon").val(global_data.no_telpon);
|
||||
$("#status").val(global_data.status == null ? "Tersedia" : global_data.status);
|
||||
$("#jenis-kelamin").val(global_data.jenis_kelamin);
|
||||
$("#dd-motor").val(global_data.dd_motor);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
104
routes/kurir_ui/login.html
Normal file
104
routes/kurir_ui/login.html
Normal file
@ -0,0 +1,104 @@
|
||||
<!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 Kurir</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 Kurir</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="/" 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 -->
|
||||
|
||||
<!-- 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: "/kurir/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', 'kurir');
|
||||
// 2 sec the to halaman login
|
||||
setTimeout(() => {
|
||||
window.location.href = "/kurir";
|
||||
}, 2500);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
$.unblockUI();
|
||||
toastr.error(xhr.responseJSON !== undefined ? xhr.responseJSON : "Terjadi Kesalahan Server");
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
206
routes/user_after_login_ui/index.html
Normal file
206
routes/user_after_login_ui/index.html
Normal file
@ -0,0 +1,206 @@
|
||||
<!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">
|
||||
<script src="/auth.js"></script>
|
||||
</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="#" id="h5-title">...</a></h5>
|
||||
<h5 class="position">Pengguna</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="/user"><i class="menu-icon fa fa-home"></i><span>Halaman
|
||||
Utama</span></a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="waves-effect" href="/user/kirim-paket"><i class="menu-icon ico mdi mdi-motorbike"></i><span>Pengiriman Paket</span></a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="waves-effect" href="#" onclick="notAvailable()"><i
|
||||
class="menu-icon ico icon-table"></i><span>History Pengiriman</span></a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="waves-effect" href="/user/profil" ><i
|
||||
class="menu-icon ico icon-user"></i><span>Profil Pengunna</span></a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="waves-effect" onclick="logout()" href="#"><i
|
||||
class="menu-icon ico icon-logout"></i><span>Logout</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="#" onclick="logout()" class="ico-item ico icon-logout" ></a>
|
||||
</div>
|
||||
<!-- /.pull-right -->
|
||||
</div>
|
||||
<!-- /.fixed-navbar -->
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row">
|
||||
|
||||
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-xs-6">
|
||||
<div class="box-content">
|
||||
<h4 class="box-title">Jumlah Kurir Tersedia</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-6 col-md-6 col-xs-6">
|
||||
<div class="box-content">
|
||||
<h4 class="box-title">Jumlah Paket Terkirim</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 class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<img src="/images/habibie.jpg" alt="" style="width: 100%; border-radius: 30px;">
|
||||
</div>
|
||||
</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>
|
||||
const global_data = JSON.parse(localStorage.getItem('user'));
|
||||
document.getElementById('h5-title').innerHTML = global_data.nama;
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
265
routes/user_after_login_ui/paket.html
Normal file
265
routes/user_after_login_ui/paket.html
Normal file
@ -0,0 +1,265 @@
|
||||
<!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 | Pengiriman Paket</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">
|
||||
|
||||
<link rel="stylesheet" href="/plugin/datatables/media/css/dataTables.bootstrap.min.css">
|
||||
|
||||
<!-- Toastr -->
|
||||
<link rel="stylesheet" href="/plugin/toastr/toastr.css">
|
||||
<script src="/auth.js"></script>
|
||||
</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="#" id="h5-title">...</a></h5>
|
||||
<h5 class="position">Pengguna</h5>
|
||||
|
||||
</div>
|
||||
<!-- /.user -->
|
||||
</header>
|
||||
<!-- /.header -->
|
||||
<div class="content">
|
||||
|
||||
<div class="navigation">
|
||||
<h5 class="title">Navigasi</h5>
|
||||
<!-- /.title -->
|
||||
<ul class="menu js__accordion">
|
||||
<li>
|
||||
<a class="waves-effect" href="/user"><i class="menu-icon fa fa-home"></i><span>Halaman
|
||||
Utama</span></a>
|
||||
</li>
|
||||
|
||||
<li class="current active">
|
||||
<a class="waves-effect" href="/user/kirim-paket"><i
|
||||
class="menu-icon ico mdi mdi-motorbike"></i><span>Pengiriman Paket</span></a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="waves-effect" href="#" onclick="notAvailable()"><i
|
||||
class="menu-icon ico icon-table"></i><span>History Pengiriman</span></a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="waves-effect" href="/user/profil"><i class="menu-icon ico icon-user"></i><span>Profil
|
||||
Pengunna</span></a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="waves-effect" onclick="logout()" href="#"><i
|
||||
class="menu-icon ico icon-logout"></i><span>Logout</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">Pengiriman Paket</h1>
|
||||
<!-- /.page-title -->
|
||||
</div>
|
||||
<!-- /.pull-left -->
|
||||
<div class="pull-right">
|
||||
|
||||
|
||||
<a href="#" class="ico-item ico icon-logout" onclick="logout()"></a>
|
||||
</div>
|
||||
<!-- /.pull-right -->
|
||||
</div>
|
||||
<!-- /.fixed-navbar -->
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">Form Kurir</h4>
|
||||
<!-- /.box-title -->
|
||||
<div class="card-content">
|
||||
<div class="form-group">
|
||||
<button type="button" class="btn btn-sm btn-info btn-rounded waves-effect waves-light"
|
||||
onclick="addpaketOpenModal()">Pendaftaran Kurir Baru</button>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</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 -->
|
||||
|
||||
<div class="modal fade" id="modal-paket" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||
<div class="modal-dialog" 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="modal-paket-title">Modal title</h4>
|
||||
</div>
|
||||
<form class="modal-body" id="form-modal">
|
||||
<div class="form-group">
|
||||
<!-- show the upload -->
|
||||
<div id="show-upload-gambar-kurir" style="display: none">
|
||||
<center>
|
||||
<div id="preview-gambar-kurir" style="height: 200px; width: 150px"></div>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="form-gambar-kurir">
|
||||
<!-- create upload -->
|
||||
<label for="modal-kurir-nama">Photo Kurir</label>
|
||||
<input type="file" class="form-control" id="gambar-kurir" accept="image/*"
|
||||
onchange="showUpload(this, 'gambar-kurir')">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="modal-kurir-no-telpon">No Telpon/HP Yang Dihubungi</label>
|
||||
<input type="text" class="form-control" id="no_telpon" oninput="numberOnly(this)" maxlength="13"
|
||||
placeholder="Masukkan No Telpon/HP Yang Dihubungi">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="modal-kurir-alamat">Alamat Pengiriman</label>
|
||||
<textarea name="alamat" class="form-control" id="alamat"
|
||||
placeholder="Masukkan Alamat"></textarea>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
</form>
|
||||
<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" id="btn-pengiriman"
|
||||
onclick="tambahpengiriman()">Lakukan Pengiriman</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/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="/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script src="/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||
<script src="/plugin/datatables/extensions/Responsive/js/dataTables.responsive.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 src="/socket-io/client-dist/socket.io.js"></script>
|
||||
<script>
|
||||
const socket = io(); // Connects to your server
|
||||
|
||||
|
||||
socket.on('connect', () => {
|
||||
console.log('Connected to server:', socket.id);
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<script>
|
||||
const global_data = JSON.parse(localStorage.getItem('user'));
|
||||
document.getElementById('h5-title').innerHTML = global_data.nama;
|
||||
</script>
|
||||
<script>
|
||||
function addpaketOpenModal() {
|
||||
$('#modal-paket-title').html('Form Pengiriman Paket Baru');
|
||||
$('#modal-paket').modal('show');
|
||||
}
|
||||
function tambahpengiriman() {
|
||||
$.ajax({
|
||||
url: '/user/kirim-paket/',
|
||||
type: 'POST',
|
||||
data: {},
|
||||
beforeSend: function () {
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
// This triggers the event
|
||||
socket.emit('scan_dia_lagi', 'hello from paket.html');
|
||||
$('#modal-paket').modal('hide');
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
158
routes/user_router.ts
Normal file
158
routes/user_router.ts
Normal file
@ -0,0 +1,158 @@
|
||||
import express from 'express';
|
||||
import type { Request, Response } from 'express';
|
||||
import PendafaranBaruModel from '../models/pendaftaran_baru_model';
|
||||
import UserModel from '../models/user_model';
|
||||
import type { UploadedFile } from 'express-fileupload';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import axios from 'axios';
|
||||
|
||||
const router = express.Router();
|
||||
import * as socket from '../socket';
|
||||
const socket_client = socket.clientSocket;
|
||||
|
||||
router.get('/', (req: Request, res: Response) => {
|
||||
// socket_client.emit('scan_dia', 'test');
|
||||
res.sendFile(__dirname + '/user_ui/index.html');
|
||||
});
|
||||
|
||||
// router.get('/coba', async (req: Request, res: Response) => {
|
||||
// res.status(200).json('success');
|
||||
// })
|
||||
|
||||
router.get('/login', (req: Request, res: Response) => {
|
||||
res.sendFile(__dirname + '/user_ui/login.html');
|
||||
})
|
||||
|
||||
router.post('/login', async (req: Request, res: Response) => {
|
||||
const { no_telpon, password } = req.body;
|
||||
const user = await UserModel.findOne({ no_telpon, password });
|
||||
if (user) {
|
||||
console.log(user);
|
||||
res.status(200).json(user);
|
||||
return;
|
||||
}
|
||||
res.status(400).json('Nomor Telpon atau Password Salah');
|
||||
})
|
||||
|
||||
router.get('/daftar', (req: Request, res: Response) => {
|
||||
res.sendFile(__dirname + '/user_ui/daftar.html');
|
||||
})
|
||||
|
||||
router.post('/daftar', async (req: Request, res: Response) => {
|
||||
const { no_telpon, nama, password } = req.body;
|
||||
// check the user
|
||||
const user = await UserModel.findOne({ no_telpon });
|
||||
if (user) {
|
||||
res.status(400).json('Nomor Telpon sudah terdaftar');
|
||||
return;
|
||||
}
|
||||
|
||||
// check the pendaftaran baru
|
||||
const pencarian_data = await PendafaranBaruModel.findOne({ no_telpon });
|
||||
if (pencarian_data) {
|
||||
// delete the pendaftaran baru with no_telpon
|
||||
await PendafaranBaruModel.deleteOne({ no_telpon });
|
||||
}
|
||||
|
||||
const otp = Math.floor(Math.random() * 1000000);
|
||||
// create pendaftaran baru
|
||||
|
||||
|
||||
// create a 6 otp random otp code
|
||||
|
||||
try {
|
||||
const response = await axios.post('http://localhost:3012/send-otp', { number: no_telpon, otp });
|
||||
const pendaftaran_baru = new PendafaranBaruModel({ no_telpon, nama, password, otp });
|
||||
await pendaftaran_baru.save();
|
||||
res.status(200).json('success');
|
||||
return;
|
||||
} catch (error: any) {
|
||||
// console.log(error);
|
||||
res.status(error.response.status).json(error.response.data);
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
// res.status(400).json('error dari backend');
|
||||
});
|
||||
|
||||
router.post('/verifikasi', async (req: Request, res: Response) => {
|
||||
const { no_telpon, kode_otp } = req.body;
|
||||
const pencarian_data = await PendafaranBaruModel.findOne({ no_telpon });
|
||||
if (!pencarian_data) {
|
||||
res.status(400).json('Nomor Telpon tidak ditemukan');
|
||||
return;
|
||||
}
|
||||
|
||||
if (pencarian_data.otp == kode_otp) {
|
||||
const user = new UserModel({ no_telpon, nama: pencarian_data.nama, password: pencarian_data.password });
|
||||
await user.save();
|
||||
await PendafaranBaruModel.deleteOne({ no_telpon });
|
||||
res.status(200).json('success');
|
||||
return;
|
||||
}
|
||||
res.status(400).json('Kode OTP Salah');
|
||||
return
|
||||
})
|
||||
|
||||
|
||||
router.get('/user', (req: Request, res: Response) => {
|
||||
res.sendFile(__dirname + '/user_after_login_ui/index.html');
|
||||
})
|
||||
|
||||
|
||||
router.get('/user/kirim-paket', async (req: Request, res: Response) => {
|
||||
res.sendFile(__dirname + '/user_after_login_ui/paket.html');
|
||||
})
|
||||
|
||||
router.post('/user/kirim-paket', async (req: Request, res: Response) => {
|
||||
console.log("kirim paket");
|
||||
socket_client.emit('scan_dia', 'ini dari kirim-paket');
|
||||
res.status(200).json("ini")
|
||||
})
|
||||
|
||||
router.get('/user/kirim-paket1', async (req: Request, res: Response) => {
|
||||
console.log("kirim paket");
|
||||
socket_client.emit('scan_dia', 'ini dari kirim-paket');
|
||||
res.status(200).json("ini")
|
||||
})
|
||||
|
||||
|
||||
router.post('/user/check', async (req: Request, res: Response) => {
|
||||
if (!req.body) {
|
||||
res.status(400).json('Bad Request');
|
||||
return;
|
||||
}
|
||||
const { _id, no_telpon, password, createdAt } = req.body;
|
||||
|
||||
// console.log(_id , no_telpon , password , createdAt);
|
||||
try {
|
||||
// check the user by _id , no_telpon , password , createdAt
|
||||
const user = await UserModel.findOne({ _id, no_telpon, password, createdAt });
|
||||
if (!user) {
|
||||
res.status(400).json('User not found');
|
||||
return;
|
||||
}
|
||||
|
||||
res.status(200).json('Success');
|
||||
return;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
res.status(500).json('Terjadi Kesalahan Server');
|
||||
return
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
// This should be the last route
|
||||
router.use((req: Request, res: Response) => {
|
||||
res.status(404).sendFile(__dirname + '/user_ui/404.html');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
export default router;
|
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