Explorar el Código

Added template and info

master
Kobus hace 5 años
padre
commit
43d299fb0c

+ 4
- 0
src/App.vue Ver fichero

@@ -46,6 +46,10 @@ hr {
46 46
   border: white solid 3px;
47 47
   border-radius: 15px;
48 48
 }
49
+.myBackground {
50
+  border-color: #60cbeb;
51
+  background-color: #60cbeb;
52
+}
49 53
 .myFill {
50 54
   fill: #60cbeb;
51 55
   color: #60cbeb;

+ 206
- 0
src/components/communication/templateDetail.vue Ver fichero

@@ -0,0 +1,206 @@
1
+<template>
2
+  <div style="padding:10px;">
3
+    <div class="container" style="background-color:rgba(215,215,215,0.75);padding:20px;">
4
+      <div class="row">
5
+        <div class="col-md-12">
6
+          <div class="d-flex">
7
+            <div class="p-2 mr-auto">
8
+              <h2>Detailed Item</h2>
9
+            </div>
10
+            <div class="p-2">
11
+              <div class="btn btn-primary myBackground">Add New</div>
12
+            </div>
13
+            <div class="p-2">
14
+              <div class="btn btn-primary myBackground">Edit</div>
15
+            </div>
16
+            <div class="p-2">
17
+              <div class="btn btn-primary myBackground">Close</div>
18
+            </div>
19
+          </div>
20
+        </div>
21
+        <div class="col-md-12">
22
+          <hr />
23
+        </div>
24
+        <div class="col-md-4 text-left">
25
+          <label>Id</label>
26
+          <div class="input-group mb-3">
27
+            <div class="input-group-prepend">
28
+              <span class="input-group-text" style="color: #60CBEB">
29
+                <b>I</b>
30
+              </span>
31
+            </div>
32
+            <input class="form-control" type="number" step="any" name="levy" v-model="item.id" />
33
+          </div>
34
+        </div>
35
+        <div class="col-md-8 text-left">
36
+          <label for="Sleeps maximum">Name</label>
37
+          <div class="input-group mb-3">
38
+            <div class="input-group-prepend">
39
+              <span class="input-group-text" style="color: #60CBEB">
40
+                <b>N</b>
41
+              </span>
42
+            </div>
43
+            <input class="form-control" type="text" step="any" name="levy" v-model="item.name" />
44
+          </div>
45
+        </div>
46
+        <div class="col-md-12">
47
+          <hr />
48
+        </div>
49
+        <div class="col-md-12 text-left">
50
+          <label for="Sleeps maximum">Subject</label>
51
+          <div class="input-group mb-3">
52
+            <div class="input-group-prepend">
53
+              <span class="input-group-text" style="color: #60CBEB">
54
+                <b>S</b>
55
+              </span>
56
+            </div>
57
+            <input class="form-control" type="text" step="any" name="levy" v-model="item.subject" />
58
+          </div>
59
+        </div>
60
+        <div class="col-md-12">
61
+          <ul class="nav nav-tabs" id="myTab" role="tablist">
62
+            <li class="nav-item">
63
+              <a
64
+                class="nav-link active"
65
+                id="directions-tab"
66
+                data-toggle="tab"
67
+                href="#directions"
68
+                role="tab"
69
+                aria-controls="directions"
70
+                aria-selected="false"
71
+              >Html</a>
72
+            </li>
73
+            <li class="nav-item">
74
+              <a
75
+                class="nav-link"
76
+                id="resort-layout-tab"
77
+                data-toggle="tab"
78
+                href="#resort-layout"
79
+                role="tab"
80
+                aria-controls="resort-layout"
81
+                aria-selected="true"
82
+              >Preview</a>
83
+            </li>
84
+          </ul>
85
+          <div
86
+            class="tab-content"
87
+            id="myTabContent"
88
+            style="background-color:rgba(255,255,255,0.75);padding:10px;"
89
+          >
90
+            <div
91
+              class="tab-pane fade show active"
92
+              style="background-color:rgba(255,255,255,0.75);padding:10px;"
93
+              id="directions"
94
+              role="tabpanel"
95
+              aria-labelledby="directions-tab"
96
+            >
97
+              <div class="text-left">
98
+                <label for="Sleeps maximum">Body</label>
99
+                <div class="input-group mb-3">
100
+                  <div class="input-group-prepend">
101
+                    <span class="input-group-text" style="color: #60CBEB">
102
+                      <b>B</b>
103
+                    </span>
104
+                  </div>
105
+                  <textarea
106
+                    class="form-control"
107
+                    type="text"
108
+                    rows="10"
109
+                    step="any"
110
+                    name="levy"
111
+                    v-model="item.body"
112
+                  />
113
+                </div>
114
+              </div>
115
+            </div>
116
+            <div
117
+              class="tab-pane fade"
118
+              id="resort-layout"
119
+              role="tabpanel"
120
+              aria-labelledby="resort-layout-tab"
121
+            >
122
+              <div class="no-style" v-html="item.body"></div>
123
+            </div>
124
+          </div>
125
+        </div>
126
+        <div class="col-md-12">
127
+          <hr />
128
+        </div>
129
+        <div class="col-md-12">
130
+          <div class="d-flex">
131
+            <div class="p-2 mr-auto">
132
+              <h2>Coded Fields</h2>
133
+            </div>
134
+            <div class="p-2">
135
+              <div class="btn btn-primary myBackground" @click="addClose()">{{btnCaption}}</div>
136
+            </div>
137
+          </div>
138
+        </div>
139
+        <div
140
+          class="col-md-12"
141
+          v-if="showNew"
142
+          style="background-color:rgba(255,255,255,1); border-radius:5px;padding:10px;"
143
+        >
144
+          <TemplateInnerItem />
145
+        </div>
146
+        <div class="col-md-12">
147
+          <hr />
148
+        </div>
149
+        <div class="col-md-12">
150
+          <ListView :items="item.placeHolders" :hideSearch="true" />
151
+        </div>
152
+      </div>
153
+    </div>
154
+  </div>
155
+</template>
156
+<script>
157
+import ListView from '../shared/listView.vue';
158
+import TemplateInnerItem from './templateInnerItem.vue';
159
+
160
+export default {
161
+  data() {
162
+    return {
163
+      showNew: false,
164
+    };
165
+  },
166
+  components: {
167
+    ListView,
168
+    TemplateInnerItem,
169
+  },
170
+  props: {
171
+    item: {},
172
+  },
173
+  computed: {
174
+    btnCaption() {
175
+      return this.showNew ? 'Close' : 'New';
176
+    },
177
+  },
178
+  methods: {
179
+    addClose() {
180
+      if (this.showNew) {
181
+        this.showNew = false;
182
+      } else this.showNew = true;
183
+    },
184
+  },
185
+};
186
+</script>
187
+<style>
188
+.no-style {
189
+  background: #fff;
190
+  border: none;
191
+  color: #000;
192
+  display: block;
193
+  font: initial;
194
+  height: auto;
195
+  letter-spacing: normal;
196
+  line-height: normal;
197
+  margin: 0;
198
+  padding: 0;
199
+  text-transform: none;
200
+  visibility: visible;
201
+  width: auto;
202
+  word-spacing: normal;
203
+  z-index: auto;
204
+  text-align: left;
205
+}
206
+</style>

+ 54
- 0
src/components/communication/templateInnerItem.vue Ver fichero

@@ -0,0 +1,54 @@
1
+<template>
2
+  <div class="row">
3
+    <div class="col-md-3">
4
+      <input
5
+        class="form-control"
6
+        type="text"
7
+        step="any"
8
+        name="levy"
9
+        placeholder="Name"
10
+        v-model="item.name"
11
+      />
12
+    </div>
13
+    <div class="col-md-3">
14
+      <select class="form-control" v-model="item.class" @change="onClassChanged()">
15
+        <option v-for="(item, i) in classes" :key="i" :value="item">{{item.name}}</option>
16
+      </select>
17
+    </div>
18
+    <div class="col-md-3">
19
+      <select class="form-control" v-model="item.property">
20
+        <option v-for="(item, i) in properties" :key="i">{{item}}</option>
21
+      </select>
22
+    </div>
23
+    <div class="col-md-3">
24
+      <div class="btn btn-primary myBackground w-100">Add</div>
25
+    </div>
26
+  </div>
27
+</template>
28
+<script>
29
+import { mapState, mapActions } from 'vuex';
30
+
31
+export default {
32
+  mounted() {
33
+    this.init();
34
+  },
35
+  data() {
36
+    return {
37
+      item: {
38
+        name: undefined,
39
+        class: undefined,
40
+        property: undefined,
41
+      },
42
+    };
43
+  },
44
+  computed: {
45
+    ...mapState('info', ['classes', 'properties']),
46
+  },
47
+  methods: {
48
+    ...mapActions('info', ['init', 'getClasses', 'getProperties']),
49
+    onClassChanged() {
50
+      this.getProperties(this.item.class);
51
+    },
52
+  },
53
+};
54
+</script>

+ 58
- 0
src/components/communication/templatePage.vue Ver fichero

@@ -0,0 +1,58 @@
1
+<template>
2
+  <div>
3
+    <br />
4
+    <hr />
5
+    <hr />
6
+    <hr />
7
+    <hr />
8
+    <hr />
9
+    <div class="row">
10
+      <div :class="listClass">
11
+        <ListView :items="list" @onRowClick="onRowClick" />
12
+      </div>
13
+      <div class="col-md-6" v-if="showDetailView">
14
+        <DetailView :item="detailItem" />
15
+      </div>
16
+    </div>
17
+    <hr />
18
+  </div>
19
+</template>
20
+
21
+<script>
22
+import { mapState, mapActions } from 'vuex';
23
+import ListView from '../shared/listView.vue';
24
+import DetailView from './templateDetail.vue';
25
+
26
+export default {
27
+  data() {
28
+    return {
29
+      detailItem: undefined,
30
+    };
31
+  },
32
+  components: {
33
+    ListView,
34
+    DetailView,
35
+  },
36
+  mounted() {
37
+    this.getList();
38
+  },
39
+  computed: {
40
+    ...mapState('template', ['list', 'item']),
41
+    showDetailView() {
42
+      return this.detailItem !== undefined && this.detailItem != null;
43
+    },
44
+    listClass() {
45
+      return this.detailItem !== undefined && this.detailItem != null
46
+        ? 'col-md-6'
47
+        : 'col-md-12';
48
+    },
49
+  },
50
+  methods: {
51
+    ...mapActions('template', ['getList']),
52
+    onRowClick(item) {
53
+      console.log(item);
54
+      this.detailItem = item;
55
+    },
56
+  },
57
+};
58
+</script>

+ 13
- 2
src/components/shared/listView.vue Ver fichero

@@ -3,7 +3,7 @@
3 3
 <template>
4 4
   <div>
5 5
     <div class="container">
6
-      <div class="d-flex justify-content-between">
6
+      <div class="d-flex justify-content-between" v-if="!hideSearch">
7 7
         <div class="p-2">
8 8
           <input v-model="searchItem" class="form-control" placeholder="Search ..." />
9 9
         </div>
@@ -18,7 +18,12 @@
18 18
         </tr>
19 19
       </thead>
20 20
       <tbody>
21
-        <tr v-for="(item, i) in DisplayItems" :key="i" class="text-left dnd-moved">
21
+        <tr
22
+          v-for="(item, i) in DisplayItems"
23
+          :key="i"
24
+          class="text-left dnd-moved"
25
+          @click="onRowClick(item)"
26
+        >
22 27
           <td v-for="(column, c) in Columns" :key="c">{{ item[column] }}</td>
23 28
         </tr>
24 29
       </tbody>
@@ -72,6 +77,9 @@ export default {
72 77
     }
73 78
   },
