-
Notifications
You must be signed in to change notification settings - Fork 0
/
rejectReason.vue
145 lines (145 loc) · 4.76 KB
/
rejectReason.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<template>
<div>
<v-dialog
v-model="getDetails.show"
persistent
max-width="582px"
scrollable
>
<v-card>
<v-card-title class="primary">
<div class="white--text">Reject Reason</div>
<v-spacer />
<v-btn icon @click="setDetails({ show: false })"
><v-icon color="white">mdi-close</v-icon></v-btn
>
</v-card-title>
<v-card-text class="py-4">
<div class="font-weight-bold fs-20 black--text">
Client Details
</div>
<br />
<v-row>
<v-col cols="6" class="d-flex">
<span class="text-title">Name/Contact :</span>
<span class="pl-6 text-value text-capitalize">
<div>{{ getDetails.object.client_name }}</div>
<div>{{ getDetails.object.client_phone }}</div>
</span>
</v-col>
<v-col cols="6" class="d-flex">
<span class="text-title">Application No. :</span>
<span class="pl-6 text-value"> #BBKAS79 </span>
</v-col>
</v-row>
<br />
<v-form ref="form">
<v-textarea
v-model="reasons"
auto-grow
dense
outlined
label="Write reason..."
rows="4"
:rules="[rules.required]"
>
<!-- @keyup.enter="submit()" -->
</v-textarea>
</v-form>
</v-card-text>
<v-card-actions class="mx-1 mb-3">
<v-btn
class="mt-n6"
block
color="primary"
:loading="loading"
@click="submit()"
>Submit</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
<script>
import { mapMutations, mapState } from "vuex";
import rules from "../../../../common/fieldRules";
export default {
name: "rejectReason",
data() {
return {
reasons: "",
rules: rules,
loading: false,
};
},
computed: {
...mapState({
getDetails: (state) => state.app.reject_reason,
}),
show: {
get() {
if (this.getDetails.show) return this.getDetails.show;
else return null;
},
},
},
watch: {
show(v) {
if (v) this.openModal();
else this.closeModal();
},
},
methods: {
...mapMutations({
setDetails: "app/SET_REJECT_REASON",
}),
openModal() {},
closeModal() {
this.$refs.form.reset();
this.reasons = "";
},
submit() {
if (this.$refs.form.validate()) {
this.loading = true;
const successHandler = () => {
this.loading = false;
this.setDetails({ show: false });
this.$emit("reload-list");
};
const finallyHandler = () => {
this.loading = false;
};
let formData = {};
formData["inquiry_state"] = this.getDetails.type;
formData["rejection_reason"] = this.reasons;
return this.$request(
this.$keys.PATCH,
this.$urls.dashboard.update_service_list +
this.getDetails.object.id+
"/",
{
data: formData,
onSuccess: successHandler,
onFinally: finallyHandler,
isTokenRequired: true,
}
);
}
},
},
};
</script>
<style scoped>
.text-title {
font-weight: 400;
font-size: 16px;
line-height: 19px;
color: rgba(0, 0, 0, 0.7);
}
.text-value {
font-weight: 500;
font-size: 16px;
line-height: 19px;
color: rgba(0, 0, 0, 0.8);
}
</style>