358 lines
11 KiB
HTML
358 lines
11 KiB
HTML
<!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 | Profil Pengguna</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">
|
|
|
|
|
|
|
|
<!-- 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" id="img-avatar" alt=""
|
|
style="width: 65px; height: 65px;"><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 ">
|
|
<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="/user/history" ><i
|
|
class="menu-icon ico icon-table"></i><span>History Pengiriman</span></a>
|
|
</li>
|
|
|
|
<li class="current active">
|
|
<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-lg-6 col-md-6 col-xs-12">
|
|
<div class="box-content card">
|
|
<h4 class="box-title">Profil Pengguna</h4>
|
|
<!-- /.box-title -->
|
|
<div id="form-profil" class="card-content">
|
|
<div class="form-group">
|
|
<!-- show the upload -->
|
|
<div id="show-upload-gambar-profil">
|
|
<center>
|
|
<div id="preview-gambar-profil" style="height: 150px; width: 150px">
|
|
<img id="img-gambar-profil" style="height: 150px; width: 150px">
|
|
</div>
|
|
</center>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group" id="form-gambar-profil" style="display: none">
|
|
<!-- create upload -->
|
|
<label for="photo-form">Photo Profil</label>
|
|
<input type="file" class="form-control" id="gambar-profil" accept="image/*"
|
|
onchange="showUpload(this, 'gambar-profil')">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="nama">Nama</label>
|
|
<input type="text" class="form-control" id="nama" placeholder="Masukkan Nama">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="no-telpon">No Telpon</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="alamat">Alamat </label>
|
|
<textarea name="alamat" class="form-control" id="alamat" placeholder="Masukkan Alamat"
|
|
style="resize: none"></textarea>
|
|
</div>
|
|
<div class="form-group text-center">
|
|
<button type="button" class="btn btn-info btn-xs" id="btn-edit-profil"
|
|
onclick="editprofil()">Edit
|
|
Profil?</button>
|
|
<button type="button" class="btn btn-primary btn-xs" id="btn-update-profil"
|
|
onclick="updateprofil()" style="display: none">Update Profil</button>
|
|
<button type="button" class="btn btn-default btn-xs" id="btn-cancel-profil"
|
|
onclick="cancelprofil()" style="display: none">Cancel</button>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
<!-- /.box-content -->
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
<div class="col-lg-6 col-md-6 col-xs-12">
|
|
<div class="box-content card">
|
|
<h4 class="box-title">Ganti Password</h4>
|
|
<!-- /.box-title -->
|
|
<div class="card-content">
|
|
|
|
|
|
<div class="form-group">
|
|
<label for="nama">Password Lama</label>
|
|
<input type="password" class="form-control" id="password_lama"
|
|
placeholder="Masukkan Password Lama">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="nama">Password Baru</label>
|
|
<input type="password" class="form-control" id="password_baru"
|
|
placeholder="Masukkan Password Baru">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="nama">Konfirmasi Password Baru</label>
|
|
<input type="password" class="form-control" id="konfirmasi_password_baru"
|
|
placeholder="Masukkan Konfirmasi Password Baru">
|
|
</div>
|
|
<div class="form-group text-center">
|
|
|
|
<button type="button" class="btn btn-primary btn-xs" id="btn-update-password"
|
|
onclick="notAvailable()">Update Password</button>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
<!-- /.box-content -->
|
|
</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>
|
|
|
|
|
|
<!-- 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>
|
|
const global_data = JSON.parse(localStorage.getItem('user'));
|
|
document.getElementById('h5-title').innerHTML = global_data.nama;
|
|
|
|
|
|
function editprofil() {
|
|
document.querySelectorAll('#form-profil input, #form-profil select, #form-profil textarea').forEach(el => {
|
|
el.disabled = false;
|
|
// disable no_telpon input
|
|
$("#no_telpon").attr("disabled", true);
|
|
});
|
|
|
|
$("#form-gambar-profil").show();
|
|
$("#btn-edit-profil").hide();
|
|
$("#btn-update-profil").show();
|
|
$("#btn-cancel-profil").show();
|
|
}
|
|
|
|
function cancelprofil() {
|
|
$("#nama").val(global_data.nama);
|
|
$("#no_telpon").val(global_data.no_telpon);
|
|
$("#alamat").val(global_data.alamat);
|
|
$("#img-gambar-profil").attr("src", global_data.gambar == null || global_data.gambar == "" ? "/images/person.png" : "/user/gambar/" + global_data._id + "/" + global_data.gambar);
|
|
$("#img-avatar").attr("src", global_data.gambar == null || global_data.gambar == "" ? "/images/person.png" : "/user/gambar/" + global_data._id + "/" + global_data.gambar);
|
|
document.querySelectorAll('#form-profil input, #form-profil select, #form-profil textarea').forEach(el => {
|
|
el.disabled = true;
|
|
$("#no_telpon").attr("disabled", true);
|
|
});
|
|
$("#form-gambar-profil").hide();
|
|
$("#btn-edit-profil").show();
|
|
$("#btn-update-profil").hide();
|
|
$("#btn-cancel-profil").hide();
|
|
}
|
|
cancelprofil();
|
|
|
|
function showUpload(element) {
|
|
var file = element.files[0];
|
|
|
|
if (file) {
|
|
var reader = new FileReader();
|
|
reader.onload = function (event) {
|
|
var imageUrl = event.target.result;
|
|
// put the image in id="img-gambar-profil" with height: 150px; width: 150px
|
|
$("#img-gambar-profil").attr("src", imageUrl);
|
|
// $("#img-gambar-profil").css("height", "150px");
|
|
// $("#img-gambar-profil").css("width", "150px");
|
|
}
|
|
reader.readAsDataURL(file);
|
|
}
|
|
}
|
|
|
|
function updateprofil() {
|
|
let form_data = new FormData();
|
|
form_data.append('id', global_data.id);
|
|
form_data.append('nama', $("#nama").val());
|
|
form_data.append('no_telpon', $("#no_telpon").val());
|
|
form_data.append('alamat', $("#alamat").val());
|
|
// check if there is a file
|
|
form_data.append('ada_file', $("#gambar-profil")[0].files.length > 0 ? 1 : 0);
|
|
if ($("#gambar-profil")[0].files.length > 0) {
|
|
form_data.append('gambar', $("#gambar-profil")[0].files[0]);
|
|
}
|
|
|
|
swal({
|
|
title: "Yakin?",
|
|
text: "Anda yakin ingin update profil?",
|
|
icon: "info",
|
|
showCancelButton: !0,
|
|
// confirmButtonColor: "#DD6B55",
|
|
confirmButtonText: "Ya",
|
|
cancelButtonText: "Tidak",
|
|
}, function (y) {
|
|
if (y) {
|
|
|
|
|
|
$.ajax({
|
|
url: '/user/' + global_data._id,
|
|
type: 'PUT',
|
|
data: form_data,
|
|
contentType: false,
|
|
processData: false,
|
|
beforeSend: function () {
|
|
blockUI('Update Profil Sedang Diproses...');
|
|
},
|
|
success: function (data) {
|
|
console.log(data);
|
|
localStorage.setItem('user', JSON.stringify(data));
|
|
toastr.success('Profil berhasil diupdate');
|
|
setTimeout(() => {
|
|
$.unblockUI();
|
|
window.location.reload();
|
|
}, 1500);
|
|
// cancelprofil();
|
|
|
|
|
|
},
|
|
error: function (xhr, status, error) {
|
|
console.log(xhr.responseJSON);
|
|
toastr.error(xhr.responseJSON !== undefined ? xhr.responseJSON : "Terjadi Kesalahan Server");
|
|
$.unblockUI();
|
|
}
|
|
})
|
|
|
|
}
|
|
})
|
|
}
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html> |