-
Notifications
You must be signed in to change notification settings - Fork 4
/
tambah-cabang.php
95 lines (94 loc) · 2.62 KB
/
tambah-cabang.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php include 'koneksi.php'; ?>
<?php
if($_SESSION['role'] === 'Super Admin'){
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include 'menu/head.php'; ?>
</head>
<body>
<div id="app">
<div class="main-wrapper">
<div class="navbar-bg"></div>
<nav class="navbar navbar-expand-lg main-navbar">
<?php include 'menu/nav.php'; ?>
</nav>
<div class="main-sidebar">
<aside id="sidebar-wrapper">
<?php include 'menu/aside.php'; ?>
</aside>
</div>
<div class="main-content">
<section class="section">
<div class="section-header">
<h1>Tambah Cabang</h1>
<div class="section-header-breadcrumb">
<div class="breadcrumb-item active"><a href="beranda">Beranda</a></div>
<div class="breadcrumb-item"><a href="pengguna">Cabang</a></div>
<div class="breadcrumb-item">Tambah Cabang</div>
</div>
</div>
<div class="section-body">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<form role="form" action="#" method="POST" enctype="multipart/form-data" id="data-form">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="nama">Nama Cabang</label>
<input type="text" class="form-control" name="nama" id="nama" required="" autocomplete="off" placeholder="Masukan Nama Cabang" maxlength="100" autofocus="">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<a href="cabang" class="btn btn-danger">Kembali</a>
<button type="submit" class="btn btn-primary float-right">Simpan</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<footer class="main-footer">
<?php include 'menu/footer.php'; ?>
</footer>
</div>
</div>
<?php include 'menu/script.php'; ?>
<script type="text/javascript">
$(document).ready(function() {
$("#data-form").submit(function(e) {
e.preventDefault();
var data = new FormData(this);
$.ajax({
type: "POST",
url: "proses/add-cabang.php",
data: data,
processData: false,
contentType: false,
success: function(response) {
var dataresponse = JSON.parse(response);
if(dataresponse.status == "1") {
window.location.href='cabang'
}else {
swal('Peringatan', 'Kesalahan dalam sebuah query', 'error');
}
}
});
return false;
});
});
</script>
</body>
</html>
<?php } else {
header("Location:beranda");
}?>