001.
<?php
002.
003.
004.
005.
006.
007.
008.
009.
010.
011.
012.
013.
014.
015.
016.
017.
018.
019.
020.
021.
022.
$status
= isset(
$_REQUEST
[
'message'
]) ?
$_REQUEST
[
'message'
] :
"ok"
;
023.
024.
if
(
$status
==
'ok'
){
025.
echo
'<p class="alert alert-success" role="alert"> <strong>เราได้รับข้อมูลของคุณเชิญลงประกาศได้แล้วค่ะ</strong>'
;
026.
echo
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'
;
027.
echo
'</p>'
;
028.
}
029.
030.
031.
?>
032.
033.
<h1><?php
034.
echo
__(
'New Add Property'
,
'wpdt-property-submit'
);
035.
?></h1>
036.
037.
<form action=
"<?php //the_permalink(); ?>"
method=
"post"
enctype=
"multipart/form-data"
name=
"wpdt_property_submit_form"
id=
"wpdt_property_submit_form"
>
038.
039.
<div
class
=
"entry-header"
>
040.
<div
class
=
"title-info"
>
041.
<p
class
=
"subtmi-title"
>
042.
<label>ชื่ออสังหาริมทรัพย์ *จำเป็นต้องกรอกด้วย*</label>
043.
<input
class
=
"title-text widefat"
autofocus placeholder=
"ใส่ชื่ออสังหาริมทรัพย์ให้ครบถ้วน"
name=
"_pro_title"
id=
"_pro_title"
type=
"text"
value=
"<?php echo $_pro_title; ?>"
/>
044.
</p>
045.
</div>
046.
</div>
047.
048.
<div
class
=
"row"
>
049.
<div
class
=
"col-md-8 col-sm-8"
>
050.
051.
<div
class
=
"entry-meta"
>
052.
<span
class
=
"proprty-info bedrooms"
>
053.
<label>จำนวนห้องนอน</label><br>
054.
<select name=
"_pro_bedrooms"
class
=
"small-select"
>
055.
<option value=
""
<?php
if
(!(
strcmp
(
""
,
$_pro_bedrooms
))) {
echo
"selected=\"selected\""
;} ?>>-</option>
056.
<option value=
"1"
<?php
if
(!(
strcmp
(1,
$_pro_bedrooms
))) {
echo
"selected=\"selected\""
;} ?>>1</option>
057.
<option value=
"2"
<?php
if
(!(
strcmp
(2,
$_pro_bedrooms
))) {
echo
"selected=\"selected\""
;} ?>>2</option>
058.
<option value=
"3"
<?php
if
(!(
strcmp
(3,
$_pro_bedrooms
))) {
echo
"selected=\"selected\""
;} ?>>3</option>
059.
<option value=
"4"
<?php
if
(!(
strcmp
(4,
$_pro_bedrooms
))) {
echo
"selected=\"selected\""
;} ?>>4</option>
060.
<option value=
"5"
<?php
if
(!(
strcmp
(5,
$_pro_bedrooms
))) {
echo
"selected=\"selected\""
;} ?>>5</option>
061.
<option value=
"6"
<?php
if
(!(
strcmp
(6,
$_pro_bedrooms
))) {
echo
"selected=\"selected\""
;} ?>>6</option>
062.
<option value=
"7"
<?php
if
(!(
strcmp
(7,
$_pro_bedrooms
))) {
echo
"selected=\"selected\""
;} ?>>7</option>
063.
<option value=
"8"
<?php
if
(!(
strcmp
(8,
$_pro_bedrooms
))) {
echo
"selected=\"selected\""
;} ?>>8</option>
064.
<option value=
"9"
<?php
if
(!(
strcmp
(9,
$_pro_bedrooms
))) {
echo
"selected=\"selected\""
;} ?>>9</option>
065.
<option value=
"10"
<?php
if
(!(
strcmp
(10,
$_pro_bedrooms
))) {
echo
"selected=\"selected\""
;} ?>>10</option>
066.
</select>
067.
</span>
068.
069.
<span
class
=
"proprty-info bathrooms"
>
070.
<label>จำนวนห้องน้ำ</label><br>
071.
<select name=
"_pro_bathrooms"
class
=
"small-select"
>
072.
<option value=
""
<?php
if
(!(
strcmp
(
""
,
$_pro_bathrooms
))) {
echo
"selected=\"selected\""
;} ?>>-</option>
073.
<option value=
"1"
<?php
if
(!(
strcmp
(1,
$_pro_bathrooms
))) {
echo
"selected=\"selected\""
;} ?>>1</option>
074.
<option value=
"2"
<?php
if
(!(
strcmp
(2,
$_pro_bathrooms
))) {
echo
"selected=\"selected\""
;} ?>>2</option>
075.
<option value=
"3"
<?php
if
(!(
strcmp
(3,
$_pro_bathrooms
))) {
echo
"selected=\"selected\""
;} ?>>3</option>
076.
<option value=
"4"
<?php
if
(!(
strcmp
(4,
$_pro_bathrooms
))) {
echo
"selected=\"selected\""
;} ?>>4</option>
077.
<option value=
"5"
<?php
if
(!(
strcmp
(5,
$_pro_bathrooms
))) {
echo
"selected=\"selected\""
;} ?>>5</option>
078.
<option value=
"6"
<?php
if
(!(
strcmp
(6,
$_pro_bathrooms
))) {
echo
"selected=\"selected\""
;} ?>>6</option>
079.
<option value=
"7"
<?php
if
(!(
strcmp
(7,
$_pro_bathrooms
))) {
echo
"selected=\"selected\""
;} ?>>7</option>
080.
<option value=
"8"
<?php
if
(!(
strcmp
(8,
$_pro_bathrooms
))) {
echo
"selected=\"selected\""
;} ?>>8</option>
081.
<option value=
"9"
<?php
if
(!(
strcmp
(9,
$_pro_bathrooms
))) {
echo
"selected=\"selected\""
;} ?>>9</option>
082.
<option value=
"10"
<?php
if
(!(
strcmp
(10,
$_pro_bathrooms
))) {
echo
"selected=\"selected\""
;} ?>>10</option>
083.
</select>
084.
</span>
085.
086.
<p
class
=
"proprty-info area"
>
087.
<label>พื้นที่ใช้สอย</label><br>
088.
<input
class
=
"small-text"
name=
"_pro_area"
type=
"text"
value=
"<?php echo $_pro_area; ?>"
/> (ตรม.)
089.
<input
class
=
"small-text"
name=
"_pro_floor"
type=
"text"
value=
"<?php echo $_pro_floor; ?>"
/> ชั้น
090.
</p>
091.
092.
</div>
093.
094.
<div role=
"main"
class
=
"site-content single-property"
id=
"content"
>
095.
096.
<div
class
=
"form-submit"
>
097.
098.
<div
class
=
"propery-infos"
>
099.
<h3
class
=
"post-subject"
>ข้อมูลประกาศ *ควรลงให้ละเอียด*</h3>
100.
101.
<div
class
=
"proerpty-list-info"
>
102.
<p
class
=
"proerpty-name"
>
103.
<label
class
=
"label"
>ชื่อโครงการ</label>
104.
<span
class
=
"text"
>
105.
<input
class
=
"large-text"
name=
"_pro_project"
type=
"text"
id=
"_pro_project"
value=
"<?php echo $_pro_project; ?>"
/>
106.
</span>
107.
</p>
108.
</div>
109.
110.
<div
class
=
"proerpty-list-info"
>
111.
<div
class
=
"proerpty-name"
>
112.
<label
class
=
"label"
>มีความต้องการ</label>
113.
<div
class
=
"text"
>
114.
<ul
class
=
"proeoty-info-right"
>
115.
116.
<?php
117.
118.
$args
=
array
(
'hide_empty'
=> false );
119.
120.
$terms
= get_terms(
'property_type'
,
$args
);
121.
122.
123.
124.
125.
$count
=
count
(
$terms
);
$i
=0;
126.
if
(
$count
> 0) {
127.
foreach
(
$terms
as
$term
) {
128.
129.
$checked
=
""
;
130.
if
(in_array(
$term
->term_id,
$_pro_property_type
)) {
131.
$checked
=
'checked="checked"'
;
132.
}
133.
echo
'<li><label><input '
.
$checked
.
' name="_pro_property_type[]" type="checkbox" value="'
.
$term
->term_id.
'" /> '
.trim(
$term
->name).
'</label></li>'
;
134.
}
135.
}
136.
137.
?>
138.
139.
</ul>
140.
</div>
141.
</div>
142.
</div>
143.
144.
145.
<div
class
=
"proerpty-list-info"
>
146.
<p
class
=
"proerpty-name"
>
147.
<label
class
=
"label"
>ประเภทประกาศ</label>
148.
<span
class
=
"text"
>
149.
<select name=
"_pro_type"
id=
"_pro_type"
>
150.
<?php
151.
152.
$args
=
array
(
'hide_empty'
=> false );
153.
$terms
= get_terms(
'category'
,
$args
);
154.
155.
$count
=
count
(
$terms
);
$i
=0;
156.
if
(
$count
> 0) {
157.
echo
'<option value="">--เลือกประเภทประกาศ--</option>'
;
158.
foreach
(
$terms
as
$term
) {
159.
echo
'<option value="'
.
$term
->term_id.
'" '
.selected(
$_pro_type
,
$term
->term_id ,false).
'>'
.
$term
->name.
'</option>'
;
160.
}
161.
}
162.
?>
163.
</select>
164.
</span>
165.
</p>
166.
</div>
167.
168.
<div
class
=
"proerpty-list-info"
>
169.
170.
<p
class
=
"proerpty-name"
>
171.
<label
class
=
"label"
>ขนาดที่ดิน</label>
172.
<span
class
=
"text"
>
173.
<input
class
=
"small-text"
name=
"_pro_area_land"
placeholder=
"ไร่-งาน-ตรว"
type=
"text"
value=
"<?php echo $_pro_area_land; ?>"
/> (ไร่)
174.
</span>
175.
</p>
176.
</div>
177.
178.
179.
<div
class
=
"proerpty-list-info"
>
180.
<p
class
=
"proerpty-name"
>
181.
<label
class
=
"label"
>จังหวัด</label>
182.
<span
class
=
"text"
>
183.
<select name=
"_pro_location"
id=
"_pro_location"
>
184.
<?php
185.
$args
=
array
(
'hide_empty'
=> false );
186.
187.
$terms
= get_terms(
'location'
,
$args
);
188.
189.
$count
=
count
(
$terms
);
$i
=0;
190.
if
(
$count
> 0) {
191.
echo
'<option value="">--เลือกจังหวัด--</option>'
;
192.
foreach
(
$terms
as
$term
) {
193.
echo
'<option value="'
.
$term
->term_id.
'" '
.selected(
$_pro_location
,
$term
->term_id ,false).
'>'
.
$term
->name.
'</option>'
;
194.
}
195.
}
196.
?>
197.
</select>
198.
</span>
199.
</p>
200.
</div>
201.
202.
203.
<div
class
=
"proerpty-list-info address"
>
204.
<div
class
=
"proerpty-name"
>
205.
<label
class
=
"label"
>ตำบล/อำเภอที่ตั้ง</label>
206.
<div
class
=
"text"
>
207.
<input id=
"_pro_address"
class
=
"large-text"
name=
"_pro_address"
type=
"text"
value=
"<?php echo $_pro_address; ?>"
/>
208.
</div>
209.
</div>
210.
</div>
211.
212.
<div
class
=
"proerpty-list-info voyage"
>
213.
<div
class
=
"proerpty-name"
>
214.
<label
class
=
"label"
>การเดินทาง</label>
215.
<div
class
=
"text"
>
216.
<textarea
class
=
"large-text"
name=
"_pro_voyage"
id=
"_pro_voyage"
cols=
"70"
rows=
"2"
><?php
echo
$_pro_voyage
; ?></textarea>
217.
</div>
218.
</div>
219.
</div>
220.
221.
<div
class
=
"proerpty-list-info map"
>
222.
<div
class
=
"proerpty-name"
>
223.
224.
<label
class
=
"label"
>แผนที่</label>
225.
226.
<div
class
=
"text"
>
227.
228.
<input id=
"_pro_lat"
name=
"_pro_lat"
type=
"hidden"
value=
"<?php echo $_pro_lat; ?>"
/>
229.
<input id=
"_pro_lng"
name=
"_pro_lng"
type=
"hidden"
value=
"<?php echo $_pro_lng; ?>"
/>
230.
<input id=
"_pro_zoom"
name=
"_pro_zoom"
type=
"hidden"
value=
"<?php echo $_pro_zoom; ?>"
/>
231.
232.
<div
class
=
"map-search-box"
>
233.
<input id=
"map_search_input"
name=
"map_search_input"
type=
"text"
/>
234.
</div>
235.
<div data-zoom=
"<?php echo $_pro_zoom; ?>"
data-lng=
"<?php echo $_pro_lng; ?>"
data-lat=
"<?php echo $_pro_lat; ?>"
id=
"property-map"
> </div>
236.
237.
<style type=
"text/css"
>
238.
239.
#property-map{ height:250px; width:100%; display:block; border:1px solid #CCCCCC; }
240.
#map_search_input{
241.
background-color: #FFFFFF;
242.
font-weight: 300;
243.
padding: 0 11px 0 13px;
244.
text-overflow: ellipsis;
245.
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
246.
border: 1px solid transparent;
247.
-moz-box-sizing: border-box;
248.
outline: none;
249.
margin-top: 10px;
250.
height: 40px;
251.
}
252.
253.
.wp-editor-container{ border:#ccc solid 1px; }
254.
255.
</style>
256.
257.
</div>
258.
259.
<script type=
"text/javascript"
>
260.
261.
262.
jQuery(document).ready(
function
($) {
263.
264.
if
($(
'#property-map'
).length != 0) {
265.
266.
var
latitude = $(
'#property-map'
).data(
'lat'
);
267.
var
longitude = $(
'#property-map'
).data(
'lng'
);
268.
var
zoom = $(
'#property-map'
).data(
'zoom'
);
269.
270.
271.
latlng =
new
google.maps.LatLng(latitude, longitude);
272.
zoom = 17;
273.
274.
var
mapOptions = {
275.
center: latlng,
276.
zoom: zoom,
277.
mapTypeId: google.maps.MapTypeId.ROADMAP
278.
};
279.
var
map =
new
google.maps.Map($(
'#property-map'
).get(0), mapOptions);
280.
281.
var
input = $(
'#map_search_input'
).get(0);
282.
283.
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
284.
285.
286.
var
autocomplete =
new
google.maps.places.Autocomplete(input);
287.
288.
autocomplete.bindTo(
'bounds'
, map);
289.
290.
var
marker =
new
google.maps.Marker({
291.
map: map,
292.
draggable: true
293.
});
294.
295.
marker.setPosition(latlng);
296.
297.
google.maps.event.addListener(autocomplete,
'place_changed'
,
function
() {
298.
var
place = autocomplete.getPlace();
299.
if
(place.geometry.viewport) {
300.
map.fitBounds(place.geometry.viewport);
301.
}
else
{
302.
map.setCenter(place.geometry.location);
303.
map.setZoom(17);
304.
}
305.
306.
marker.setPosition(place.geometry.location);
307.
308.
$(
"#_pro_lat"
).val(place.geometry.location.lat());
309.
$(
"#_pro_lng"
).val(place.geometry.location.lng());
310.
$(
"#_pro_zoom"
).val(map.getZoom());
311.
});
312.
313.
google.maps.event.addListener(marker,
'drag'
,
function
() {
314.
$(
'#_pro_lat'
).val(marker.getPosition().lat());
315.
$(
'#_pro_lng'
).val(marker.getPosition().lng());
316.
$(
"#_pro_zoom"
).val(map.getZoom());
317.
});
318.
319.
$(input).keypress(
function
(event) {
320.
if
(event.keyCode == 13) {
321.
event.preventDefault();
322.
}
323.
});
324.
325.
}
326.
});
327.
</script>
328.
</div>
329.
</div>
330.
331.
332.
<div
class
=
"proerpty-list-info rate-price"
>
333.
<div
class
=
"proerpty-name"
>
334.
<label
class
=
"label"
>เรทราคาใกล้เคียง</label>
335.
<span
class
=
"text"
>
336.
<select name=
"_pro_price_rate"
id=
"_pro_price_rate"
>
337.
<?php
338.
$args
=
array
(
'hide_empty'
=> false );
339.
340.
$terms
= get_terms(
'price_rate'
,
$args
);
341.
342.
$count
=
count
(
$terms
);
$i
=0;
343.
if
(
$count
> 0) {
344.
echo
'<option value="">--เลือกเรทราคาใกล้เคียง--</option>'
;
345.
foreach
(
$terms
as
$term
) {
346.
$i
++;
347.
echo
'<option value="'
.
$term
->term_id.
'" '
.selected(
$_pro_price_rate
,
$term
->term_id,false).
'>'
.
$term
->name.
'</option>'
;
348.
349.
}
350.
}
351.
?>
352.
</select>
353.
</span>
354.
</div>
355.
</div>
356.
357.
358.
<div
class
=
"proerpty-list-info price"
>
359.
<div
class
=
"proerpty-name"
>
360.
<label
class
=
"label"
>ราคาสำหรับขาย</label>
361.
<div
class
=
"text price"
>
362.
<input
class
=
"small-text number"
name=
"_pro_pricex"
id=
"_pro_pricex"
type=
"text"
value=
"<?php echo $_pro_price; ?>"
/>
363.
<input name=
"_pro_price"
type=
"hidden"
id=
"_pro_price"
value=
"<?php echo $_pro_price; ?>"
/>
364.
</div>
365.
</div>
366.
</div>
367.
368.
<div
class
=
"proerpty-list-info price-rent"
>
369.
<div
class
=
"proerpty-name"
>
370.
<label
class
=
"label"
>ราคาสำหรับให้เช่า</label>
371.
<div
class
=
"text price"
>
372.
<input
class
=
"small-text number"
name=
"_pro_price_rentx"
type=
"text"
id=
"_pro_price_rentx"
value=
"<?php echo $_pro_price_rent; ?>"
/>
373.
<input name=
"_pro_price_rent"
type=
"hidden"
id=
"_pro_price_rent"
value=
"<?php echo $_pro_price_rent; ?>"
/>
374.
</div>
375.
</div>
376.
</div>
377.
378.
<p> </p>
379.
<div
class
=
"proerpty-list-info length"
>
380.
381.
<h3
class
=
"post-subject"
>สิ่งอำนวยความสะดวก</h3>
382.
383.
<p
class
=
"proerpty-list-info"
>
384.
<label
class
=
"label abel post-subject-2"
>สถานที่ใกล้เคียง</label>
385.
</p>
386.
387.
<ul
class
=
"proeoty-info"
>
388.
389.
<?php
390.
391.
$args
=
array
(
'hide_empty'
=> false );
392.
393.
$terms
= get_terms(
'nearby'
,
$args
);
394.
395.
$count
=
count
(
$terms
);
$i
=0;
396.
if
(
$count
> 0) {
397.
foreach
(
$terms
as
$term
) {
398.
399.
$checked
=
""
;
400.
if
(in_array(
$term
->term_id,
$_pro_nearby
)) {
401.
$checked
=
'checked="checked"'
;
402.
}
403.
echo
'<li><label class="checked"><input '
.
$checked
.
' name="_pro_nearby[]" type="checkbox" value="'
.
$term
->term_id.
'" /> '
.trim(
$term
->name).
'</label></li>'
;
404.
}
405.
}
406.
407.
?>
408.
409.
</ul>
410.
<p></p>
411.
412.
<p
class
=
"proerpty-list-info length"
>
413.
<label
class
=
"label abel post-subject-2"
>สิ่งอำนวยความสะดวกภายนอก</label>
414.
</p>
415.
<ul
class
=
"proeoty-info"
>
416.
417.
<?php
418.
419.
$args
=
array
(
'hide_empty'
=> false );
420.
421.
$terms
= get_terms(
'facilities_outside'
,
$args
);
422.
423.
$count
=
count
(
$terms
);
$i
=0;
424.
if
(
$count
> 0) {
425.
foreach
(
$terms
as
$term
) {
426.
427.
$checked
=
""
;
428.
if
(in_array(
$term
->term_id,
$_pro_facilities_outside
)) {
429.
$checked
=
'checked="checked"'
;
430.
}
431.
432.
echo
'<li><label class=" checked"><input '
.
$checked
.
' name="_pro_facilities_outside[]" type="checkbox" value="'
.
$term
->term_id.
'" /> '
.trim(
$term
->name).
'</label></li>'
;
433.
434.
}
435.
}
436.
?>
437.
</ul>
438.
<p></p>
439.
<p
class
=
"proerpty-list-info length"
>
440.
<label
class
=
"label post-subject-2"
>สิ่งอำนวยความสะดวกภายใน</label>
441.
</p>
442.
<ul
class
=
"proeoty-info"
>
443.
<?php
444.
$args
=
array
(
'hide_empty'
=> false );
445.
446.
$terms
= get_terms(
'facilities_inside'
,
$args
);
447.
448.
$count
=
count
(
$terms
);
$i
=0;
449.
450.
if
(
$count
> 0) {
451.
foreach
(
$terms
as
$term
) {
452.
$checked
=
""
;
453.
if
(in_array(
$term
->term_id,
$_pro_facilities_inside
)) {
454.
$checked
=
'checked="checked"'
;
455.
}
456.
echo
'<li><label class="checked"><input '
.
$checked
.
' name="_pro_facilities_inside[]" type="checkbox" value="'
.
$term
->term_id.
'" /> '
.trim(
$term
->name).
'</label></li>'
;
457.
458.
}
459.
}
460.
?>
461.
</ul>
462.
<p></p>
463.
464.
</div>
465.
466.
</div>
467.
</div>
468.
469.
<p
class
=
"description"
>
470.
<h3
class
=
"post-subject"
>รายละเอียดเพิ่มเติม</h3>
471.
472.
<?php
473.
$settings
=
array
(
'textarea_name,'
=>
'_pro_description'
,
'media_buttons'
=> false,
'editor_height'
=>20 ,
'teeny'
=>true,
'dfw'
=>true,
'quicktags'
=>false);
474.
475.
wp_editor(
$_pro_description
,
"_pro_description"
,
$settings
);
476.
?>
477.
</p>
478.
479.
480.
<p
class
=
"tags"
>
481.
<label
class
=
"post-tags"
>แท็ก</label>
482.
<input
class
=
"large-text"
placeholder=
"ตัวอย่าง: แท็ก1,แท็ก2,แท็ก3,..."
name=
"_pro_tags"
id=
"_pro_tags"
type=
"text"
value=
"<?php echo $_pro_tags; ?>"
/>
483.
</p>
484.
485.
486.
<div
class
=
"property-gallery"
>
487.
<h3>เกลอรี่</h3>
488.
489.
<div
class
=
"panel panel-default photox"
>
490.
<?php
491.
$images_limit
= 12;
492.
493.
494.
echo
'<div class="col-sm-12 upload-thumbnails">'
;
495.
foreach
(
$_pro_images
as
$_pro_image_id
){
496.
497.
$image_attributes
= wp_get_attachment_image_src(
$_pro_image_id
,
'large'
);
498.
$image_attributes_thumbnail
= wp_get_attachment_image_src(
$_pro_image_id
,
'thumbnail'
);
499.
echo
'<div class="upload-thumbnail"><img src="'
.
$image_attributes_thumbnail
[0].
'" />'
;
500.
echo
' <div class="actions">'
;
501.
echo
' <a class="action del" href="#" data-id="'
.
$_pro_image_id
.
'" data-postid="'
.
$_pro_id
.
'">'
._(
'ลบ'
).
'</a>'
;
502.
echo
' <span class="step"> | </span>'
;
503.
echo
' <a class="action featured" href="#" data-id="'
.
$_pro_image_id
.
'" data-postid="'
.
$_pro_id
.
'">'
._(
'ตั้งเป็นภาพหลัก'
).
'</a>'
;
504.
echo
' </div>'
;
505.
echo
'</div>'
;
506.
507.
}
508.
echo
'</div>'
;
509.
510.
for
(
$file
=1;
$file
<= (
$images_limit
-
count
(
$_pro_images
));
$file
++){
511.
?>
512.
<p
class
=
"col-sm-6"
>
513.
<label
class
=
"inline"
>เลือกรูปที่ <?php
echo
$file
; ?> : </label>
514.
<input type=
"file"
name=
"_pro_images[]"
id=
"images<?php echo $file; ?>"
>
515.
</p>
516.
517.
<?php } ?>
518.
<div
class
=
"clear"
></div>
519.
</div>
520.
521.
</div>
522.
523.
</div>
524.
525.
</div>
526.
527.
<div
class
=
"col-md-4 col-sm-4"
>
528.
529.
530.
531.
<div
class
=
"widget contact-info"
>
532.
<h3
class
=
"widget-title"
>ข้อมูลผู้ประกาศ</h3>
533.
<div
class
=
"widget-content"
>
534.
<p
class
=
"contact-name"
>
535.
<label>ชื่อผู้ติดต่อ</label>
536.
<input
class
=
"large-text"
name=
"_pro_contact_name"
type=
"text"
value=
"<?php echo esc_html( um_user( 'display_name' ) ); ?>"
readonly />
537.
</p>
538.
<p
class
=
"phone"
>
539.
<label>เบอร์โทรผู้ติดต่อ</label>
540.
<input
class
=
"large-text"
name=
"_pro_contact_phone"
type=
"text"
value=
"<?php echo esc_html( um_user( 'phone_number' ) ); ?>"
/>
541.
</p>
542.
543.
<p
class
=
"lineid"
>
544.
<label>LINE ID</label>
545.
<input
class
=
"large-text"
name=
"_pro_contact_line_id"
type=
"text"
value=
"<?php echo $_pro_contact_line_id; ?>"
/>
546.
</p>
547.
548.
<p
class
=
"facebook"
>
549.
<label>ชื่อเฟสบุ๊ค</label>
550.
<input
class
=
"large-text"
name=
"_pro_contact_facebook"
type=
"text"
value=
"<?php echo esc_html( um_user( 'user_facebook' ) ); ?>"
/>
551.
</p>
552.
553.
<p
class
=
"email"
>
554.
<label>อีเมล์ผู้ติดต่อ</label>
555.
<input
class
=
"large-text"
name=
"_pro_contact_email"
type=
"text"
value=
"<?php echo esc_html( um_user( 'user_email' ) ); ?>"
readonly/>
556.
</p>
557.
558.
</div>
559.
560.
<div
class
=
"scatteringx"
>
561.
<label>จุดเด่น</label>
562.
<textarea
class
=
"large-text "
name=
"_pro_scattering"
cols=
"20"
rows=
"3"
><?php
echo
$_pro_scattering
; ?></textarea>
563.
</div>
564.
</div>
565.
566.
</div>
567.
</div>
568.
569.
570.
571.
572.
<div
class
=
"clear"
></div>
573.
574.
<div
class
=
"entry-footer"
>
575.
<hr />
576.
<input name=
"_pro_id"
type=
"hidden"
value=
"<?php echo $_pro_id; ?>"
>
577.
578.
579.
<input type=
"submit"
name=
"submit"
id=
"submit"
class
=
"button button-primary"
value=
"ลงประกาศ"
>
580.
581.
<?php
if
(false){ ?>
582.
<input name=
"_pro_status"
type=
"hidden"
value=
"<?php echo $_pro_status; ?>"
>
583.
584.
<?php }
else
{ ?>
585.
<select name=
"_pro_status"
class
=
"select-statu"
style=
"height: 42px; float: left; margin-right: 10px; padding: 5px;"
>
586.
<option value=
"publish"
<?php
if
(!(
strcmp
(
"publish"
,
$_pro_status
))) {
echo
"selected=\"selected\""
;} ?>>เผยแพร่(ห้ามคลิกเปลื่ยน)</option>
587.
588.
589.
</select>
590.
<?php } ?>
591.
592.
<?php
593.
if
(isset(
$_REQUEST
[
'action'
]) &&
$_REQUEST
[
'action'
]==
"update"
){
594.
wp_nonce_field(
'update_wpdt_property_submit'
,
'update_wpdt_property_submit_field'
);
595.
?>
596.
<?php
if
(
$_pro_status
==
"draft"
){ ?>
597.
<a target=
"_blank"
href=
"<?php echo esc_url( home_url( '/' ) ); ?>?p=<?php echo $_pro_id ; ?>&preview=true"
class
=
"button proview"
>(สถานะยังไม่เผยแพร่) ดูตัวอย่าง </a>
598.
<?php } ?>
599.
600.
<?php
if
(
$_pro_status
==
"publish"
){
601.
602.
if
(isset(
$_REQUEST
[
"message"
])){
603.
604.
wp_redirect( esc_url( add_query_arg(
'postid'
, get_permalink(
$_pro_id
), home_url(
'/thkpost'
) ) ) );
605.
}
606.
} ?>
607.
<?php
608.
}
else
{
609.
wp_nonce_field(
'add_wpdt_property_submit'
,
'add_wpdt_property_submit_field'
);
610.
}
611.
612.
?>
613.
</div>
614.
615.
</form>
616.
<input type=
"hidden"
id=
"submitx"
value=0>
617.
618.
<script type=
"text/javascript"
>
619.
if
(typeof $ ==
'undefined'
) {
620.
var
$ = jQuery;
621.
}
622.
623.
$(document).ready(
function
(){
624.
$(
'.number'
).number(true,2);
625.
$(
'#_pro_price_rentx'
).keyup(
function
(){
626.
var
numb = $(this).val();
627.
numb = parseFloat(numb.replace(
","
,
""
),2);
628.
console.log(numb);
629.
$(
'#_pro_price_rent'
).val(numb);
630.
});
631.
$(
'#_pro_pricex'
).keyup(
function
(){
632.
var
numb = $(this).val();
633.
numb = parseFloat(numb.replace(
","
,
""
),2);
634.
console.log(numb);
635.
$(
'#_pro_price'
).val(numb);
636.
});
637.
$(
'#wpdt_property_submit_form'
).submit(
function
(e){
638.
var
data= {};
639.
data[
"_pro_title"
] = $(
'#_pro_title'
).val();
640.
data[
"_pro_project"
] = $(
'#_pro_project'
).val();
641.
data[
"_pro_property_type"
] = false;
642.
$(
'input[name="_pro_property_type[]"]'
).each(
function
(){
643.
if
($(this).is(
':checked'
)){
644.
data[
"_pro_property_type"
] = true;
645.
}
646.
});
647.
648.
649.
650.
651.
652.
653.
654.
655.
656.
657.
658.
659.
660.
661.
662.
663.
664.
665.
666.
667.
data[
"_pro_images"
] = false;
668.
$(
'input[name="_pro_images[]"]'
).each(
function
(){
669.
if
($(this).val().length>0){
670.
data[
"_pro_images"
] = true;
671.
}
672.
});
673.
674.
data[
"_pro_type"
] = $(
'#_pro_type'
).val();
675.
data[
"_pro_location"
] = $(
'#_pro_location'
).val();
676.
data[
"_pro_address"
] = $(
'#_pro_address'
).val();
677.
data[
"_pro_voyage"
] = $(
'#_pro_voyage'
).val();
678.
data[
"_pro_price_rate"
] = $(
'#_pro_price_rate'
).val();
679.
data[
"_pro_price"
] = $(
'#_pro_price'
).val();
680.
data[
"_pro_price_rent"
] = $(
'#_pro_price_rent'
).val();
681.
data[
"_pro_tags"
] = $(
'#_pro_tags'
).val();
682.
683.
684.
var
editorContent = tinymce.get(
"_pro_description"
).getContent();
685.
if
(editorContent ==
''
){ data[
'content'
] = false; }
else
{ data[
'content'
] = true; }
686.
687.
var
allchk = true;
688.
$.each( data,
function
( key, value ) {
689.
if
(!value||value.length<1||value==
'0.00'
||value==0){
690.
if
(key==
'_pro_images'
){
691.
$(
'input'
).addClass(
'bdr'
);
692.
$(
'.photox'
).addClass(
'err'
).addClass(
'bdr'
);
693.
$(
'textarea'
).addClass(
'err'
).addClass(
'bdr'
);
694.
$(
'select'
).addClass(
'bdr'
);
695.
allchk = false;
696.
}
else
{
697.
$(
'input'
).addClass(
'bdr'
);
698.
$(
'textarea'
).addClass(
'err'
).addClass(
'bdr'
);
699.
$(
'#'
+key).addClass(
'err'
);
700.
$(
'select'
).addClass(
'bdr'
);
701.
allchk = false;
702.
}
703.
704.
}
else
{
705.
if
(key==
'_pro_images'
){
706.
$(
'.photox'
).removeClass(
'err'
).removeClass(
'bdr'
);
707.
$(
'input'
).removeClass(
'err'
).removeClass(
'bdr'
);
708.
$(
'select'
).removeClass(
'err'
).removeClass(
'bdr'
);
709.
}
else
{
710.
$(
'#'
+key).removeClass(
'err'
).removeClass(
'bdr'
);
711.
$(
'input'
).removeClass(
'err'
).removeClass(
'bdr'
);
712.
$(
'select'
).removeClass(
'err'
).removeClass(
'bdr'
);
713.
}
714.
}
715.
716.
});
717.
if
(!allchk){
718.
popme();
719.
return
false; e.preventDefault();
720.
}
721.
$(
'.site-content'
).removeClass(
'err'
);
722.
console.log(
"OK submit"
);
723.
});
724.
});
725.
726.
727.
function
popme(){
728.
alert(
'กรุณาตรวจสอบข้อมูลให้ครบอีกครั้งค่ะ'
);
729.
730.
}
731.
</script>
732.
<style>
733.
.err{ background:#FFF0D9!important; }
734.
.bdr{ border:#000 1px solid!important; }
735.
</style>