| @@ -19,8 +19,9 @@ | ||
| 19 | 19 | |
| 20 | 20 | $vbo_app = VikBooking::getVboApplication(); |
| 21 | 21 | $vbo_app->loadSelect2(); |
| 22 | 22 | $vbo_app->loadDatePicker(); |
| 23 | +$vbo_app->prepareJavaScriptCurrency(); | |
| 23 | 24 | |
| 24 | 25 | JHtml::fetch('script', VBO_ADMIN_URI . 'resources/js_upload/jquery.stickytableheaders.min.js'); |
| 25 | 26 | |
| 26 | 27 | $nowdf = VikBooking::getDateFormat(true); |
| @@ -32,9 +33,8 @@ | ||
| 32 | 33 | $df = 'Y/m/d'; |
| 33 | 34 | } |
| 34 | 35 | $datesep = VikBooking::getDateSeparator(true); |
| 35 | 36 | $juidf = $nowdf == "%d/%m/%Y" ? 'dd/mm/yy' : ($nowdf == "%m/%d/%Y" ? 'mm/dd/yy' : 'yy/mm/dd'); |
| 36 | -$currencysymb = VikBooking::getCurrencySymb(true); | |
| 37 | 37 | |
| 38 | 38 | $month = VikRequest::getInt('month', 0, 'request'); |
| 39 | 39 | $printtableaux = VikRequest::getInt('printtableaux', 0, 'request'); |
| 40 | 40 | |
| @@ -46,9 +46,9 @@ | ||
| 46 | 46 | JText::translate('VBTUE'), |
| 47 | 47 | JText::translate('VBWED'), |
| 48 | 48 | JText::translate('VBTHU'), |
| 49 | 49 | JText::translate('VBFRI'), |
| 50 | - JText::translate('VBSAT') | |
| 50 | + JText::translate('VBSAT'), | |
| 51 | 51 | ); |
| 52 | 52 | $months_labels = array( |
| 53 | 53 | JText::translate('VBMONTHONE'), |
| 54 | 54 | JText::translate('VBMONTHTWO'), |
| @@ -60,9 +60,9 @@ | ||
| 60 | 60 | JText::translate('VBMONTHEIGHT'), |
| 61 | 61 | JText::translate('VBMONTHNINE'), |
| 62 | 62 | JText::translate('VBMONTHTEN'), |
| 63 | 63 | JText::translate('VBMONTHELEVEN'), |
| 64 | - JText::translate('VBMONTHTWELVE') | |
| 64 | + JText::translate('VBMONTHTWELVE'), | |
| 65 | 65 | ); |
| 66 | 66 | $long_months_labels = $months_labels; |
| 67 | 67 | foreach ($months_labels as $i => $v) { |
| 68 | 68 | $months_labels[$i] = function_exists('mb_substr') ? mb_substr($v, 0, 3, 'UTF-8') : substr($v, 0, 3); |
| @@ -85,40 +85,24 @@ | ||
| 85 | 85 | ?> |
| 86 | 86 | </div> |
| 87 | 87 | <div id="filter-bar" class="btn-toolbar vbo-btn-toolbar vbo-tableaux-filters" style="width: 100%; display: inline-block;"> |
| 88 | 88 | <div class="btn-group pull-left" style="font-size: 12px;"> |
| 89 | - <select id="roomsel" name="roomids[]" multiple="multiple"> | |
| 90 | - <?php | |
| 91 | - foreach ($this->allrooms as $rid => $rdata) { | |
| 92 | - ?> | |
| 93 | - <option value="<?php echo $rid; ?>"<?php echo in_array($rid, $roomids) ? ' selected="selected"' : ''; ?>><?php echo $rdata['name']; ?></option> | |
| 89 | + <span class="vbo-toolbar-multiselect-wrap"> | |
| 94 | 90 | <?php |
| 95 | - } | |
| 96 | - | |
| 97 | - /** | |
| 98 | - * Use the optgroup to separate rooms from categories in the | |
| 99 | - * drop down menu, only if allrooms > 1 e categories > 1. | |
| 100 | - * | |
| 101 | - * @since 1.13.5 | |
| 102 | - */ | |
| 103 | - if (count($this->allrooms) > 1 && count($this->categories) > 1) { | |
| 91 | + echo $vbo_app->renderElementsDropDown([ | |
| 92 | + 'id' => 'roomsel', | |
| 93 | + 'elements' => 'listings', | |
| 94 | + 'placeholder' => JText::translate('VBO_LISTINGS'), | |
| 95 | + 'allow_clear' => 1, | |
| 96 | + 'attributes' => [ | |
| 97 | + 'name' => 'roomids[]', | |
| 98 | + 'multiple' => 'multiple', | |
| 99 | + ], | |
| 100 | + 'load_categories' => 1, | |
| 101 | + 'selected_values' => (array) JFactory::getApplication()->input->get('roomids', [], 'array'), | |
| 102 | + ]); | |
| 104 | 103 | ?> |
| 105 | - <optgroup label="<?php echo addslashes(JText::translate('VBOCATEGORYFILTER')); ?>"> | |
| 106 | - <?php | |
| 107 | - foreach ($this->categories as $cat) { | |
| 108 | - // we use negative values for the IDs of the categories | |
| 109 | - $cat_id = ($cat['id'] - ($cat['id'] * 2)); | |
| 110 | - ?> | |
| 111 | - <option value="<?php echo $cat_id; ?>"><?php echo (in_array($cat['id'], $this->reqcats) ? '- ' : '') . $cat['name']; ?></option> | |
| 112 | - <?php | |
| 113 | - } | |
| 114 | - ?> | |
| 115 | - </optgroup> | |
| 116 | - <?php | |
| 117 | - } | |
| 118 | - // | |
| 119 | - ?> | |
| 120 | - </select> | |
| 104 | + </span> | |
| 121 | 105 | </div> |
| 122 | 106 | <div class="btn-group pull-left"> |
| 123 | 107 | <span style="font-size: 15px;"> </span> |
| 124 | 108 | </div> |
| @@ -158,12 +142,9 @@ | ||
| 158 | 142 | $layout_data = [ |
| 159 | 143 | 'tool' => 'tableaux', |
| 160 | 144 | ]; |
| 161 | 145 | // render the permissions layout |
| 162 | - echo JLayoutHelper::render('operators.permissions', $layout_data, null, [ | |
| 163 | - 'component' => 'com_vikbooking', | |
| 164 | - 'client' => 'administrator', | |
| 165 | - ]); | |
| 146 | + echo JLayoutHelper::render('operators.permissions', $layout_data); | |
| 166 | 147 | |
| 167 | 148 | // count the cells per month |
| 168 | 149 | $thead_info = array(); |
| 169 | 150 | $months_days = array(); |
| @@ -707,10 +688,9 @@ | ||
| 707 | 688 | checkinLbl: "<?php echo addslashes(JText::translate('VBPICKUPAT')); ?>", |
| 708 | 689 | checkoutLbl: "<?php echo addslashes(JText::translate('VBRELEASEAT')); ?>", |
| 709 | 690 | numChildren: "<?php echo addslashes(JText::translate('VBEDITORDERCHILDREN')); ?>", |
| 710 | 691 | totalAmount: "<?php echo addslashes(JText::translate('VBEDITORDERNINE')); ?>", |
| 711 | - totalPaid: "<?php echo addslashes(JText::translate('VBPEDITBUSYTOTPAID')); ?>", | |
| 712 | - currencySymb: "<?php echo $currencysymb; ?>" | |
| 692 | + totalPaid: "<?php echo addslashes(JText::translate('VBPEDITBUSYTOTPAID')); ?>" | |
| 713 | 693 | }; |
| 714 | 694 | |
| 715 | 695 | function registerHoveringTooltip(that) { |
| 716 | 696 | if (hovtip) { |
| @@ -846,11 +826,11 @@ | ||
| 846 | 826 | if (v.hasOwnProperty('channelimg')) { |
| 847 | 827 | bcont += "<div class=\"vbo-overview-tip-bprovenience\"><span class=\"vbo-overview-tip-lbl\"><?php echo addslashes(JText::translate('VBPVIEWORDERCHANNEL')); ?></span><span class=\"vbo-overview-tip-cnt\">"+v.channelimg+"</span></div>"; |
| 848 | 828 | } |
| 849 | 829 | bcont += "<div class=\"vbo-overview-tip-bookingcont-total\">"; |
| 850 | - bcont += "<div class=\"vbo-overview-tip-btot\"><span class=\"vbo-overview-tip-lbl\">"+vboMessages.totalAmount+"</span><span class=\"vbo-overview-tip-cnt\">"+vboMessages.currencySymb+" "+v.format_tot+"</span></div>"; | |
| 830 | + bcont += "<div class=\"vbo-overview-tip-btot\"><span class=\"vbo-overview-tip-lbl\">"+vboMessages.totalAmount+"</span><span class=\"vbo-overview-tip-cnt\">" + VBOCore.getCurrency().display(v.format_tot) + "</span></div>"; | |
| 851 | 831 | if (v.totpaid > 0.00) { |
| 852 | - bcont += "<div class=\"vbo-overview-tip-btot\"><span class=\"vbo-overview-tip-lbl\">"+vboMessages.totalPaid+"</span><span class=\"vbo-overview-tip-cnt\">"+vboMessages.currencySymb+" "+v.format_totpaid+"</span></div>"; | |
| 832 | + bcont += "<div class=\"vbo-overview-tip-btot\"><span class=\"vbo-overview-tip-lbl\">"+vboMessages.totalPaid+"</span><span class=\"vbo-overview-tip-cnt\">" + VBOCore.getCurrency().display(v.format_totpaid) + "</span></div>"; | |
| 853 | 833 | } |
| 854 | 834 | var getnotes = v.adminnotes; |
| 855 | 835 | if (getnotes !== null && getnotes.length) { |
| 856 | 836 | bcont += "<div class=\"vbo-overview-tip-notes\"><span class=\"vbo-overview-tip-lbl\"><span class=\"vbo-overview-tip-notes-inner\"><i class=\"vboicn-info hasTooltip\" title=\""+getnotes+"\"></i></span></span></div>"; |
| @@ -985,9 +965,9 @@ | ||
| 985 | 965 | } |
| 986 | 966 | }).done(function(res) { |
| 987 | 967 | // parse the JSON response that contains the fest object for the passed date |
| 988 | 968 | try { |
| 989 | - var stored_fest = JSON.parse(res); | |
| 969 | + var stored_fest = typeof res === 'string' ? JSON.parse(res) : res; | |
| 990 | 970 | if (!vboFests.hasOwnProperty(stored_fest['dt'])) { |
| 991 | 971 | // we need to add the proper class to all cells to show that there is a fest |
| 992 | 972 | jQuery('td.vbo-tableaux-daycell[data-ymd="'+stored_fest['dt']+'"]').addClass('vbo-tableaux-festcell'); |
| 993 | 973 | } |
| @@ -1324,10 +1304,8 @@ | ||
| 1324 | 1304 | |
| 1325 | 1305 | jQuery(function() { |
| 1326 | 1306 | // add listener to scroll event on the main table |
| 1327 | 1307 | document.getElementById('vbo-tableaux-table-scroller').addEventListener('scroll', vboDebounceScroll(vboHandleScroll, 1000)); |
| 1328 | - | |
| 1329 | - jQuery("#roomsel, .vbo-perm-roomsel").select2({placeholder: '<?php echo addslashes(JText::translate('VBCOUPONALLVEHICLES')); ?>', width: "300px", allowClear: true}); | |
| 1330 | 1308 | |
| 1331 | 1309 | jQuery('#vbo-date-from').datepicker({ |
| 1332 | 1310 | showOn: 'focus', |
| 1333 | 1311 | dateFormat: '<?php echo $juidf; ?>', |
| @@ -1375,8 +1353,17 @@ | ||
| 1375 | 1353 | jQuery('.vbo-tableaux-booking-checkin, .vbo-tableaux-booking-checkout, .vbo-tableaux-booking-stay').hover(function() { |
| 1376 | 1354 | registerHoveringTooltip(this); |
| 1377 | 1355 | }, unregisterHoveringTooltip); |
| 1378 | 1356 | |
| 1357 | + // view booking snapshot | |
| 1358 | + jQuery('.vbo-tableaux-booking').on('click', function(e) { | |
| 1359 | + e.stopPropagation(); | |
| 1360 | + let bid = jQuery(this).attr('data-bid'); | |
| 1361 | + if (bid) { | |
| 1362 | + VBOCore.handleDisplayWidgetNotification({widget_id: 'booking_details'}, {booking_id: bid}); | |
| 1363 | + } | |
| 1364 | + }); | |
| 1365 | + | |
| 1379 | 1366 | jQuery(document).keydown(function(e) { |
| 1380 | 1367 | if (e.keyCode == 27) { |
| 1381 | 1368 | if (hovtip === true) { |
| 1382 | 1369 | hideVboTooltip(); |
| @@ -1391,15 +1378,15 @@ | ||
| 1391 | 1378 | }); |
| 1392 | 1379 | |
| 1393 | 1380 | jQuery(document).mouseup(function(e) { |
| 1394 | 1381 | if (!hovtip && !vbodialogfests_on && !vbodialogrdaynotes_on) { |
| 1395 | - return false; | |
| 1382 | + return; | |
| 1396 | 1383 | } |
| 1397 | 1384 | if (hovtip) { |
| 1398 | 1385 | var vbo_overlay_cont = jQuery(".vbo-overview-tipblock"); |
| 1399 | 1386 | if (!vbo_overlay_cont.is(e.target) && vbo_overlay_cont.has(e.target).length === 0) { |
| 1400 | 1387 | hideVboTooltip(); |
| 1401 | - return true; | |
| 1388 | + return; | |
| 1402 | 1389 | } |
| 1403 | 1390 | } |
| 1404 | 1391 | if (vbodialogfests_on) { |
| 1405 | 1392 | var vbo_overlay_cont = jQuery(".vbo-modal-overlay-content-fests"); |