Skip to content

Commit

Permalink
Review feedback von @ChristophHi
Browse files Browse the repository at this point in the history
  • Loading branch information
Larisa-Staroverova committed Oct 16, 2023
1 parent fa9c9a2 commit 250417b
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h3 class="cx-status">
[charactersLimit]="getCharactersLimitForCardTile()"
></cx-card>
<button
*ngIf="isQuoteInformationEditable(quoteDetails)"
*ngIf="isQuoteEditableForBuyer(quoteDetails)"
class="link cx-action-link cx-edit-btn"
(click)="toggleEditMode()"
>
Expand All @@ -40,8 +40,10 @@ <h3 class="cx-status">
<div class="cx-summary-card">
<cx-card
[content]="
getEstimatedAndDate(quoteDetails, quoteDetails.creationTime | cxDate)
| async
getEstimatedTotalAndDate(
quoteDetails,
quoteDetails.creationTime | cxDate
) | async
"
></cx-card>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,22 +313,22 @@ describe('QuoteHeaderOverviewComponent', () => {

it('should return "false" if the quote information is not editable', () => {
quote.isEditable = false;
expect(component.isQuoteInformationEditable(quote)).toBe(false);
expect(component.isQuoteEditableForBuyer(quote)).toBe(false);
});

it('should return "false" if the quote information is not editable for "SELLER_DRAFT"', () => {
quote.state = QuoteState.SELLER_DRAFT;
expect(component.isQuoteInformationEditable(quote)).toBe(false);
expect(component.isQuoteEditableForBuyer(quote)).toBe(false);
});

it('should return "true" if the quote information is editable for "BUYER_DRAFT"', () => {
quote.state = QuoteState.BUYER_DRAFT;
expect(component.isQuoteInformationEditable(quote)).toBe(true);
expect(component.isQuoteEditableForBuyer(quote)).toBe(true);
});

it('should return "true" if the quote information is editable for "BUYER_OFFER"', () => {
quote.state = QuoteState.BUYER_OFFER;
expect(component.isQuoteInformationEditable(quote)).toBe(true);
expect(component.isQuoteEditableForBuyer(quote)).toBe(true);
});
});

