ECommerceAddCustomerDrawer.vue
5.52 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<script setup>
import { PerfectScrollbar } from 'vue3-perfect-scrollbar'
import { VForm } from 'vuetify/components/VForm'
const props = defineProps({
isDrawerOpen: {
type: Boolean,
required: true,
},
})
const emit = defineEmits(['update:isDrawerOpen'])
const handleDrawerModelValueUpdate = val => {
emit('update:isDrawerOpen', val)
}
const refVForm = ref()
const name = ref()
const email = ref()
const mobile = ref()
const addressLine1 = ref()
const addressLine2 = ref()
const town = ref()
const state = ref()
const postCode = ref()
const country = ref()
const isBillingAddress = ref(false)
const resetForm = () => {
refVForm.value?.reset()
emit('update:isDrawerOpen', false)
}
const closeNavigationDrawer = () => {
emit('update:isDrawerOpen', false)
nextTick(() => {
refVForm.value?.reset()
refVForm.value?.resetValidation()
})
}
</script>
<template>
<VNavigationDrawer
:model-value="props.isDrawerOpen"
temporary
location="end"
width="370"
@update:model-value="handleDrawerModelValueUpdate"
>
<!-- 👉 Header -->
<AppDrawerHeaderSection
title="Add a Customer"
@cancel="closeNavigationDrawer"
/>
<VDivider />
<VCard flat>
<PerfectScrollbar
:options="{ wheelPropagation: false }"
class="h-100"
>
<VCardText style="block-size: calc(100dvh - 5rem);">
<VForm
ref="refVForm"
@submit.prevent=""
>
<VRow>
<VCol>
<div class="text-body-1 font-weight-medium text-high-emphasis">
Basic Information
</div>
</VCol>
<VCol cols="12">
<VTextField
v-model="name"
label="Full Name"
:rules="[requiredValidator]"
placeholder="John Doe"
/>
</VCol>
<VCol cols="12">
<VTextField
v-model="email"
label="Email Address"
:rules="[requiredValidator, emailValidator]"
placeholder="johndoe@email.com"
/>
</VCol>
<VCol cols="12">
<VTextField
v-model="mobile"
label="Mobile Number"
type="number"
:rules="[requiredValidator]"
placeholder="+(123) 456-7890"
/>
</VCol>
<VCol>
<div class="text-body-1 font-weight-medium text-high-emphasis">
Shipping Information
</div>
</VCol>
<VCol cols="12">
<VTextField
v-model="addressLine1"
label="Address Line 1*"
:rules="[requiredValidator]"
placeholder="45, Rocker Terrace"
/>
</VCol>
<VCol cols="12">
<VTextField
v-model="addressLine2"
placeholder="Empire Heights,"
:rules="[requiredValidator]"
label="Address Line 2*"
/>
</VCol>
<VCol cols="12">
<VTextField
v-model="town"
label="Town*"
:rules="[requiredValidator]"
placeholder="New York"
/>
</VCol>
<VCol cols="12">
<VTextField
v-model="state"
placeholder="Texas"
:rules="[requiredValidator]"
label="State/Province*"
/>
</VCol>
<VCol cols="12">
<VTextField
v-model="postCode"
label="Post Code*"
type="number"
:rules="[requiredValidator]"
placeholder="982347"
/>
</VCol>
<VCol cols="12">
<VSelect
v-model="country"
placeholder="United States"
:rules="[requiredValidator]"
label="Country"
:items="['United States', 'United Kingdom', 'Canada']"
/>
</VCol>
<VCol cols="12">
<div class="d-flex justify-space-between">
<div class="d-flex flex-column gap-y-1">
<h6 class="text-h6">
Use as a billing address?
</h6>
<span class="text-sm">Please check budget for more info</span>
</div>
<VSwitch v-model="isBillingAddress" />
</div>
</VCol>
<VCol cols="12">
<div class="d-flex justify-start">
<VBtn
type="submit"
color="primary"
class="me-4"
>
Add
</VBtn>
<VBtn
color="error"
variant="outlined"
@click="resetForm"
>
Discard
</VBtn>
</div>
</VCol>
</VRow>
</VForm>
</VCardText>
</PerfectScrollbar>
</VCard>
</VNavigationDrawer>
</template>
<style lang="scss">
.v-navigation-drawer__content {
overflow-y: hidden !important;
}
</style>