PageSourceSearch

https://gecs.galfar.com/SupplyChainPortal/views/enquiry.js?3.4.2

js galfar.com collected 2026-10-02 16:29:46 UTC 48,895 bytes, 813 lines download raw bytes

1//FixVersion="3.3.1.1028"
2//FixVersion="3.3.1.1040"
3//FixVersion="3.4.0.396"
4//FixVersion="3.4.0.506"
5//FixVersion="3.4.0.930"
6var objEnquiryState = { 'selectedEntity': '', 'selectedState': '' };
7SupplierPortalMaterialize.enquiry = function (params) {
8    "use strict";
9    var arrEnquiries = [], objEnqStatCnt = {}, arrEnqEntDivn = [],
10        selectedDivision = objEnquiryState.selectedEntity,
11        currentStatus = objEnquiryState.selectedState ? objEnquiryState.selectedState : 'New',
12        tempDocGuid, tempEnqType, tempRcptId,multipleQuoteFlag='N';
13    var cntPageTotal;
14    function bindEnquiryHostActions() {
15        $(document).off('click.enquirySearch', '#btnSearchEnquiryFilter').on('click.enquirySearch', '#btnSearchEnquiryFilter', function (clickEvent) {
16            clickEvent.preventDefault();
17            vmEnquiry.searchFilterEnquiry();
18        });
19
20        $(document).off('click.enquiryClear', '#btnClearEnquiryFilter').on('click.enquiryClear', '#btnClearEnquiryFilter', function (clickEvent) {
21            clickEvent.preventDefault();
22            vmEnquiry.clearFilterEnquiry();
23        });
24    }
25
26    var vmEnquiry = {
27        name: "enquiry",
28        initializeCustomScreen: function (e) {
29            this.viewRendered(e);
30            bindEnquiryHostActions();
31        },
32        //Procurement Purchase Enquiry
33        viewRendered: function (e) {
34            initUserAccess(e, function () {
35            DynamicMenu(vmEnquiry.name);
36            if (typeof bindBreadcrumbs === "function") {
37                bindBreadcrumbs(vmEnquiry.name);
38            }
39            $('#custom-breadcrumbs').show();
40                bindBreadcrumbs(vmEnquiry.name);
41                $('#custom-breadcrumbs').show();
42                //vmEnquiry.executeEnquiries();
43                $('#enqType').html('');
44                $('#enqType').append('<option value="PR">Procurement</option>');
45                $('#enqType').append('<option value="SC"> Subcontract</option>');
46                $('#enqType').append('<option value="AL" selected>All</option>');
47                Materialize.updateTextFields();
48                tempEnqType = $('#enqType').val();
49
50                $('#enqType').on("change", function (e) {
51                    tempEnqType = $('#enqType').val();
52                    vmEnquiry.loadPagingFooter();
53                });
54                if (localStorage.enqRefresh) localStorage.enqRefresh = '';
55                $('#txt_Enq_filter').keyup(function (e) {
56                    if (e.keyCode == 13) {
57                        vmEnquiry.searchFilterEnquiry();
58                    }
59                });
60                $('#txt_Enq_filter').change(function (e) {
61                    if ($(this).val() == '') {
62                        vmEnquiry.loadPagingFooter();
63                    }
64                });
65                $("#headerChipsPlacedOn").off();
66                $("#headerChipsPlacedOn").on("click", ".chip", function () {
67                    $('#txt_Enq_filter').val('');
68                    $("#headerChipsPlacedOn").find('.chip').removeClass('secondary_back');
69                    $(this).addClass('secondary_back');
70                    selectedDivision = $(this).data('divisionid');
71                    objEnquiryState.selectedEntity = selectedDivision;
72                    if (selectedDivision) {
73                        vmEnquiry.setEnquiryStatCount();
74                    }
75                    vmEnquiry.loadPagingFooter();
76                });
77                $("#myButtons").off();
78                $("#myButtons").on("click", ".sectiondiv", function () {
79                    $('#txt_Enq_filter').val('');
80                    $("#myButtons").find('.sectiondiv').find('.card-image').addClass('secInactive').removeClass('secondary_back');
81                    $(this).find('.card-image').addClass('secondary_back').removeClass('secInactive');
82                    currentStatus = $(this).find('.card-title').text();
83                    objEnquiryState.selectedState = currentStatus;
84                    vmEnquiry.loadPagingFooter();
85                });
86                if (currentStatus) {
87                    $("#myButtons").find('.sectiondiv').find('.card-image').addClass('secInactive').removeClass('secondary_back');
88                    $("#myButtons").find('.sectiondiv[data-state="' + currentStatus + '"]').find('.card-image').addClass('secondary_back').removeClass('secInactive');
89                }
90                vmEnquiry.loadGridIconEvents();
91                vmEnquiry.loadEnqHeaderCnt(function () {
92                    vmEnquiry.setEnquiryStatCount();
93                    vmEnquiry.loadEnqTbl(function () {
94                        $('#custom-loader').hide();
95                        if (currentStatus) {
96                            $("#myButtons").find('.sectiondiv').find('.card-image').addClass('secInactive').removeClass('secondary_back');
97                            $("#myButtons").find('.sectiondiv[data-state="' + currentStatus.substring(0, 1) + '"]').
98                                find('.card-image').addClass('secondary_back').removeClass('secInactive');
99                            $($("#headerChipsPlacedOn").find('.chip[data-divisionid="' + selectedDivision + '"]')).trigger('click');
100                        }
101                    });
102                });
103            });
104            $(document).ready(function () {
105                var allowView = false;
106                $('#custom-loader').show();
107                executeServiceCall("GetUserViewAccess", {
108            sUserName: ENCRYPTED_USER, //USERNAME, //XE-74005 USERNAME
109        }, function (success) {
110           var  accessViews = success;
111
112          allowView =  accessViews.some(function(el) {
113                return el.PORTAL_VIEW_NAME == getCurrentPortalViewName();
114            }); 
115            if (!allowView) {
116                navigateView("home", false, {});
117                displayToast('Access Denied.', 'warning', defaultToastMessageDuration);
118            }
119            $('#custom-loader').hide();
120        });
121        
122
123            });
124            bindEnquiryHostActions();
125        },
126        loadGridIconEvents: function () {
127            $("#tblEnquiry tbody").off();
128            $("#tblEnquiry tbody").on("click", ".downloadEnquiry", function (e) {
129                tempDocGuid = $($(e.currentTarget).closest('tr').find('td')[0]).data('docguid');
130                vmEnquiry.DownloadEnquiryData(e);
131            });
132            $("#tblEnquiry tbody").on("click", ".confirmEnquiry", function (e) {
133                tempDocGuid = $($(e.currentTarget).closest('tr').find('td')[0]).data('docguid');
134                var rcptId = $(e.currentTarget).closest('tr').data('rcptid');
135                var processCode = $(e.currentTarget).closest('tr').data('processcode');
136                var stepCode = $(e.currentTarget).closest('tr').data('stepcode');
137                vmEnquiry.ConfirmDeclineEnquiry(e, 'O', '', rcptId, processCode, stepCode);
138            });
139            $("#tblEnquiry tbody").on("click", ".declineEnquiry", function (e) {
140                swal({
141                    title: '',
142                    text: 'Are you sure you want to decline this document?',
143                    input: 'textarea',
144                    inputPlaceholder: 'Please enter your reason for decline..',
145                    inputAttributes: {
146                        maxlength: 5000,
147                        length: 5000,
148                        autocapitalize: 'off',
149                        autocorrect: 'off'
150                    },
151                    type: "warning",
152                    showCancelButton: true,
153                    confirmButtonText: confirmButtonText,
154                    cancelButtonText: cancelButtonText,
155                    confirmButtonColor: confirmButtonColor,
156                    cancelButtonColor: cancelButtonColor,
157                    allowOutsideClick: false,
158                    animation: false,
159                    customClass: 'animated zoomIn',
160                    preConfirm: function (ev) {
161                        if (!ev) swal.showValidationError('Please enter your reason')
162                    },
163                }).then(function (r) {
164                    if (r.value) {
165                        var msg = r.value.substr(0, 5000);
166                        var rcptId =  $(e.currentTarget).closest('tr').data('rcptid');
167                        tempDocGuid = $($(e.currentTarget).closest('tr').find('td')[0]).data('docguid');
168                        var processCode = $(e.currentTarget).closest('tr').data('processcode');
169                        var stepCode = $(e.currentTarget).closest('tr').data('stepcode');
170                        vmEnquiry.ConfirmDeclineEnquiry(e, 'D', msg, rcptId, processCode, stepCode);
171                    }
172                });
173            });
174            $("#tblEnquiry tbody").on("click", ".viewEnquiry, .requestQuote", function (e) {
175                tempDocGuid = $($(e.currentTarget).closest('tr').find('td')[0]).data('docguid');
176                var tempEntity = $(e.currentTarget).closest('tr').data('entitydivisionid');
177                var ieCode = $(e.currentTarget).closest('tr').data('iecode');
178                var enqType = $(e.currentTarget).closest('tr').data('enqtype');
179                var responseBy = $(e.currentTarget).closest('tr').data('responseby');
180                tempRcptId = $(e.currentTarget).closest('tr').data('rcptid');
181                var processCode = $(e.currentTarget).closest('tr').data('processcode');
182                var stepCode = $(e.currentTarget).closest('tr').data('stepcode');
183                var code;
184                if ($(this).hasClass('ammendQuoteEnquiry') == true) code = 'A';
185                else code = 'Q';
186
187                navigateView('EnquiryResponse', true,
188                    {
189                        sEnqDocGuid: tempDocGuid && tempDocGuid != null ? tempDocGuid : '',
190                        sEntityDivision: tempEntity && tempEntity != null ? tempEntity : '',
191                        sRecipientId: tempRcptId && tempRcptId != null ? tempRcptId : '',
192                        sProcessCode: processCode && processCode != null ? processCode : '',
193                        sStepCode: stepCode && stepCode != null ? stepCode : '',
194                    });
195                //}
196                localStorage.enqRefresh = 'N';
197
198
199            });
200            $("#tblEnquiry tbody").on("click", ".viewRecommendation", function (e) {
201                tempDocGuid = $($(e.currentTarget).closest('tr').find('td')[0]).data('docguid');
202                var tempEntity = $(e.currentTarget).closest('tr').data('entitydivisionid');
203                var ieCode = $(e.currentTarget).closest('tr').data('iecode');
204                var enqType = $(e.currentTarget).closest('tr').data('enqtype');
205                var responseBy = $(e.currentTarget).closest('tr').data('responseby');
206                var processCode = $(e.currentTarget).closest('tr').data('processcode');
207                var stepCode = $(e.currentTarget).closest('tr').data('stepcode');
208                tempRcptId = $(e.currentTarget).closest('tr').data('rcptid');
209                
210
211                navigateView('EnquiryRecommendation', true,
212                    {
213                        sEnqDocGuid: tempDocGuid && tempDocGuid != null ? tempDocGuid : '',
214                        sEntityDivision: tempEntity && tempEntity != null ? tempEntity : '',
215                        sRecipientId: tempRcptId && tempRcptId != null ? tempRcptId : '',
216                        sProcessCode: processCode && processCode != null ? processCode : '',
217                        sStepCode: stepCode && stepCode != null ? stepCode : '',
218                    });
219                //}
220                localStorage.enqRefresh = 'N';
221
222
223            });
224            $("#tblEnquiry tbody").on("click", ".quoteEnquiry, .ammendQuoteEnquiry", function (e) {
225                tempDocGuid = $($(e.currentTarget).closest('tr').find('td')[0]).data('docguid');
226                var tempEntity = $(e.currentTarget).closest('tr').data('entitydivisionid');
227                var ieCode = $(e.currentTarget).closest('tr').data('iecode');
228                var enqType = $(e.currentTarget).closest('tr').data('enqtype');
229                var responseBy = $(e.currentTarget).closest('tr').data('responseby');
230                tempRcptId = $(e.currentTarget).closest('tr').data('rcptid');
231                var processCode = $(e.currentTarget).closest('tr').data('processcode');
232                var stepCode = $(e.currentTarget).closest('tr').data('stepcode');
233                var date = new Date();
234                var date1 = new Date(responseBy);
235                var currentDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
236                var varResponseDate = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate());
237
238                executeServiceCall("GetXpedeonParameters", {
239                    sName: 'SCP_STOP_QUOTE_AFTER_RESP_DATE'
240                }, function (success) {
241                    if (success.length > 0) {
242                        if (success[0].STRING_NUMERIC_VALUE == 'Y') {
243                            if (responseBy && Date.parse(currentDate) > Date.parse(varResponseDate)) {
244                                displayToast('Quotations cannot be entered as the enquiry has lapsed.', 'warning', defaultToastMessageDuration);
245                            } else {
246                                var code;
247                                if ($(this).hasClass('ammendQuoteEnquiry') == true) code = 'A';
248                                else code = 'Q';
249
250                                navigateView('EnquiryResponse', true,
251                                    {
252                                        sEnqDocGuid: tempDocGuid && tempDocGuid != null ? tempDocGuid : '',
253                                        sEntityDivision: tempEntity && tempEntity != null ? tempEntity : '',
254                                        sRecipientId: tempRcptId && tempRcptId != null ? tempRcptId : '',
255                                        sProcessCode: processCode && processCode != null ? processCode : '',
256                                        sStepCode: stepCode && stepCode != null ? stepCode : '',
257                                    });
258                                //}
259                                localStorage.enqRefresh = 'N';
260                            }
261
262                        } else {
263                            var code;
264                            if ($(this).hasClass('ammendQuoteEnquiry') == true) code = 'A';
265                            else code = 'Q';
266
267                            navigateView('EnquiryResponse', true,
268                                {
269                                    sEnqDocGuid: tempDocGuid && tempDocGuid != null ? tempDocGuid : '',
270                                    sEntityDivision: tempEntity && tempEntity != null ? tempEntity : '',
271                                    sRecipientId: tempRcptId && tempRcptId != null ? tempRcptId : '',
272                                    sProcessCode: processCode && processCode != null ? processCode : '',
273                                    sStepCode: stepCode && stepCode != null ? stepCode : '',
274                                });
275                            //}
276                            localStorage.enqRefresh = 'N';
277                        }
278                    } else { //XE-74231
279                        var code;
280                        if ($(this).hasClass('ammendQuoteEnquiry') == true) code = 'A';
281                        else code = 'Q';
282
283                        navigateView('EnquiryResponse', true,
284                            {
285                                sEnqDocGuid: tempDocGuid && tempDocGuid != null ? tempDocGuid : '',
286                                sEntityDivision: tempEntity && tempEntity != null ? tempEntity : '',
287                                sProcessCode: processCode && processCode != null ? processCode : '',
288                                sStepCode: stepCode && stepCode != null ? stepCode : '',
289                            });
290                        //}
291                        localStorage.enqRefresh = 'N';
292                    }
293                }, function (err) {
294                    displayToast(err, 'error');
295                });
296
297            });
298            $("#tblEnquiry tbody").on("click", ".additionalEnquiry", function (e) {
299               tempDocGuid = $($(e.currentTarget).closest('tr').find('td')[0]).data('docguid');
300                var tempEntity = $(e.currentTarget).closest('tr').data('entitydivisionid');
301                var ieCode = $(e.currentTarget).closest('tr').data('iecode');
302                var rcptid = $(e.currentTarget).closest('tr').data('rcptid');
303                var processCode = $(e.currentTarget).closest('tr').data('processcode');
304                var stepCode = $(e.currentTarget).closest('tr').data('stepcode');
305                $("#additionalQuoteInfo").remove();
306                $('#tblAdditionalEnquiry tbody tr').append('<td id="additionalQuoteInfo" data-docguid="' + tempDocGuid + '" data-iecode="' + ieCode +
307                    '" data-rcptid="' + rcptid + '" data-entitydivisionid="' + tempEntity + '"></td>');
308               //vmEnquiry.additionalEnquiryClick(e);
309                swal({
310                    title: '',
311                    text: 'Description',
312                    input: 'textarea',
313                    inputPlaceholder: 'Please enter additional quote description.',
314                    inputAttributes: {
315                        maxlength: 250,
316                        length: 250,
317                        autocapitalize: 'off',
318                        autocorrect: 'off'
319                    },
320                    type: "info",
321                    showCancelButton: true,
322                    confirmButtonText: 'Save',
323                    cancelButtonText: 'Cancel',
324                    confirmButtonColor: confirmButtonColor,
325                    cancelButtonColor: cancelButtonColor,
326                    allowOutsideClick: false,
327                    animation: false,
328                    customClass: 'animated zoomIn',
329                    preConfirm: function (ev) {
330                        if (!ev) swal.showValidationError('Quote Description is mandatory.');
331                    },
332                }).then(function (r) {
333                    if (r.value) {
334                        var desc = r.value.substr(0, 250);
335                        var stempDocGuid = $("#additionalQuoteInfo").data('docguid');
336                        var stempEntity = $("#additionalQuoteInfo").data('entitydivisionid');
337                        var sRcptid = $("#additionalQuoteInfo").data('rcptid');
338
339                        vmEnquiry.saveAddtionalQuote(e, stempDocGuid, stempEntity, sRcptid, desc, processCode, stepCode);
340                    }
341                });
342                
343                //$("#modalAdditionalEnquiry").openModal();  
344            });
345            $("#tblEnquiry tbody").on("click", ".enquiryMessage", function (e) {
346                tempDocGuid = $($(e.currentTarget).closest('tr').find('td')[0]).data('docguid');
347                var tempEntity = $(e.currentTarget).closest('tr').data('entitydivisionid');
348                var ieCode = $(e.currentTarget).closest('tr').data('iecode');
349                var rcptid = $(e.currentTarget).closest('tr').data('rcptid');
350                var processCode = $(e.currentTarget).closest('tr').data('processcode');
351                var stepCode = $(e.currentTarget).closest('tr').data('stepcode');
352                $("#additionalQuoteInfo").remove();
353                $('#tblMessage tbody tr').append('<td id="additionalQuoteInfo" data-docguid="' + tempDocGuid + '" data-iecode="' + ieCode +
354                    '" data-rcptid="' + rcptid + '" data-entitydivisionid="' + tempEntity + '"></td>');
355                //vmEnquiry.messageClick(e);
356                swal({
357                    title: '',
358                    text: 'Message',
359                    input: 'textarea',
360                    inputPlaceholder: 'Please enter additional quote description.',
361                    inputAttributes: {
362                        maxlength: 250,
363                        length: 250,
364                        autocapitalize: 'off',
365                        autocorrect: 'off'
366                    },
367                    type: "info",
368                    showCancelButton: true,
369                    confirmButtonText: 'Send',
370                    cancelButtonText: 'Cancel',
371                    confirmButtonColor: confirmButtonColor,
372                    cancelButtonColor: cancelButtonColor,
373                    allowOutsideClick: false,
374                    animation: false,
375                    customClass: 'animated zoomIn',
376                    preConfirm: function (ev) {
377                        if (!ev) swal.showValidationError('Quote Description is mandatory.');
378                    },
379                }).then(function (r) {
380                    if (r.value) {
381                        var message = r.value.substr(0, 250);
382                        var stempDocGuid = $("#additionalQuoteInfo").data('docguid');
383                        var stempEntity = $("#additionalQuoteInfo").data('entitydivisionid');
384                        var sRcptid = $("#additionalQuoteInfo").data('rcptid');
385                        vmEnquiry.sendQuoteMessage(e, stempDocGuid, stempEntity, sRcptid, message, processCode, stepCode);
386                    }
387                });
388
389            });
390        },
391        setEnquiryStatCount: function () {
392            $('.newCount').text('0').attr('data-pgcnt', '0');
393            $('.openCount').text('0').attr('data-pgcnt', '0');
394            $('.quoteCount').text('0').attr('data-pgcnt', '0');
395            $('.noresponseCount').text('0').attr('data-pgcnt', '0');
396            $('.declineCount').text('0').attr('data-pgcnt', '0');
397            $('.quoteInProgressCount').text('0').attr('data-pgcnt', '0');
398            $('.noresponse').hide();
399            $('.recommendationCount').text('0').attr('data-pgcnt', '0');
400            $.each(objEnqStatCnt, function (i, obj) {
401                if (obj.PORTAL_STATUS) {
402                    if (obj.PORTAL_STATUS_DESC == 'New' && selectedDivision == obj.ENTITY_DIVISION_ID)
403                        $('.newCount').text(obj.TOTAL_CNT).attr('data-pgcnt', obj.PAGE_CNT);
404                    else if (obj.PORTAL_STATUS_DESC == 'Open' && selectedDivision == obj.ENTITY_DIVISION_ID)
405                        $('.openCount').text(obj.TOTAL_CNT).attr('data-pgcnt', obj.PAGE_CNT);
406                    else if (obj.PORTAL_STATUS_DESC == 'Quoted' && selectedDivision == obj.ENTITY_DIVISION_ID)
407                        $('.quoteCount').text(obj.TOTAL_CNT).attr('data-pgcnt', obj.PAGE_CNT);
408                    else if (obj.PORTAL_STATUS_DESC == 'Quotes In Progress' && selectedDivision == obj.ENTITY_DIVISION_ID)
409                        $('.quoteInProgressCount').text(obj.TOTAL_CNT).attr('data-pgcnt', obj.PAGE_CNT);
410                    else if (obj.PORTAL_STATUS_DESC == 'Declined' && selectedDivision == obj.ENTITY_DIVISION_ID)
411                        $('.declineCount').text(obj.TOTAL_CNT).attr('data-pgcnt', obj.PAGE_CNT);
412                    else if (obj.PORTAL_STATUS_DESC == 'No Response' && selectedDivision == obj.ENTITY_DIVISION_ID && obj.TOTAL_CNT) {
413                        $('.noresponseCount').text(obj.TOTAL_CNT).attr('data-pgcnt', obj.PAGE_CNT);
414                        $('.noresponse').show();
415                    }
416                    else if (obj.PORTAL_STATUS_DESC == 'Recommendation' && selectedDivision == obj.ENTITY_DIVISION_ID)
417                        $('.recommendationCount').text(obj.TOTAL_CNT).attr('data-pgcnt', obj.PAGE_CNT);
418                }
419
420            });
421        },
422        loadEnqHeaderCnt: function (callback) {
423            executeServiceCall("GetEnquiriesCount", {
424                sUserName: ENCRYPTED_USER, //USERNAME, //XE-74005
425                sRowsPerPage: rowsPerPage,
426            }, function (success) {
427                objEnqStatCnt = success;
428                arrEnqEntDivn = $.grep(objEnqStatCnt, function (itm) {
429                    itm.DISPLAY_DIVISION_NAME = objActiveEntityList[itm.ENTITY_DIVISION_ID]["DISPLAY_DIVISION_NAME"];
430                    return (!itm.PORTAL_STATUS);
431                });
432                sortJsonByMultipleKeys(arrEnqEntDivn, [{ "key": "DISPLAY_DIVISION_NAME", "order": "asc" }], function (dataArr) {
433                    arrEnqEntDivn = dataArr;
434                });
435
436                $('#headerChipsPlacedOn').html('');
437                $.each(arrEnqEntDivn, function (i, obj) {
438                    if (!obj.PORTAL_STATUS)
439                        $('#headerChipsPlacedOn').append('<div class="chip linkcursor waves-effect" data-divisionid="' + obj.ENTITY_DIVISION_ID + '">' +
440                            '<div class="divCount">' + obj.TOTAL_CNT + '</div>' + objActiveEntityList[obj.ENTITY_DIVISION_ID]["DISPLAY_DIVISION_NAME"] + '</div>');
441                });
442                if (arrEnqEntDivn.length > 0) {
443                    var isSelected = false;
444                    $.each(arrEnqEntDivn, function (i, obj) {
445                        if (selectedDivision == obj.ENTITY_DIVISION_ID) {
446                            $($('#headerChipsPlacedOn').find('.chip')[i]).addClass('secondary_back');
447                            isSelected = true;
448                        }
449                    });
450                    if (!isSelected) {
451                        selectedDivision = arrEnqEntDivn[0].ENTITY_DIVISION_ID;
452                        //$($("#headerChipsPlacedOn").find('.chip')[0]).trigger('click');
453                    }
454                }
455                if (callback) callback();
456            });
457        },
458        loadPagingFooter: function () {
459            cntPageTotal = $('.card.sectiondiv').find('.card-title:contains("' + currentStatus + '")').closest('.card-image').find('.price').attr('data-pgcnt');
460            var filterText = $('#txt_Enq_filter').val();
461            loadMaterialPaging('#enqPaging', { 'pgNum': cntPageTotal, 'pgCur': 1 }, function (curPageNum) {
462                $('#custom-loader').show();
463                var localCurrentStatus = currentStatus == 'No Response' ? 'X' : currentStatus.substring(0, 1);
464                if (localCurrentStatus == 'Q') {
465                    if (currentStatus == "Quotes In Progress") {
466                        localCurrentStatus = 'QU';
467                    } else {
468                        localCurrentStatus = 'QL';
469                    }
470                }
471                executeServiceCall("GetEnquiriesByPage", {
472                    sEntDivId: selectedDivision,
473                    sPortalStatus: localCurrentStatus,
474                    sPageNo: curPageNum,
475                    sRowsPerPage: rowsPerPage,
476                    sSearchText: filterText,
477                    sEnqType: tempEnqType,
478                }, function (success) {
479                    arrEnquiries = success[0];
480                    vmEnquiry.loadEnqTbl(function () {
481                        $('#custom-loader').hide();
482                    });
483                });
484            });
485        },
486        loadEnqTbl: function (callback) {
487            var responsiveTableOption = {
488                "columnDefs": [{ "targets": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "orderable": false }],
489                "order": [[1, "desc"], [2, "asc"]]
490            };
491            responsiveTableOption.scrollHeight = $('#layouts-horizontal').height() - ($('#header').height() + $('#horizontal-nav').height() +
492                $('#headerChipsPlacedOn').height() + $('#myButtons').height() + $('.page-footer').height() + 192);
493            responsiveTableOption.scrollCollapse = true;
494            responsiveTableOption.filter = false;
495            setDataTablesResponsive('#tblEnquiry', function () {
496                $('#tblEnquiry tbody').html('');
497                var optionAction = '';
498                var enqType, enqDate, quoteClass;
499                $(".enquiryReference").text("Enquiry Ref. #");
500                $.each(arrEnquiries, function (i, obj) {
501                    quoteClass = '';
502                    if (obj.IS_MULTIPLE_ALLOW == 'Y') {
503                        multipleQuoteFlag = 'Y';
504                    }
505                    if (obj.QUOTE_DESCRIPTION) {
506                        multipleQuoteFlag = 'Y';
507                    }
508                    
509                    if (obj.ENTITY_DIVISION_ID == selectedDivision) {
510                        if (obj.PORTAL_STATUS == 'N') {
511                            optionAction = '<div class="action-icon mydivEnquiry">' +
512                                '<ul>' +
513                                '<li class="downloadEnquiry"><a><i class="icon-download7"></i><div class="actionText">Download</div></a></li>' +
514                                '<li class="confirmEnquiry"><a><i class="icon-file-check2"></i><div class="actionText">Confirm</div></a></li>' +
515                                '<li class="declineEnquiry"><a><i class="icon-cancel-square2"></i><div class="actionText">Decline</div></a></li>' +
516                                '</ul>' +
517                                '</div>';
518                        } else if (obj.PORTAL_STATUS == 'O') {
519                            //if (obj.IS_QUOTE_REQUEST == 'Y') quoteClass = 'requestQuote';
520                            //else quoteClass = 'quoteEnquiry';
521                            if (obj.IS_MULTIPLE_ALLOW == 'Y') {
522                                optionAction = '<div class="action-icon mydivEnquiry">' +
523                                    '<ul>' +
524                                    '<li class="downloadEnquiry"><a><i class="icon-download7"></i><div class="actionText">Download</div></a></li>' +
525                                    '<li class="quoteEnquiry"><a><i class="icon-highlight"></i><div class="actionText">Quote</div></a></li>' +
526                                    ' <li class="additionalEnquiry"><a><i class="icon-highlight"></i><div class="actionText">Additional Quote</div></a></li>' +                                    
527                                    '<li class="enquiryMessage"><a><img style ="height: 15px;
527width: 20px;margin: 0px 0px;" class="imageIcon" src="images/icons8-Chat Filled-50.png" alt="Message"><div class="actionText">Message</div></a></li>' +
528                                    '</ul>' +
529                                    '</div>';
530                            } else {
531                                optionAction = '<div class="action-icon mydivEnquiry">' +
532                                        '<ul>' +
533                                        '<li class="downloadEnquiry"><a><i class="icon-download7"></i><div class="actionText">Download</div></a></li>' +
534                                        '<li class="quoteEnquiry"> <a><i class="icon-highlight"></i><div class="actionText">Quote</div></a></li>' +                                    
535                                    '<li  class="enquiryMessage"><a><img style ="height: 15px;width: 20px;margin: 0px 0px;"  class="imageIcon" src="images/icons8-Chat Filled-50.png" alt="Message"><div class="actionText">Message</div></a></li>' +
536                                    '</ul>' +
537                                        '</div>';
538                            }
539                        } else if (obj.PORTAL_STATUS == 'Q') {
540                            //if (obj.IS_QUOTE_REQUEST == 'Y') quoteClass = 'requestQuote';
541                            //else quoteClass = 'ammendQuoteEnquiry';
542                            if (obj.IS_MULTIPLE_ALLOW == 'Y') {                                
543                                optionAction = '<div class="action-icon mydivEnquiry">' +
544                                    '<ul>' +
545                                    '<li class="downloadEnquiry"><a><i class="icon-download7"></i><div class="actionText">Download</div></a></li>' +
546                                    '<li class="ammendQuoteEnquiry"><a><i class="icon-add-to-list"></i><div class="actionText">Amend Quote</div></a></li>' +                                    
547                                    ' <li class="additionalEnquiry"><a><i class="icon-highlight"></i><div class="actionText">Additional Quote</div></a></li>' +
548                                   ' <li class="enquiryMessage"><a><img style="height: 15px;width: 20px;margin: 0px 0px;" class="imageIcon" src="images/icons8-Chat Filled-50.png" alt="Message"><div class="actionText">Message</div></a></li>' +
549                                    '</ul>' +                                    
550                                    '</div>';
551                            }
552                            else {
553                                optionAction = '<div class="action-icon mydivEnquiry">' +
554                                    '<ul>' +
555                                    '<li class="downloadEnquiry"><a><i class="icon-download7"></i><div class="actionText">Download</div></a></li>' +
556                                    '<li class="ammendQuoteEnquiry"><a><i class="icon-add-to-list"></i><div class="actionText">Amend Quote</div></a></li>' +
557                                    '<li class="enquiryMessage"><a><img style="height: 15px;width: 20px;margin: 0px 0px;" class="imageIcon" src="images/icons8-Chat Filled-50.png" alt="Message"><div class="actionText">Message</div></a></li>' +
558                                    '</ul>' +                                    
559                                    '</div>';
560                            }
561                        } else if (obj.PORTAL_STATUS == 'D' || obj.PORTAL_STATUS == 'X') {
562                            optionAction = '<div class="action-icon mydivEnquiry">' +
563                                '<ul>' +
564                                '<li class="downloadEnquiry"><a><i class="icon-download7"></i><div class="actionText">Download</div></a></li>' +
565                                '</ul>' +
566                                '</div>';
567                        } else if (obj.PORTAL_STATUS == 'R') {
568                            $(".enquiryReference").text("Recommendation Ref. #");
569                            optionAction = '<div class="action-icon mydivEnquiry">' +
570                                '<ul>' +
571                                '<li class="viewRecommendation"> <a><i class="icon-file-eye2"></i><div class="actionText">View</div></a></li >' +
572                                '</ul>' +
573                                '</div>';
574                        }else {
575                            // if (obj.IS_QUOTE_REQUEST == 'Y') quoteClass = 'requestQuote';
576                            // else quoteClass = 'ammendQuoteEnquiry';
577                            optionAction = '<div class="action-icon mydivEnquiry">' +
578                                '<ul>' +
579                                '<li class="downloadEnquiry"><a><i class="icon-download7"></i><div class="actionText">Download</div></a></li>' +
580                                '<li class="ammendQuoteEnquiry"><a><i class="icon-add-to-list"></i><div class="actionText">Amend Quote</div></a></li>' +
581                                '<li class="declineEnquiry"><a><i class="icon-cancel-square2"></i><div class="actionText">Decline</div></a></li>' +
582                                '</ul>' +
583                                '</div>';
584                        }
585                        if (obj.PORTAL_LOCK_STATUS == 'L' || obj.PORTAL_LOCK_STATUS == 'C') {
586                            if (obj.IS_MULTIPLE_ALLOW == 'Y') {
587                                optionAction = '<div class="action-icon mydivEnquiry">' +
588                                    '<ul>' +
589                                    '<li class="downloadEnquiry"><a><i class="icon-download7"></i><div class="actionText">Download</div></a></li>' +
590                                    '<li class="viewEnquiry"><a><i class="icon-file-eye2"></i><div class="actionText">View Response</div></a></li>' +
591                                    ' <li class="additionalEnquiry"><a><i class="icon-highlight"></i><div class="actionText">Additional Quote</div></a></li>' +
592                                    ' <li class="enquiryMessage"><a><img style="height: 15px;
592width: 20px;margin: 0px 0px;" class="imageIcon" src="images/icons8-Chat Filled-50.png" alt="Message"><div class="actionText">Message</div></a></li>' +
593                                    '</ul>' +
594                                    '</div>';
595                            } else {
596                                optionAction = '<div class="action-icon mydivEnquiry">' +
597                                    '<ul>' +
598                                    '<li class="downloadEnquiry"><a><i class="icon-download7"></i><div class="actionText">Download</div></a></li>' +
599                                    '<li class="viewEnquiry"><a><i class="icon-file-eye2"></i><div class="actionText">View Response</div></a></li>' +
600                                    '<li class="enquiryMessage"><a><img style="height: 15px;width: 20px;margin: 0px 0px;" class="imageIcon" src="images/icons8-Chat Filled-50.png" alt="Message"><div class="actionText">Message</div></a></li>' +
601                                    '</ul>' +
602                                    '</div>';
603                            }
604                        }
605                        if (obj.ENQ_TYPE == 'Subcontract Enquiry')
606                            enqType = '<img class="imageIcon tooltip Subcontract" style="margin: 5px 0px;" src="images/worker.png" alt="Subcontract" title="Subcontract">';
607                        else if (obj.ENQ_TYPE == 'Procurement Enquiry')
608                            enqType = '<img class="imageIcon tooltip Procurement" style="margin: 5px 0px;" src="images/cart.png" alt="Procurement" title="Procurement">';
609                        else
610                            enqType = '';
611                        if (obj.IS_QUOTE_REQUEST == 'Y') enqType += '<img class="imageIcon tooltip Quote Request" style="margin: 5px 0px;" src="images/QuoteReq.png" alt="Qute Request" title="Quote Request">'
612                        enqDate = getFormattedDateString(obj.DOC_DATE, standardDateFormat);
613                        if (obj.PORTAL_STATUS_DESC == currentStatus || currentStatus == "Quotes In Progress") {
614                            $('#tblEnquiry tbody').append('<tr data-docguid="' + obj.DOC_GUID + '" data-enquirynum="' + obj.DOC_REF +
615                                '" data-title="' + obj.DOC_TITLE + '" data-date="' + enqDate + '" data-amtprec="' + obj.AMOUNT_PRECISION +
616                                '" data-isspm="' + obj.IS_SPM + '" data-iecode="' + obj.IE_CODE + '" data-enqtype="' + obj.ENQ_TYPE +
617                                '" data-rcptid="' + obj.RECIPIENT_ID + '" data-currencycode="' + obj.D_CURRENCY_CODE +
618                                '" data-entitydivisionid="' + obj.ENTITY_DIVISION_ID +
619                                '" data-processcode="' + obj.PROCESS_CODE +
620                                '" data-stepcode="' + obj.STEP_CODE +
621                                '" data-responseby="' + obj.RESPONSE_BY + '">' +
622                                '<td data-docguid="' + obj.DOC_GUID + '">' +
623                                enqType +
624                                '</td>' +
625                                //'<td>' + (obj.PORTAL_STATUS_DESC && obj.PORTAL_STATUS_DESC !== null ? obj.PORTAL_STATUS_DESC : '') + '</td>' +
626                                '<td style="position: relative; padding-bottom: 15px;"><span class="dn">' + getFormattedDateString(obj.DOC_DATE, 'yyyyMMdd') + '</span>' + enqDate +
627                                '<div class="childPreviewLine">' + (obj.COMMENTARY ? ' <span>' + obj.COMMENTARY + '</span>' : '') + '</div></td>' +
628                                
629                                '<td>' + (obj.DOC_REF && obj.DOC_REF !== null ? obj.DOC_REF : '') + '</td>' +
630                                '<td>' + (obj.DOC_TITLE && obj.DOC_TITLE !== null ? obj.DOC_TITLE : '') + '</td>' +
631                                '<td>' + (obj.BUYER && obj.BUYER !== null ? obj.BUYER : '') + '</td>' +
632                                '<td>' + (obj.ENTITY_CONTACT ? obj.ENTITY_CONTACT : '') + '</td>' +
633                                '<td>' + (obj.RESPONSE_BY ? getFormattedDateString(new Date(obj.RESPONSE_BY), standardDateFormat) : '') + '</td>' +
634                                '<td style="white-space: pre-line !important;">' + (obj.LOCATION && obj.LOCATION !== null ? obj.LOCATION : '') + '</td>' +
635                                '<td> <pre style="white-space: pre-wrap;">
635' + (obj.ENQ_REMARKS ? obj.ENQ_REMARKS : '') + '</pre></td>' +
636                                '<td class="descDisplay">' + (obj.QUOTE_DESCRIPTION ? obj.QUOTE_DESCRIPTION : '') + '</td>' +
637                                '<td>' + optionAction + '</td>' +
638                                '</tr>');
639                        }
640                    }
641                });
642            }, responsiveTableOption);
643            if (multipleQuoteFlag == 'N') {
644                $(".descDisplay").hide();
645            }
646            else {
647                $(".descDisplay").show();
648                multipleQuoteFlag = 'N';
649            }
650            $('.tooltip').tooltipster({
651                side: 'right',
652            });
653            $('.childPreviewLine').css('width', $('#tblEnquiry').width() - 75);
654            $.each($('#tblEnquiry tbody tr'), function (i, item) {
655                if ($(item).find('.childPreviewLine').height() > 0) $(item).find('td').css('padding-bottom', $(item).find('.childPreviewLine').height());
656            });
657            $('#custom-loader').hide();
658            if (callback) callback();
659        },
660        ConfirmDeclineEnquiry: function (e, type, declineMessage, rcptId, processCode, stepCode) {
661            $('#custom-loader').show();
662            executeServiceCall("TransitionState", {
663                sProcessCode: processCode,
664                sStepCode: stepCode,
665                sDOCGUID: tempDocGuid.toString(),
666                sStatus: type == 'O' ? 'O' : type == 'D' ? 'D' : 'Q',
667                sEntityDivisionID: selectedDivision.toString(),
668                sPortalUser: USERNAME,
669                sReasonForDecline: declineMessage ? declineMessage : null,
670                sPortalLockStatus: null,
671                sRecipientId: rcptId,
672            }, function (successConfirm) {
673                vmEnquiry.viewRendered();
674            });
675        },
676        DownloadEnquiryData: function (e) {
677            var result = arrEnquiries.filter(function (obj) {
678                return obj.DOC_GUID == tempDocGuid
679            });
680            if (result.length > 0) {
681                //executeServiceCall("GenerateSpreadsheet", {
682                //    processCode: result[0].PROCESS_CODE,
683                //    stepCode: result[0].STEP_CODE,
684                //    sDOCGuid: tempDocGuid.toString(),
685                //    strEnquiryDocRef: result[0].DOC_REF
686
687                $('#custom-loader').show();
688                executeServiceCall("DownloadPortalEnquiryDocuments", {
689                    sProcessCode: result[0].PROCESS_CODE,
690                    sStepCode: result[0].STEP_CODE,
691                    sIECode: result[0].IE_CODE,
692                    sDocguid: result[0].DOC_GUID.toString(),
693                    sEntityDivisionID: selectedDivision.toString(),//USER_ENTITY,
694                    sCompanyCode: result[0].COMPANY_CODE,
695                }, function (successDownload) {
696                    convertBase64ToFile('Enquiry - ' + tempDocGuid + '.zip', successDownload);
697                    $('#custom-loader').hide();
698                });
699            }
700        },
701        clearFilterEnquiry: function () {
702            $('#txt_Enq_filter').val('');
703            vmEnquiry.loadPagingFooter();
704        },
705        searchFilterEnquiry: function () {
706            var filterText = $('#txt_Enq_filter').val();
707            if (filterText == '') vmEnquiry.loadPagingFooter();
708            else {
709                $('#custom-loader').show();
710                var localCurrentStatus = currentStatus == 'No Response' ? 'X' : (currentStatus == 'Overdue' ? 'E' : currentStatus.substring(0, 1));
711                if (localCurrentStatus == 'Q') {
712                    if (currentStatus == "Quotes In Progress") {
713                        localCurrentStatus = 'QU';
714                    } else {
715                        localCurrentStatus = 'QL';
716                    }
717                }
718                executeServiceCall("GetEnquiriesByPage", {
719                    sEntDivId: selectedDivision,
720                    sPortalStatus: localCurrentStatus,
721                    sPageNo: 0,
722                    sRowsPerPage: rowsPerPage,
723                    sSearchText: filterText,
724                    sEnqType: tempEnqType,
725                }, function (success) {
726                    arrEnquiries = success[0];
727                    vmEnquiry.loadEnqTbl(function () {
728                        $('#custom-loader').hide();
729                    });
730
731                    loadMaterialPaging('#enqPaging', { 'pgNum': success[1], 'pgCur': 1 }, function (curPageNum) {
732                        $('#custom-loader').show();
733                        executeServiceCall("GetEnquiriesByPage", {
734                            sEntDivId: selectedDivision,
735                            sPortalStatus: localCurrentStatus,//(currentStatus == 'Overdue' ? 'E' : currentStatus.substring(0, 1)),
736                            sPageNo: curPageNum,
737                            sRowsPerPage: rowsPerPage,
738                            sSearchText: filterText,
739                            sEnqType: tempEnqType,
740                        }, function (success) {
741                            arrEnquiries = success[0];
742                            vmEnquiry.loadEnqTbl(function () {
743                                $('#custom-loader').hide();
744                            });
745                        });
746                    }, true);
747                });
748            }
749        },
750        saveAddtionalQuote: function (e, stempDocGuid, stempEntity, sRcptid, description, sProcessCode, sStepCode) {
751    /*        var stempDocGuid = $("#additionalQuoteInfo").data('docguid');
752            var stempEntity = $("#additionalQuoteInfo").data('entitydivisionid');
753            var sRcptid = $("#additionalQuoteInfo").data('rcptid');
754            if (!$(".quoteDescription").val()) {
755                displayToast('Quote Description is mandatory.', 'warning');
756                return;
757            } */
758            executeServiceCall("EnquiryAdditionalQuote", {
759                sProcessCode: sProcessCode,
760                sStepCode: sStepCode,
761                sEnqDocGuid: stempDocGuid,
762                sEntDivId: stempEntity,
763                sRecipientId: sRcptid,
764                sQuoteDesc: description,
765                sPortalUser: USERNAME
766            }, function (success) {
767               
768                //vmEnquiry.closeAdditionalPopUp();
769                vmEnquiry.viewRendered();
770                displayToast('Saved Successfully. Additional Quote created is added in Open Quote section', 'success');
771            });           
772        },
773        sendQuoteMessage: function (e, stempDocGuid, stempEntity, sRcptid, message, processCode, stepCode) {
774         /*   var stempDocGuid = $("#additionalQuoteInfo").data('docguid');
775            var stempEntity = $("#additionalQuoteInfo").data('entitydivisionid');
776            var sRcptid = $("#additionalQuoteInfo").data('rcptid');
777            if (!$(".quoteMessage").val()) {
778                displayToast('Message is mandatory.', 'warning');
779                return;
780            } */
781            executeServiceCall("TransitionState", {
782                sProcessCode: processCode,
783                sStepCode: stepCode,
784                sDOCGUID: stempDocGuid,
785                sStatus: 'M',                       //hard coded as 'M to send message XE-73986
786                sEntityDivisionID: stempEntity,
787                sPortalUser: USERNAME,
788                sReasonForDecline: message,
789                sPortalLockStatus: null,
790                sRecipientId: sRcptid,
791            }, function (successConfirm) {
792              // vmEnquiry.closeMessagePopUp();
793                displayToast('Message Sent Successfully.', 'success');
794            });
795        },
796    /*    additionalEnquiryClick: function (e) {
797            $(".quoteDescription").val('');
798            $("#modalAdditionalEnquiry").openModal(e);  
799        },
800        closeAdditionalPopUp: function () {
801            $("#modalAdditionalEnquiry").closeModal();
802        },
803        messageClick: function () {
804            $(".quoteMessage").val('');
805            $("#modalMessage").openModal();
806        },
807        closeMessagePopUp: function () {
808            $("#modalMessage").closeModal();
809        },
810        */
811    };
812    return vmEnquiry;
813};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.