-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew_branch.php
93 lines (88 loc) · 3.42 KB
/
new_branch.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
<?php if(!isset($conn)){ include 'db_connect.php'; } ?>
<style>
textarea{
resize: none;
}
</style>
<div class="col-lg-12">
<div class="card card-outline card-primary">
<div class="card-body">
<form action="" id="manage-branch">
<input type="hidden" name="id" value="<?php echo isset($id) ? $id : '' ?>">
<div class="row">
<div class="col-md-12">
<div id="msg" class=""></div>
<div class="row">
<div class="col-sm-6 form-group ">
<label for="" class="control-label">Street/Building</label>
<textarea name="street" id="" cols="30" rows="2" class="form-control"><?php echo isset($street) ? $street : '' ?></textarea>
</div>
<div class="col-sm-6 form-group ">
<label for="" class="control-label">City</label>
<textarea name="city" id="" cols="30" rows="2" class="form-control"><?php echo isset($city) ? $city : '' ?></textarea>
</div>
</div>
<div class="row">
<div class="col-sm-6 form-group ">
<label for="" class="control-label">State</label>
<textarea name="state" id="" cols="30" rows="2" class="form-control"><?php echo isset($state) ? $state : '' ?></textarea>
</div>
<div class="col-sm-6 form-group ">
<label for="" class="control-label">Zip Code/ Postal Code</label>
<textarea name="zip_code" id="" cols="30" rows="2" class="form-control"><?php echo isset($zip_code) ? $zip_code : '' ?></textarea>
</div>
</div>
<div class="row">
<div class="col-sm-6 form-group ">
<label for="" class="control-label">Country</label>
<textarea name="country" id="" cols="30" rows="2" class="form-control"><?php echo isset($country) ? $country : '' ?></textarea>
</div>
<div class="col-sm-6 form-group ">
<label for="" class="control-label">Contact #</label>
<textarea name="contact" id="" cols="30" rows="2" class="form-control"><?php echo isset($contact) ? $contact : '' ?></textarea>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="card-footer border-top border-info">
<div class="d-flex w-100 justify-content-center align-items-center">
<button class="btn btn-flat bg-gradient-primary mx-2" form="manage-branch">Save</button>
<a class="btn btn-flat bg-gradient-secondary mx-2" href="./index.php?page=branch_list">Cancel</a>
</div>
</div>
</div>
</div>
<script>
$('#manage-branch').submit(function(e){
e.preventDefault()
start_load()
$.ajax({
url:'ajax.php?action=save_branch',
data: new FormData($(this)[0]),
cache: false,
contentType: false,
processData: false,
method: 'POST',
type: 'POST',
success:function(resp){
if(resp == 1){
alert_toast('Data successfully saved',"success");
setTimeout(function(){
location.href = 'index.php?page=branch_list'
},2000)
}
}
})
})
function displayImgCover(input,_this) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#cover').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
</script>