Skip to content

Commit

Permalink
feat: handle cancel state for form modals
Browse files Browse the repository at this point in the history
  • Loading branch information
belsman committed Sep 5, 2024
1 parent 1386916 commit 573a1f7
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { transformOrderToInput } from '../utils';
onOpenEditOrderItem(vm.order, vm.products, $event)
"
(openDeleteOrderItemModal)="onDeleteOrderItem(vm.order, $event)"
(openEditShopModal)="onOpenEditShopModal()"
/>
</ng-container>
`,
Expand Down Expand Up @@ -228,4 +229,8 @@ export class OrderViewComponent implements OnInit, OnDestroy {
});
});
}

onOpenEditShopModal() {
// console.log("On open edit shop modal!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export const buildOrderAddressSchema = (
{
type: 'button',
label: 'Cancel',
action: 'reset',
action: 'cancel',
class: 'transparent',
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/modules/order/src/lib/jss-forms/order.jss-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export const buildOrderSchema = (
{
type: 'button',
label: 'Cancel',
action: 'reset',
action: 'cancel',
class: 'transparent',
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ export class JSSFormModalComponent {
}
}

onAction(_: string): void {
// TODO
onAction(actionType: string): void {
if (actionType === 'cancel') {
this.close();
}
}

close(value?: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@
<button
vcl-button
type="button"
(click)="close()"
>
Reset
Cancel
</button>
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<div class="order-details">
<div class="order-shop">
<rc-shop-info [shop]="order.shop || {}" />
<rc-shop-info
[shop]="order.shop || {}"
(openEditShopModal)="openEditShopModal.emit()"
/>
</div>

<div class="order-info">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class RcOrderViewComponent implements OnInit {
new EventEmitter<IoRestorecommerceOrderItem>();

@Output() openEditOrderInfoModal = new EventEmitter<void>();
@Output() openEditShopModal = new EventEmitter<void>();

product?: IoRestorecommerceProductPhysicalVariant | null;
customer?: IoRestorecommerceUserUser | null;
Expand Down

0 comments on commit 573a1f7

Please sign in to comment.