소스 검색

tenderWeeks admin

master
Kobus Botha 5 년 전
부모
커밋
1632661b72

+ 3
- 0
src/App.vue 파일 보기

33
 </script>
33
 </script>
34
 
34
 
35
 <style>
35
 <style>
36
+button:hover {
37
+  cursor: pointer;
38
+},
36
 hr {
39
 hr {
37
   background-color: #60cbeb;
40
   background-color: #60cbeb;
38
 }
41
 }

+ 8
- 4
src/components/admin/status/tenderWeekAdminPage.vue 파일 보기

17
       </div>
17
       </div>
18
     </div>
18
     </div>
19
     <div id="table" class="col-xs-12 table-responsive">
19
     <div id="table" class="col-xs-12 table-responsive">
20
-      <datatable :columns="columns" :data="rows"></datatable>
20
+      <ListView :items="items" :showNew="false"></listView>
21
     </div>
21
     </div>
22
     <br />
22
     <br />
23
   </div>
23
   </div>
26
 </template>
26
 </template>
27
 <script>
27
 <script>
28
 import { mapState, mapActions } from 'vuex';
28
 import { mapState, mapActions } from 'vuex';
29
+import ListView from '../../shared/listView.vue';
29
 
30
 
30
 export default {
31
 export default {
31
   name: 'TenderWeekAdmin',
32
   name: 'TenderWeekAdmin',
32
   created() {
33
   created() {
33
-    this.gettenderWeekdmin();
34
+    this.getItems();
35
+  },
36
+  components: {
37
+    ListView
34
   },
38
   },
35
   computed: {
39
   computed: {
36
-    ...mapState('status', ['tenderWeekAdmin']),
40
+    ...mapState('tenderWeek', ['items']),
37
   },
41
   },
38
   methods: {
42
   methods: {
39
-    ...mapActions('status', ['gettenderWeekAdmin']),
43
+    ...mapActions('tenderWeek', ['getItems']),
40
   },
44
   },
41
 };
45
 };
42
 </script>
46
 </script>

+ 2
- 2
src/components/shared/listView.vue 파일 보기

14
         <div class="d-flex flex-row">
14
         <div class="d-flex flex-row">
15
           <div class="p2" v-if="selectedItems.length > 0">
15
           <div class="p2" v-if="selectedItems.length > 0">
16
             <div
16
             <div
17
-              class="btn btn-primary myBackground btn-width"
17
+              class="btn btn-primary myBackground btn-width cursor-pointer"
18
               @click="onClearSelected()"
18
               @click="onClearSelected()"
19
             >Clear Selected</div>
19
             >Clear Selected</div>
20
           </div>
20
           </div>
21
           <div class="p2" v-if="showNew">
21
           <div class="p2" v-if="showNew">
22
-            <div class="btn btn-primary myBackground btn-width" @click="onNew()">New</div>
22
+            <div class="btn btn-primary myBackground btn-width cursor-pointer" @click="onNew()">New</div>
23
           </div>
23
           </div>
24
         </div>
24
         </div>
25
       </div>
25
       </div>

+ 9
- 2
src/components/timeshare/buy/buyPage.vue 파일 보기

35
           </div>
35
           </div>
36
           <hr />
36
           <hr />
37
           <div class="row mb-4">
37
           <div class="row mb-4">
38
-            <div class="container col-md-4">
39
-              <div class="accordion" id="accordionExample">
38
+            <div class="container col-md-4" v-if="availRegion">
39
+              <div class="accordion" id="accordionExample" v-if="availRegion.length > 0">
40
                 <div class="card darker-border" v-for="(region, r) in availRegion" :key="r">
40
                 <div class="card darker-border" v-for="(region, r) in availRegion" :key="r">
41
                   <a
41
                   <a
42
                     class="mb-0 color-text-a"
42
                     class="mb-0 color-text-a"
77
                     </div>
77
                     </div>
78
                   </div>
78
                   </div>
79
                 </div>
79
                 </div>
80
+                  </div>
81
+                  <div v-else>
82
+                    <Alert :text="'No items found...'" :type="'INFO'" />
80
               </div>
83
               </div>
81
             </div>
84
             </div>
82
             <div class="col-md-8">
85
             <div class="col-md-8">
110
 </template>
113
 </template>
111
 <script>
114
 <script>
112
 import { mapState, mapActions } from 'vuex';
115
 import { mapState, mapActions } from 'vuex';
116
+import Alert from '../../shared/alert.vue';
113
 
117
 
