|
@@ -0,0 +1,182 @@
|
|
1
|
+<template>
|
|
2
|
+ <main id="main">
|
|
3
|
+ <section id="contact2">
|
|
4
|
+ <div class="container">
|
|
5
|
+ <div class="row">
|
|
6
|
+ <div class="section-header">
|
|
7
|
+ <h2>Update Agent Info</h2>
|
|
8
|
+ </div>
|
|
9
|
+ </div>
|
|
10
|
+ <div class="row">
|
|
11
|
+ <div class="col">
|
|
12
|
+ <float-label>
|
|
13
|
+ <input
|
|
14
|
+ type="text"
|
|
15
|
+ name="name"
|
|
16
|
+ class="form-control uniInput"
|
|
17
|
+ id="name"
|
|
18
|
+ placeholder="USERNAME"
|
|
19
|
+ data-rule="minlen:4"
|
|
20
|
+ data-msg="Please enter your name"
|
|
21
|
+ v-model="agent.user.username"
|
|
22
|
+ />
|
|
23
|
+ </float-label>
|
|
24
|
+ </div>
|
|
25
|
+ <div class="col">
|
|
26
|
+ <float-label>
|
|
27
|
+ <input
|
|
28
|
+ type="text"
|
|
29
|
+ name="name"
|
|
30
|
+ class="form-control uniInput"
|
|
31
|
+ id="name"
|
|
32
|
+ placeholder="NAME"
|
|
33
|
+ data-rule="minlen:4"
|
|
34
|
+ data-msg="Please enter your name"
|
|
35
|
+ v-model="agent.name"
|
|
36
|
+ />
|
|
37
|
+ </float-label>
|
|
38
|
+ </div>
|
|
39
|
+ </div>
|
|
40
|
+ <div class="row mt-4">
|
|
41
|
+ <div class="col-md-6">
|
|
42
|
+ <float-label>
|
|
43
|
+ <input
|
|
44
|
+ type="text"
|
|
45
|
+ class="form-control uniInput"
|
|
46
|
+ name="surname"
|
|
47
|
+ id="surname"
|
|
48
|
+ placeholder="SURNAME"
|
|
49
|
+ data-msg="Please enter your surname"
|
|
50
|
+ v-model="agent.surname"
|
|
51
|
+ />
|
|
52
|
+ </float-label>
|
|
53
|
+ </div>
|
|
54
|
+ <div class="col">
|
|
55
|
+ <float-label>
|
|
56
|
+ <input
|
|
57
|
+ type="text"
|
|
58
|
+ class="form-control uniInput"
|
|
59
|
+ name="email"
|
|
60
|
+ id="email"
|
|
61
|
+ placeholder="EMAIL ADDRESS"
|
|
62
|
+ data-msg="Please enter your email address"
|
|
63
|
+ v-model="agent.email"
|
|
64
|
+ />
|
|
65
|
+ </float-label>
|
|
66
|
+ </div>
|
|
67
|
+ <!-- <div class="col">
|
|
68
|
+ <float-label>
|
|
69
|
+ <input
|
|
70
|
+ type="text"
|
|
71
|
+ name="idnum"
|
|
72
|
+ class="form-control uniInput"
|
|
73
|
+ id="idnum"
|
|
74
|
+ placeholder="ID NUMBER"
|
|
75
|
+ data-rule="minlen:4"
|
|
76
|
+ data-msg="Please enter your ID number"
|
|
77
|
+ />
|
|
78
|
+ </float-label>
|
|
79
|
+ </div> -->
|
|
80
|
+ </div>
|
|
81
|
+ <!-- <div class="row mt-4">
|
|
82
|
+ <div class="col-md-6">
|
|
83
|
+ <float-label>
|
|
84
|
+ <input
|
|
85
|
+ type="text"
|
|
86
|
+ class="form-control uniInput"
|
|
87
|
+ name="company"
|
|
88
|
+ id="company"
|
|
89
|
+ placeholder="COMPANY REG NUMBER"
|
|
90
|
+ data-rule="minlen:4"
|
|
91
|
+ data-msg="Please enter your company reg number"
|
|
92
|
+ />
|
|
93
|
+ </float-label>
|
|
94
|
+ </div>
|
|
95
|
+ </div> -->
|
|
96
|
+ <div class="row mt-4">
|
|
97
|
+ <div class="col">
|
|
98
|
+ <float-label>
|
|
99
|
+ <input
|
|
100
|
+ type="text"
|
|
101
|
+ name="cell"
|
|
102
|
+ class="form-control uniInput"
|
|
103
|
+ id="cell"
|
|
104
|
+ placeholder="CELL NUMBER"
|
|
105
|
+ data-rule="minlen:4"
|
|
106
|
+ data-msg="Please enter your cell number"
|
|
107
|
+ v-model="agent.cellNumber"
|
|
108
|
+ />
|
|
109
|
+ </float-label>
|
|
110
|
+ </div>
|
|
111
|
+ <div class="col">
|
|
112
|
+ <float-label>
|
|
113
|
+ <input
|
|
114
|
+ type="text"
|
|
115
|
+ class="form-control uniInput"
|
|
116
|
+ name="landline"
|
|
117
|
+ id="landline"
|
|
118
|
+ placeholder="LANDLINE NUMBER"
|
|
119
|
+ data-msg="Please enter your landline number"
|
|
120
|
+ v-model="agent.telephone"
|
|
121
|
+ />
|
|
122
|
+ </float-label>
|
|
123
|
+ </div>
|
|
124
|
+ </div>
|
|
125
|
+ <div class="row mt-4">
|
|
126
|
+ <div class="col">
|
|
127
|
+ <float-label fixed label="AGENCY">
|
|
128
|
+ <select v-model="agent.agencyId" class="form-control uniSelect" name="" id="">
|
|
129
|
+ <option v-for="agency in agencies" :key="agency.id" :value="agency.id">{{
|
|
130
|
+ agency.agencyName
|
|
131
|
+ }}</option>
|
|
132
|
+ </select>
|
|
133
|
+ </float-label>
|
|
134
|
+ </div>
|
|
135
|
+ </div>
|
|
136
|
+ <div class="row mt-5 mb-5">
|
|
137
|
+ <div class="col">
|
|
138
|
+ <button class="btn-solid-blue" @click="sendToApi()">SAVE</button>
|
|
139
|
+ </div>
|
|
140
|
+ <div class="col">
|
|
141
|
+ <button class="btn-solid-blue" @click="$router.go(-1)">CLOSE</button>
|
|
142
|
+ </div>
|
|
143
|
+ </div>
|
|
144
|
+ </div>
|
|
145
|
+ </section>
|
|
146
|
+ </main>
|
|
147
|
+</template>
|
|
148
|
+
|
|
149
|
+<script>
|
|
150
|
+/* eslint-disable */
|
|
151
|
+import { mapState, mapActions, mapGetters } from "vuex";
|
|
152
|
+
|
|
153
|
+export default {
|
|
154
|
+ props: {
|
|
155
|
+ agent: {}
|
|
156
|
+ },
|
|
157
|
+ created() {
|
|
158
|
+ this.getAgencies();
|
|
159
|
+ },
|
|
160
|
+ computed: {
|
|
161
|
+ ...mapState("timeshare", ["agencies"])
|
|
162
|
+ },
|
|
163
|
+ methods: {
|
|
164
|
+ ...mapActions("timeshare", ["getAgencies", "updateAgent"]),
|
|
165
|
+ sendToApi() {
|
|
166
|
+ this.agent.fullName = this.agent.name + " " + this.agent.surname;
|
|
167
|
+ if (this.agent.telephone === "") {
|
|
168
|
+ delete this.agent.telephone;
|
|
169
|
+ }
|
|
170
|
+ if (this.agent.cellNumber === "") {
|
|
171
|
+ delete this.agent.cellNumber;
|
|
172
|
+ }
|
|
173
|
+ console.log(this.agent);
|
|
174
|
+ this.updateAgent(this.agent).then(() => {
|
|
175
|
+ this.$router.go(-1);
|
|
176
|
+ });
|
|
177
|
+ }
|
|
178
|
+ }
|
|
179
|
+};
|
|
180
|
+</script>
|
|
181
|
+
|
|
182
|
+<style lang="scss" scoped></style>
|