-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
649 lines (550 loc) · 29.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Search Engine</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/alpinejs/2.8.1/alpine.js" ></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
.out{
height: 100%;
max-height: 400px;
min-height: 0px;
overflow: auto;
}
.right {
/* position: sticky; */
right: 0px;
margin-right: 0px;
float: right;
}
.runthis{
cursor: pointer;
}
.lg\:max-w-lg {
width: 65vw !important;
}
.swal-wide{
width:850px !important;
}
</style>
</head>
<body class="bg-gray-100 w-full flex justify-center items-center">
<div class="container mx-auto">
<div class="w-full max-w-xlg mx-auto">
<input type="text" id="searchInput" placeholder="Search with anything..." class="w-full p-4 rounded-lg shadow-lg focus:ring-2 focus:ring-blue-500 focus:outline-none transition-all">
<ul id="searchResults" class="out mt-4 space-y-2"></ul>
<h3 class="text-3xl font-semibold mb-4">Activity Groups </h3>
<div id="groups" class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 xlg:grid-cols-8 gap-4"></div>
<div x-data="{ isOpen: false, data: '' }" id="popup" class="fixed inset-0 bg-gray-800 bg-opacity-75 flex items-center justify-center hidden">
<div class="bg-white p-6 rounded-lg shadow-xl">
<button @click="isOpen = false">×</button>
<div>
<h2>Data</h2>
<p x-text="data"></p>
</div>
</div>
</div>
</div>
</div>
<div class="fixed z-10 overflow-y-auto top-0 w-full left-0 hidden" id="modal">
<div class="flex items-center justify-center min-height-100vh pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 transition-opacity">
<div class="absolute inset-0 bg-gray-900 opacity-75" />
</div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen">​</span>
<div style="max-width: 90% !important; max-height: 100% !important; margin-top: 20px;" class="inline-block align-center bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle md:max-w-lg sm:w-full" role="dialog" aria-modal="true" aria-labelledby="modal-headline">
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<h1 class="text-3xl font-semibold mb-4"><span class="mti"></span></h1>
<input type="text" id="searchInput31" class="w-full p-4 rounded-lg shadow-lg focus:ring-2 focus:ring-blue-500 focus:outline-none transition-all" placeholder="Search Base On Current Category...">
<ul id="searchResults2" class="out mt-4 space-y-2"></ul>
</div>
<div class="bg-gray-200 px-4 py-3 text-right">
<button type="button" class="py-2 px-4 bg-gray-500 text-white rounded hover:bg-gray-700 mr-2" onclick="toggleModal()"><i class="fas fa-times"></i> Cancel</button>
</div>
</div>
</div>
</div>
<script src="https://cdn.socket.io/4.7.4/socket.io.min.js" integrity="sha384-Gr6Lu2Ajx28mzwyVR8CFkULdCU7kMlZ9UthllibdOSo6qAiN+yXNHqtgdTvFXMT4" crossorigin="anonymous"></script>
<script>
const socket = io();
function getIconForGroup(groupName) {
const keywordToIcon = {
"Agricultural": "🚜", // Tractor for agriculture
"Livestock Farming": "🐾", // Paw prints for livestock
"Charcoal Production": "🔥", // Fire for charcoal production
"Fishing": "🎣", // Fishing pole for fishing
"key duplicators & stamp making": "🔑", // Web for cotton & metal nets
"personal requisities repairing": "⚙️", // Web for cotton & metal nets
"Trasport, shipping and storage/ Tourism Activites": "🚛", // Web for cotton & metal nets
"Foodstuff mills and packaging": "🍜", // Web for cotton & metal nets
"Bread manufacturing": "🍞",
"Separate professional activities": "📢",
"Manufacturing of chemicals": "⚗️",
"Fodder and fertilizers manufacturing": "🏭",
"Waste collection and treatment": "🚮",
"water manufacturing and bottling": "🧴",
"Petroleum": "⛽", // Fuel pump for petroleum
"Metal Extraction": "⛏️", // Pickaxe for metal extraction
"Food industries": "🏭", // Factory for food industries
"Oil & Natural Gas": "🛢️", // Oil drum for oil and natural gas
"Professional Activities": "💼", // Briefcase for professional activities
"Meat processing": "🍖", // Meat on bone for meat processing
"Canning & Freezing": "❄️", // Snowflake for canning & freezing
"Mills and Packaging": "📦", // Box for mills and packaging
"Bread Manufacturing": "🍞", // Bread for bread manufacturing
"Restaurants": "🍴", // Fork and knife for restaurants
"Coffee Shops": "☕", // Coffee for coffee shops
"Chemicals": "🧪", // Test tube for chemicals
"Fodder And Fertilizers": "🌱", // Seedling for fodder and fertilizers
"Waste Treatment": "♻️", // Recycle for waste treatment
"Water Bottling": "💧", // Droplet for water bottling
"Tobacco": "🚬",
"Manufacturing of tobacco and cigarettes":"🚬", // Cigarette for tobacco
"Textiles": "🧵", // Thread for textiles
"Carpet & Mat": "🧶", // Yarn for carpet & mat
"Cotton & Metal Nets": "🕸️", // Web for cotton & metal nets
"Fish canning & freezing": "🕸️", // Web for cotton & metal nets
"Tailoring": "✂️", // Scissors for tailoring
"Handicraft": "🎨", // Palette for handicraft
"Wood Products": "🌲", // Evergreen tree for wood products
"Paper Products": "📝", // Memo for paper products
"Publishing Services": "📚", // Books for publishing services
"Manufacture Of petroleum products": "⛽",
"Manufacture of medicines": "💊",
"Pipes and wires manufacturing": "🔧",
"Other metal indusries": "🏭",
"Appliances and machinery manufacturing": "🛠",
"steel tool manufacturing": "🔨",
"Manufacture of motor vehicles, motorcycles & its spare parts": "🚗",
"Light aircraft manufacturing & maintenance": "✈️",
"Advertising": "📢",
"Ship building and repairing": "🚢",
"Medical Laboratories": "🔬",
"Lenses cutting & glass repairing": "🔍",
"Repairing of electrical & electronic appliances": "⚡",
"Repairing of equipments": "🛠️",
"Contracting and building works": "🏗",
"Power generation and transimission": "⚡",
"Facility management": "🏢",
"Facilities Management Group": "🏢",
"Sewage and cleaning services": "🧹",
"Motor vehicle repairing": "🔧",
"Other Trading Activities": "💱",
"Halls and exibition": "🖼",
"Packing services": "📦",
"Commercial brokerge": "🤝",
"Other professional services": "💼",
"Mechanical & engineering equipment trading": "⚙️",
"Fuel and petroleum products trading": "⛽",
"Building materials trading": "🧱",
"Jewellery trading": "💍",
"Sports equipment trading": "🏀",
"Pets nursery and trading": "🐾",
"Domestic gas distribution": "🔥",
"Used electronics & furniture trading": "📺",
"Used Articles Trading": "🛒",
"Used heavy equipment trading": "🏗",
"Outlet Group": "🏪",
"Separate trading activities": "💱",
"Trasport, shipping and storage": "🚚",
"Car rent and passenger transport": "🚕",
"Tourism Activites": "🌴",
"Car registration & transfer services": "📄",
"Event organizers": "🎫",
"Information Technology": "💻",
"Cinema & theaters": "🎭",
"Information Provision Services": "ℹ️",
"Employment Support Services": "👥",
"Real estate": "🏠",
"finance consultants": "💹",
"Legal services": "⚖️",
"Accounts": "🧮",
"Promotion Services": "📣",
"Consultancy -D- management, information and marketing": "💡",
"Sport Club": "🏆",
"Consultancy -B- Engineering": "👷",
"Goldsmith & gold repairing": "💎",
"Art production/ studio - professional license/ studio - trade license": "🎨",
"studio - proffesional license": "📸",
"Translation Group": "🗣",
"Building maintainance, sureillance and cleaning services": "🛠️",
"Personal & Community services": "🤲",
"sport equipment rental": "🏂",
"Other Rental Services": "🔄",
"Office & electronic equipment rental": "💻",
"Machinery and equipement rental": "🚜",
"Labour Supply & employment agency": "👨🔧",
"Transport, shipping and storage/ Tourism Activities": "🚢",
"Cleaning Services": "🧼",
"Typing and translation": "⌨️",
"Documents destroying & storage": "🗑️",
"Medical Clinic": "🏥",
"Government Transactions Services": "🏛️",
"Education": "📚",
"Not Active": "🚫",
"Institutes and education": "🏫",
"motor & motorcycles driving institutes": "🏍️",
"hospitals & recovery houses": "🏥",
"Gents salon": "💇♂️",
"Social Work Activities": "👐",
"Charity Society": "❤️",
"Nursery": "👶",
"Commercial Library": "📚",
"Exibition organizers": "🖼️",
"Recreation halls": "🎮",
"Business Council": "🏢",
"Businessmen Forum": "👔",
"Business Aviation Association": "✈️",
"Personal requisites repairing": "🔧",
"Key duplicators & stamp making": "🔑",
"Laundry": "🧺",
"Ladies Salon": "💇♀️",
"Kids Salon": "👧",
"Special purpose Firm": "🎯",
"Office Of International Organization": "🌍",
"Business & Professional Organizations": "📈",
"Information Technology": "🚫💻",
"default": "❓",
};
// Convert groupName to lowercase for case-insensitive matching
const lowerGroupName = groupName;
// Find the first matching keyword and return its associated icon
for (const [keyword, icon] of Object.entries(keywordToIcon)) {
if (lowerGroupName.includes(keyword)) {
return icon;
console.log(keyword);
}
}
// Return a default icon if no specific keywords match
return keywordToIcon["default"];
}
document.getElementById('searchInput').addEventListener('input', function(e) {
const query = e.target.value;
const searchResults = document.getElementById('searchResults');
if (query.length > 2) { // Optional: Trigger search when query length is more than 2 characters
jQuery("#searchResults").show();
fetch(`https://activities.crmsoftware.ae/search?q=${encodeURIComponent(query)}`)
.then(response => response.json())
.then(data => handleSearchResults(data))
.catch(error => console.error('Error fetching search results:', error));
}
else{
searchResults.innerHTML = '';
jQuery("#searchResults").hide();
}
});
function handleSearchResults(results) {
const searchResults = document.getElementById('searchResults');
searchResults.innerHTML = '';
searchResults.classList.add('bg-white', 'shadow-lg', 'rounded-lg', 'p-4', 'divide-y', 'divide-gray-200');
// Limit the results to the top 10
results.slice(0, 10).forEach(result => {
const li = document.createElement('li');
const type = result.ltype || "Other";
const group = result.agroup || "Other";
const adr = result.adr || "There is nothing";
const iconClass = getIconForGroup(group); // Ensure you define this function based on your logic
// li.innerHTML = `
// <a class="link nact" href="#${result.nact}">${result.nact}</a>
// <a class="link group" href="#${group}">${iconClass} ${group}</a>
// <a class="link type" href="#${type}">${type}</a>
// <h6>${result.ename}</h6>
// <div class="description">
// <strong>Description:</strong> <br>${result.edescr}<br>
// <strong>Approval Department Requirement:</strong> <br>${adr}<br>
// <strong>Approval Department:</strong> <br>${result.ad}<br>
// <button onclick="joinMain(${result.id})">Show Full Activity</button>
// </div>
// `;
// li.classList.add('py-2', 'result-item');
li.innerHTML = `<a class="px-3 py-2 text-xs font-medium text-center inline-flex items-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800" href="#${result.nact}" class="btn btn-primary">${result.nact}</a>` +
`<a href="#${group}" class="px-3 py-2 text-xs font-medium text-center inline-flex items-center text-white bg-gray-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-gray-600 dark:hover:bg-gray-700 dark:focus:ring-gray-800 right">${iconClass} ${group}</a>`+
`<a href="#${type}" class="px-3 py-2 text-xs font-medium text-center inline-flex items-center text-white bg-green-700 rounded-lg hover:bg-green-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-green-800 right">${type}</a>`+
`<br><h6 class="text-lg font-bold dark:text-white">${result.ename}</h6>`+`<div class="p-4 text-sm text-gray-800 rounded-lg bg-gray-50 dark:bg-gray-800 dark:text-gray-300" role="alert"><strong>Description:</strong> <br>${result.edescr}<br><button onclick="jomain(${result.id})" type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
Show Full Activity
<svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5h12m0 0L9 1m4 4L9 9"/>
</svg>
</button>
<a href="#inquiryat" onclick="frameload(${result.nact},'${result.ename}')" type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
Inquire Now
<svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5h12m0 0L9 1m4 4L9 9"/>
</svg>
</a>
</div>`
; // Replace with the actual column name from your table
li.classList.add('py-2');
searchResults.appendChild(li);
});
}
// document.getElementById('searchInput').addEventListener('input', () => {
// const searchResults = document.getElementById('searchResults');
// searchResults.innerHTML = `
// <div role="status" class="max-w-sm animate-pulse">
// <div class="h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 w-48 mb-4"></div>
// <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px] mb-2.5"></div>
// <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 mb-2.5"></div>
// <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[330px] mb-2.5"></div>
// <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[300px] mb-2.5"></div>
// <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px]"></div>
// <span class="sr-only">Loading...</span>
// </div>
// `;
// const query = document.getElementById('searchInput').value.trim();
// if(query === ""){
// searchResults.innerHTML = '';
// jQuery("#searchResults").hide();
// } else {
// socket.emit('search', query);
// jQuery("#searchResults").show();
// }
// });
// socket.on('searchResults', results => {
// const searchResults = document.getElementById('searchResults');
// searchResults.innerHTML = '';
// searchResults.classList.add('bg-white', 'shadow-lg', 'rounded-lg', 'p-4', 'divide-y', 'divide-gray-200');
// // Limit the results to the top 10
// results.slice(0, 10).forEach(result => {
// const li = document.createElement('li');
// var t=result.ltype;
// var group=result.agroup;
// if(t===""){
// j="Other";
// }
// else{
// var j=result.ltype;
// }
// if(group===""){
// group="Other";
// }
// else{
// var group=result.agroup;
// }
// if(result.adr==""){
// var adr="There is nothing";
// }
// else{
// adr= result.adr;
// }
// const iconClass = getIconForGroup(result.agroup);
// console.log(iconClass);
// li.innerHTML = `<a class="px-3 py-2 text-xs font-medium text-center inline-flex items-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800" href="#${result.nact}" class="btn btn-primary">${result.nact}</a>` +
// `<a href="#${group}" class="px-3 py-2 text-xs font-medium text-center inline-flex items-center text-white bg-gray-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-gray-600 dark:hover:bg-gray-700 dark:focus:ring-gray-800 right">${iconClass} ${group}</a>`+
// `<a href="#${j}" class="px-3 py-2 text-xs font-medium text-center inline-flex items-center text-white bg-green-700 rounded-lg hover:bg-green-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-green-800 right">${j}</a>`+
// `<br><h6 class="text-lg font-bold dark:text-white">${result.ename}</h6>`+`<div class="p-4 text-sm text-gray-800 rounded-lg bg-gray-50 dark:bg-gray-800 dark:text-gray-300" role="alert"><strong>Description:</strong> <br>${result.edescr}<br><strong>Approval Department Requirement</strong> <br>${adr}<br><strong>Approval Department</strong> <br>${result.ad}<br><button onclick="jomain(${result.id})" type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
// Show Full Activity
// <svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">
// <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5h12m0 0L9 1m4 4L9 9"/>
// </svg>
// </button></div>`
// ; // Replace with the actual column name from your table
// li.classList.add('py-2');
// searchResults.appendChild(li);
// });
// });
// Fetch data from the provided endpoint
fetch('https://activities.crmsoftware.ae/unique-agroup')
.then(response => response.json())
.then(data => {
// Get the container element
const groupsContainer = document.getElementById('groups');
// Loop through the data and create HTML elements for each group
data.forEach(group => {
// Create a div for each group
const groupDiv = document.createElement('div');
groupDiv.classList.add('bg-gray-200', 'p-4', 'items-center', 'rounded-lg','text-center','runthis');
groupDiv.setAttribute('onclick', 'toggleModal(this)');
groupDiv.setAttribute('data-title', `${group.agroup}`);
// Create an icon element
var ico=getIconForGroup(group.agroup);
// Create a span for the group name
const groupName = document.createElement('span');
groupName.innerHTML = `<div style="font-size:40px">${ico}</div><h4>`+group.agroup+`</h4>`;
//groupName.setAttribute('onclick', 'myfunction()');
// Append the icon and group name to the group div
// groupDiv.appendChild(icon);
groupDiv.appendChild(groupName);
// Append the group div to the container
groupsContainer.appendChild(groupDiv);
});
})
.catch(error => {
console.error('Error fetching groups:', error);
});
function toggleModal(e) {
var t=jQuery(e).attr('data-title');
console.log(t);
jQuery('.mti').text(t);
const searchResults = document.getElementById('searchResults2');
// const searchResults = document.getElementById('searchResults');
searchResults.innerHTML = `
<div role="status" class="max-w-sm animate-pulse">
<div class="h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 w-48 mb-4"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[330px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[300px] mb-2.5"></div>
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px]"></div>
<span class="sr-only">Loading...</span>
</div>
`;
fetch('https://activities.crmsoftware.ae/agroup/'+t)
.then(response => response.json())
.then(data => {
searchResults.innerHTML = '';
// Get the container element
// const groupsContainer = document.getElementById('groups');
// Loop through the data and create HTML elements for each group
data.forEach(group => {
// Create a div for each group
//console.log(group);
const li = document.createElement('li');
var result=group;
var t=result.ltype;
var group=result.agroup;
if(t===""){
j="Other";
}
else{
var j=result.ltype;
}
if(group===""){
group="Other";
}
else{
var group=result.agroup;
}
if(result.adr==""){
var adr="There is nothing";
}
else{
adr= result.adr;
}
const iconClass = getIconForGroup(result.agroup);
console.log(iconClass);
li.innerHTML = `<a class="px-3 py-2 text-xs font-medium text-center inline-flex items-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800" href="#${result.nact}" class="btn btn-primary">${result.nact}</a>` +
`<a href="#${group}" class="px-3 py-2 text-xs font-medium text-center inline-flex items-center text-white bg-gray-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-gray-600 dark:hover:bg-gray-700 dark:focus:ring-gray-800 right">${iconClass} ${group}</a>`+
`<a href="#${j}" class="px-3 py-2 text-xs font-medium text-center inline-flex items-center text-white bg-green-700 rounded-lg hover:bg-green-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-green-800 right">${j}</a>`+
`<br><h6 class="text-lg font-bold dark:text-white">${result.ename}</h6>`+`<div class="p-4 text-sm text-gray-800 rounded-lg bg-gray-50 dark:bg-gray-800 dark:text-gray-300" role="alert"><strong>Description:</strong> <br>${result.edescr}<br><button onclick="jomain(${result.id})" type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
Show Full Activity
<svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5h12m0 0L9 1m4 4L9 9"/>
</svg>
</button><a href="#inquiryat" onclick="frameload(${result.nact},'${result.ename}')" type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
Inquire Now
<svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5h12m0 0L9 1m4 4L9 9"/>
</svg>
</a></div><hr>`
; // Replace with the actual column name from your table
li.classList.add('py-2');
searchResults.appendChild(li);
});
})
.catch(error => {
console.error('Error fetching groups:', error);
});
document.getElementById('modal').classList.toggle('hidden')
}
function loadsingle(e) {
var t=jQuery(e).attr('data-title');
console.log(t);
document.getElementById('modal').classList.toggle('hidden')
document.getElementById('modal').classList.toggle('hidden')
}
//create sweet alert function that hold complete Activity
function jomain(e){
fetch(`https://activities.crmsoftware.ae/get-act/${e}`)
.then(response => response.json()).then(data => {
//console.log(response.id);
const recordsList = document.getElementById('mhere');
recordsList.innerHTML = ` <div class="relative overflow-x-auto shadow-md sm:rounded-lg">
<table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
<tr>
<td scope="col" class="px-6 py-3"><strong>Activity Number:</strong><br> ${data.nact}</td>
</tr>
<tr><td scope="col" class="px-6 py-3">
<strong>Activity Name:</strong><br> ${data.ename}</td>
</tr>
<tr>
<td scope="col" class="px-6 py-3">
<strong>Activity Group:</strong><br> ${data.agroup}</td>
</tr>
<tr>
<td scope="col" class="px-6 py-3">
<strong>Type:</strong><br> ${data.ltype}</td>
</tr><tr>
<td scope="col" class="px-6 py-3"><strong>Description:</strong><br> ${data.edescr}</td>
</tr>
<tr>
<td colspan="2"><a href="#inquiryat" onclick="frameload(${data.nact},'${data.ename}')" type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
Inquire Now
<svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5h12m0 0L9 1m4 4L9 9"/>
</svg>
</a></td>
</tr>
</thead>
</table>
</div>
`;
const mtitle = document.getElementById('mtitle');
mtitle.innerHTML =`${data.ename}`;
})
Swal.fire({
title: `<h3 class="text-lg font-bold dark:text-white" id="mtitle"></h3>`,
html: `
<div id="mhere"></div>
`,
showCloseButton: false,
showCancelButton: true,
showConfirmButton:false,
focusConfirm: false,
allowOutsideClick: false,
confirmButtonText: `
<i class="fa fa-thumbs-up"></i> Great!
`,
confirmButtonAriaLabel: "Thumbs up, great!",
cancelButtonText: `
Close
`,
cancelButtonAriaLabel: "Thumbs down"
});
}
function frameload(a,b){
// jQuery('#WAbVSuWXn4WkxLoOaPde').attr('src',"https://api.leadconnectorhq.com/widget/form/WAbVSuWXn4WkxLoOaPde?title="+b+"&price=0");
//document.getElementById('modal').classList.toggle('hidden');
//jQuery("#modal").hide();
const loginModal = document.getElementById('modal');
loginModal.classList.add('hidden');
swal.close();
//console.log(a,b);
}
jQuery(document).ready(function($) {
// console.log("hell yeah");
$('#searchInput31').on('keyup', function() {
var searchText = $(this).val().toLowerCase();
$('#searchResults2 li').each(function() {
var listItemText = $(this).text().toLowerCase();
if (listItemText.indexOf(searchText) === -1) {
$(this).hide();
} else {
$(this).show();
}
});
});
});
// jQuery(".runthis").click(function(){
// alert("i am working");
// })
</script>
</div>
</body>
</html>