You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

makeOffer.vue 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <!-- eslint-disable max-len -->
  3. <div style="padding-left:50px; padding-right:50px; padding-bottom:50px;">
  4. <div v-if="!isSaved">
  5. <br />
  6. <div v-if="isProperty">
  7. <div class="form-group row">
  8. <div class="col-md-6">
  9. <div class="title-box-d">
  10. <h3 class="title-d">{{ item.shortDescription }}</h3>
  11. </div>
  12. </div>
  13. </div>
  14. <div class="form-group row">
  15. <div class="col-md-12" style="text-align:left">
  16. <div v-html="item.description"></div>
  17. </div>
  18. </div>
  19. </div>
  20. <div v-if="!isProperty">
  21. <div class="form-group row">
  22. <div class="col-md-6 col-lg-5 section-md-t3">
  23. <div class="title-box-d">
  24. <h3 class="title-d">{{ item ? item.resort.resortName : '' }}</h3>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="form-group row">
  29. <div class="col-md-6">
  30. <label for="resortunit">Unit</label>
  31. <div class="input-group mb-3">
  32. <div class="input-group-prepend">
  33. <span class="input-group-text" style="color: #60CBEB">
  34. <b>U#</b>
  35. </span>
  36. </div>
  37. <input
  38. class="form-control"
  39. type="text"
  40. id="resort"
  41. name="resortunit"
  42. disabled
  43. v-model="item.unitNumber"
  44. />
  45. </div>
  46. </div>
  47. <div class="col-md-6">
  48. <label for="resortWeek">Module / Week Number</label>
  49. <div class="input-group mb-3">
  50. <div class="input-group-prepend">
  51. <span class="input-group-text" style="color: #60CBEB">
  52. <b>M</b>
  53. </span>
  54. </div>
  55. <input
  56. class="form-control"
  57. type="text"
  58. id="week"
  59. name="resortWeek"
  60. disabled
  61. v-model="item.weekNumber"
  62. />
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="form-group row">
  68. <div class="col-md-6">
  69. <label>Current Price</label>
  70. <div class="input-group mb-3">
  71. <div class="input-group-prepend">
  72. <span class="input-group-text" style="color: #60CBEB">
  73. <b>R</b>
  74. </span>
  75. </div>
  76. <input class="form-control" type="number" v-model="item.sellPrice" disabled />
  77. </div>
  78. </div>
  79. <div class="col-md-6">
  80. <label>Offer</label>
  81. <div class="input-group mb-3">
  82. <div class="input-group-prepend">
  83. <span class="input-group-text" style="color: #60CBEB">
  84. <b>R</b>
  85. </span>
  86. </div>
  87. <input
  88. class="form-control"
  89. type="number"
  90. step="any"
  91. id="minPrice"
  92. name="minPrice"
  93. v-model="item.offer"
  94. :disabled="!isMakeOffer"
  95. />
  96. </div>
  97. </div>
  98. </div>
  99. <div class="form-group row">
  100. <div class="col-md-12">
  101. <label>Comments</label>
  102. <textarea
  103. class="form-control editor form-control-lg form-control-a"
  104. name="description"
  105. v-model="item.comment"
  106. :disabled="!isMakeOffer"
  107. ></textarea>
  108. </div>
  109. </div>
  110. </div>
  111. <div v-if="!isSaved" class="container">
  112. <button
  113. v-if="isMakeOffer"
  114. type="button"
  115. @click="SendOffer()"
  116. class="btn btn-b-n"
  117. style="width: 150px; height:40px;"
  118. >Send Offer</button>
  119. <button
  120. v-if="!isMakeOffer && !isDecline && canEdit"
  121. type="submit"
  122. @click="Accept()"
  123. class="btn btn-b-n"
  124. style="width: 150px; height:40px;"
  125. >Accept</button>
  126. <button
  127. v-if="!isMakeOffer && !isDecline && canEdit"
  128. type="button"
  129. @click="Decline()"
  130. class="btn btn-b-n"
  131. style="width: 150px; height:40px;"
  132. >Decline</button>
  133. </div>
  134. <div v-if="isDecline || item.statusCode === 'E3'" class="form-group row">
  135. <div class="col-md-12">
  136. <br />
  137. <label>Decline Reason</label>
  138. <textarea
  139. class="form-control editor form-control-lg form-control-a"
  140. name="description"
  141. v-model="item.declineReason"
  142. :disabled="item.statusCode === 'E3'"
  143. ></textarea>
  144. </div>
  145. </div>
  146. <button
  147. v-if="isDecline"
  148. type="button"
  149. @click="Complete()"
  150. class="btn btn-b-n"
  151. style="width: 150px; height:40px;"
  152. >Complete</button>
  153. <div v-if="isSaved">
  154. <div class="form-group row">
  155. <br />
  156. <label>{{ message }}</label>
  157. </div>
  158. <button
  159. v-if="isSaved"
  160. type="button"
  161. class="btn btn-b-n"
  162. style="width: 150px; height:40px;"
  163. data-dismiss="modal"
  164. >OK</button>
  165. </div>
  166. </div>
  167. </template>
  168. <script>
  169. import { mapState, mapActions } from 'vuex';
  170. export default {
  171. name: 'MakeOffer',
  172. props: {
  173. isMakeOffer: Boolean,
  174. isProperty: Boolean,
  175. canEdit: Boolean,
  176. item: Object,
  177. bidId: Number,
  178. updateItem: Function,
  179. },
  180. data() {
  181. return {
  182. isDecline: false,
  183. isSaved: false,
  184. message: '',
  185. };
  186. },
  187. methods: {
  188. ...mapActions('bid', ['getBid', 'saveBid', 'acceptBid', 'declineBid']),
  189. SendOffer() {
  190. this.getBid(0);
  191. this.bidItem.id = 0;
  192. this.bidItem.amount = this.item.offer;
  193. this.bidItem.comment = this.item.comment;
  194. if (this.isProperty) {
  195. this.bidItem.propertyId = this.item.id;
  196. } else {
  197. this.bidItem.timeshareWeekId = this.item.id;
  198. }
  199. this.saveBid(this.bidItem);
  200. this.item = [];
  201. this.isSaved = true;
  202. this.message = 'Offer was submitted.';
  203. },
  204. Accept() {
  205. this.acceptBid(this.item.id);
  206. this.isSaved = true;
  207. this.message = 'Offer Accepted.';
  208. },
  209. Decline() {
  210. this.isDecline = true;
  211. },
  212. Complete() {
  213. this.isDecline = false;
  214. const decline = {
  215. id: this.item.id,
  216. comment: this.item.declineReason,
  217. };
  218. this.declineBid(decline);
  219. this.isSaved = true;
  220. this.message = 'Offer Declined.';
  221. },
  222. },
  223. computed: {
  224. ...mapState('bid', ['bidItem']),
  225. },
  226. };
  227. </script>