Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | 1x 1x 1x 1x | <template> <div class="row justify-content-center w-100 h-100 m-0"> <div class="col-10 h-100 mt-3"> <div class="d-flex w-100 mb-3 d-flex align-items-center"> <button v-on:click="$emit('setIsTable')" class="mr-3"> <BIconArrowLeft /> </button> <h6 class="m-0">Add customer</h6> </div> <form autocomplete="off" id="add-customer-form" v-on:submit.stop.prevent="save" class="block mb-3 p-3" ref="form" > <div class="p-2"> <div class="row mb-2"> <div class="col-6"> <label class="d-flex" for="first-name"> First Name </label> <input id="first-name" type="text" placeholder="Enter first name" v-model.trim="customer.firstName" required autofocus="true" class="w-100" /> </div> <div class="col-6"> <label class="d-flex" for="last-name"> Last Name </label> <input id="last-name" type="text" placeholder="Enter last name" v-model.trim="customer.lastName" required autofocus="true" class="w-100" /> </div> </div> <div class="row mb-2"> <div class="col-6"> <label class="d-flex" for="s-contact-no"> Cellphone </label> <masked-input type="text" name="s-contact-no" class="w-100" v-model.trim="customer.cellphone" :mask="phoneMask" :guide="true" placeholder="+1(___)-___-____" /> </div> <div class="col-6"> <label class="d-flex" for="s-email"> Email </label> <input id="s-email" type="text" placeholder="Enter email" v-model="customer.email" required autofocus="true" class="w-100" /> </div> </div> <div class="mb-2"> <label class="d-flex" for="s-address"> Address </label> <input id="s-address" type="text" placeholder="Enter your address" v-model.trim="customer.address1" required autofocus="true" class="w-100" /> </div> <div class="mb-2"> <label class="d-flex" for="s-city"> City </label> <input id="s-city" type="text" placeholder="Enter your city" v-model.trim="customer.city" required autofocus="true" class="w-100" /> </div> <div class="mb-2"> <label class="d-flex" for="s-state"> State </label> <select size="1" name="states_hash" v-model="customer.state" ref="select" required class="w-100" :class="customer.state && 'chosed'" > <option disabled :value="''">Chose state</option> <option v-for="hash in states_hashes" :key="hash.name" :value="hash" > {{ showHash(hash) }} </option> </select> </div> <div class="mb-2"> <label class="d-flex" for="s-zip-code"> Zip Code </label> <input id="s-zip-code" type="text" placeholder="Enter your Zip code" v-model.trim="customer.zip" required autofocus="true" class="w-100" /> </div> <div class="mb-2"> <label class="d-flex" for="s-company"> Company </label> <input id="s-company" type="text" placeholder="Enter company name" v-model.trim="customer.company" autofocus="true" class="w-100" /> </div> </div> </form> <div class="w-100 d-flex justify-content-end"> <button size="sm" class="btn btn-light mr-2" v-on:click="$emit('setIsTable')" > Cancel </button> <button size="sm" class="btn btn-success" type="submit" form="add-customer-form" > Save </button> </div> </div> </div> </template> <script> import { mapActions } from "vuex"; import { states_hashes } from "@/data"; export default { name: "AddCustomer", data: () => ({ customer: { firstName: "", lastName: "", company: "", address1: "", address2: "", city: "", state: "", zip: "", cellphone: "", email: "", }, phoneMask: [ "+", "1", " ", "(", /[1-9]/, /\d/, /\d/, ")", " ", /\d/, /\d/, /\d/, "-", /\d/, /\d/, /\d/, /\d/, ], states_hashes, }), methods: { ...mapActions({ createCustomer: "admin_customers/createCustomer", }), vueTelInputProps: (required = true) => ({ mode: "international", validCharactersOnly: true, inputOptions: { placeholder: "Enter a phone number", required, }, }), showHash: function (hash) { if (this.customer.state && this.customer.state.name === hash.name) { return hash.abbreviation; } return hash.name; }, save: async function () { const { state } = this.customer; const data = { ...this.customer, state: state.name, }; await this.createCustomer(data); this.$refs.form.reset(); }, }, }; </script> <style scoped> input, select { position: relative; border: 1px solid #000; border-radius: 5px; } .block { border: 1px solid #000; border-radius: 10px; background-color: #fff; } </style> |