74 79
   props: {
80
+    hideSearch: {
81
+      default: false,
82
+    },
75 83
     items: undefined,
76 84
   },
77 85
   data() {
@@ -86,6 +94,9 @@ export default {
86 94
     };
87 95
   },
88 96
   methods: {
97
+    onRowClick(item) {
98
+      this.$emit('onRowClick', item);
99
+    },
89 100
     changeColumn(title, checked) {
90 101
       if (checked) {
91 102
         this.myColumns.push(title);

+ 7
- 0
src/router/index.js Ver fichero

@@ -44,6 +44,8 @@ import Offer from '../components/processFlow/offers.vue';
44 44
 import searchLog from '../components/admin/logs/SearchLogs.vue';
45 45
 // import store from '../store';
46 46
 
47
+import TemplatePage from '../components/communication/templatePage.vue';
48
+
47 49
 Vue.use(Router);
48 50
 
49 51
 
@@ -69,6 +71,11 @@ export default new Router({
69 71
     name: 'abouttimeshare',
70 72
     component: AboutTimeshare,
71 73
   },
74
+  {
75
+    path: '/communication/template',
76
+    name: 'template',
77
+    component: TemplatePage,
78
+  },
72 79
   {
73 80
     path: '/timeshare/sell',
74 81
     name: 'TimeshareSell',

+ 4
- 0
src/store/index.js Ver fichero

@@ -20,6 +20,8 @@ import Bid from './modules/processFlow/bid';
20 20
 import Authentication from './modules/user/authentication';
21 21
 import PropertySearch from './modules/property/propertySearch';
22 22
 import SearchLog from './modules/logs/searchLog';
23
+import Template from './modules/communication/template';
24
+import Info from './modules/communication/info';
23 25
 
24 26
 Vue.use(Vuex);
25 27
 /* eslint no-param-reassign: ["error", { "props": false }] */
@@ -45,5 +47,7 @@ export default new Vuex.Store({
45 47
     authentication: Authentication,
46 48
     propertySearch: PropertySearch,
47 49
     searchLog: SearchLog,
50
+    template: Template,
51
+    info: Info,
48 52
   },
49 53
 });

+ 46
- 0
src/store/modules/communication/info.js Ver fichero

@@ -0,0 +1,46 @@
1
+import axios from 'axios';
2
+
3
+export default {
4
+  namespaced: true,
5
+  state: {
6
+    classes: [],
7
+    properties: [],
8
+  },
9
+  mutations: {
10
+    setClasses(state, list) {
11
+      state.classes = list;
12
+    },
13
+    setProperties(state, list) {
14
+      state.properties = list;
15
+    },
16
+    clearAll(state) {
17
+      state.classes = [];
18
+      state.properties = [];
19
+    },
20
+  },
21
+  getters: {},
22
+  actions: {
23
+    init({
24
+      dispatch,
25
+    }) {
26
+      dispatch('clearAll');
27
+      dispatch('getClasses');
28
+    },
29
+    getClasses({
30
+      commit,
31
+    }) {
32
+      axios
33
+        .get('api/info/getAllClasses')
34
+        .then(result => commit('setClasses', result.data))
35
+        .catch(console.error);
36
+    },
37
+    getProperties({
38
+      commit,
39
+    }, obj) {
40
+      axios
41
+        .get(`api/info/${obj.fullName}`)
42
+        .then(result => commit('setProperties', result.data))
43
+        .catch(console.error);
44
+    },
45
+  },
46
+};

+ 25
- 0
src/store/modules/communication/template.js Ver fichero

@@ -0,0 +1,25 @@
1
+import axios from 'axios';
2
+
3
+export default {
4
+  namespaced: true,
5
+  state: {
6
+    list: [],
7
+    item: {},
8
+  },
9
+  mutations: {
10
+    setList(state, list) {
11
+      state.list = list;
12
+    },
13
+  },
14
+  getters: {},
15
+  actions: {
16
+    getList({
17
+      commit,
18
+    }) {
19
+      axios
20
+        .get('/api/template/getSimple')
21
+        .then(result => commit('setList', result.data))
22
+        .catch(console.error);
23
+    },
24
+  },
25
+};

Loading…
Cancelar
Guardar