| @@ -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,50 +85,34 @@ | ||
| 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> |
| 125 | 109 | <div class="btn-group pull-left input-append"> |
| 126 | - <input type="text" id="vbo-date-from" placeholder="<?php echo JText::translate('VBNEWSEASONONE'); ?>" value="<?php echo date($df, $fromts); ?>" size="14" name="fromdate" onfocus="this.blur();" /> | |
| 110 | + <input type="text" id="vbo-date-from" placeholder="<?php echo JText::translate('VBNEWSEASONONE'); ?>" value="<?php echo date($df, $fromts); ?>" size="14" name="tbxfromdate" onfocus="this.blur();" /> | |
| 127 | 111 | <button type="button" class="btn" id="vbo-date-from-trig"><i class="icon-calendar"></i></button> |
| 128 | 112 | </div> |
| 129 | 113 | <div class="btn-group pull-left input-append"> |
| 130 | - <input type="text" id="vbo-date-to" placeholder="<?php echo JText::translate('VBNEWSEASONTWO'); ?>" value="<?php echo date($df, $tots); ?>" size="14" name="todate" onfocus="this.blur();" /> | |
| 114 | + <input type="text" id="vbo-date-to" placeholder="<?php echo JText::translate('VBNEWSEASONTWO'); ?>" value="<?php echo date($df, $tots); ?>" size="14" name="tbxtodate" onfocus="this.blur();" /> | |
| 131 | 115 | <button type="button" class="btn" id="vbo-date-to-trig"><i class="icon-calendar"></i></button> |
| 132 | 116 | </div> |
| 133 | 117 | <div class="btn-group pull-left"> |
| 134 | 118 | <span style="font-size: 15px;"> </span> |
| @@ -136,9 +120,9 @@ | ||
| 136 | 120 | <div class="btn-group pull-left"> |
| 137 | 121 | <button type="submit" class="btn"><i class="icon-search"></i> <?php echo JText::translate('VBAPPLY'); ?></button> |
| 138 | 122 | </div> |
| 139 | 123 | <div class="btn-group pull-right"> |
| 140 | - <a href="javascript: void(0);" onclick="vboManagePermissions();" class="vbo-perms-operators"><i class="vboicn-user-plus icn-nomargin"></i> <span><?php echo JText::translate('VBOPERMSOPERATORS'); ?></span></a> | |
| 124 | + <a href="javascript: void(0);" onclick="VBOCore.emitEvent('vbo-tool-permissions-modal-toggle');" class="vbo-perms-operators"><i class="vboicn-user-plus icn-nomargin"></i> <span><?php echo JText::translate('VBOPERMSOPERATORS'); ?></span></a> | |
| 141 | 125 | </div> |
| 142 | 126 | <div class="btn-group pull-right"> |
| 143 | 127 | <a href="javascript: void(0);" onclick="vboSendPrintTableaux();" class="vbcsvexport"><?php VikBookingIcons::e('print'); ?> <span><?php echo JText::translate('VBOPRINT'); ?></span></a> |
| 144 | 128 | </div> |
| @@ -148,8 +132,20 @@ | ||
| 148 | 132 | <input type="hidden" name="option" value="com_vikbooking" /> |
| 149 | 133 | </form> |
| 150 | 134 | |
| 151 | 135 | <?php |
| 136 | + /** | |
| 137 | + * Render the permissions layout to manage the permissions of | |
| 138 | + * a specific tool, tableaux, for all the operators. | |
| 139 | + * | |
| 140 | + * @since 1.16.9 (J) - 1.6.9 (WP) | |
| 141 | + */ | |
| 142 | + $layout_data = [ | |
| 143 | + 'tool' => 'tableaux', | |
| 144 | + ]; | |
| 145 | + // render the permissions layout | |
| 146 | + echo JLayoutHelper::render('operators.permissions', $layout_data); | |
| 147 | + | |
| 152 | 148 | // count the cells per month |
| 153 | 149 | $thead_info = array(); |
| 154 | 150 | $months_days = array(); |
| 155 | 151 | $nowinfo = getdate($fromts); |
| @@ -487,13 +483,13 @@ | ||
| 487 | 483 | } |
| 488 | 484 | } |
| 489 | 485 | if (count($custvalues) > 1) { |
| 490 | 486 | $enoughinfo = true; |
| 491 | - $cellcont .= '<span class="vbo-tableaux-guest-name">' . implode(' ', $custvalues) . '</span>';; | |
| 487 | + $cellcont .= '<span class="vbo-tableaux-guest-name">' . implode(' ', $custvalues) . '</span>'; | |
| 492 | 488 | } |
| 493 | 489 | } |
| 494 | 490 | if (!$enoughinfo) { |
| 495 | - $cellcont .= '<span class="vbo-tableaux-guest-name">' . $rbook['idorder'] . '</span>';; | |
| 491 | + $cellcont .= '<span class="vbo-tableaux-guest-name">' . $rbook['idorder'] . '</span>'; | |
| 496 | 492 | } |
| 497 | 493 | } |
| 498 | 494 | |
| 499 | 495 | // distinctive features |
| @@ -581,125 +577,8 @@ | ||
| 581 | 577 | </div> |
| 582 | 578 | |
| 583 | 579 | </div> |
| 584 | 580 | |
| 585 | -<?php | |
| 586 | -$opobj = VikBooking::getOperatorInstance(); | |
| 587 | -$all_operators = $opobj->getAll(); | |
| 588 | -$currentops = $opobj->getOperatorsFromPermissions('tableaux', $all_operators); | |
| 589 | - | |
| 590 | -// build JS strings for operators and rooms drop downs | |
| 591 | -$jsoperators = "<select name='oper_id[%s]' class='vbo-perm-opersel-js-%s'><option value=''>-----</option>"; | |
| 592 | -foreach ($all_operators as $v) { | |
| 593 | - $jsoperators .= "<option value='".$v['id']."'>".addslashes(trim($v['first_name'].' '.$v['last_name']))."</option>"; | |
| 594 | -} | |
| 595 | -$jsoperators .= "</select>"; | |
| 596 | -// | |
| 597 | -$jsrooms = "<select name='oper_rooms[%s][]' class='vbo-perm-roomsel-js-%s' multiple='multiple'><option></option>"; | |
| 598 | -foreach ($this->allrooms as $rid => $rdata) { | |
| 599 | - $jsrooms .= "<option value='".$rid."'>".addslashes($rdata['name'])."</option>"; | |
| 600 | -} | |
| 601 | -$jsrooms .= "</select>"; | |
| 602 | -?> | |
| 603 | - | |
| 604 | -<div class="vbo-modal-overlay-block vbo-modal-overlay-block-tableauxperms"> | |
| 605 | - <a class="vbo-modal-overlay-close" href="javascript: void(0);"></a> | |
| 606 | - <div class="vbo-modal-overlay-content vbo-modal-overlay-content-large vbo-modal-overlay-content-tableauxperms"> | |
| 607 | - <div class="vbo-modal-overlay-content-head vbo-modal-overlay-content-head-dashwidgets"> | |
| 608 | - <h3><span><?php echo $vbo_app->createPopover(array('title' => JText::translate('VBOPERMSOPERATORS'), 'content' => JText::translate('VBOPERMSOPERATORSSHELP'))); ?> <?php echo JText::translate('VBOPERMSOPERATORS'); ?></span> <span class="vbo-modal-overlay-close-times" onclick="hideVboDialog();">×</span></h3> | |
| 609 | - </div> | |
| 610 | - <div class="vbo-modal-overlay-content-body vbo-modal-overlay-content-body-scroll"> | |
| 611 | - <div class="vbo-tableauxperms-info-list"> | |
| 612 | - <form action="index.php?option=com_vikbooking&task=operatorperms" method="post" id="vbo-tblx-fperms"> | |
| 613 | - <?php | |
| 614 | - $opindex = 1; | |
| 615 | - foreach ($currentops as $op) { | |
| 616 | - ?> | |
| 617 | - <div class="vbo-pmsperm-entry-wrap"> | |
| 618 | - <div class="vbo-pmsperm-entry-cont"> | |
| 619 | - <div class="vbo-pmsperm-entry-lbl"> | |
| 620 | - <?php echo JText::translate('VBOOPERATOR'); ?> | |
| 621 | - </div> | |
| 622 | - <div class="vbo-pmsperm-entry-val"> | |
| 623 | - <input type="hidden" name="oper_id[<?php echo $opindex; ?>]" value="<?php echo $op['id']; ?>" /> | |
| 624 | - <span><?php echo $op['first_name'].' '.$op['last_name']; ?></span> | |
| 625 | - </div> | |
| 626 | - </div> | |
| 627 | - <div class="vbo-pmsperm-entry-cont"> | |
| 628 | - <div class="vbo-pmsperm-entry-lbl"> | |
| 629 | - <?php echo JText::translate('VBOPERMTBLXDAYS'); ?> | |
| 630 | - </div> | |
| 631 | - <div class="vbo-pmsperm-entry-val"> | |
| 632 | - <input type="number" name="oper_days[<?php echo $opindex; ?>]" value="<?php echo $op['perms']['days']; ?>" min="1" /> | |
| 633 | - </div> | |
| 634 | - </div> | |
| 635 | - <div class="vbo-pmsperm-entry-cont"> | |
| 636 | - <div class="vbo-pmsperm-entry-lbl"> | |
| 637 | - <?php echo JText::translate('VBOPERMTBLXROOMS'); ?> | |
| 638 | - </div> | |
| 639 | - <div class="vbo-pmsperm-entry-val"> | |
| 640 | - <select class="vbo-perm-roomsel" name="oper_rooms[<?php echo $opindex; ?>][]" multiple="multiple"> | |
| 641 | - <option></option> | |
| 642 | - <?php | |
| 643 | - foreach ($this->allrooms as $rid => $rdata) { | |
| 644 | - ?> | |
| 645 | - <option value="<?php echo $rid; ?>"<?php echo in_array($rid, $op['perms']['rooms']) ? ' selected="selected"' : ''; ?>><?php echo $rdata['name']; ?></option> | |
| 646 | - <?php | |
| 647 | - } | |
| 648 | - ?> | |
| 649 | - </select> | |
| 650 | - </div> | |
| 651 | - </div> | |
| 652 | - <div class="vbo-pmsperm-entry-cont"> | |
| 653 | - <div class="vbo-pmsperm-entry-lbl"> | |
| 654 | - <?php echo JText::translate('VBOCUSTOMERDETAILS'); ?> | |
| 655 | - </div> | |
| 656 | - <div class="vbo-pmsperm-entry-val"> | |
| 657 | - <select name="oper_guestname[<?php echo $opindex; ?>]"> | |
| 658 | - <option value="1"<?php echo !empty($op['perms']['guestname']) ? ' selected="selected"' : ''; ?>><?php echo JText::translate('VBYES'); ?></option> | |
| 659 | - <option value="0"<?php echo empty($op['perms']['guestname']) ? ' selected="selected"' : ''; ?>><?php echo JText::translate('VBNO'); ?></option> | |
| 660 | - </select> | |
| 661 | - </div> | |
| 662 | - </div> | |
| 663 | - <div class="vbo-pmsperm-entry-cont"> | |
| 664 | - <div class="vbo-pmsperm-entry-lbl"> | |
| 665 | - <?php echo JText::translate('VBPEDITBUSYEXTRACOSTS'); ?> | |
| 666 | - </div> | |
| 667 | - <div class="vbo-pmsperm-entry-val"> | |
| 668 | - <select name="oper_roomextras[<?php echo $opindex; ?>]"> | |
| 669 | - <option value="1"<?php echo !empty($op['perms']['roomextras']) ? ' selected="selected"' : ''; ?>><?php echo JText::translate('VBYES'); ?></option> | |
| 670 | - <option value="0"<?php echo empty($op['perms']['roomextras']) ? ' selected="selected"' : ''; ?>><?php echo JText::translate('VBNO'); ?></option> | |
| 671 | - </select> | |
| 672 | - </div> | |
| 673 | - </div> | |
| 674 | - <div class="vbo-pmsperm-entry-cont"> | |
| 675 | - <div class="vbo-pmsperm-entry-rm"> | |
| 676 | - <button type="button" class="btn btn-danger" onclick="vboSetRemoveOpPerm(this, <?php echo $op['id']; ?>);">×</button> | |
| 677 | - </div> | |
| 678 | - </div> | |
| 679 | - </div> | |
| 680 | - <?php | |
| 681 | - $opindex++; | |
| 682 | - } | |
| 683 | - ?> | |
| 684 | - <input type="hidden" name="permtype" value="tableaux" /> | |
| 685 | - <input type="hidden" name="task" value="operatorperms" /> | |
| 686 | - <input type="hidden" name="option" value="com_vikbooking" /> | |
| 687 | - </form> | |
| 688 | - </div> | |
| 689 | - </div> | |
| 690 | - <div class="vbo-modal-overlay-content-footer"> | |
| 691 | - <div class="vbo-modal-overlay-content-footer-left"> | |
| 692 | - <button type="button" class="btn btn-secondary" onclick="javascript: vboAddPermission();"><?php VikBookingIcons::e('plus-circle'); ?> <?php echo JText::translate('VBOADDOPERATORPERM'); ?></button> | |
| 693 | - </div> | |
| 694 | - <div class="vbo-modal-overlay-content-footer-right"> | |
| 695 | - <button type="button" class="btn btn-success btn-large" onclick="document.getElementById('vbo-tblx-fperms').submit();"><?php echo JText::translate('VBAPPLY'); ?></button> | |
| 696 | - <button type="button" class="btn btn-danger btn-large" onclick="javascript: hideVboDialog();"><?php echo JText::translate('VBANNULLA'); ?></button> | |
| 697 | - </div> | |
| 698 | - </div> | |
| 699 | - </div> | |
| 700 | -</div> | |
| 701 | - | |
| 702 | 581 | <div class="vbo-modal-overlay-block vbo-modal-overlay-block-fests"> |
| 703 | 582 | <a class="vbo-modal-overlay-close" href="javascript: void(0);"></a> |
| 704 | 583 | <div class="vbo-modal-overlay-content vbo-modal-overlay-content-fests"> |
| 705 | 584 | <div class="vbo-modal-overlay-content-head vbo-modal-overlay-content-head-fests"> |
| @@ -764,80 +643,12 @@ | ||
| 764 | 643 | |
| 765 | 644 | <script type="text/javascript"> |
| 766 | 645 | var vboFests = <?php echo json_encode($this->festivities); ?>; |
| 767 | 646 | var vboRdayNotes = <?php echo json_encode($this->rdaynotes); ?>; |
| 768 | -var operatoridsel = "<?php echo $jsoperators; ?>"; | |
| 769 | -var operatorroomsel = "<?php echo $jsrooms; ?>"; | |
| 770 | -var opindex = <?php echo $opindex; ?>; | |
| 771 | 647 | var vbodialog_on = false; |
| 772 | 648 | var vbodialogfests_on = false; |
| 773 | 649 | var vbodialogrdaynotes_on = false; |
| 774 | 650 | |
| 775 | -function hideVboDialog() { | |
| 776 | - if (vbodialog_on === true) { | |
| 777 | - jQuery(".vbo-modal-overlay-block-tableauxperms").fadeOut(400, function() { | |
| 778 | - jQuery(".vbo-modal-overlay-content-tableauxperms").show(); | |
| 779 | - }); | |
| 780 | - vbodialog_on = false; | |
| 781 | - } | |
| 782 | -} | |
| 783 | - | |
| 784 | -function vboManagePermissions() { | |
| 785 | - jQuery('.vbo-modal-overlay-block-tableauxperms').fadeIn(); | |
| 786 | - vbodialog_on = true; | |
| 787 | -} | |
| 788 | - | |
| 789 | -function vboAddPermission() { | |
| 790 | - opindex++; | |
| 791 | - var newperm = ''; | |
| 792 | - newperm += '<div class="vbo-pmsperm-entry-wrap">'; | |
| 793 | - newperm += ' <div class="vbo-pmsperm-entry-cont">'; | |
| 794 | - newperm += ' <div class="vbo-pmsperm-entry-lbl"><?php echo addslashes(JText::translate('VBOOPERATOR')); ?></div>'; | |
| 795 | - newperm += ' <div class="vbo-pmsperm-entry-val">'+operatoridsel.replace(/%s/g, opindex)+'</div>'; | |
| 796 | - newperm += ' </div>'; | |
| 797 | - newperm += ' <div class="vbo-pmsperm-entry-cont">'; | |
| 798 | - newperm += ' <div class="vbo-pmsperm-entry-lbl"><?php echo addslashes(JText::translate('VBOPERMTBLXDAYS')); ?></div>'; | |
| 799 | - newperm += ' <div class="vbo-pmsperm-entry-val"><input type="number" name="oper_days['+opindex+']" value="14" min="1" /></div>'; | |
| 800 | - newperm += ' </div>'; | |
| 801 | - newperm += ' <div class="vbo-pmsperm-entry-cont">'; | |
| 802 | - newperm += ' <div class="vbo-pmsperm-entry-lbl"><?php echo addslashes(JText::translate('VBOPERMTBLXROOMS')); ?></div>'; | |
| 803 | - newperm += ' <div class="vbo-pmsperm-entry-val">'+operatorroomsel.replace(/%s/g, opindex)+'</div>'; | |
| 804 | - newperm += ' </div>'; | |
| 805 | - newperm += ' <div class="vbo-pmsperm-entry-cont">'; | |
| 806 | - newperm += ' <div class="vbo-pmsperm-entry-lbl"><?php echo addslashes(JText::translate('VBOCUSTOMERDETAILS')); ?></div>'; | |
| 807 | - newperm += ' <div class="vbo-pmsperm-entry-val">'; | |
| 808 | - newperm += ' <select name="oper_guestname['+opindex+']">'; | |
| 809 | - newperm += ' <option value="1" selected="selected"><?php echo JText::translate('VBYES'); ?></option>'; | |
| 810 | - newperm += ' <option value="0"><?php echo JText::translate('VBNO'); ?></option>'; | |
| 811 | - newperm += ' </select>'; | |
| 812 | - newperm += ' </div>'; | |
| 813 | - newperm += ' </div>'; | |
| 814 | - newperm += ' <div class="vbo-pmsperm-entry-cont">'; | |
| 815 | - newperm += ' <div class="vbo-pmsperm-entry-lbl"><?php echo addslashes(JText::translate('VBPEDITBUSYEXTRACOSTS')); ?></div>'; | |
| 816 | - newperm += ' <div class="vbo-pmsperm-entry-val">'; | |
| 817 | - newperm += ' <select name="oper_roomextras['+opindex+']">'; | |
| 818 | - newperm += ' <option value="1"><?php echo JText::translate('VBYES'); ?></option>'; | |
| 819 | - newperm += ' <option value="0"><?php echo JText::translate('VBNO'); ?></option>'; | |
| 820 | - newperm += ' </select>'; | |
| 821 | - newperm += ' </div>'; | |
| 822 | - newperm += ' </div>'; | |
| 823 | - newperm += ' <div class="vbo-pmsperm-entry-cont">'; | |
| 824 | - newperm += ' <div class="vbo-pmsperm-entry-rm"><button type="button" class="btn btn-danger" onclick="vboSetRemoveOpPerm(this, -1);">×</button></div>'; | |
| 825 | - newperm += ' </div>'; | |
| 826 | - newperm += '</div>'; | |
| 827 | - jQuery('#vbo-tblx-fperms').append(newperm); | |
| 828 | - jQuery(".vbo-perm-roomsel-js-"+opindex).select2({placeholder: '<?php echo addslashes(JText::translate('VBCOUPONALLVEHICLES')); ?>', width: "200px", allowClear: true}); | |
| 829 | - jQuery(".vbo-perm-opersel-js-"+opindex).select2(); | |
| 830 | -} | |
| 831 | - | |
| 832 | -function vboSetRemoveOpPerm(that, oper_id) { | |
| 833 | - var elem = jQuery(that); | |
| 834 | - if (!isNaN(oper_id) && oper_id > 0) { | |
| 835 | - jQuery('#vbo-tblx-fperms').append('<input type="hidden" name="oper_rm[]" value="'+oper_id+'" />'); | |
| 836 | - } | |
| 837 | - elem.closest('.vbo-pmsperm-entry-wrap').remove(); | |
| 838 | -} | |
| 839 | - | |
| 840 | 651 | /** |
| 841 | 652 | * Fests dialog |
| 842 | 653 | */ |
| 843 | 654 | function hideVboDialogFests() { |
| @@ -877,10 +688,9 @@ | ||
| 877 | 688 | checkinLbl: "<?php echo addslashes(JText::translate('VBPICKUPAT')); ?>", |
| 878 | 689 | checkoutLbl: "<?php echo addslashes(JText::translate('VBRELEASEAT')); ?>", |
| 879 | 690 | numChildren: "<?php echo addslashes(JText::translate('VBEDITORDERCHILDREN')); ?>", |
| 880 | 691 | totalAmount: "<?php echo addslashes(JText::translate('VBEDITORDERNINE')); ?>", |
| 881 | - totalPaid: "<?php echo addslashes(JText::translate('VBPEDITBUSYTOTPAID')); ?>", | |
| 882 | - currencySymb: "<?php echo $currencysymb; ?>" | |
| 692 | + totalPaid: "<?php echo addslashes(JText::translate('VBPEDITBUSYTOTPAID')); ?>" | |
| 883 | 693 | }; |
| 884 | 694 | |
| 885 | 695 | function registerHoveringTooltip(that) { |
| 886 | 696 | if (hovtip) { |
| @@ -885,23 +695,48 @@ | ||
| 885 | 695 | function registerHoveringTooltip(that) { |
| 886 | 696 | if (hovtip) { |
| 887 | 697 | return false; |
| 888 | 698 | } |
| 699 | + | |
| 889 | 700 | if (hovtimer) { |
| 890 | 701 | clearTimeout(hovtimer); |
| 891 | 702 | hovtimer = null; |
| 892 | 703 | } |
| 704 | + | |
| 893 | 705 | var elem = jQuery(that); |
| 894 | 706 | var cellheight = elem.outerHeight(); |
| 707 | + | |
| 895 | 708 | hovtimer = setTimeout(function() { |
| 709 | + // turn flag on | |
| 896 | 710 | hovtip = true; |
| 897 | - jQuery( | |
| 898 | - "<div class=\"vbo-overview-tipblock\">"+ | |
| 899 | - "<div class=\"vbo-overview-tipinner\"><span class=\"vbo-overview-tiploading\">"+vboMessages.loadingTip+"</span></div>"+ | |
| 900 | - "<div class=\"vbo-overview-tipexpander\" style=\"display: none;\"><div class=\"vbo-overview-expandtoggle\"><i class=\"<?php echo VikBookingIcons::i('expand'); ?>\"></i></div></div>"+ | |
| 901 | - "</div>" | |
| 902 | - ).appendTo(elem); | |
| 903 | - jQuery(".vbo-overview-tipblock").css("bottom", "+="+cellheight); | |
| 711 | + | |
| 712 | + // calculate cell-element position | |
| 713 | + let pos_top = elem.offset().top; | |
| 714 | + let pos_left = elem.offset().left; | |
| 715 | + let elem_height = elem.outerHeight(); | |
| 716 | + let screen_width = window?.screen?.width || 0; | |
| 717 | + | |
| 718 | + // build tooltip block element | |
| 719 | + let tooltip_block = jQuery('<div></div>'); | |
| 720 | + tooltip_block.addClass('vbo-overview-tipblock'); | |
| 721 | + tooltip_block.append("<div class=\"vbo-overview-tipinner\"><span class=\"vbo-overview-tiploading\">" + vboMessages.loadingTip + "</span></div>"); | |
| 722 | + tooltip_block.append("<div class=\"vbo-overview-tipexpander\" style=\"display: none;\"><div class=\"vbo-overview-expandtoggle\"><i class=\"<?php echo VikBookingIcons::i('expand'); ?>\"></i></div></div>"); | |
| 723 | + | |
| 724 | + // calculate block position | |
| 725 | + tooltip_block.css('top', (pos_top + elem_height - 16) + 'px'); | |
| 726 | + // tooltip_block.css('left', (pos_left - 6) + 'px'); | |
| 727 | + if (screen_width > 600 && (pos_left + 400) > screen_width) { | |
| 728 | + // place the tooltip starting from right | |
| 729 | + tooltip_block.css('left', (pos_left - (400 - elem.outerWidth())) + 'px'); | |
| 730 | + } else { | |
| 731 | + // regular placing starting from left | |
| 732 | + tooltip_block.css('left', (pos_left - 6) + 'px'); | |
| 733 | + } | |
| 734 | + | |
| 735 | + // append block to body | |
| 736 | + tooltip_block.appendTo(jQuery('body')); | |
| 737 | + | |
| 738 | + // load tooltip bookings | |
| 904 | 739 | loadTooltipBookings(elem.attr('data-bid')); |
| 905 | 740 | }, 900); |
| 906 | 741 | } |
| 907 | 742 | |
| @@ -909,8 +744,11 @@ | ||
| 909 | 744 | clearTimeout(hovtimer); |
| 910 | 745 | hovtimer = null; |
| 911 | 746 | } |
| 912 | 747 | |
| 748 | +/** | |
| 749 | + * @deprecated 1.16.10 (J) - 1.6.10 (WP) | |
| 750 | + */ | |
| 913 | 751 | function adjustHoveringTooltip() { |
| 914 | 752 | setTimeout(function() { |
| 915 | 753 | var difflim = 35; |
| 916 | 754 | var otop = jQuery(".vbo-overview-tipblock").offset().top; |
| @@ -968,9 +806,9 @@ | ||
| 968 | 806 | // build content |
| 969 | 807 | var bcont = "<div class=\"vbo-overview-tip-bookingcont\">"; |
| 970 | 808 | bcont += "<div class=\"vbo-overview-tip-bookingcont-left\">"; |
| 971 | 809 | bcont += "<div class=\"vbo-overview-tip-bid\"><span class=\"vbo-overview-tip-lbl\">ID <span class=\"vbo-overview-tip-lbl-innerleft\"><a href=\"" + base_uri_edit.replace('%d', v.id) + "\" target=\"_blank\"><i class=\"<?php echo VikBookingIcons::i('edit'); ?>\"></i></a></span></span><span class=\"vbo-overview-tip-cnt\">"+v.id+"</span></div>"; |
| 972 | - bcont += "<div class=\"vbo-overview-tip-bstatus\"><span class=\"vbo-overview-tip-lbl\"><?php echo addslashes(JText::translate('VBPVIEWORDERSEIGHT')); ?></span><span class=\"vbo-overview-tip-cnt\"><div class=\"label "+(v.status == 'confirmed' ? 'label-success' : 'label-warning')+"\">"+v.status_lbl+"</div></span></div>"; | |
| 810 | + bcont += "<div class=\"vbo-overview-tip-bstatus\"><span class=\"vbo-overview-tip-lbl\"><?php echo addslashes(JText::translate('VBPVIEWORDERSEIGHT')); ?></span><span class=\"vbo-overview-tip-cnt\"><div class=\"badge "+(v.status == 'confirmed' ? 'badge-success' : 'badge-warning')+"\">"+v.status_lbl+"</div></span></div>"; | |
| 973 | 811 | bcont += "<div class=\"vbo-overview-tip-bdate\"><span class=\"vbo-overview-tip-lbl\"><?php echo addslashes(JText::translate('VBPVIEWORDERSONE')); ?></span><span class=\"vbo-overview-tip-cnt\"><a href=\"" + base_uri_details.replace('%d', v.id) + "\" target=\"_blank\">"+v.ts+"</a></span></div>"; |
| 974 | 812 | bcont += "</div>"; |
| 975 | 813 | bcont += "<div class=\"vbo-overview-tip-bookingcont-right\">"; |
| 976 | 814 | bcont += "<div class=\"vbo-overview-tip-bcustomer\"><span class=\"vbo-overview-tip-lbl\"><?php echo addslashes(JText::translate('VBOCUSTOMER')); ?></span><span class=\"vbo-overview-tip-cnt\">"+v.cinfo+"</span></div>"; |
| @@ -988,11 +826,11 @@ | ||
| 988 | 826 | if (v.hasOwnProperty('channelimg')) { |
| 989 | 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>"; |
| 990 | 828 | } |
| 991 | 829 | bcont += "<div class=\"vbo-overview-tip-bookingcont-total\">"; |
| 992 | - 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>"; | |
| 993 | 831 | if (v.totpaid > 0.00) { |
| 994 | - 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>"; | |
| 995 | 833 | } |
| 996 | 834 | var getnotes = v.adminnotes; |
| 997 | 835 | if (getnotes !== null && getnotes.length) { |
| 998 | 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>"; |
| @@ -1002,11 +840,15 @@ | ||
| 1002 | 840 | bcont += "</div>"; |
| 1003 | 841 | container.append(bcont); |
| 1004 | 842 | jQuery('.vbo-overview-tipexpander').show(); |
| 1005 | 843 | }); |
| 844 | + | |
| 845 | + /** | |
| 846 | + * @deprecated 1.16.10 (J) - 1.6.10 (WP) | |
| 847 | + */ | |
| 1006 | 848 | // adjust the position so that it won't go under other contents |
| 1007 | - adjustHoveringTooltip() | |
| 1008 | - // | |
| 849 | + // adjustHoveringTooltip(); | |
| 850 | + | |
| 1009 | 851 | } catch(err) { |
| 1010 | 852 | // restore |
| 1011 | 853 | hideVboTooltip(); |
| 1012 | 854 | // display error |
| @@ -1123,9 +965,9 @@ | ||
| 1123 | 965 | } |
| 1124 | 966 | }).done(function(res) { |
| 1125 | 967 | // parse the JSON response that contains the fest object for the passed date |
| 1126 | 968 | try { |
| 1127 | - var stored_fest = JSON.parse(res); | |
| 969 | + var stored_fest = typeof res === 'string' ? JSON.parse(res) : res; | |
| 1128 | 970 | if (!vboFests.hasOwnProperty(stored_fest['dt'])) { |
| 1129 | 971 | // we need to add the proper class to all cells to show that there is a fest |
| 1130 | 972 | jQuery('td.vbo-tableaux-daycell[data-ymd="'+stored_fest['dt']+'"]').addClass('vbo-tableaux-festcell'); |
| 1131 | 973 | } |
| @@ -1459,13 +1301,11 @@ | ||
| 1459 | 1301 | jQuery('table.vbo-tableaux-table').stickyTableHeaders({cacheHeaderHeight: true, fixedOffset: jQuery('.navbar')}); |
| 1460 | 1302 | tableauxStickySet = true; |
| 1461 | 1303 | } |
| 1462 | 1304 | |
| 1463 | -jQuery(document).ready(function() { | |
| 1305 | +jQuery(function() { | |
| 1464 | 1306 | // add listener to scroll event on the main table |
| 1465 | 1307 | document.getElementById('vbo-tableaux-table-scroller').addEventListener('scroll', vboDebounceScroll(vboHandleScroll, 1000)); |
| 1466 | - | |
| 1467 | - jQuery("#roomsel, .vbo-perm-roomsel").select2({placeholder: '<?php echo addslashes(JText::translate('VBCOUPONALLVEHICLES')); ?>', width: "300px", allowClear: true}); | |
| 1468 | 1308 | |
| 1469 | 1309 | jQuery('#vbo-date-from').datepicker({ |
| 1470 | 1310 | showOn: 'focus', |
| 1471 | 1311 | dateFormat: '<?php echo $juidf; ?>', |
| @@ -1513,16 +1353,22 @@ | ||
| 1513 | 1353 | jQuery('.vbo-tableaux-booking-checkin, .vbo-tableaux-booking-checkout, .vbo-tableaux-booking-stay').hover(function() { |
| 1514 | 1354 | registerHoveringTooltip(this); |
| 1515 | 1355 | }, unregisterHoveringTooltip); |
| 1516 | 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 | + | |
| 1517 | 1366 | jQuery(document).keydown(function(e) { |
| 1518 | 1367 | if (e.keyCode == 27) { |
| 1519 | 1368 | if (hovtip === true) { |
| 1520 | 1369 | hideVboTooltip(); |
| 1521 | 1370 | } |
| 1522 | - if (vbodialog_on === true) { | |
| 1523 | - hideVboDialog(); | |
| 1524 | - } | |
| 1525 | 1371 | if (vbodialogfests_on === true) { |
| 1526 | 1372 | hideVboDialogFests(); |
| 1527 | 1373 | } |
| 1528 | 1374 | if (vbodialogrdaynotes_on === true) { |
| @@ -1532,15 +1378,15 @@ | ||
| 1532 | 1378 | }); |
| 1533 | 1379 | |
| 1534 | 1380 | jQuery(document).mouseup(function(e) { |
| 1535 | 1381 | if (!hovtip && !vbodialogfests_on && !vbodialogrdaynotes_on) { |
| 1536 | - return false; | |
| 1382 | + return; | |
| 1537 | 1383 | } |
| 1538 | 1384 | if (hovtip) { |
| 1539 | 1385 | var vbo_overlay_cont = jQuery(".vbo-overview-tipblock"); |
| 1540 | 1386 | if (!vbo_overlay_cont.is(e.target) && vbo_overlay_cont.has(e.target).length === 0) { |
| 1541 | 1387 | hideVboTooltip(); |
| 1542 | - return true; | |
| 1388 | + return; | |
| 1543 | 1389 | } |
| 1544 | 1390 | } |
| 1545 | 1391 | if (vbodialogfests_on) { |
| 1546 | 1392 | var vbo_overlay_cont = jQuery(".vbo-modal-overlay-content-fests"); |