This repository has been archived by the owner on Oct 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
16 changed files
with
576 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<template> | ||
<SfList> | ||
{{address.id}} | ||
<hr/> | ||
<SfProperty | ||
name="name" | ||
:value="name" /> | ||
<SfProperty | ||
name="street" | ||
:value="street" /> | ||
<SfProperty | ||
name="city" | ||
:value="city" /> | ||
<SfProperty | ||
name="zipcode" | ||
:value="zipcode" /> | ||
<SfProperty | ||
name="country" | ||
:value="country" /> | ||
</SfList> | ||
</template> | ||
<script> | ||
import { SfList, SfProperty } from '@storefront-ui/vue' | ||
import { VuelidateMixin } from '@vuelidate/core' | ||
import { required } from '@vuelidate/validators' | ||
import { useUser } from '@shopware-pwa/composables' | ||
import { CustomerAddress } from '@shopware-pwa/shopware-6-client' | ||
export default { | ||
name: "MyProfile", | ||
mixins: [VuelidateMixin], | ||
components: {SfList, SfProperty}, | ||
props: { | ||
address: { | ||
type: CustomerAddress, | ||
default: {} | ||
} | ||
}, | ||
computed: { | ||
name(){ | ||
return this.address && `${this.address.firstName} ${this.address.lastName}` | ||
}, | ||
street() { | ||
return this.address && this.address.street | ||
}, | ||
city() { | ||
return this.address && this.address.city | ||
}, | ||
zipcode() { | ||
return this.address && this.address.zipcode | ||
}, | ||
country() { | ||
return this.address && this.address.country && this.address.country.name || "" | ||
} | ||
}, | ||
data() { | ||
return { | ||
} | ||
}, | ||
methods: { | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import '~@storefront-ui/vue/styles.scss'; | ||
@import '~@storefront-ui/shared/styles/helpers/visibility'; | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<template> | ||
<SfTabs :open-tab="1"> | ||
<SfTab title="Personal data"> | ||
<SfList> | ||
<SfProperty name="customerNumber" :value="customerNumber"/> | ||
<SfProperty name="email" :value="email"/> | ||
<SfProperty name="firstname" :value="firstName"/> | ||
<SfProperty name="lastname" :value="lastName"/> | ||
</SfList> | ||
</SfTab> | ||
</SfTabs> | ||
</template> | ||
<script> | ||
import { SfProperty, SfTabs, SfList } from '@storefront-ui/vue' | ||
import { VuelidateMixin } from '@vuelidate/core' | ||
import { required } from '@vuelidate/validators' | ||
import { useUser } from '@shopware-pwa/composables' | ||
export default { | ||
name: "MyProfile", | ||
mixins: [VuelidateMixin], | ||
components: {SfProperty, SfTabs, SfList}, | ||
props: { | ||
}, | ||
setup() { | ||
const { user } = useUser() | ||
return { | ||
user | ||
} | ||
}, | ||
data() { | ||
return { | ||
} | ||
}, | ||
computed: { | ||
customerNumber(){ | ||
return this.user && this.user.customerNumber | ||
}, | ||
email() { | ||
return this.user && this.user.email | ||
}, | ||
firstName(){ | ||
return this.user && this.user.firstName | ||
}, | ||
lastName(){ | ||
return this.user && this.user.lastName | ||
} | ||
}, | ||
methods: { | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import '~@storefront-ui/vue/styles.scss'; | ||
@import '~@storefront-ui/shared/styles/helpers/visibility'; | ||
</style> |
47 changes: 47 additions & 0 deletions
47
packages/default-theme/components/account/OrderHistory.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<template> | ||
<div> | ||
<SfList v-for="order in orders" :key="order.id"> | ||
<OrderDetails @click="$emit('click')" :order="order" /> | ||
<SfDivider/> | ||
</SfList> | ||
</div> | ||
|
||
</template> | ||
<script> | ||
import { SfList, SfDivider } from '@storefront-ui/vue' | ||
import { VuelidateMixin } from '@vuelidate/core' | ||
import { required } from '@vuelidate/validators' | ||
import { useUser } from '@shopware-pwa/composables' | ||
import OrderDetails from "./OrderHistory/OrderDetails" | ||
export default { | ||
name: "MyProfile", | ||
mixins: [VuelidateMixin], | ||
components: {SfList, OrderDetails, SfDivider}, | ||
props: { | ||
}, | ||
setup() { | ||
const { orders, loadOrders } = useUser() | ||
loadOrders() | ||
return { | ||
orders | ||
} | ||
}, | ||
data() { | ||
return { | ||
} | ||
}, | ||
methods: { | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import '~@storefront-ui/vue/styles.scss'; | ||
@import '~@storefront-ui/shared/styles/helpers/visibility'; | ||
</style> |
95 changes: 95 additions & 0 deletions
95
packages/default-theme/components/account/OrderHistory/OrderDetails.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<template> | ||
<div class="order-details__item"> | ||
<SfBadge class="sf-badge--full-width"><strong>#{{orderNumber}}</strong></SfBadge> | ||
<SfProperty name="amountTotal" :value="totalAmount"/> | ||
<SfProperty name="status" :value="status"/> | ||
<SfProperty name="orderDateTime" :value="orderDateTime"/> | ||
<SfProperty name="shippingCost" :value="shippingCost"/> | ||
|
||
<SfButton v-if="!isLoaded" class="order-details__item__btn sf-button--outline" v-on:click="loadOrderDetails(order.id)"> | ||
See more | ||
</SfButton> | ||
{{ orderDetails }} | ||
</div> | ||
|
||
</template> | ||
<script> | ||
import { SfProperty, SfButton, SfBadge } from '@storefront-ui/vue' | ||
import { VuelidateMixin } from '@vuelidate/core' | ||
import { required } from '@vuelidate/validators' | ||
import { useUser } from '@shopware-pwa/composables' | ||
import { Order } from '@shopware-pwa/shopware-6-client' | ||
export default { | ||
name: "OrderDetail", | ||
mixins: [VuelidateMixin], | ||
components: {SfButton, SfProperty}, | ||
props: { | ||
order: { | ||
type: Order, | ||
default: null | ||
} | ||
}, | ||
setup() { | ||
const { getOrderDetails } = useUser() | ||
return { | ||
getOrderDetails | ||
} | ||
}, | ||
data() { | ||
return { | ||
orderDetails: null | ||
} | ||
}, | ||
computed: { | ||
isLoaded() { | ||
return !!this.orderDetails | ||
}, | ||
orderNumber() { | ||
return this.order && this.order.orderNumber | ||
}, | ||
totalAmount() { | ||
return this.order && this.order.amountTotal | ||
}, | ||
shippingCost() { | ||
return this.order && this.order.shippingCosts && this.order.shippingCosts.totalPrice | ||
}, | ||
orderDateTime() { | ||
return this.order && this.order.orderDateTime | ||
}, | ||
status() { | ||
return this.order.stateMachineState && this.order.stateMachineState && this.order.stateMachineState.name | ||
} | ||
}, | ||
methods: { | ||
// detailed info are available through the separated endpoint | ||
async loadOrderDetails(orderId) { | ||
this.orderDetails = "details" | ||
// uncomment this line once the way of fetching the details is cleared | ||
//orderDetails = await this.getOrderDetails(orderId) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import '~@storefront-ui/vue/styles.scss'; | ||
@import '~@storefront-ui/shared/styles/helpers/visibility'; | ||
.order-details { | ||
&__item { | ||
padding-top:10px; | ||
padding-bottom:10px; | ||
overflow: auto; | ||
&__btn { | ||
position: relative; | ||
float:right; | ||
} | ||
} | ||
} | ||
</style> |
Oops, something went wrong.
6e373a3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for website ready!
Built with commit 9843462
https://shopware-pwa-njmac5loh.now.sh