Преглед изворни кода

Fix made to bids screen

master
George Williams пре 4 година
родитељ
комит
e429d504ed
2 измењених фајлова са 59 додато и 57 уклоњено
  1. 39
    41
      src/components/processFlow/makeOffer.vue
  2. 20
    16
      src/store/modules/processFlow/bid.js

+ 39
- 41
src/components/processFlow/makeOffer.vue Прегледај датотеку

@@ -10,9 +10,7 @@
10 10
         class="btn btn-b-n"
11 11
         style="width: 150px; height:40px;"
12 12
         data-dismiss="modal"
13
-      >
14
-        OK
15
-      </button>
13
+      >OK</button>
16 14
     </div>
17 15
     <div v-else>
18 16
       <div v-if="!isSaved">
@@ -84,27 +82,26 @@
84 82
       <div v-if="!isSaved" class="container">
85 83
         <div class="row">
86 84
           <div algin="center" class="col">
87
-            <button v-if="isMakeOffer" type="button" @click="SendOffer()" class="btn-solid-blue">
88
-              Send Offer
89
-            </button>
85
+            <button
86
+              v-if="isMakeOffer"
87
+              type="button"
88
+              @click="SendOffer()"
89
+              class="btn-solid-blue"
90
+            >Send Offer</button>
90 91
             <button
91 92
               v-if="!isMakeOffer && !isDecline && canEdit"
92 93
               type="submit"
93 94
               @click="Accept()"
94 95
               class="btn btn-b-n"
95 96
               style="width: 150px; height:40px;"
96
-            >
97
-              Accept
98
-            </button>
97
+            >Accept</button>
99 98
             <button
100 99
               v-if="!isMakeOffer && !isDecline && canEdit"
101 100
               type="button"
102 101
               @click="Decline()"
103 102
               class="btn btn-b-n"
104 103
               style="width: 150px; height:40px;"
105
-            >
106
-              Decline
107
-            </button>
104
+            >Decline</button>
108 105
           </div>
109 106
         </div>
110 107
       </div>
@@ -126,9 +123,7 @@
126 123
         @click="Complete()"
127 124
         class="btn btn-b-n"
128 125
         style="width: 150px; height:40px;"
129
-      >
130
-        Complete
131
-      </button>
126
+      >Complete</button>
132 127
       <div v-if="isSaved">
133 128
         <div class="form-group row">
134 129
           <br />
@@ -142,9 +137,7 @@
142 137
           class="btn btn-b-n"
143 138
           style="width: 150px; height:40px;"
144 139
           data-dismiss="modal"
145
-        >
146
-          OK
147
-        </button>
140
+        >OK</button>
148 141
       </div>
149 142
     </div>
150 143
   </div>
@@ -163,7 +156,7 @@ export default {
163 156
     canEdit: Boolean,
164 157
     item: Object,
165 158
     bidId: Number,
166
-    updateItem: Function
159
+    updateItem: Function,
167 160
   },
168 161
   data() {
169 162
     return {
@@ -171,28 +164,30 @@ export default {
171 164
       isSaved: false,
172 165
       message: "",
173 166
       isInfo: true,
174
-      isLoggedIn: Log.isLoggedIn()
167
+      isLoggedIn: Log.isLoggedIn(),
175 168
     };
176 169
   },
177 170
   methods: {
178
-    ...mapActions("bid", ["getBid", "saveBid", "acceptBid", "declineBid"]),
171
+    ...mapActions("bid", ["getTemplate", "saveBid", "acceptBid", "declineBid"]),
179 172
     SendOffer() {
180
-      alert("Under Development");
181
-      // this.getBid(0);
182
-      // this.bidItem.id = 0;
183
-      // this.bidItem.amount = this.item.offer;
184
-      // this.bidItem.comment = this.item.comment;
185
-      // if (this.isProperty) {
186
-      //   this.bidItem.propertyId = this.item.id;
187
-      // } else {
188
-      //   this.bidItem.timeshareWeekId = this.item.id;
189
-      // }
190
-      // this.saveBid(this.bidItem);
173
+      //alert("Under Development");
174
+      this.bidItem.id = 0;
175
+
176
+      this.bidItem.amount = this.item.offer;
177
+      this.bidItem.comment = this.item.comment;
178
+      if (this.isProperty) {
179
+        this.bidItem.propertyId = this.item.id;
180
+      } else {
181
+        this.bidItem.timeshareWeekId = this.item.id;
182
+        if (this.item.isTender) {
183
+          this.bidItem.tenderWeek = this.item;
184
+        }
185
+      }
186
+      this.saveBid(this.bidItem);
191 187
 
192
-      // this.item = [];
193
-      // this.isSaved = true;
194
-      // this.message = "Offer was submitted.";
195
-      // this.isInfo = true;
188
+      this.isSaved = true;
189
+      this.isInfo = true;
190
+      this.message = "Offer was submitted.";
196 191
     },
197 192
     Accept() {
198 193
       this.acceptBid(this.item.id);
@@ -208,24 +203,27 @@ export default {
208 203
 
209 204
       const decline = {
210 205
         id: this.item.id,
211
-        comment: this.item.declineReason
206
+        comment: this.item.declineReason,
212 207
       };
213 208
 
214 209
       this.declineBid(decline);
215 210
       this.isSaved = true;
216 211
       this.message = "Offer Declined.";
217 212
       this.isInfo = false;
218
-    }
213
+    },
219 214
   },
220 215
   computed: {
221
-    ...mapState("bid", ["bidIt,em"])
216
+    ...mapState("bid", ["bidItem"]),
217
+  },
218
+  mounted() {
219
+    this.getTemplate();
222 220
   },
223 221
   watch: {
224 222
     item() {
225 223
       this.isSaved = false;
226 224
       this.canEdit = this.item.statusCode === "E1";
227
-    }
228
-  }
225
+    },
226
+  },
229 227
 };
