PageSourceSearch

https://www.hseu.org.sg/assets/js/utils.js

js hseu.org.sg collected 2026-10-07 23:11:53 UTC 176,023 bytes, 4,182 lines download raw bytes

1// Pagination JS
2
3$(function () {
4    const calculatePagesCount = (pageSize, totalCount) => {
5        return totalCount < pageSize ? 1 : Math.ceil(totalCount / pageSize);
6    };
7
8    var pagination = $("#pagination-container"),
9        totalRecords = $("#list-section").attr("data-records"),
10        pageType = $("#list-section").attr("data-pagetype"),
11        results = 10;
12    if ($("#page-count-dropdown .dropdown-item.active").length > 0) {
13        results = $("#page-count-dropdown .dropdown-item.active").data("value");
14    }
15    (recPerPage = totalRecords < results ? totalRecords : results),
16        (page = 1),
17        (visiblePages = 5),
18        (totalPages =
19            totalRecords > 0 ? calculatePagesCount(recPerPage, totalRecords) : 0);
20    var sortorder = $("#page-sorting-dropdown .dropdown-item.active").data(
21        "value"
22    );
23
24    var api = {
25        Programmes: "/api/programmes/getprogrammes",
26        News: "/api/news/getNews",
27        NewsCollection: "/api/newscollection/GetNewsCollectionWithFilter",
28        RelevantArticlesForCollection:
29            "/api/newscollection/GetRelevantArticlesForCollectionFilter",
30        Events: "/api/events/GetEvents",
31        Publications: "/api/publications/getPublications",
32        MediaGallery: "/api/MediaGallery/getMediaGalleryList",
33        MediaMaterial: "/api/MediaMaterial/getmediaMaterial",
34        Videos: "/api/resourcegridapi/getallvideos",
35        SingleGallery: "/api/MediaGallery/SingleGallery",
36        Blogs: "/api/resourcegridapi/getallblogs",
37        Guides: "/api/resourcegridapi/getallguides",
38        OurPrinciples: "/api/ourpeoplegridapi/getallpeopleusingprinciple",
39        Stories: "/api/storiesgrid/getallstories",
40        Reports: "/api/ReportsAndJournals/GetAllReportsFiltered",
41        Journals: "/api/ReportsAndJournals/GetAllJournalsFiltered",
42        Deals: "/api/dealsgrid/getalldeals",
43        CaseStudy: "/api/CaseStudy/GetAllCaseStudy",
44        Testimonials: "/api/PageContent/GetAllTestimonials",
45        quiz: "/api/quiz/CaptureQuizResponse",
46        Professionals: "/api/Profiles/GetAllProfile",
47    };
48
49    var dummyData = {
50        total: 27,
51        type: "Programmes",
52        results: [
53            {
54                title: "",
55                description: "",
56                url: "https://mccfl0eprmdb46dmk92-cm.managedcloud.sitecore.com/Programmes/Career-Coaching",
57                buttonText: "",
58                image: null,
59            },
60            {
61                title: "",
62                description: "",
63                url: "https://mccfl0eprmdb46dmk92-cm.managedcloud.sitecore.com/Programmes/Company-Training-Committees",
64                buttonText: "",
65                image: null,
66            },
67            {
68                title: "",
69                description: "",
70                url: "https://mccfl0eprmdb46dmk92-cm.managedcloud.sitecore.com/Programmes/Enhanced-NTUC-Care-Fund-Covid-19",
71                buttonText: "",
72                image: null,
73            },
74            {
75                title: "",
76                description: "",
77                url: "https://mccfl0eprmdb46dmk92-cm.managedcloud.sitecore.com/Programmes/Enhanced-NTUC-Care-Fund-Covid-19",
78                buttonText: "",
79                image: null,
80            },
81            {
82                title: "",
83                description: "",
84                url: "https://mccfl0eprmdb46dmk92-cm.managedcloud.sitecore.com/Programmes/Enhanced-NTUC-Care-Fund-Covid-19",
85                buttonText: "",
86                image: null,
87            },
88            {
89                title: "",
90                description: "",
91                url: "https://mccfl0eprmdb46dmk92-cm.managedcloud.sitecore.com/Programmes/Enhanced-NTUC-Care-Fund-Covid-19",
92                buttonText: "",
93                image: null,
94            },
95            {
96                title: "",
97                description: "",
98                url: "https://mccfl0eprmdb46dmk92-cm.managedcloud.sitecore.com/Programmes/Enhanced-NTUC-Care-Fund-Covid-19",
99                buttonText: "",
100                image: null,
101            },
102            {
103                title: "",
104                description: "",
105                url: "https://mccfl0eprmdb46dmk92-cm.managedcloud.sitecore.com/Programmes/Enhanced-NTUC-Care-Fund-Covid-19",
106                buttonText: "",
107                image: null,
108            },
109            {
110                title: "",
111                description: "",
112                url: "https://mccfl0eprmdb46dmk92-cm.managedcloud.sitecore.com/Programmes/Enhanced-NTUC-Care-Fund-Covid-19",
113                buttonText: "",
114                image: null,
115            },
116            {
117                title: "",
118                description: "",
119                url: "https://mccfl0eprmdb46dmk92-cm.managedcloud.sitecore.com/Programmes/Enhanced-NTUC-Care-Fund-Covid-19",
120                buttonText: "",
121                image: null,
122            },
123            {
124                title: "",
125                description: "",
126                url: "https://mccfl0eprmdb46dmk92-cm.managedcloud.sitecore.com/Programmes/Enhanced-NTUC-Care-Fund-Covid-19",
127                buttonText: "",
128                image: null,
129            },
130            {
131                title: "",
132                description: "",
133                url: "https://mccfl0eprmdb46dmk92-cm.managedcloud.sitecore.com/Programmes/Enhanced-NTUC-Care-Fund-Covid-19",
134                buttonText: "",
135                image: null,
136            },
137        ],
138    };
139    var dummyDataNews = {
140        total: 3,
141        type: "News",
142        "data-newstype": "306b8a6d0088496493c118102461d5ef",
143        results: [
144            {
145                title: "Union of security employees",
146                description: null,
147                url: "/News/Union of security employees/",
148                buttonText: null,
149                image:
150                    "https://alep-p-001-delivery.sitecorecontenthub.cloud/api/public/content/de16ff2e67bd4f45b83e99eb8347b881?v=3a51f05a",
151                imagetext: null,
152                custom: [
153                    { Key: "topic", Value: "Cost Of Living" },
154                    { Key: "publishedDate", Value: "15 Jan" },
155                ],
156                Id: "00000000-0000-0000-0000-000000000000",
157            },
158            {
159                title:
160                    "Singapore’s economic outlook 2022: PM Lee remains cautiously optimistic",
161                description: null,
162                url: "/News/Union of security employees/",
163                buttonText: null,
164                image:
165                    "https://alep-p-001-delivery.sitecorecontenthub.cloud/api/public/content/de16ff2e67bd4f45b83e99eb8347b881?v=3a51f05a",
166                imagetext: null,
167                custom: [
168                    { Key: "topic", Value: "Cost Of Living" },
169                    { Key: "publishedDate", Value: "16 Jan" },
170                ],
171                Id: "00000000-0000-0000-0000-000000000010",
172            },
173            {
174                title:
175                    "Labour market advance release: total employment sees substantial growth in 4Q2021",
176                description: null,
177                url: "/News/Union of security employees/",
178                buttonText: null,
179                image: "",
180                imagetext: null,
181                custom: [
182                    { Key: "topic", Value: "Cost Of Living" },
183                    { Key: "publishedDate", Value: "21 Jan" },
184                ],
185                Id: "00000000-0000-0000-0000-000000000010",
186            },
187        ],
188        Id: "d78390b3-dff8-467e-9f14-f3e316c31e9c",
189    };
190    var dummyDataCollections = {
191        total: 11,
192        type: "NewsCollection",
193        results: [
194            {
195                title: "Sri News 02",
196                description: "this is 2nd item",
197                url: "/News/Sri News 2/",
198                buttonText: null,
199                image:
200                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f1e94b4dbf084802b3be6dad05bd0bf8?v=d7132f2b",
201                imagetext: null,
202                custom: [
203                    {
204                        Key: "RelatedArticles",
205                        Value: "18",
206                    },
207                ],
208                Id: "00000000-0000-0000-0000-000000000000",
209            },
210            {
211                title: "Sri News 01",
212                description: "Supporting workers shifting careers text text",
213                url: "https://ntucsc.dev.local/News/Sri News 1/",
214                buttonText: null,
215                image:
216                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/de16ff2e67bd4f45b83e99eb8347b881?v=e2ed8f10",
217                imagetext: null,
218                custom: [
219                    {
220                        Key: "RelatedArticles",
221                        Value: "4",
222                    },
223                ],
224                Id: "00000000-0000-0000-0000-000000000000",
225            },
226            {
227                title: "Sri News 03",
228                description: "text text",
229                url: "/News/Sri News 3/",
230                buttonText: null,
231                image:
232                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f1e94b4dbf084802b3be6dad05bd0bf8?v=d7132f2b",
233                imagetext: null,
234                custom: [
235                    {
236                        Key: "RelatedArticles",
237                        Value: "4",
238                    },
239                ],
240                Id: "00000000-0000-0000-0000-000000000000",
241            },
242            {
243                title: "Sri News 02",
244                description: null,
245                url: "/News/Sri News 2/",
246                buttonText: null,
247                image:
248                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f1e94b4dbf084802b3be6dad05bd0bf8?v=d7132f2b",
249                imagetext: null,
250                custom: [
251                    {
252                        Key: "RelatedArticles",
253                        Value: "18",
254                    },
255                ],
256                Id: "00000000-0000-0000-0000-000000000000",
257            },
258            {
259                title: "Sri News 01",
260                description: "Supporting workers shifting careers text text",
261                url: "https://ntucsc.dev.local/News/Sri News 1/",
262                buttonText: null,
263                image:
264                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/de16ff2e67bd4f45b83e99eb8347b881?v=e2ed8f10",
265                imagetext: null,
266                custom: [
267                    {
268                        Key: "RelatedArticles",
269                        Value: "4",
270                    },
271                ],
272                Id: "00000000-0000-0000-0000-000000000000",
273            },
274            {
275                title: "Sri News 03",
276                description: "text text",
277                url: "/News/Sri News 3/",
278                buttonText: null,
279                image:
280                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f1e94b4dbf084802b3be6dad05bd0bf8?v=d7132f2b",
281                imagetext: null,
282                custom: [
283                    {
284                        Key: "RelatedArticles",
285                        Value: "4",
286                    },
287                ],
288                Id: "00000000-0000-0000-0000-000000000000",
289            },
290            {
291                title: "Sri News 02",
292                description: null,
293                url: "/News/Sri News 2/",
294                buttonText: null,
295                image:
296                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f1e94b4dbf084802b3be6dad05bd0bf8?v=d7132f2b",
297                imagetext: null,
298                custom: [
299                    {
300                        Key: "RelatedArticles",
301                        Value: "18",
302                    },
303                ],
304                Id: "00000000-0000-0000-0000-000000000000",
305            },
306            {
307                title: "Sri News 01",
308                description: "Supporting workers shifting careers text text",
309                url: "https://ntucsc.dev.local/News/Sri News 1/",
310                buttonText: null,
311                image:
312                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/de16ff2e67bd4f45b83e99eb8347b881?v=e2ed8f10",
313                imagetext: null,
314                custom: [
315                    {
316                        Key: "RelatedArticles",
317                        Value: "4",
318                    },
319                ],
320                Id: "00000000-0000-0000-0000-000000000000",
321            },
322            {
323                title: "Sri News 04",
324                description: "abc",
325                url: "/News/Sri News 4/",
326                buttonText: null,
327                image:
328                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f1e94b4dbf084802b3be6dad05bd0bf8?v=d7132f2b",
329                imagetext: null,
330                custom: [
331                    {
332                        Key: "RelatedArticles",
333                        Value: "4",
334                    },
335                ],
336                Id: "00000000-0000-0000-0000-000000000000",
337            },
338            {
339                title:
340                    "Union of security employees: give security officers the respect and dignity they deserve.",
341                description: "text text",
342                url: "https://ntucsc.dev.local/News/Union of security employees/",
343                buttonText: null,
344                image:
345                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f1e94b4dbf084802b3be6dad05bd0bf8?v=d7132f2b",
346                imagetext: null,
347                custom: [
348                    {
349                        Key: "RelatedArticles",
350                        Value: "14",
351                    },
352                ],
353                Id: "00000000-0000-0000-0000-000000000000",
354            },
355            {
356                title: "Sri News 06",
357                description: "Supporting workers shifting careers",
358                url: "https://ntucsc.dev.local/News/Sri News 6/",
359                buttonText: null,
360                image:
361                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f1e94b4dbf084802b3be6dad05bd0bf8?v=d7132f2b",
362                imagetext: null,
363                custom: [
364                    {
365                        Key: "RelatedArticles",
366                        Value: "10",
367                    },
368                ],
369                Id: "00000000-0000-0000-0000-000000000000",
370            },
371        ],
372        PinnedArticle: {
373            title: "Sri News 03 Banner",
374            description: "text text banner banner",
375            url: "/News/Sri News 3/",
376            buttonText: null,
377            image:
378                "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f1e94b4dbf084802b3be6dad05bd0bf8?v=d7132f2b",
379            imagetext: null,
380            custom: [
381                {
382                    Key: "RelatedArticles",
383                    Value: "4",
384                },
385            ],
386            Id: "00000000-0000-0000-0000-000000000000",
387        },
388        Id: "4c206feb-a483-4c5a-bba3-580fcb5607a2",
389    };
390    var dummyDataRelevantArticlesForCollection = {
391        total: 2,
392        type: "RelevantArticlesForCollection",
393        results: [
394            {
395                title: "Sri News 09",
396                description: null,
397                url: "https://dev.aleph-labs.com/clients/ntuc-portal/templates/collection-articles.html",
398                buttonText: null,
399                image:
400                    "https://dev.aleph-labs.com/clients/ntuc-portal/assets/images/upload/news-small2.png",
401                alttext: null,
402                isPinned: false,
403                custom: [
404                    {
405                        Key: "topic",
406                        Value: "Protect your work right",
407                    },
408                    {
409                        Key: "publishedDate",
410                        Value: "08 Jul",
411                    },
412                ],
413                Id: "00000000-0000-0000-0000-000000000000",
414            },
415            {
416                title: "Sri News 07",
417                description: null,
418                url: "/News/Sri News 7/?isSerp=true",
419                buttonText: null,
420                image: "",
421                alttext: null,
422                isPinned: false,
423                custom: [
424                    {
425                        Key: "topic",
426                        Value: "Protect your work right",
427                    },
428                    {
429                        Key: "publishedDate",
430                        Value: "22 Dec 2021",
431                    },
432                ],
433                Id: "00000000-0000-0000-0000-000000000000",
434            },
435        ],
436        PinnedArticle: null,
437        Id: "092c0ea2-6816-44fb-8928-b1f0ea7eee5c",
438    };
439    var dummyDataPublications = {
440        total: 10,
441        type: "Publications",
442        results: [
443            {
444                title: "Sri News 03",
445                description: "Non-corporate, Protect your work rights, All audience",
446                url: "https://ntucsc.dev.local/News/Sri News 3/",
447                buttonText: null,
448                image: null,
449                imagetext: null,
450                isPinned: true,
451                custom: [
452                    {
453                        Key: "Publication",
454                        Value: "Books",
455                    },
456                    {
457                        Key: "publishedDate",
458                        Value: "10 Jun",
459                    },
460                ],
461                Id: "00000000-0000-0000-0000-000000000000",
462            },
463            {
464                title: "Sri News 02",
465                description:
466                    "Non-corporate news. Protect your work rights. FSE and young workers.",
467                url: "https://ntucsc.dev.local/News/Sri News 2/",
468                buttonText: null,
469                image:
470                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f1e94b4dbf084802b3be6dad05bd0bf8?v=d7132f2b",
471                imagetext: null,
472                isPinned: true,
473                custom: [
474                    {
475                        Key: "Publication",
476                        Value: "Citation",
477                    },
478                    {
479                        Key: "publishedDate",
480                        Value: "09 Jun",
481                    },
482                ],
483                Id: "00000000-0000-0000-0000-000000000000",
484            },
485            {
486                title: "Sri News 01",
487                description:
488                    "This is Sri News card description. æ— åŒ -  摩登兄弟刘宇宁  电视剧《且试天下》主题曲. Let us see how this will be displayed. Updated.",
489                url: "/News/Sri News 1/",
490                buttonText: null,
491                image:
492                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/de16ff2e67bd4f45b83e99eb8347b881?v=e2ed8f10",
493                imagetext: null,
494                isPinned: false,
495                custom: [
496                    {
497                        Key: "Publication",
498                        Value: "Citation",
499                    },
500                    {
501                        Key: "publishedDate",
502                        Value: "13 May",
503                    },
504                ],
505                Id: "00000000-0000-0000-0000-000000000000",
506            },
507            {
508                title: "Sri News 05",
509                description:
510                    "Non-corporate, Workplace safety and health, Migrant and lower-wage workers",
511                url: "/News/Sri News 5/",
512                buttonText: null,
513                image: "-/media/Default-Website/cover.jpg",
514                imagetext: null,
515                isPinned: true,
516                custom: [
517                    {
518                        Key: "Publication",
519                        Value: "Citation",
520                    },
521                    {
522                        Key: "publishedDate",
523                        Value: "06 May",
524                    },
525                ],
526                Id: "00000000-0000-0000-0000-000000000000",
527            },
528            {
529                title: "Sri News 04",
530                description: "Corporate, Training, Partners and SME",
531                url: "https://ntucsc.dev.local/News/Sri News 4/",
532                buttonText: null,
533                image: null,
534                imagetext: null,
535                isPinned: true,
536                custom: [
537                    {
538                        Key: "Publication",
539                        Value: "Books",
540                    },
541                    {
542                        Key: "publishedDate",
543                        Value: "01 May",
544                    },
545                ],
546                Id: "00000000-0000-0000-0000-000000000000",
547            },
548            {
549                title: "Sri News 07",
550                description: "Non-corporate, Protect your work rights, All audience",
551                url: "https://ntucsc.dev.local/News/Sri News 8/",
552                buttonText: null,
553                image: "-/media/System/Email/SampleNewsletter/lion.png",
554                imagetext: null,
555                isPinned: false,
556                custom: [
557                    {
558                        Key: "Publication",
559                        Value: "",
560                    },
561                    {
562                        Key: "publishedDate",
563                        Value: "14 Feb",
564                    },
565                ],
566                Id: "00000000-0000-0000-0000-000000000000",
567            },
568            {
569                title:
570                    "Union of security employees: give security officers the respect and dignity they deserve.",
571                description:
572                    "\n              The public must accord security officers with respect and dignity while they carry out their duties, urged\n              Union of Security Employees (USE) General Secretary Raymond Chin.\n            \n            ",
573                url: "/News/Union of security employees/",
574                buttonText: null,
575                image: "-/media/Images/article.png",
576                imagetext: null,
577                isPinned: false,
578                custom: [
579                    {
580                        Key: "Publication",
581                        Value: "NTUC This Week",
582                    },
583                    {
584                        Key: "publishedDate",
585                        Value: "16 Jan",
586                    },
587                ],
588                Id: "00000000-0000-0000-0000-000000000000",
589            },
590            {
591                title: "Sri News 07",
592                description: "Non-corporate, Protect your work rights, All audience",
593                url: "https://ntucsc.dev.local/News/Sri News 7/",
594                buttonText: null,
595                image: "-/media/Feature/AboutUS/Our-Centres/NTUC-map-photo-1.png",
596                imagetext: null,
597                isPinned: false,
598                custom: [
599                    {
600                        Key: "Publication",
601                        Value: "",
602                    },
603                    {
604                        Key: "publishedDate",
605                        Value: "22 Dec 2021",
606                    },
607                ],
608                Id: "00000000-0000-0000-0000-000000000000",
609            },
610            {
611                title: "Sri News 06",
612                description: "Non-corporate. Cost of living. Partners and SMEs",
613                url: "/News/Sri News 6/",
614                buttonText: null,
615                image: "-/media/Feature/News/collection-visual-banner.png",
616                imagetext: null,
617                isPinned: true,
618                custom: [
619                    {
620                        Key: "Publication",
621                        Value: "NTUC This Week",
622                    },
623                    {
624                        Key: "publishedDate",
625                        Value: "03 Nov 2021",
626                    },
627                ],
628                Id: "00000000-0000-0000-0000-000000000000",
629            },
630            {
631                title: null,
632                description: null,
633                url: null,
634                buttonText: null,
635                image: null,
636                imagetext: null,
637                isPinned: false,
638                custom: [
639                    {
640                        Key: "Publication",
641                        Value: "",
642                    },
643                    {
644                        Key: "publishedDate",
645                        Value: "01 Jan 0001",
646                    },
647                ],
648                Id: "00000000-0000-0000-0000-000000000000",
649            },
650        ],
651        PinnedArticle: null,
652        Id: "a1e26a44-4001-4ece-bff4-914c653e97b1",
653    };
654    var dummyDataMediaGallery = {
655        total: 5,
656        type: "MediaGallery",
657        results: [
658            {
659                title: "Gallery 1",
660                description: null,
661                url: "/uportal/gallery/gallery-1",
662                buttonText: null,
663                image:
664                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/3e2ebfbe87f748aba3eb68fd95ca6a61?v=830704c3",
665                imagetext: null,
666                isPinned: false,
667                custom: [
668                    {
669                        Key: "photos",
670                        Value: 4,
671                    },
672                    {
673                        Key: "videos",
674                        Value: 0,
675                    },
676                    {
677                        Key: "ExternalLinkUrl",
678                        Value: "",
679                    },
680                    {
681                        Key: "ExternalLinkTarget",
682                        Value: "",
683                    },
684                ],
685                Id: "2c747775-5257-4f66-8b6b-0289e237051f",
686            },
687            {
688                title: "Gallery 3",
689                description: null,
690                url: "/uportal/gallery/gallery-3",
691                buttonText: null,
692                image:
693                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/e8a15efb5c3e49cf946633cb9d99edd4?v=9ad2ecf0",
694                imagetext: null,
695                isPinned: false,
696                custom: [
697                    {
698                        Key: "photos",
699                        Value: 21,
700                    },
701                    {
702                        Key: "videos",
703                        Value: 1,
704                    },
705                    {
706                        Key: "ExternalLinkUrl",
707                        Value: "",
708                    },
709                    {
710                        Key: "ExternalLinkTarget",
711                        Value: "",
712                    },
713                ],
714                Id: "71eaa6e0-ffff-4d3f-bd70-7fcb0cb59362",
715            },
716            {
717                title: "Gallery 4",
718                description: null,
719                url: "/uportal/gallery/gallery-4",
720                buttonText: null,
721                image:
722                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/17a996c002bf4512b990775866c1f22f?v=ee2b25a2",
723                imagetext: null,
724                isPinned: false,
725                custom: [
726                    {
727                        Key: "photos",
728                        Value: 11,
729                    },
730                    {
731                        Key: "videos",
732                        Value: 1,
733                    },
734                    {
735                        Key: "ExternalLinkUrl",
736                        Value: "http://www.google.com",
737                    },
738                    {
739                        Key: "ExternalLinkTarget",
740                        Value: "_blank",
741                    },
742                ],
743                Id: "3708f2c4-cee6-4bdd-a374-888906f279cc",
744            },
745            {
746                title: "Gallery 2",
747                description: null,
748                url: "/uportal/gallery/gallery-2",
749                buttonText: null,
750                image: "-/media/images/banner-2.ashx",
751                imagetext: null,
752                isPinned: false,
753                custom: [
754                    {
755                        Key: "photos",
756                        Value: 7,
757                    },
758                    {
759                        Key: "videos",
760                        Value: 1,
761                    },
762                    {
763                        Key: "ExternalLinkUrl",
764                        Value: "",
765                    },
766                    {
767                        Key: "ExternalLinkTarget",
768                        Value: "",
769                    },
770                ],
771                Id: "d7b89755-7bc7-4e37-8fe9-ff9236ac91b8",
772            },
773            {
774                title: "Gallery Page",
775                description: null,
776                url: "/uportal/gallery/gallery-page",
777                buttonText: null,
778                image: "-/media/images/banner-2.ashx",
779                imagetext: null,
780                isPinned: false,
781                custom: [
782                    {
783                        Key: "photos",
784                        Value: 7,
785                    },
786                    {
787                        Key: "videos",
788                        Value: 1,
789                    },
790                    {
791                        Key: "ExternalLinkUrl",
792                        Value: "/uportal/",
793                    },
794                    {
795                        Key: "ExternalLinkTarget",
796                        Value: "_blank",
797                    },
798                ],
799                Id: "b40db9bf-7d94-4d8f-a5f4-434cbf93874d",
800            },
801        ],
802        PinnedArticle: null,
803        Id: "f3f3b81f-ef68-4150-a1e5-2b5d67d6fdd7",
804    };
805    var dummyDataSingleGallery = {
806        total: 3,
807        type: "SingleGallery",
808        results: [
809            {
810                title: "The entity definition for this entity",
811                description: null,
812                url: "https://akns-images.eonline.com/eol_images/Entire_Site/20171018/rs_634x1024-171118132453-1024-2017-miss-world-miss-china.jpg?fit=around%7C634:1024&output-quality=90&crop=634:1024;center,top",
813                buttonText: null,
814                image: null,
815                alttext: null,
816                isPinned: false,
817                custom: [
818                    {
819                        Key: "IsVideo",
820                        Value: false,
821                    },
822                    {
823                        Key: "VideoLink",
824                        Value: "",
825                    },
826                ],
827                Id: "00000000-0000-0000-0000-000000000000",
828            },
829            {
830                title: "The entity definition for this entity",
831                description: null,
832                url: "https://www.gardendesign.com/pictures/images/675x529Max/site_3/helianthus-yellow-flower-pixabay_11863.jpg",
833                buttonText: null,
834                image: null,
835                alttext: null,
836                isPinned: false,
837                custom: [
838                    {
839                        Key: "IsVideo",
840                        Value: false,
841                    },
842                    {
843                        Key: "VideoLink",
844                        Value: "",
845                    },
846                ],
847                Id: "00000000-0000-0000-0000-000000000000",
848            },
849            {
850                title: "The entity definition for this entity",
851                description: null,
852                url: null,
853                buttonText: null,
854                image: null,
855                alttext: null,
856                isPinned: false,
857                custom: [
858                    {
859                        Key: "IsVideo",
860                        Value: true,
861                    },
862                    {
863                        Key: "VideoLink",
864                        Value:
865                            "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/8c2b77234c474f5993d4f024c543cb4d?v=5f7394f9",
866                    },
867                ],
868                Id: "00000000-0000-0000-0000-000000000000",
869            },
870            {
871                title: "The entity definition for this entity",
872                description: null,
873                url: "https://r4.wallpaperflare.com/wallpaper/800/61/157/actors-keanu-reeves-wallpaper-thumb.jpg",
874                buttonText: null,
875                image: null,
876                alttext: null,
877                isPinned: false,
878                custom: [
879                    {
880                        Key: "IsVideo",
881                        Value: true,
882                    },
883                    {
884                        Key: "VideoLink",
885                        Value: "https://www.youtube.com/embed/yjRHZEUamCc",
886                    },
887                ],
888                Id: "00000000-0000-0000-0000-000000000000",
889            },
890        ],
891        PinnedArticle: null,
892        Id: "0d2b3544-8724-470b-aebc-2cae767b1b79",
893    };
894    var dummyDataMediaMaterial = {
895        total: 6,
896        type: "MediaMaterial",
897        results: [
898            {
899                title: "Non-corporate, Protect your work rights, All audience",
900                description: "Non-corporate, Protect your work rights, All audience",
901                url: "https://ntucsc.dev.local/News/Sri News 3/",
902                buttonText: null,
903                image: null,
904                alttext: null,
905                isPinned: true,
906                custom: [
907                    {
908                        Key: "Publication",
909                        Value: "Books",
910                    },
911                    {
912                        Key: "publishedDate",
913                        Value: "10 Jun",
914                    },
915                ],
916                Id: "00000000-0000-0000-0000-000000000000",
917            },
918            {
919                title: "Sri News 02",
920                description:
921                    "Non-corporate news. Protect your work rights. FSE and young workers.",
922                url: "https://ntucsc.dev.local/News/Sri News 2/",
923                buttonText: null,
924                image:
925                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f1e94b4dbf084802b3be6dad05bd0bf8?v=d7132f2b",
926                alttext: null,
927                isPinned: true,
928                custom: [
929                    {
930                        Key: "Publication",
931                        Value: "Citation",
932                    },
933                    {
934                        Key: "publishedDate",
935                        Value: "09 Jun",
936                    },
937                ],
938                Id: "00000000-0000-0000-0000-000000000000",
939            },
940            {
941                title: "Sri News 04",
942                description: "Corporate, Training, Partners and SME",
943                url: "https://ntucsc.dev.local/News/Sri News 4/",
944                buttonText: null,
945                image: null,
946                alttext: null,
947                isPinned: true,
948                custom: [
949                    {
950                        Key: "Publication",
951                        Value: "Books",
952                    },
953                    {
954                        Key: "publishedDate",
955                        Value: "01 May",
956                    },
957                ],
958                Id: "00000000-0000-0000-0000-000000000000",
959            },
960            {
961                title: "Sri News 07",
962                description: "Non-corporate, Protect your work rights, All audience",
963                url: "https://ntucsc.dev.local/News/Sri News 8/",
964                buttonText: null,
965                image: "-/media/System/Email/SampleNewsletter/lion.png",
966                alttext: null,
967                isPinned: false,
968                custom: [
969                    {
970                        Key: "Publication",
971                        Value: "",
972                    },
973                    {
974                        Key: "publishedDate",
975                        Value: "14 Feb",
976                    },
977                ],
978                Id: "00000000-0000-0000-0000-000000000000",
979            },
980            {
981                title: "Sri News 07",
982                description: "Non-corporate, Protect your work rights, All audience",
983                url: "/News/Sri News 7/",
984                buttonText: null,
985                image: "-/media/Feature/AboutUS/Our-Centres/NTUC-map-photo-1.png",
986                alttext: null,
987                isPinned: false,
988                custom: [
989                    {
990                        Key: "Publication",
991                        Value: "",
992                    },
993                    {
994                        Key: "publishedDate",
995                        Value: "22 Dec 2021",
996                    },
997                ],
998                Id: "00000000-0000-0000-0000-000000000000",
999            },
1000            {
1001                title: "Sri News 06",
1002                description: "Non-corporate. Cost of living. Partners and SMEs",
1003                url: "/News/Sri News 6/",
1004                buttonText: null,
1005                image: "-/media/Feature/News/collection-visual-banner.png",
1006                alttext: null,
1007                isPinned: true,
1008                custom: [
1009                    {
1010                        Key: "Publication",
1011                        Value: "NTUC This Week",
1012                    },
1013                    {
1014                        Key: "publishedDate",
1015                        Value: "03 Nov 2021",
1016                    },
1017                ],
1018                Id: "00000000-0000-0000-0000-000000000000",
1019            },
1020        ],
1021        PinnedArticle: null,
1022        Id: "4b96addb-d60f-42db-87ad-6ae2cbc4e61d",
1023    };
1024    var dummyDataVideo = {
1025        total: 7,
1026        type: "Videos",
1027        results: [
1028            {
1029                Title: "Video title Test1",
1030                Description: "Hi",
1031                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1032                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1033                PublishedDate: "30 Jun",
1034                TemplateName: "VideoPage",
1035                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1036            },
1037            {
1038                Title: "Video title Test1",
1039                Description: "Hi",
1040                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1041                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1042                PublishedDate: "30 Jun",
1043                TemplateName: "VideoPage",
1044                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1045            },
1046            {
1047                Title: "Video title Test1",
1048                Description: "Hi",
1049                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1050                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1051                PublishedDate: "30 Jun",
1052                TemplateName: "VideoPage",
1053                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1054            },
1055            {
1056                Title: "Video title Test1",
1057                Description: "Hi",
1058                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1059                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1060                PublishedDate: "30 Jun",
1061                TemplateName: "VideoPage",
1062                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1063            },
1064            {
1065                Title: "Video title Test1 Video title Test1 ",
1066                Description: "Hi",
1067                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1068                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1069                PublishedDate: "30 Jun",
1070                TemplateName: "VideoPage",
1071                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1072            },
1073            {
1074                Title: "Video title Test1",
1075                Description: "Hi",
1076                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1077                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1078                PublishedDate: "30 Jun",
1079                TemplateName: "VideoPage",
1080                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1081            },
1082            {
1083                Title: "Video title Test1",
1084                Description: "Hi",
1085                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1086                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1087                PublishedDate: "30 Jun",
1088                TemplateName: "VideoPage",
1089                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1090            },
1091        ],
1092        Id: "2D3B2AA1-C5C8-477C-A1B6-F83A3F3045E8",
1093    };
1094    var dummyDataBlogs = {
1095        total: 1,
1096        type: "Blogs",
1097        results: [
1098            {
1099                Title: "Test1",
1100                Description: "Hi",
1101                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1102                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1103                PublishedDate: "30 Jun",
1104                TemplateName: "OurBlog",
1105                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1106            },
1107        ],
1108        Id: "2D3B2AA1-C5C8-477C-A1B6-F83A3F3045E8",
1109    };
1110    var dummyDataGuides = {
1111        total: 15,
1112        type: "Guides",
1113        results: [
1114            {
1115                Title: "Test Video 1",
1116                Description: "Hi",
1117                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1118                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1119                PublishedDate: "30 Jun",
1120                TemplateName: "VideoPage",
1121                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1122            },
1123            {
1124                Title: "Test Blog 2",
1125                Description: "Hi",
1126                Image: null,
1127                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1128                PublishedDate: "30 Jun",
1129                TemplateName: "OurBlog",
1130                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1131            },
1132            {
1133                Title: "Test Video 3",
1134                Description: "Hi",
1135                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1136                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1137                PublishedDate: "30 Jun",
1138                TemplateName: "VideoPage",
1139                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1140            },
1141            {
1142                Title: "Test Video 4",
1143                Description: "Hi",
1144                Image: null,
1145                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1146                PublishedDate: "30 Jun",
1147                TemplateName: "VideoPage",
1148                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1149            },
1150            {
1151                Title: "Test Blog 5",
1152                Description: "Hi",
1153                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1154                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1155                PublishedDate: "30 Jun",
1156                TemplateName: "OurBlog",
1157                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1158            },
1159            {
1160                Title: "Test Video 1",
1161                Description: "Hi",
1162                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1163                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1164                PublishedDate: "30 Jun",
1165                TemplateName: "VideoPage",
1166                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1167            },
1168            {
1169                Title: "Test Blog 2",
1170                Description: "Hi",
1171                Image: null,
1172                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1173                PublishedDate: "30 Jun",
1174                TemplateName: "OurBlog",
1175                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1176            },
1177            {
1178                Title: "Test Video 3",
1179                Description: "Hi",
1180                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1181                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1182                PublishedDate: "30 Jun",
1183                TemplateName: "VideoPage",
1184                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1185            },
1186            {
1187                Title: "Test Video 4",
1188                Description: "Hi",
1189                Image: null,
1190                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1191                PublishedDate: "30 Jun",
1192                TemplateName: "VideoPage",
1193                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1194            },
1195            {
1196                Title: "Test Blog 5",
1197                Description: "Hi",
1198                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1199                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1200                PublishedDate: "30 Jun",
1201                TemplateName: "OurBlog",
1202                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1203            },
1204            {
1205                Title: "Test Video 1",
1206                Description: "Hi",
1207                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1208                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1209                PublishedDate: "30 Jun",
1210                TemplateName: "VideoPage",
1211                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1212            },
1213            {
1214                Title: "Test Blog 2",
1215                Description: "Hi",
1216                Image: null,
1217                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1218                PublishedDate: "30 Jun",
1219                TemplateName: "OurBlog",
1220                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1221            },
1222            {
1223                Title: "Test Video 3",
1224                Description: "Hi",
1225                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1226                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1227                PublishedDate: "30 Jun",
1228                TemplateName: "VideoPage",
1229                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1230            },
1231            {
1232                Title: "Test Video 4",
1233                Description: "Hi",
1234                Image: null,
1235                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1236                PublishedDate: "30 Jun",
1237                TemplateName: "VideoPage",
1238                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1239            },
1240            {
1241                Title: "Test Blog 5",
1242                Description: "Hi",
1243                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1244                Url: "https://xp1011adminsc.dev.local/Membership/Resources-for-members/Test1/",
1245                PublishedDate: "30 Jun",
1246                TemplateName: "OurBlog",
1247                Id: "18dce17e-5f5c-4cc7-b553-95d85a861e57",
1248            },
1249        ],
1250        Id: "2D3B2AA1-C5C8-477C-A1B6-F83A3F3045E8",
1251    };
1252    var dummyDataReports = {
1253        total: 4,
1254        type: "Reports",
1255        results: [
1256            {
1257                title: "Workers in transition",
1258                description:
1259                    "A one-stop source for information on labour provisions in more than 100 regional trade agreements in over 140 economies.",
1260                url: null,
1261                buttonText: null,
1262                image:
1263                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/58230cb66c7b4306aaabaff7d2e4982f?v=251b9ed2",
1264                alttext: null,
1265                custom: [
1266                    {
1267                        Key: "Infographics",
1268                        Value: 0,
1269                    },
1270                ],
1271                Id: "4da43b3e-ffcd-4889-931c-df9fa51056de",
1272            },
1273            {
1274                title: "Upskilling of mature workers",
1275                description:
1276                    "A one-stop source for information on labour provisions in more than 100 regional trade agreements in over 140 economies.",
1277                url: null,
1278                buttonText: null,
1279                image:
1280                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/58230cb66c7b4306aaabaff7d2e4982f?v=251b9ed2",
1281                alttext: null,
1282                custom: [
1283                    {
1284                        Key: "Infographic",
1285                        Value: 1,
1286                    },
1287                ],
1288                Id: "0a64abfe-ee26-4157-bb05-e5861ab28d93",
1289            },
1290            {
1291                title: "Upskilling of mature worker 2",
1292                description:
1293                    "A one-stop source for information on labour provisions in more than 100 regional trade agreements in over 140 economies.",
1294                url: null,
1295                buttonText: null,
1296                image:
1297                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/31a7942165854e19bf2ddee34d01eb95?v=688bff99",
1298                alttext: null,
1299                custom: [
1300                    {
1301                        Key: "Infographics",
1302                        Value: 4,
1303                    },
1304                ],
1305                Id: "5996fea0-86f5-47c1-ac36-681f18f7b0ac",
1306            },
1307            {
1308                title: "Upskilling of mature workers 3",
1309                description:
1310                    "A one-stop source for information on labour provisions in more than 100 regional trade agreements in over 140 economies.",
1311                url: null,
1312                buttonText: null,
1313                image:
1314                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/58230cb66c7b4306aaabaff7d2e4982f?v=251b9ed2",
1315                alttext: null,
1316                custom: [
1317                    {
1318                        Key: "Infographics",
1319                        Value: 4,
1320                    },
1321                ],
1322                Id: "5fe8f672-dfba-4491-814a-e2022f03261f",
1323            },
1324        ],
1325        Id: "94617575-a412-4a45-9c6f-12909e73fd8f",
1326    };
1327    var dummyDataJournals = {
1328        total: 4,
1329        type: "Journals",
1330        results: [
1331            {
1332                title: "Singapore Labour Journal1",
1333                description:
1334                    "A one-stop source for information on labour provisions in more than 100 regional trade agreements in over 140 economies.",
1335                url: null,
1336                buttonText: null,
1337                image:
1338                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f0485a7ebe3d44b6b42f1c22298b38b8?v=3e525ecb",
1339                alttext: null,
1340                custom: [
1341                    {
1342                        Key: "JournalDocumentSize",
1343                        Value: "127 KB|IMAGE",
1344                    },
1345                    {
1346                        Key: "JournalDocument",
1347                        Value:
1348                            "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/ae59fb9612b74f098009180b688271a4?v=d089a954&download=true",
1349                    },
1350                ],
1351                Id: "9f49e07e-771f-4fa6-99d3-e7732f866d1a",
1352            },
1353            {
1354                title: "Singapore Labour Journal2",
1355                description:
1356                    "A one-stop source for information on labour provisions in more than 100 regi
1356onal trade agreements in over 140 economies.",
1357                url: null,
1358                buttonText: null,
1359                image:
1360                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f0485a7ebe3d44b6b42f1c22298b38b8?v=3e525ecb",
1361                alttext: null,
1362                custom: [
1363                    {
1364                        Key: "JournalDocumentSize",
1365                        Value: "127 KB|PDF",
1366                    },
1367                    {
1368                        Key: "JournalDocument",
1369                        Value:
1370                            "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/ae59fb9612b74f098009180b688271a4?v=d089a954&download=true",
1371                    },
1372                ],
1373                Id: "c36fa51d-97cd-41cb-aa02-290a06a738d2",
1374            },
1375            {
1376                title: "Singapore Labour Journal3",
1377                description:
1378                    "A one-stop source for information on labour provisions in more than 100 regional trade agreements in over 140 economies.",
1379                url: null,
1380                buttonText: null,
1381                image:
1382                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/f0485a7ebe3d44b6b42f1c22298b38b8?v=3e525ecb",
1383                alttext: null,
1384                custom: [
1385                    {
1386                        Key: "JournalDocumentSize",
1387                        Value: "127 KB|PDF",
1388                    },
1389                    {
1390                        Key: "JournalDocument",
1391                        Value:
1392                            "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/ae59fb9612b74f098009180b688271a4?v=d089a954&download=true",
1393                    },
1394                ],
1395                Id: "c1cf4f5f-dbd5-4a5e-b957-6354791880ee",
1396            },
1397            {
1398                title: "Singapore Labour Journal",
1399                description:
1400                    "A one-stop source for information on labour provisions in more than 100 regional trade agreements in over 140 economies.",
1401                url: null,
1402                buttonText: null,
1403                image:
1404                    "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/3953b54a7b824089a1becfadcd63e9bb?v=2565c262",
1405                alttext: null,
1406                custom: [
1407                    {
1408                        Key: "JournalDocumentSize",
1409                        Value: "3 MB|IMAGE",
1410                    },
1411                    {
1412                        Key: "JournalDocument",
1413                        Value:
1414                            "https://alep-p-001.sitecorecontenthub.cloud/api/public/content/38316f5930714e6cbcb8c5d76502f43d?v=02b073e6&download=true",
1415                    },
1416                ],
1417                Id: "90124730-6185-4f28-9f6e-0398361de370",
1418            },
1419        ],
1420        Id: "8da7eaed-00d1-4953-82cc-15e9694e9bf5",
1421    };
1422    var dummyDataStoris = {
1423        total: 4,
1424        type: "Stories",
1425        results: [
1426            {
1427                Title: "OurStory ArticlePage1",
1428                Description:
1429                    "In 1855, the jeweller Joseph Resch, who had arrived from Vienna in 1837, had a house built in the heart of Bucharest.",
1430                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1431                Url: "http://127.0.0.1/All-Stories/OurStory/2022/07/27/03/36/OurStory-ArticlePage1",
1432                PublishedDate: "27 Jul",
1433                TemplateName: "OurStory",
1434                Id: "d836b51f-b624-46f4-8c70-5d9aa6fbbd7f",
1435            },
1436            {
1437                Title: "OurStory VideoPage1",
1438                Description: "Welcome to NTUC OurStory VideoPage",
1439                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1440                Url: "/All-Stories/OurStory-VideoPage/2022/07/26/03/48/OurStory-VideoPage1",
1441                PublishedDate: "26 Jul",
1442                TemplateName: "OurStory VideoPage",
1443                Id: "822783fd-b497-444a-b4c3-35b963bb6baa",
1444            },
1445            {
1446                Title: "OurStory ArticlePage1",
1447                Description:
1448                    "In 1855, the jeweller Joseph Resch, who had arrived from Vienna in 1837, had a house built in the heart of Bucharest.",
1449                Image: "",
1450                Url: "http://127.0.0.1/All-Stories/OurStory/2022/07/27/03/36/OurStory-ArticlePage1",
1451                PublishedDate: "27 Jul",
1452                TemplateName: "OurStory",
1453                Id: "d836b51f-b624-46f4-8c70-5d9aa6fbbd7f",
1454            },
1455            {
1456                Title: "OurStory VideoPage1",
1457                Description: "Welcome to NTUC OurStory VideoPage",
1458                Image: "https://i.ytimg.com/vi/cqVJW5c-rmI/hqdefault.jpg",
1459                Url: "/All-Stories/OurStory-VideoPage/2022/07/26/03/48/OurStory-VideoPage1",
1460                PublishedDate: "26 Jul",
1461                TemplateName: "OurStory VideoPage",
1462                Id: "822783fd-b497-444a-b4c3-35b963bb6baa",
1463            },
1464        ],
1465    };
1466    var dummyDataDeals = {
1467        total: 2,
1468        type: "Deals",
1469        results: [
1470            {
1471                Title: "Our Music",
1472                Description: "$5 off per pax on the standard price",
1473                Image: "-/media/Images/article.png",
1474                PromotionImage: "-/media/Images/article.png",
1475                PromotionMessage: "Redeem a free yoga mat",
1476                Url: "/Membership/Deals-for-members/Our Music/",
1477                CreatedDate: null,
1478                TemplateName: "Deals Page",
1479                Category: ["Health & Wellness", "NTUC Social Enterprises"],
1480                Labels: [
1481                    {
1482                        Text: "Popular this month",
1483                        Style: "teal",
1484                    },
1485                    {
1486                        Text: "Expiring soon!",
1487                        Style: "pink",
1488                    },
1489                ],
1490
1491                Id: "230208c9-262c-42e6-8d8e-ed7a305585ce",
1492            },
1493            {
1494                Title: "Trapped escape room",
1495                Description: "$5 off per pax on the standard price",
1496                Image: "-/media/Images/article.png",
1497                PromotionImage: "-/media/Images/article.png",
1498                PromotionMessage: "",
1499                Url: "/Membership/Deals-for-members/Our Music Studio/",
1500                CreatedDate: null,
1501                TemplateName: "Deals Page",
1502                Category: ["Hotel & Travel"],
1503                Label: [
1504                    {
1505                        Text: "Popular this month",
1506                        Style: "teal",
1507                    },
1508                ],
1509
1510                Id: "230208c9-262c-42e6-8d8e-ed7a305585ce",
1511            },
1512        ],
1513        Id: "9823D93F-5C02-4E42-BC13-FE292C00E6FD",
1514    };
1515
1516    // Render cards
1517    var renderCards = (records, pageType, page) => {
1518        if (pageType == "Professionals") {
1519            $("#list-section .row").html("");
1520            const filterSection = document.getElementById("showInstitute");
1521            // Get the value of the data attribute
1522            const showInstitute = filterSection.getAttribute("data");
1523
1524            for (var i = 0; i < records.results.length; i++) {
1525                var expertiseArray = records.results[i].experties.split("|");
1526
1527                var expertiseHTML = "";
1528                if (!records.results[i].experties.length == 0) {
1529                    for (var j = 0; j < expertiseArray.length; j++) {
1530                        expertiseHTML +=
1531                            "<div class='rounded-tag'><p class='tag-label'>" +
1532                            expertiseArray[j] +
1533                            "</p></div>";
1534                    }
1535                }
1536                var rate = records.results[i].rate;
1537                var rateStr = "";
1538                if (rate === null || rate === "" || rate === "0") {
1539                    rateStr = "Contact professional";
1540                } else {
1541                    rateStr = records.results[i].rate;
1542                }
1543                var accreditationHTML = "";
1544                var accreditationTxt = records.results[i].accreditation.trim();
1545                if (accreditationTxt.length !== 0) {
1546                    accreditationHTML = "<div class='certified-tag'> <i class='ri-medal-line certified-icon'></i><p class='certified-label'>" + accreditationTxt + "</p></div>";
1547                }
1548
1549                if (showInstitute === "true") {
1550                    var bottomDiv = "";
1551                    if (records.results[i].institution != "") {
1552                        bottomDiv =
1553                            "<div class='bottom'>" +
1554                            "<div class='stats' style='width: max-content;'><p class='bottom-title'>" +
1555                            "Institution" +
1556                            "</p><p class='bottom-description'>" +
1557                            records.results[i].institution +
1558                            "</p></div>" +
1559                            "<div class='stats' style='width: max-content;'></div></div></div></div></a></div>";
1560                    }
1561
1562                    var div =
1563                        "<div class='col-sm-6'><a href='" +
1564                        records.results[i].url +
1565                        "' class='professional-card-link'>" +
1566                        "<div class='professional-card'> <div class='image-container'> <img src='" +
1567                        records.results[i].profilephoto +
1568                        "' height='233' width='100%' class='image-fit'/>" +
1569                        accreditationHTML +
1570                        "</div><div class='content-container'><div class='upper'><div class='tag-container'>" +
1571                        expertiseHTML +
1572                        "</div> <p class='title'>" +
1573                        records.results[i].name +
1574                        "</p><p class='description'>" +
1575                        records.results[i].shortDescription +
1576                        " </p></div>" +
1577                        bottomDiv;
1578
1579                    $("#list-section .row").append(div);
1580                } else {
1581                    var div =
1582                        "<div class='col-sm-6'><a href='" +
1583                        records.results[i].url +
1584                        "' class='professional-card-link'>" +
1585                        "<div class='professional-card'> <div class='image-container'> <img src='" +
1586                        records.results[i].profilephoto +
1587                        "' height='233' width='100%' class='image-fit'/>" +
1588                        accreditationHTML +
1589                        "</div><div class='content-container'><div class='upper'><div class='tag-container'>" +
1590                        expertiseHTML +
1591                        "</div> <p class='title'>" +
1592                        records.results[i].name +
1593                        "</p><p class='description'>" +
1594                        records.results[i].shortDescription +
1595                        " </p></div><div class='bottom'><div class='stats'><p class='bottom-title'>Experience</p><p class='bottom-description'>" +
1596                        records.results[i].experience +
1597                        " years</p></div><div class='stats'><p class='bottom-title'>Rate</p><p class='bottom-description'>" +
1598                        rateStr +
1599                        "</p></div></div></div></div></a></div>";
1600
1601                    $("#list-section .row").append(div);
1602                }
1603            }
1604        }
1605        if (pageType == "Programmes") {
1606            $("#list-section .row").html("");
1607            for (var i = 0; i < records.results.length; i++) {
1608                var div =
1609                    "<div class='col-sm-6'><a class='card-default programme' href='" +
1610                    records.results[i].url +
1611                    "'><div class='card-content'><div class='upper-part'><h3 class='card-title'>" +
1612                    records.results[i].title +
1613                    "</h3><div class='desc'>" +
1614                    records.results[i].description +
1615                    "</div></div><div class='lower-part'><span class='link-default'>" +
1616                    records.results[i].buttonText +
1617                    "</span></div></div></a></div>";
1618                $("#list-section .row").append(div);
1619            }
1620        }
1621        if (pageType == "CaseStudy") {
1622            $("#list-section .row").html("");
1623            for (var i = 0; i < records.results.length; i++) {
1624                var div =
1625                    "<div class='col-sm-6'> <a class='card-default event' href='" +
1626                    records.results[i].url +
1627                    "'> <div class='image-wrapper'> <img src='" +
1628                    records.results[i].image +
1629                    "' alt='" +
1630                    records.results[i].imagetext +
1631                    "'/></div><div class='card-content'><div class='upper-part'><h3 class='card-title'>" +
1632                    records.results[i].title +
1633                    "</h3><div class='desc'>" +
1634                    records.results[i].title +
1635                    "</div></div></div></a></div>";
1636                $("#list-section .row").append(div);
1637            }
1638        }
1639        if (pageType == "Testimonials") {
1640            $("#list-section .row").html("");
1641            for (var i = 0; i < records.results.length; i++) {
1642                var div =
1643                    "<div class='content-container'><img class='logo-container' src='" +
1644                    records.results[i].image +
1645                    "' height='100' width='100' /><div><h4 class='title'>" +
1646                    records.results[i].title +
1647                    "</h4><p class='desc'>" +
1648                    records.results[i].description +
1649                    "<br></br></p> <div class='extra-spacing'> </div><div>" +
1650                    records.results[i].buttonText +
1651                    "</div> </div></div>";
1652                $("#list-section .row").append(div);
1653            }
1654        }
1655        if (pageType == "News") {
1656            $("#list-section .row").html("");
1657            for (var i = 0; i < records.results.length; i++) {
1658                var imageHTML = records.results[i].image
1659                    ? "<div class='image-wrapper'><img src='" +
1660                    records.results[i].image +
1661                    "' alt='" +
1662                    records.results[i].imagetext +
1663                    "'/></div>"
1664                    : "";
1665
1666                var div =
1667                    "<div class='col-lg-12'><a class='card-default horizontal' href='" +
1668                    records.results[i].url +
1669                    "'>" +
1670                    imageHTML +
1671                    "<div class='card-content'><div class='content-top'><span class='date'>" +
1672                    records.results[i].custom[1]["Value"] +
1673                    "</span><span class='card-label grey'>" +
1674                    records.results[i].custom[0]["Value"] +
1675                    "</span></div><div class='card-title'>" +
1676                    records.results[i].title +
1677                    "</div></div></a></div>";
1678
1679                $("#list-section .row").append(div);
1680            }
1681        }
1682        if (pageType == "Events") {
1683            $("#list-section .row").html("");
1684            for (var i = 0; i < records.results.length; i++) {
1685                var labelsHTML = "";
1686                for (var j = 0; j < records.results[i].custom[1]["Value"].length; j++) {
1687                    labelsHTML +=
1688                        "<span class='card-label " +
1689                        records.results[i].custom[1]["Value"][j].Style +
1690                        "'>" +
1691                        records.results[i].custom[1]["Value"][j].Text +
1692                        "</span>";
1693                }
1694                var div =
1695                    "<div class='col-sm-6'><a class='card-default event' href='" +
1696                    records.results[i].url +
1697                    "'> <div class='image-wrapper'> <img src='" +
1698                    records.results[i].image +
1699                    "' alt='" +
1700                    records.results[i].imagetext +
1701                    "'> </div><div class='card-content'> <div class='upper-part'> <div class='icon-text'> <i class='ri-calendar-event-line'></i> <span class='text'>" +
1702                    records.results[i].custom[0]["Value"] +
1703                    "</span> </div><h3 class='card-title'>" +
1704                    records.results[i].title +
1705                    "</h3> <div class='desc'>" +
1706                    records.results[i].description +
1707                    "</div></div><div class='lower-part'>" +
1708                    labelsHTML +
1709                    "</div></div></a></div>";
1710                $("#list-section .row").append(div);
1711            }
1712        }
1713        if (pageType == "NewsCollection") {
1714            $("#list-section").html("");
1715            if (page == 1 && records.PinnedArticle) {
1716                var image0HTML = records.PinnedArticle.image
1717                    ? "<div class='image'><img src='" +
1718                    records.PinnedArticle.image +
1719                    "' alt='" +
1720                    records.PinnedArticle.imagetext +
1721                    "'/></div>"
1722                    : "";
1723
1724                var desc0HTML = records.PinnedArticle.description
1725                    ? "<div class='desc'>" + records.PinnedArticle.description + "</div>"
1726                    : "";
1727
1728                var bannerTemplate =
1729                    "<div class='banner-right-feature'><div class='inner'><div class='content'><span class='btn secondary'>Featured</span>
1729<h3 class='card-title'>" +
1730                    records.PinnedArticle.title +
1731                    "</h3>" +
1732                    desc0HTML +
1733                    "<a class='link-default' href='" +
1734                    records.PinnedArticle.url +
1735                    "'>Learn more</a></div>" +
1736                    image0HTML +
1737                    "</div></div>";
1738                $("#list-section").append(bannerTemplate);
1739            }
1740            $("#list-section").append("<div class='row'></div>");
1741
1742            for (var i = 0; i < records.results.length; i++) {
1743                var imageHTML = records.results[i].image
1744                    ? "<div class='image-wrapper'><img src='" +
1745                    records.results[i].image +
1746                    "' alt='" +
1747                    records.results[i].imagetext +
1748                    "'/></div>"
1749                    : "";
1750
1751                var descHTML = records.results[i].description
1752                    ? "<div class='desc'>" + records.results[i].description + "</div>"
1753                    : "";
1754
1755                var listingTemplate =
1756                    "<div class='col-sm-6'><a class='card-default collection-card' href='" +
1757                    records.results[i].url +
1758                    "'>" +
1759                    imageHTML +
1760                    "<div class='card-content'> <div class='upper-part'> <div class='content-top'><span class='content-count'>" +
1761                    records.results[i].custom[0]["Value"] +
1762                    " articles</span> </div><h3 class='card-title'>" +
1763                    records.results[i].title +
1764                    "</h3>" +
1765                    descHTML +
1766                    "</div></div></a></div>";
1767                $("#list-section .row").append(listingTemplate);
1768            }
1769        }
1770        if (pageType == "RelevantArticlesForCollection") {
1771            $("#list-section .row").html("");
1772            for (var i = 0; i < records.results.length; i++) {
1773                var imageHTML = records.results[i].image
1774                    ? "<div class='image-wrapper'><img src='" +
1775                    records.results[i].image +
1776                    "' alt='" +
1777                    records.results[i].title +
1778                    "'/></div>"
1779                    : "";
1780
1781                var div =
1782                    "<div class='col-lg-12'><a class='card-default horizontal' href='" +
1783                    records.results[i].url +
1784                    "'>" +
1785                    imageHTML +
1786                    "<div class='card-content'><div class='content-top'><span class='date'>" +
1787                    records.results[i].custom[1]["Value"] +
1788                    "</span><span class='card-label grey'>" +
1789                    records.results[i].custom[0]["Value"] +
1790                    "</span></div><div class='card-title'>" +
1791                    records.results[i].title +
1792                    "</div></div></a></div>";
1793
1794                $("#list-section .row").append(div);
1795            }
1796        }
1797        if (pageType == "Publications") {
1798            $("#list-section .row").html("");
1799            for (var i = 0; i < records.results.length; i++) {
1800                var imageHTML = records.results[i].image
1801                    ? "<div class='image-wrapper'><img src='" +
1802                    records.results[i].image +
1803                    "' alt='" +
1804                    records.results[i].imagetext +
1805                    "'/></div>"
1806                    : "";
1807
1808                var div =
1809                    "<div class='col-lg-12'><a class='card-default horizontal' href='" +
1810                    records.results[i].url +
1811                    "'>" +
1812                    imageHTML +
1813                    "<div class='card-content'><div class='content-top'><span class='date'>" +
1814                    records.results[i].custom[1]["Value"] +
1815                    "</span><span class='card-label grey'>" +
1816                    records.results[i].custom[0]["Value"] +
1817                    "</span></div><div class='card-title'>" +
1818                    records.results[i].title +
1819                    "</div></div></a></div>";
1820
1821                $("#list-section .row").append(div);
1822            }
1823        }
1824        if (pageType == "MediaMaterial") {
1825            $("#list-section .row").html("");
1826            for (var i = 0; i < records.results.length; i++) {
1827                var div =
1828                    "<div class='col-lg-12'><a class='card-default horizontal' href='" +
1829                    records.results[i].url +
1830                    "'><div class='card-content'><div class='content-top'><span class='date'>" +
1831                    records.results[i].custom[1]["Value"] +
1832                    "</span></div><div class='card-title'>" +
1833                    records.results[i].title +
1834                    "</div></div></a></div>";
1835
1836                $("#list-section .row").append(div);
1837            }
1838        }
1839        if (pageType == "MediaGallery") {
1840            $("#list-section .row").html("");
1841            for (var i = 0; i < records.results.length; i++) {
1842                var imageHTML = records.results[i].image
1843                    ? "<div class='image-wrapper'><img src='" +
1844                    records.results[i].image +
1845                    "' alt='" +
1846                    records.results[i].imagetext +
1847                    "'/></div>"
1848                    : "";
1849
1850                var urlHTML = records.results[i].custom[2]["Value"]
1851                    ? records.results[i].custom[2]["Value"]
1852                    : records.results[i].url;
1853                var descHTML = records.results[i].description
1854                    ? "<div class='desc'>" + records.results[i].description + "</div>"
1855                    : "";
1856
1857                if (records.results[i].custom[2]["Value"]) {
1858                    var targetHTML =
1859                        records.results[i].custom[3]["Value"] == "_blank"
1860                            ? "target='_blank'"
1861                            : "";
1862                    var div =
1863                        "<div class='col-lg-12'><a class='card-default horizontal' " +
1864                        targetHTML +
1865                        "href='" +
1866                        urlHTML +
1867                        "'>" +
1868                        imageHTML +
1869                        "<div class='card-content'><div class='card-title'>" +
1870                        records.results[i].title +
1871                        "</div>" +
1872                        descHTML +
1873                        "</div></a></div>";
1874                } else {
1875                    var contentTopHTML =
1876                        records.results[i].custom[0]["Value"] &&
1877                            records.results[i].custom[0]["Value"] > 0
1878                            ? "<span class='date'>" +
1879                            records.results[i].custom[0]["Value"] +
1880                            " " +
1881                            records.results[i].custom[0]["Key"] +
1882                            "</span>"
1883                            : "";
1884
1885                    if (
1886                        records.results[i].custom.length > 1 &&
1887                        records.results[i].custom[1]["Value"] &&
1888                        records.results[i].custom[1]["Value"] > 0
1889                    ) {
1890                        contentTopHTML +=
1891                            "<span class='card-label'>" +
1892                            records.results[i].custom[1]["Value"] +
1893                            " " +
1894                            records.results[i].custom[1]["Key"] +
1895                            "</span>";
1896                    }
1897                    var div =
1898                        "<div class='col-lg-12'><a class='card-default horizontal' href='" +
1899                        urlHTML +
1900                        "'>" +
1901                        imageHTML +
1902                        "<div class='card-content'><div class='content-top'>" +
1903                        contentTopHTML +
1904                        "</div><div class='card-title'>" +
1905                        records.results[i].title +
1906                        "</div>" +
1907                        descHTML +
1908                        "</div></a></div>";
1909                }
1910
1911                $("#list-section .row").append(div);
1912            }
1913        }
1914        if (pageType == "Videos") {
1915            $("#list-section .row").html("");
1916            for (var i = 0; i < records.results.length; i++) {
1917                var imageHTML = records.results[i].Image
1918                    ? "<div class='image-wrapper'><img src='" +
1919                    records.results[i].Image +
1920                    "' alt='" +
1921                    records.results[i].Title +
1922                    "'/></div>"
1923                    : "";
1924
1925                var div =
1926                    "<div class='col-sm-6 col-lg-4'><a class='card-default video-card' href='" +
1927                    records.results[i].Url +
1928                    "'>" +
1929                    imageHTML +
1930                    "<div class='card-content'><div class='content-top'><span class='content-count'>" +
1931                    records.results[i].PublishedDate +
1932                    "</span></div><div class='card-title'>" +
1933                    records.results[i].Title +
1934                    "</div></div></a></div>";
1935
1936                $("#list-section .row").append(div);
1937            }
1938        }
1939        if (pageType == "SingleGallery") {
1940            // Single-gallery view (Gallery.cshtml) was rebuilt with an adaptive
1941            // modal that does its own item rendering. The view exposes a renderer
1942            // on window — hand off the results and the new markup + click
1943            // delegation in the view take care of the rest. fancyBoxRendering()
1944            // is intentionally dropped here; the adaptive modal replaces fancybox
1945            // for this view only. Other pageTypes below still call it normally.
1946            if (window.NtucAdaptiveGallery && records && records.results) {
1947                window.NtucAdaptiveGallery.renderResults(records.results);
1948            }
1949        }
1950        if (pageType == "Blogs") {
1951            $("#list-section .row").html("");
1952            for (var i = 0; i < records.results.length; i++) {
1953                var imageHTML = records.results[i].Image
1954                    ? "<div class='image-wrapper'><img src='" +
1955                    records.results[i].Image +
1956                    "' alt='" +
1957                    records.results[i].Title +
1958                    "'/></div>"
1959                    : "";
1960
1961                var div =
1962                    "<div class='col-lg-12'><a class='card-default horizontal' href='" +
1963                    records.results[i].Url +
1964                    "'>" +
1965                    imageHTML +
1966                    "<div class='card-content'><div class='content-top'><span class='date'>" +
1967                    records.results[i].PublishedDate +
1968                    "</span></div><div class='card-title'>" +
1969                    records.results[i].Title +
1970                    "</div></div></a></div>";
1971
1972                $("#list-section .row").append(div);
1973            }
1974        }
1975        if (pageType == "Guides") {
1976            $("#list-section .row").html("");
1977            for (var i = 0; i < records.results.length; i++) {
1978                var imageHTML = records.results[i].Image
1979                    ? "<div class='image-wrapper'><img src='" +
1980                    records.results[i].Image +
1981                    "' alt='" +
1982                    records.results[i].Title +
1983                    "'/></div>"
1984                    : "";
1985                var hasVideo =
1986                    records.results[i].TemplateName === "VideoPage" ? "video-card" : "";
1987                var div =
1988                    "<div class='col-lg-12'><a class='card-default horizontal " +
1989                    hasVideo +
1990                    "' href='" +
1991                    records.results[i].Url +
1992                    "'>" +
1993                    imageHTML +
1994                    "<div class='card-content'><div class='content-top'><span class='date'>" +
1995                    records.results[i].PublishedDate +
1996                    "</span></div><div class='card-title'>" +
1997                    records.results[i].Title +
1998                    "</div></div></a></div>";
1999
2000                $("#list-section .row").append(div);
2001            }
2002        }
2003        if (pageType == "OurPrinciples") {
2004            $("#list-section .row").html("");
2005            for (var i = 0; i < records.results.length; i++) {
2006                var imageHTML = records.results[i].Image
2007                    ? "<div class='image-wrapper'><img src='" +
2008                    records.results[i].Image +
2009                    "' alt='" +
2010                    records.results[i].Title +
2011                    "'/></div>"
2012                    : "";
2013
2014                var hasVideo =
2015                    records.results[i].TemplateName === "People VideoPage"
2016                        ? "video-card"
2017                        : "";
2018
2019                var div =
2020                    "<div class='col-lg-12'><a class='card-default horizontal " +
2021                    hasVideo +
2022                    "' href='" +
2023                    records.results[i].Url +
2024                    "'>" +
2025                    imageHTML +
2026                    "<div class='card-content'><div class='content-top'><span class='date'>" +
2027                    records.results[i].PublishedDate +
2028                    "</span><span class='card-label grey'>" +
2029                    records.results[i].OurPrincipleType[0]["Value"] +
2030                    "</span></div><div class='card-title'>" +
2031                    records.results[i].Title +
2032                    "</div></div></a></div>";
2033
2034                $("#list-section .row").append(div);
2035            }
2036        }
2037        if (pageType == "Stories") {
2038            $("#list-section .row").html("");
2039            for (var i = 0; i < records.results.length; i++) {
2040                var imageHTML = records.results[i].Image
2041                    ? "<div class='image-wrapper'><img src='" +
2042                    records.results[i].Image +
2043                    "' alt='" +
2044                    records.results[i].Title +
2045                    "'/></div>"
2046                    : "";
2047
2048                var hasVideo =
2049                    records.results[i].TemplateName === "OurStory VideoPage"
2050                        ? "video-card"
2051                        : "";
2052                var div =
2053                    "<div class='col-lg-12'><a class='card-default horizontal " +
2054                    hasVideo +
2055                    "' href='" +
2056                    records.results[i].Url +
2057                    "'>" +
2058                    imageHTML +
2059                    "<div class='card-content'><div class='content-top'><span class='date'>" +
2060                    records.results[i].PublishedDate +
2061                    "</span></div><div class='card-title'>" +
2062                    records.results[i].Title +
2063                    "</div></div></a></div>";
2064
2065                $("#list-section .row").append(div);
2066            }
2067        }
2068        if (pageType == "Reports") {
2069            $("#list-section .row").html("");
2070            for (var i = 0; i < records.results.length; i++) {
2071                var imageHTML = records.results[i].image
2072                    ? "<div class='image-wrapper'><img src='" +
2073                    records.results[i].image +
2074                    "' alt='" +
2075                    records.results[i].imagetext +
2076                    "'/></div>"
2077                    : "";
2078                var infographicsHTML =
2079                    records.results[i].custom[0]["Value"] &&
2080                        records.results[i].custom[0]["Value"] > 0
2081                        ? "<span class='card-label'>" +
2082                        records.results[i].custom[0]["Value"] +
2083                        " " +
2084                        records.results[i].custom[0]["Key"] +
2085                        "</span>"
2086                        : "";
2087
2088                var div =
2089                    "<div class='col-lg-12'><a class='card-default report' href='" +
2090                    records.results[i].url +
2091                    "'>" +
2092                    imageHTML +
2093                    "<div class='card-content'><div class='content-top'><span class='date'>1 report</span>" +
2094                    infographicsHTML +
2095                    "</div><div class='card-title'>" +
2096                    records.results[i].title +
2097                    "</div><div class='desc'>" +
2098                    records.results[i].description +
2099                    "</div></div></a></div>";
2100
2101                $("#list-section .row").append(div);
2102            }
2103        }
2104        if (pageType == "Journals") {
2105            $("#list-section .row").html("");
2106            for (var i = 0; i < records.results.length; i++) {
2107                var imageHTML = records.results[i].image
2108                    ? "<div class='image-wrapper'><img src='" +
2109                    records.results[i].image +
2110                    "' alt='" +
2111                    records.results[i].imagetext +
2112                    "'/></div>"
2113                    : "";
2114
2115                var fileDownload = records.results[i].custom[0]["Value"];
2116                const myFile = fileDownload.split("|");
2117                var div =
2118                    "<div class='col-lg-12'><a class='card-default report' target='_blank' href='" +
2119                    records.results[i].custom[1]["Value"] +
2120                    "'>" +
2121                    imageHTML +
2122                    "<div class='card-content'><div class='card-title'>" +
2123                    records.results[i].title +
2124                    "</div><div class='desc'>" +
2125                    records.results[i].description +
2126                    "</div>
2126<span class='download-link'>Download " +
2127                    myFile[1] +
2128                    " (" +
2129                    myFile[0] +
2130                    ")</span></div></a></div>";
2131
2132                $("#list-section .row").append(div);
2133            }
2134        }
2135        if (pageType == "Deals") {
2136            $("#list-section .row").html("");
2137            for (var i = 0; i < records.results.length; i++) {
2138                var labelsHTML = "";
2139                var categoriesHTML = "";
2140                for (var j = 0; j < records.results[i].Category.length; j++) {
2141                    if (j == 0) {
2142                        categoriesHTML +=
2143                            "<span class='text'>" +
2144                            records.results[i].Category[j] +
2145                            "</span>";
2146                    } else {
2147                        categoriesHTML +=
2148                            " | <span class='text'>" +
2149                            records.results[i].Category[j] +
2150                            "</span>";
2151                    }
2152                }
2153                for (var j = 0; j < records.results[i].Labels.length; j++) {
2154                    labelsHTML +=
2155                        "<span class='card-label " +
2156                        records.results[i].Labels[j]["Style"] +
2157                        "'>" +
2158                        records.results[i].Labels[j]["Text"] +
2159                        "</span>";
2160                }
2161                var promotionHTML = records.results[i].PromotionMessage
2162                    ? "<div class='gift-icon'><img src='" +
2163                    records.results[i].PromotionImage +
2164                    "'><span>" +
2165                    records.results[i].PromotionMessage +
2166                    "</span></div>"
2167                    : "";
2168
2169                var div =
2170                    "<div class='col-sm-6'><a class='card-default event deal' href='" +
2171                    records.results[i].Url +
2172                    "'> <div class='image-wrapper'> <img src='" +
2173                    records.results[i].Image +
2174                    "' alt='" +
2175                    records.results[i].Title +
2176                    "'> </div><div class='card-content'> <div class='upper-part'> <div class='icon-text'><span class='text'>" +
2177                    categoriesHTML +
2178                    "</span> </div><h3 class='card-title'>" +
2179                    records.results[i].Title +
2180                    "</h3> <div class='desc'>" +
2181                    records.results[i].Description +
2182                    "</div></div><div class='lower-part'>" +
2183                    labelsHTML +
2184                    promotionHTML +
2185                    "</div></div></a></div>";
2186                $("#list-section .row").append(div);
2187            }
2188        }
2189    };
2190
2191    var renderSkeleton = () => {
2192        $("#list-section .row").html("");
2193        for (var i = 0; i < 10; i++) {
2194            var div =
2195                "<div class='col-sm-6'><a class='card-default programme ' loading-skeleton='true' href='#'><div class='card-content'><div class='upper-part'><h3 class='card-title'>Operation</h3><div class='desc'>Receive training and certification to empower your businessx</div></div><div class='lower-part'><span class='link-default'>Learn more</span></div></div></a></div>";
2196            $("#list-section .row").append(div);
2197        }
2198    };
2199
2200    var filterAccordion = "#filter-accordion";
2201
2202    $(window)
2203        .resize(function () {
2204            if ($(window).width() < 576) {
2205                visiblePages = 3;
2206            } else {
2207                visiblePages = 5;
2208            }
2209
2210            if ($(window).width() < 992) {
2211                filterAccordion = "#filter-accordion-mb";
2212            }
2213        })
2214        .resize();
2215
2216    if (
2217        decodeURI(window.location.search).indexOf("topic") < 0 &&
2218        totalPages > 0
2219    ) {
2220        apply_pagination();
2221    }
2222
2223    //Apply pagination
2224    function apply_pagination(pageCount, startPage) {
2225        var pageNumber = pageCount ? pageCount : totalPages;
2226        pagination.twbsPagination({
2227            totalPages: pageNumber,
2228            visiblePages: visiblePages,
2229            initiateStartPageClick: false,
2230            startPage: startPage,
2231            first: "<span></span>",
2232            prev: '<span class="prev-icon"> </span>',
2233            next: '<span class="next-icon"></span>',
2234            last: "<span></span>",
2235            onPageClick: function (event, page) {
2236                var pageData = getPageData();
2237                fetchData(page, pageData);
2238                window.scrollTo({ top: 0, behavior: "smooth" });
2239            },
2240        });
2241    }
2242    function updateDealsUrl(page, pageData) {
2243
2244        if ($("#list-section").attr("data-pagetype") !== "Deals")
2245            return;
2246
2247        var queryString = generateDealsQueryString(
2248            pageData.category || "",
2249            pageData.membership || ""
2250        );
2251
2252        window.history.replaceState(
2253            {},
2254            document.title,
2255            window.location.pathname +
2256            (queryString ? "?" + queryString : "")
2257        );
2258    }
2259    //Fetch data from the api
2260    function fetchData(page, pageData, startPage) {
2261        updateDealsUrl(page, pageData);
2262        var expertise = "";
2263        var subexpertise = "";
2264        var accreditation = "";
2265        var membertype = "";
2266        var institution = "";
2267        var experience = "";
2268        var industry = "";
2269        var company = "";
2270        var pillars = "";
2271        var topics = "";
2272        var audience = "";
2273        var location = "";
2274        var price = "";
2275        var publications = "";
2276        var mediaGallery = "";
2277        var mediaMaterial = "";
2278        var dateFrom = "";
2279        var dateTo = "";
2280        var category = "";
2281        var membership = "";
2282        var newsMediaMaterial =
2283            $("[data-news-media-material]").length > 0
2284                ? $("[data-news-media-material]").data("news-media-material")
2285                : "";
2286
2287        if ($("#page-sorting-dropdown .dropdown-item.active").length > 0) {
2288            sortorder = $("#page-sorting-dropdown .dropdown-item.active").data(
2289                "value"
2290            );
2291        }
2292        if ($("#page-count-dropdown .dropdown-item.active").length > 0) {
2293            results = $("#page-count-dropdown .dropdown-item.active").data("value");
2294        }
2295        var newstype = $("#list-section").attr("data-newstype");
2296        var sourceId = $("#list-section").attr("data-sourceid");
2297        var membersonly = false;
2298
2299        if (pageData && pageData["expertise"] !== undefined) {
2300            expertise = pageData["expertise"];
2301        }
2302
2303        if (pageData && pageData["subexpertise"] !== undefined) {
2304            subexpertise = pageData["subexpertise"];
2305        }
2306
2307        if (pageData && pageData["accreditation"] !== undefined) {
2308            accreditation = pageData["accreditation"];
2309        }
2310
2311        if (pageData && pageData["institution"] !== undefined) {
2312            institution = pageData["institution"];
2313        }
2314
2315        if (pageData && pageData["membertype"] !== undefined) {
2316            membertype = pageData["membertype"];
2317        }
2318
2319        if (pageData && pageData["experience"] !== undefined) {
2320            experience = pageData["experience"];
2321        }
2322
2323        if (pageData && pageData["industry"] !== undefined) {
2324            industry = pageData["industry"];
2325        }
2326
2327        if (pageData && pageData["company"] !== undefined) {
2328            company = pageData["company"];
2329        }
2330
2331        if (pageData && pageData["pillars"] !== undefined) {
2332            pillars = pageData["pillars"];
2333        }
2334
2335        if (pageData && pageData["topics"] !== undefined) {
2336            topics = pageData["topics"];
2337        }
2338
2339        if (pageData && pageData["audience"] !== undefined) {
2340            audience = pageData["audience"];
2341        }
2342
2343        if (pageData && pageData["location"] !== undefined) {
2344            location = pageData["location"];
2345        }
2346
2347        if (pageData && pageData["price"] !== undefined) {
2348            price = pageData["price"];
2349        }
2350
2351        if (pageData && pageData["publications"] !== undefined) {
2352            publications = pageData["publications"];
2353        }
2354
2355        if (pageData && pageData["mediaGallery"] !== undefined) {
2356            mediaGallery = pageData["mediaGallery"];
2357        }
2358
2359        if (pageData && pageData["mediaMaterial"] !== undefined) {
2360            mediaMaterial = pageData["mediaMaterial"];
2361        }
2362
2363        if (pageData && pageData["dateFrom"] !== undefined) {
2364            dateFrom = pageData["dateFrom"];
2365        }
2366
2367        if (pageData && pageData["dateTo"] !== undefined) {
2368            dateTo = pageData["dateTo"];
2369        }
2370
2371        if (pageData && pageData["sortorder"] !== undefined) {
2372            sortorder = pageData["sortorder"];
2373        }
2374
2375        if (pageData && pageData["results"] !== undefined) {
2376            results = pageData["results"];
2377        }
2378
2379        if (pageData && pageData["membersonly"] !== false) {
2380            membersonly = pageData["membersonly"];
2381        }
2382        if (pageData && pageData["category"] !== undefined) {
2383            category = pageData["category"];
2384        }
2385
2386        if (pageData && pageData["membership"] !== undefined) {
2387            membership = pageData["membership"];
2388        }
2389        var payloadData = {
2390            expertise: expertise,
2391            subexpertise: subexpertise,
2392            accreditation: accreditation,
2393            institution: institution,
2394            membertype: membertype,
2395            experience: experience,
2396            industry: industry,
2397            company: company,
2398            pillars: pillars,
2399            topics: topics,
2400            audience: audience,
2401            location: location,
2402            price: price,
2403            publications: publications,
2404            mediaGallery: mediaGallery,
2405            mediaMaterial: mediaMaterial,
2406            newsMediaMaterial: newsMediaMaterial,
2407            dateFrom: dateFrom,
2408            dateTo: dateTo,
2409            pagenumber: page,
2410            results: results,
2411            sortorder: sortorder,
2412            sourceid: sourceId,
2413            newstype: newstype,
2414            membersonly: membersonly,
2415            category: category,
2416            membership: membership,
2417        };
2418
2419        localStorage.setItem("expertise", expertise);
2420        localStorage.setItem("subexpertise", subexpertise);
2421        localStorage.setItem("accreditation", accreditation);
2422        localStorage.setItem("institution", institution);
2423        localStorage.setItem("membertype", membertype);
2424        localStorage.setItem("experience", experience);
2425        localStorage.setItem("industry", industry);
2426        localStorage.setItem("company", company);
2427        localStorage.setItem("pillars", pillars);
2428        localStorage.setItem("topics", topics);
2429        localStorage.setItem("audience", audience);
2430        localStorage.setItem("location", location);
2431        localStorage.setItem("price", price);
2432        localStorage.setItem("publications", publications);
2433        localStorage.setItem("mediaGallery", mediaGallery);
2434        localStorage.setItem("mediaMaterial", mediaMaterial);
2435        localStorage.setItem("newsMediaMaterial", newsMediaMaterial);
2436        localStorage.setItem("dateFrom", dateFrom);
2437        localStorage.setItem("dateTo", dateTo);
2438        localStorage.setItem("pagenumber", page);
2439        localStorage.setItem("results", results);
2440        localStorage.setItem("sortorder", sortorder);
2441        localStorage.setItem("sourceid", sourceId);
2442        localStorage.setItem("newstype", newstype);
2443        localStorage.setItem("membersonly", membersonly);
2444        localStorage.setItem("category", category);
2445        localStorage.setItem("membership", membership);
2446        localStorage.setItem("data-pagetype", pageType);
2447
2448        if (
2449            decodeURI(window.location.search).indexOf("topic") > 0 &&
2450            totalPages == 0
2451        )
2452            return;
2453        $.ajax({
2454            url: api[pageType],
2455            dataType: "json",
2456            type: "post",
2457            contentType: "application/json",
2458            data: JSON.stringify(payloadData),
2459            beforeSend: function () {
2460                renderSkeleton();
2461            },
2462            success: function (data, textStatus, jQxhr) {
2463                var res = data;
2464                if (res.total == 0) {
2465                    $(
2466                        ".top-filter .wrapper, .top-filter-mb .count span, .filter-pagination-container"
2467                    ).hide();
2468                    renderCountBubble();
2469                    $("#list-section .row").html("");
2470                    var noRecordHtml =
2471                        "<div class='col-12'><h3 data-no-records-found>No records found</h3></div>";
2472                    $("#list-section .row").html("").append(noRecordHtml);
2473                } else {
2474                    $(
2475                        ".top-filter .wrapper, .top-filter-mb .count span, .filter-pagination-container"
2476                    ).show();
2477                    var resCount = res.total;
2478                    var pageCount = calculatePagesCount(results, res.total);
2479                    renderResultCount(page, res.results.length, resCount, results);
2480                    renderCountBubble();
2481                    renderCards(res, pageType, page);
2482                    apply_pagination(pageCount, startPage);
2483                }
2484                if (startPage) {
2485                    if (
2486                        $(filterAccordion + " input[type='checkbox']:checked").length > 0
2487                    ) {
2488                        var accordionItem = $(
2489                            filterAccordion + " input[type='checkbox']:checked"
2490                        ).closest(".accordion-item");
2491                        accordionItem.find(".accordion-button.collapsed").trigger("click");
2492                        accordionItem.find(".clear-btn").show();
2493
2494                        $(".filter-btn-container").show();
2495                    }
2496                    if ($(filterAccordion + " .dropdown-cmp").length > 0) {
2497                        if (
2498                            dateFrom !=
2499                            $(filterAccordion + " [date-from-dropdown]").data(
2500                                "select-calendar"
2501                            ) ||
2502                            dateTo !=
2503                            $(filterAccordion + " [date-to-dropdown]").data(
2504                                "select-calendar"
2505                            )
2506                        ) {
2507                            var accordionItem = $(
2508                                filterAccordion + " [date-from-dropdown]"
2509                            ).closest(".accordion-item");
2510                            accordionItem
2511                                .find(".accordion-button.collapsed")
2512                                .trigger("click");
2513                            accordionItem.find(".clear-btn").show();
2514
2515                            $(".filter-btn-container").show();
2516
2517                            var bubbleHtml =
2518                                "<a class='btn secondary rightIcon small tag-bubble' data-tag data-value='date' href='#' id='dateCount'><span>Date</span></i></a>";
2519                            $("#filter-tags").append(bubbleHtml);
2520                        }
2521                    }
2522                    if (
2523                        $(filterAccordion + " input[type='checkbox']:checked").length > 0 ||
2524                        $(filterAccordion + " .dropdown-cmp").length > 0
2525                    ) {
2526                        var filterCount =
2527                            $(filterAccordion + " input[type='checkbox']:checked").length +
2528                            $("#dateCount").length;
2529                        $(".filter-button strong").find("span").remove();
2530                        $(".filter-button strong").append(
2531                            "<span class='filterCount'> (" + filterCount + ")</span>"
2532                        );
2533                        $(".filter-button").addClass("active");
2534                    }
2535                }
2536            },
2537            error: function (jqXhr, textStatus, errorThrown) {
2538                console.log(errorThrown);
2539            },
2540        });
2541    }
2542
2543    //Return page start number
2544    var getPageStart = (pageSize, pageNr) => {
2545        return pageSize * pageNr;
2546    };
2547
2548    //Render result section eg: 1 - 2 of 20 results
2549    var renderResultCount = (page, resCount, totalCount, results) => {
2550        if (totalCount == 0) {
2551            $(".count").empty();
2552            $(
2553                ".top-filter .wrapper, .top-filter-mb .count span, .filter-pagination-container"
2554            ).hide();
2555            $("#list-section .row").html("");
2556            var noRecordHtml =
2557                "<div class='col-12'><h3 data-no-records-found>
2557No records found</h3></div>";
2558            $("#list-section .row").html("").append(noRecordHtml);
2559            return;
2560        }
2561        if (page == 1) {
2562            start = page;
2563        } else {
2564            start = Math.max(getPageStart(results, page - 1), 0);
2565            start = start + 1;
2566        }
2567        end = start + (resCount - 1);
2568        var pageCountHtml =
2569            "<span><strong>" +
2570            start +
2571            " - " +
2572            end +
2573            "</strong> of <strong>" +
2574            totalCount +
2575            "</strong> results </span>";
2576        $(".count").attr("loading-skeleton", false);
2577        $(".count").empty().append(pageCountHtml);
2578    };
2579    // Render result count on page load
2580    var renderCountBubble = () => {
2581        var expertiseCount = $("input[name=expertise]:checked").length;
2582        var subexpertiseCount = $("input[name=subexpertise]:checked").length;
2583        var accreditationCount = $("input[name=accreditation]:checked").length;
2584        var institutionCount = $("input[name=institution]:checked").length;
2585        var membertypeCount = $("input[name=membertype]:checked").length;
2586        var experienceCount = $("input[name=experience]:checked").length;
2587        var industryCount = $("input[name=industry]:checked").length;
2588        var companyCount = $("input[name=company]:checked").length;
2589        var pillarsCount = $("input[name=pillars]:checked").length;
2590        var topicsCount = $("input[name=topics]:checked").length;
2591        var audienceCount = $("input[name=audience]:checked").length;
2592        var locationCount = $("input[name=location]:checked").length;
2593        var priceCount = $("input[name=price]:checked").length;
2594        var publicationCount = $("input[name=publication-types]:checked").length;
2595        var mediaGalleryCount = $("input[name=mediaGallery-types]:checked").length;
2596        var materialCount = $("input[name=media-material]:checked").length;
2597        var categoryCount = $("input[name=category]:checked").length;
2598        var membershipCount = $("input[name=membership-type]:checked").length;
2599        if (expertiseCount > 0) {
2600            $("#expertiseCount").remove();
2601            var bubbleHtml =
2602                "<a class='btn secondary rightIcon small tag-bubble' href='#' data-tag data-value='expertise' id='expertiseCount'><span>Expertise (" +
2603                expertiseCount +
2604                ")</span></i></a>";
2605            $("#filter-tags").append(bubbleHtml);
2606        } else {
2607            $("#expertiseCount").remove();
2608        }
2609        if ($("#expertiseCount").length < 1) {
2610            if (subexpertiseCount > 0) {
2611                $("#expertiseCount").remove();
2612                var parentChecks = [];
2613                $("input[name=subexpertise]:checked").each(function () {
2614                    parentChecks.push(
2615                        $(this)
2616                            .closest(".nested-filter-li")
2617                            .find(".nested-filter-container")
2618                            .find(".parentCheckbox")
2619                            .val()
2620                    );
2621                    parentChecks = jQuery.unique(parentChecks);
2622                });
2623                var bubbleHtml =
2624                    "<a class='btn secondary rightIcon small tag-bubble' href='#' data-tag data-value='expertise' id='expertiseCount'><span>Expertise (" +
2625                    parentChecks.length +
2626                    ")</span></i></a>";
2627                if ($(".tag-bubble").length < 1) {
2628                    $("#filter-tags").append(bubbleHtml);
2629                }
2630            } else {
2631                $("#expertiseCount").remove();
2632            }
2633        }
2634
2635        if (experienceCount > 0) {
2636            $("#industryCount").remove();
2637            var bubbleHtml =
2638                "<a class='btn secondary rightIcon small tag-bubble' href='#' data-tag data-value='experience' id='experienceCount'><span>Experience (" +
2639                experienceCount +
2640                ")</span></i></a>";
2641            $("#filter-tags").append(bubbleHtml);
2642        } else {
2643            $("#experienceCount").remove();
2644        }
2645
2646        if (accreditationCount > 0) {
2647            $("#accreditationCount").remove();
2648            var bubbleHtml =
2649                "<a class='btn secondary rightIcon small tag-bubble' href='#' data-tag data-value='accreditation' id='accreditationCount'><span>Accreditations (" +
2650                accreditationCount +
2651                ")</span></i></a>";
2652            $("#filter-tags").append(bubbleHtml);
2653        } else {
2654            $("#accreditationCount").remove();
2655        }
2656        if (institutionCount > 0) {
2657            $("#institutionCount").remove();
2658            var bubbleHtml =
2659                "<a class='btn secondary rightIcon small tag-bubble' href='#' data-tag data-value='institution' id='institutionCount'><span>Institutions (" +
2660                institutionCount +
2661                ")</span></i></a>";
2662            $("#filter-tags").append(bubbleHtml);
2663        } else {
2664            $("#institutionCount").remove();
2665        }
2666        if (membertypeCount > 0) {
2667            $("#membertypeCount").remove();
2668            var bubbleHtml =
2669                "<a class='btn secondary rightIcon small tag-bubble' href='#' data-tag data-value='membertype' id='membertypeCount'><span>Member Type (" +
2670                membertypeCount +
2671                ")</span></i></a>";
2672            $("#filter-tags").append(bubbleHtml);
2673        } else {
2674            $("#membertypeCount").remove();
2675        }
2676        if (industryCount > 0) {
2677            $("#industryCount").remove();
2678            var bubbleHtml =
2679                "<a class='btn secondary rightIcon small tag-bubble' href='#' data-tag data-value='industry' id='industryCount'><span>Industry (" +
2680                industryCount +
2681                ")</span></i></a>";
2682            $("#filter-tags").append(bubbleHtml);
2683        } else {
2684            $("#industryCount").remove();
2685        }
2686        if (companyCount > 0) {
2687            $("#companyCount").remove();
2688            var bubbleHtml =
2689                "<a class='btn secondary rightIcon small tag-bubble' href='#' data-tag data-value='company' id='companyCount'><span>Company Types (" +
2690                companyCount +
2691                ")</span></i></a>";
2692            $("#filter-tags").append(bubbleHtml);
2693        } else {
2694            $("#companyCount").remove();
2695        }
2696        if (pillarsCount > 0) {
2697            $("#pillarsCount").remove();
2698            var bubbleHtml =
2699                "<a class='btn secondary rightIcon small tag-bubble' href='#' data-tag data-value='pillars' id='pillarsCount'><span>Pillars (" +
2700                pillarsCount +
2701                ")</span></i></a>";
2702            $("#filter-tags").append(bubbleHtml);
2703        } else {
2704            $("#pillarsCount").remove();
2705        }
2706        if (topicsCount > 0) {
2707            $("#topicCount").remove();
2708            var bubbleHtml =
2709                "<a class='btn secondary rightIcon small tag-bubble' href='#' data-tag data-value='topics' id='topicCount'><span>Topics (" +
2710                topicsCount +
2711                ")</span></i></a>";
2712            $("#filter-tags").append(bubbleHtml);
2713        } else {
2714            $("#topicCount").remove();
2715        }
2716        if (audienceCount > 0) {
2717            $("#audienceCount").remove();
2718            var bubbleHtml =
2719                "<a class='btn secondary rightIcon small tag-bubble' data-tag data-value='audience' href='#' id='audienceCount'><span>Audience (" +
2720                audienceCount +
2721                ")</span></i></a>";
2722            $("#filter-tags").append(bubbleHtml);
2723        } else {
2724            $("#audienceCount").remove();
2725        }
2726        if (locationCount > 0) {
2727            $("#locationCount").remove();
2728            var bubbleHtml =
2729                "<a class='btn secondary rightIcon small tag-bubble' data-tag data-value='location' href='#' id='locationCount'><span>Location (" +
2730                locationCount +
2731                ")</span></i></a>";
2732            $("#filter-tags").append(bubbleHtml);
2733        } else {
2734            $("#locationCount").remove();
2735        }
2736        if (priceCount > 0) {
2737            $("#priceCount").remove();
2738            var bubbleHtml =
2739                "<a class='btn secondary rightIcon small tag-bubble' data-tag data-value='price' href='#' id='priceCount'><span>Price (" +
2740                priceCount +
2741                ")</span></i></a>";
2742            $("#filter-tags").append(bubbleHtml);
2743        } else {
2744            $("#priceCount").remove();
2745        }
2746        if (publicationCount > 0) {
2747            $("#publicationCount").remove();
2748            var bubbleHtml =
2749                "<a class='btn secondary rightIcon small tag-bubble' data-tag data-value='publication-types' href='#' id='publicationCount'><span>Publication (" +
2750                publicationCount +
2751                ")</span></i></a>";
2752            $("#filter-tags").append(bubbleHtml);
2753        } else {
2754            $("#publicationCount").remove();
2755        }
2756        if (mediaGalleryCount > 0) {
2757            $("#mediaGalleryCount").remove();
2758            var bubbleHtml =
2759                "<a class='btn secondary rightIcon small tag-bubble' data-tag data-value='mediaGallery-types' href='#' id='mediaGalleryCount'><span>Media Gallery (" +
2760                mediaGalleryCount +
2761                ")</span></i></a>";
2762            $("#filter-tags").append(bubbleHtml);
2763        } else {
2764            $("#mediaGalleryCount").remove();
2765        }
2766        if (materialCount > 0) {
2767            $("#materialCount").remove();
2768            var bubbleHtml =
2769                "<a class='btn secondary rightIcon small tag-bubble' data-tag data-value='media-material' href='#' id='materialCount'><span>Media Material (" +
2770                materialCount +
2771                ")</span></i></a>";
2772            $("#filter-tags").append(bubbleHtml);
2773        } else {
2774            $("#materialCount").remove();
2775        }
2776        if (categoryCount > 0) {
2777            $("#categoryCount").remove();
2778            var bubbleHtml =
2779                "<a class='btn secondary rightIcon small tag-bubble' data-tag data-value='category' href='#' id='categoryCount'><span>Category (" +
2780                categoryCount +
2781                ")</span></i></a>";
2782            $("#filter-tags").append(bubbleHtml);
2783        } else {
2784            $("#categoryCount").remove();
2785        }
2786        if (membershipCount > 0) {
2787            $("#membershipCount").remove();
2788            var bubbleHtml =
2789                "<a class='btn secondary rightIcon small tag-bubble' data-tag data-value='membership-type' href='#' id='membershipCount'><span>Membership (" +
2790                membershipCount +
2791                ")</span></i></a>";
2792            $("#filter-tags").append(bubbleHtml);
2793        } else {
2794            $("#membershipCount").remove();
2795        }
2796    };
2797
2798    //on tag bubble click, reset check boxes and remove clear button, if no check box selected remove apply all ans clear all button
2799    $("#filter-tags").on("click", ".tag-bubble", function () {
2800        var filterName = $(this).attr("data-value");
2801        if (filterName === "date") {
2802            var dateFromDefault = $("[date-from-dropdown]").attr(
2803                "data-select-calendar"
2804            );
2805            var dateToDefault = $("[date-to-dropdown]").attr("data-select-calendar");
2806            var accordionWrap = $("[data-select-calendar]").closest(
2807                ".accordion-item"
2808            );
2809            $("[date-from-dropdown] button span").text(dateFromDefault);
2810            $("[date-to-dropdown] button span").text(dateToDefault);
2811            $("[data-select-calendar] .dropdown-item.active").removeClass("active");
2812            $(
2813                '[date-from-dropdown] .dropdown-item:contains("' +
2814                dateFromDefault +
2815                '")'
2816            ).addClass("active");
2817            $(
2818                '[date-to-dropdown] .dropdown-item:contains("' + dateToDefault + '")'
2819            ).addClass("active");
2820            accordionWrap.find(".clear-btn").hide();
2821        } else {
2822            $('input[name="' + filterName + '"]').each(function () {
2823                this.checked = false;
2824            });
2825        }
2826        var parentId = $(filterAccordion + " input[name='" + filterName + "']")
2827            .closest(".accordion-collapse ")
2828            .attr("id");
2829        $("#" + parentId + " .clear-btn").hide();
2830
2831        if ($(filterAccordion + " input[type='checkbox']:checked ").length == 0) {
2832            $(".filter-btn-container").hide();
2833        }
2834
2835        $(this).remove();
2836        if ($(this).attr("id")) {
2837            $(".childCheckbox").prop("checked", false);
2838        }
2839
2840        resetPagination();
2841        var pageData = getPageData();
2842        fetchData(page, pageData);
2843
2844        if ($(window).width() < 992) {
2845            var filterCount =
2846                $(".filter-mb input:checkbox:checked").length + $("#dateCount").length;
2847            if (filterCount > 0) {
2848                $(".filter-button strong").find("span").remove();
2849                $(".filter-button strong").append(
2850                    "<span class='filterCount'> (" + filterCount + ")</span>"
2851                );
2852                $(".filter-button").addClass("active");
2853            } else {
2854                $(".filter-button strong").find("span").remove();
2855                $(".filter-button").removeClass("active");
2856            }
2857        }
2858    });
2859
2860    //Call fetchData function
2861
2862    $(".dropdown-cmp .dropdown-item").on("click", function (e) {
2863        e.preventDefault();
2864        if ($(this).closest("[data-select-calendar]").length > 0) {
2865            $(this)
2866                .closest(".dropdown-menu")
2867                .find(".dropdown-item.active")
2868                .removeClass("active");
2869            $(this).addClass("active");
2870            $(this)
2871                .closest(".dropdown-cmp")
2872                .find(".dropdown-toggle span")
2873                .text($(this).text());
2874            var clearBtn = $(this).closest(".accordion-item").find(".clear-btn");
2875            clearBtn.show();
2876            $(".clear-all-btn").show();
2877            $(".filter-btn-container").show();
2878
2879            $("#dateCount").remove();
2880            var bubbleHtml =
2881                "<a class='btn secondary rightIcon small tag-bubble' data-tag data-value='date' href='#' id='dateCount'><span>Date</span></i></a>";
2882            $("#filter-tags").append(bubbleHtml);
2883            $(".filter-button").addClass("active");
2884
2885            var pageData = getPageData();
2886            resetPagination();
2887            fetchData(page, pageData);
2888        } else {
2889            $(this)
2890                .closest(".dropdown-menu")
2891                .find(".dropdown-item.active")
2892                .removeClass("active");
2893            $(this).addClass("active");
2894            $(this)
2895                .closest(".dropdown-cmp")
2896                .find(".dropdown-toggle span")
2897                .text($(this).text());
2898            var pageData = getPageData();
2899            resetPagination();
2900            fetchData(page, pageData);
2901        }
2902    });
2903
2904    //Return page data to create payload
2905    var getPageData = () => {
2906        var pageData = [];
2907
2908        var expertise = new Array();
2909        $(
2910            "input[name='expertise']:checked:not(.filter-mb input[name='expertise']:checked)"
2911        ).each(function () {
2912            expertise.push($(this).val());
2913        });
2914
2915        // $("input[name='expertise']:checked").each(function () {
2916        //   expertise.push($(this).val());
2917        // });
2918
2919        var subexpertise = new Array();
2920        $(
2921            "input[name='subexpertise']:checked:not(.filter-mb input[name='subexpertise']:checked)"
2922        ).each(function () {
2923            subexpertise.push($(this).val());
2924        });
2925
2926        if ($(window).width() < 992) {
2927            expertise.splice(0, expertise.length);
2928            subexpertise.splice(0, subexpertise.length);
2929            $(".filter-mb input[name='subexpertise']:checked").each(function () {
2930                subexpertise.push($(this).val());
2931            });
2932            $(".filter-mb input[name='subexpertise']:checked").each(function () {
2933                subexpertise.push($(this).val());
2934            });
2935        }
2936        // $("input[name='subexpertise']:checked").each(function () {
2937        //   subexpertise.push($(this).val());
2938        // });
2939
2940        var experience = new Array();
2941        $("input[name='experience']:checked").each(function () {
2942            experience.push($(this).val());
2943        });
2944
2945        var industry = new Array();
2946        $("input[name='industry']:checked").each(function () {
2947            industry.push($(this).val());
2948        });
2949
2950        var company = new Array();
2951        $("input[name='company']:checked").each(function () {
2952            company.push($(this).val());
2953        });
2954
2955        var pillars = new Array();
2956        $("input[name='pillars']:checked").each(function () {
2957            pillars.push($(this).val());
2958        });
2959
2960        var topics = new Array();
2961        $("input[name='topics']:checked").each(function () {
2962            topics.push($(this).val());
2963        });
2964
2965        var audience = new Array();
2966        $("input[name='audience']:checked").each(function () {
2967            audience.push($(this).val());
2968        });
2969
2970        var accreditation = new Array();
2971        $(
2972            "input[name='accreditation']:checked:not(.filter-mb input[name='accreditation']:checked)"
2973        ).each(function () {
2974            accreditation.push($(this).val());
2975        });
2976
2977        var institution = new Array();
2978        $(
2979            "input[name='institution']:checked:not(.filter-mb input[name='institution']:checked)"
2980        ).each(function () {
2981            institution.push($(this).val());
2982        });
2983
2984        var membertype = new Array();
2985        $(
2986            "input[name='membertype']:checked:not(.filter-mb input[name='membertype']:checked)"
2987        ).each(function () {
2988            membertype.push($(this).val());
2989        });
2990
2991        var location = new Array();
2992        $("input[name='location']:checked").each(function () {
2993            location.push($(this).attr("data-key"));
2994        });
2995
2996        var price = new Array();
2997        $("input[name='price']:checked").each(function () {
2998            price.push($(this).attr("data-key"));
2999        });
3000
3001        var publications = new Array();
3002        $("input[name='publication-types']:checked").each(function () {
3003            publications.push($(this).val());
3004        });
3005
3006        var mediaGallery = new Array();
3007        $("input[name='mediaGallery-types']:checked").each(function () {
3008            mediaGallery.push($(this).val());
3009        });
3010
3011        var mediaMaterial = new Array();
3012        $("input[name='media-material']:checked").each(function () {
3013            mediaMaterial.push($(this).val());
3014        });
3015
3016        var category = new Array();
3017        $("input[name='category']:checked").each(function () {
3018            category.push($(this).val());
3019        });
3020
3021        var membership = new Array();
3022        $("input[name='membership-type']:checked").each(function () {
3023            membership.push($(this).val());
3024        });
3025
3026        if ($("#list-section").attr("data-pagetype") == "Professionals") {
3027            var queryString = generateQueryString(
3028                expertise.join("|"),
3029                subexpertise.join("|"),
3030                accreditation.join("|"),
3031                institution.join("|"),
3032                membertype.join("|")
3033            );
3034            var currentURL = window.location.href;
3035            window.history.replaceState(
3036                {},
3037                document.title,
3038                window.location.origin + window.location.pathname + "?" + queryString
3039            );
3040        }
3041        var dateFrom = new Array();
3042        var dateTo = new Array();
3043
3044        if ($(window).width() > 991) {
3045            $("#dateFromBtn").each(function () {
3046                dateFrom.push($(this).find("span").text());
3047            });
3048            $("#dateToBtn").each(function () {
3049                dateTo.push($(this).find("span").text());
3050            });
3051        } else {
3052            $("#dateFromBtnMb").each(function () {
3053                dateFrom.push($(this).find("span").text());
3054            });
3055            $("#dateToBtnMb").each(function () {
3056                dateTo.push($(this).find("span").text());
3057            });
3058        }
3059
3060        if ($("#page-sorting-dropdown .dropdown-item.active").length > 0) {
3061            sortorder = $("#page-sorting-dropdown .dropdown-item.active").data(
3062                "value"
3063            );
3064        }
3065        pageData["sortorder"] = sortorder;
3066
3067        if ($("#page-count-dropdown .dropdown-item.active").length > 0) {
3068            results = $("#page-count-dropdown .dropdown-item.active").data("value");
3069        }
3070        pageData["results"] = results;
3071
3072        expertise.length > 0 && (pageData["expertise"] = getString(expertise));
3073        subexpertise.length > 0 &&
3074            (pageData["subexpertise"] = getString(subexpertise));
3075        accreditation.length > 0 &&
3076            (pageData["accreditation"] = getString(accreditation));
3077        institution.length > 0 &&
3078            (pageData["institution"] = getString(institution));
3079        membertype.length > 0 && (pageData["membertype"] = getString(membertype));
3080        experience.length > 0 && (pageData["experience"] = getString(experience));
3081        industry.length > 0 && (pageData["industry"] = getString(industry));
3082        company.length > 0 && (pageData["company"] = getString(company));
3083        pillars.length > 0 && (pageData["pillars"] = getString(pillars));
3084        topics.length >
3084 0 && (pageData["topics"] = getString(topics));
3085        audience.length > 0 && (pageData["audience"] = getString(audience));
3086        location.length > 0 && (pageData["location"] = getString(location));
3087        price.length > 0 && (pageData["price"] = getString(price));
3088        dateFrom.length > 0 && (pageData["dateFrom"] = getString(dateFrom));
3089        dateTo.length > 0 && (pageData["dateTo"] = getString(dateTo));
3090        publications.length > 0 &&
3091            (pageData["publications"] = getString(publications));
3092        mediaGallery.length > 0 &&
3093            (pageData["mediaGallery"] = getString(mediaGallery));
3094        mediaMaterial.length > 0 &&
3095            (pageData["mediaMaterial"] = getString(mediaMaterial));
3096        category.length > 0 && (pageData["category"] = getString(category));
3097        membership.length > 0 && (pageData["membership"] = getString(membership));
3098
3099        if (window.location.search.indexOf("membersonly=true") > -1) {
3100            pageData["membersonly"] = true;
3101        }
3102
3103        return pageData;
3104    };
3105    //Clear all button click will uncheck all checkboxes and remove tag bubbles
3106    $(filterAccordion + " .clear-all-btn").on("click", function (e) {
3107        e.preventDefault();
3108        $(filterAccordion + " .accordion-body ul .form-check-input").prop(
3109            "checked",
3110            false
3111        );
3112        var pageData = [];
3113        if (
3114            $("[date-from-dropdown]").length > 0 &&
3115            $("[date-from-dropdown]").length > 0
3116        ) {
3117            var dateFromDefault = $("[date-from-dropdown]").attr(
3118                "data-select-calendar"
3119            );
3120            var dateToDefault = $("[date-to-dropdown]").attr("data-select-calendar");
3121            $("[date-from-dropdown]:visible button span").text(
3122                $("[date-from-dropdown]").attr("data-select-calendar")
3123            );
3124            $("[date-to-dropdown]:visible button span").text(
3125                $("[date-to-dropdown]").attr("data-select-calendar")
3126            );
3127            $("[data-select-calendar] .dropdown-item.active").removeClass("active");
3128            $(
3129                '[date-from-dropdown] .dropdown-item:contains("' +
3130                dateFromDefault +
3131                '")'
3132            ).addClass("active");
3133            $(
3134                '[date-to-dropdown] .dropdown-item:contains("' + dateToDefault + '")'
3135            ).addClass("active");
3136            pageData["dateFrom"] = $("[date-from-dropdown]").attr(
3137                "data-select-calendar"
3138            );
3139            pageData["dateTo"] = $("[date-to-dropdown]").attr("data-select-calendar");
3140        }
3141        if ($(window).width() > 992) {
3142            $(filterAccordion + " .accordion-collapse").collapse("hide");
3143        }
3144
3145        $(".filter-btn-container").hide();
3146        $(filterAccordion + " .clear-btn").hide();
3147        $("#filter-tags").empty();
3148
3149        resetPagination();
3150        fetchData(1, pageData);
3151    });
3152
3153    //Clear all button click will uncheck all checkboxes and remove tag bubbles for mobile
3154    $(".clear-all-btn-mb").on("click", function (e) {
3155        e.preventDefault();
3156        $(filterAccordion + " .accordion-body ul .form-check-input").prop(
3157            "checked",
3158            false
3159        );
3160        var pageData = [];
3161        if (
3162            $("[date-from-dropdown]").length > 0 &&
3163            $("[date-from-dropdown]").length > 0
3164        ) {
3165            var dateFromDefault = $("[date-from-dropdown]").attr(
3166                "data-select-calendar"
3167            );
3168            var dateToDefault = $("[date-to-dropdown]").attr("data-select-calendar");
3169            $("[date-from-dropdown]:visible button span").text(dateFromDefault);
3170            $("[date-to-dropdown]:visible button span").text(dateToDefault);
3171            $("[data-select-calendar] .dropdown-item.active").removeClass("active");
3172            $(
3173                '[date-from-dropdown] .dropdown-item:contains("' +
3174                dateFromDefault +
3175                '")'
3176            ).addClass("active");
3177            $(
3178                '[date-to-dropdown] .dropdown-item:contains("' + dateToDefault + '")'
3179            ).addClass("active");
3180            pageData["dateFrom"] = $("[date-from-dropdown]").attr(
3181                "data-select-calendar"
3182            );
3183            pageData["dateTo"] = $("[date-to-dropdown]").attr("data-select-calendar");
3184        }
3185        if ($(window).width() > 992) {
3186            $(filterAccordion + " .accordion-collapse").collapse("hide");
3187        }
3188
3189        $(".filter-btn-container").hide();
3190        $(filterAccordion + " .clear-btn").hide();
3191        $("#filter-tags").empty();
3192
3193        $(".filter-button strong").find("span").remove();
3194        $(".filter-button").removeClass("active");
3195
3196        resetPagination();
3197        fetchData(1, pageData);
3198    });
3199
3200    //Reset pagination
3201    var resetPagination = () => {
3202        pagination.empty();
3203        pagination.removeData("twbs-pagination");
3204        pagination.unbind("page");
3205    };
3206
3207    //Get string with | saperator
3208    var getString = (arr) => {
3209        return arr.join("|");
3210    };
3211
3212    //Apply button click event - mobile filter
3213    $(".filter-apply-btn-mb").on("click", function () {
3214        var checkCheckboxLength = $(".filter-mb input:checkbox:checked").length;
3215
3216        if (checkCheckboxLength > 0 || $("#dateCount").length > 0) {
3217            var filterCount = checkCheckboxLength + $("#dateCount").length;
3218            $(".filter-button strong").find("span").remove();
3219            $(".filter-button strong").append(
3220                "<span class='filterCount'> (" + filterCount + ")</span>"
3221            );
3222            $(".filter-button").addClass("active");
3223        } else {
3224            $(".filter-button strong").find("span").remove();
3225            $(".filter-button").removeClass("active");
3226        }
3227        var pageData = getPageDataMB();
3228        resetPagination();
3229        fetchData(page, pageData);
3230    });
3231
3232    //Get page data for mobile to create payload
3233    var getPageDataMB = () => {
3234        var pageData = [],
3235            page = 1;
3236
3237        var expertise = new Array();
3238        $(".filter-mb input[name='expertise']:checked").each(function () {
3239            expertise.push($(this).val());
3240        });
3241
3242        var subexpertise = new Array();
3243        $(".filter-mb input[name='subexpertise']:checked").each(function () {
3244            subexpertise.push($(this).val());
3245        });
3246
3247        var experience = new Array();
3248        $(".filter-mb input[name='experience']:checked").each(function () {
3249            experience.push($(this).val());
3250        });
3251
3252        var industry = new Array();
3253        $(".filter-mb input[name='industry']:checked").each(function () {
3254            industry.push($(this).val());
3255        });
3256
3257        var company = new Array();
3258        $(".filter-mb input[name='company']:checked").each(function () {
3259            company.push($(this).val());
3260        });
3261
3262        var pillars = new Array();
3263        $(".filter-mb input[name='pillars']:checked").each(function () {
3264            pillars.push($(this).attr("data-key"));
3265        });
3266
3267        var topics = new Array();
3268        $(".filter-mb input[name='topics']:checked").each(function () {
3269            topics.push($(this).val());
3270        });
3271
3272        var audience = new Array();
3273        $(".filter-mb input[name='audience']:checked").each(function () {
3274            audience.push($(this).val());
3275        });
3276
3277        var accreditation = new Array();
3278        $(".filter-mb input[name='accreditation']:checked").each(function () {
3279            accreditation.push($(this).val());
3280        });
3281
3282        var institution = new Array();
3283        $(".filter-mb input[name='institution']:checked").each(function () {
3284            institution.push($(this).val());
3285        });
3286
3287        var membertype = new Array();
3288        $(".filter-mb input[name='membertype']:checked").each(function () {
3289            membertype.push($(this).val());
3290        });
3291
3292        var location = new Array();
3293        $(".filter-mb input[name='location']:checked").each(function () {
3294            location.push($(this).attr("data-key"));
3295        });
3296
3297        var price = new Array();
3298        $(".filter-mb input[name='price']:checked").each(function () {
3299            price.push($(this).attr("data-key"));
3300        });
3301
3302        var publications = new Array();
3303        $(".filter-mb input[name='publication-types']:checked").each(function () {
3304            publications.push($(this).val());
3305        });
3306
3307        var mediaGallery = new Array();
3308        $(".filter-mb input[name='mediaGallery-types']:checked").each(function () {
3309            mediaGallery.push($(this).val());
3310        });
3311
3312        var mediaMaterial = new Array();
3313        $(".filter-mb input[name='media-material']:checked").each(function () {
3314            mediaMaterial.push($(this).val());
3315        });
3316
3317        var dateFrom = new Array();
3318        $(".filter-mb #dateFromBtnMb").each(function () {
3319            dateFrom.push($(this).find("span").text());
3320        });
3321        var dateTo = new Array();
3322        $(".filter-mb #dateToBtnMb").each(function () {
3323            dateTo.push($(this).find("span").text());
3324        });
3325
3326        var category = new Array();
3327        $(".filter-mb input[name='category']:checked").each(function () {
3328            category.push($(this).val());
3329        });
3330
3331        var membership = new Array();
3332        $(".filter-mb input[name='membership-type']:checked").each(function () {
3333            membership.push($(this).val());
3334        });
3335
3336        sortorder = $('.filter-mb input[name="sortingOption"]:checked').val();
3337        pageData["sortorder"] = sortorder;
3338        if ($("#page-count-dropdown .dropdown-item.active").length > 0) {
3339            results = $("#page-count-dropdown .dropdown-item.active").data("value");
3340        }
3341        pageData["results"] = results;
3342
3343        if ($("#list-section").attr("data-pagetype") == "Professionals") {
3344            var queryString = generateQueryString(
3345                expertise.join("|"),
3346                subexpertise.join("|"),
3347                accreditation.join("|"),
3348                institution.join("|"),
3349                membertype.join("|")
3350            );
3351            var currentURL = window.location.href;
3352            window.history.replaceState(
3353                {},
3354                document.title,
3355                window.location.origin + window.location.pathname + "?" + queryString
3356            );
3357        }
3358
3359        if ($("#list-section").attr("data-pagetype") == "Deals") {
3360
3361            var queryString = generateDealsQueryString(
3362                category.join("|"),
3363                membership.join("|")
3364            );
3365
3366            window.history.replaceState(
3367                {},
3368                document.title,
3369                window.location.origin + window.location.pathname +
3370                (queryString ? '?' + queryString : '')
3371            );
3372        }
3373        expertise.length > 0 && (pageData["expertise"] = getString(expertise));
3374        subexpertise.length > 0 &&
3375            (pageData["subexpertise"] = getString(subexpertise));
3376        accreditation.length > 0 &&
3377            (pageData["accreditation"] = getString(accreditation));
3378        institution.length > 0 &&
3379            (pageData["institution"] = getString(institution));
3380        membertype.length > 0 && (pageData["membertype"] = getString(membertype));
3381        experience.length > 0 && (pageData["experience"] = getString(experience));
3382        industry.length > 0 && (pageData["industry"] = getString(industry));
3383        company.length > 0 && (pageData["company"] = getString(company));
3384        pillars.length > 0 && (pageData["pillars"] = getString(pillars));
3385        topics.length >
3385 0 && (pageData["topics"] = getString(topics));
3386        audience.length > 0 && (pageData["audience"] = getString(audience));
3387        location.length > 0 && (pageData["location"] = getString(location));
3388        price.length > 0 && (pageData["price"] = getString(price));
3389        dateFrom.length > 0 && (pageData["dateFrom"] = getString(dateFrom));
3390        dateTo.length > 0 && (pageData["dateTo"] = getString(dateTo));
3391        publications.length > 0 &&
3392            (pageData["publications"] = getString(publications));
3393        mediaGallery.length > 0 &&
3394            (pageData["mediaGallery"] = getString(mediaGallery));
3395        mediaMaterial.length > 0 &&
3396            (pageData["mediaMaterial"] = getString(mediaMaterial));
3397        category.length > 0 && (pageData["category"] = getString(category));
3398        membership.length > 0 && (pageData["membership"] = getString(membership));
3399        if (window.location.search.indexOf("membersonly=true") > -1) {
3400            pageData["membersonly"] = true;
3401        }
3402        return pageData;
3403    };
3404
3405    //ResolveQuerystring
3406    if ($("#list-section").attr("data-pagetype") == "Professionals") {
3407        function decodeQueryString() {
3408            var queryString = window.location.search.slice(1); // Remove the leading '?'
3409            var params = new URLSearchParams(queryString);
3410
3411            var expertise = params.get("expertise");
3412            var subexpertise = params.get("subexpertise");
3413            var accreditation = params.get("accreditation");
3414            var institution = params.get("institution");
3415            var membertype = params.get("membertype");
3416
3417            // Decode values
3418            var decodedExpertise = expertise ? decodeURIComponent(expertise) : "";
3419            var decodedSubexpertise = subexpertise
3420                ? decodeURIComponent(subexpertise)
3421                : "";
3422            var decodedAccreditation = accreditation
3423                ? decodeURIComponent(accreditation)
3424                : "";
3425            var decodedInstitution = accreditation
3426                ? decodeURIComponent(institution)
3427                : "";
3428            var decodedMemberType = membertype ? decodeURIComponent(membertype) : "";
3429
3430            if (
3431                expertise == null &&
3432                subexpertise == null &&
3433                accreditation == null &&
3434                institution == null &&
3435                membertype == null
3436            )
3437                return;
3438            // Convert pipe-separated strings to arrays
3439            var expertiseArray = decodedExpertise.split("|");
3440            var subexpertiseArray = decodedSubexpertise.split("|");
3441            var accreditationArray = decodedAccreditation.split("|");
3442            var institutionArray = decodedInstitution.split("|");
3443            var membertypeArray = decodedMemberType.split("|");
3444
3445            if ($(window).width() > 992) {
3446                $(".filter-cmp .accordion-body input[name='expertise'].parentCheckbox")
3447                    .filter(function () {
3448                        if (expertise != null && expertise.includes($(this).val())) {
3449                            $(this)
3450                                .closest(".nested-filter-li")
3451                                .find(".childCheckbox")
3452                                .prop("checked", true);
3453                            $(this)
3454                                .closest(".nested-filter-li")
3455                                .find(".nested-filters")
3456                                .attr("style", "padding-top: 20px; max-height: 1000px;");
3457                            $(this)
3458                                .closest(".nested-filter-li")
3459                                .find(".toggle-icon")
3460                                .removeClass("ri-add-line")
3461                                .addClass("ri-subtract-line");
3462                            return expertise.includes($(this).val());
3463                        }
3464                    })
3465                    .prop("checked", true);
3466
3467                $(".filter-cmp .accordion-body input[name='accreditation']")
3468                    .not(
3469                        ".filter-mb .filter-cmp .accordion-body input[name='accreditation']"
3470                    )
3471                    .filter(function () {
3472                        if (
3473                            accreditation != null &&
3474                            accreditation.includes($(this).val())
3475                        ) {
3476                            $(this)
3477                                .closest(".nested-filter-li")
3478                                .find(".childCheckbox")
3479                                .prop("checked", true);
3480                            $(this)
3481                                .closest(".nested-filter-li")
3482                                .find(".nested-filters")
3483                                .attr("style", "padding-top: 20px; max-height: 1000px;");
3484                            $(this)
3485                                .closest(".nested-filter-li")
3486                                .find(".toggle-icon")
3487                                .removeClass("ri-add-line")
3488                                .addClass("ri-subtract-line");
3489                            return accreditation.includes($(this).val());
3490                        }
3491                    })
3492                    .prop("checked", true);
3493
3494                $(".filter-cmp .accordion-body input[name='institution']")
3495                    .not(
3496                        ".filter-mb .filter-cmp .accordion-body input[name='institution']"
3497                    )
3498                    .filter(function () {
3499                        if (institution != null && institution.includes($(this).val())) {
3500                            $(this)
3501                                .closest(".nested-filter-li")
3502                                .find(".childCheckbox")
3503                                .prop("checked", true);
3504                            $(this)
3505                                .closest(".nested-filter-li")
3506                                .find(".nested-filters")
3507                                .attr("style", "padding-top: 20px; max-height: 1000px;");
3508                            $(this)
3509                                .closest(".nested-filter-li")
3510                                .find(".toggle-icon")
3511                                .removeClass("ri-add-line")
3512                                .addClass("ri-subtract-line");
3513                            return institution.includes($(this).val());
3514                        }
3515                    })
3516                    .prop("checked", true);
3517
3518                $(".filter-cmp .accordion-body input[name='membertype']")
3519                    .not(
3520                        ".filter-mb .filter-cmp .accordion-body input[name='membertype']"
3521                    )
3522                    .filter(function () {
3523                        if (membertype != null && membertype.includes($(this).val())) {
3524                            $(this)
3525                                .closest(".nested-filter-li")
3526                                .find(".childCheckbox")
3527                                .prop("checked", true);
3528                            $(this)
3529                                .closest(".nested-filter-li")
3530                                .find(".nested-filters")
3531                                .attr("style", "padding-top: 20px; max-height: 1000px;");
3532                            $(this)
3533                                .closest(".nested-filter-li")
3534                                .find(".toggle-icon")
3535                                .removeClass("ri-add-line")
3536                                .addClass("ri-subtract-line");
3537                            return membertype.includes($(this).val());
3538                        }
3539                    })
3540                    .prop("checked", true);
3541            } else {
3542                $(
3543                    ".filter-mb .filter-cmp .accordion-body input[name='expertise'].parentCheckbox"
3544                )
3545                    .filter(function () {
3546                        if (expertise != null && expertise.includes($(this).val())) {
3547                            $(this)
3548                                .closest(".nested-filter-li")
3549                                .find(".childCheckbox")
3550                                .prop("checked", true);
3551                            $(this)
3552                                .closest(".nested-filter-li")
3553                                .find(".nested-filters")
3554                                .attr("style", "padding-top: 20px; max-height: 1000px;");
3555                            $(this)
3556                                .closest(".nested-filter-li")
3557                                .find(".toggle-icon")
3558                                .removeClass("ri-add-line")
3559                                .addClass("ri-subtract-line");
3560                            return expertise.includes($(this).val());
3561                        }
3562                    })
3563                    .prop("checked", true);
3564
3565                $(".filter-mb .filter-cmp .accordion-body input[name='accreditation']")
3566                    .filter(function () {
3567                        if (
3568                            accreditation != null &&
3569                            accreditation.includes($(this).val())
3570                        ) {
3571                            $(this)
3572                                .closest(".nested-filter-li")
3573                                .find(".childCheckbox")
3574                                .prop("checked", true);
3575                            $(this)
3576                                .closest(".nested-filter-li")
3577                                .find(".nested-filters")
3578                                .attr("style", "padding-top: 20px; max-height: 1000px;");
3579                            $(this)
3580                                .closest(".nested-filter-li")
3581                                .find(".toggle-icon")
3582                                .removeClass("ri-add-line")
3583                                .addClass("ri-subtract-line");
3584                            return accreditation.includes($(this).val());
3585                        }
3586                    })
3587                    .prop("checked", true);
3588
3589                $(".filter-mb .filter-cmp .accordion-body input[name='institution']")
3590                    .filter(function () {
3591                        if (institution != null && institution.includes($(this).val())) {
3592                            $(this)
3593                                .closest(".nested-filter-li")
3594                                .find(".childCheckbox")
3595                                .prop("checked", true);
3596                            $(this)
3597                                .closest(".nested-filter-li")
3598                                .find(".nested-filters")
3599                                .attr("style", "padding-top: 20px; max-height: 1000px;");
3600                            $(this)
3601                                .closest(".nested-filter-li")
3602                                .find(".toggle-icon")
3603                                .removeClass("ri-add-line")
3604                                .addClass("ri-subtract-line");
3605                            return institution.includes($(this).val());
3606                        }
3607                    })
3608                    .prop("checked", true);
3609
3610                $(".filter-mb .filter-cmp .accordion-body input[name='membertype']")
3611                    .filter(function () {
3612                        if (membertype != null && membertype.includes($(this).val())) {
3613                            $(this)
3614                                .closest(".nested-filter-li")
3615                                .find(".childCheckbox")
3616                                .prop("checked", true);
3617                            $(this)
3618                                .closest(".nested-filter-li")
3619                                .find(".nested-filters")
3620                                .attr("style", "padding-top: 20px; max-height: 1000px;");
3621                            $(this)
3622                                .closest(".nested-filter-li")
3623                                .find(".toggle-icon")
3624                                .removeClass("ri-add-line")
3625                                .addClass("ri-subtract-line");
3626                            return membertype.includes($(this).val());
3627                        }
3628                    })
3629                    .prop("checked", true);
3630            }
3631
3632            $(".filter-cmp .accordion-body input[name='subexpertise'].childCheckbox")
3633                .filter(function () {
3634                    if (subexpertise != null && subexpertise.includes($(this).val())) {
3635                        $(this)
3636                            .closest(".nested-filter-li")
3637                            .find(".nested-filters")
3638                            .attr("style", "padding-top: 20px; max-height: 1000px;");
3639                        $(this)
3640                            .closest(".nested-filter-li")
3641                            .find(".toggle-icon")
3642                            .removeClass("ri-add-line")
3643                            .addClass("ri-subtract-line");
3644                        return subexpertiseArray.includes($(this).val());
3645                    }
3646                })
3647                .prop("checked", true);
3648
3649            if ($(window).width() > 992) {
3650                $(".filter-mb .form-check-input.childCheckbox").prop("checked", false);
3651                $(".filter-mb input[name=expertise]:checked").prop("checked", false);
3652                var pageData = getPageData();
3653                resetPagination();
3654                fetchData(page, pageData);
3655            } else {
3656                var pageData = getPageDataMB();
3657                resetPagination();
3658                fetchData(page, pageData);
3659            }
3660        }
3661
3662        // Call the function on page load
3663        decodeQueryString();
3664    }
3665    if ($("#list-section").attr("data-pagetype") == "Deals") {
3666
3667        function decodeDealsQueryString() {
3668
3669            var params = new URLSearchParams(window.location.search);
3670
3671            var category = params.get("category");
3672            var membership = params.get("membership");
3673
3674            if (!category && !membership)
3675                return;
3676            var categoryArray = category
3677                ? decodeURIComponent(category).split("|").map(function (x) {
3678                    return x.toLowerCase();
3679                })
3680                : [];
3681
3682            var membershipArray = membership
3683                ? decodeURIComponent(membership).split("|").map(function (x) {
3684                    return x.toLowerCase();
3685                })
3686                : [];
3687
3688            if ($(window).width() > 992) {
3689
3690                $(".filter-cmp input[name='category']")
3691                    .not(".filter-mb input[name='category']")
3692                    .filter(function () {
3693                        return categoryArray.includes($(this).val().toLowerCase());
3694                    })
3695                    .prop("checked", true);
3696
3697                $(".filter-cmp input[name='membership-type']")
3698                    .not(".filter-mb input[name='membership-type']")
3699                    .filter(function () {
3700                        return membershipArray.includes($(this).val().toLowerCase());
3701                    })
3702                    .prop("checked", true);
3703            }
3704            else {
3705
3706                $(".filter-mb input[name='category']")
3707                    .filter(function () {
3708                        return categoryArray.includes($(this).val().toLowerCase());
3709                    })
3710                    .prop("checked", true);
3711
3712                $(".filter-mb input[name='membership-type']")
3713                    .filter(function () {
3714                        return membershipArray.includes($(this).val().toLowerCase());
3715                    })
3716                    .prop("checked", true);
3717            }
3718            $(".accordion-collapse").each(function () {
3719
3720                if ($(this).find("input:checkbox:checked").length > 0) {
3721                    $(this).find(".clear-btn").show();
3722                }
3723                else {
3724                    $(this).find(".clear-btn").hide();
3725                }
3726            });
3727
3728            $(".filter-btn-container").toggle(
3729                $("input:checkbox:checked").length > 0
3730            );
3731
3732            if ($(window).width() > 992) {
3733                var pageData = getPageData();
3734                resetPagination();
3735                fetchData(page, pageData);
3736            } else {
3737                var pageData = getPageDataMB();
3738                resetPagination();
3739                fetchData(page, pageData);
3740            }
3741        }
3742
3743        decodeDealsQueryString();
3744    }
3745    //Two level checkbox
3746    $(
3747        filterAccordion +
3748        " .accordion-body ul .nested-filter-li .form-check-input.parentCheckbox"
3749    ).on("click", function () {
3750        var parentId = $(this).closest(".accordion-collapse ").attr("id");
3751        $("#" + parentId)
3752            .find(".clear-btn")
3753            .hide();
3754        var checkboxName = $(this).attr("name");
3755        var chekedlengthByName = $(
3756            filterAccordion + " input[name='" + checkboxName + "']:checked"
3757        ).length;
3758
3759        if (chekedlengthByName > 0) {
3760            $("#" + parentId + " .clear-btn").show();
3761        } else {
3762            $("#" + parentId + " .clear-btn").hide();
3763            $(".tag-bubble[data-value='" + checkboxName + "']").remove();
3764        }
3765
3766        if ($(filterAccordion + " input:checkbox:checked").length > 0) {
3767            $(".filter-btn-container").show();
3768        } else {
3769            $(".filter-btn-container").hide();
3770        }
3771        var isChecked = $(this).prop("checked");
3772        $(this)
3773            .closest(".nested-filter-li")
3774            .find(".childCheckbox:not(.filter-mb)")
3775            .prop("checked", isChecked);
3776        //$(this).closest(".nested-filter-li").find(".filter-mb .childCheckbox").prop("checked", false);
3777        // API call only for desktop checkbox click
3778        if ($(window).width() > 992) {
3779            var pageData = getPageData();
3780            resetPagination();
3781            fetchData(page, pageData);
3782        }
3783    });
3784
3785    //Click on checkbox
3786    $(filterAccordion + " .accordion-body ul .form-check-input").on(
3787        "click",
3788        function () {
3789            var parentId = $(this).closest(".accordion-collapse ").attr("id");
3790            $("#" + parentId)
3791                .find(".clear-btn")
3792                .hide();
3793            var checkboxName = $(this).attr("name");
3794            var chekedlengthByName = $(
3795                filterAccordion + " input[name='" + checkboxName + "']:checked"
3796            ).length;
3797
3798            if (chekedlengthByName > 0) {
3799                $("#" + parentId + " .clear-btn").show();
3800            } else {
3801                $("#" + parentId + " .clear-btn").hide();
3802                $(".tag-bubble[data-value='" + checkboxName + "']").remove();
3803            }
3804
3805            if ($(filterAccordion + " input:checkbox:checked").length > 0) {
3806                $(".filter-btn-container").show();
3807            } else {
3808                $(".filter-btn-container").hide();
3809            }
3810            // API call only for desktop checkbox click
3811            if ($(window).width() > 992) {
3812                var pageData = getPageData();
3813                resetPagination();
3814                fetchData(page, pageData);
3815            }
3816        }
3817    );
3818
3819    //Click on clear button
3820    $(filterAccordion + " .clear-btn").on("click", function (e) {
3821        e.preventDefault();
3822        if (
3823            window.location.search.length > 0 &&
3824            $("#list-section").attr("data-pagetype") !== "Deals"
3825        ) {
3826            window.location.search = "";
3827        }
3828        var parentId = $(this).closest(".accordion-collapse ").attr("id");
3829        $(this).hide();
3830        var pageData = [];
3831        $("#" + parentId + " ul li").each(function () {
3832            $(this).find("input:checkbox").prop("checked", false);
3833            $(this).find("input:radio").prop("checked", false);
3834        });
3835        if (
3836            $(this).closest(".accordion-body").find("[data-select-calendar]").length >
3837            0
3838        ) {
3839            var dateFromDefault = $("[date-from-dropdown]").attr(
3840                "data-select-calendar"
3841            );
3842            var dateToDefault = $("[date-to-dropdown]").attr("data-select-calendar");
3843            $("[date-from-dropdown]:visible button span").text(dateFromDefault);
3844            $("[date-to-dropdown]:visible button span").text(dateToDefault);
3845            $("[data-select-calendar] .dropdown-item.active").removeClass("active");
3846            $(
3847                '[date-from-dropdown] .dropdown-item:contains("' +
3848                dateFromDefault +
3849                '")'
3850            ).addClass("active");
3851            $(
3852                '[date-to-dropdown] .dropdown-item:contains("' + dateToDefault + '")'
3853            ).addClass("active");
3854            pageData["dateFrom"] = $("[date-from-dropdown]").attr(
3855                "data-select-calendar"
3856            );
3857            pageData["dateTo"] = $("[date-to-dropdown]").attr("data-select-calendar");
3858            $("#dateCount").remove();
3859            $(this).hide();
3860            if ($(".clear-btn:visible").length < 1) {
3861                $(".clear-all-btn").hide();
3862            }
3863        }
3864        // API call only for desktop checkbox click
3865        if ($(window).width() >= 992) {
3866            pageData = getPageData();
3867            if (
3868                $(this).closest(".accordion-body").find("[data-select-calendar]")
3869                    .length > 0
3870            ) {
3871                pageData["dateFrom"] = $("[date-from-dropdown]").attr(
3872                    "data-select-calendar"
3873                );
3874                pageData["dateTo"] = $("[date-to-dropdown]").attr(
3875                    "data-select-calendar"
3876                );
3877            }
3878            resetPagination();
3879            fetchData(page, pageData);
3880
3881            if ($(filterAccordion + " input[type='checkbox']:checked").length == 0) {
3882                $(".filter-btn-container").hide();
3883            }
3884        }
3885    });
3886
3887    if ($("[data-deal]").length > 0 && performance.navigation.type != 2) {
3888        const publicationHash = decodeURI(window.location.hash).replace("#", "");
3889
3890        var arr = $("[data-deal]").filter(function () {
3891            return $(this).attr("data-deal") === publicationHash;
3892        });
3893
3894        if ($(window).width() > 991) {
3895            $(arr[0]).trigger("click");
3896            $(arr[0])
3897                .closest(".accordion-item")
3898                .find(".accordion-button")
3899                .trigger("click");
3900        } else {
3901            $(arr[1]).trigger("click");
3902            $(".filter-apply-btn-mb").trigger("click");
3903        }
3904    }
3905    if ($("[data-publication]").length > 0 && performance.navigation.type != 2) {
3906        const publicationHash = decodeURI(window.location.hash).replace("#", "");
3907
3908        var arr = $("[data-publication]").filter(function () {
3909            return $(this).attr("data-publication") === publicationHash;
3910        });
3911
3912        if ($(window).width() > 991) {
3913            $(arr[0]).trigger("click");
3914            $(arr[0])
3915                .closest(".accordion-item")
3916                .find(".accordion-button")
3917                .trigger("click");
3918        } else {
3919            $(arr[1]).trigger("click");
3920            $(".filter-apply-btn-mb").trigger("click");
3921        }
3922    }
3923    if (
3924        $("[data-media-material]").length > 0 &&
3925        performance.navigation.type != 2
3926    ) {
3927        const mediaMaterialHash = decodeURI(window.location.hash).replace("#", "");
3928        var arr = $("[data-media-material]").filter(function () {
3929            return $(this).attr("data-media-material") === mediaMaterialHash;
3930        });
3931        if ($(window).width() > 991) {
3932            $(arr[0]).trigger("click");
3933            $(arr[0])
3934                .closest(".accordion-item")
3935                .find(".accordion-button")
3936                .trigger("click");
3937        } else {
3938            $(arr[1]).trigger("click");
3939            $(".filter-apply-btn-mb").trigger("click");
3940        }
3941    }
3942
3943    if (
3944        decodeURI(window.location.search).indexOf("topic") > 0 ||
3945        decodeURI(window.location.search).indexOf("tag") > 0 ||
3946        decodeURI(window.location.search).indexOf("newstype") > 0
3947    ) {
3948        let searchText = decodeURI(window.location.search)
3949            .replace("?topic=", "")
3950            .replace("?tag=", "")
3951            .replace("?newstype=", "")
3952            .replace("&sc_lang=en", "");
3953        searchText = searchText.toLowerCase();
3954
3955        if (totalRecords == 0) {
3956            $(
3957                ".top-filter .wrapper, .top-filter-mb .count span, .filter-pagination-container"
3958            ).hide();
3959            $("#list-section .row").html("");
3960            var noRecordHtml =
3961                "<div class='col-12'><h3 data-no-records-found>No records found</h3></div>";
3962            $("#list-section .row").html("").append(noRecordHtml);
3963        }
3964        var arr = $('input[type="checkbox"]').filter(function () {
3965            return $(this).val().toLowerCase() === searchText;
3966        });
3967        if ($(window).width() > 991) {
3968            $(arr[0])
3969                .closest(".accordion-item")
3970                .find(".accordion-button.collapsed")
3971                .trigger("click");
3972            $(arr[0]).trigger("click");
3973        } else {
3974            $(arr[1]).trigger("click");
3975            $(".filter-apply-btn-mb").trigger("click");
3976        }
3977        renderCountBubble();
3978    }
3979
3980    if (performance.navigation.type == 2 && $("#list-section").length > 0) {
3981        // Filter is aready reset because landed to another Filter page before click on back button
3982        if (!localStorage.getItem("data-pagetype")) {
3983            renderResultCount(page, recPerPage, totalRecords, recPerPage);
3984            return;
3985        }
3986        if (
3987            localStorage.getItem("data-pagetype") &&
3988            localStorage.getItem("data-pagetype") !== pageType
3989        ) {
3990            renderResultCount(page, recPerPage, totalRecords, recPerPage);
3991            $(".accordion-button").on("click", function () {
3992                $('.filter-cmp input[type="checkbox"]:checked').prop("checked", false);
3993            });
3994            $(".filter-button").on("click", function () {
3995                $('.filter-cmp input[type="checkbox"]:checked').prop("checked", false);
3996            });
3997            // location.reload();
3998        } else {
3999            // Page keep its filter from previous time so need to reload data from localstorage
4000            var pageData = [];
4001            localStorage.getItem("pagenumber") &&
4002                (pageData["pagenumber"] = localStorage.getItem("pagenumber"));
4003            localStorage.getItem("sortorder") &&
4004                (pageData["sortorder"] = localStorage.getItem("sortorder"));
4005            localStorage.getItem("results") &&
4006                (pageData["results"] = localStorage.getItem("results"));
4007            localStorage.getItem("expertise") &&
4008                (pageData["expertise"] = localStorage.getItem("expertise"));
4009            localStorage.getItem("subexpertise") &&
4010                (pageData["subexpertise"] = localStorage.getItem("subexpertise"));
4011            localStorage.getItem("experience") &&
4012                (pageData["experience"] = localStorage.getItem("experience"));
4013            localStorage.getItem("industry") &&
4014                (pageData["industry"] = localStorage.getItem("industry"));
4015            localStorage.getItem("company") &&
4016                (pageData["company"] = localStorage.getItem("company"));
4017            localStorage.getItem("pillars") &&
4018                (pageData["pillars"] = localStorage.getItem("pillars"));
4019            localStorage.getItem("topics") &&
4020                (pageData["topics"] = localStorage.getItem("topics"));
4021            localStorage.getItem("audience") &&
4022                (pageData["audience"] = localStorage.getItem("audience"));
4023            localStorage.getItem("location") &&
4024                (pageData["location"] = localStorage.getItem("location"));
4025            localStorage.getItem("price") &&
4026                (pageData["price"] = localStorage.getItem("price"));
4027
4028            localStorage.getItem("dateTo") &&
4029                (pageData["dateTo"] = localStorage.getItem("dateTo"));
4030            localStorage.getItem("publications") &&
4031                (pageData["publications"] = localStorage.getItem("publications"));
4032            localStorage.getItem("mediaGallery") &&
4033                (pageData["mediaGallery"] = localStorage.getItem("mediaGallery"));
4034            localStorage.getItem("mediaMaterial") &&
4035                (pageData["mediaMaterial"] = localStorage.getItem("mediaMaterial"));
4036            localStorage.getItem("newsMediaMaterial") &&
4037                (pageData["newsMediaMaterial"] =
4038                    localStorage.getItem("newsMediaMaterial"));
4039            localStorage.getItem("category") &&
4040                (pageData["category"] = localStorage.getItem("category"));
4041            localStorage.getItem("membership") &&
4042                (pageData["membership"] = localStorage.getItem("membership"));
4043
4044            if ($("[data-select-calendar]").data("select-calendar")) {
4045                pageData["dateFrom"] = localStorage.getItem("dateFrom")
4046                    ? localStorage.getItem("dateFrom")
4047                    : $("[date-from-dropdown]").data("select-calendar");
4048                pageData["dateTo"] = localStorage.getItem("dateTo")
4049                    ? localStorage.getItem("dateTo")
4050                    : $("[date-to-dropdown]").data("select-calendar");
4051            }
4052            resetPagination();
4053            var pageNumber = localStorage.getItem("pagenumber")
4054                ? localStorage.getItem("pagenumber")
4055                : 1;
4056            fetchData(Number(pageNumber), pageData, Number(pageNumber));
4057
4058            applyDropdown($("#page-count-dropdown"), Number(pageData["results"]));
4059            applyDropdown($("#page-sorting-dropdown"), Number(pageData["sortorder"]));
4060
4061            if (pageData["dateFrom"]) {
4062                applyDropdownDate(
4063                    $(filterAccordion + " [date-from-dropdown]"),
4064                    pageData["dateFrom"]
4065                );
4066            }
4067            if (pageData["dateTo"]) {
4068                applyDropdownDate(
4069                    $(filterAccordion + " [date-to-dropdown]"),
4070                    pageData["dateTo"]
4071                );
4072            }
4073        }
4074    } else {
4075        renderResultCount(page, recPerPage, totalRecords, recPerPage);
4076    }
4077
4078    // refresh Filter page and it's Filter page
4079    if (performance.navigation.type == 1 && $("#list-section").length > 0) {
4080        localStorage.clear();
4081    }
4082    // land to new page by url and it's Filter page
4083    if (performance.navigation.type == 0 && $("#list-section").length > 0) {
4084        localStorage.clear();
4085        localStorage.setItem("data-pagetype", pageType);
4086    }
4087});
4088
4089function applyDropdown(dropdownId, dataValue) {
4090    dropdownId.find(".dropdown-item.active").removeClass("active");
4091    var newSelectedItem = dropdownId
4092        .find(".dropdown-item")
4093        .filter("[data-value=" + dataValue + "]");
4094    newSelectedItem.addClass("active");
4095    dropdownId.find(".dropdown-toggle span").text(newSelectedItem.text());
4096}
4097
4098function applyDropdownDate(dropdownId, value) {
4099    dropdownId.find(".dropdown-item.active").removeClass("active");
4100    var newSelectedItem = dropdownId.find(
4101        ".dropdown-item:contains(" + value + ")"
4102    );
4103    newSelectedItem.addClass("active");
4104    dropdownId.find(".dropdown-toggle span").text(newSelectedItem.text());
4105}
4106
4107// $(".parentCheckbox").change(function () {
4108//   var isChecked = $(this).prop("checked");
4109//   $(this).closest(".nested-filter-li").find(".childCheckbox").prop("checked", isChecked);
4110// });
4111
4112$(".childCheckbox").change(function () {
4113    if (
4114        $(this).closest(".nested-filter-li").find(".childCheckbox").length ===
4115        $(this).closest(".nested-filter-li").find(".childCheckbox:checked").length
4116    ) {
4117        $(this)
4118            .closest(".nested-filter-li")
4119            .find(".parentCheckbox")
4120            .prop("checked", true);
4121    } else {
4122        $(this)
4123            .closest(".nested-filter-li")
4124            .find(".parentCheckbox")
4125            .prop("checked", false);
4126    }
4127});
4128
4129function generateQueryString(
4130    expertise,
4131    subexpertise,
4132    accreditation,
4133    institution,
4134    membertype
4135) {
4136    var encodedExpertiseValue = expertise ? encodeURIComponent(expertise) : "";
4137    var encodedSubexpertiseValue = encodeURIComponent(subexpertise);
4138    var encodedAccreditationValue = encodeURIComponent(accreditation);
4139    var encodedInstitutionValue = encodeURIComponent(institution);
4140    var encodedMemberTypeValue = encodeURIComponent(membertype);
4141
4142    var newParameter = "";
4143    if (encodedExpertiseValue) {
4144        newParameter += "expertise=" + encodedExpertiseValue;
4145    }
4146    if (encodedSubexpertiseValue) {
4147        newParameter +=
4148            (newParameter.length > 0 ? "&" : "") + "subexpertise=" + subexpertise;
4149    }
4150    if (encodedAccreditationValue) {
4151        newParameter +=
4152            (newParameter.length > 0 ? "&" : "") + "accreditation=" + accreditation;
4153    }
4154    if (encodedInstitutionValue) {
4155        newParameter +=
4156            (newParameter.length > 0 ? "&" : "") + "institution=" + institution;
4157    }
4158    if (encodedMemberTypeValue) {
4159        newParameter +=
4160            (newParameter.length > 0 ? "&" : "") + "membertype=" + membertype;
4161    }
4162
4163    var updatedQueryString = newParameter;
4164
4165    return updatedQueryString;
4166}
4167function generateDealsQueryString(category, membership) {
4168
4169    var newParameter = "";
4170
4171    if (category) {
4172        newParameter += "category=" + encodeURIComponent(category).replace(/%7C/g, "|");
4173    }
4174
4175    if (membership) {
4176        newParameter +=
4177            (newParameter.length > 0 ? "&" : "") +
4178            "membership=" + encodeURIComponent(membership).replace(/%7C/g, "|");
4179    }
4180
4181    return newParameter;
4182}

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.