|
@@ -89,6 +89,7 @@ export default {
|
89
|
89
|
alert,
|
90
|
90
|
},
|
91
|
91
|
mounted() {
|
|
92
|
+ this.getContactUsSources()
|
92
|
93
|
this.clearContactUsSource()
|
93
|
94
|
if (this.$route.params.id > 0) {
|
94
|
95
|
console.log(this.$route.params.id)
|
|
@@ -97,7 +98,7 @@ export default {
|
97
|
98
|
}
|
98
|
99
|
},
|
99
|
100
|
computed: {
|
100
|
|
- ...mapState('contactUsSources', ['contactUsSource']),
|
|
101
|
+ ...mapState('contactUsSources', ['contactUsSource', 'contactUsSources']),
|
101
|
102
|
checkAccess() {
|
102
|
103
|
if (Log.getUser().role === 'Super Admin') {
|
103
|
104
|
return true
|
|
@@ -112,6 +113,7 @@ export default {
|
112
|
113
|
'saveContactUsSource',
|
113
|
114
|
'updateContactUsSource',
|
114
|
115
|
'clearContactUsSource',
|
|
116
|
+ 'getContactUsSources',
|
115
|
117
|
]),
|
116
|
118
|
SubmitData() {
|
117
|
119
|
if (this.validatePage()) {
|
|
@@ -127,6 +129,21 @@ export default {
|
127
|
129
|
Close() {
|
128
|
130
|
this.$router.push('/contactUsSource/list')
|
129
|
131
|
},
|
|
132
|
+ uniqueSource: function (tfield) {
|
|
133
|
+ if (tfield) {
|
|
134
|
+ if (
|
|
135
|
+ this.contactUsSources.find(
|
|
136
|
+ (i) => i.description === this.contactUsSource.description,
|
|
137
|
+ )
|
|
138
|
+ ) {
|
|
139
|
+ return false
|
|
140
|
+ } else {
|
|
141
|
+ return true
|
|
142
|
+ }
|
|
143
|
+ } else {
|
|
144
|
+ return false
|
|
145
|
+ }
|
|
146
|
+ },
|
130
|
147
|
requiredField: function (tfield) {
|
131
|
148
|
if (tfield) {
|
132
|
149
|
return true
|
|
@@ -138,10 +155,18 @@ export default {
|
138
|
155
|
console.log('validatePage')
|
139
|
156
|
if (this.contactUsSource.description) {
|
140
|
157
|
console.log('passed')
|
141
|
|
- this.errorOccurred = ''
|
142
|
|
- this.errorMessage = ''
|
143
|
|
- this.boolValidationError = false
|
144
|
|
- return true
|
|
158
|
+ if (!this.uniqueSource(this.contactUsSource.description)) {
|
|
159
|
+ this.statusLoad = true
|
|
160
|
+ this.descriptionLoad = true
|
|
161
|
+ this.boolValidationError = true
|
|
162
|
+ this.errorOccurred = 'ERROR'
|
|
163
|
+ this.errorMessage = 'Status Code already recorded!'
|
|
164
|
+ } else {
|
|
165
|
+ this.errorOccurred = ''
|
|
166
|
+ this.errorMessage = ''
|
|
167
|
+ this.boolValidationError = false
|
|
168
|
+ return true
|
|
169
|
+ }
|
145
|
170
|
} else {
|
146
|
171
|
console.log('failed')
|
147
|
172
|
this.descriptionLoad = true
|