forked from rizkadwisaputra/inventorybarang
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathperusahaan.php
More file actions
84 lines (83 loc) · 3.3 KB
/
perusahaan.php
File metadata and controls
84 lines (83 loc) · 3.3 KB
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
<?php
$perusahaan = new \Ataslangit\DB\Perusahaan();
?>
<div class="row">
<div class="col-md-12">
<div class="box">
<div class="box-header">
<h3 class="box-title" style="padding-top:0; margin-top:0; color:#f00;">Setting Perusahaan</h3>
</div>
<hr />
<div class="box-body">
<?php
if (isset($_POST['save'])) {
$perusahaan->simpan_perusahaan($_POST['nama'], $_POST['alamat'], $_POST['pemilik'], $_POST['kota']);
echo "<script>bootbox.alert('Tersimpan!', function(){
window.location = 'index.php?page=perusahaan';
});</script>";
}
$per = $perusahaan->tampil_perusahaan();
?>
<form method="POST" id="forminput" enctype="multipart/form-data">
<div class="form-group">
<label>Nama Perusahaan</label>
<input type="text" class="form-control" name="nama" id="nama" value="<?= $per['nama_perusahaan']; ?>" placeholder="Masukan Nama Perusahaan">
</div>
<div class="form-group">
<label>Alamat</label>
<input type="text" class="form-control" name="alamat" id="alamat" value="<?= $per['alamat']; ?>" placeholder="Masukan Alamat Perusahaan">
</div>
<div class="form-group">
<label>Nama Pemilik</label>
<input type="text" class="form-control" name="pemilik" id="pemilik" value="<?= $per['pemilik']; ?>" placeholder="Masukan Nama Pemilik Perusahaan">
</div>
<div class="form-group">
<label>Kota</label>
<input type="text" class="form-control" name="kota" id="kota" value="<?= $per['kota']; ?>" placeholder="Masukan Kota Perusahaan">
</div>
<button id="formbtn" class="btn btn-primary" name="save"><i class="fa fa-save"></i> Simpan</button>
</form>
</div>
</div>
</div>
</div>
<script>
//fungsi hide div
$(function() {
setTimeout(function() {
$("#divAlert").fadeOut(900)
}, 500);
});
function validateText(id) {
if ($('#' + id).val() == null || $('#' + id).val() == "") {
var div = $('#' + id).closest('div');
div.addClass("has-error has-feedback");
return false;
} else {
var div = $('#' + id).closest('div');
div.removeClass("has-error has-feedback");
return true;
}
}
$(document).ready(function() {
$("#formbtn").click(function() {
if (!validateText('nama')) {
$('#nama').focus();
return false;
}
if (!validateText('alamat')) {
$('#alamat').focus();
return false;
}
if (!validateText('pemilik')) {
$('#pemilik').focus();
return false;
}
if (!validateText('kota')) {
$('#kota').focus();
return false;
}
return true;
});
});
</script>