Skip to content

Commit

Permalink
feat(fulfilment): add trigger fulfilment button in detail page
Browse files Browse the repository at this point in the history
  • Loading branch information
belsman committed Oct 24, 2024
1 parent 009aa4b commit 3b9bc35
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<pre>
{{ fulfillment | json }}
</pre>
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ import { IFulfillment } from '@console-core/types';

@Component({
selector: 'app-module-fulfillment-view-details',
template: `
<pre>
{{ fulfillment | json }}
</pre
>
`,
templateUrl: './fulfillment-view-details.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FulfillmentViewDetailsComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[triggerRead]="triggerRead"
[triggerSelectId]="triggerSelectId"
[triggerRemove]="triggerRemove"
[triggerSubmitFulfillment]="triggerSubmitFulfillment"
>
<ng-container rc-crud-search>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ export class FulfillmentTemplateComponent implements OnInit, OnDestroy {
limit: PAGINATION.limit,
};

readonly triggerSubmitFulfillment = new BehaviorSubject<string | null>(null);
readonly triggerSubmitFulfillment$ = this.triggerSubmitFulfillment
.asObservable()
.pipe(
tap((id) => {
if (id === null) {
return;
}

// this.orderFacade.createFulfilment(id);
})
);

readonly triggerRead = new BehaviorSubject<null>(null);
readonly triggerRead$ = this.triggerRead
.asObservable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,20 @@
<vcl-icon icon="mdi:truck-plus-outline" />
</button>

<button
*ngIf="
isTriggerSubmitFulfillment &&
[EUrlSegment.View].includes(urlSegment)
"
(click)="onCreateFulfillment(id)"
vcl-button
rc-append
class="square half-transparent button"
title="Submit Fulfillment"
>
<vcl-icon icon="mdi:truck-plus-outline" />
</button>

<button
vcl-button
rc-append
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class RcCrudMainComponent implements OnInit, OnDestroy {
@Input({ required: true }) triggerRemove!: BehaviorSubject<string | null>;
@Input() triggerCreateInvoice?: BehaviorSubject<string | null>;
@Input() triggerCreateFulfillment?: BehaviorSubject<string | null>;
@Input() triggerSubmitFulfillment?: BehaviorSubject<string | null>;
@Input() title = '';
@Input() isRead = true;
@Input() isCreate = true;
Expand All @@ -38,6 +39,7 @@ export class RcCrudMainComponent implements OnInit, OnDestroy {

isTriggerCreateInvoice = false;
isTriggerCreateFulfillment = false;
isTriggerSubmitFulfillment = false;

readonly EUrlSegment = EUrlSegment;

Expand Down Expand Up @@ -78,6 +80,7 @@ export class RcCrudMainComponent implements OnInit, OnDestroy {
ngOnInit(): void {
this.isTriggerCreateInvoice = !!this.triggerCreateInvoice;
this.isTriggerCreateFulfillment = !!this.triggerCreateFulfillment;
this.isTriggerSubmitFulfillment = !!this.triggerSubmitFulfillment;
}

ngOnDestroy(): void {
Expand All @@ -100,6 +103,10 @@ export class RcCrudMainComponent implements OnInit, OnDestroy {
this.triggerCreateFulfillment?.next(id);
}

onSubmitFulfillment(id: string | null): void {
this.triggerSubmitFulfillment?.next(id);
}

onRemove(id: string | null): void {
this.subscriptions.sink = this.alertService
.open({
Expand Down

0 comments on commit 3b9bc35

Please sign in to comment.