From 8583b31260a64383664729528de1e1800a8339ee Mon Sep 17 00:00:00 2001 From: Nicola Lanzilotto Date: Mon, 28 Oct 2024 13:06:10 +0100 Subject: [PATCH] Adds the ability to manage abandoned conversation on the No real time conversations page --- .../services/websocket/ws-requests.service.ts | 25 ++++++++++------ .../history-and-nort-convs.component.html | 29 +++++++++++++++++- .../history-and-nort-convs.component.ts | 30 +++++++++++++++++-- .../img/request_icons/status150_abandoned.svg | 18 +++++++++++ 4 files changed, 89 insertions(+), 13 deletions(-) create mode 100644 src/assets/img/request_icons/status150_abandoned.svg diff --git a/src/app/services/websocket/ws-requests.service.ts b/src/app/services/websocket/ws-requests.service.ts index 9fd15f335553..69583a910afe 100755 --- a/src/app/services/websocket/ws-requests.service.ts +++ b/src/app/services/websocket/ws-requests.service.ts @@ -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: { @@ -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); diff --git a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.html b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.html index 2d03069282cd..4bfeb2cdc69b 100755 --- a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.html +++ b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.html @@ -44,8 +44,13 @@ - {{ "Unserved" | translate }} + {{ "Unserved" | translate }} + + + Abandoned + + @@ -1270,6 +1286,17 @@ + + + + + + + + diff --git a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.ts b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.ts index 3e4b1047091e..bb708c5df595 100755 --- a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.ts +++ b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.ts @@ -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' }, ]; @@ -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) { @@ -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); @@ -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() } @@ -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); // } @@ -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) => { diff --git a/src/assets/img/request_icons/status150_abandoned.svg b/src/assets/img/request_icons/status150_abandoned.svg new file mode 100644 index 000000000000..e4e7672ba18a --- /dev/null +++ b/src/assets/img/request_icons/status150_abandoned.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + +