PageSourceSearch

https://nnyln.org/wp-content/plugins/booking-system/assets/js/fees/frontend-fees.js?ver=2.9.9.6.9

js nnyln.org collected 2026-10-02 10:51:51 UTC 9,039 bytes, 244 lines download raw bytes

1
2/*
3* Title                   : Pinpoint Booking System WordPress Plugin (PRO)
4* Version                 : 2.1.2
5* File                    : assets/js/fees/frontend-fees.js
6* File Version            : 1.0
7* Created / Last Modified : 08 November 2015
8* Author                  : Dot on Paper
9* Copyright               : © 2012 Dot on Paper
10* Website                 : http://www.dotonpaper.net
11* Description             : Frontend end fees JavaScript class.
12*/
13
14var DOPBSPFrontEndFees = new function(){
15    'use strict';
16    
17    /*
18     * Private variables.
19     */
20    var $ = jQuery.noConflict();
21    
22    /*
23     * Constructor
24     */
25    this.__construct = function(){
26    };
27           
28    /*
29     * Get fees.
30     * 
31     * @param ID (Number): calendar ID
32     * @param reservationPrice (Number): reservation price
33     * @param discountPrice (Number): discount price
34     * @param extrasPrice (Number): extras price
35     * @param ciDay (String): check in day
36     * @param ciDay (String): check in day
37     * @param startHour (String): start hour
38     * @param endHour (String): start hour
39     * @param noItems (Number): number of reserved items
40     * 
41     * @retun fees
42     */ 
43    this.get = function(ID,
44                        reservationPrice,
45                        discountPrice,
46                        extrasPrice,
47                        ciDay,
48                        coDay,
49                        startHour,
50                        endHour,
51                        noItems){
52        var dataDays = DOPBSPFrontEnd.calendar[ID]['days']['data'],
53        dataFees = DOPBSPFrontEnd.calendar[ID]['fees']['data'],
54        dataHours = DOPBSPFrontEnd.calendar[ID]['hours']['data'],
55        dataWooCommerce = DOPBSPFrontEnd.calendar[ID]['woocommerce']['data'],
56        fees = dataFees['fees'],
57        i,
58        timeLapse;
59                
60        /*
61         * Verify days/hours.
62         */
63        coDay = coDay === '' ? ciDay:coDay;
64        endHour = endHour === '' ? startHour:endHour;
65                
66        /*
67         * Calculate price.
68         */
69        timeLapse = dataHours['enabled'] ? DOPPrototypes.getHoursDifference(startHour, endHour, 'hours')+(dataHours['addLastHourToTotalPrice'] ? 1:0):
70                                           DOPPrototypes.getNoDays(ciDay, coDay)-(dataDays['morningCheckOut'] ? 1:0);
71                                                    
72        for (i=0; i<fees.length; i++){
73            fees[i]['price_total'] = this.getPrice(ID,
74                                                   [fees[i]],
75                                                   reservationPrice,
76                                                   discountPrice,
77                                                   extrasPrice,
78                                                   ciDay,
79                                                   coDay,
80                                                   startHour,
81                                                   endHour,
82                                                   noItems);
83        }
84                
85        return fees;
86    };
87    
88    /*
89     * Get fees value.
90     * 
91     * @param ID (Number): calendar ID
92     * @param fees (Array): list of fees
93     * @param reservationPrice (Number): reservation price
94     * @param discountPrice (Number): discount price
95     * @param extrasPrice (Number): extras price
96     * @param ciDay (String): check in day
97     * @param ciDay (String): check in day
98     * @param startHour (String): start hour
99     * @param endHour (String): start hour
100     * @param noItems (Number): number of reserved items
101     * 
102     * @retun fees price value
103     */
104    this.getPrice = function(ID,
105                             fees,
106                             reservationPrice,
107                             discountPrice,
108                             extrasPrice,
109                             ciDay,
110                             coDay,
111                             startHour,
112                             endHour,
113                             noItems){
114        var dataDays = DOPBSPFrontEnd.calendar[ID]['days']['data'],
115        dataHours = DOPBSPFrontEnd.calendar[ID]['hours']['data'],
116        dataWooCommerce = DOPBSPFrontEnd.calendar[ID]['woocommerce']['data'],
117        fee,
118        i,
119        price = 0,
120        timeLapse;
121        
122        /*
123         * Verify days/hours.
124         */
125        coDay = coDay === '' ? ciDay:coDay;
126        endHour = endHour === '' ? startHour:endHour;
127
128        /*
129         * Calculate price.
130         */
131        timeLapse = dataHours['enabled'] ? DOPPrototypes.getHoursDifference(startHour, endHour, 'hours')+(dataHours['addLastHourToTotalPrice'] ? 1:0):
132                                           DOPPrototypes.getNoDays(ciDay, coDay)-(dataDays['morningCheckOut'] ? 1:0);
133
134        for (i=0; i<fees.length; i++){
135            fee = fees[i];
136
137            if (fee['included'] === 'false'){
138                price += (fee['operation'] === '-' ? -1:1)
139                         *(fee['price_by'] === 'once' ? 1:timeLapse)
140                         *parseFloat(fee['price'])
141                         *(fee['price_type'] === 'fixed' ? noItems:(reservationPrice+discountPrice+(fee['extras'] === 'true' ? extrasPrice:0)))/
142                         (fee['price_type'] === 'fixed' ? 1:100);
143            }
144        }
145
146        return price;
147    };
148    
149    /*
150     * Set fees details.
151     * 
152     * @param ID (Number): calendar ID
153     * @param type (String): set where to display fees details
154     *                       "reservation" display details in reservation
155     *                       "cart" display details in cart
156     * @param fees (Array): list of fees
157     * @param reservationPrice (Number): reservation price
158     * @param discountPrice (Number): discount price
159     * @param extrasPrice (Number): extras price
160     * @param ciDay (String): check in day
161     * @param ciDay (String): check in day
162     * @param startHour (String): start hour
163     * @param endHour (String): start hour
164     * @param noItems (Number): number of reserved items
165     * 
166     * @retun HTML
167     */
168    this.set = function(ID,
169                        type,
170                        fees,
171                        ciDay,
172                        coDay,
173                        startHour,
174                        endHour){
175        var dataCart = DOPBSPFrontEnd.calendar[ID]['cart']['data'],
176        dataHours = DOPBSPFrontEnd.calendar[ID]['hours']['data'],
177        HTML = new Array(),
178        i;
179
180        /*
181         * Verify days/hours.
182         */
183        coDay = coDay === '' ? ciDay:coDay;
184        endHour = endHour === '' ? startHour:endHour;
185
186        if (fees.length > 0){
187            HTML.push(' <tr class="dopbsp-separator">');
188            HTML.push('     <td class="dopbsp-label"><div class="dopbsp-line"></div></td>');
189            HTML.push('     <td class="dopbsp-value"><div class="dopbsp-line"></div></td>');
190            HTML.push(' </tr>');
191        }
192
193        for (i=0; i<fees.length; i++){
194            if ((type === 'reservation'
195                            && (fees[i]['cart'] === 'false'
196                                    || !dataCart['enabled']))
197                    || (type === 'cart'
198                            && fees[i]['cart'] === 'true')){
199                HTML.push(' <tr>');
200                HTML.push('     <td class="dopbsp-label">'+fees[i]['translation']+'</td>');
201                HTML.push('     <td class="dopbsp-value">');
202
203                /*
204                 * Set fee rule.
205                 */
206
207                if (fees[i]['price_type'] !== 'fixed' 
208                        || fees[i]['price_by'] !== 'once'){
209                    HTML.push('         <span class="dopbsp-info-rule">&#9632;&nbsp;');
210
211                    if (fees[i]['price_type'] === 'fixed'){
212                        HTML.push(fees[i]['operation']+DOPBSPFrontEnd.setPrice(ID, fees[i]['price']));
213                    }
214                    else{
215                        HTML.push(fees[i]['operation']+fees[i]['price']+'%');
216                    }
217
218                    if (fees[i]['price_by'] !== 'once'){
219                        HTML.push('/'+(dataHours['enabled'] ? DOPBSPFrontEnd.text(ID, 'fees', 'byHour'):DOPBSPFrontEnd.text(ID, 'fees', 'byDay')));
220                    }
221                    HTML.push('         </span><br />');
222                }
223                HTML.push('         <span class="dopbsp-info-price">');
224
225                /*
226                 * Set fee value.
227                 */
228                if (fees[i]['included'] === 'true'){
229                    HTML.push(DOPBSPFrontEnd.text(ID, 'fees', 'included'));
230                }
231                else{
232                    HTML.push(fees[i]['operation']+'&nbsp;'+DOPBSPFrontEnd.setPrice(ID, fees[i]['price_total']));
233                }
234                HTML.push('         </span>');
235                HTML.push('     </td>');
236                HTML.push(' </tr>');
237            }
238        }
239
240        return HTML.join('');
241    };
242    
243    return this.__construct();
244};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.