230 228
 </script>
231 229
 

+ 20
- 16
src/store/modules/processFlow/bid.js Прегледај датотеку

@@ -1,11 +1,12 @@
1
-import axios from 'axios';
2
-import log from '../../../assets/Log';
1
+import axios from "axios";
2
+import log from "../../../assets/Log";
3
+import { result } from "lodash";
3 4
 
4 5
 export default {
5 6
   namespaced: true,
6 7
   state: {
7 8
     bidItem: {},
8
-    bidItems: [],
9
+    bidItems: []
9 10
   },
10 11
   mutations: {
11 12
     setBid(state, bid) {
@@ -20,20 +21,23 @@ export default {
20 21
     updateBidList(state, bid) {
21 22
       state.bidItems.find(item => item.id === bid.id).status = bid.status;
22 23
       console.log(JSON.stringify(bid));
23
-    },
24
+    }
24 25
   },
25 26
   getters: {},
26 27
   actions: {
28
+    getTemplate({ commit }) {
29
+      axios.get("/api/bid/GetNewBidTemplate").then(result => commit("setBid", result.data));
30
+    },
27 31
     getBid({ commit }, id) {
28 32
       axios
29 33
         .get(`/api/bid/${id}`)
30
-        .then(result => commit('addToBids', result.data))
34
+        .then(result => commit("addToBids", result.data))
31 35
         .catch(console.error);
32 36
     },
33 37
     getBids({ commit }) {
34 38
       axios
35
-        .get('/api/bid/GetBids/All')
36
-        .then(result => commit('setBids', result.data))
39
+        .get("/api/bid/GetBids/All")
40
+        .then(result => commit("setBids", result.data))
37 41
         .catch(console.error);
38 42
     },
39 43
     saveBid({ commit }, item) {
@@ -42,27 +46,27 @@ export default {
42 46
       }
43 47
       console.log(JSON.stringify(item));
44 48
       axios
45
-        .post('/api/bid', item)
46
-        .then(result => commit('setBid', result.data))
49
+        .post("/api/bid", item)
50
+        .then(result => commit("setBid", result.data))
47 51
         .catch(console.error);
48 52
     },
49 53
     updateBid({ commit }, item) {
50 54
       axios
51
-        .put('/api/bid', item)
52
-        .then(result => commit('setBid', item))
55
+        .put("/api/bid", item)
56
+        .then(result => commit("setBid", item))
53 57
         .catch(console.error);
54 58
     },
55 59
     acceptBid({ commit }, id) {
56 60
       axios
57 61
         .put(`/api/bid/AcceptBid/${id}`)
58
-        .then(result => commit('updateBidList', result.data))
62
+        .then(result => commit("updateBidList", result.data))
59 63
         .catch(console.error);
60 64
     },
61 65
     declineBid({ commit }, item) {
62 66
       axios
63
-        .put('/api/bid/DeclineBid', item)
64
-        .then(result => commit('updateBidList', result.data))
67
+        .put("/api/bid/DeclineBid", item)
68
+        .then(result => commit("updateBidList", result.data))
65 69
         .catch(console.error);
66
-    },
67
-  },
70
+    }
71
+  }
68 72
 };

Loading…
Откажи
Сачувај