Skip to content

Commit

Permalink
Merge pull request #264 from nimble-platform/staging
Browse files Browse the repository at this point in the history
Pull Request for Release MVP 17.1.14 / FMP 11.1.14
  • Loading branch information
dogukan10 authored Dec 3, 2020
2 parents f241a4a + 366f5e1 commit 2b6900a
Show file tree
Hide file tree
Showing 64 changed files with 704 additions and 292 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h5 class="space-before"><span [innerHTML]="'Company Analytics' | translate"></s
<span [innerHTML]="'Collaboration stats' | translate"></span>
</a>
</li>
<li class="nav-item">
<li *ngIf="!hideVisitStats" class="nav-item">
<a href id="Visits" class="nav-link" [ngClass]="{ active: selectedTab === 'Visits'}" (click)="onSelectTab($event,'Visits')">
<span [innerHTML]="'Visit stats' | translate"></span>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { DomSanitizer } from "@angular/platform-browser";
styleUrls: ["./performance-analytics.component.css"]
})
export class PerformanceAnalyticsComponent implements OnInit {
hideVisitStats = myGlobals.config.hideVisitStats;
user_count = -1;
comp_count = -1;
bp_count = -1;
Expand Down
2 changes: 1 addition & 1 deletion src/app/analytics/platform-analytics.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h3><span [innerHTML]="'Platform Analytics' | translate"></span></h3>
<div class="col-12">
<!-- Product Tabs -->
<ul class="nav nav-tabs">
<ng-container *ngIf="config.kibanaEnabled">
<ng-container *ngIf="config.kibanaEnabled && !hideLogAnalytics">
<li class="nav-item">
<a href id="LOG" class="nav-link" [ngClass]="{ active: selectedTab === 'LOG'}" (click)="onSelectTab($event,'LOG')">
<span [innerHTML]="'Log Analytics' | translate"></span>
Expand Down
3 changes: 2 additions & 1 deletion src/app/analytics/platform-analytics.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { TranslateService } from '@ngx-translate/core';
styleUrls: ["./platform-analytics.component.css"]
})
export class PlatformAnalyticsComponent implements OnInit {
hideLogAnalytics = myGlobals.config.hideLogAnalytics;
user_count = -1;
comp_count = -1;
bp_count = -1;
Expand Down Expand Up @@ -112,7 +113,7 @@ export class PlatformAnalyticsComponent implements OnInit {

ngOnInit(): void {

this.selectedTab = this.config.kibanaEnabled ? "LOG" : "DB";
this.selectedTab = this.config.kibanaEnabled && !this.hideLogAnalytics? "LOG" : "DB";
if (this.config.kibanaEnabled) {
let tmpDashboards = this.config.kibanaConfig.dashboards;
for (let i = 0; i < tmpDashboards.length; i++) {
Expand Down
44 changes: 6 additions & 38 deletions src/app/bpe/bp-summary/thread-summary.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<div *ngIf="titleEvent && showFinishCollaborationButton" class="inline" (click)="finishCollaboration()" data-toggle="tooltip" data-placement="top" [title]="'Finish the collaboration' | translate">
<i class="far fa-check-circle p-1 pointer" aria-hidden="true"></i>
</div>
<div *ngIf="titleEvent && showCancelCollaborationButton" class="inline" (click)="rateCollaborationCancelled(addCancelRatingModal)" data-toggle="tooltip" data-placement="top" [title]="'Cancel the collaboration' | translate">
<div *ngIf="titleEvent && showCancelCollaborationButton" class="inline" (click)="openCancelCollaborationModal()" data-toggle="tooltip" data-placement="top" [title]="'Cancel the collaboration' | translate">
<i class="fa fa-times p-1 pointer" aria-hidden="true"></i>
</div>
<div *ngIf="!expanded" class="inline" (click)="expanded = !expanded" data-toggle="tooltip" data-placement="top" [title]="'Show details' | translate">
Expand All @@ -98,7 +98,7 @@
<div *ngIf="titleEvent && showRateCollaborationButton" (click)="rateCollaboration(addSuccessRatingModal,addCancelRatingModal)" data-toggle="tooltip" data-placement="top" title="Rate this collaboration">
<i class="fa fa-star p-2 pointer" aria-hidden="true"></i>
</div>
<div *ngIf="titleEvent && showCancelCollaborationButton" (click)="cancelCollaboration()" data-toggle="tooltip" data-placement="top" title="Cancel the collaboration">
<div *ngIf="titleEvent && showCancelCollaborationButton" (click)="openCancelCollaborationModal()" data-toggle="tooltip" data-placement="top" title="Cancel the collaboration">
<i class="fa fa-times p-2 pointer" aria-hidden="true"></i>
</div>
<div *ngIf="!expanded" (click)="expanded = !expanded" data-toggle="tooltip" data-placement="top" title="Show details">
Expand Down Expand Up @@ -332,41 +332,9 @@ <h4 class="modal-title"><span [innerHTML]="'Rate Collaboration' | translate"></s
</form>
</ng-template>

<!-- Rating Cancel Modal -->
<ng-template #addCancelRatingModal let-d="dismiss">
<form novalidate>
<div class="modal-header">
<h4 class="modal-title"><span [innerHTML]="'Cancellation Reasons' | translate"></span></h4>
<button type="button" class="close" aria-label="Close" (click)="d('')">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="form-group row">
<label class="col-2 col-form-label">
<strong> <span [innerHTML]="'Reason' | translate"></span>:</strong>
</label>
<div class="col-10">
<select class="form-control" [(ngModel)]="compComment" name="compCommentCancel">
<option></option>
<!-- We store english labels of cancellation reasons -->
<option value="Slow Response Time"><span [innerHTML]="'Slow Response Time' | translate"></span></option>
<option value="Suspicious Company Information"><span [innerHTML]="'Suspicious Company Information' | translate"></span></option>
<option value="Undervalued Offer"><span [innerHTML]="'Undervalued Offer' | translate"></span></option>
<option value="Rejected Delivery Terms"><span [innerHTML]="'Rejected Delivery Terms' | translate"></span></option>
<option value="Other"><span [innerHTML]="'Other' | translate"></span></option>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<call-status [callStatus]="saveCallStatusRating"></call-status>
<button type="button" class="btn btn-primary save-cert-btn" [disabled]="saveCallStatusRating.isLoading() || checkCompComment()" (click)="cancelCollaboration(d)">
<span [innerHTML]="'Cancel collaboration' | translate"></span>
</button>
</div>
</form>
</ng-template>

<call-status [callStatus]="archiveCallStatus" [large]="true"></call-status>
<call-status [callStatus]="collaborationGroupRetrievalCallStatus" [large]="true"></call-status>

<!--Cancel Collaboration Modal-->
<cancel-collaboration-modal (onCollaborationCancelStatusUpdated)="onCollaborationCancelStatusUpdated($event)">
</cancel-collaboration-modal>
55 changes: 28 additions & 27 deletions src/app/bpe/bp-summary/thread-summary.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/

import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core";
import {Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
import { ProcessInstanceGroup } from "../model/process-instance-group";
import { ActivatedRoute, Router } from "@angular/router";
import { BPDataService } from "../bp-view/bp-data-service";
Expand All @@ -28,7 +28,6 @@ import { ProcessType } from "../model/process-type";
import { ThreadEventMetadata } from "../../catalogue/model/publish/thread-event-metadata";
import { ThreadEventStatus } from "../../catalogue/model/publish/thread-event-status";
import { SearchContextService } from "../../simple-search/search-context.service";
import { DocumentService } from "../bp-view/document-service";
import { EvidenceSupplied } from "../../catalogue/model/publish/evidence-supplied";
import { Comment } from "../../catalogue/model/publish/comment";
import { NgbModal } from "@ng-bootstrap/ng-bootstrap";
Expand All @@ -38,15 +37,15 @@ import { BpActivityEvent } from '../../catalogue/model/publish/bp-start-event';
import { UBLModelUtils } from '../../catalogue/model/ubl-model-utils';
import { selectPreferredValue } from '../../common/utils';
import { DashboardProcessInstanceDetails } from '../model/dashboard-process-instance-details';
import { Item } from '../../catalogue/model/publish/item';
import { NEGOTIATION_RESPONSES } from "../../catalogue/model/constants";
import { DataChannel } from '../../data-channel/model/datachannel';
import * as myGlobals from "../../globals";
import { UserService } from '../../user-mgmt/user.service';
import { AppComponent } from "../../app.component";
import { TranslateService } from "@ngx-translate/core";
import { Subject } from 'rxjs';
import { CatalogueService } from '../../catalogue/catalogue.service';
import {CancelCollaborationModalComponent} from '../../common/cancel-collaboration-modal.component';
import {CancelCollaborationStatus} from '../../common/model/cancel-collaboration-status';

@Component({
selector: 'thread-summary',
Expand Down Expand Up @@ -129,6 +128,10 @@ export class ThreadSummaryComponent implements OnInit {
ngUnsubscribe: Subject<void> = new Subject<void>();
private translations: any;

// cancel collaboration modal
@ViewChild(CancelCollaborationModalComponent)
public cancelCollaborationModal: CancelCollaborationModalComponent;

constructor(private bpeService: BPEService,
private cookieService: CookieService,
private dataChannelService: DataChannelService,
Expand Down Expand Up @@ -697,23 +700,6 @@ export class ThreadSummaryComponent implements OnInit {
})
}

cancelCollaboration(close) {
this.appComponent.confirmModalComponent.open("Are you sure that you want to cancel this collaboration?").then(result => {
if(result){
this.archiveCallStatus.submit();
this.bpeService.cancelCollaboration(this.processInstanceGroup.id, this.compComment, this.processInstanceGroup.sellerFederationId)
.then(() => {
this.archiveCallStatus.callback("Cancelled collaboration successfully");
close();
this.threadStateUpdatedNoChange.next();
})
.catch(err => {
this.archiveCallStatus.error("Failed to cancel collaboration", err);
});
}
});
}

changeCommunicationRating() {
let totalStarts = 0;
let numberOfCriteria = 0;
Expand Down Expand Up @@ -826,9 +812,28 @@ export class ThreadSummaryComponent implements OnInit {
this.modalService.open(content);
}

rateCollaborationCancelled(content) {
/**
* Opens the cancel collaboration modal
* */
openCancelCollaborationModal() {
this.compComment = "";
this.modalService.open(content);
this.cancelCollaborationModal.open(this.processInstanceGroup.id, this.processInstanceGroup.sellerFederationId);
}

/**
* This method handles the status of collaboration cancelling emitted by {@link CancelCollaborationModalComponent}.
* @param cancelCollaborationStatus the status of collaboration cancelling process
* */
onCollaborationCancelStatusUpdated(cancelCollaborationStatus:CancelCollaborationStatus){
switch (cancelCollaborationStatus.status) {
case 'STARTED':
break;
case 'COMPLETED':
// reload the thread state
this.threadStateUpdatedNoChange.next();
break;
case 'FAILED':
}
}

onSaveSuccessRating(close: any) {
Expand Down Expand Up @@ -863,10 +868,6 @@ export class ThreadSummaryComponent implements OnInit {
return !filled;
}

checkCompComment(): boolean {
return this.compComment == "";
}

alertWait() {
alert('Waiting for trading partner... try again later.');
}
Expand Down
17 changes: 15 additions & 2 deletions src/app/bpe/bp-view/negotiation/negotiation-request.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,23 @@
</div>

<div *ngIf="showRequestedPrice()" class="row actions-row">
<div class="col-6"></div>
<div *ngIf="bpDataService.isProcessPresentInTheWorkflow('Order')" class="col-6"></div>
<div *ngIf="!bpDataService.isProcessPresentInTheWorkflow('Order')" class="col-3 call-status-col">
<call-status [callStatus]="callStatus"></call-status>
</div>
<div class="col-4 price-col"><span [innerHTML]="'Requested Price' | translate"></span>: {{ getGrossTotalString() }}</div>
<div class="col-2">
<button class="btn btn-secondary action" [disabled]="isLoading()" (click)="onBack()">Back</button>
<button class="btn btn-secondary action" [disabled]="isLoading()" (click)="onBack()">{{'Back'|translate}}</button>
</div>
<!-- Buyer can cancel the collaboration when Negotiation is the last step in the business workflow-->
<div *ngIf="!bpDataService.isProcessPresentInTheWorkflow('Order')" class="col-3">
<button class="btn btn-secondary action" (click)="openCancelCollaborationModal()" [disabled]="isLoading() || processMetadata.collaborationStatus === 'COMPLETED' || processMetadata.collaborationStatus === 'CANCELLED'">
<span [innerHTML]="'Cancel collaboration' | translate"></span>
</button>
</div>
</div>
</ng-container>

<!--Cancel Collaboration Modal-->
<cancel-collaboration-modal (onCollaborationCancelStatusUpdated)="onCollaborationCancelStatusUpdated($event)">
</cancel-collaboration-modal>
32 changes: 32 additions & 0 deletions src/app/bpe/bp-view/negotiation/negotiation-request.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ import { BpActivityEvent } from '../../../catalogue/model/publish/bp-start-event
import { CompanySettings } from '../../../user-mgmt/model/company-settings';
import { FormGroup } from '@angular/forms';
import { ValidationService } from '../../../common/validation/validators';
import {CancelCollaborationModalComponent} from '../../../common/cancel-collaboration-modal.component';
import {CancelCollaborationStatus} from '../../../common/model/cancel-collaboration-status';

@Component({
selector: "negotiation-request",
Expand Down Expand Up @@ -109,6 +111,10 @@ export class NegotiationRequestComponent implements OnInit {

VALIDATION_ERROR_FOR_FRAME_CONTRACT="validation_provide_valid_input_for_frame_contract";

// cancel collaboration modal
@ViewChild(CancelCollaborationModalComponent)
public cancelCollaborationModal: CancelCollaborationModalComponent;

constructor(private bpDataService: BPDataService,
private bpeService: BPEService,
private userService: UserService,
Expand Down Expand Up @@ -439,4 +445,30 @@ export class NegotiationRequestComponent implements OnInit {
return ret;
}

/**
* Opens the cancel collaboration modal
* */
openCancelCollaborationModal() {
this.cancelCollaborationModal.open(this.bpActivityEvent.containerGroupId,this.processMetadata.sellerFederationId);
}

/**
* This method handles the status of collaboration cancelling emitted by {@link CancelCollaborationModalComponent}.
* @param cancelCollaborationStatus the status of collaboration cancelling process
* */
onCollaborationCancelStatusUpdated(cancelCollaborationStatus:CancelCollaborationStatus){
switch (cancelCollaborationStatus.status) {
case 'STARTED':
this.callStatus.submit();
break;
case 'COMPLETED':
// change collaboration status
this.processMetadata.collaborationStatus = "CANCELLED";
this.callStatus.callback("Cancelled collaboration successfully");
break;
case 'FAILED':
this.callStatus.error(cancelCollaborationStatus.errorMessage,cancelCollaborationStatus.error);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ <h3 class="font-weight-600"><span [innerHTML]="'Producer Response' | translate">
<!-- Original terms -->
<ng-container [ngSwitch]="primaryTermsSource">
<div *ngSwitchCase="'product_defaults'" class="col-3">
<label>{{isCatalogueLineDeleted ? "Not available" : wrapper.lineDiscountPriceWrapper.totalPriceString | translate}}</label>
<label>{{(isCatalogueLineDeleted ? "Not available" : wrapper.lineDiscountPriceWrapper.totalPriceString) | translate}}</label>
<small *ngIf="!isCatalogueLineDeleted">( {{ wrapper.lineDiscountPriceWrapper.discountedPriceAmountUI | amountUiTranslatePipe }} )</small>
</div>
<div *ngSwitchCase="'frame_contract'" class="col-3">
Expand Down Expand Up @@ -233,7 +233,7 @@ <h3 class="font-weight-600"><span [innerHTML]="'Producer Response' | translate">
[step]="0.01"
[disableQuantityUnit]="wrapper.lineDiscountPriceWrapper.itemPrice.hasPrice()">
</quantity-input>
<small>( {{ wrapper.newQuotationWrapper.priceWrapper.pricePerItemString | wordByWordTranslate}} )</small>
<small>( {{ wrapper.newQuotationWrapper.priceWrapper.priceAmountUI | amountUiTranslatePipe}} )</small>
<span *ngIf="isDiscountIconVisibleInCustomerRequestColumn()" class="space-left" data-toggle="tooltip" data-placement="top" (click)="openDiscountModal()" [title]="'Applied Discounts/Charges'|translate" style="cursor: pointer">
<i class="fa fa-search" aria-hidden="true"></i>
</span>
Expand Down Expand Up @@ -333,7 +333,7 @@ <h3 class="font-weight-600"><span [innerHTML]="'Producer Response' | translate">
<div *ngIf="!isDeliveryDateSectionOpen" class="row content-row" [ngClass]="{'bg-danger text-white':!wrapper.checkEqualForRequest(primaryTermsSource, 'deliveryPeriod')}">
<div class="col-3"><strong class="font-weight-500"><span [innerHTML]="'Delivery Period' | translate"></span>:</strong></div>
<ng-container [ngSwitch]="primaryTermsSource">
<div *ngSwitchCase="'product_defaults'" class="col-3">{{ isCatalogueLineDeleted ? "Not available" : (wrapper.lineDeliveryPeriod | quantityTranslatePipe)}}</div>
<div *ngSwitchCase="'product_defaults'" class="col-3">{{ isCatalogueLineDeleted ? ("Not available" | translate) : (wrapper.lineDeliveryPeriod | quantityTranslatePipe)}}</div>
<div *ngSwitchCase="'frame_contract'" class="col-3">{{ wrapper.frameContractQuotationWrapper.deliveryPeriod | quantityTranslatePipe}}</div>
<div *ngSwitchCase="'last_offer'" class="col-3">{{ wrapper.lastOfferQuotationWrapper.deliveryPeriod | quantityTranslatePipe}}</div>
</ng-container>
Expand Down
Loading

0 comments on commit 2b6900a

Please sign in to comment.