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

Web Setup Validation & formats

master
Brian Conway пре 2 година
родитељ
комит
0c597abd8b
2 измењених фајлова са 84 додато и 68 уклоњено
  1. 14
    7
      src/components/communication/contactUsSource.vue
  2. 70
    61
      src/store/modules/timeshare/status.js

+ 14
- 7
src/components/communication/contactUsSource.vue Прегледај датотеку

@@ -16,7 +16,7 @@
16 16
                 <div class="col-md-4">
17 17
                   <float-label fixed label="Description">
18 18
                     <input
19
-                      class="form-control"
19
+                      class="form-control uniInput"
20 20
                       type="text"
21 21
                       name="description"
22 22
                       id="description"
@@ -36,6 +36,11 @@
36 36
               </div>
37 37
             </form>
38 38
           </div>
39
+          <div v-if="boolValidationError" class="row">
40
+            <div class="col">
41
+              <alert :text="errorMessage" :type="errorOccurred" />
42
+            </div>
43
+          </div>
39 44
           <div class="col-md-12">
40 45
             <button
41 46
               type="button"
@@ -109,13 +114,15 @@ export default {
109 114
       'clearContactUsSource',
110 115
     ]),
111 116
     SubmitData() {
112
-      console.log('SubmitData')
113
-      if (this.contactUsSource.id > 0) {
114
-        this.updateContactUsSource(this.contactUsSource)
115
-      } else {
116
-        this.saveContactUsSource(this.contactUsSource)
117
+      if (this.validatePage()) {
118
+        console.log('SubmitData')
119
+        if (this.contactUsSource.id > 0) {
120
+          this.updateContactUsSource(this.contactUsSource)
121
+        } else {
122
+          this.saveContactUsSource(this.contactUsSource)
123
+        }
124
+        this.$router.push('/contactUsSource/list')
117 125
       }
118
-      this.$router.push('/contactUsSource/list')
119 126
     },
120 127
     Close() {
121 128
       this.$router.push('/contactUsSource/list')

+ 70
- 61
src/store/modules/timeshare/status.js Прегледај датотеку

@@ -1,67 +1,76 @@
1 1
 /* eslint-disable */
2
-import axios from 'axios';
2
+import axios from 'axios'
3 3
 
4 4
 export default {
5
-  namespaced: true,
6
-  state: {
7
-    statusList: [],
8
-    singleStatus: {}
9
-  },
10
-  mutations: {
11
-    setStatusList(state, list) {
12
-      state.statusList = list;
5
+    namespaced: true,
6
+    state: {
7
+        statusList: [],
8
+        status: {},
13 9
     },
14
-    addNewStatus(state, status){
15
-      state.statusList.push(status)
10
+    mutations: {
11
+        setStatusList(state, list) {
12
+            state.statusList = list
13
+        },
14
+        addNewStatus(state, status) {
15
+            state.statusList.push(status)
16
+        },
17
+        setSingleStatus(state, status) {
18
+            state.status = status
19
+        },
20
+        deleteStatus(state, id) {
21
+            var index = state.statusList.findIndex((stat) => stat.id == id)
22
+            state.statusList.splice(index, 1)
23
+        },
24
+        clearStatus(state) {
25
+            state.status = {
26
+                code: '',
27
+                description: '',
28
+            }
29
+        },
16 30
     },
17
-    setSingleStatus(state, status){
18
-      state.singleStatus = status
31
+    getters: {},
32
+    actions: {
33
+        getStatusList({ commit }) {
34
+            axios
35
+                .get('/api/status')
36
+                .then((result) => commit('setStatusList', result.data))
37
+                .catch(console.error)
38
+        },
39
+        async getSingleStatus({ commit }, id) {
40
+            await axios
41
+                .get('/api/status/' + id)
42
+                .then((result) => {
43
+                    commit('setSingleStatus', result.data[0])
44
+                })
45
+                .catch((e) => {
46
+                    console.log(e.response)
47
+                })
48
+        },
49
+        async createNewStatus({ commit }, status) {
50
+            await axios
51
+                .post('/api/status', status)
52
+                .then((result) => {
53
+                    commit('addNewStatus', result.data)
54
+                })
55
+                .catch((e) => {
56
+                    console.log(e)
57
+                })
58
+        },
59
+        async updateStatus({ commit }, status) {
60
+            await axios
61
+                .put('/api/status', status)
62
+                .then((result) => {})
63
+                .catch((e) => {
64
+                    console.log(e)
65
+                })
66
+        },
67
+        async deleteStatus({ commit }, id) {
68
+            await axios.delete('/api/status/' + id).then(() => {
69
+                commit('deleteStatus', id)
70
+            })
71
+        },
72
+        clearStatus({ commit }) {
73
+            commit('clearStatus')
74
+        },
19 75
     },
20
-    deleteStatus(state, id){
21
-      var index = state.statusList.findIndex((stat) => stat.id == id)
22
-      state.statusList.splice(index, 1)
23
-    }
24
-  },
25
-  getters: {},
26
-  actions: {
27
-    getStatusList({ commit }) {
28
-      axios
29
-        .get('/api/status')
30
-        .then(result => commit('setStatusList', result.data))
31
-        .catch(console.error);
32
-    },
33
-    async getSingleStatus({commit}, id){
34
-      await axios.get('/api/status/'+ id)
35
-      .then((result) => {
36
-        commit("setSingleStatus", result.data[0])
37
-      })
38
-      .catch((e) => {
39
-        console.log(e.response);
40
-      })
41
-    },
42
-    async createNewStatus({commit}, status){
43
-      await axios.post("/api/status", status)
44
-      .then((result) => {
45
-        commit("addNewStatus", result.data)
46
-      })
47
-      .catch((e) => {
48
-        console.log(e);
49
-      })
50
-    },
51
-    async updateStatus({commit}, status){
52
-      await axios.put("/api/status", status)
53
-      .then((result) => {
54
-        
55
-      })
56
-      .catch((e) => {
57
-        console.log(e);
58
-      })
59
-    },
60
-    async deleteStatus({commit}, id){
61
-      await axios.delete('/api/status/'+id)
62
-      .then(() => {
63
-        commit("deleteStatus", id)
64
-      })
65
-    }
66
-  },
67
-};
76
+}

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