-
Notifications
You must be signed in to change notification settings - Fork 0
/
pwa-example.html
799 lines (786 loc) · 45.4 KB
/
pwa-example.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
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
<!--
jQuery JSON - WhatsApp InstaOrder
Created by LivelyWorks - http://livelyworks.net
Ver. 1.0.0
Based on Bootstrap 4
-->
<!DOCTYPE html>
<html lang="en" class="h-100">
<head>
<meta charset="utf-8" />
<title>jQuery JSON WhatsApp InstaOrder PWA Example</title>
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no, minimum-scale=1.0, maximum-scale=5.0" />
<meta name="description" content="jQuery JSON - WhatsApp InstaOrder" />
<meta name="author" content="LivelyWorks" />
<link rel="stylesheet"
href="static-assets/packages/bootstrap-4.6.0/css/bootstrap.min.css" />
<link href="static-assets/lw-jquery-whatsapp-insta-order/css/lw-jquery-whatsapp-insta-order.css?ver=1624282648"
rel="stylesheet" />
<link href="static-assets/packages/fontawesome-free-5.11.2-web/css/all.min.css"
rel="stylesheet" />
<link rel="apple-touch-icon"
sizes="180x180"
href="static-assets/ico/apple-touch-icon.png" />
<link rel="icon"
type="image/png"
sizes="32x32"
href="static-assets/ico/favicon-32x32.png" />
<link rel="icon"
type="image/png"
sizes="16x16"
href="static-assets/ico/favicon-16x16.png" />
<link rel="manifest" href="pwa.manifest" />
</head>
<!-- do not remove bs-4, used for theme recognition -->
<body class="d-flex flex-column h-100">
<!-- Begin page content -->
<div id="loaderContainer">
<div class="preloader">Loading ...</div>
<span class="lw-waiting-text">Please wait</span>
<div class="lw-loading-status">Initializing...</div>
</div>
<div id="mainContainer" style="display: none">
<!-- Main Container -->
<div class="container-fluid lw-content-container mt-4 mb-5">
<!-- Content Holder -->
<div class="row">
<div class="col-lg-3 col-md-4 col-sm-12 mb-5 lw-sidebar-container pb-5">
<button class="btn btn-light btn-lg border lw-sidebar-toggle-btn">
<i class="fa fa-bars" aria-hidden="true"></i>
<i class="fa fa-times" aria-hidden="true"></i>
</button>
<!-- Sidebar Holder -->
<!-- Categories Holder -->
<div class="card shadow-sm border-0 pl-3">
<!-- logo -->
<img id="storeLogo" src="logo.svg" alt="Logo" />
<!-- Show Cart Button -->
<span class="shopping-cart-btn-container"></span>
<!-- /Show Cart Button -->
<div class="card-header">Categories</div>
<div class="list-group list-group-flush" id="categoriesList">
<h5>
<a data-categoryindex="all"
href="#/category/uid-all"
class="category-link-all category-link list-group-item list-group-item-action active-category category-list-item-all mb-2">All</a>
</h5>
</div>
</div>
<!-- /Categories Holder -->
<!-- /Sidebar Holder -->
</div>
<div class="lw-sidebar-overlay" style="display: none"></div>
<div class="col-lg-9 col-md-8 col-sm-12 lw-main-area offset-lg-3 offset-md-4">
<div class="mb-5 lw-search-container text-center">
<img id="storeLogo" src="logo.svg" alt="Logo" />
<div class="input-group mt-md-5">
<div class="input-group-prepend lw-spotlight-search-text">
<span class="input-group-text">Search</span>
</div>
<input type="search"
class="search-product form-control form-control-lg"
placeholder="type to search ...." />
<div class="input-group-append">
<button disabled
class="btn btn-outline-secondary clear-search-result-btn"
type="button">
<strong>×</strong>
</button>
</div>
</div>
<!-- /input-group -->
<h5 class="text-center mt-2 text-info"
id="searchedProductCounts"></h5>
</div>
<!-- Breadcrumb -->
<nav class="lw-breadcrumb-container" aria-label="breadcrumb">
<ol class="breadcrumb" id="productsBreadcrumb">
<li class="breadcrumb-item">All</li>
</ol>
</nav>
<!-- /Breadcrumb -->
<!-- Products Holder -->
<div id="productsContainer"></div>
<!-- /Products Holder -->
<hr />
<div class="clearfix mt-4 lw-result-loaded-text text-center"></div>
<div class="clearfix mt-4">
<button class="btn btn-primary lw-load-more-content btn-block w-50 m-auto">
Load More
</button>
</div>
</div>
</div>
<!-- /Content Holder -->
</div>
<!-- /Main Container -->
</div>
<footer class="footer mt-auto py-3">
<div class="footer-text container text-center">
© <span class="footer-store-name">WhatsApp InstaOrder</span> 2021<a href="#"
id="lwGotoTop"
class="go-to-top fr float-right btn btn-light">
<i class="fa fa-arrow-up"></i> Go to Top
</a>
</div>
</footer>
<!-- Modal Placeholder -->
<div id="modalContainer">
<div class="modal fade lw-modal"
id="commonModal"
tabindex="-1"
role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content common-modal-content"></div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</div>
<!-- Modal Placeholder -->
<!-- Templates -->
<!-- Submit Order form -->
<script type="text/template" class="submit-order-form-template">
<div class="modal-header">
<h3 class="order-page-header modal-title">Your Details</h3>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body order-page-body">
<!-- Submit Order Form -->
<form class="form-horizontal bs-4-form" id="submitOrderForm">
<div class="bs-callout bs-callout-danger">
Field(s) marked as <strong class="color-red">*</strong> are required.
</div>
<div class="alert alert-danger hidden lw-errors-container">
<strong>Error!!</strong>
<p class="lw-other-error-message hidden">
</p>
<p class="lw-error-email hidden">
Please enter a valid email address.
</p>
</div>
<div>
<!-- Name -->
<div class="form-group row">
<label for="fname" class="col-sm-3 col-md-3 col-lg-3 control-label"><strong class="color-red">*</strong>Name: </label>
<div class="col-sm-6 col-md-6 col-lg-6">
<input type="text" name="fname" value="" id="fname" class="form-control required" required autofocus>
</div>
</div>
<!-- /Name -->
<!-- Email -->
<div class="form-group row">
<label for="email" class="col-sm-3 col-md-3 col-lg-3 control-label"> Email: </label>
<div class="col-sm-6 col-md-6 col-lg-6">
<input type="email" name="email" value="" id="email" class="form-control">
</div>
</div>
<!-- /Email -->
<!-- Mobile Number -->
<div class="form-group row">
<label for="mobile_number" class="col-sm-3 col-md-3 col-lg-3 control-label"><strong class="color-red">*</strong> Mobile: </label>
<div class="col-sm-6 col-md-6 col-lg-6">
<input type="number" name="mobile_number" minlength="9" maxlength="15" value="" id="mobile_number" class="form-control required" required>
</div>
</div>
<!-- /Mobile Number -->
<div class="lw-delivery-fields lw-delivery-field-table" style="display:none">
<!-- Table -->
<div class="form-group row">
<label for="" class="col-sm-3 col-md-3 col-lg-3 control-label"></label>
<div class="col-sm-6 col-md-6 col-lg-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><strong class="color-red">*</strong> Table#</span>
</div>
<input type="text" name="table_number" value="" id="table_number" class="form-control required">
</div>
</div>
</div>
<!-- /Table -->
</div>
<!-- Address -->
<div class="lw-delivery-fields lw-delivery-field-delivery" style="display:none">
<div class="form-group row">
<label for="add" class="col-sm-3 col-md-3 col-lg-3 control-label"><strong class="color-red">*</strong> Address: </label>
<div class="col-sm-6 col-md-6 col-lg-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">Street</span>
</div>
<input type="text" name="add" value="" id="add" class="form-control required" autocomplete="off">
</div>
</div>
</div>
<!-- /Street -->
<!-- City -->
<div class="form-group row">
<label for="" class="col-sm-3 col-md-3 col-lg-3 control-label"></label>
<div class="col-sm-6 col-md-6 col-lg-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">City</span>
</div>
<input type="text" name="city" value="" id="city" class="form-control required">
</div>
</div>
</div>
<!-- /City -->
<!-- Zip code -->
<div class="form-group row">
<label for="" class="col-sm-3 col-md-3 col-lg-3 control-label"></label>
<div class="col-sm-6 col-md-6 col-lg-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">ZIP</span>
</div>
<input type="text" name="zip" value="" id="zip" class="form-control required">
</div>
</div>
</div>
<!-- /Zip code -->
<!-- Country -->
<div class="form-group row">
<label for="" class="col-sm-3 col-md-3 col-lg-3 control-label"></label>
<div class="col-sm-6 col-md-6 col-lg-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">Country</span>
</div>
<input type="text" name="country" value="" id="country" class="form-control ">
</div>
</div>
</div>
<!-- /Country -->
</div>
<!-- /Address -->
<!-- Message -->
<div class="form-group row">
<label for="message" class="col-12 control-label">Instructions/Message if any: </label>
<div class="col-12">
<textarea name="message" cols="40" rows="10" id="message" class="form-control"></textarea>
</div>
</div>
<!-- /Message -->
</form>
<!-- /Submit Order Form -->
</div>
<div class="modal-footer">
<!-- Action Buttons -->
<div class="lw-btns"><a id="backToCartBtn" href="#" class="btn btn-light float-left mr-2"><i class="fa fa-arrow-left"></i> Go Back</a> <a href="#" id="submitOrderBtn" class="btn btn-lg btn-success btn-md mr-2 disabled"><i class="fab fa-whatsapp"></i> WhatsApp Order</a> <button class="btn order-page-close-btn btn btn-light" data-dismiss="modal" aria-hidden="true">Cancel</button></div>
<!-- /Action Buttons -->
</div>
</script>
<!-- /Submit Order form -->
<!-- Shopping Cart. -->
<script type="text/template" class="shopping-cart-template">
<div class="modal-header">
<h3 class="modal-title">Ready to Order</h3>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="table-responsive lw-shopping-cart">
<table class="table table-striped table-bordered">
<thead class="shadow-sm">
<tr>
<th>Thumbnails</th>
<th>Description</th>
<th class="right-align">Price</th>
<th class="text-center">Qty.</th>
<th class="right-align">Total</th>
<th class="text-center">Remove</th>
</tr>
</thead>
<tbody id="shoppingCartData">
<% if( _oData.cartProductsCollection.length > 0 ) {
_.each( _oData.cartProductsCollection, function(listItem, nCartRowIndex ) {
var listItemProduct = _oData.allProductsCollection[listItem.index];
var totalAddonPrice = 0,
itemTotal = listItemProduct.price;
%>
<tr class="cart-row-<%- nCartRowIndex %> shadow-sm">
<td>
<div class="lw-cart-thumbnail">
<img src="<%- listItemProduct.thumbPath %>" alt="<%- listItemProduct.name %>">
</div>
</td>
<td>
<h5 class="text-success">
<%- listItemProduct.name %>
</h5>
<%
if( !_.isEmpty(listItem.options) ) {
_.each( listItem.options, function(listItemOption, listItemOptionKey) {
var listOptionValueDetails = _.findWhere(listItemProduct.productOptions[listItemOptionKey].optionValues,{value:listItemOption.value});
%>
<div>
<small>
<%- listItemOption.optionTitle %>: <%- listItemOption.name %>
<% if(listOptionValueDetails.addonPrice) {
totalAddonPrice = totalAddonPrice + listOptionValueDetails.addonPrice;
itemTotal += listOptionValueDetails.addonPrice;
%>
(+ <%- listOptionValueDetails.addonPriceFormatted %>)
<% } %>
</small>
</div>
<% }); }
%>
</td>
<td class="right-align">
<div><%- _oData.fnMisc.formatAmount(listItemProduct.price + totalAddonPrice) %></div>
<% if(listItemProduct.additionalShippingCharge) {
var itemShippingCharges = listItemProduct.calculateShipping();
itemTotal += itemShippingCharges;
if(itemShippingCharges) {
%>
<div><small>+ Shipping <%- _oData.fnMisc.formatAmount(itemShippingCharges) %></small></div>
<% } } %>
<% if(listItemProduct.taxPercentage || _oData.configOptions.taxPercentage) {
var itemTax = listItemProduct.calculateTax(totalAddonPrice);
itemTotal += itemTax;
%>
<div><small>+ Tax <%- _oData.fnMisc.formatAmount(itemTax) %></small></div>
<% } %>
</td>
<td class="text-center lw-cart-qty-input">
<input data-cartrowindex="<%- nCartRowIndex %>" type="number" step="1" min="1" value="<%- listItem.qty %>" class="cart-product-qty center-align form-control" />
</td>
<td class="right-align"><%- _oData.fnMisc.formatAmount(itemTotal * listItem.qty) %></td>
<td class="text-center"><button type="button" data-cartrowindex="<%- nCartRowIndex %>" href="#" class="btn btn-light btn-block btn delete-product-from-cart" title="Remove from Cart"><i class="fa fa-trash"></i></button></td>
</tr>
<% }); } else { %>
<td colspan="6"><div class="alert alert-info">Bag is Empty!!</div></td>
<% } %>
</tbody>
</table>
</div>
<div id="shopping_cart_total" class="alert tar text-right col-lg-12">
<div class="float-md-right">
<!-- Order Types -->
<% if(!_.isUndefined(_oData.configOptions.checkoutMethods.orderByWhatsApp.orderTypes)) { %>
<div class="form-group row">
<label class="col-sm-12 control-label text-left" for="orderTypeSelection"><strong class="color-red">*</strong> Select Order Type</label>
<div class="col-sm-12">
<select class="custom-select form-control form-control-lg" name="order_type" id="orderTypeSelection">
<option value="">Select</option>
<% _.each( _oData.configOptions.checkoutMethods.orderByWhatsApp.orderTypes, function(itemValue, itemKey ) {
if(itemValue.enable == true) { %>
<option <%- (itemKey == _oData.generalVars.orderType) ? 'selected' : '' %> value="<%- itemKey %>"><%- itemValue.title %></option>
<% } %>
<% }); %>
</select>
</div>
</div>
<% } %>
</div>
<div class="clear"></div>
<div><strong><%- _oData.cartStats.totalItems %></strong> item(s) of <%- _oData.fnMisc.formatAmount(_oData.cartStats.subTotal) %></div>
<div>
<%
var fullTotal = _oData.cartStats.subTotal;
if( fullTotal && _oData.cartStats.totalShippingCharges ) {
fullTotal += _oData.cartStats.totalShippingCharges;
%>
+ Total Shipping: <%- _oData.fnMisc.formatAmount( _oData.cartStats.totalShippingCharges ) %>
<% } %>
<% if( _oData.cartStats.totalTaxes ) {
fullTotal += _oData.cartStats.totalTaxes;
%>
</div>
<div>
+ Taxes: <%- _oData.fnMisc.formatAmount( _oData.cartStats.totalTaxes ) %>
</div>
<% } %>
<br>
<h3 class="text-primary"> <small>Total Amount Payable</small> <%- _oData.fnMisc.fullFormatAmount(fullTotal) %> </h3>
</div>
</div>
<div class="modal-footer">
<div class="float-right lw-btns">
<a href="#" class="btn btn-light" data-dismiss="modal"><i class="fa fa-arrow-left"></i> Continue Ordering</a>
<% if(!_.isEmpty(_oData.configOptions.checkoutMethods)) { %>
<% _.each(_oData.configOptions.checkoutMethods,function( checkoutMethod ) {
if(checkoutMethod.enable === true) { %>
<a href="#" id="<%- checkoutMethod.btnElement.id %>" data-method="<%- checkoutMethod.method %>" class="lw-checkout-button btn btn-lg <%- checkoutMethod.btnElement.class %> <% if( ! _oData.generalVars.enableOrderBtn) { %> disabled <% } %>" title="<%- checkoutMethod.title ? checkoutMethod.title : '' %>" <% if( ! _oData.generalVars.enableOrderBtn) { %> disabled <% } %> >
<% if(checkoutMethod.btnElement.imageUrl) { %>
<img src="<%- checkoutMethod.btnElement.imageUrl %>" alt="<%- checkoutMethod.title ? checkoutMethod.title : '' %>" /> <%- checkoutMethod.title ? checkoutMethod.title : '' %>
<% } else if(checkoutMethod.btnElement.title) { %>
<%= checkoutMethod.btnElement.title %>
<% } } %>
</a>
<% }) } %>
</div>
</div>
</script>
<!-- /Shopping Cart. -->
<!-- Shopping Cart button. -->
<script type="text/template" class="shopping-cart-btn-template">
<a title="Items ready for Order" class="btn btn-danger show-shopping-cart-btn btn-block btn-lg" href="#/shopping-cart/uid-show">
<i class="fab fa-whatsapp"></i> <strong><%- _oData.cartStats.totalItems %></strong> item(s) of <%- _oData.cartStats.amountFormatted %>
</a>
</script>
<!-- /Shopping Cart button. -->
<!-- Add for Order button. -->
<script type="text/template" class="add-to-cart-btn-template">
<% if( ! _oData.nProductInCart ) { %>
<a href="#" class="btn btn-success add-to-cart-btn btn-block"><span class="add-to-cart-btn-text">Add for Order</span> <i class="fa fa-shopping-cart"></i></a>
<% } else { %>
<a href="#" class="btn btn-success add-to-cart-btn btn-block"><span class="add-to-cart-btn-text">Update Order</span> <i class="fa fa-shopping-cart"></i> </a>
<% }%>
</script>
<!-- Sidebar Categories.↳ ↳-->
<script type="text/template" class="sidebar-categories-template">
<% _.each(_oData.categoriesCollection,function( listItem ) { %>
<h5><a style="padding-left: <%- listItem.parentLevel * 10 %>px;" data-categoryindex="<%- listItem.index %>" href="#/category/uid-<%- listItem.index %>/<%- listItem.slug %>" class="category-link-<%- listItem.index %> category-link list-group-item-action list-group-item category-list-item-<%- listItem.index %>"> <% if(listItem.parentLevel != 1) { %> ↳ <% }%> <%- listItem.name %> </a></h5>
<% }) %>
</script>
<!-- /Add for Order button. -->
<!-- Products Grid -->
<script type="text/template" class="products-grid-template">
<% if( _oData.currentProductCollection.length < 1) { %>
<div class="clearfix">
<div class="alert alert-warning">
No Products to Display
</div>
</div>
<% } else { %>
<div class="lw-gutter-sizer"></div>
<% _.each( _oData.currentProductCollection, function( listItem ){ %>
<div data-productindex="<%- listItem.index %>" class="card product-item product-item-new border bg-light text-white">
<% if(listItem.details) { %>
<a data-productindex="<%- listItem.index %>" href="#/product/uid-<%- listItem.index %>/<%- listItem.slug %>" class="product-id-<%- listItem.index %> product-link">
<span title="Click for details" class="lw-details-link-window-icon"> <i class="fa fa-info-circle" aria-hidden="true"></i></span>
<div class="thumb-holder">
<img class="card-img-top product-item-thumb-image" data-src="<%- listItem.thumbPath %>" alt="<%- listItem.name %>">
</div>
</a>
<% } else { %>
<span class="product-id-<%- listItem.index %> product-link">
<div class="thumb-holder"><img class="card-img-top product-item-thumb-image" data-src="<%- listItem.thumbPath %>" alt="<%- listItem.name %>"></div>
</span>
<% } %>
<div class="card-body">
<% if(listItem.details) { %>
<a data-productindex="<%- listItem.index %>" href="#/product/uid-<%- listItem.index %>/<%- listItem.slug %>" class="product-id-<%- listItem.index %> product-link card-title">
<h3 class="product-name text-dark"> <%- listItem.name %></h3>
</a>
<% } else { %>
<h3 class="product-name text-dark"> <%- listItem.name %></h3>
<% } %>
<div class="lw-btns">
<% if(listItem.price) { %>
<h4 class="product-price">
<%- listItem.formattedPrice %>
<% if(listItem.hasAddonPrice) { %>
<sup class="lw-has-addon-price" title="Product Options selection may affect a price">+</sup>
<% } %>
<% if(listItem.oldPrice && (listItem.oldPrice.price != listItem.price)){ %>
<small class="old-product-price"> <%- listItem.oldPrice.formatted %></small>
<% } %>
</h4>
<% } %>
<% if(listItem.price && !listItem.outOfStock) { %>
<a tabindex="0" data-placement="top" data-toggle="popover" title="Add for Order - <%- listItem.name %>" data-productindex="<%- listItem.index %>" class="btn btn-success btn-block add-to-cart-btn-grid-item grid-product-id-<%- listItem.index %>"><i class="fa fa-shopping-cart"></i> <span class="add-to-cart-btn-text-grid-item">Add for Order</span> </a>
<% } else if(listItem.outOfStock) { %>
<button class="btn btn btn-warning disabled btn-block" disabled aria-hidden="true">Out of Stock</button>
<% } else { %>
<a tabindex="0" disabled href="#" class="btn btn-primary btn-block disabled">Contact for Price </a>
<% } %>
<% if(listItem.detailsLink && listItem.detailsLink.link_url) { %>
<a rel="noopener" href="<%- listItem.detailsLink.link_url %>" target="<%- listItem.detailsLink.target ? listItem.detailsLink.target : '_blank' %>" class="btn btn-light <%- listItem.detailsLink.class %>"><%- listItem.detailsLink.title ? listItem.detailsLink.title : 'Details' %></a>
<% } %>
</div>
</div>
</div>
<% }); }; %>
</script>
<!-- /Products Grid -->
<!-- Popover details -->
<script type="text/template" class="product-options-popover-template">
<div class="lw-popover-content p-2">
<% var productOptions = _oData.oCurrentProductData.productOptions;
if(_oData.fnMisc.objectLength(productOptions) > 0) {
for(var productOptionKey in productOptions) {
var productOption = productOptions[productOptionKey];
%>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><%- productOption.title %></span>
</div>
<select data-title="<%- productOption.title %>" data-id="<%- productOption._id %>" class="form-control custom-select product-option-<%- productOption._id %> option-selector">
<%
if(productOption.optionValues.length > 0) {
_.each(productOption.optionValues,function(optionValue){ %>
<option data-belongs-to="<%- productOption._id %>" value="<%- optionValue.value %>">
<%- optionValue.name %>
<% if(optionValue.addonPrice) { %>
(+ <%- optionValue.addonPriceFormatted %>)
<% }%>
</option>
<% }) %>
<% }%>
</select>
</div>
<% } %>
<% }%>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Qty</span>
</div>
<input type="number" step="1" min="1" value="1" class="item-product-qty center-align form-control" />
</div>
<div class="btn-group btn-block">
<button data-productindex="<%- _oData.oCurrentProductData.index %>" type="button" class="btn btn-primary add-to-cart-btn-grid-item-save"><i class="lw-spin-animation fa fa-refresh"></i></button>
<a href="#/shopping-cart/uid-show" class="btn btn-outline-success"><i class="fab fa-whatsapp" aria-hidden="true"></i></a>
</div>
</div>
</script>
<!-- /Popover details -->
<!-- Product Details Modal -->
<script type="text/template" class="products-details-modal-template">
<div class="modal-header">
<h3 class="modal-title">
<%- _oData.oCurrentProductData.name %>
<br>
<small class="lw-product-attributes">
<% var categoryItem = _oData.categoriesCollection[_oData.oCurrentProductData.categoryIndex]; %>
<span>Category: </span><a data-categoryindex="<%- categoryItem.index %>" href="#/category/uid-<%- categoryItem.index %>/<%- categoryItem.slug %>" class="category-link-<%- categoryItem.index %> category-link"><%- categoryItem.name %></a> |
<span>Product ID: </span><%- _oData.oCurrentProductData.id %>
</small>
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body lw-modal-body row">
<div class="col-sm-12 col-md-8">
<h5>Description</h5>
<%= _oData.oCurrentProductData.details %>
</div>
<div class="col-sm-12 col-md-4">
<% if(_oData.oCurrentProductData.price) { %>
<h4>Price </h4>
<h3 class="product-price mb-3">
<%- _oData.oCurrentProductData.formattedPrice %>
<% if(_oData.oCurrentProductData.hasAddonPrice){ %>
<sup class="lw-has-addon-price" title="Product Options selection may affect a price">+</sup>
<% } %>
<% if(_oData.oCurrentProductData.oldPrice && (_oData.oCurrentProductData.oldPrice.price != _oData.oCurrentProductData.price)){ %>
<small class="old-product-price"> <%- _oData.oCurrentProductData.oldPrice.formatted %></small>
<% } %>
<% } %>
</h3>
<div class="form">
<% var productOptions = _oData.oCurrentProductData.productOptions;
if(_oData.fnMisc.objectLength(productOptions) > 0) {
for(var productOptionKey in productOptions) {
var productOption = productOptions[productOptionKey];
%>
<div class="form-group">
<label for=""><%- productOption.title %></label>
<select data-title="<%- productOption.title %>" data-id="<%- productOption._id %>" class="form-control custom-select product-option-<%- productOption._id %> option-selector">
<%
if(productOption.optionValues.length > 0) {
_.each(productOption.optionValues,function(optionValue){ %>
<option data-belongs-to="<%- productOption._id %>" value="<%- optionValue.value %>">
<%- optionValue.name %>
<% if(optionValue.addonPrice) { %>
(+ <%- optionValue.addonPriceFormatted %>)
<% }%>
</option>
<% }) %>
<% }%>
</select>
</div>
<% } %>
<% }%>
<div class="form-group">
<div class="input-group">
<% if(_oData.oCurrentProductData.price && !_oData.oCurrentProductData.outOfStock) { %>
<div class="input-group lw-number-spinner">
<div class="input-group-prepend">
<span class="input-group-text">Qty</span>
</div>
<span class="input-group-btn">
<button class="btn btn-default" data-dir="dwn">-</button>
</span>
<input type="number" step="1" min="1" value="1" class="item-product-qty center-align form-control" />
<span class="input-group-btn">
<button class="btn btn-default" data-dir="up">+</button>
</span>
</div>
</div>
</div>
<div class="form-group lw-btns">
<div id="addToCartBtnContainer"></div>
<% } else if(_oData.oCurrentProductData.outOfStock) { %>
<button class="btn btn btn-warning disabled" disabled aria-hidden="true">Out of Stock</button>
<% } else { %>
<button class="btn btn btn-success disabled" disabled aria-hidden="true">Contact for Price</button>
<% }%>
</div>
<div>
<% if(_oData.oCurrentProductData.detailsLink && _oData.oCurrentProductData.detailsLink.link_url) { %>
<hr>
<a href="<%- _oData.oCurrentProductData.detailsLink.link_url %>" target="<%- _oData.oCurrentProductData.detailsLink.target ? _oData.oCurrentProductData.detailsLink.target : '_blank' %>" class="btn btn-light <%- _oData.oCurrentProductData.detailsLink.class %>"><%- _oData.oCurrentProductData.detailsLink.title ? _oData.oCurrentProductData.detailsLink.title : 'Details' %></a>
<% } %>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn btn-light" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</script>
<!-- /Product Details Modal -->
<!-- WhatsApp order template -->
<script type="text/template" class="whatsapp-order-template">
```
New Order @ <%- _oData.configOptions.storeName %>
**************************
Order# : <%- _oData.orderId %>
Order Type : <%- _oData.selectedOrderType %><%- _oData.formDetails.table_number ? ("\nTable# :" +_oData.formDetails.table_number) : null %>
--------------------------
Customer Details
--------------------------
<%- _oData.formDetails.fname ? ('Name : ' + _oData.formDetails.fname) : null %>
<%- _oData.formDetails.email ? ("Email : " + _oData.formDetails.email ): null %><%- _oData.formDetails.mobile_number ? ("\nMobile : " +_oData.formDetails.mobile_number) : null %><%- _oData.formDetails.add ? ("\nStreet : " +_oData.formDetails.add) : null %><%- _oData.formDetails.city ? ("\nCity : " +_oData.formDetails.city) : null %><%- _oData.formDetails.zip ? ("\nZip/Postal Code : " +_oData.formDetails.zip) : null %><%- _oData.formDetails.country ? ("\nCountry : " +_oData.formDetails.country) : null %><%- _oData.formDetails.message ? ("\n\n--------------------------\nMessage/Instructions:\n" +_oData.formDetails.message) : null %>
--------------------------
Order Details
--------------------------
<% if( _oData.cartProductsCollection.length > 0 ) {
var countIndex = 0;
_.each( _oData.cartProductsCollection, function(listItem, nCartRowIndex ) {
var listItemProduct = _oData.allProductsCollection[listItem.index];
var totalAddonPrice = 0,
itemTotal = listItemProduct.price;
countIndex ++; %>
<%- countIndex %>) <%- listItemProduct.name %> <% if( !_.isEmpty(listItem.options) ) { %> <% _.each( listItem.options, function(listItemOption, listItemOptionKey) {
var listOptionValueDetails = _.findWhere(listItemProduct.productOptions[listItemOptionKey].optionValues,{value:listItemOption.value}); %> <% if(listOptionValueDetails.addonPrice) { totalAddonPrice = totalAddonPrice + listOptionValueDetails.addonPrice; itemTotal += listOptionValueDetails.addonPrice; %>
<%- listItemOption.optionTitle %> - <%- listItemOption.name %> (+ <%- listOptionValueDetails.addonPriceFormatted %>)
<% } else if(listItemOption.name) %> <%- listItemOption.optionTitle %> - <%- listItemOption.name %> <% }); } %>
--------------------------
Item Price : <%- _oData.fnMisc.formatAmount(listItemProduct.price + totalAddonPrice) %> <% if(listItemProduct.additionalShippingCharge) { var itemShippingCharges = listItemProduct.calculateShipping(); itemTotal += itemShippingCharges; %>
Shipping : <%- _oData.fnMisc.formatAmount(itemShippingCharges) %><% } %> <% if(listItemProduct.taxPercentage || _oData.configOptions.taxPercentage) { var itemTax = listItemProduct.calculateTax(totalAddonPrice); itemTotal += itemTax; %>
Tax : <%- _oData.fnMisc.formatAmount(itemTax) %> <% } %>
Qty : <%- listItem.qty %>
--------------------------
Item Total :<%- _oData.fnMisc.formatAmount(itemTotal * listItem.qty) %>
--------------------------
<% }); } %>
<%- _oData.cartStats.totalItems %> item(s) of <%- _oData.fnMisc.formatAmount(_oData.cartStats.subTotal) %><% var fullTotal = _oData.cartStats.subTotal; if( fullTotal && _oData.cartStats.totalShippingCharges ) { fullTotal += _oData.cartStats.totalShippingCharges; %>
Total Shipping : <%- _oData.fnMisc.formatAmount( _oData.cartStats.totalShippingCharges ) %> <% } %> <% if( _oData.cartStats.totalTaxes ) { fullTotal += _oData.cartStats.totalTaxes; %>
Taxes : <%- _oData.fnMisc.formatAmount( _oData.cartStats.totalTaxes ) %> <% } %>
--------------------------
Total Amount Payable
<%- _oData.fnMisc.fullFormatAmount(fullTotal) %>
Thank you
```
</script>
<!-- /Shopping Cart. -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript"
src="static-assets/packages/other-js-libs/jquery-3.4.1.min.js"></script>
<script type="text/javascript"
src="static-assets/packages/other-js-libs/underscore-min.js"></script>
<script type="text/javascript"
src="static-assets/packages/bootstrap-4.6.0/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript"
src="static-assets/packages/other-js-libs/jquery.validate.min.js"></script>
<script type="text/javascript"
src="static-assets/packages/other-js-libs/jquery.json.min.js"></script>
<script type="text/javascript"
src="static-assets/packages/other-js-libs/jstorage.min.js"></script>
<script type="text/javascript"
src="static-assets/packages/other-js-libs/jquery.lazy.min.js"></script>
<script type="text/javascript"
src="static-assets/packages/other-js-libs/masonry.pkgd.min.js"></script>
<script type="text/javascript"
src="static-assets/lw-jquery-whatsapp-insta-order/js/lw-jquery-whatsapp-insta-order.js?ver=1624282648"></script>
<script>
$("body").whatsAppInstaOrder({
// data url for products json
// set if other than default
dataUrl: "data-provider/products.json",
siteBaseUrl: "",
// whatever to force fresh data or not
forceFresh: false,
// your store name
storeName: "WhatsApp InstaOrder",
// logo image path
logoImage: "",
// set currency symbol
currencySymbol: "$",
// currency symbol
currency: "USD",
// checkout methods
checkoutMethods: {
orderByWhatsApp: {
// enable this gateway or not
enable: true,
// Your Mobile Number with 0 and country code
mobileNumber: "917020135825",
// Enable the order types you required
// no shipping charges will be levied if user chooses takeaway or table order type
orderTypes: {
// if user wants to pickup the order
takeaway: {
enable: true,
title: "Takeaway",
},
// if the user wants delivery of the item
// full address will be asked by the system
delivery: {
// it will enable the form to submit address information
enable: true,
title: "Delivery",
},
// will enable the table number field
table: {
enable: true,
title: "Table",
},
},
// gateway title
title: "WhatsApp Order",
// method name do not change
method: "orderByWhatsApp",
// button element will be created using following information
btnElement: {
id: "#whatsappCheckout",
class: "btn-success",
title:
'Proceed to <i class="fab fa-whatsapp"></i> WhatsApp Order',
// imageUrl : 'image path for button'
},
},
},
// global shipping charges in amount
shippingCharges: 0,
// global tax charges in percentage
taxPercentage: 0,
// do you want to search product description
searchProductDetails: true,
// do you want to search the product ids
searchProductIds: true,
// do you want to search the product category ids
searchCategoryIds: true,
// per page item for the load more pagination
perPageCount: 12,
});
// service worker
if ("serviceWorker" in navigator) {
// register service worker
navigator.serviceWorker.register("/service-worker.js");
} else {
console.log("Service worker is not supported");
}
</script>
</body>
</html>