Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

contentSectionNew.vue 67KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832
  1. <template>
  2. <div v-if="userLoggedIn">
  3. <section v-if="boolLoaded">
  4. <div class="container">
  5. <div v-if="boolMessage" class="row">
  6. <div class="col">
  7. <alert
  8. :text="'Your In formation has been sent!'"
  9. :type="'SUCCESS'"
  10. />
  11. </div>
  12. </div>
  13. <div v-if="boolValidationError" class="row">
  14. <div class="col">
  15. <alert :text="errorMessage" :type="errorOccurred" />
  16. </div>
  17. </div>
  18. <div class="row">
  19. <div class="col-sm-12">
  20. <div class="section-header">
  21. <h2>Week Information</h2>
  22. </div>
  23. <div align="left" class="custom-control custom-switch mb-2">
  24. <div class="row">
  25. <div align="center" class="col">
  26. <label class="mr-5">Were you referred by an agent?</label>
  27. <input
  28. type="checkbox"
  29. class="custom-control-input"
  30. id="customSwitch1"
  31. :checked="refAgent"
  32. @change="changeRef"
  33. />
  34. <label class="custom-control-label" for="customSwitch1">
  35. {{ refAgent ? 'Yes' : 'No' }}
  36. </label>
  37. <div
  38. class="refbyAgent"
  39. :class="{ 'refbyAgent--clicked': refAgent }"
  40. >
  41. <div class="col-md-6" v-if="refAgent">
  42. <label for="Name of Agency">Agency</label>
  43. <select
  44. class="form-control uniSelect"
  45. id="Agency"
  46. name="agency"
  47. v-model="sellItem.agencyId"
  48. >
  49. <!-- <option value=""></option> -->
  50. <option
  51. v-for="(item, i) in agencies"
  52. :key="i"
  53. :value="item.id"
  54. >
  55. {{ item.agencyName }}
  56. </option>
  57. </select>
  58. </div>
  59. <div class="col-md-6" v-if="refAgent">
  60. <label for="Name of Agent">Agent</label>
  61. <select
  62. class="form-control uniSelect"
  63. id="agent"
  64. name="agent"
  65. v-model="sellItem.agentId"
  66. :disabled="!sellItem.agencyId"
  67. >
  68. <!-- <option value=""></option> -->
  69. <option
  70. v-for="(item, i) in displayNotDeletedAgents"
  71. :key="i"
  72. :value="item.id"
  73. >
  74. <div>{{ item.name + ' ' + item.surname }}</div>
  75. </option>
  76. </select>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. <div class="form">
  83. <!-- <div id="sendmessage">Your details has been sent. Thank you!</div> -->
  84. <div id="errormessage"></div>
  85. <div class="form-row">
  86. <div class="col-md-6 mt-2">
  87. <div class="form-group">
  88. <label
  89. v-if="!sellItem.region"
  90. class="uniSelectLabel"
  91. for="weekInfoRegionSelect"
  92. >
  93. Region
  94. </label>
  95. <float-label label="Region" style="width: 100%;">
  96. <select
  97. id="weekInfoRegionSelect"
  98. class="form-control uniSelect"
  99. v-model="sellItem.region"
  100. @change="regionChange()"
  101. v-bind:class="{
  102. 'is-valid': sellItem.region,
  103. 'is-invalid':
  104. !requiredField(sellItem.region) && regionLoad,
  105. }"
  106. v-on:keyup="regionLoad = true"
  107. v-on:blur="regionLoad = true"
  108. >
  109. <option
  110. v-for="(region, r) in regions"
  111. :key="r"
  112. :value="region"
  113. >
  114. {{ region.regionName }}
  115. </option>
  116. </select>
  117. <div class="invalid-feedback">
  118. Please select a region!
  119. </div>
  120. </float-label>
  121. </div>
  122. </div>
  123. <div class="col-md-6 mt-2">
  124. <div class="form-group">
  125. <label
  126. v-if="!sellItem.resort"
  127. class="uniSelectLabel"
  128. for="weekInfoResortSelect"
  129. >
  130. Resort Name
  131. </label>
  132. <float-label label="Resort Name" style="width: 100%;">
  133. <select
  134. id="weekInfoResortSelect"
  135. class="form-control uniSelect"
  136. v-model="sellItem.resort"
  137. @change="resortChange()"
  138. v-bind:class="{
  139. 'is-valid': sellItem.resort,
  140. 'is-invalid':
  141. !requiredField(sellItem.resort) && resortLoad,
  142. }"
  143. v-on:keyup="resortLoad = true"
  144. v-on:blur="resortLoad = true"
  145. >
  146. <option value="Other">Other</option>
  147. <option
  148. v-for="(res, r) in filteredResort"
  149. :key="r"
  150. :value="res"
  151. >
  152. {{ res.resortName }}
  153. </option>
  154. </select>
  155. <div class="invalid-feedback">
  156. Please select a resort!
  157. </div>
  158. </float-label>
  159. </div>
  160. </div>
  161. </div>
  162. <div v-if="sellItem.otherResort">
  163. <div class="form-row">
  164. <div class="col-md-6 mt-2">
  165. <div class="form-group">
  166. <float-label
  167. label="Other Resort Name"
  168. style="width: 100%;"
  169. >
  170. <input
  171. type="text"
  172. name="other"
  173. id="other"
  174. v-model="sellItem.otherResortName"
  175. class="form-control uniInput"
  176. v-if="sellItem.otherResort"
  177. v-bind:class="{
  178. 'is-valid': sellItem.otherResortName,
  179. 'is-invalid':
  180. !requiredField(sellItem.otherResortName) &&
  181. otherResortLoad,
  182. }"
  183. v-on:keyup="otherResortLoad = true"
  184. v-on:blur="otherResortLoad = true"
  185. placeholder="Other Resort Name"
  186. />
  187. <div class="invalid-feedback">
  188. Other Resort Name is required!
  189. </div>
  190. </float-label>
  191. </div>
  192. </div>
  193. <div class="form-row"></div>
  194. <div class="col-md-6 mt-2">
  195. <div class="form-group">
  196. <label
  197. v-if="!sellItem.region"
  198. class="uniSelectLabel"
  199. for="otherResortregion"
  200. >
  201. Region
  202. </label>
  203. <float-label label="Region" style="width: 100%;">
  204. <select
  205. id="otherResortRegion"
  206. name="otherResortRegion"
  207. class="form-control uniSelect"
  208. v-if="sellItem.otherResort"
  209. v-model="sellItem.region"
  210. v-bind:class="{
  211. 'is-valid': sellItem.region,
  212. 'is-invalid':
  213. !requiredField(sellItem.region) &&
  214. otherResorRegionLoad,
  215. }"
  216. v-on:keyup="otherResortRegionLoad = true"
  217. v-on:blur="otherResortRegionLoad = true"
  218. >
  219. <option
  220. v-for="(region, r) in regions"
  221. :key="r"
  222. :value="region"
  223. >
  224. {{ region.regionName }}
  225. </option>
  226. </select>
  227. <div class="invalid-feedback">
  228. Please select a region!
  229. </div>
  230. </float-label>
  231. </div>
  232. </div>
  233. </div>
  234. </div>
  235. <div class="form-row">
  236. <div class="col-md-6 mt-2">
  237. <div class="form-group">
  238. <float-label label="Unit Number" style="width: 100%;">
  239. <input
  240. type="text"
  241. class="form-control uniInput"
  242. name="unitNumber"
  243. id="unitNumber"
  244. v-model="sellItem.unitNumber"
  245. v-bind:class="{
  246. 'is-valid': sellItem.unitNumber,
  247. 'is-invalid':
  248. !requiredField(sellItem.unitNumber) &&
  249. unitNumberLoad,
  250. }"
  251. v-on:keyup="unitNumberLoad = true"
  252. v-on:blur="unitNumberLoad = true"
  253. placeholder="Unit Number"
  254. />
  255. <div class="invalid-feedback">
  256. Unit Number is required!
  257. </div>
  258. </float-label>
  259. </div>
  260. </div>
  261. <div class="col-md-6 mt-2">
  262. <div class="form-group">
  263. <float-label label="Week Module" style="width: 100%;">
  264. <input
  265. type="text"
  266. class="form-control uniInput"
  267. name="week"
  268. id="week"
  269. v-model="sellItem.module"
  270. data-msg="Please enter week number"
  271. v-bind:class="{
  272. 'is-valid': sellItem.module,
  273. 'is-invalid':
  274. !requiredField(sellItem.module) && moduleLoad,
  275. }"
  276. v-on:keyup="moduleLoad = true"
  277. v-on:blur="moduleLoad = true"
  278. placeholder="Week Module"
  279. />
  280. <div class="invalid-feedback">
  281. Week Module is required!
  282. </div>
  283. </float-label>
  284. </div>
  285. </div>
  286. </div>
  287. <div class="form-row">
  288. <div class="col-md-6 mt-2">
  289. <div class="form-group">
  290. <label
  291. v-if="!sellItem.season"
  292. class="uniSelectLabel"
  293. for="season"
  294. >
  295. Season
  296. </label>
  297. <float-label label="Season" style="width: 100%;">
  298. <select
  299. id="season"
  300. name="season"
  301. class="form-control uniSelect"
  302. v-model="sellItem.season"
  303. v-bind:class="{
  304. 'is-valid': sellItem.season,
  305. 'is-invalid':
  306. !requiredField(sellItem.season) && seasonLoad,
  307. }"
  308. v-on:keyup="seasonLoad = true"
  309. v-on:blur="seasonLoad = true"
  310. >
  311. <option v-for="(season, r) in seasons" :key="r">
  312. {{ season.name }}
  313. </option>
  314. </select>
  315. <div class="invalid-feedback">
  316. Please select a season!
  317. </div>
  318. </float-label>
  319. </div>
  320. </div>
  321. <div class="col-md-6 mt-2">
  322. <div class="form-group">
  323. <label
  324. v-if="!sellItem.bedrooms"
  325. class="uniSelectLabel"
  326. for="bedrooms"
  327. >
  328. Bedroom/s
  329. </label>
  330. <float-label label="Bedroom/s" style="width: 100%;">
  331. <select
  332. id="bedrooms"
  333. name="bedrooms"
  334. class="form-control uniSelect"
  335. v-model="sellItem.bedrooms"
  336. v-bind:class="{
  337. 'is-valid': sellItem.bedrooms,
  338. 'is-invalid':
  339. !requiredField(sellItem.bedrooms) && bedroomsLoad,
  340. }"
  341. v-on:keyup="bedroomsLoad = true"
  342. v-on:blur="bedroomsLoad = true"
  343. >
  344. <option
  345. v-for="(item, i) in resortBedrooms"
  346. :key="i"
  347. :value="item"
  348. >
  349. {{ item }}
  350. </option>
  351. </select>
  352. <div class="invalid-feedback">
  353. Please select Bedroom/s!
  354. </div>
  355. </float-label>
  356. </div>
  357. </div>
  358. </div>
  359. <div class="form-row">
  360. <div class="col-md-6 mt-2">
  361. <div class="form-group">
  362. <label
  363. v-if="!sellItem.maxSleep"
  364. class="uniSelectLabel"
  365. for="maxSleep"
  366. >
  367. Max Sleeper
  368. </label>
  369. <float-label label="Max Sleeper" style="width: 100%;">
  370. <select
  371. id="maxSleep"
  372. name="maxSleep"
  373. class="form-control uniSelect"
  374. v-model="sellItem.maxSleep"
  375. v-bind:class="{
  376. 'is-valid': sellItem.maxSleep,
  377. 'is-invalid':
  378. !requiredField(sellItem.maxSleep) && maxSleepLoad,
  379. }"
  380. v-on:keyup="maxSleepLoad = true"
  381. v-on:blur="maxSleepLoad = true"
  382. >
  383. <option
  384. v-for="(item, i) in maxSleep"
  385. :key="i"
  386. :value="item"
  387. >
  388. {{ item }}
  389. </option>
  390. </select>
  391. <div class="invalid-feedback">
  392. Please select maximum sleeper!
  393. </div>
  394. </float-label>
  395. </div>
  396. </div>
  397. <div class="col-md-6 mt-2">
  398. <div class="form-group">
  399. <float-label label="Levy Amount" style="width: 100%;">
  400. <input
  401. type="number"
  402. id="levy"
  403. v-model="sellItem.levyAmount"
  404. class="form-control uniInput"
  405. placeholder="Levy Amount"
  406. v-bind="money"
  407. v-bind:class="{
  408. 'is-valid': sellItem.levyAmount,
  409. 'is-invalid':
  410. !requiredField(sellItem.levyAmount) &&
  411. levyAmountLoad,
  412. }"
  413. v-on:keyup="levyAmountLoad = true"
  414. v-on:blur="levyAmountLoad = true"
  415. />
  416. <div class="invalid-feedback">
  417. Levy Amount is required!
  418. </div>
  419. </float-label>
  420. </div>
  421. </div>
  422. </div>
  423. <div class="form-row">
  424. <div class="col-md-6 mt-2">
  425. <div class="form-group">
  426. <label
  427. v-if="!sellItem.weekType"
  428. class="uniSelectLabel"
  429. for="weekType"
  430. >
  431. Week Type
  432. </label>
  433. <float-label label="Week Type" style="width: 100%;">
  434. <select
  435. id="weekType"
  436. name="weekType"
  437. class="form-control uniSelect"
  438. v-model="sellItem.weekType"
  439. v-bind:class="{
  440. 'is-valid': sellItem.weekType,
  441. 'is-invalid':
  442. !requiredField(sellItem.weekType) && weekTypeLoad,
  443. }"
  444. v-on:keyup="weekTypeLoad = true"
  445. v-on:blur="weekTypeLoad = true"
  446. >
  447. <option value="0" :key="0">Flexi</option>
  448. <option value="1" :key="1">Fixed</option>
  449. <option value="2" :key="2">Module</option>
  450. <option value="3" :key="3">Syndicate</option>
  451. </select>
  452. <div class="invalid-feedback">
  453. Please select Week Type!
  454. </div>
  455. </float-label>
  456. </div>
  457. </div>
  458. </div>
  459. </div>
  460. <div class="row">
  461. <div align="left" class="custom-control custom-switch mb-2">
  462. <div class="row">
  463. <div align="center" class="col">
  464. <label class="mr-5">
  465. Has your week been spacebanked for the current year?
  466. </label>
  467. <input
  468. type="checkbox"
  469. class="custom-control-input"
  470. id="customSwitch2"
  471. :checked="sellItem.currentYearBanked"
  472. @change="changeCurrentBanked"
  473. />
  474. <label class="custom-control-label" for="customSwitch2">
  475. {{ sellItem.currentYearBanked ? 'Yes' : 'No' }}
  476. </label>
  477. <div
  478. class="spacebanked1"
  479. :class="{
  480. 'spacebanked1--clicked': sellItem.currentYearBanked,
  481. }"
  482. >
  483. <div class="col-md-6">
  484. <label
  485. for="If yes, please confirm with whom"
  486. v-if="sellItem.currentYearBanked"
  487. >
  488. Please confirm with whom
  489. </label>
  490. <select
  491. class="form-control uniSelect"
  492. name="spacebankOwner"
  493. v-if="sellItem.currentYearBanked"
  494. v-model="sellItem.bankedWith"
  495. v-bind:class="{
  496. 'is-valid': sellItem.bankedWith,
  497. 'is-invalid':
  498. !requiredField(sellItem.bankedWith) &&
  499. bankedWithLoad,
  500. }"
  501. v-on:keyup="bankedWithLoad = true"
  502. v-on:blur="bankedWithLoad = true"
  503. >
  504. <option v-for="(item, i) in bankedEntities" :key="i">
  505. {{ item }}
  506. </option>
  507. </select>
  508. <div class="invalid-feedback">
  509. Please select a Banking Entity!
  510. </div>
  511. </div>
  512. </div>
  513. </div>
  514. </div>
  515. </div>
  516. <div class="section-header">
  517. <h2>Detailed Individual Information</h2>
  518. </div>
  519. <div class="form">
  520. <div class="row mb-4">
  521. <div class="col-md-12">
  522. <float-label label="Owner Type" fixed>
  523. <select
  524. class="form-control uniSelect"
  525. name="ownerType"
  526. id="ownerType"
  527. v-model="selectedUserType"
  528. @change="userChange()"
  529. v-bind:class="{
  530. 'is-valid': selectedUserType,
  531. 'is-invalid':
  532. !requiredField(selectedUserType) &&
  533. selectedUserTypeLoad,
  534. }"
  535. v-on:keyup="selectedUserTypeLoad = true"
  536. v-on:blur="selectedUserTypeLoad = true"
  537. >
  538. <option value="myself">Myself</option>
  539. <option value="custom">Custom User</option>
  540. </select>
  541. </float-label>
  542. </div>
  543. </div>
  544. <div class="row mb-2">
  545. <div class="form-group col-md-6">
  546. <float-label label="Name" style="width: 100%;">
  547. <input
  548. type="text"
  549. name="name"
  550. class="form-control uniSelect"
  551. :disabled="ChangeCustomUser"
  552. id="name"
  553. placeholder="Name"
  554. data-rule="minlen:4"
  555. data-msg="Please enter your name"
  556. v-model="indiv.name"
  557. v-bind:class="{
  558. 'is-valid': indiv.name,
  559. 'is-invalid': !requiredField(indiv.name) && nameLoad,
  560. }"
  561. v-on:keyup="nameLoad = true"
  562. v-on:blur="nameLoad = true"
  563. />
  564. <div class="invalid-feedback">Name is Required!</div>
  565. </float-label>
  566. </div>
  567. <div class="form-group col-md-6">
  568. <float-label label="Surname" style="width: 100%;">
  569. <input
  570. type="text"
  571. class="form-control uniSelect"
  572. :disabled="ChangeCustomUser"
  573. name="surname"
  574. id="surname"
  575. placeholder="Surname"
  576. data-msg="Please enter your surname"
  577. v-model="indiv.surname"
  578. v-bind:class="{
  579. 'is-valid': indiv.surname,
  580. 'is-invalid':
  581. !requiredField(indiv.surname) && surnameLoad,
  582. }"
  583. v-on:keyup="surnameLoad = true"
  584. v-on:blur="surnameLoad = true"
  585. />
  586. <div class="invalid-feedback">Surname is Required!</div>
  587. </float-label>
  588. </div>
  589. </div>
  590. <div class="row mb-2">
  591. <div class="form-group col-md-6">
  592. <float-label>
  593. <input
  594. type="text"
  595. name="idnum"
  596. class="form-control uniSelect"
  597. :disabled="ChangeCustomUser"
  598. id="idnum"
  599. placeholder="ID Number"
  600. data-rule="minlen:4"
  601. data-msg="Please enter your ID number"
  602. v-model="indiv.idNumber"
  603. v-bind:class="{
  604. 'is-valid': indiv.idNumber,
  605. }"
  606. />
  607. </float-label>
  608. </div>
  609. <div class="form-group col-md-6">
  610. <float-label>
  611. <input
  612. type="text"
  613. class="form-control uniSelect"
  614. :disabled="ChangeCustomUser"
  615. name="company"
  616. id="company"
  617. placeholder="Company Reg Number"
  618. data-rule="minlen:4"
  619. data-msg="Please enter your company reg number"
  620. v-model="indiv.companyRegNumber"
  621. v-bind:class="{
  622. 'is-valid': indiv.companyRegNumber,
  623. }"
  624. />
  625. <div class="invalid-feedback">
  626. Company Registration Number is required!
  627. </div>
  628. </float-label>
  629. </div>
  630. </div>
  631. <div class="row mb-2">
  632. <div class="form-group col-md-6">
  633. <div class="input-group">
  634. <span v-if="!indiv.howMarried">
  635. <label
  636. v-if="indiv.howMarried === 'N/A'"
  637. for="howMarried"
  638. class="uniSelectLabel"
  639. >
  640. Marital Status
  641. </label>
  642. </span>
  643. <float-label
  644. fixed
  645. label="Marital Status"
  646. style="width: 100%;"
  647. >
  648. <select
  649. class="form-control uniSelect"
  650. id="howMarried"
  651. :disabled="ChangeCustomUser"
  652. v-model="indiv.howMarried"
  653. v-bind:class="{
  654. 'is-valid': indiv.howMarried,
  655. }"
  656. >
  657. <option v-bind:value="0">N/A</option>
  658. <option v-bind:value="1">
  659. In Community Of Property
  660. </option>
  661. <option v-bind:value="2">
  662. Out of Community Of Property
  663. </option>
  664. <option v-bind:value="3">Other</option>
  665. <option v-bind:value="4">Traditional Wedding</option>
  666. <option v-bind:value="5">Single</option>
  667. <option v-bind:value="6">Divorced</option>
  668. <option v-bind:value="7">Widow</option>
  669. <option v-bind:value="8">
  670. Committed Relationship
  671. </option>
  672. <option v-bind:value="9">Partner</option>
  673. </select>
  674. </float-label>
  675. </div>
  676. </div>
  677. <div class="form-group col-md-6">
  678. <float-label label="Email Address" style="width: 100%;">
  679. <input
  680. type="text"
  681. class="form-control uniInput"
  682. name="email"
  683. :disabled="ChangeCustomUser"
  684. id="email"
  685. placeholder="Email Address"
  686. data-msg="Please enter your email address"
  687. v-model="indiv.emailAddress"
  688. v-bind:class="{
  689. 'is-valid': indiv.emailAddress,
  690. 'is-invalid':
  691. !validEmail(indiv.emailAddress) && emailAddressLoad,
  692. }"
  693. v-on:keyup="emailAddressLoad = true"
  694. v-on:blur="emailAddressLoad = true"
  695. />
  696. <div class="invalid-feedback">
  697. Valid Email address is Required!
  698. </div>
  699. </float-label>
  700. </div>
  701. </div>
  702. <div class="row">
  703. <div class="form-group col-md-6">
  704. <float-label label="Cell Number" style="width: 100%;">
  705. <input
  706. type="text"
  707. name="cell"
  708. class="form-control uniSelect"
  709. :disabled="ChangeCustomUser"
  710. id="cell"
  711. placeholder="Cell Number"
  712. data-rule="minlen:4"
  713. data-msg="Please enter your cell number"
  714. v-model="indiv.cellNumber"
  715. v-bind:class="{
  716. 'is-valid':
  717. indiv.cellNumber &&
  718. validPhoneNumber(indiv.cellNumber),
  719. 'is-invalid':
  720. !requiredField(indiv.cellNumber) ||
  721. (indiv.cellNumber &&
  722. !validPhoneNumber(indiv.cellNumber) &&
  723. cellNumberLoad),
  724. }"
  725. v-on:keyup="cellNumberLoad = true"
  726. v-on:blur="cellNumberLoad = true"
  727. />
  728. <div class="invalid-feedback">
  729. Cell Number is Required!
  730. </div>
  731. </float-label>
  732. </div>
  733. <div class="form-group col-md-6">
  734. <float-label label="Landline Number" style="width: 100%;">
  735. <input
  736. type="text"
  737. class="form-control uniSelect"
  738. :disabled="ChangeCustomUser"
  739. name="landline"
  740. id="landline"
  741. placeholder="Landline Number"
  742. data-msg="Please enter your landline number"
  743. v-model="indiv.landlineNumber"
  744. v-bind:class="{
  745. 'is-valid':
  746. indiv.landlineNumber &&
  747. validPhoneNumber(indiv.landlineNumber),
  748. 'is-invalid':
  749. indiv.landlineNumber &&
  750. !validPhoneNumber(indiv.landlineNumber),
  751. }"
  752. v-on:keyup="landlineNumberLoad = true"
  753. v-on:blur="landlineNumberLoad = true"
  754. />
  755. <div class="invalid-feedback">
  756. Valid landline number is required!
  757. </div>
  758. </float-label>
  759. </div>
  760. </div>
  761. </div>
  762. <div v-if="indiv.howMarried === 1" class="section-header">
  763. <h2>Spouse Details</h2>
  764. </div>
  765. <div v-if="indiv.howMarried === 1" class="form">
  766. <div class="form-row mb-2">
  767. <div class="form-group col-md-6 mt-2">
  768. <float-label label="Spouse Name" style="width: 100%;">
  769. <input
  770. type="text"
  771. class="form-control uniSelect"
  772. placeholder="Spouse Name"
  773. data-msg="Please enter your spouse's name"
  774. v-model="indiv.spouseName"
  775. v-bind:class="{ 'is-valid': indiv.spouseName }"
  776. />
  777. </float-label>
  778. </div>
  779. <div class="form-group col-md-6 mt-2">
  780. <float-label
  781. fixed
  782. label="Spouse Surname"
  783. style="width: 100%;"
  784. >
  785. <input
  786. type="text"
  787. class="form-control uniInput"
  788. placeholder="Spouse Surname"
  789. data-msg="Please enter your spouse's surname"
  790. v-model="indiv.spouseSurname"
  791. v-bind:class="{ 'is-valid': indiv.spouseSurname }"
  792. />
  793. </float-label>
  794. </div>
  795. <div class="form-group col-md-6 mt-2">
  796. <float-label label="Spouse Email" style="width: 100%;">
  797. <input
  798. type="email"
  799. class="form-control uniSelect"
  800. placeholder="Spouse Email"
  801. data-rule="minlen:4"
  802. data-msg="Please enter your spouse's email"
  803. v-model="indiv.spouseEmail"
  804. v-bind:class="{
  805. 'is-valid': indiv.spouseEmail,
  806. 'is-invalid':
  807. !validEmail(indiv.spouseEmail) && spouseEmailLoad,
  808. }"
  809. v-on:keyup="spouseEmailLoad = true"
  810. v-on:blur="spouseEmailLoad = true"
  811. />
  812. <div class="invalid-feedback">
  813. Valid Email address is Required!
  814. </div>
  815. </float-label>
  816. </div>
  817. <div class="form-group col-md-6 mt-2">
  818. <float-label label="Spouse Telephone" style="width: 100%;">
  819. <input
  820. type="text"
  821. class="form-control uniSelect"
  822. placeholder="Spouse Telephone"
  823. data-rule="minlen:4"
  824. data-msg="Please enter your spouse's telephone number"
  825. v-model="indiv.spouseTelephone"
  826. v-bind:class="{ 'is-valid': indiv.spouseTelephone }"
  827. />
  828. </float-label>
  829. </div>
  830. <div class="form-group col-md-6 mt-2">
  831. <float-label
  832. label="Spouse Cell Number"
  833. style="width: 100%;"
  834. >
  835. <input
  836. type="text"
  837. class="form-control uniSelect"
  838. placeholder="Spouse Cell Number"
  839. data-rule="minlen:4"
  840. data-msg="Please enter your spouse's cellphone number"
  841. v-model="indiv.spouseCellnumber"
  842. v-bind:class="{ 'is-valid': indiv.spouseCellNumber }"
  843. />
  844. </float-label>
  845. </div>
  846. </div>
  847. </div>
  848. <div class="section-header">
  849. <h2>Address</h2>
  850. </div>
  851. <div class="form">
  852. <div class="row">
  853. <div class="form-group col-md-12">
  854. <addressAutoComplete @GoogleAddress="UpdateAddress" />
  855. </div>
  856. </div>
  857. <div class="form-row">
  858. <div class="form-group col-md-6">
  859. <input
  860. type="text"
  861. name="street-nr"
  862. class="form-control uniInput"
  863. id="street-nr"
  864. placeholder="Street Number"
  865. data-rule="minlen:4"
  866. data-msg="Please enter your street number"
  867. v-model="indiv.address.streetNumber"
  868. disabled
  869. />
  870. <div class="validation"></div>
  871. </div>
  872. <div class="form-group col-md-6">
  873. <input
  874. type="text"
  875. class="form-control uniInput"
  876. name="street"
  877. id="street"
  878. placeholder="Street Name"
  879. data-msg="Please enter your street name"
  880. disabled
  881. v-model="indiv.address.street"
  882. />
  883. <div class="validation"></div>
  884. </div>
  885. <div class="form-group col-md-6">
  886. <input
  887. type="text"
  888. name="province"
  889. class="form-control uniInput"
  890. id="province"
  891. placeholder="Province"
  892. data-rule="minlen:4"
  893. data-msg="Please enter your province"
  894. disabled
  895. v-model="indiv.address.province"
  896. />
  897. <div class="validation"></div>
  898. </div>
  899. <div class="form-group col-md-6">
  900. <input
  901. type="text"
  902. class="form-control uniInput"
  903. name="city"
  904. id="city"
  905. placeholder="City"
  906. data-rule="minlen:4"
  907. data-msg="Please enter your city"
  908. v-model="indiv.address.city"
  909. disabled
  910. />
  911. <div class="validation"></div>
  912. </div>
  913. <div class="form-group col-md-6">
  914. <input
  915. type="text"
  916. name="suburb"
  917. class="form-control uniInput"
  918. id="suburb"
  919. placeholder="Suburb"
  920. data-rule="minlen:4"
  921. data-msg="Please enter your suburb"
  922. v-model="indiv.address.suburb"
  923. disabled
  924. />
  925. <div class="validation"></div>
  926. </div>
  927. <div class="form-group col-md-6">
  928. <input
  929. type="text"
  930. class="form-control uniInput"
  931. name="postal"
  932. id="postal"
  933. placeholder="Postal Code"
  934. data-msg="Please enter your postal code"
  935. v-model="indiv.address.postalCode"
  936. disabled
  937. />
  938. <div class="validation"></div>
  939. </div>
  940. </div>
  941. </div>
  942. <div class="section-header">
  943. <h2>Share Transfer Information</h2>
  944. </div>
  945. <div class="form">
  946. <!-- <div id="sendmessage">Your details has been sent. Thank you!</div> -->
  947. <div id="errormessage"></div>
  948. <div class="form-row">
  949. <div
  950. class="form-group col-md-12"
  951. style="
  952. border: solid;
  953. border-width: 2px;
  954. border-color: rgb(27, 117, 187);
  955. border-radius: 3px;
  956. "
  957. >
  958. <p style="text-align: left; margin: auto; padding: 10px;">
  959. 1. With respect to my timeshare module/week, I confirm
  960. that:
  961. </p>
  962. <div class="validation"></div>
  963. </div>
  964. </div>
  965. <div class="form-row">
  966. <div class="col-md-8">
  967. <p>
  968. 1.1. All levy amounts for the current cycle have been paid
  969. in full
  970. </p>
  971. </div>
  972. <div class="form-group col-md-2">
  973. <div class="custom-control custom-switch">
  974. <input
  975. type="checkbox"
  976. class="custom-control-input"
  977. id="customSwitch3"
  978. :checked="sellItem.leviesPaidInFull"
  979. @change="changeLeviesPaidInFull"
  980. />
  981. <label class="custom-control-label" for="customSwitch3">
  982. {{ sellItem.leviesPaidInFull ? 'Yes' : 'No' }}
  983. </label>
  984. </div>
  985. <div class="validation"></div>
  986. </div>
  987. </div>
  988. <div class="form-row">
  989. <div class="col-md-8">
  990. <p>
  991. 1.2. My week is placed on rental or exchange this year
  992. </p>
  993. </div>
  994. <div class="form-group col-md-2">
  995. <div class="custom-control custom-switch">
  996. <input
  997. type="checkbox"
  998. class="custom-control-input"
  999. id="customSwitch4"
  1000. :checked="sellItem.weekPlacedForRental"
  1001. @change="changeWeekPlacedForRental"
  1002. />
  1003. <label class="custom-control-label" for="customSwitch4">
  1004. {{ sellItem.weekPlacedForRental ? 'Yes' : 'No' }}
  1005. </label>
  1006. </div>
  1007. <div class="validation"></div>
  1008. </div>
  1009. </div>
  1010. <div class="form-row">
  1011. <div class="col-md-8">
  1012. <p>
  1013. 1.3. I / We bought the timeshare module/week on the
  1014. following date:
  1015. </p>
  1016. </div>
  1017. <div class="form-group col-md-2">
  1018. <input
  1019. type="date"
  1020. class="form-control"
  1021. name="date"
  1022. v-model="sellItem.originalPurchaseDate"
  1023. v-bind:class="{
  1024. 'is-valid': sellItem.originalPurchaseDate,
  1025. }"
  1026. />
  1027. <div class="validation"></div>
  1028. </div>
  1029. </div>
  1030. <div class="form-row">
  1031. <div class="col-md-8">
  1032. <p>
  1033. 1.4. The purchase price for which I / we bought timeshare
  1034. module / week was:
  1035. </p>
  1036. </div>
  1037. <div class="form-group col-md-2">
  1038. <input
  1039. class="form-control uniInput"
  1040. placeholder="R"
  1041. type="number"
  1042. step="any"
  1043. name="purchasePrice"
  1044. v-model="sellItem.originalPurchasePrice"
  1045. v-bind:class="{
  1046. 'is-valid': sellItem.originalPurchasePrice,
  1047. }"
  1048. />
  1049. <div class="validation"></div>
  1050. </div>
  1051. </div>
  1052. <div class="form-row">
  1053. <div class="col-md-8">
  1054. <p>
  1055. 1.5. I / We bought the timeshare module / week for the
  1056. following dates for the current year:
  1057. </p>
  1058. </div>
  1059. <div class="form-group col-md-2">
  1060. Arrival Date :
  1061. <input
  1062. type="date"
  1063. class="form-control uniInput"
  1064. name="occupationDate1"
  1065. v-model="sellItem.arrivalDate"
  1066. v-bind:class="{
  1067. 'is-valid': sellItem.arrivalDate,
  1068. 'is-invalid':
  1069. !requiredField(sellItem.arrivalDate) &&
  1070. arrivalDateLoad,
  1071. }"
  1072. v-on:keyup="arrivalDateLoad = true"
  1073. v-on:blur="arrivalDaterLoad = true"
  1074. />
  1075. <div class="invalid-feedback">
  1076. Arrival Date is Required!
  1077. </div>
  1078. </div>
  1079. <div class="form-group col-md-2">
  1080. Departure Date :
  1081. <input
  1082. type="date"
  1083. class="form-control"
  1084. name="occupationDate2"
  1085. v-model="sellItem.departureDate"
  1086. v-bind:class="{
  1087. 'is-valid': sellItem.departureDate,
  1088. 'is-invalid':
  1089. !requiredField(sellItem.departureDate) &&
  1090. departureDateLoad,
  1091. }"
  1092. v-on:keyup="departureDateLoad = true"
  1093. v-on:blur="departureDaterLoad = true"
  1094. />
  1095. <div class="invalid-feedback">
  1096. Departure Date is Required!
  1097. </div>
  1098. </div>
  1099. </div>
  1100. <div class="form-row">
  1101. <div class="col-md-8">
  1102. <p>
  1103. 1.6. The selling price for the timeshare module / week for
  1104. which I / we want to sell is: (Incl. Vat)
  1105. </p>
  1106. </div>
  1107. <div class="form-group col-md-2">
  1108. <input
  1109. class="form-control uniInput"
  1110. type="number"
  1111. step="any"
  1112. name="sellingPrice"
  1113. v-model="sellItem.sellPrice"
  1114. placeholder="R"
  1115. v-bind:class="{
  1116. 'is-valid': sellItem.sellPrice,
  1117. 'is-invalid':
  1118. !requiredField(sellItem.sellPrice) &&
  1119. sellingPriceLoad,
  1120. }"
  1121. v-on:keyup="sellingPriceLoad = true"
  1122. v-on:blur="sellingPriceLoad = true"
  1123. />
  1124. <div class="invalid-feedback">
  1125. Selling Price is Required!
  1126. </div>
  1127. </div>
  1128. </div>
  1129. <div class="form-row">
  1130. <div class="col-md-8">
  1131. <p>
  1132. 1.7. Estate agent's commission agreed to (state Rand
  1133. value)
  1134. </p>
  1135. </div>
  1136. <div class="form-group col-md-2">
  1137. <input
  1138. class="form-control uniInput"
  1139. type="number"
  1140. step="any"
  1141. name="commission"
  1142. v-model="sellItem.agentCommission"
  1143. placeholder="R"
  1144. v-bind:class="{
  1145. 'is-valid': sellItem.agentCommission,
  1146. }"
  1147. />
  1148. <div class="validation"></div>
  1149. </div>
  1150. </div>
  1151. <div class="form-row">
  1152. <div class="col-md-8">
  1153. <p>
  1154. 1.8. I hereby Mandate Uni-Vate properties to sell the
  1155. timeshare listed above on my behalf
  1156. </p>
  1157. </div>
  1158. <div class="form-group col-md-4">
  1159. <input
  1160. type="checkbox"
  1161. @change="SetMandateDate"
  1162. v-model="sellItem.mandate"
  1163. />
  1164. </div>
  1165. </div>
  1166. <div class="form-row" v-if="!CanSave">
  1167. <div class="col-md-12">
  1168. <p class="alert myError">
  1169. Please ensure that you add spouse details.
  1170. </p>
  1171. </div>
  1172. </div>
  1173. <div align="left" class="custom-control custom-switch mb-2">
  1174. <div class="row">
  1175. <div align="center" class="col">
  1176. <label class="mr-5">
  1177. I wish to receive future listings and special campaigns?
  1178. </label>
  1179. <input
  1180. type="checkbox"
  1181. class="custom-control-input"
  1182. id="customSwitch5"
  1183. :checked="sellItem.consent"
  1184. @change="changeConsent"
  1185. />
  1186. <label class="custom-control-label" for="customSwitch5">
  1187. {{ sellItem.consent ? 'Yes' : 'No' }}
  1188. </label>
  1189. </div>
  1190. </div>
  1191. </div>
  1192. <div class="text-center col-12" v-if="CanSave">
  1193. <button
  1194. class="btn-white-border"
  1195. v-if="!sellItem.id"
  1196. @click="submitSale()"
  1197. >
  1198. Submit
  1199. </button>
  1200. <button class="btn-white-border" v-else @click="newSale()">
  1201. New Week
  1202. </button>
  1203. </div>
  1204. <div class="row">
  1205. <div v-if="boolMessage" class="row">
  1206. <div class="col">
  1207. <alert
  1208. :text="'Your Information has been updated!'"
  1209. :type="'SUCCESS'"
  1210. />
  1211. </div>
  1212. </div>
  1213. <div v-if="boolValidationError" class="row">
  1214. <div class="col">
  1215. <alert :text="errorMessage" :type="errorOccurred" />
  1216. </div>
  1217. </div>
  1218. </div>
  1219. <!-- <div class="text-center col-12">
  1220. <button class="btn-solid-blue" @click="paygateRedirect()">PayGate</button>
  1221. </div>-->
  1222. </div>
  1223. </div>
  1224. </div>
  1225. </div>
  1226. <div v-if="wait" id="preloader"></div>
  1227. </div>
  1228. </section>
  1229. <div v-else>
  1230. <vue-loaders
  1231. class="my-auto"
  1232. style="
  1233. margin-top: 50px !important;
  1234. margin-bottom: 50px !important;
  1235. margin-left: 50%;
  1236. "
  1237. name="line-spin-fade-loader"
  1238. color="black"
  1239. scale="1"
  1240. ></vue-loaders>
  1241. </div>
  1242. </div>
  1243. </template>
  1244. <script>
  1245. /* eslint-disable */
  1246. import { mapState, mapActions, mapGetters } from 'vuex'
  1247. import addressAutoComplete from '../../shared/addressAutoComplete'
  1248. import Alert from '../../shared/alert.vue'
  1249. import Log from '../../../assets/Log'
  1250. import _ from 'lodash'
  1251. import md5 from 'js-md5'
  1252. export default {
  1253. name: 'TimeshareToSell',
  1254. props: {
  1255. weekId: {
  1256. default: 0,
  1257. },
  1258. },
  1259. data() {
  1260. return {
  1261. wait: false,
  1262. errorOccurred: '',
  1263. errorMessage: '',
  1264. boolMessage: '',
  1265. boolValidationError: false,
  1266. userLoggedIn: Log.isLoggedIn(),
  1267. profileEmailError: false,
  1268. selectedUserType: '',
  1269. boolLoaded: false,
  1270. regionLoad: false,
  1271. resortLoad: false,
  1272. otherResortLoad: false,
  1273. otherResortRegionLoad: false,
  1274. unitNumberLoad: false,
  1275. moduleLoad: false,
  1276. seasonLoad: false,
  1277. bedroomsLoad: false,
  1278. maxSleepLoad: false,
  1279. levyAmountLoad: false,
  1280. weekTypeLoad: false,
  1281. bankedWithLoad: false,
  1282. selectedUserTypeLoad: false,
  1283. nameLoad: false,
  1284. surnameLoad: false,
  1285. emailAddressLoad: false,
  1286. cellNumberLoad: false,
  1287. landlineNumberLoad: false,
  1288. spouseEmailLoad: false,
  1289. arrivalDateLoad: false,
  1290. departureDateLoad: false,
  1291. sellingPriceLoad: false,
  1292. money: {
  1293. decimal: '.',
  1294. thousands: '',
  1295. prefix: ' ',
  1296. suffix: ' R',
  1297. precision: 2,
  1298. masked: false,
  1299. },
  1300. }
  1301. },
  1302. components: {
  1303. addressAutoComplete,
  1304. Alert,
  1305. },
  1306. mounted() {
  1307. if (this.sellItem.id) {
  1308. this.newSale()
  1309. }
  1310. this.loadData().then(() => {
  1311. setTimeout(() => {
  1312. this.boolLoaded = true
  1313. }, 100)
  1314. })
  1315. },
  1316. created() {
  1317. this.initTimeshare(this.weekId)
  1318. if (this.selectedUserType === '') {
  1319. this.selectedUserType = 'myself'
  1320. }
  1321. },
  1322. computed: {
  1323. ...mapState('timeshare', [
  1324. 'resorts',
  1325. 'regions',
  1326. 'detailedRegion',
  1327. 'seasons',
  1328. 'result',
  1329. 'resortBedrooms',
  1330. 'maxSleep',
  1331. 'bankedEntities',
  1332. 'sellItem',
  1333. 'agencies',
  1334. 'agents',
  1335. 'getTemplate',
  1336. ]),
  1337. ...mapState('individual', ['indiv']),
  1338. ...mapState('authentication', ['isLoggedIn']),
  1339. ...mapState('status', ['statusList']),
  1340. ...mapGetters({
  1341. user: 'authentication/getUser',
  1342. person: 'authentication/getPerson',
  1343. }),
  1344. ...mapState('bank', ['banks']),
  1345. refAgent() {
  1346. return this.sellItem && this.sellItem.referedByAgent
  1347. },
  1348. ...mapGetters('fees', ['getListingFee']),
  1349. filteredResort() {
  1350. let list = []
  1351. if (
  1352. this.sellItem &&
  1353. this.sellItem.region &&
  1354. this.sellItem.region.regionCode
  1355. ) {
  1356. const item = this.detailedRegion.find(
  1357. (region) =>
  1358. region.region.regionCode === this.sellItem.region.regionCode,
  1359. )
  1360. if (item) {
  1361. list = item.children
  1362. }
  1363. } else {
  1364. list = this.resorts
  1365. }
  1366. return _.sortBy(list, (x) => x.resortName)
  1367. },
  1368. isLoggedIn() {
  1369. return this.user && this.person
  1370. },
  1371. displayNotDeletedAgents() {
  1372. var notDeletedArr = []
  1373. this.agents.forEach((agent) => {
  1374. if (!agent.isDeleted) {
  1375. if (agent.agencyId === this.sellItem.agencyId) {
  1376. notDeletedArr.push(agent)
  1377. }
  1378. }
  1379. })
  1380. return notDeletedArr
  1381. },
  1382. ChangeCustomUser() {
  1383. if (this.selectedUserType === 'myself') {
  1384. return true
  1385. } else {
  1386. return false
  1387. }
  1388. },
  1389. CanSave() {
  1390. if (this.indiv.howMarried === 'In Community Of Property') {
  1391. if (
  1392. this.indiv.spouseName ||
  1393. this.indiv.spouseSurname ||
  1394. this.spouseEmail
  1395. ) {
  1396. return true
  1397. }
  1398. return false
  1399. }
  1400. return true
  1401. },
  1402. },
  1403. methods: {
  1404. ...mapActions('individual', ['getIndividual']),
  1405. ...mapActions('timeshare', [
  1406. 'initTimeshare',
  1407. 'onResortChange',
  1408. 'saveWeek',
  1409. 'getBlankWeek',
  1410. ]),
  1411. ...mapActions('payment', ['addPayment']),
  1412. ...mapActions('bank', ['getBanks']),
  1413. ...mapActions('status', ['getStatusList']),
  1414. async loadData() {
  1415. await this.initTimeshare(0)
  1416. await this.getIndividual(Log.getUser().id)
  1417. await this.getBanks()
  1418. await this.getStatusList()
  1419. },
  1420. newSale() {
  1421. this.weekId = 0
  1422. this.getBlankWeek()
  1423. },
  1424. capitalizeFirstLetter() {
  1425. this.indiv.name =
  1426. this.indiv.name.charAt(0).toUpperCase() + this.indiv.name.slice(1)
  1427. this.indiv.surname =
  1428. this.indiv.surname.charAt(0).toUpperCase() + this.indiv.surname.slice(1)
  1429. },
  1430. getPubDate() {
  1431. var today = new Date()
  1432. var dd = String(today.getDate()).padStart(2, '0')
  1433. var mm = String(today.getMonth() + 1).padStart(2, '0') //January is 0!
  1434. var yyyy = today.getFullYear()
  1435. today = mm + '/' + dd + '/' + yyyy
  1436. var isoDate = new Date(today).toISOString()
  1437. var fixedDate = new Date(isoDate).setHours(+4)
  1438. var pubDate = new Date(fixedDate).toISOString()
  1439. return pubDate
  1440. },
  1441. generatePayment(id) {
  1442. var myData = []
  1443. // Merchant details
  1444. myData['merchant_id'] = '10000100'
  1445. myData['merchant_key'] = '46f0cd694581a'
  1446. myData['return_url'] =
  1447. 'https://www.univateproperties.co.za/#/payments/success'
  1448. myData['cancel_url'] = 'https://www.univateproperties.co.za/#/'
  1449. myData['notify_url'] = 'http://www.yourdomain.co.za/notify_url'
  1450. // Buyer details
  1451. myData['name_first'] = this.indiv.name
  1452. myData['name_last'] = this.indiv.surname
  1453. myData['email_address'] = this.indiv.emailAddress
  1454. // Transaction details
  1455. //myData["m_payment_id"] = "1234";
  1456. myData['amount'] = this.getListingFee.amount.toString()
  1457. myData['item_name'] =
  1458. 'Uni-Vate Week sale. Resort: ' +
  1459. this.sellItem.resort +
  1460. ' Referemce: #' +
  1461. id.toString()
  1462. myData['signature'] = this.generateSignature(myData)
  1463. //console.log(paymentObj);
  1464. //axios.post("https://sandbox.payfast.co.za​/eng/process", paymentObj);
  1465. //console.log(myData);
  1466. var paymentObj = Object.assign({}, myData)
  1467. console.log('Twas here')
  1468. console.log(paymentObj)
  1469. this.$router.push({
  1470. name: 'PayFast',
  1471. params: {
  1472. paymentObj: paymentObj,
  1473. },
  1474. })
  1475. },
  1476. generateSignature(data, passPhrase = null) {
  1477. let pfOutput = ''
  1478. for (let key in data) {
  1479. if (data.hasOwnProperty(key)) {
  1480. if (data[key] !== '') {
  1481. pfOutput += `${key}=${encodeURIComponent(data[key].trim()).replace(
  1482. /%20/g,
  1483. '+',
  1484. )}&`
  1485. }
  1486. }
  1487. }
  1488. let getString = pfOutput.slice(0, -1)
  1489. if (passPhrase !== null) {
  1490. getString += `&passphrase=${encodeURIComponent(
  1491. passPhrase.trim(),
  1492. ).replace(/%20/g, '+')}`
  1493. }
  1494. var hash = md5.create()
  1495. hash.update(getString)
  1496. console.log(hash.hex())
  1497. console.log(getString)
  1498. return hash.toString()
  1499. },
  1500. submitSale() {
  1501. this.boolError = false
  1502. this.boolValidationError = false
  1503. if (this.userLoggedIn) {
  1504. if (this.validatePage()) {
  1505. console.log('validated')
  1506. //Capitalize the first letter of the first and last name of the indiv
  1507. this.capitalizeFirstLetter()
  1508. //Sets the status of the week to waiting for EFT Payment
  1509. this.statusList.forEach((status) => {
  1510. if (status.code === 'APEFT') {
  1511. this.sellItem.statusId = status.id
  1512. }
  1513. })
  1514. //Check if a custom owner is selected
  1515. if (this.selectedUserType === 'custom') {
  1516. this.sellItem.customOwner = true
  1517. }
  1518. //set the owner of the week to the indiv
  1519. this.sellItem.ownerObject = this.indiv
  1520. //set the publish date equal to today's date
  1521. this.sellItem.pulbishedDate = this.getPubDate()
  1522. //Set the user ID of the week equal to the user who listed the week
  1523. this.sellItem.ownerId = Log.getUser().id
  1524. this.sellItem.weekType = parseInt(this.sellItem.weekType)
  1525. //console.log(this.sellItem.ownerObject);
  1526. console.log(this.sellItem)
  1527. console.log('here')
  1528. //console.log(JSON.stringify(this.sellItem))
  1529. //console.log('here1')
  1530. // console.log(Log.getUser());
  1531. if (!this.boolError) {
  1532. console.log('saveweek')
  1533. this.saveWeek(this.sellItem)
  1534. .then((fulfilled) => {
  1535. this.boolMessage = true
  1536. // this.$router.push({
  1537. // name: "PaymentOption",
  1538. // params: { week: fulfilled, indiv: this.indiv }
  1539. // });
  1540. this.$router.push({
  1541. name: 'EFTPage',
  1542. params: { week: fulfilled },
  1543. })
  1544. //this.paygateRedirect();
  1545. //this.generatePayment(fulfilled.id);
  1546. })
  1547. .catch((ex) => {
  1548. console.log('error')
  1549. this.errorOccurred = 'ERRORHTML'
  1550. this.errorMessage = ex
  1551. })
  1552. }
  1553. }
  1554. } else {
  1555. //If the user is not logged in they are redirected to the login
  1556. this.$router.push('/user/login')
  1557. }
  1558. },
  1559. paygateRedirect() {
  1560. var amount = this.getListingFee.amount
  1561. var paymentObj = {
  1562. timeshareWeekId: this.sellItem.id, // this.sellItem.Id,
  1563. propertyId: 0,
  1564. creatydById: Log.getUser().id, //Log.getUser().id,
  1565. amount: amount,
  1566. paymentStatus: '',
  1567. paymentToken: '',
  1568. }
  1569. this.addPayment(paymentObj).then((res) => {
  1570. this.$router.push({
  1571. name: 'PaymentGateway',
  1572. params: {
  1573. paymentReqId: res.PAY_REQUEST_ID,
  1574. checksum: res.CHECKSUM,
  1575. },
  1576. })
  1577. })
  1578. },
  1579. previewFiles(event) {
  1580. console.log(event.target.files)
  1581. },
  1582. changeRef() {
  1583. this.sellItem.agent = undefined
  1584. this.sellItem.agency = undefined
  1585. this.sellItem.referedByAgent = !this.sellItem.referedByAgent
  1586. },
  1587. changeConsent() {
  1588. this.sellItem.consent = !this.sellItem.consent
  1589. },
  1590. changeLeviesPaidInFull() {
  1591. this.sellItem.leviesPaidInFull = !this.sellItem.leviesPaidInFull
  1592. },
  1593. changeWeekPlacedForRental() {
  1594. this.sellItem.weekPlacedForRental = !this.sellItem.weekPlacedForRental
  1595. },
  1596. changeCurrentBanked() {
  1597. this.sellItem.bankedWith = undefined
  1598. this.sellItem.currentYearBanked = !this.sellItem.currentYearBanked
  1599. },
  1600. resortChange() {
  1601. this.onResortChange({
  1602. resortName: this.sellItem.resort.resortName,
  1603. resortCode: this.sellItem.resort.resortCode,
  1604. })
  1605. if (this.sellItem && this.sellItem.resort === 'Other') {
  1606. this.sellItem.otherResortName = undefined
  1607. this.sellItem.otherResort = true
  1608. } else {
  1609. this.sellItem.otherResortName = undefined
  1610. this.sellItem.otherResort = false
  1611. }
  1612. console.log(this.detailedRegion)
  1613. let resortlist = []
  1614. if (this.sellItem.resortCode) {
  1615. //console.log('Here')
  1616. const item = this.detailedRegion.find(
  1617. (detregion) =>
  1618. detregion.children.resortCode === this.sellItem.resortCode,
  1619. )
  1620. if (item) {
  1621. console.log('Item')
  1622. this.sellItem.region = item.region.regionCode
  1623. }
  1624. }
  1625. console.log(this.sellItem.region)
  1626. },
  1627. regionChange() {
  1628. this.sellItem.regionId = this.sellItem.region
  1629. ? this.sellItem.region.id
  1630. : 1
  1631. },
  1632. userChange() {
  1633. this.nameLoad = false
  1634. this.surnameLoad = false
  1635. this.emailAddressLoad = false
  1636. this.cellNumberLoad = false
  1637. this.spouseEmailLoad = false
  1638. },
  1639. UpdateAddress(address) {
  1640. this.indiv.address.streetNumber = address.streetNumber
  1641. this.indiv.address.street = address.streetName
  1642. this.indiv.address.province = address.province
  1643. this.indiv.address.city = address.city
  1644. this.indiv.address.suburb = address.suburb
  1645. this.indiv.address.postalCode = address.postalCode
  1646. },
  1647. SetMandateDate() {
  1648. if (this.sellItem.mandate) {
  1649. this.sellItem.mandateDate = new Date()
  1650. } else {
  1651. this.sellItem.mandateDate = undefined
  1652. }
  1653. },
  1654. requiredField: function (tfield) {
  1655. if (tfield) {
  1656. return true
  1657. } else {
  1658. return false
  1659. }
  1660. },
  1661. validEmail: function (email) {
  1662. var re = /(.+)@(.+){2,}\.(.+){2,}/
  1663. if (email) {
  1664. return re.test(email.toLowerCase())
  1665. } else {
  1666. return re.test(email)
  1667. }
  1668. },
  1669. validPhoneNumber(number) {
  1670. if (number) {
  1671. const rx = /^\(?\d{3}\)?[-\s]?\d{3}[-\s]?\d{4}$/
  1672. // const rx = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/im
  1673. return rx.test(String(number))
  1674. } else {
  1675. return true
  1676. }
  1677. },
  1678. validatePage: function () {
  1679. console.log('validatePage')
  1680. if (
  1681. this.sellItem.region &&
  1682. this.sellItem.resort &&
  1683. this.sellItem.unitNumber &&
  1684. this.sellItem.module &&
  1685. this.sellItem.season &&
  1686. this.sellItem.bedrooms &&
  1687. this.sellItem.maxSleep &&
  1688. this.sellItem.weekType &&
  1689. this.sellItem.levyAmount &&
  1690. this.sellItem.arrivalDate &&
  1691. this.sellItem.departureDate &&
  1692. this.sellItem.sellPrice
  1693. ) {
  1694. if (this.selectedUserType === 'custom') {
  1695. if (
  1696. this.indiv.name &&
  1697. this.indiv.surname &&
  1698. this.indiv.emailAddress &&
  1699. this.indiv.cellNumber &&
  1700. this.validEmail(this.indiv.emailAddress) &&
  1701. this.validPhoneNumber(this.indiv.cellNumber) &&
  1702. this.validPhoneNumber(this.indiv.landlineNumber)
  1703. ) {
  1704. console.log('passed custom')
  1705. this.errorOccurred = ''
  1706. this.errorMessage = ''
  1707. this.boolValidationError = true
  1708. return true
  1709. } else {
  1710. console.log('failed custom')
  1711. this.nameLoad = true
  1712. this.surnameLoad = true
  1713. this.emailAddressLoad = true
  1714. this.cellNumberLoad = true
  1715. this.boolValidationError = true
  1716. this.errorOccurred = 'ERROR'
  1717. this.errorMessage =
  1718. 'Please check form and correct all input fields!'
  1719. return false
  1720. }
  1721. } else {
  1722. this.errorOccurred = ''
  1723. this.errorMessage = ''
  1724. this.boolValidationError = true
  1725. return true
  1726. }
  1727. } else {
  1728. this.regionLoad = true
  1729. this.resortLoad = true
  1730. this.otherResortLoad = true
  1731. this.otherResortRegionLoad = true
  1732. this.unitNumberLoad = true
  1733. this.moduleLoad = true
  1734. this.seasonLoad = true
  1735. this.bedroomsLoad = true
  1736. this.maxSleepLoad = true
  1737. this.levyAmountLoad = true
  1738. this.weekTypeLoad = true
  1739. this.bankedWithLoad = true
  1740. this.arrivalDateLoad = true
  1741. this.departureDateLoad = true
  1742. this.sellingPriceLoad = true
  1743. if (this.selectedUserType === 'custom') {
  1744. this.nameLoad = true
  1745. this.surnameLoad = true
  1746. this.emailAddressLoad = true
  1747. this.cellNumberLoad = true
  1748. this.spouseEmailLoad = true
  1749. }
  1750. this.boolValidationError = true
  1751. this.errorOccurred = 'ERROR'
  1752. this.errorMessage = 'Please check form and correct all input fields!'
  1753. return false
  1754. }
  1755. },
  1756. },
  1757. }
  1758. </script>
  1759. }
  1760. <style lang="scss" scoped>
  1761. .refbyAgent {
  1762. will-change: transform;
  1763. transition: height 500ms;
  1764. height: 0px;
  1765. }
  1766. .refbyAgent--clicked {
  1767. height: 150px;
  1768. }
  1769. .spacebanked1 {
  1770. will-change: transform;
  1771. transition: height 500ms;
  1772. height: 0px;
  1773. }
  1774. .spacebanked1--clicked {
  1775. height: 150px;
  1776. }
  1777. .custom-file-label {
  1778. border-width: 2px;
  1779. border-color: rgb(27, 117, 187);
  1780. margin-bottom: 20px;
  1781. }
  1782. .custom-file-label::after {
  1783. border-left: none;
  1784. border-bottom: solid;
  1785. border-width: 2px;
  1786. border-color: rgb(27, 117, 187);
  1787. font-family: 'Muli';
  1788. }
  1789. </style>