114
 export default {
118
 export default {
115
   name: 'TimeshareToBuy',
119
   name: 'TimeshareToBuy',
120
+  components:{
121
+    Alert
122
+  },
116
   data() {
123
   data() {
117
     return {
124
     return {
118
       myMap: 'SouthAfrica',
125
       myMap: 'SouthAfrica',

+ 38
- 11
src/components/timeshare/myWeeksPage.vue 파일 보기

1
 <template>
1
 <template>
2
-  <div>
3
-    <br />
4
-    <br />
5
-    <br />
6
-    <br />
7
-    <br />
8
-    
9
-    <div class="row">
10
-      <div class="offset-1 col-md-10">
11
-        <ListView :items="items" :editable="true" @onEdit="onEdit" />
12
-      </div>
2
+<div>
3
+  <br />
4
+  <div class="row">
5
+    <div class="offset-1 col-md-3">
6
+      {{items[selectedItems]}}
7
+      <button 
8
+        type="button"
9
+        :class="{'form-control btn btn-primary ': (1===1), 'my-disable': (!(selectedItems.length == 1) || !items[selectedItems] || items[selectedItems].status.code !== 'A2')}"
10
+        value="Publish Week"
11
+        :disabled="!(items.length == 1)"
12
+      >
13
+        Publish selected week
14
+      </button>
15
+    </div>
16
+    <div class="offset-1 col-md-10">
17
+      <ListView :items="items" :editable="true" @onNew="onNew" @onRowClick="onRowClick"
18
+          @onClearSelected="onClearSelected"  />
13
     </div>
19
     </div>
14
   </div>
20
   </div>
21
+</div>
15
 </template>
22
 </template>
16
 <script>
23
 <script>
17
 import { mapState, mapActions } from 'vuex';
24
 import { mapState, mapActions } from 'vuex';
25
   data() {
32
   data() {
26
     return {
33
     return {
27
       user: Log.getUser(),
34
       user: Log.getUser(),
35
+      selectedItems: [],
28
     };
36
     };
29
   },
37
   },
30
   mounted() {
38
   mounted() {
39
     onEdit(item) {
47
     onEdit(item) {
40
       this.$router.push(`/timeshare/${item.id}`);
48
       this.$router.push(`/timeshare/${item.id}`);
41
     },
49
     },
50
+    onNew() {
51
+      this.$router.push('/timeshare/sell');
52
+    },
53
+    onRowClick(items) {
54
+      this.selectedItems = items;
55
+    },
56
+    onClearSelected() {
57
+      this.selectedItems = [];
58
+    },
42
   },
59
   },
43
 };
60
 };
44
 </script>
61
 </script>
62
+<style scoped>
63
+.my-disable {
64
+  background-color: silver;
65
+  border-color: silver;
66
+}
67
+.my-disable:hover {
68
+  background-color: lightgray;
69
+  border-color: lightgray;
70
+}
71
+</style>

+ 2
- 0
src/store/index.js 파일 보기

26
 import Carousel from './modules/misc/carousel';
26
 import Carousel from './modules/misc/carousel';
27
 import Individual from './modules/user/individual';
27
 import Individual from './modules/user/individual';
28
 import Alert from './modules/misc/alert';
28
 import Alert from './modules/misc/alert';
29
+import TenderWeek from './modules/timeshare/tenderWeeks';
29
 
30
 
30
 Vue.use(Vuex);
31
 Vue.use(Vuex);
31
 /* eslint no-param-reassign: ["error", { "props": false }] */
32
 /* eslint no-param-reassign: ["error", { "props": false }] */
56
     carousel: Carousel,
57
     carousel: Carousel,
57
     individual: Individual,
58
     individual: Individual,
58
     alert: Alert,
59
     alert: Alert,
60
+    tenderWeek: TenderWeek
59
   },
61
   },
60
 });
62
 });

+ 3
- 0
src/store/modules/timeshare/myWeeks.js 파일 보기

35
         console.log(err);
35
         console.log(err);
36
       }
36
       }
37
     },
37
     },
38
+    publishWeek(id) {
39
+      axios.post(`/api/timeshareweek/publishweek/${id}`).catch(console.error);
40
+    }
38
 
41
 
39
   },
42
   },
40
 };
43
 };

+ 22
- 0
src/store/modules/timeshare/tenderWeeks.js 파일 보기

1
+import axios from 'axios';
2
+
3
+export default {
4
+  namespaced: true,
5
+  state: {
6
+    items: [],
7
+  },
8
+  mutations: {
9
+    setItems(state, list) {
10
+      state.items = list;
11
+    },
12
+  },
13
+  getters: {},
14
+  actions: {
15
+    getItems({ commit }) {
16
+      axios
17
+        .get('/api/timeshareweek/getTenderWeeks')
18
+        .then(result => commit('setItems', result.data))
19
+        .catch(console.error);
20
+    },
21
+  },
22
+};

Loading…
취소
저장