123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764 |
- <template>
- <main id="main">
- <section id="contact2">
- <div class="container">
- <div class="row">
- <div class="col-lg-12">
- <div class="section-header">
- <h2>Week Information</h2>
- </div>
- {{ weekParam }}
- <div align="left" class="custom-control custom-switch mb-2">
- <div class="row">
- <div align="center" class="col">
- <!-- <label class="mr-5">Were you referred by an agent?</label> -->
- <!-- <input
- type="checkbox"
- class="custom-control-input"
- id="customSwitch1"
- :checked="refAgent"
- @change="changeRef"
- /> -->
- <!-- <label class="custom-control-label" for="customSwitch1">{{
- refAgent ? "Yes" : "No"
- }}</label> -->
- <!-- <div class="refbyAgent" :class="{ 'refbyAgent--clicked': refAgent }">
- <div class="col-md-6" v-if="refAgent">
- <label for="Name of Agency">Agency</label>
- <select
- class="form-control uniSelect"
- id="Agency"
- name="agency"
- v-model="sellItem.agencyId"
- >
- <option v-for="(item, i) in agencies" :key="i" :value="item.id">
- {{ item.agencyName }}
- </option>
- </select>
- </div>
- <div class="col-md-6" v-if="refAgent">
- <label for="Name of Agent">Agent</label>
- <select
- class="form-control uniSelect"
- id="agent"
- name="agent"
- v-model="sellItem.agentId"
- :disabled="!sellItem.agencyId"
- >
- <option
- v-for="(item, i) in displayNotDeletedAgents"
- :key="i"
- :value="item.id"
- >
- <div>{{ item.name + " " + item.surname }}</div>
- </option>
- </select>
- </div>
- </div> -->
- </div>
- </div>
- </div>
-
- <div class="form">
- <div id="sendmessage">Your details has been sent. Thank you!</div>
- <div id="errormessage"></div>
- <div class="form-row">
- <div class="form-group col-md-6">
- <div class="input-group">
- <select
- id="weekInfoRegionSelect"
- class="form-control uniSelect"
- v-model="weekParam.region.regionName"
- style="font-size: 15px"
- >
- <option v-for="(region, r) in regions" :key="r" :value="region">{{
- region.regionName
- }}</option>
- </select>
- </div>
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <div class="input-group">
- <label v-if="!sellItem.resort" class="uniSelectLabel" for="weekInfoResortSelect"
- >RESORT NAME</label
- >
-
- <select
- id="weekInfoResortSelect"
- class="form-control uniSelect"
- v-model="sellItem.resort"
- @change="resortChange()"
- >
- <option value="Other">Other</option>
- <option v-for="(resort, r) in filteredResort" :key="r" :value="resort">{{
- resort.resortName
- }}</option>
- </select>
- </div>
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <input
- class="form-control"
- v-if="sellItem.otherResort"
- placeholder="NAME OF RESORT (* IF OTHER)"
- type="text"
- name="other"
- v-model="sellItem.otherResortName"
- />
- </div>
- <div class="form-group col-md-6">
- <div v-if="sellItem.otherResort">
- <label v-if="!sellItem.region" class="uniSelectLabel" for="region"
- >REGION</label
- >
- </div>
-
- <select
- class="form-control uniSelect"
- v-if="sellItem.otherResort"
- name="region"
- id="region"
- v-model="sellItem.region"
- >
- <option v-for="(region, r) in regions" :key="r">{{ region.regionName }}</option>
- </select>
- </div>
- <div class="form-group col-md-6">
- <input
- type="number"
- class="form-control"
- name="unitNumber"
- id="unitNumber"
- placeholder="UNIT NUMBER"
- v-model="sellItem.unitNumber"
- data-msg="Please enter unit number"
- />
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <input
- type="number"
- class="form-control"
- name="week"
- id="week"
- placeholder="UNIT / WEEK NUMBER"
- v-model="sellItem.module"
- data-msg="Please enter week number"
- />
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <select
- class="form-control uniSelect"
- name="region"
- id="region"
- v-model="selectedSeason"
- >
- <option v-for="(season, r) in seasons" :key="r">{{ season.name }}</option>
- </select>
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <label v-if="!sellItem.bedrooms" class="uniSelectLabel" for="region"
- >BEDROOM/S</label
- >
-
- <select
- class="form-control uniSelect"
- name="region"
- id="region"
- v-model="sellItem.bedrooms"
- >
- <option v-for="(item, i) in resortBedrooms" :key="i">{{ item }}</option>
- </select>
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <label v-if="!sellItem.maxSleep" class="uniSelectLabel" for="region"
- >SLEEP MAX</label
- >
-
- <select
- class="form-control uniSelect"
- name="region"
- id="region"
- v-model="sellItem.maxSleep"
- >
- <option v-for="(item, i) in maxSleep" :key="i">{{ item }}</option>
- </select>
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <input
- type="number"
- class="form-control"
- name="levy"
- id="levy"
- placeholder="Levy Amount"
- v-model="sellItem.levyAmount"
- data-msg="Please enter levy amount"
- />
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <label v-if="!sellItem.weekType" class="uniSelectLabel" for="region"
- >WEEK TYPE</label
- >
- <select
- class="form-control uniSelect"
- name="region"
- id="region"
- v-model="sellItem.weekType"
- >
- <option :key="0">Flexi</option>
- <option :key="1">Fixed</option>
- <option :key="2">Module</option>
- <option :key="3">Syndicate</option>
- </select>
- </div>
- <div class="form-row">
- <div class="form-group col-md-6">
- Arrival Date :
- <input
- type="date"
- class="form-control"
- name="occupationDate1"
- v-model="sellItem.arrivalDate"
- />
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- Departure Date :
- <input
- type="date"
- class="form-control"
- name="occupationDate2"
- v-model="sellItem.departureDate"
- />
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- Purchase Price:
- <input
- class="form-control"
- placeholder="R"
- type="number"
- step="any"
- name="purchasePrice"
- v-model="sellItem.originalPurchasePrice"
- />
- <div class="validation"></div>
- </div>
- </div>
- </div>
- </div>
- <div align="left" class="custom-control custom-switch mb-2">
- <div class="row">
- <div align="center" class="col">
- <label class="mr-5">Has your week been spacebanked for the current year?</label>
- <input
- type="checkbox"
- class="custom-control-input"
- id="customSwitch2"
- :checked="sellItem.currentYearBanked"
- @change="changeCurrentBanked"
- />
- <label class="custom-control-label" for="customSwitch2">{{
- sellItem.currentYearBanked ? "Yes" : "No"
- }}</label>
- <div
- class="spacebanked1"
- :class="{ 'spacebanked1--clicked': sellItem.currentYearBanked }"
- >
- <div class="col-md-6">
- <label
- for="If yes, please confirm with whom"
- v-if="sellItem.currentYearBanked"
- >Please confirm with whom</label
- >
- <select
- class="form-control uniSelect"
- name="spacebankOwner"
- v-if="sellItem.currentYearBanked"
- v-model="sellItem.bankedWith"
- >
- <option v-for="(item, i) in bankedEntities" :key="i">{{ item }}</option>
- </select>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <div class="section-header">
- <h2>Detailed Individual Information</h2>
- </div>
- <div class="form">
- <div class="row">
- <div class="form-group col-md-6">
- <input
- type="text"
- name="name"
- class="form-control"
- id="name"
- placeholder="Name"
- data-rule="minlen:4"
- data-msg="Please enter your name"
- v-model="indiv.name"
- />
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <input
- type="text"
- class="form-control"
- name="surname"
- id="surname"
- placeholder="Surname"
- data-msg="Please enter your surname"
- v-model="indiv.surname"
- />
- <div class="validation"></div>
- </div>
- </div>
- <div class="row">
- <div class="form-group col-md-6">
- <input
- type="text"
- name="idnum"
- class="form-control"
- id="idnum"
- placeholder="ID Number"
- data-rule="minlen:4"
- data-msg="Please enter your ID number"
- v-model="indiv.idNumber"
- />
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <input
- type="text"
- class="form-control"
- name="company"
- id="company"
- placeholder="Company Reg Number"
- data-rule="minlen:4"
- data-msg="Please enter your company reg number"
- v-model="indiv.companyRegNumber"
- />
- <div class="validation"></div>
- </div>
- </div>
- <div class="row">
- <div class="form-group col-md-6">
- <div class="input-group">
- <label
- v-if="!indiv.howMarried || indiv.howMarried === 'N/A'"
- for="howMarried"
- class="uniSelectLabel"
- >Marital Status</label
- >
- <select
- class="form-control uniSelect"
- id="howMarried"
- v-model="indiv.howMarried"
- >
- <option value="N/A">N/A</option>
- <option value="In Community Of Property">In Community Of Property</option>
- <option value="Out of Community Of Property"
- >Out of Community Of Property</option
- >
- <option value="Other">Other</option>
- <option value="Traditional Wedding">Traditional Wedding</option>
- <option value="Single">Single</option>
- <option value="Divorced">Divorced</option>
- <option value="Widow">Widow</option>
- <option value="Committed Relationship">Committed Relationship</option>
- <option value="Partner">Partner</option>
- </select>
- </div>
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <input
- type="text"
- class="form-control"
- name="email"
- id="email"
- placeholder="Email Address"
- data-msg="Please enter your email address"
- v-model="indiv.emailAddress"
- />
- <div class="validation"></div>
- </div>
- </div>
- <div class="row">
- <div class="form-group col-md-6">
- <input
- type="text"
- name="cell"
- class="form-control"
- id="cell"
- placeholder="Cell Number"
- data-rule="minlen:4"
- data-msg="Please enter your cell number"
- v-model="indiv.cellNumner"
- />
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <input
- type="text"
- class="form-control"
- name="landline"
- id="landline"
- placeholder="Landline Number"
- data-msg="Please enter your landline number"
- v-model="indiv.landlineNumber"
- />
- <div class="validation"></div>
- </div>
- </div>
- </div>
- <div v-if="indiv.howMarried === 'In Community Of Property'" class="section-header">
- <h2>Spouse Details</h2>
- </div>
- <div v-if="indiv.howMarried === 'In Community Of Property'" class="form">
- <div class="form-row">
- <div class="form-group col-md-6">
- <input
- type="text"
- class="form-control"
- placeholder="SPOUSE NAME"
- data-msg="Please enter your spouse's name"
- v-model="indiv.spouseName"
- />
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <input
- type="text"
- class="form-control"
- placeholder="SPOUSE SURNAME"
- data-msg="Please enter your spouse's surname"
- v-model="indiv.spouseSurname"
- />
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <input
- type="text"
- class="form-control"
- placeholder="SPOUSE EMAIL"
- data-rule="minlen:4"
- data-msg="Please enter your spouse's email"
- v-model="indiv.spouseEmail"
- />
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <input
- type="text"
- class="form-control"
- placeholder="SPOUSE TELEPHONE"
- data-rule="minlen:4"
- data-msg="Please enter your spouse's telephone number"
- v-model="indiv.spouseTelephone"
- />
- <div class="validation"></div>
- </div>
- <div class="form-group col-md-6">
- <input
- type="text"
- class="form-control"
- placeholder="SPOUSE CELL NUMBER"
- data-rule="minlen:4"
- data-msg="Please enter your spouse's cellphone number"
- v-model="indiv.spouseCellnumber"
- />
- <div class="validation"></div>
- </div>
- </div>
- <div class="form-group col-md-6">
- <input
- type="text"
- class="form-control"
- placeholder="SPOUSE CELL NUMBER"
- data-rule="minlen:4"
- data-msg="Please enter your spouse's cellphone number"
- v-model="indiv.spouseCellnumber"
- />
- <div class="validation"></div>
- </div>
- </div>
-
- <div class="form">
- <div id="sendmessage">Your details has been sent. Thank you!</div>
- <div id="errormessage"></div>
-
- <div class="form-row" v-if="!CanSave">
- <div class="col-md-12">
- <p class="alert myError">Please ensure that you add spouse details.</p>
- </div>
- </div>
- <div class="text-center col-12" v-if="CanSave">
- <button class="btn-solid-blue">
- Save
- </button>
- </div>
- <div class="text-center col-12">
- <button class="btn-solid-blue" v-on:click="backToListView()">Back</button>
- </div>
- <br />
- <br />
- </div>
- </div>
-
- <br />
- <br />
- </div>
- <div v-if="wait" id="preloader"></div>
- </div>
- </section>
- </main>
- </template>
-
- <script>
- /* eslint-disable */
- import { mapState, mapActions, mapGetters } from "vuex";
- import addressAutoComplete from "../../shared/addressAutoComplete";
- import Alert from "../../shared/alert.vue";
- import Log from "../../../assets/Log";
- import _ from "lodash";
-
- export default {
- name: "EditTimeshare",
- props: {
- weekParam: {},
- weekId: {
- default: 0
- }
- },
- data() {
- return {
- wait: false,
- userLoggedIn: Log.isLoggedIn(),
- listedWeekId: this.$route.params.id,
- selectedItems: [],
- selectedSeason: {}
- };
- },
- components: {
- addressAutoComplete,
- Alert
- },
- mounted() {
- if (this.sellItem.id) {
- this.newSale();
- }
- this.initTimeshare(0);
- this.getIndividual(Log.getUser().id);
- this.getBanks();
- this.selectedSeason = this.weekParam.season;
- //this.getWeek(this.$route.params.id);
- },
- created() {
- this.initTimeshare(this.weekId);
- },
- computed: {
- ...mapState("timeshare", [
- "resorts",
- "regions",
- "detailedRegion",
- "seasons",
- "result",
- "resortBedrooms",
- "maxSleep",
- "bankedEntities",
- "sellItem",
- "agencies",
- "agents",
- "getTemplate"
- ]),
- ...mapState("individual", ["indiv"]),
- ...mapState("authentication", ["isLoggedIn"]),
- ...mapState("myWeeks", ["items", "week"]),
- ...mapGetters({
- user: "authentication/getUser",
- person: "authentication/getPerson"
- }),
- ...mapState("bank", ["banks"]),
- refAgent() {
- return this.sellItem && this.sellItem.referedByAgent;
- },
- filteredResort() {
- let list = [];
- if (this.sellItem && this.sellItem.region && this.sellItem.region.regionCode) {
- const item = this.detailedRegion.find(
- region => region.region.regionCode === this.sellItem.region.regionCode
- );
- if (item) {
- list = item.children;
- }
- } else {
- list = this.resorts;
- }
- return _.sortBy(list, x => x.resortName);
- },
- isLoggedIn() {
- return this.user && this.person;
- },
- displayNotDeletedAgents() {
- var notDeletedArr = [];
- this.agents.forEach(agent => {
- if (!agent.isDeleted) {
- if (agent.agencyId === this.sellItem.agencyId) {
- notDeletedArr.push(agent);
- }
- }
- });
- return notDeletedArr;
- },
- CanSave() {
- if (this.indiv.howMarried === "In Community Of Property") {
- if (this.indiv.spouseName || this.indiv.spouseSurname || this.spouseEmail) {
- return true;
- }
- return false;
- }
- return true;
- }
- },
- methods: {
- ...mapActions("individual", ["getIndividual"]),
- ...mapActions("timeshare", ["initTimeshare", "onResortChange", "saveWeek", "getBlankWeek"]),
- ...mapActions("payment", ["addPayment"]),
- ...mapActions("bank", ["getBanks"]),
- ...mapActions("myWeeks", ["getItems", "getWeek"]),
- newSale() {
- this.weekId = 0;
- this.getBlankWeek();
- },
- submitSale() {
- if (this.userLoggedIn) {
- this.sellItem.ownerObject = this.indiv;
- this.sellItem.status = undefined;
- this.saveWeek(this.sellItem).then(fulfilled => {
- this.paygateRedirect();
- });
- } else this.$router.push("/user/login");
- },
- paygateRedirect() {
- var paymentObj = {
- timeshareWeekId: this.sellItem.id, // this.sellItem.Id,
- propertyId: 0,
- creatydById: Log.getUser().id, //Log.getUser().id,
- amount: 380.0,
- paymentStatus: "",
- paymentToken: ""
- };
-
- this.addPayment(paymentObj).then(res => {
- this.$router.push({
- name: "PaymentGateway",
- params: {
- paymentReqId: res.PAY_REQUEST_ID,
- checksum: res.CHECKSUM
- }
- });
- });
- },
- previewFiles(event) {
- console.log(event.target.files);
- },
- changeRef() {
- this.sellItem.agent = undefined;
- this.sellItem.agency = undefined;
- this.sellItem.referedByAgent = !this.sellItem.referedByAgent;
- },
- changeLeviesPaidInFull() {
- this.sellItem.leviesPaidInFull = !this.sellItem.leviesPaidInFull;
- },
- changeWeekPlacedForRental() {
- this.sellItem.weekPlacedForRental = !this.sellItem.weekPlacedForRental;
- },
- changeCurrentBanked() {
- this.sellItem.bankedWith = undefined;
- this.sellItem.currentYearBanked = !this.sellItem.currentYearBanked;
- },
- resortChange() {
- this.onResortChange({
- resortName: this.sellItem.resort.resortName,
- resortCode: this.sellItem.resort.resortCode
- });
-
- if (this.sellItem && this.sellItem.resort === "Other") {
- this.sellItem.otherResortName = undefined;
- this.sellItem.otherResort = true;
- } else {
- this.sellItem.otherResortName = undefined;
- this.sellItem.otherResort = false;
- }
- },
- regionChange() {
- this.sellItem.regionId = this.sellItem.region ? this.sellItem.region.id : 1;
- },
- UpdateAddress(address) {
- this.indiv.address.streetNumber = address.streetNumber;
- this.indiv.address.street = address.streetName;
- this.indiv.address.province = address.province;
- this.indiv.address.city = address.city;
- this.indiv.address.suburb = address.suburb;
- this.indiv.address.postalCode = address.postalCode;
- },
- SetMandateDate() {
- if (this.sellItem.mandate) {
- this.sellItem.mandateDate = new Date();
- } else {
- this.sellItem.mandateDate = undefined;
- }
- },
- backToListView() {
- this.$router.push("/status/timeshareAdmin");
- }
- }
- };
- </script>
-
- <style lang="scss" scoped>
- .refbyAgent {
- will-change: transform;
- transition: height 500ms;
- height: 0px;
- }
-
- .refbyAgent--clicked {
- height: 150px;
- }
-
- .spacebanked1 {
- will-change: transform;
- transition: height 500ms;
- height: 0px;
- }
-
- .spacebanked1--clicked {
- height: 150px;
- }
-
- .custom-file-label {
- border-width: 2px;
- border-color: rgb(27, 117, 187);
- margin-bottom: 20px;
- }
-
- .custom-file-label::after {
- border-left: none;
- border-bottom: solid;
- border-width: 2px;
- border-color: rgb(27, 117, 187);
- font-family: "Muli";
- }
- </style>
|