Expand Down Expand Up @@ -421,7 +421,7 @@ describe('QuoteHeaderOverviewComponent', () => {
};

component
.getEstimatedAndDate(mockQuote, undefined)
.getEstimatedTotalAndDate(mockQuote, undefined)
.subscribe((result) => {
expect(result).toEqual(expected);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export class QuoteHeaderOverviewComponent {
protected translationService = inject(TranslationService);
protected quoteUIConfig = inject(QuoteUIConfig);

private static NO_DATA = '-';
private static CHARACTERS_LIMIT = 255;
private static DEFAULT_CARD_TILE_MAX_CHARS = 100;
protected static NO_DATA = '-';
protected static CHARACTERS_LIMIT = 255;
protected static DEFAULT_CARD_TILE_MAX_CHARS = 100;

quoteDetails$: Observable<Quote> = this.quoteFacade.getQuoteDetails();
iconTypes = ICON_TYPE;
Expand All @@ -61,7 +61,7 @@ export class QuoteHeaderOverviewComponent {
* @param {Quote} quote - quote
* @returns {boolean} - if the quote is editable and its state is 'QuoteState.BUYER_DRAFT' or 'QuoteState.BUYER_OFFER', otherwise returns 'false'.
*/
isQuoteInformationEditable(quote: Quote): boolean {
isQuoteEditableForBuyer(quote: Quote): boolean {
return (
quote.isEditable &&
(quote.state === QuoteState.BUYER_DRAFT ||
Expand Down Expand Up @@ -152,7 +152,7 @@ export class QuoteHeaderOverviewComponent {
* @param {any} createdDate - Created date
* @returns {Observable<Card>} - Card content
*/
getEstimatedAndDate(
getEstimatedTotalAndDate(
quote: Quote,
createdDate?: string | null
): Observable<Card> {
Expand Down
12 changes: 6 additions & 6 deletions feature-libs/quote/components/list/quote-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import { QuoteListComponentService } from './quote-list-component.service';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class QuoteListComponent {
protected quoteListService = inject(QuoteListComponentService);
protected quoteListComponentService = inject(QuoteListComponentService);

sorts = this.quoteListService.sorts;
sortLabels$ = this.quoteListService.sortLabels$;
quotesState$ = this.quoteListService.quotesState$;
sorts = this.quoteListComponentService.sorts;
sortLabels$ = this.quoteListComponentService.sortLabels$;
quotesState$ = this.quoteListComponentService.quotesState$;
dateFormat: string = 'MMMM d, YYYY h:mm aa';
iconTypes = ICON_TYPE;

Expand All @@ -29,11 +29,11 @@ export class QuoteListComponent {
}

changeSortCode(sortCode: string): void {
this.quoteListService.setSort(sortCode);
this.quoteListComponentService.setSort(sortCode);
}

changePage(page: number): void {
this.quoteListService.setCurrentPage(page);
this.quoteListComponentService.setCurrentPage(page);
}

/**
Expand Down
18 changes: 9 additions & 9 deletions feature-libs/quote/core/connectors/quote.connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,56 +20,56 @@ import { QuoteAdapter } from './quote.adapter';

@Injectable()
export class QuoteConnector {
protected adapter = inject(QuoteAdapter);
protected quoteAdapter = inject(QuoteAdapter);

public getQuotes(
userId: string,
pagination: PaginationModel
): Observable<QuoteList> {
return this.adapter.getQuotes(userId, pagination);
return this.quoteAdapter.getQuotes(userId, pagination);
}

public createQuote(
userId: string,
quoteStarter: QuoteStarter
): Observable<Quote> {
return this.adapter.createQuote(userId, quoteStarter);
return this.quoteAdapter.createQuote(userId, quoteStarter);
}

public getQuote(userId: string, quoteCode: string): Observable<Quote> {
return this.adapter.getQuote(userId, quoteCode);
return this.quoteAdapter.getQuote(userId, quoteCode);
}

public editQuote(
userId: string,
quoteCode: string,
quoteMetadata: QuoteMetadata
): Observable<unknown> {
return this.adapter.editQuote(userId, quoteCode, quoteMetadata);
return this.quoteAdapter.editQuote(userId, quoteCode, quoteMetadata);
}

public performQuoteAction(
userId: string,
quoteCode: string,
quoteAction: QuoteActionType
): Observable<unknown> {
return this.adapter.performQuoteAction(userId, quoteCode, quoteAction);
return this.quoteAdapter.performQuoteAction(userId, quoteCode, quoteAction);
}

public addComment(
userId: string,
quoteCode: string,
quoteComment: Comment
): Observable<unknown> {
return this.adapter.addComment(userId, quoteCode, quoteComment);
return this.quoteAdapter.addComment(userId, quoteCode, quoteComment);
}

public addDiscount(
userId: string,
quoteCode: string,
discount: QuoteDiscount
): Observable<unknown> {
return this.adapter.addDiscount(userId, quoteCode, discount);
return this.quoteAdapter.addDiscount(userId, quoteCode, discount);
}

public addQuoteEntryComment(
Expand All @@ -78,7 +78,7 @@ export class QuoteConnector {
entryNumber: string,
comment: Comment
): Observable<unknown> {
return this.adapter.addQuoteEntryComment(
return this.quoteAdapter.addQuoteEntryComment(
userId,
quoteCode,
entryNumber,
Expand Down
6 changes: 3 additions & 3 deletions feature-libs/quote/core/facade/quote.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class QuoteService implements QuoteFacade {
protected commandService = inject(CommandService);
protected activeCartFacade = inject(ActiveCartFacade);
protected routingService = inject(RoutingService);
protected multiCartService = inject(MultiCartFacade);
protected multiCartFacade = inject(MultiCartFacade);
protected quoteCartService = inject(QuoteCartService);
protected cartUtilsService = inject(CartUtilsService);
protected globalMessageService = inject(GlobalMessageService);
Expand Down Expand Up @@ -106,7 +106,7 @@ export class QuoteService implements QuoteFacade {
)
),
tap(([_, userId, quote]) => {
this.multiCartService.loadCart({
this.multiCartFacade.loadCart({
userId,
cartId: quote.cartId as string,
extraData: {
Expand Down Expand Up @@ -307,7 +307,7 @@ export class QuoteService implements QuoteFacade {
quoteId: string,
actionType: QuoteActionType
) {
this.multiCartService.loadCart({
this.multiCartFacade.loadCart({
userId: userId,
cartId: cartId,
extraData: {
Expand Down
Loading

0 comments on commit 250417b

Please sign in to comment.