-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmanage_houses.php
More file actions
187 lines (180 loc) · 6.97 KB
/
manage_houses.php
File metadata and controls
187 lines (180 loc) · 6.97 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php include('db_connect.php');?>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/2.0.5/css/dataTables.dataTables.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/3.0.2/css/buttons.dataTables.css">
<div class="container-fluid">
<div class="col-lg-12 mt-5">
<marquee onMouseOver="this.stop()" onMouseOut="this.start()">For any software development or website designing work contact me at <a href="mailto:codecampbdofficial@gmail.com" >codecampbdofficial@gmail.com </a> Or Contact <a href="https://www.facebook.com/dev.mhrony/" target="_blank" >Facebook</a> </marquee>
<div class="row">
<!-- FORM Panel -->
<!-- FORM Panel -->
<!-- Author Name: MH RONY.
GigHub Link: https://github.com/dev-mhrony
Facebook Link:https://www.facebook.com/dev.mhrony
Youtube Link: https://www.youtube.com/channel/UChYhUxkwDNialcxj-OFRcDw
for any PHP, Laravel, Python, Dart, Flutter work contact me at developer.mhrony@gmail.com
Visit My Website : developerrony.com
-->
<!-- Table Panel -->
<div class="col-md-12">
<div class="card">
<div class="card-header">
<b>House List</b>
</div>
<div class="card-body">
<table id="example" class="display table table-bordered table-hover">
<thead>
<tr>
<th class="text-center">#</th>
<th class="text-center">House</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
$house = $conn->query("SELECT h.*,c.name as cname FROM houses h inner join categories c on c.id = h.category_id order by id asc");
while($row=$house->fetch_assoc()):
?>
<tr>
<td class="text-center"><?php echo $i++ ?></td>
<td class="">
<p>House #: <?php echo $row['house_no'] ?></p>
<p><small>House Type: <?php echo $row['cname'] ?></small></p>
<p><small>Description: <?php echo $row['description'] ?></small></p>
<p><small>Price: <?php echo number_format($row['price'],2) ?></small></p>
</td>
<td class="text-center">
<button class="btn btn-sm btn-primary edit_house" type="button" data-id="<?php echo $row['id'] ?>" data-house_no="<?php echo $row['house_no'] ?>" data-description="<?php echo $row['description'] ?>" data-category_id="<?php echo $row['category_id'] ?>" data-price="<?php echo $row['price'] ?>" >Edit</button>
<button class="btn btn-sm btn-danger delete_house" type="button" data-id="<?php echo $row['id'] ?>">Delete</button>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Table Panel -->
</div>
</div>
</div>
<!-- Author Name: MH RONY.
GigHub Link: https://github.com/dev-mhrony
Facebook Link:https://www.facebook.com/dev.mhrony
Youtube Link: https://www.youtube.com/channel/UChYhUxkwDNialcxj-OFRcDw
for any PHP, Laravel, Python, Dart, Flutter work contact me at developer.mhrony@gmail.com
Visit My Website : developerrony.com
-->
<style>
td{
vertical-align: middle !important;
}
td p {
margin: unset;
padding: unset;
line-height: 1em;
}
</style>
<!-- Author Name: MH RONY.
GigHub Link: https://github.com/dev-mhrony
Facebook Link:https://www.facebook.com/dev.mhrony
Youtube Link: https://www.youtube.com/channel/UChYhUxkwDNialcxj-OFRcDw
for any PHP, Laravel, Python, Dart, Flutter work contact me at developer.mhrony@gmail.com
Visit My Website : developerrony.com
-->
<script>
$('#manage-house').on('reset',function(e){
$('#msg').html('')
})
$('#manage-house').submit(function(e){
e.preventDefault()
start_load()
$('#msg').html('')
$.ajax({
url:'ajax.php?action=save_house',
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.reload()
},1500)
}
else if(resp==2){
$('#msg').html('<div class="alert alert-danger">House number already exist.</div>')
end_load()
}
}
})
})
$('.edit_house').click(function(){
start_load()
var cat = $('#manage-house')
cat.get(0).reset()
cat.find("[name='id']").val($(this).attr('data-id'))
cat.find("[name='house_no']").val($(this).attr('data-house_no'))
cat.find("[name='description']").val($(this).attr('data-description'))
cat.find("[name='price']").val($(this).attr('data-price'))
cat.find("[name='category_id']").val($(this).attr('data-category_id'))
end_load()
})
$('.delete_house').click(function(){
_conf("Are you sure to delete this house?","delete_house",[$(this).attr('data-id')])
})
// function delete_house($id){
// start_load()
// $.ajax({
// url:'ajax.php?action=delete_house',
// method:'POST',
// data:{id:$id},
// success:function(resp){
// if(resp==1){
// alert_toast("Data successfully deleted",'success')
// setTimeout(function(){
// location.reload()
// },1500)
// }
// }
// })
// }
// $('table').dataTable()
</script>
<!-- Author Name: MH RONY.
GigHub Link: https://github.com/dev-mhrony
Facebook Link:https://www.facebook.com/dev.mhrony
Youtube Link: https://www.youtube.com/channel/UChYhUxkwDNialcxj-OFRcDw
for any PHP, Laravel, Python, Dart, Flutter work contact me at developer.mhrony@gmail.com
Visit My Website : developerrony.com
-->
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="https://cdn.datatables.net/2.0.5/js/dataTables.js"></script>
<script src="https://cdn.datatables.net/buttons/3.0.2/js/dataTables.buttons.js"></script>
<script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.html5.min.js"></script>
<script>
new DataTable('#example', {
layout: {
topStart: {
buttons: ['copyHtml5', 'excelHtml5', 'csvHtml5', 'pdfHtml5']
}
}
});
</script>
<!-- Author Name: MH RONY.
GigHub Link: https://github.com/dev-mhrony
Facebook Link:https://www.facebook.com/dev.mhrony
Youtube Link: https://www.youtube.com/channel/UChYhUxkwDNialcxj-OFRcDw
for any PHP, Laravel, Python, Dart, Flutter work contact me at developer.mhrony@gmail.com
Visit My Website : developerrony.com
-->
<footer class="footer d-flex flex-column flex-md-row align-items-center justify-content-between px-4 py-3 border-top small">
<p class="text-muted mb-1 mb-md-0">Copyright © 2024 Tenant Management System Software - Design and Develop By <a href="https://www.facebook.com/dev.mhrony/" target="_blank"> MH RONY </a> </p>
</footer>