-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard-update-listing.php
208 lines (193 loc) · 10.8 KB
/
dashboard-update-listing.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
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<?php
session_start();
// Check visitor is logged in. If not redirect to login page
if (!$_SESSION['logged_in']) {
header('location: dashboard-login');
}
$title = "Update Listing";
$metaD = "Admin dashboard page, update listing";
include 'includes/dashboard-header.php';
include 'includes/dashboard-sidebar.php';
include 'processes/process-populate-update-listing.php';
?>
<h1>Update Listing</h1>
<!-- error/success messages -->
<div><?php if (isset($_SESSION['successMessage'])) { echo $_SESSION['successMessage']; unset($_SESSION['successMessage']); }; ?></div>
<div><?php if (isset($_SESSION['errorMessage'])) { echo $_SESSION['errorMessage']; unset($_SESSION['errorMessage']); }; ?></div>
<div><?php if (isset($_SESSION['propertiesErrorMessage'])) { echo $_SESSION['propertiesErrorMessage']; unset($_SESSION['propertiesErrorMessage']); }; ?></div>
<div><?php if (isset($_SESSION['agentsErrorMessage'])) { echo $_SESSION['agentsErrorMessage']; unset($_SESSION['agentsErrorMessage']); }; ?></div>
<div><?php if (isset($_SESSION['categoriesErrorMessage'])) { echo $_SESSION['categoriesErrorMessage']; unset($_SESSION['categoriesErrorMessage']); }; ?></div>
<div><?php if (isset($_SESSION['typeErrorMessage'])) { echo $_SESSION['typeErrorMessage']; unset($_SESSION['typeErrorMessage']); }; ?></div>
<div><?php if (isset($_SESSION['featuredImErrorMessage'])) { echo $_SESSION['featuredImErrorMessage']; unset($_SESSION['featuredImErrorMessage']); }; ?></div>
<form class="add-listing-form" method="post" role="form" action="processes/process-update-listing.php" enctype="multipart/form-data">
<div class="listing-form">
<h3>Current Property Details</h3>
<h5>Listing #<?php echo $listing_id ?></h5>
<div class="form-row form-inline mt-4">
<div class="col-12 col-xl-4 mb-3">
<label for="agents">Sales Agent</label>
<select class="form-control" required name="updateSalesAgent" id="type" value="">
<option value="" disabled>Select</option>
<?php echo $options_agents; ?>
</select>
</div>
<div class="col-12 col-xl-4 mb-3">
<label for="title">Listing Title</label>
<input class="form-control wide" required name="updateListingTitle" id="title" placeholder="Inspiring title for your listing" value="<?php echo $listing_title ?>">
</div>
<div class="col-12 col-xl-4 mb-3">
<label for="address">Street Address</label>
<input class="form-control wide" required name="updateStreetAddress" id="address" placeholder="number, street, suburb" value="<?php echo $address ?>">
</div>
</div>
<div class="form-row form-inline">
<div class="col-12 col-md-6 col-xl-3 mb-3 mb-xl-24">
<label for="city">City</label>
<select class="form-control" required name="updateCity" id="city" value="">
<option value="" disabled>Select</option>
<?php echo $options_city; ?>
</select>
</div>
<div class="col-12 col-md-6 col-xl-3 mb-3 mb-xl-24">
<label for="type">Property Type</label>
<select class="form-control" required name="updatePropertyType" id="type" value="">
<option value="" disabled>Select</option>
<?php echo $options_type; ?>
</select>
</div>
<div class="col-12 col-md-6 col-xl-3 mb-3">
<label for="price">Price</label>
<div class="input-group">
<span class="input-group-addon" id="price$">$</span>
<input type="number" class="form-control" required name="updatePrice" id="price" aria-describedby="pricehelp" aria-label="Amount (to the nearest dollar)" placeholder="100000" value="<?php echo $price ?>">
<span class="input-group-addon">.00</span>
</div>
<small id="pricehelp" class="form-text text-muted">set sale price, or market value </small>
</div>
<div class="col-12 col-md-6 col-xl-3 mb-3">
<label for="sale-method">Sale Method</label>
<input type="text" class="form-control wide" name="updateSaleMethod" id="sale-method" aria-describedby="salehelp" placeholder="Negotiation, auction, tender" value="<?php echo $sell_method ?>">
<small id="salehelp" class="form-text text-muted"><b>NOT REQUIRED</b> if you have a set sale price</small>
</div>
</div>
<div class="form-row form-inline">
<div class="col-12 col-md-6 col-xl-3 mb-3">
<label for="bedrooms">Bedrooms</label>
<select class="form-control" required name="updateBedrooms" id="bedrooms" value="">
<option value="" disabled>Select</option>
<option value="N/A">N/A</option>
<?php echo $options_beds ?>
</select>
</div>
<div class="col-12 col-md-6 col-xl-3 mb-3">
<label for="bed-des">Bedroom Description</label>
<input class="form-control wide" required name="updateBedDescription" id="bed-des" placeholder="Double bedrooms, double wardrobes" value="<?php echo $bed_des ?>">
</div>
<div class="col-12 col-md-6 col-xl-3 mb-3">
<label for="bathrooms">Bathrooms</label>
<select class="form-control" required name="updateBathrooms" id="bathrooms" value="">
<option value="" disabled>Select</option>
<option value="N/A">N/A</option>
<?php echo $options_bath ?>
</select>
</div>
<div class="col-12 col-md-6 col-xl-3 mb-3">
<label for="bath-des">Bathroom Description</label>
<input class="form-control wide" required name="updateBathDescription" id="bath-des" placeholder="Main, ensuite, seperate toilet" value="<?php echo $bath_des ?>">
</div>
</div>
<div class="form-row form-inline">
<div class="col-12 col-md-6 col-xl-3 mb-3">
<label for="lounges">Lounges</label>
<select class="form-control" required name="updateLounges" id="lounges" value="">
<option value="" disabled>Select</option>
<option value="N/A">N/A</option>
<?php echo $options_lounge ?>
</select>
</div>
<div class="col-12 col-md-6 col-xl-3 mb-3">
<label for="lou-des">Lounge Description</label>
<input class="form-control wide" required name="updateLoungeDescription" id="lou-des" placeholder="TV room, family room, rumpus" value="<?php echo $lounge_des ?>">
</div>
<div class="col-12 col-md-6 col-xl-3 mb-3">
<label for="garages">Garages</label>
<select class="form-control" required name="updateGarages" id="garages" value="">
<option value="" disabled>Select</option>
<option value="N/A">N/A</option>
<?php echo $options_garage ?>
</select>
</div>
<div class="col-12 col-md-6 col-xl-3 mb-3">
<label for="gar-des">Garage Description</label>
<input class="form-control wide" required name="updateGarageDescription" id="gar-des" placeholder="Double, single, workshop" value="<?php echo $garage_des ?>">
</div>
</div>
<div class="form-row form-inline">
<div class="col-12 col-md-6 col-xl-3 mb-3">
<label for="house-sqm">House Size</label>
<div class="input-group">
<input type="number" class="form-control" required name="updateHouseSize" id="house-sqm" aria-describedby="h-sqm" placeholder="180" value="<?php echo $house_size ?>">
<span class="input-group-addon" id="h-sqm">m<sup>2</sup></span>
</div>
</div>
<div class="col-12 col-md-6 col-xl-3 mb-3">
<label for="land-sqm">Land Size</label>
<div class="input-group">
<input type="number" class="form-control" required name="updateLandSize" id="land-sqm" aria-describedby="l-sqm" placeholder="800" value="<?php echo $land_size ?>">
<span class="input-group-addon" id="l-sqm">m<sup>2</sup></span>
</div>
</div>
<div class="col-12 col-md-6 col-xl-3 mb-3">
<label for="map">Map Co-ordinates</label>
<input type="text" class="form-control wide" required name="updateMapCoord" id="map" placeholder="41.850, -87.650" value="<?php echo $map_co_ords ?>">
</div>
</div>
<div class="form-row">
<div class="col-12 col-xl-6 pl-0 mb-3">
<label for="description">Property Description</label>
<textarea class="form-control" id="description" required name="updatePropDes" rows="3" placeholder="Write all the good stuff about your listing here..."><?php echo $prop_des ?></textarea>
</div>
</div>
<div class="form-row">
<div class="col mb-3">
<div class="form-check">
<label class="form-check-label">
<input class="form-check-input" name="updateFListing" type="checkbox" value="1" <?php if($featured_property == "1"){echo 'checked="checked"';} ?>>
<h5 class="ml-1">Featured Listing</h5>
</label>
</div>
</div>
</div>
</div> <!-- listing form div -->
<!-- Update Featured Image -->
<div id="featured-image-form">
<div class="col pl-0 pr-0">
<div class="featured-image-form">
<h3 class="mb-4">Change Featured Image</h3>
<?php echo $radio_featured_image; ?>
<small id="" class="form-text text-muted">Select an image to replace the existing featured image</small>
</div>
</div>
</div>
<!-- Image upload tool -->
<div class="form-row form-inline">
<div class="col col-lg-6">
<div class="image-form">
<h3 class="mb-4">Add More Images</h3>
<label for="file">Upload Property Images</label>
<small id="p-image-help" class="form-text text-muted">png, jpg or jpeg file types accepted, max size 500KB</small><br>
<div id="filediv">
<!-- <input class="form-control" name="file[]" type="file" id="file" aria-describedby="p-image-help"/> -->
</div>
<input type="button" id="add_more" class="btn" value="Add Another Image"/>
<div><?php if (isset($_SESSION['imgUploadError'])) { echo $_SESSION['imgUploadError']; unset($_SESSION['imgUploadError']); }; ?></div>
<div><?php if (isset($_SESSION['imgFileError'])) { echo $_SESSION['imgFileError']; unset($_SESSION['imgFileError']); }; ?></div>
<div><?php if (isset($_SESSION['imgError'])) { echo $_SESSION['imgError']; unset($_SESSION['imgError']); }; ?></div>
</div>
</div>
</div>
<input type="submit" value="Update Listing" name="submit" id="upload" class="btn"/>
</form>
<?php
include 'includes/dashboard-footer.php';
?>