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 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | <template> <div class="row w-100 m-0 justify-content-center"> <div class="d-flex flex-column col-11"> <div class="d-flex align-items-start mt-3"> <button v-on:click="clearSelectedOrders()" class="button"> <BIconArrowLeft /> </button> <div class="w-100 px-3"> <div class="d-flex align-items-center"> <h6 class="m-0 px-2 font-weight-bold">{{ selected.id }}</h6> <div class="paid p-1 pl-2 pr-3 mr-2" :class="selected.paid && 'active'" > <BIconDot scale="2" /> Paid </div> <div class="status p-1 pl-2 pr-3 mr-2"> <BIconDot scale="2" /> {{ selected.order_status.title }} </div> </div> <p>{{ selected.order_date | formatDate }}</p> </div> <button class="border-left" v-on:click="setPreviousOrder" :disabled="!previous" > <BIconChevronLeft /> </button> <button class="border-right" v-on:click="setNextOrder" :disabled="!next" > <BIconChevronRight /> </button> </div> <div class="row mb-3"> <div class="col-7"> <div class="block w-100 mb-3"> <div class="block-main d-flex flex-column p-3"> <div class="d-flex"> <div class=" icon-circle-wrap d-flex align-items-center justify-content-center " > <BIconCheckCircle variant="success" /> </div> <h6 class="ml-2 m-0">{{ selected.status }}</h6> </div> <div class="d-flex flex-column"> <div class="row" v-for="order_item in selected.order_items" :key="order_item.id" > <div class="col-2"></div> </div> <div class="row" v-for="order_bundle in selected.order_bundles" :key="order_bundle.id" > <div class="col-2"></div> </div> </div> </div> <div class="d-flex justify-content-end p-3"> <button class="btn btn-success" v-on:click="openModal('package_planner')" > Package planner </button> </div> </div> <div class="block w-100"> <div class="block-main d-flex flex-column p-3"> <div class="d-flex"> <div class=" icon-circle-wrap d-flex align-items-center justify-content-center " > <BIconCheckCircle variant="success" /> </div> <h6 class="ml-2 m-0">Paid</h6> </div> <div class="d-flex flex-lg-row flex-column justify-content-between" > <p>Subtotal</p> <p class="text-center"> {{ selected.order_items.length + selected.order_bundles.length }} items </p> <p>${{ selected.total | formatNumber }}</p> </div> <div class="d-flex flex-lg-row flex-column justify-content-between" > <p>Shipping</p> <p class="text-center">Flat Rate (0.07 rate lb)</p> <p>${{ selected.total | formatNumber }}</p> </div> <div class="d-flex justify-content-between"> <p class="font-weight-bold">Total</p> <p class="font-weight-bold"> ${{ selected.total | formatNumber }} </p> </div> </div> <div class="d-flex justify-content-between p-3"> <p class="m-0">Paid by customer</p> <p class="m-0">${{ selected.total | formatNumber }}</p> </div> </div> </div> <div class="col-5 d-flex flex-column"> <div class="block mb-3"> <div class="d-flex justify-content-between align-items-center p-3"> <h6 class="text-uppercase m-0">Customer</h6> </div> <div class="block-main pt-0 px-3"> <a href="#" v-on:click.prevent="$emit('setCustomer')"> <p class="text-ellipsis m-0">{{ getCustomerName() }}</p> </a> <p>{{ getOrdersCount() }} order</p> </div> <div class="block-main p-3"> <div class="d-flex justify-content-between align-items-center"> <h6 class="text-uppercase m-0">Contact information</h6> <span v-on:click="openModal('contact-modal')">Edit</span> </div> <p class="text-ellipsis">{{ selected.billing_email }} customer</p> </div> <div class="block-main p-3"> <div class="d-flex justify-content-between align-items-center"> <h6 class="text-uppercase m-0">Shipping address</h6> <span v-on:click="openModal('shipping-modal')">Edit</span> </div> <p class="text-ellipsis">{{ getCustomerName() }}</p> <p class="text-ellipsis"> {{ selected.address1 || selected.address2 || "undefined" }} </p> <p class="text-ellipsis"> {{ selected.cellphone || "undefined" }} </p> <a href="#">View map</a> </div> <div class="p-3"> <h6 class="text-uppercase m-0">Billing address</h6> <p>Same as shipping address</p> </div> </div> <div class="block d-flex flex-column align-items-center"> <div class="block-main p-3 w-100"> <h6 class="m-0">Fraud analysis</h6> <BProgress class="mt-2" :max="100"> <BProgressBar :value="45 * (6 / 10)" variant="success" /> <BProgressBar :value="45 * (2.5 / 10)" variant="warning" /> <BProgressBar :value="45 * (1.5 / 10)" variant="danger" /> </BProgress> <ul class="d-flex flex-column p-0 mt-2"> <li class="d-flex align-items-center mb-2"> <BIconDot scale="2" class="mr-2" /> <p class="m-0"> Characteristic of this order similat to non-fraudulent orders observed in the past </p> </li> <li class="d-flex align-items-center"> <BIconDot scale="2" class="mr-2" /> <p class="m-0">There was 1 payment attempt</p> </li> </ul> </div> <a href="#" class="p-3" v-on:click.prevent="openModal('fraud-analysis')" >View full analisis</a > </div> </div> </div> </div> <PackagePlannerModal :order="selected" /> <ContactModal :order="selected" /> <ShippingModal :order="selected" /> <FraudAnalysisModal /> </div> </template> <script> import { mapMutations, mapGetters, mapActions } from "vuex"; import { getStrapiMedia } from "~/utils/medias"; import { prevCurrNextItems } from "~/helpers"; import "~/utils/filters"; import ContactModal from "./modals/ContactModal.vue"; import ShippingModal from "./modals/ShippingModal.vue"; import FraudAnalysisModal from "./modals/FraudAnalysisModal.vue"; import PackagePlannerModal from "./modals/PackagePlannerModal.vue"; export default { name: "Order", components: { ContactModal, ShippingModal, PackagePlannerModal, FraudAnalysisModal, }, computed: { ...mapGetters({ orders: "admin_orders/orders", previous: "admin_orders/previous", selected: "admin_orders/selected", next: "admin_orders/next", params: "admin_orders/params", total: "admin_orders/total", }), }, methods: { getStrapiMedia, prevCurrNextItems, ...mapActions({ getOrders: "admin_orders/getOrders", }), ...mapMutations({ clearSelectedOrders: "admin_orders/clearSelectedOrders", setSelectedOrders: "admin_orders/setSelectedOrders", setParams: "admin_orders/setParams", }), openModal: function (modal) { this.$root.$emit("bv::show::modal", modal); }, getOrdersCount: function () { const { user } = this.selected; return user?.orders_count || 0; }, setNextOrder: async function () { const index = this.findIndex(); const { page, currentPerPage } = this.params; let isMax = false; if ( this.total / currentPerPage - page <= 0 && index === this.orders.length - 2 ) { isMax = true; } const { selected, next, previous } = this.prevCurrNextItems( this.orders[index + 1], this.orders ); if (!isMax && !next) { const { page } = this.params; this.setParams({ ...this.params, page: page + 1 }); await this.getOrders(); const result = this.prevCurrNextItems(this.orders[0], [ selected, ...this.orders, ]); this.setSelectedOrders(result); } else { this.setSelectedOrders({ selected, next, previous }); } }, setPreviousOrder: async function () { const index = this.findIndex(); const { page } = this.params; const { selected, next, previous } = this.prevCurrNextItems( this.orders[index - 1], this.orders ); let isMin = false; if (page >= 1 && index === 1) { isMin = true; } if (!isMin && !previous) { const { page } = this.params; this.setParams({ ...this.params, page: page - 1 }); await this.getOrders(); const result = this.prevCurrNextItems( this.orders[this.orders.length - 1], [...this.orders, selected] ); this.setSelectedOrders(result); } else { this.setSelectedOrders({ selected, next, previous }); } }, findIndex: function () { return this.orders.findIndex((item) => item.id === this.selected.id); }, getCustomerName: function () { const { user } = this.selected; if (user) { const { username, first_name, last_name } = user; if (first_name) { return `${first_name} ${last_name}`; } return username; } return "undefined"; }, }, async destroyed() { this.setParams({ ...this.params, page: 1 }); await this.getOrders(); }, }; </script> <style scoped> .button { border-radius: 5px; background: none; } .border-left { border-radius: 5px 0 0 5px; border: 1px solid #000; } .border-right { border-radius: 0 5px 5px 0; border: 1px solid #000; } .image-wrap:hover > .image-buttons { top: 0; bottom: 0; left: 0; right: 0; display: flex; } .status, .paid { border-radius: 20px; font-size: 15px; background: #e4e5e7; } .status { background: yellow; } .paid.active { background: green; } .icon-circle-wrap { border: 4px solid #ade9d0; border-radius: 50%; } .block-main { border-bottom: 1px solid black; } </style> |