Skip to content

Commit

Permalink
feat(com-pwa): add order prop to all order pages
Browse files Browse the repository at this point in the history
  • Loading branch information
AliMD committed Mar 6, 2023
1 parent f25e479 commit feef5cf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
11 changes: 7 additions & 4 deletions uniquely/com-pwa/src/page-order/page-order-detail.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {customElement, css, html, LocalizeMixin, AlwatrBaseElement, SignalMixin} from '@alwatr/element';
import {customElement, css, html, LocalizeMixin, AlwatrBaseElement, SignalMixin, property} from '@alwatr/element';
import {message} from '@alwatr/i18n';
import '@alwatr/ui-kit/button/button.js';
import '@alwatr/ui-kit/card/surface.js';
Expand All @@ -7,6 +7,8 @@ import '@alwatr/ui-kit/text-field/text-field.js';

import {topAppBarContextProvider} from '../context.js';

import type {Order, OrderDraft} from '@alwatr/type/customer-order-management.js';

declare global {
interface HTMLElementTagNameMap {
'alwatr-page-order-detail': AlwatrPageOrderDetail;
Expand All @@ -29,6 +31,9 @@ export class AlwatrPageOrderDetail extends LocalizeMixin(SignalMixin(AlwatrBaseE
}
`;

@property({attribute: false})
order?: Order | OrderDraft | null;

override connectedCallback(): void {
super.connectedCallback();

Expand All @@ -42,8 +47,6 @@ export class AlwatrPageOrderDetail extends LocalizeMixin(SignalMixin(AlwatrBaseE

override render(): unknown {
this._logger.logMethod('render');
return html`
order tracking
`;
return html`${JSON.stringify(this.order)}`;
}
}
5 changes: 4 additions & 1 deletion uniquely/com-pwa/src/page-order/page-order-shipping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import '@alwatr/ui-kit/text-field/text-field.js';

import {submitOrderShippingCommandTrigger, topAppBarContextProvider} from '../context.js';

import type {OrderDelivery} from '@alwatr/type/customer-order-management.js';
import type {OrderDelivery, OrderDraft} from '@alwatr/type/customer-order-management.js';
import type {AlwatrFieldSet, RadioGroupOptions} from '@alwatr/ui-kit/radio-group/radio-group.js';
import type {AlwatrTextField} from '@alwatr/ui-kit/text-field/text-field.js';

Expand Down Expand Up @@ -90,6 +90,9 @@ export class AlwatrPageOrderShopping extends LocalizeMixin(SignalMixin(AlwatrBas
@property({type: Boolean, reflect: true})
disabled = false;

@property({attribute: false})
order?: OrderDraft | null;

override connectedCallback(): void {
super.connectedCallback();

Expand Down
9 changes: 6 additions & 3 deletions uniquely/com-pwa/src/page-order/page-order-tracking.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {customElement, css, html, LocalizeMixin, AlwatrBaseElement, SignalMixin} from '@alwatr/element';
import {customElement, css, html, LocalizeMixin, AlwatrBaseElement, SignalMixin, property} from '@alwatr/element';
import {message} from '@alwatr/i18n';
import '@alwatr/ui-kit/button/button.js';
import '@alwatr/ui-kit/card/surface.js';
Expand All @@ -7,6 +7,8 @@ import '@alwatr/ui-kit/text-field/text-field.js';

import {topAppBarContextProvider} from '../context.js';

import type {OrderDraft} from '@alwatr/type/customer-order-management.js';

declare global {
interface HTMLElementTagNameMap {
'alwatr-page-order-tracking': AlwatrPageOrderTracking;
Expand All @@ -18,8 +20,6 @@ declare global {
*/
@customElement('alwatr-page-order-tracking')
export class AlwatrPageOrderTracking extends LocalizeMixin(SignalMixin(AlwatrBaseElement)) {
static formId = 'order';

static override styles = css`
:host {
display: block;
Expand All @@ -29,6 +29,9 @@ export class AlwatrPageOrderTracking extends LocalizeMixin(SignalMixin(AlwatrBas
}
`;

@property({attribute: false})
order?: OrderDraft | null;

override connectedCallback(): void {
super.connectedCallback();

Expand Down

0 comments on commit feef5cf

Please sign in to comment.