PluginProbe
Booking Calendar / 11.8.2
Booking Calendar v11.8.2
11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 All 203 releases
booking / includes / print / _src / bookings_print.js

bookings_print.js in Booking Calendar 11.8.2, at includes/print/_src/bookings_print.js

107 lines 4.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 "use strict";
2
3 function wpbc_print_dialog__show( booking_id_arr ){
4
5 if ( 'function' === typeof (jQuery( '#wpbc_ajx_print_modal' ).wpbc_my_modal) ){
6 jQuery( '#wpbc_ajx_print_modal' ).wpbc_my_modal( 'show' );
7
8
9 if ( undefined == booking_id_arr ){
10 booking_id_arr = [];
11 }
12 if ( ! Array.isArray( booking_id_arr ) ){
13 booking_id_arr = [booking_id_arr]
14 }
15 wpbc_print_dialog__define_content( booking_id_arr );
16 } else {
17 alert( 'Warning! Modal module( wpbc_my_modal ) had not define.' )
18 }
19 }
20
21 function wpbc_print_dialog__define_content( booking_id_arr = [] ){
22 // Set content.
23 jQuery( '#wpbc__print_frame__inner' ).html( jQuery( '.wpbc__list__table' ).html() );
24 // Define the same classes.
25 jQuery( '#wpbc__print_frame__inner' ).addClass( 'wpbc__list__table wpbc_selectable_table' );
26 /*
27 jQuery( '#wpbc__print_frame__inner .check-column').hide();
28 jQuery( '#wpbc__print_frame__inner .wpbc_actions_buttons').hide();
29 jQuery( '#wpbc_ajx_print_modal .modal-body').css({
30 maxHeight : "500px",
31 overflowY: "scroll"
32 });
33 */
34
35 // Hide some not selected rows, if user selected them
36 var selected_rows_arr;
37
38 if ( booking_id_arr.length == 0 ){
39 selected_rows_arr = wpbc_get_selected_row_id();
40 } else {
41 selected_rows_arr = booking_id_arr;
42 }
43
44 if ( selected_rows_arr.length > 0 ){
45
46 jQuery( '#wpbc__print_frame__inner .wpbc_selectable_body .wpbc_listing_usual_row' ).hide();
47
48 for ( var i = 0; i < selected_rows_arr.length; ++i ){
49 jQuery( "#wpbc__print_frame__inner #row_id_" + selected_rows_arr[ i ] ).show();
50 }
51 }
52
53 // Add cost as text labels to print layout
54 jQuery( '#wpbc__print_frame__inner .wpbc_selectable_body .wpbc_listing_usual_row' ).find( '.set_booking_cost_text_field' ).each( function ( index ){
55
56 var currency = jQuery( jQuery( this ).parent( '.ui_element' ).find( '.wpbc_ui_control_label' )[ 0 ] ).html();
57
58 jQuery( this ).parents( '.wpbc_listing_usual_row ' ).find( '.wpbc_col_booking_labels .content_text' ).append( '<span class="wpbc_label wpbc_label_booking_id">' + currency + ' ' + jQuery( this ).val() + '</span>' );
59 } );
60
61
62 // Add remark to the content of booking details
63 jQuery( '#wpbc__print_frame__inner .wpbc_selectable_body .wpbc_listing_usual_row' ).find( '.set_booking_note_text' ).each( function ( index ){
64
65 var remark_text = jQuery( this ).val().replace( /\r\n|\r|\n/g, "<br />" );
66
67 if ( '' != remark_text ){
68
69 jQuery( this ).parents( '.wpbc_listing_usual_row ' ).find( '.wpbc_col_data .content_text' ).append(
70 '<div class="wpbc_remark_text">'
71 + '<hr/><strong>Notes:</strong><br/>'
72 + remark_text
73 + '</div>'
74 );
75 }
76
77 } );
78 }
79
80 function wpbc_print_dialog__do_printing(){
81 jQuery( '#wpbc_content_for_js_print' ).wpbc_js_print(
82 {
83 debug : false, // show the iframe for debugging
84 importCSS : true, // import parent page css
85 importStyle : true, // import style tags
86 printContainer : true, // print outer container/$.selector
87 loadCSS : "", // path to additional css file - use an array [] for multiple
88 pageTitle : "", // add title to print page
89 removeInline : false, // remove inline styles from print elements
90 removeInlineSelector: "*", // custom selectors to filter inline styles. removeInline must be true
91 printDelay : 300, // variable print delay
92 header : null, // prefix to html
93 footer : null, // postfix to html
94 base : false, // preserve the BASE tag or accept a string for the URL
95 formValues : true, // preserve input/form values
96 canvas : true, // copy canvas content
97 doctypeString : '<!DOCTYPE html>', // enter a different doctype for older markup
98 removeScripts : false, // remove script tags from print content
99 copyTagClasses : true, // copy classes from the html & body tag
100 copyTagStyles : true, // copy styles from html & body tag (for CSS Variables)
101 beforePrintEvent : null, // callback function for printEvent in iframe
102 beforePrint : null, // function called before iframe is filled
103 afterPrint : null // function called before iframe is removed
104 }
105 );
106 jQuery( '#wpbc_ajx_print_modal' ).wpbc_my_modal( 'hide' );
107 }