Skip to content

Commit

Permalink
Adds the ability to manage abandoned conversation on the No real time…
Browse files Browse the repository at this point in the history
… conversations page
  • Loading branch information
Nicola Lanzilotto committed Oct 28, 2024
1 parent 0fdf3e2 commit 8583b31
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 13 deletions.
25 changes: 16 additions & 9 deletions src/app/services/websocket/ws-requests.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { AppConfigService } from '../../services/app-config.service';
import { LoggerService } from '../../services/logger/logger.service';
import { LocalDbService } from '../users-local-db.service';
import { map } from 'rxjs/operators';
import { CodeInstallationModule } from 'app/components/widget-installations/code-installation/code-installation.module';
export interface Message {
action: string;
payload: {
Expand Down Expand Up @@ -1250,38 +1251,44 @@ export class WsRequestsService implements OnDestroy {
// WS Requests NO-RT & HISTORY
// -------------------------------------------------------------
public getHistoryAndNortRequests(operator: string, status: string, statuses, _preflight, querystring: string, pagenumber: number) {
this.logger.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE Get REQUESTS - operator ', operator);
this.logger.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE Get REQUEST - status ', status);
console.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE Get REQUESTS - operator ', operator);
console.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE Get REQUEST - status ', status);
this.logger.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE Get REQUEST - statuses ', statuses);
this.logger.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE Get REQUEST - statuses length ', statuses?.length);
this.logger.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE Get REQUEST - querystring ', querystring);
this.logger.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE Get REQUEST - _preflight ', _preflight);
this.logger.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE Get REQUEST - pagenumber ', pagenumber);

if (status === 'all') {
status = '100,150,200'
operator = '='
}

let _querystring = ''
if (querystring && querystring !== undefined) {
if (status === '100' || status === '200' || status === '1000' || status === '50' || status ==="1000,100,200" || statuses?.length>0) {
if (status === '100' || status === '200' || status === '1000' || status === '50' || status ==="1000,100,200" || status ==="100,150,200" || statuses?.length>0) {
_querystring = '&' + querystring
this.logger.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE HERE 1');
console.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE HERE 1');
} else if (status === 'all') {
_querystring = querystring + '&'
this.logger.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE HERE 2');

console.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE HERE 2', _querystring);
} else {
this.logger.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE HERE 3');
console.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE HERE 3');
}
} else {
_querystring = ''
this.logger.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE HERE 4');
console.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE HERE 4');
}

let url = '';
if (status !== 'all') {
url = this.SERVER_BASE_PATH + this.project_id + '/requests?status' + operator + status + _querystring + '&page=' + pagenumber + '&no_populate=true&no_textscore=true&preflight='+ _preflight;
this.logger.log('url status != all ' ,url )
console.log('url status != all ' ,url )

} else {
url = this.SERVER_BASE_PATH + this.project_id + '/requests?' + _querystring + 'page=' + pagenumber + '&no_populate=true&no_textscore=true&preflight='+ _preflight;
this.logger.log('url status all ' ,url )
console.log('url status all ' ,url )
}

// console.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - GET REQUESTS URL ', url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@
</span>

<span *ngIf="requests_status === '100'">
<a>{{ "Unserved" | translate }}</a>
<a> {{ "Unserved" | translate }}</a>
</span>

<span *ngIf="requests_status === '150'">
<a>Abandoned</a>
</span>

<b class="caret"></b>
</a>
<ul class="dropdown-menu" style="min-width: 195px;">
Expand Down Expand Up @@ -87,6 +92,17 @@
</div>
</div>
</li>

<li (click)="requestsStatusSelect('150')">
<div class="parent" style="display: flex; align-items: center;">
<div class="left" style="padding:12px 6px">
<input type="radio" id="150" name="status" value="150" [(ngModel)]="requests_status">
</div>
<div class="right" style="flex-grow: 1;">
<a class="custom-dropdown-a">{{'RequestMsgsPage.RequestAbandoned' | translate}}</a>
</div>
</div>
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -1270,6 +1286,17 @@

</span>
</span>

<span *ngIf="request?.status === 150">
<span (click)='goToRequestMsgs(request?.request_id)' style="cursor:pointer">

<img style="width: 30px;" src="assets/img/request_icons/status150_abandoned.svg" class="img-fluid"
matTooltipClass="mat-white-tooltip"
matTooltip="{{ 'RequestMsgsPage.RequestAbandoned' | translate }}" #tooltip="matTooltip"
matTooltipPosition='right' matTooltipHideDelay="100">

</span>
</span>
</td>

<!-- ===== REQUEST ID ===== -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O
status = [
{ id: '100', name: 'Unserved' },
{ id: '200', name: 'Served' },
{ id: '150', name: 'Abandoned' },
{ id: 'all', name: 'All' },
];

Expand Down Expand Up @@ -455,6 +456,11 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O
this.requests_status = '200'
this.requestsStatusSelect(this.requests_status)
}

if (this.queryParams.leftfilter === '150') {
this.requests_status = '150'
this.requestsStatusSelect(this.requests_status)
}
}

if (this.queryParams && this.queryParams.qs) {
Expand Down Expand Up @@ -1131,11 +1137,19 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O

// this.logger.log('[HISTORY & NORT-CONVS] - WsRequests NO-RT - requestsStatusSelect requests_status_selected_from_left_filter', this.requests_status_selected_from_left_filter);
this.getServedRequests();

} else if (request_status === '100') {
this.requests_status_selected_from_left_filter = '100'
this.requests_status_selected_from_advanced_option = null
// this.logger.log('[HISTORY & NORT-CONVS] - WsRequests NO-RT - requestsStatusSelect requests_status_selected_from_left_filter', this.requests_status_selected_from_left_filter);
this.getUnservedRequests();

} else if (request_status === '150') {
this.requests_status_selected_from_left_filter = '150'
this.requests_status_selected_from_advanced_option = null
// this.logger.log('[HISTORY & NORT-CONVS] - WsRequests NO-RT - requestsStatusSelect requests_status_selected_from_left_filter', this.requests_status_selected_from_left_filter);
this.getAbandonedRequests();

} else if (request_status === 'all') {
this.requests_status_selected_from_left_filter = 'all'
// this.logger.log('[HISTORY & NORT-CONVS] - WsRequests NO-RT - requestsStatusSelect requests_status_selected_from_left_filter', this.requests_status_selected_from_left_filter);
Expand Down Expand Up @@ -1203,8 +1217,9 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O
}

getAllRequests() {
// this.operator = '<'
// this.operator = '='
this.requests_status = 'all'
// this.requests_status = '100,150,200'
// this.logger.log('[HISTORY & NORT-CONVS] - WsRequests NO-RT - getAllRequests', this.requests_status, 'operator ', this.operator);
this.getRequests()
}
Expand All @@ -1223,6 +1238,13 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O
this.getRequests()
}

getAbandonedRequests() {
this.operator = '='
this.requests_status = '150'
// this.logger.log('[HISTORY & NORT-CONVS] - WsRequests NO-RT - getUnservedRequests status ', this.requests_status, 'operator ', this.operator);
this.getRequests()
}

// unsuscribeRequestById(idrequest) {
// this.wsRequestsService.unsubscribeTo_wsRequestById(idrequest);
// }
Expand Down Expand Up @@ -1344,9 +1366,11 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O

// GET REQUEST COPY - START
getRequests() {
this.logger.log('getRequests queryString', this.queryString)
console.log('getRequests queryString', this.queryString)
// this.logger.log('getRequests _preflight' , this._preflight)
// this.logger.log('getRequests requests_statuses ' , this.requests_statuses)
console.log('getRequests requests_statuses ' , this.requests_statuses)
console.log('getRequests requests_status ' , this.requests_status)

this.showSpinner = true;
let promise = new Promise((resolve, reject) => {
this.wsRequestsService.getHistoryAndNortRequests(this.operator, this.requests_status, this.requests_statuses, this._preflight, this.queryString, this.pageNo).subscribe((requests: any) => {
Expand Down
18 changes: 18 additions & 0 deletions src/assets/img/request_icons/status150_abandoned.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8583b31

Please sign in to comment.