Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <div>
  3. <main id="main">
  4. <section id="services">
  5. <div class="container">
  6. <div class="col-12">
  7. <h1>Property Details</h1>
  8. </div>
  9. <main id="main" style="margin-top:-20px">
  10. <div class="container pt-5 pb-5">
  11. <div class="row my-3">
  12. <div class="col-md-6">
  13. <select
  14. class="form-control uniSelect"
  15. v-model="property.propertyUsageType"
  16. @change="UpdateUsageType"
  17. >
  18. <option>Commercial</option>
  19. <option>Residential</option>
  20. </select>
  21. </div>
  22. <div class="col-md-6">
  23. <select class="form-control uniSelect" v-model="property.statusString">
  24. <option v-for="(item, i) in statuses" :key="i">{{ item }}</option>
  25. </select>
  26. </div>
  27. </div>
  28. <div class="row my-3">
  29. <div class="col-md-6">
  30. <div v-if="!property.propertyName">
  31. <label for="propertyName" class="uniSelectLabel">PROPERTY NAME</label>
  32. </div>
  33. <input
  34. class="form-control uniInput"
  35. type="text"
  36. name="propertyName"
  37. v-model="property.propertyName"
  38. />
  39. </div>
  40. <div class="col-md-6">
  41. <div v-if="!property.propertyRef">
  42. <label for="propertyName" class="uniSelectLabel">PROPERTY REFERENCE</label>
  43. </div>
  44. <input
  45. class="form-control uniInput"
  46. type="text"
  47. name="propertyRef"
  48. v-model="property.propertyRef"
  49. />
  50. </div>
  51. </div>
  52. <div class="row my-3">
  53. <div class="col-md-6">
  54. <select
  55. class="form-control uniSelect"
  56. name="propertyType"
  57. id="propertyType"
  58. v-model="property.propertyTypeId"
  59. >
  60. <option value="0">Please select type *</option>
  61. <option
  62. v-for="item in propertyTypes"
  63. :value="item.id"
  64. :key="item.id"
  65. >{{ item.description }}</option>
  66. </select>
  67. </div>
  68. <div v-if="property.propertyUsageType === 'Commercial'" class="col-md-2">
  69. <div v-if="!property.unit">
  70. <label for="unit" class="uniSelectLabel">UNIT</label>
  71. </div>
  72. <input
  73. class="form-control uniInput"
  74. type="text"
  75. name="unit"
  76. id="unit"
  77. v-model="property.unit"
  78. />
  79. </div>
  80. </div>
  81. <div class="row my-3">
  82. <div class="col-md-6">
  83. <mapSection
  84. v-on:map-location="updateLocation"
  85. :savedCoords="property.propertCoords"
  86. />
  87. <input
  88. type="checkbox"
  89. v-model="property.showAddress"
  90. style="margin-right: 10px; margin-top: 10px;"
  91. />
  92. <label>Show address on listing</label>
  93. </div>
  94. <div class="col-md-6">
  95. <div class="row">
  96. <div class="col-md-6">
  97. <div v-if="property.price < 1">
  98. <label
  99. for="price"
  100. class="uniSelectLabel"
  101. style="text-transform:uppercase; margin-left:17px; background-color:white"
  102. >{{ property.salesTypeString }} Price</label>
  103. </div>
  104. <input
  105. class="form-control uniInput"
  106. type="number"
  107. name="price"
  108. id="price"
  109. v-model="property.price"
  110. />
  111. </div>
  112. <div v-if="property.salesTypeString === 'Rental'" class="col-md-6">
  113. <select
  114. class="form-control uniSelect"
  115. name="propertyType"
  116. id="propertyType"
  117. v-model="property.pricePer"
  118. >
  119. <option value>Please select</option>
  120. <option value="Month">Month</option>
  121. <option value="Day">Day</option>
  122. </select>
  123. </div>
  124. </div>
  125. <div class="row my-3">
  126. <div class="col-md-12">
  127. <input
  128. type="date"
  129. class="form-control uniInput"
  130. name="date"
  131. v-model="property.dateAvailable"
  132. />
  133. </div>
  134. </div>
  135. <div class="row my-3">
  136. <br />
  137. </div>
  138. <div class="row my-3">
  139. <div class="col-md-12">
  140. <div v-if="!property.streetNumber">
  141. <label for="streetNumber" class="uniSelectLabel">STREET NUMBER</label>
  142. </div>
  143. <input
  144. class="form-control uniInput"
  145. type="text"
  146. name="streetNumber"
  147. id="unit"
  148. v-model="property.streetNumber"
  149. disabled
  150. />
  151. </div>
  152. </div>
  153. <div class="row my-3">
  154. <div class="col-md-12">
  155. <div v-if="!property.streetName">
  156. <label for="streetName" class="uniSelectLabel">STREET NAME</label>
  157. </div>
  158. <input
  159. class="form-control uniInput"
  160. type="text"
  161. name="streetName"
  162. id="unit"
  163. v-model="property.streetName"
  164. disabled
  165. />
  166. </div>
  167. </div>
  168. <div class="row my-3">
  169. <div class="col-md-12">
  170. <div v-if="!property.suburb">
  171. <label for="suburb" class="uniSelectLabel">SUBURB</label>
  172. </div>
  173. <input
  174. class="form-control uniInput"
  175. type="text"
  176. name="suburb"
  177. id="unit"
  178. v-model="property.suburb"
  179. disabled
  180. />
  181. </div>
  182. </div>
  183. <div class="row my-3">
  184. <div class="col-md-12">
  185. <div v-if="!property.city">
  186. <label for="city" class="uniSelectLabel">CITY</label>
  187. </div>
  188. <input
  189. class="form-control uniInput"
  190. type="text"
  191. name="city"
  192. id="unit"
  193. v-model="property.city"
  194. disabled
  195. />
  196. </div>
  197. </div>
  198. <div class="row my-3">
  199. <div class="col-md-12">
  200. <div v-if="!property.province">
  201. <label for="province" class="uniSelectLabel">PROVINCE</label>
  202. </div>
  203. <input
  204. class="form-control uniInput"
  205. type="text"
  206. name="province"
  207. id="unit"
  208. v-model="property.province"
  209. disabled
  210. />
  211. </div>
  212. </div>
  213. <div class="row my-3">
  214. <div class="col-md-12">
  215. <div v-if="!property.postalCode">
  216. <label for="postalCode" class="uniSelectLabel">POSTAL CODE</label>
  217. </div>
  218. <input
  219. class="form-control uniInput"
  220. type="text"
  221. name="postalCode"
  222. id="unit"
  223. v-model="property.postalCode"
  224. disabled
  225. />
  226. </div>
  227. </div>
  228. <div class="row my-3">
  229. <div class="col-md-12">
  230. <div v-if="!property.country">
  231. <label for="country" class="uniSelectLabel">COUNTRY</label>
  232. </div>
  233. <input
  234. class="form-control uniInput"
  235. type="text"
  236. name="country"
  237. id="unit"
  238. v-model="property.country"
  239. disabled
  240. />
  241. </div>
  242. </div>
  243. <div class="row my-3">
  244. <div class="col-md-12">
  245. <button
  246. type="button"
  247. @click="clearAddress()"
  248. class="btn-solid-blue"
  249. >Clear Address</button>
  250. </div>
  251. </div>
  252. </div>
  253. </div>
  254. <div class="row">
  255. <div class="col-md-12">
  256. <label for="Property Description" style="font-family:'muli'">Description:</label>
  257. <vue-editor v-model="property.description" :editor-toolbar="customToolbar" />
  258. <br />
  259. <p>
  260. * A listing fee of R380 including VAT is payable to list your Property on the
  261. Uni-Vate website
  262. </p>
  263. </div>
  264. </div>
  265. <div class="row">
  266. <div class="section-header">
  267. <h2>Property Information</h2>
  268. </div>
  269. <div class="row mb-3" v-for="item in propertyFields" :key="item.id">
  270. <div class="col-md-6" v-for="field in item.fields" :key="field.id">
  271. <div v-if="field.type === 'number'">
  272. {{ field.name }}
  273. <input
  274. type="number"
  275. class="form-control uniInput"
  276. v-model="field.value"
  277. />
  278. </div>
  279. <div v-else class="display:none"></div>
  280. <div v-if="field.type === 'yesno'">
  281. {{ field.name }}
  282. <input type="checkbox" v-model="field.value" />
  283. </div>
  284. </div>
  285. </div>
  286. </div>
  287. <div class="row">
  288. <div class="col-sm-12">
  289. <div class="section-header">
  290. <h2>Media</h2>
  291. </div>
  292. </div>
  293. </div>
  294. <div class="form-group row">
  295. <div class="col-md-12">
  296. <label class="uniSelectLabel">Virtual Tour (URL)</label>
  297. <div class="input-group-prepend">
  298. <input
  299. class="form-control uniInput"
  300. type="link"
  301. name="vtlink"
  302. id="vtlink"
  303. v-model="property.virtualTour"
  304. />
  305. </div>
  306. </div>
  307. </div>
  308. <div class="row">
  309. <div class="col-md-12">
  310. <label class="uniSelectLabel">Video (URL)</label>
  311. <div class="input-group-prepend">
  312. <input
  313. class="form-control uniInput"
  314. type="link"
  315. name="vlink"
  316. id="vlink"
  317. v-model="property.video"
  318. />
  319. </div>
  320. </div>
  321. </div>
  322. <div class="row mt-3">
  323. <div class="col-md-6">
  324. <div class="content-header">
  325. <h2>Images</h2>
  326. </div>
  327. <div class="input-group-prepend"></div>
  328. </div>
  329. </div>
  330. <ImageLoad
  331. :savedImaged="propertyImages"
  332. :loadedImages="loadedImages"
  333. @DefaultImage="UpdateDefaultImage"
  334. />
  335. <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">Save</button>
  336. <button v-if="!wait" type="button" @click="Close()" class="btn-solid-blue">Close</button>
  337. <div v-if="showPropertyTypeError">
  338. <p
  339. class="alert myError"
  340. >Missing fields. Please fill in all required fields. Marked with *</p>
  341. </div>
  342. <div v-if="!addressSet">
  343. <p class="alert myError">Please enter an address.</p>
  344. </div>
  345. <div v-if="wait" id="preloader"></div>
  346. </div>
  347. </main>
  348. </div>
  349. </section>
  350. </main>
  351. </div>
  352. </template>
  353. <script>
  354. /* eslint-disable */
  355. import { mapState, mapActions } from "vuex";
  356. import mapSection from "../mapSection";
  357. import ImageLoad from "../propertyImage";
  358. import _ from "lodash";
  359. export default {
  360. components: {
  361. mapSection,
  362. ImageLoad,
  363. },
  364. data() {
  365. return {
  366. addressSet: true,
  367. defaultImage: 0,
  368. images: [],
  369. wait: false,
  370. };
  371. },
  372. methods: {
  373. ...mapActions("property", [
  374. "getProperty",
  375. "getPropertyTypes",
  376. "getPropertyFields",
  377. "updateProperty",
  378. ]),
  379. clearAddress() {
  380. this.addressSet = false;
  381. this.property.streetNumber = undefined;
  382. this.property.streetName = undefined;
  383. this.property.suburb = undefined;
  384. this.property.city = undefined;
  385. this.property.province = undefined;
  386. this.property.country = undefined;
  387. this.property.postalCode = undefined;
  388. this.property.addressUrl = undefined;
  389. this.property.propertCoords = undefined;
  390. },
  391. UpdateUsageType() {
  392. this.getPropertyTypes(this.property.propertyUsageType);
  393. this.getPropertyFields(this.property.propertyUsageType);
  394. },
  395. UpdateDefaultImage(item) {
  396. this.defaultImage = item;
  397. },
  398. loadedImages(values) {
  399. this.images = values;
  400. },
  401. SubmitData() {
  402. this.wait = true;
  403. this.property.propertyFields = this.propertyFields;
  404. if (this.images.length > 0) {
  405. this.property.newImages = [];
  406. }
  407. // eslint-disable-next-line no-plusplus
  408. for (let i = 0; i < this.images.length; i++) {
  409. let setAsDefault = false;
  410. if (i === this.defaultImage) {
  411. setAsDefault = true;
  412. }
  413. this.property.newImages.push({
  414. image: this.images[i],
  415. isDefault: setAsDefault,
  416. });
  417. }
  418. this.updateProperty(this.property).then((fulfilled) => {
  419. this.$router.push("/PropertyAdmin");
  420. });
  421. },
  422. Close() {
  423. this.$router.push("/PropertyAdmin");
  424. },
  425. updateLocation(place) {
  426. this.addressSet = true;
  427. this.property.streetNumber = place.streetNumber;
  428. this.property.streetName = place.streetName;
  429. this.property.suburb = place.suburb;
  430. this.property.city = place.city;
  431. this.property.province = place.province;
  432. this.property.country = place.country;
  433. this.property.postalCode = place.postalCode;
  434. this.property.addressUrl = place.url;
  435. this.property.propertCoords = place.coords;
  436. },
  437. },
  438. mounted() {
  439. this.wait = false;
  440. this.getProperty(this.$route.params.id);
  441. },
  442. computed: {
  443. ...mapState("property", [
  444. "property",
  445. "propertyTypes",
  446. "propertyImages",
  447. "propertyFields",
  448. "statuses",
  449. ]),
  450. },
  451. };
  452. </script>
  453. <style lang="scss" scoped></style>