PluginProbe
Booking Calendar / 11.0
Booking Calendar v11.0
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 / js / wpbc-gutenberg.js

wpbc-gutenberg.js in Booking Calendar 11.0, at js/wpbc-gutenberg.js

1,638 lines 65.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * @version 1.0
3 * @package Booking Calendar
4 * @subpackage Getenberg integration
5 * @category inserting into posts
6 *
7 * @author wpdevelop
8 * @link https://wpbookingcalendar.com/
9 * @email info@wpbookingcalendar.com
10 *
11 * @modified 2018-08-23Probably you updated your paid version of Booking Calendar
12 */
13
14 // FixIn: 8.3.3.99.
15
16 /*
17 window.wp.blocks,
18 window.wp.components,
19 window.wp.element
20
21 */
22 //( function( blocks, components, element ) {
23
24 ( function( wp ) {
25 /**
26 * Registers a new block provided a unique name and an object defining its behavior.
27 * @see https://github.com/WordPress/gutenberg/tree/master/blocks#api
28 */
29 var registerBlockType = wp.blocks.registerBlockType;
30
31 /**
32 * Returns a new element of given type. Element is an abstraction layer atop React.
33 * @see https://github.com/WordPress/gutenberg/tree/master/packages/element#element
34 */
35 var el = wp.element.createElement;
36
37 /**
38 * Retrieves the translation of text.
39 * @see https://github.com/WordPress/gutenberg/tree/master/i18n#api
40 */
41 var __ = wp.i18n.__;
42
43 // FixIn: 8.4.3.1.
44 /*
45 var source = wp.blocks.source,
46 RichText = wp.editor.RichText,
47 BlockControls = wp.editor.BlockControls,
48 AlignmentToolbar = wp.editor.AlignmentToolbar;*/
49
50 /**
51 * Custom SVG path for Booking Calendar icon
52 */
53 // var wpbc_icon = el('svg', { width: 16, height: 16, fill: "currentColor", className: "bi bi-calendar3-range", viewBox: "-2 -1 20 20" },
54 // el('path', { d: "M14 0H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zM1 3.857C1 3.384 1.448 3 2 3h12c.552 0 1 .384 1 .857v10.286c0 .473-.448.857-1 .857H2c-.552 0-1-.384-1-.857V3.857z" } ),
55 // el('path', { d: "M7 10a1 1 0 0 0 0-2H1v2h6zm2-3h6V5H9a1 1 0 0 0 0 2z" } )
56 // );
57
58 // FixIn: 10.11.3.3.
59 var wpbc_icon = el('svg', { width: 16, height: 16, fill: "currentColor", className: "bi bi-calendar3-range", viewBox: "0 0 550 550" },
60 el('path', { d: "M275 162.36c-92.32 0-167.15 77.82-167.15 173.81S182.69 509.99 275 509.99s167.15-77.82 167.15-173.82S367.31 162.36 275 162.36Zm0 264.53c-50.1 0-90.71-40.61-90.71-90.71s40.61-90.71 90.71-90.71 90.71 40.61 90.71 90.71-40.61 90.71-90.71 90.71Z", fill: "#eee" } ),
61 el('path', { d: "M340.53 398.91c-14.85 15.51-35.16 25.76-57.84 27.66-54.87 4.6-101.64-41.14-98.23-96.1 2.94-47.44 42.35-85.01 90.54-85.01 24.84 0 47.34 9.98 63.72 26.16 5.86 5.78 15.29 5.73 21.11-.09l35.14-35.14c5.69-5.69 5.9-14.87.43-20.77-30.41-32.83-73.1-53.26-120.4-53.26-92.32 0-167.15 77.82-167.15 173.81S182.69 509.99 275 509.99c48.49 0 92.15-21.47 122.68-55.76 5.29-5.94 5.02-14.97-.6-20.59l-35.05-35.05c-5.98-5.98-15.67-5.79-21.51.32Z", fill: "#000" } ),
62 el('path', { d: "M112.53 261.27c12.34-39.07 38.32-70.02 77.79-97.04.92-.63 1.48-1.67 1.48-2.79V14.76c0-4.28-3.68-7.76-8.22-7.76h-3.76c-18.56 0-73.17 40.3-71.79 60.62l-.17 192.91c0 2.74 3.86 3.34 4.68.73Z", fill: "#000" } )
63 );
64
65 registerBlockType( 'booking/booking', {
66
67 title: 'Booking Calendar',
68
69 description: __( 'Show a booking form, availability calendar or other elements from Booking Calendar plugin.' ),
70
71 icon: wpbc_icon, // FixIn: 9.5.2.1.
72
73 // icon: {
74 // // Specifying a background color to appear with the icon e.g.: in the inserter.
75 // background: 'rgb(129, 142, 160)',
76 // // Specifying a color for the icon (optional: if not set, a readable color will be automatically defined)
77 // foreground: '#fff',
78 // // Specifying a dashicon for the block
79 // src: 'calendar-alt'
80 // },
81
82 category: 'common', // common | formatting | layout | widgets | embed
83
84 /*
85 // Use the block just once per post // its possible to use several Booking Calendar forms for different booking resources
86 multiple: false,
87 */
88
89 // // Add the support for block's alignment (left, center, right, wide, full).
90 // align: true,
91 //
92 // // Pick which alignment options to display.
93 // align: [ 'left', 'right', 'full' ],
94
95 keywords: [ 'wpbc' , 'oplugins', 'form' ],
96
97 // // Specifying my block attributes
98 attributes: {
99 /*content: {
100 type: 'string',
101 source: 'children',
102 selector: 'p',
103 },*/
104
105 wpbc_shortcode: {
106 type: 'string',
107 default: ''
108 }
109 },
110
111
112 edit: function( props ) {
113
114 //console.log( 'WPBC-Gb :: Edit :', props );
115
116 jQuery( '.wpbc-gutenberg-update-view').remove();
117
118 var children = [],
119 cid = props.clientId; // its reference to unique 'data-block' attribute in section: <div class="editor-block-list__block-edit" data-block="8a1b713a-6981-43d3-a1f5-ce98b0e611d4"> ...
120
121 var btnClassName = 'button wpbc-gutenberg-open-btn';
122
123
124 ////////////////////////////////////////////////////////////////////////////////////////////////////
125 ////////////////////////////////////////////////////////////////////////////////////////////////////
126
127 // Old value from attribute
128 var _val = props.attributes.wpbc_shortcode;
129
130 // Possibly new value, set to the text field programmatically from popup
131 var _valNew = jQuery( 'div[data-block="' + cid + '"] .wpbc_gb_text_shortcode' ).val();
132
133 //console.log( '%cWPBC-Gb :: E d i t >>> _valNew , _val , cid, obj', 'color: green; font-weight: bold;', _valNew , _val , cid , jQuery( 'div[data-block="' + cid + '"] .wpbc_gb_text_shortcode' ) );
134
135 // Default value here
136 if ( typeof _val == typeof undefined ) {
137 _val = '';
138 }
139 if ( ( typeof _valNew != typeof undefined ) && ( _val !== _valNew ) ) {
140 _val = _valNew;
141 props.setAttributes( { wpbc_shortcode: _val } );
142 }
143
144 ////////////////////////////////////////////////////////////////////////////////////////////////////
145 ////////////////////////////////////////////////////////////////////////////////////////////////////
146
147
148 children.push(
149 el( 'a',
150 {
151 className : btnClassName,
152 // href : 'javascript:void(0)', //FixIn: 8.7.3.17 href: '#!'
153 href : '#!',
154 data_block_id: cid,
155 popup_tab_index: 0 // Will be index for active tab in popup dialog
156 , key: 'configure_' + cid // FixIn: 8.7.3.18.
157 },
158 __( 'Configure Booking Calendar Block' )
159 )
160 );
161
162 // Visual Preview of Block
163 children = wpbc_gt_parse_shortcode( props.attributes.wpbc_shortcode, children , cid ); // FixIn: 8.7.3.18.
164
165 //console.log( 'WPBC children', children) ;
166
167 children.push(
168
169 el(
170 'input',
171 {
172 key: 'onchangewpbcinput_' + cid, // FixIn: 8.7.3.18.
173 value : _val, //props.attributes.wpbc_shortcode,
174 onChange : function ( event ) {
175 props.setAttributes( {wpbc_shortcode: event.target.value } );
176 //console.log( '%cWPBC-Gb :: o n C h a n g e !!!! Y E S !!! event for onChangeWPBCinputShortcode', 'color: orange; font-weight: bold;', event );
177 },
178 onClick: function (event) { // FixIn: 8.8.2.10.
179 props.setAttributes( {wpbc_shortcode: event.target.value } );
180 },
181 className: 'wpbc_gb_text_shortcode',
182 type : 'text',
183 //readOnly : 'readonly', // FixIn: 8.8.2.10.
184 //disabled : 'disabled', // FixIn: 8.8.2.10.
185 // onFocus : function ( event ){
186 // event.target.select();
187 // }
188 }
189 )
190
191 );
192
193
194 // Show Hided Block (after configuration) -- React update Block preview
195 jQuery( '.wpbc_gb_div_block' ).parent().removeClass( 'hidden' );
196
197
198 var wpbc_gb_div_block_css = 'wpbc_gb_div_block';
199 if ( '' == props.attributes.wpbc_shortcode ) {
200 // If no shortcode at all, then do not hide configure button
201 wpbc_gb_div_block_css += ' wpbc_gb_div_block_no_shortcode';
202 }
203
204 return el( 'div', { className: wpbc_gb_div_block_css }, children );
205 },
206
207
208 save: function( props ) {
209
210 //console.log( 'WPBC-Gb :: Saving ', props );
211
212 return el( 'div', null, props.attributes.wpbc_shortcode );
213 }
214
215
216 } );
217
218
219 } )(
220 window.wp
221 );
222
223
224 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
225 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
226 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
227
228
229 ( function( $ ) {
230
231 $( document ).on( 'click', '.wpbc_gb_block_preview_inner_title_edit', function( e ) {
232 //jQuery( '.wpbc-gutenberg-open-btn' ).hide();
233 $( this ).closest( '.wpbc_gb_div_block' ).find( '.wpbc-gutenberg-open-btn' ).trigger( 'click' ); // FixIn: 8.7.11.12.
234
235 });
236
237 /**
238 * Open popup window for configuration Booking Calendar shortcode
239 */
240 $( document ).on( 'click', '.wpbc-gutenberg-open-btn', function( e ) {
241
242 e.preventDefault();
243
244 // Set ID of currently edited section in post (just in case if we will have several sections
245 var _id = $( this ).attr( 'data_block_id' );
246
247
248 // Remove CSS class 'is-selected' (remove blue focus) in main DIV (after popup opened), because of that hide via CSS BIG blue button: "Configure Booking Calendar Block"
249 jQuery( 'div[data-block="' + _id + '"]' ).removeClass( 'is-selected' ); // FixIn: 8.8.2.10.
250
251 // Get num. of popup active tab to set
252 var popup_tab_index = $( this ).attr( 'popup_tab_index' );
253
254 var wpbc_tag = '';
255
256 wpbc_tiny_btn_click( wpbc_tag );
257
258 jQuery( "#wpbc_text_gettenberg_section_id" ).val( _id );
259
260 // Select specific TAB in poup dialog
261 jQuery( "#wpbc_tiny_modal .wpdvlp-top-tabs a.nav-tab" ).eq( popup_tab_index ).trigger( 'click' ); // FixIn: 8.7.11.12.
262
263
264 //console.log( 'WPBC-Gb :: Popup window for configuration Booking Calendar shortcode. Section #', _id );
265
266 });
267
268
269 /**
270 * Remove Update view button after clicking on it.
271 */
272 $( document ).on( 'click', '.wpbc-gutenberg-update-preview-btn', function( e ) {
273
274 e.preventDefault();
275
276 jQuery( '.wpbc-gutenberg-update-view').remove();
277
278 //console.log( 'WPBC-Gb :: Preview button clicked. Section #' );
279
280 });
281
282
283 } ) ( jQuery );
284
285
286 /**
287 * Send shortcode from popup dialog into the gutenberg sections.
288 *
289 * @param shortcode_text
290 * @returns {boolean}
291 */
292 function wpbc_send_text_to_gutenberg( shortcode_text ){
293
294 // Get ID of section, where to insert shortcode configuraiton
295 var block_section_id = jQuery( "#wpbc_text_gettenberg_section_id" ).val();
296
297 //console.log( 'WPBC-Gb :: wpbc_send_text_to_gutenberg' , shortcode_text, block_section_id );
298
299 if ( '' == block_section_id ) {
300
301 return false; // if no such block then just return false, its means tha inserting in Classic block - TinyMCE
302 }
303
304
305 // Code to insert into Gutenberg section in our text field
306 jQuery( 'div[data-block="' + block_section_id + '"] .wpbc_gb_text_shortcode' ).val( shortcode_text );
307
308 //Its does not work for automatic generating "Edit" event :((( , so we make some workarround in Edit block event
309 jQuery( 'div[data-block="' + block_section_id + '"] .wpbc_gb_text_shortcode' ).trigger( 'focus' ).trigger('mousedown').trigger( 'click' ).trigger('mouseup').trigger('change');
310
311 // FixIn: 8.4.2.10.
312 //FixIn: 8.7.3.17 href: '#!'
313 //FixIn: 8.7.3.19 - chnaged <a href="#!" to '<div href="#!" - its make update of block after clicking on DIV (and not A) element
314
315 //FixIn: 8.8.2.10 - commenting these 2 blocks
316 // jQuery( 'div[data-block="' + block_section_id + '"]' ).parent().parent().before(
317 // '<div class="editor-block-list__block wpbc-gutenberg-update-view" style="cursor: pointer;text-align: center;">' +
318 // '<div href="#!" class="button wpbc-gutenberg-update-preview-btn" ' +
319 // '>' + wp.i18n.__( 'Click to Preview Block' ) + '</div></div>'
320 // );
321 // // FixIn: 8.7.6.11.
322 // jQuery( 'div[data-block="' + block_section_id + '"]' ).before(
323 // '<div class="editor-block-list__block wpbc-gutenberg-update-view" style="cursor: pointer;text-align: center;">' +
324 // '<div href="#!" class="button wpbc-gutenberg-update-preview-btn" ' +
325 // '>' + wp.i18n.__( 'Click to Preview Block' ) + '</div></div>'
326 // );
327
328
329
330 // Hide entire Block -- until React does not update Block preview
331 //jQuery( 'div[data-block="' + block_section_id + '"]' ).addClass( 'hidden' ); //FixIn: 8.8.2.10 - commenting
332
333 // Neet to return true, to prevent insertion into some other TinyMCE block, if exist, because we have inserted it into Gutenberg
334 return true;
335 }
336
337
338 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
339 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
340 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
341
342
343
344 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
345 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
346 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
347
348 /**
349 * Parse shortcode in text field and show Visual Preview of element
350 *
351 * @param shortcode_in_text - shortcode from text field
352 * @param children - array of el for gnerating preview
353 * @returns - array of el
354 */
355 function wpbc_gt_parse_shortcode( shortcode_in_text, children, cid ){ // FixIn: 8.7.3.18.
356
357 //console.log( 'wpbc_gt_parse_shortcode cid', cid );
358
359 var wpbc_shortcode_type
360 , shortcode_obj
361 , block_preview_el = ''
362 , el = wp.element.createElement;
363
364 var block_header_txt, block_text_txt;
365
366 var wpbc_shortcode_type_arr = [ 'booking'
367 , 'bookingcalendar'
368 , 'bookingtimeline'
369 , 'bookingselect'
370 , 'bookingform'
371 , 'bookingsearch'
372 , 'bookingsearchresults'
373 , 'bookingedit'
374 , 'bookingcustomerlisting'
375 , 'bookingresource'
376 , 'booking_confirm'
377 , 'booking-manager-import'
378 , 'booking-manager-listing'
379 ];
380 var wpbc_shortcode_type_arr_length = wpbc_shortcode_type_arr.length;
381
382 for ( var i = 0; i < wpbc_shortcode_type_arr_length ; i++ ){
383
384 wpbc_shortcode_type = wpbc_shortcode_type_arr[ i ];
385
386 shortcode_obj = wp.shortcode.next( wpbc_shortcode_type, shortcode_in_text, 0 ); // Parse shortcode
387
388 if ( undefined != shortcode_obj ){
389
390 block_preview_el = '';
391 //console.log( 'wpbc_shortcode_type' , wpbc_shortcode_type);
392 // Get Preview
393 switch ( wpbc_shortcode_type ){
394
395 case 'booking':
396 block_preview_el = wpbc_gt_get_visual_block_for_booking( shortcode_obj.shortcode, {
397 'shortcode_in_text': shortcode_in_text
398 , 'cid_key': wpbc_shortcode_type+ '_' + cid // FixIn: 8.7.3.18.
399 } );
400 children[ (children.length - 1) ].props.popup_tab_index = 0; // Set index of Active tab in popup dialog
401 break;
402
403 case 'bookingcalendar':
404 block_preview_el = wpbc_gt_get_visual_block_for_bookingcalendar( shortcode_obj.shortcode, {
405 'shortcode_in_text': shortcode_in_text
406 , 'cid_key': wpbc_shortcode_type+ '_' + cid
407 } );
408 children[ (children.length - 1) ].props.popup_tab_index = 2; // Set index of Active tab in popup dialog
409 break;
410
411 case 'bookingtimeline':
412 block_preview_el = wpbc_gt_get_visual_block_for_bookingtimeline( shortcode_obj.shortcode, {
413 'shortcode_in_text': shortcode_in_text
414 , 'cid_key': wpbc_shortcode_type+ '_' + cid
415 } );
416 children[ (children.length - 1) ].props.popup_tab_index = 1; // Set index of Active tab in popup dialog
417 break;
418
419 case 'bookingselect':
420 block_preview_el = wpbc_gt_get_visual_block_for_bookingselect( shortcode_obj.shortcode, {
421 'shortcode_in_text': shortcode_in_text
422 , 'cid_key': wpbc_shortcode_type+ '_' + cid
423 } );
424 children[ (children.length - 1) ].props.popup_tab_index = 3; // Set index of Active tab in popup dialog
425 break;
426
427 case 'bookingform':
428 block_preview_el = wpbc_gt_get_visual_block_for_bookingform( shortcode_obj.shortcode, {
429 'shortcode_in_text': shortcode_in_text
430 , 'cid_key': wpbc_shortcode_type+ '_' + cid
431 } );
432 children[ (children.length - 1) ].props.popup_tab_index = 5; // Set index of Active tab in popup dialog
433 break;
434
435 case 'bookingsearch':
436 block_preview_el = wpbc_gt_get_visual_block_for_bookingsearch( shortcode_obj.shortcode, {
437 'shortcode_in_text': shortcode_in_text
438 , 'cid_key': wpbc_shortcode_type+ '_' + cid
439 } );
440 children[ (children.length - 1) ].props.popup_tab_index = 4; // Set index of Active tab in popup dialog
441 break;
442
443 case 'bookingsearchresults':
444 block_preview_el = wpbc_gt_get_visual_block_for_bookingsearchresults( shortcode_obj.shortcode, {
445 'shortcode_in_text': shortcode_in_text
446 , 'cid_key': wpbc_shortcode_type+ '_' + cid
447 } );
448 children[ (children.length - 1) ].props.popup_tab_index = 4; // Set index of Active tab in popup dialog
449 break;
450
451 case 'bookingedit':
452 block_preview_el = wpbc_gt_get_visual_block_for_bookingedit( shortcode_obj.shortcode, {
453 'shortcode_in_text': shortcode_in_text
454 , 'cid_key': wpbc_shortcode_type+ '_' + cid
455 } );
456 children[ (children.length - 1) ].props.popup_tab_index = -1; // Set index of Active tab in popup dialog
457 break;
458
459 case 'bookingcustomerlisting':
460 block_preview_el = wpbc_gt_get_visual_block_for_bookingcustomerlisting( shortcode_obj.shortcode, {
461 'shortcode_in_text': shortcode_in_text
462 , 'cid_key': wpbc_shortcode_type+ '_' + cid
463 } );
464 children[ (children.length - 1) ].props.popup_tab_index = -1; // Set index of Active tab in popup dialog
465 break;
466
467 case 'bookingresource':
468 block_preview_el = wpbc_gt_get_visual_block_for_bookingresource( shortcode_obj.shortcode, {
469 'shortcode_in_text': shortcode_in_text
470 , 'cid_key': wpbc_shortcode_type+ '_' + cid
471 } );
472 children[ (children.length - 1) ].props.popup_tab_index = -1; // Set index of Active tab in popup dialog
473 break;
474
475 case 'booking_confirm':
476 block_preview_el = wpbc_gt_get_visual_block_for_booking_confirm( shortcode_obj.shortcode, {
477 'shortcode_in_text': shortcode_in_text
478 , 'cid_key': wpbc_shortcode_type+ '_' + cid
479 } );
480 children[ (children.length - 1) ].props.popup_tab_index = -1; // Set index of Active tab in popup dialog
481 break;
482
483 case 'booking-manager-import':
484 block_preview_el = wpbc_gt_get_visual_block_for_booking_manager_import( shortcode_obj.shortcode, {
485 'shortcode_in_text': shortcode_in_text
486 , 'cid_key': wpbc_shortcode_type+ '_' + cid
487 } );
488 //block_preview_el = el( 'div', { className: 'test' }, 'Test Import 1' );
489 children[ (children.length - 1) ].props.popup_tab_index = -1; // Set index of Active tab in popup dialog
490 break;
491
492 case 'booking-manager-listing':
493 block_preview_el = wpbc_gt_get_visual_block_for_booking_manager_listing( shortcode_obj.shortcode, {
494 'shortcode_in_text': shortcode_in_text
495 , 'cid_key': wpbc_shortcode_type+ '_' + cid
496 } );
497 //block_preview_el = el( 'div', { className: 'test' }, 'Test 2' );
498 children[ (children.length - 1) ].props.popup_tab_index = -1; // Set index of Active tab in popup dialog
499 break;
500
501 default:
502 block_preview_el = wpbc_gt_get_visual_block_for_default( shortcode_obj.shortcode
503 , {
504 'shortcode_in_text': shortcode_in_text,
505 'block_header' : block_header_txt,
506 'block_text' : block_text_txt
507 , 'cid_key': wpbc_shortcode_type+ '_' + cid
508 }
509 );
510
511 }
512
513 //console.log( 'WPBC-Gb :: block_preview_el', block_preview_el);
514
515 if ( '' != block_preview_el ){
516 children.push( block_preview_el );
517 }
518 }
519
520 }
521
522 return children;
523 }
524
525
526 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
527
528
529 /**
530 * Generate Visual Preview Block - just general Shortcode
531 *
532 * @param shortcode_obj - shortcode JavaScript obj.
533 * @returns
534 */
535 function wpbc_gt_get_visual_block_for_default( shortcode_obj, params ){
536
537 // Booking Form Parameters // FixIn: 10.0.0.16.
538 var shortcode_defaults = {
539 type : 1,
540 resource_id : 1,
541 nummonths : 1,
542 form_type : 'standard',
543 aggregate : null,
544 startmonth: null,
545 options : null
546 };
547
548 // // Calendar Parameters
549 // var shortcode_defaults = {
550 // type : 1,
551 // resource_id : 1,
552 // nummonths : 1,
553 // aggregate : null,
554 // startmonth: null,
555 // options : null
556 // };
557
558 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
559
560 var el = wp.element.createElement;
561
562 //FixIn: 8.7.3.18 Start
563 var inner_header = el( 'div', {className: 'wpbc_gb_block_preview_inner_header', key: 'header_' + params[ 'cid_key' ]}
564 , wpbc_gb_tpl_header( { header: params[ 'block_header' ], cid_key: 'header_' + params[ 'cid_key' ] } )
565 );
566 var inner_body = el( 'div', {className: 'wpbc_gb_block_preview_inner_body', key: 'body_' + params[ 'cid_key' ] }
567 , wpbc_gb_tpl_shortcode_parameters(
568 [
569 { block_text: params[ 'block_text' ] }
570 , { name: 'Booking form', value: 'super-booking-admin'}
571 , { name: 'Number of months to show', value: '2'}
572 ]
573 , { cid_key: 'body_' + params[ 'cid_key' ] }
574 )
575 );
576 var inner_footer = el( 'div', {className: 'wpbc_gb_block_preview_inner_footer' , key: 'footer_' + params[ 'cid_key' ] }
577 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
578 );
579
580 return el( 'div', { className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_default' , key: 'preview_wrapper_' + params[ 'cid_key' ] }
581
582 , el( 'div', { className: 'wpbc_gb_block_shortcode_preview_content' , key: 'preview_content_' + params[ 'cid_key' ] }
583 , [ inner_header, inner_body ]
584 )
585 , inner_footer
586 );
587 //FixIn: 8.7.3.18 End
588 }
589
590
591 /**
592 * Generate Visual Preview Block of Booking form
593 *
594 * @param shortcode_obj - shortcode JavaScript obj.
595 * @returns
596 */
597 function wpbc_gt_get_visual_block_for_booking( shortcode_obj, params ){
598
599 // Booking Form Parameters // FixIn: 10.0.0.16.
600 var shortcode_defaults = {
601 type : 1,
602 resource_id : 1,
603 nummonths : 1,
604 form_type : 'standard',
605 aggregate : null,
606 startmonth: null,
607 options : null
608 };
609
610
611 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
612
613 var el = wp.element.createElement;
614
615 var inner_header = el( 'div', {
616 className: 'wpbc_gb_block_preview_inner_header'
617 , key: 'header_' + params[ 'cid_key' ] // FixIn: 8.7.3.18.
618 }
619 , wpbc_gb_tpl_header( { header: wp.i18n.__( 'Booking Form' ), cid_key: 'header_' + params[ 'cid_key' ] } )
620 );
621 var inner_body = el( 'div', {
622 className: 'wpbc_gb_block_preview_inner_body'
623 , key: 'body_' + params[ 'cid_key' ] // FixIn: 8.7.3.18.
624 }
625 , wpbc_gb_tpl_shortcode_parameters( wpbc_parse_params_into_rows_arr_for_booking( props ), { cid_key: 'body_' + params[ 'cid_key' ] } )
626 );
627 var inner_footer = el( 'div', {
628 className: 'wpbc_gb_block_preview_inner_footer'
629 , key: 'footer_' + params[ 'cid_key' ] // FixIn: 8.7.3.18.
630 }
631 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
632 );
633
634
635 return el( 'div', {
636 className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_booking'
637 , key: 'preview_wrapper_' + params[ 'cid_key' ] // FixIn: 8.7.3.18.
638 }
639 , el( 'div', {
640 className: 'wpbc_gb_block_shortcode_preview_content'
641 , key: 'preview_content_' + params[ 'cid_key' ] // FixIn: 8.7.3.18.
642 }
643 , [ inner_header, inner_body ]
644 )
645 , inner_footer
646 );
647 }
648
649
650 /**
651 * Parse parameters into array of rows objects for showing in conetnt of block
652 *
653 * @param props
654 */
655 function wpbc_parse_params_into_rows_arr_for_booking( props ){
656 //console.log( 'WPBC::props', props, props[ 'type' ], props[ 'resource_id' ]);
657 // Parameters Description /////////////////////////////////
658 var rows_in_content = [];
659 if ( (undefined != props[ 'type' ]) && ( 1 != props[ 'type' ]) ){
660 rows_in_content.push( {name: wp.i18n.__( 'Booking resource' ), value: 'ID = ' + props[ 'type' ]} );
661 }
662 // FixIn: 10.0.0.16.
663 if ( (undefined != props[ 'resource_id' ]) && ( 1 != props[ 'resource_id' ]) ){
664 rows_in_content.push( {name: wp.i18n.__( 'Booking resource' ), value: 'ID = ' + props[ 'resource_id' ]} );
665 }
666 if ( undefined != props[ 'nummonths' ] ){
667 rows_in_content.push( {name: wp.i18n.__( 'Visible months number' ), value: props[ 'nummonths' ]} );
668 }
669 if ( undefined != props[ 'startmonth' ] ) {
670 rows_in_content.push( { name: wp.i18n.__( 'Start month' ), value: props[ 'startmonth' ] } );
671 }
672 if ( ( undefined != props[ 'form_type' ] ) && ( 'standard' != props[ 'form_type' ] ) ){
673 rows_in_content.push( { name: wp.i18n.__( 'Custom booking form' ), value: props[ 'form_type' ] } );
674 }
675 if ( undefined != props[ 'aggregate' ] ) {
676 rows_in_content.push( { name: wp.i18n.__( 'Unavailable dates from other booking resources' ), value: 'ID = ' + props[ 'aggregate' ] } );
677 }
678 if ( undefined != props[ 'options' ] ) {
679 rows_in_content.push( { name: wp.i18n.__( 'Options' ), value: props[ 'options' ] } );
680 }
681
682 return rows_in_content;
683 }
684
685
686 /**
687 * Generate Visual Preview Block of Booking form
688 *
689 * @param shortcode_obj - shortcode JavaScript obj.
690 * @returns
691 */
692 function wpbc_gt_get_visual_block_for_bookingcalendar( shortcode_obj, params ){
693
694 // Booking Form Parameters // FixIn: 10.0.0.16.
695 var shortcode_defaults = {
696 type : 1,
697 resource_id : 1,
698 nummonths : 1,
699 aggregate : null,
700 startmonth: null,
701 options : null
702 };
703
704
705 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
706
707 var el = wp.element.createElement;
708
709 var inner_header = el( 'div', {
710 className: 'wpbc_gb_block_preview_inner_header'
711 , key: 'header_' + params[ 'cid_key' ] // FixIn: 8.7.3.18.
712 }
713 , wpbc_gb_tpl_header( { header: wp.i18n.__( 'Availability Calendar' ), cid_key: 'header_' + params[ 'cid_key' ] } )
714 );
715 var inner_body = el( 'div', {
716 className: 'wpbc_gb_block_preview_inner_body'
717 , key: 'body_' + params[ 'cid_key' ] // FixIn: 8.7.3.18.
718 }
719 , wpbc_gb_tpl_shortcode_parameters( wpbc_parse_params_into_rows_arr_for_bookingcalendar( props ), { cid_key: 'body_' + params[ 'cid_key' ] } )
720 );
721 var inner_footer = el( 'div', {
722 className: 'wpbc_gb_block_preview_inner_footer'
723 , key: 'footer_' + params[ 'cid_key' ] // FixIn: 8.7.3.18.
724 }
725 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
726 );
727
728
729 return el( 'div', {
730 className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_bookingcalendar'
731 , key: 'preview_wrapper_' + params[ 'cid_key' ] // FixIn: 8.7.3.18.
732 }
733
734 , el( 'div', {
735 className: 'wpbc_gb_block_shortcode_preview_content'
736 , key: 'preview_content_' + params[ 'cid_key' ] // FixIn: 8.7.3.18.
737 }
738 , [ inner_header, inner_body ]
739 )
740 , inner_footer
741 );
742 }
743
744
745 /**
746 * Parse parameters into array of rows objects for showing in conetnt of block
747 *
748 * @param props
749 */
750 function wpbc_parse_params_into_rows_arr_for_bookingcalendar( props ){
751
752 // Parameters Description /////////////////////////////////
753 var rows_in_content = [];
754 if ( (undefined != props[ 'type' ]) && ( 1 != props[ 'type' ]) ){
755 rows_in_content.push( {name: wp.i18n.__( 'Booking resource' ), value: 'ID = ' + props[ 'type' ]} );
756 }
757 // FixIn: 10.0.0.16.
758 if ( (undefined != props[ 'resource_id' ]) && ( 1 != props[ 'resource_id' ]) ){
759 rows_in_content.push( {name: wp.i18n.__( 'Booking resource' ), value: 'ID = ' + props[ 'resource_id' ]} );
760 }
761 if ( undefined != props[ 'nummonths' ] ){
762 rows_in_content.push( {name: wp.i18n.__( 'Visible months number' ), value: props[ 'nummonths' ]} );
763 }
764 if ( undefined != props[ 'startmonth' ] ) {
765 rows_in_content.push( { name: wp.i18n.__( 'Start month' ), value: props[ 'startmonth' ] } );
766 }
767 if ( undefined != props[ 'aggregate' ] ) {
768 rows_in_content.push( { name: wp.i18n.__( 'Unavailable dates from other booking resources' ), value: 'ID = ' + props[ 'aggregate' ] } );
769 }
770 if ( undefined != props[ 'options' ] ) {
771 rows_in_content.push( { name: wp.i18n.__( 'Options' ), value: props[ 'options' ] } );
772 }
773
774 return rows_in_content;
775 }
776
777
778 /**
779 * Generate Visual Preview Block of TimeLine
780 *
781 * @param shortcode_obj - shortcode JavaScript obj.
782 * @returns
783 */
784 function wpbc_gt_get_visual_block_for_bookingtimeline( shortcode_obj, params ){
785
786 // Booking Form Parameters
787 var shortcode_defaults = {
788 type : 'Default', // 1,
789 view_days_num : 30, // 30,
790
791 scroll_start_date : null, // '',
792 scroll_day : null, // 0,
793 scroll_month : null, // 0,
794 header_title : null, // '',
795 limit_hours : null, // '0,24'
796 };
797 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
798
799 var el = wp.element.createElement;
800
801
802 var inner_header = el( 'div', {
803 className: 'wpbc_gb_block_preview_inner_header'
804 , key: 'header_' + params[ 'cid_key' ] // FixIn: 8.7.3.18.
805 }
806 , wpbc_gb_tpl_header( { header: wp.i18n.__( 'Timeline' ), cid_key: 'header_' + params[ 'cid_key' ] } )
807 );
808 var inner_body = el( 'div', {
809 className: 'wpbc_gb_block_preview_inner_body'
810 , key: 'body_' + params[ 'cid_key' ] // FixIn: 8.7.3.18.
811 }
812 , wpbc_gb_tpl_shortcode_parameters( wpbc_parse_params_into_rows_arr_for_bookingtimeline( props ), { cid_key: 'body_' + params[ 'cid_key' ] } )
813 );
814 var inner_footer = el( 'div', {
815 className: 'wpbc_gb_block_preview_inner_footer'
816 , key: 'footer_' + params[ 'cid_key' ] // FixIn: 8.7.3.18.
817 }
818 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
819 );
820
821 return el( 'div', { className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_bookingtimeline' , key: 'preview_wrapper_' + params[ 'cid_key' ] }
822
823 , el( 'div', { className: 'wpbc_gb_block_shortcode_preview_content' , key: 'preview_content_' + params[ 'cid_key' ] }
824 , [ inner_header, inner_body ]
825 )
826 , inner_footer
827 );
828 }
829
830
831 /**
832 * Parse parameters into array of rows objects for showing in conetnt of block
833 *
834 * @param props
835 */
836 function wpbc_parse_params_into_rows_arr_for_bookingtimeline( props ){
837
838 // Parameters Description /////////////////////////////////
839 var rows_in_content = [];
840 if ( undefined != props[ 'type' ] ){
841 rows_in_content.push( {name: wp.i18n.__( 'Booking resource(s)' ), value: 'ID = ' + props[ 'type' ]} );
842 }
843 if ( undefined != props[ 'view_days_num' ] ){
844
845 if ( '1' == props[ 'view_days_num' ] ) {
846 props[ 'view_days_num' ] = 'Day';
847 }
848 if ( '7' == props[ 'view_days_num' ] ) {
849 props[ 'view_days_num' ] = 'Week';
850 }
851 if ( '30' == props[ 'view_days_num' ] ) {
852 props[ 'view_days_num' ] = 'Month';
853 }
854 if ( '60' == props[ 'view_days_num' ] ) {
855 props[ 'view_days_num' ] = '2 Months';
856 }
857 if ( '90' == props[ 'view_days_num' ] ) {
858 props[ 'view_days_num' ] = '3 Months';
859 }
860 if ( '365' == props[ 'view_days_num' ] ){
861 props[ 'view_days_num' ] = 'Year';
862 }
863 rows_in_content.push( {name: wp.i18n.__( 'View mode' ), value: props[ 'view_days_num' ]} );
864 }
865 if ( undefined != props[ 'header_title' ] ) {
866 rows_in_content.push( { name: wp.i18n.__( 'Title' ), value: props[ 'header_title' ] } );
867 }
868 if ( undefined != props[ 'scroll_day' ] ) {
869 rows_in_content.push( { name: wp.i18n.__( 'Number of days to scroll' ), value: props[ 'scroll_day' ] } );
870 }
871 if ( undefined != props[ 'scroll_month' ] ) {
872 rows_in_content.push( { name: wp.i18n.__( 'Number of months to scroll' ), value: props[ 'scroll_month' ] } );
873 }
874 if ( undefined != props[ 'scroll_start_date' ] ) {
875 rows_in_content.push( { name: wp.i18n.__( 'Start Date' ), value: props[ 'scroll_start_date' ] } );
876 }
877 if ( undefined != props[ 'limit_hours' ] ) {
878 rows_in_content.push( { name: wp.i18n.__( 'Show from/to' ), value: props[ 'limit_hours' ] } );
879 }
880
881 return rows_in_content;
882 }
883
884
885 /**
886 * Generate Visual Preview Block of Booking form
887 *
888 * @param shortcode_obj - shortcode JavaScript obj.
889 * @returns
890 */
891 function wpbc_gt_get_visual_block_for_bookingselect( shortcode_obj, params ){
892
893 // Booking Form Parameters
894 var shortcode_defaults = {
895 type : wp.i18n.__( 'All booking resources' ),
896 nummonths : 1,
897 form_type : null, // : 'standard',
898 selected_type : null, // : '',
899 label : null, // : '',
900 first_option_title: wp.i18n.__( 'Please Select' ),
901 startmonth : null,
902 options : null
903 };
904
905
906 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
907
908 var el = wp.element.createElement;
909
910 //FixIn: 8.7.3.18 Start
911 var inner_header = el( 'div', {className: 'wpbc_gb_block_preview_inner_header', key: 'header_' + params[ 'cid_key' ]}
912 , wpbc_gb_tpl_header( { header: wp.i18n.__( 'Selection of Resources' ), cid_key: 'header_' + params[ 'cid_key' ] } )
913 );
914 var inner_body = el( 'div', {className: 'wpbc_gb_block_preview_inner_body', key: 'body_' + params[ 'cid_key' ] }
915 , wpbc_gb_tpl_shortcode_parameters( wpbc_parse_params_into_rows_arr_for_bookingselect( props ), { cid_key: 'body_' + params[ 'cid_key' ] } )
916 );
917 var inner_footer = el( 'div', {className: 'wpbc_gb_block_preview_inner_footer' , key: 'footer_' + params[ 'cid_key' ] }
918 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
919 );
920
921 return el( 'div', { className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_bookingselect' , key: 'preview_wrapper_' + params[ 'cid_key' ] }
922
923 , el( 'div', { className: 'wpbc_gb_block_shortcode_preview_content' , key: 'preview_content_' + params[ 'cid_key' ] }
924 , [ inner_header, inner_body ]
925 )
926 , inner_footer
927 );
928 //FixIn: 8.7.3.18 End
929
930 }
931
932
933 /**
934 * Parse parameters into array of rows objects for showing in conetnt of block
935 *
936 * @param props
937 */
938 function wpbc_parse_params_into_rows_arr_for_bookingselect( props ){
939
940 // Parameters Description /////////////////////////////////
941 var rows_in_content = [];
942 if ( undefined != props[ 'type' ] ){
943 rows_in_content.push( {name: wp.i18n.__( 'Booking resource(s)' ), value: props[ 'type' ]} );
944 }
945 if ( undefined != props[ 'label' ] ) {
946 rows_in_content.push( { name: wp.i18n.__( 'Label' ), value: props[ 'label' ] } );
947 }
948 if ( undefined != props[ 'selected_type' ] ) {
949 rows_in_content.push( { name: wp.i18n.__( 'Selected booking resource (by default)' ), value: 'ID = ' + props[ 'selected_type' ] } );
950 }
951 if ( undefined != props[ 'first_option_title' ] ) {
952 rows_in_content.push( { name: wp.i18n.__( 'Title of first option in list' ), value: props[ 'first_option_title' ] } );
953 }
954 if ( undefined != props[ 'nummonths' ] ){
955 rows_in_content.push( {name: wp.i18n.__( 'Visible months number' ), value: props[ 'nummonths' ]} );
956 }
957 if ( undefined != props[ 'startmonth' ] ) {
958 rows_in_content.push( { name: wp.i18n.__( 'Start month' ), value: props[ 'startmonth' ] } );
959 }
960 if ( ( undefined != props[ 'form_type' ] ) && ( 'standard' != props[ 'form_type' ] ) ){
961 rows_in_content.push( { name: wp.i18n.__( 'Custom booking form for all booking resources' ), value: props[ 'form_type' ] } );
962 }
963 if ( undefined != props[ 'aggregate' ] ) {
964 rows_in_content.push( { name: wp.i18n.__( 'Unavailable dates from other booking resources' ), value: 'ID = ' + props[ 'aggregate' ] } );
965 }
966 if ( undefined != props[ 'options' ] ) {
967 rows_in_content.push( { name: wp.i18n.__( 'Options' ), value: props[ 'options' ] } );
968 }
969
970 return rows_in_content;
971 }
972
973
974 /**
975 * Generate Visual Preview Block of Booking form
976 *
977 * @param shortcode_obj - shortcode JavaScript obj.
978 * @returns
979 */
980 function wpbc_gt_get_visual_block_for_bookingform( shortcode_obj, params ){
981
982 // Booking Form Parameters // FixIn: 10.0.0.16.
983 var shortcode_defaults = {
984 type : 1,
985 resource_id : 1,
986 selected_dates : null,
987 form_type : 'standard'
988 };
989
990
991 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
992
993 var el = wp.element.createElement;
994
995 //FixIn: 8.7.3.18 Start
996 var inner_header = el( 'div', {className: 'wpbc_gb_block_preview_inner_header', key: 'header_' + params[ 'cid_key' ]}
997 , wpbc_gb_tpl_header( { header: wp.i18n.__( 'Booking Form (without calendar)' ), cid_key: 'header_' + params[ 'cid_key' ] } )
998 );
999 var inner_body = el( 'div', {className: 'wpbc_gb_block_preview_inner_body', key: 'body_' + params[ 'cid_key' ] }
1000 , wpbc_gb_tpl_shortcode_parameters( wpbc_parse_params_into_rows_arr_for_bookingform( props ), { cid_key: 'body_' + params[ 'cid_key' ] } )
1001 );
1002 var inner_footer = el( 'div', {className: 'wpbc_gb_block_preview_inner_footer' , key: 'footer_' + params[ 'cid_key' ] }
1003 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
1004 );
1005
1006 return el( 'div', { className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_bookingform' , key: 'preview_wrapper_' + params[ 'cid_key' ] }
1007
1008 , el( 'div', { className: 'wpbc_gb_block_shortcode_preview_content' , key: 'preview_content_' + params[ 'cid_key' ] }
1009 , [ inner_header, inner_body ]
1010 )
1011 , inner_footer
1012 );
1013 //FixIn: 8.7.3.18 End
1014 }
1015
1016
1017 /**
1018 * Parse parameters into array of rows objects for showing in conetnt of block
1019 *
1020 * @param props
1021 */
1022 function wpbc_parse_params_into_rows_arr_for_bookingform( props ){
1023
1024 // Parameters Description /////////////////////////////////
1025 var rows_in_content = [];
1026 if ( (undefined != props[ 'type' ]) && ( 1 != props[ 'type' ]) ){
1027 rows_in_content.push( {name: wp.i18n.__( 'Booking resource' ), value: 'ID = ' + props[ 'type' ]} );
1028 }
1029 // FixIn: 10.0.0.16.
1030 if ( (undefined != props[ 'resource_id' ]) && ( 1 != props[ 'resource_id' ]) ){
1031 rows_in_content.push( {name: wp.i18n.__( 'Booking resource' ), value: 'ID = ' + props[ 'resource_id' ]} );
1032 }
1033
1034 if ( undefined != props[ 'selected_dates' ] ){
1035 rows_in_content.push( {name: wp.i18n.__( 'Date for submit booking' ), value: props[ 'selected_dates' ]} );
1036 }
1037 if ( ( undefined != props[ 'form_type' ] ) && ( 'standard' != props[ 'form_type' ] ) ){
1038 rows_in_content.push( { name: wp.i18n.__( 'Custom booking form' ), value: props[ 'form_type' ] } );
1039 }
1040
1041 return rows_in_content;
1042 }
1043
1044
1045 /**
1046 * Generate Visual Preview Block of Search Availability Form
1047 *
1048 * @param shortcode_obj - shortcode JavaScript obj.
1049 * @returns
1050 */
1051 function wpbc_gt_get_visual_block_for_bookingsearch( shortcode_obj, params ){
1052
1053 // Booking Form Parameters
1054 var shortcode_defaults = {
1055 searchresultstitle : '', // searchresultstitle='{searchresults} Result(s) Found'
1056 noresultstitle : '', // noresultstitle='Nothing Found'
1057 users : null, // users='3,55'
1058 searchresults : null // searchresults='http://test.com/search-results'
1059 };
1060
1061 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
1062
1063 var el = wp.element.createElement;
1064
1065 //FixIn: 8.7.3.18 Start
1066 var inner_header = el( 'div', {className: 'wpbc_gb_block_preview_inner_header', key: 'header_' + params[ 'cid_key' ]}
1067 , wpbc_gb_tpl_header( { header: wp.i18n.__( 'Search Availability form' ), cid_key: 'header_' + params[ 'cid_key' ] } )
1068 );
1069 var inner_body = el( 'div', {className: 'wpbc_gb_block_preview_inner_body', key: 'body_' + params[ 'cid_key' ] }
1070 , wpbc_gb_tpl_shortcode_parameters( wpbc_parse_params_into_rows_arr_for_bookingsearch( props ), { cid_key: 'body_' + params[ 'cid_key' ] } )
1071 );
1072 var inner_footer = el( 'div', {className: 'wpbc_gb_block_preview_inner_footer' , key: 'footer_' + params[ 'cid_key' ] }
1073 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
1074 );
1075
1076 return el( 'div', { className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_bookingsearch' , key: 'preview_wrapper_' + params[ 'cid_key' ] }
1077
1078 , el( 'div', { className: 'wpbc_gb_block_shortcode_preview_content' , key: 'preview_content_' + params[ 'cid_key' ] }
1079 , [ inner_header, inner_body ]
1080 )
1081 , inner_footer
1082 );
1083 //FixIn: 8.7.3.18 End
1084
1085 }
1086
1087
1088 /**
1089 * Parse parameters into array of rows objects for showing in conetnt of block
1090 *
1091 * @param props
1092 */
1093 function wpbc_parse_params_into_rows_arr_for_bookingsearch( props ){
1094
1095 // Parameters Description /////////////////////////////////
1096 var rows_in_content = [];
1097 if ( undefined != props[ 'searchresults' ] ){
1098 rows_in_content.push( { name: wp.i18n.__( 'Show search results on other page' )
1099 , value: wp.element.createElement( 'a', { href: props[ 'searchresults' ] }, props[ 'searchresults' ] )
1100 } );
1101 rows_in_content.push( {name: wp.i18n.__( 'Note' ), value: wp.i18n.__( 'Search results page must have this shortcode' ) + ' [bookingsearchresults]' } );
1102 rows_in_content.push( { block_text: '---' } );
1103 } else {
1104 rows_in_content.push( { block_text: wp.i18n.__( 'Show search results in the same page' ) } );
1105 }
1106 if ( undefined != props[ 'searchresultstitle' ] ){
1107 //rows_in_content.push( {name: wp.i18n.__( 'Search Results Title' ), value: props[ 'searchresultstitle' ]} );
1108 }
1109 if ( undefined != props[ 'noresultstitle' ] ){
1110 //rows_in_content.push( {name: wp.i18n.__( 'Title, if no search results' ), value: props[ 'noresultstitle' ]} );
1111 }
1112 if ( undefined != props[ 'users' ] ){
1113 rows_in_content.push( {name: wp.i18n.__( 'Search in booking resources of WP users' ), value: 'ID = ' + props[ 'users' ]} );
1114 }
1115
1116 return rows_in_content;
1117 }
1118
1119
1120 /**
1121 * Generate Visual Preview Block of Search Results
1122 *
1123 * @param shortcode_obj - shortcode JavaScript obj.
1124 * @returns
1125 */
1126 function wpbc_gt_get_visual_block_for_bookingsearchresults( shortcode_obj, params ){
1127
1128 // Booking Form Parameters
1129 var shortcode_defaults = {
1130 };
1131
1132 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
1133
1134 var el = wp.element.createElement;
1135
1136 //FixIn: 8.7.3.18 Start
1137 var inner_header = el( 'div', {className: 'wpbc_gb_block_preview_inner_header', key: 'header_' + params[ 'cid_key' ]}
1138 , wpbc_gb_tpl_header( { header: wp.i18n.__( 'Search Results' ), cid_key: 'header_' + params[ 'cid_key' ] } )
1139 );
1140 var inner_body = el( 'div', {className: 'wpbc_gb_block_preview_inner_body', key: 'body_' + params[ 'cid_key' ] }
1141 , wpbc_gb_tpl_shortcode_parameters( wpbc_parse_params_into_rows_arr_for_bookingsearchresults( props ), { cid_key: 'body_' + params[ 'cid_key' ] } )
1142 );
1143 var inner_footer = el( 'div', {className: 'wpbc_gb_block_preview_inner_footer' , key: 'footer_' + params[ 'cid_key' ] }
1144 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
1145 );
1146
1147 return el( 'div', { className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_bookingsearch' , key: 'preview_wrapper_' + params[ 'cid_key' ] }
1148
1149 , el( 'div', { className: 'wpbc_gb_block_shortcode_preview_content' , key: 'preview_content_' + params[ 'cid_key' ] }
1150 , [ inner_header, inner_body ]
1151 )
1152 , inner_footer
1153 );
1154 //FixIn: 8.7.3.18 End
1155 }
1156
1157
1158 /**
1159 * Parse parameters into array of rows objects for showing in conetnt of block
1160 *
1161 * @param props
1162 */
1163 function wpbc_parse_params_into_rows_arr_for_bookingsearchresults( props ){
1164
1165 // Parameters Description /////////////////////////////////
1166 var rows_in_content = [];
1167 rows_in_content.push( { block_text: wp.i18n.__( 'Show search results on this page, after redirection from search form at other page.' ) } );
1168
1169 return rows_in_content;
1170 }
1171
1172
1173 /**
1174 * Generate Visual Preview Block of Booking Confirm - system shortcode
1175 *
1176 * @param shortcode_obj - shortcode JavaScript obj.
1177 * @returns
1178 */
1179 function wpbc_gt_get_visual_block_for_booking_confirm( shortcode_obj, params ){
1180
1181 // Booking Form Parameters
1182 var shortcode_defaults = {
1183 };
1184
1185 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
1186
1187 var el = wp.element.createElement;
1188
1189 //FixIn: 8.7.3.18 Start
1190 var inner_header = el( 'div', {className: 'wpbc_gb_block_preview_inner_header', key: 'header_' + params[ 'cid_key' ]}
1191 , wpbc_gb_tpl_header( { header: 'WP Booking Calendar - ' + wp.i18n.__( 'System Block' ) , cid_key: 'header_' + params[ 'cid_key' ] } )
1192 );
1193 var inner_body = el( 'div', {className: 'wpbc_gb_block_preview_inner_body', key: 'body_' + params[ 'cid_key' ] }
1194 , wpbc_gb_tpl_shortcode_parameters( wpbc_parse_params_into_rows_arr_for_booking_confirm( props ,'body_' + params[ 'cid_key' ] ), { cid_key: 'body_' + params[ 'cid_key' ] } )
1195 );
1196 var inner_footer = el( 'div', {className: 'wpbc_gb_block_preview_inner_footer' , key: 'footer_' + params[ 'cid_key' ] }
1197 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
1198 );
1199
1200 return el( 'div', { className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_booking_confirm' , key: 'preview_wrapper_' + params[ 'cid_key' ] }
1201
1202 , el( 'div', { className: 'wpbc_gb_block_shortcode_preview_content' , key: 'preview_content_' + params[ 'cid_key' ] }
1203 , [ inner_header, inner_body ]
1204 )
1205 , inner_footer
1206 );
1207 //FixIn: 8.7.3.18 End
1208 }
1209
1210
1211 /**
1212 * Generate Visual Preview Block of "Booking Manager" == Import ==
1213 *
1214 * @param shortcode_obj - shortcode JavaScript obj.
1215 * @returns
1216 */
1217 function wpbc_gt_get_visual_block_for_booking_manager_import( shortcode_obj, params ){
1218
1219 // Booking Form Parameters
1220 var shortcode_defaults = {};
1221
1222 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
1223
1224 var el = wp.element.createElement;
1225
1226 var inner_header = el( 'div', {className: 'wpbc_gb_block_preview_inner_header', key: 'header_' + params[ 'cid_key' ]}
1227 , wpbc_gb_tpl_header( { header: 'Booking Manager - ' + wp.i18n.__( 'Import Events from .ics feed into WP Booking Calendar - Block' ) , cid_key: 'header_' + params[ 'cid_key' ] } )
1228 );
1229 var inner_body = el( 'div', {className: 'wpbc_gb_block_preview_inner_body', key: 'body_' + params[ 'cid_key' ] }
1230 , wpbc_gb_tpl_shortcode_parameters(
1231 [
1232 { block_text: wp.i18n.__( 'This shortcode [ booking-manager-import ] is used for import bookings from .ics feed URL into the WP Booking Calendar plugin' ) }
1233 ]
1234 , { cid_key: 'body_' + params[ 'cid_key' ] }
1235 )
1236 );
1237 var inner_footer = el( 'div', {className: 'wpbc_gb_block_preview_inner_footer' , key: 'footer_' + params[ 'cid_key' ] }
1238 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
1239 );
1240
1241 return el( 'div', { className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_booking_import' , key: 'preview_wrapper_' + params[ 'cid_key' ] }
1242
1243 , el( 'div', { className: 'wpbc_gb_block_shortcode_preview_content' , key: 'preview_content_' + params[ 'cid_key' ] }
1244 , [ inner_header, inner_body ]
1245 )
1246 , inner_footer
1247 );
1248 }
1249
1250
1251 /**
1252 * Generate Visual Preview Block of "Booking Manager" == Import ==
1253 *
1254 * @param shortcode_obj - shortcode JavaScript obj.
1255 * @returns
1256 */
1257 function wpbc_gt_get_visual_block_for_booking_manager_listing( shortcode_obj, params ){
1258
1259 // Booking Form Parameters
1260 var shortcode_defaults = {};
1261
1262 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
1263
1264 var el = wp.element.createElement;
1265
1266 var inner_header = el( 'div', {className: 'wpbc_gb_block_preview_inner_header', key: 'header_' + params[ 'cid_key' ]}
1267 , wpbc_gb_tpl_header( { header: 'Booking Manager - ' + wp.i18n.__( 'Show Events Listing from .ics feed - Block' ) , cid_key: 'header_' + params[ 'cid_key' ] } )
1268 );
1269 var inner_body = el( 'div', {className: 'wpbc_gb_block_preview_inner_body', key: 'body_' + params[ 'cid_key' ] }
1270 , wpbc_gb_tpl_shortcode_parameters(
1271 [
1272 { block_text: wp.i18n.__( 'This shortcode [ booking-manager-listing ] used for show events listing from .ics feed URL.' ) }
1273 ]
1274 , { cid_key: 'body_' + params[ 'cid_key' ] }
1275 )
1276 );
1277 var inner_footer = el( 'div', {className: 'wpbc_gb_block_preview_inner_footer' , key: 'footer_' + params[ 'cid_key' ] }
1278 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
1279 );
1280
1281 return el( 'div', { className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_booking_import' , key: 'preview_wrapper_' + params[ 'cid_key' ] }
1282
1283 , el( 'div', { className: 'wpbc_gb_block_shortcode_preview_content' , key: 'preview_content_' + params[ 'cid_key' ] }
1284 , [ inner_header, inner_body ]
1285 )
1286 , inner_footer
1287 );
1288 }
1289
1290
1291 /**
1292 * Generate Visual Preview Block of Booking Edit - system shortcode
1293 *
1294 * @param shortcode_obj - shortcode JavaScript obj.
1295 * @returns
1296 */
1297 function wpbc_gt_get_visual_block_for_bookingedit( shortcode_obj, params ){
1298
1299 // Booking Form Parameters
1300 var shortcode_defaults = {
1301 };
1302
1303 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
1304
1305 var el = wp.element.createElement;
1306
1307 //FixIn: 8.7.3.18 Start
1308 var inner_header = el( 'div', {className: 'wpbc_gb_block_preview_inner_header', key: 'header_' + params[ 'cid_key' ]}
1309 , wpbc_gb_tpl_header( { header: wp.i18n.__( 'System Block' ) + ' (' + wp.i18n.__( 'Booking Calendar Editing' ) + ')', cid_key: 'header_' + params[ 'cid_key' ] } )
1310 );
1311 var inner_body = el( 'div', {className: 'wpbc_gb_block_preview_inner_body', key: 'body_' + params[ 'cid_key' ] }
1312 , wpbc_gb_tpl_shortcode_parameters( wpbc_parse_params_into_rows_arr_for_bookingedit( props ,'body_' + params[ 'cid_key' ] ), { cid_key: 'body_' + params[ 'cid_key' ] } )
1313 );
1314 var inner_footer = el( 'div', {className: 'wpbc_gb_block_preview_inner_footer' , key: 'footer_' + params[ 'cid_key' ] }
1315 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
1316 );
1317
1318 return el( 'div', { className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_bookingedit' , key: 'preview_wrapper_' + params[ 'cid_key' ] }
1319
1320 , el( 'div', { className: 'wpbc_gb_block_shortcode_preview_content' , key: 'preview_content_' + params[ 'cid_key' ] }
1321 , [ inner_header, inner_body ]
1322 )
1323 , inner_footer
1324 );
1325 //FixIn: 8.7.3.18 End
1326 }
1327
1328
1329 /**
1330 * Parse parameters into array of rows objects for showing in conetnt of block
1331 *
1332 * @param props
1333 */
1334 function wpbc_parse_params_into_rows_arr_for_booking_confirm( props , cid_key){
1335
1336 // Parameters Description /////////////////////////////////
1337 var rows_in_content = [];
1338 rows_in_content.push( { block_text: wp.i18n.__( 'This shortcode [booking_confirm] is used on a confirmation booking page to display booking details and confirmation after a successful booking.' ) } );
1339
1340 return rows_in_content;
1341 }
1342
1343
1344 /**
1345 * Parse parameters into array of rows objects for showing in conetnt of block
1346 *
1347 * @param props
1348 */
1349 function wpbc_parse_params_into_rows_arr_for_bookingedit( props, cid_key ){
1350
1351 var el = wp.element.createElement;
1352
1353 // Parameters Description /////////////////////////////////
1354 var rows_in_content = [];
1355 rows_in_content.push( { block_text: wp.i18n.__( 'This block required for ability to edit, cancel the booking by visitor, who made the booking, or for ability to show payment form, after sending payment request.' ) } );
1356
1357 rows_in_content.push( { block_text:
1358
1359 el( 'div', { key: 'wpbc_be1_' + cid_key }
1360 , el( 'span', { key: 'wpbc_be2_' + cid_key }, wp.i18n.__( 'Link to this page must be defined' ) )
1361 , ' '
1362 , el( 'a', { href: 'admin.php?page=wpbc-settings#wpbc_general_settings_advanced_metabox', key: 'wpbc_be3_' + cid_key }, 'on this page' )
1363 , ', '
1364 , el( 'span', { key: 'wpbc_be4_' + cid_key }, wp.i18n.__( 'at this option' ) )
1365 , ': "'
1366 , el( 'strong', { key: 'wpbc_be5_' + cid_key }, wp.i18n.__( 'URL to edit bookings' ) )
1367 , '".'
1368 )
1369 } );
1370 rows_in_content.push( { block_text:
1371 el( 'div', { style: { marginTop: '20px' }, key: 'wpbc_be6_' + cid_key }
1372 , el( 'strong', { key: 'wpbc_be7_' + cid_key }, wp.i18n.__( 'Important!' ) )
1373 , ' '
1374 , el( 'span', { key: 'wpbc_be8_' + cid_key }, wp.i18n.__( 'You can not open this page directly. Please, use links in ' ) )
1375 , ' '
1376 , el( 'a', { href: 'admin.php?page=wpbc-settings&tab=email' , key: 'wpbc_be9_' + cid_key }, 'email' )
1377 , '.'
1378 )
1379 } );
1380 rows_in_content.push( { block_text:
1381 el( 'div', { key: 'wpbc_be10_' + cid_key }
1382 , el( 'span', { key: 'wpbc_be11_' + cid_key }, wp.i18n.__( 'If you open this page directly, then you will see this error' ) )
1383 , ': "'
1384 , el( 'strong', { key: 'wpbc_be12_' + cid_key }, wp.i18n.__( 'You do not set any parameters for booking editing' ) )
1385 , '".'
1386 )
1387 } );
1388 return rows_in_content;
1389 }
1390
1391
1392 /**
1393 * Generate Visual Preview Block of Customer Bookings Listing - system shortcode
1394 *
1395 * @param shortcode_obj - shortcode JavaScript obj.
1396 * @returns
1397 */
1398 function wpbc_gt_get_visual_block_for_bookingcustomerlisting( shortcode_obj, params ){
1399
1400 // Booking Form Parameters
1401 var shortcode_defaults = {
1402 };
1403
1404 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
1405
1406 var el = wp.element.createElement;
1407
1408 //FixIn: 8.7.3.18 Start
1409 var inner_header = el( 'div', {className: 'wpbc_gb_block_preview_inner_header', key: 'header_' + params[ 'cid_key' ]}
1410 , wpbc_gb_tpl_header( { header: wp.i18n.__( 'Customer Bookings Listing' ), cid_key: 'header_' + params[ 'cid_key' ] } )
1411 );
1412 var inner_body = el( 'div', {className: 'wpbc_gb_block_preview_inner_body', key: 'body_' + params[ 'cid_key' ] }
1413 , wpbc_gb_tpl_shortcode_parameters( wpbc_parse_params_into_rows_arr_for_bookingcustomerlisting( props, 'body_' + params[ 'cid_key' ] ), { cid_key: 'body_' + params[ 'cid_key' ] } )
1414 );
1415 var inner_footer = el( 'div', {className: 'wpbc_gb_block_preview_inner_footer' , key: 'footer_' + params[ 'cid_key' ] }
1416 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
1417 );
1418
1419 return el( 'div', { className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_bookingcustomerlisting' , key: 'preview_wrapper_' + params[ 'cid_key' ] }
1420
1421 , el( 'div', { className: 'wpbc_gb_block_shortcode_preview_content' , key: 'preview_content_' + params[ 'cid_key' ] }
1422 , [ inner_header, inner_body ]
1423 )
1424 , inner_footer
1425 );
1426 //FixIn: 8.7.3.18 End
1427 }
1428
1429
1430 /**
1431 * Parse parameters into array of rows objects for showing in conetnt of block
1432 *
1433 * @param props
1434 */
1435 function wpbc_parse_params_into_rows_arr_for_bookingcustomerlisting( props, cid_key ){
1436
1437 var el = wp.element.createElement;
1438
1439 // Parameters Description /////////////////////////////////
1440 var rows_in_content = [];
1441 rows_in_content.push( { block_text: wp.i18n.__( 'Visitors of your website, can view previous (own) bookings, by clicking on secret link in email, which is sending after booking created.' ) } );
1442
1443 rows_in_content.push( { block_text:
1444
1445 el( 'div', { key: 'wpbc_bcl1_' + cid_key }
1446 , el( 'span', { key: 'wpbc_bcl2_' + cid_key }, wp.i18n.__( 'Link to this page must be defined' ) )
1447 , ' '
1448 , el( 'a', { href: 'admin.php?page=wpbc-settings#wpbc_general_settings_advanced_metabox' , key: 'wpbc_bcl2_2_' + cid_key }, 'on this page' )
1449 , ', '
1450 , el( 'span', { key: 'wpbc_bcl3_' + cid_key }, wp.i18n.__( 'at this option' ) )
1451 , ': "'
1452 , el( 'strong', { key: 'wpbc_bcl4_' + cid_key }, wp.i18n.__( 'URL of page for customer bookings listing' ) )
1453 , '".'
1454 )
1455 } );
1456 rows_in_content.push( { block_text:
1457 el( 'div', { style: { marginTop: '20px' }, key: 'wpbc_bcl5_' + cid_key }
1458 , el( 'strong', { key: 'wpbc_bcl6_' + cid_key }, wp.i18n.__( 'Important!' ) )
1459 , ' '
1460 , el( 'span', { key: 'wpbc_bcl7_' + cid_key }, wp.i18n.__( 'You can not open this page directly. Please, use links in ' ) )
1461 , ' '
1462 , el( 'a', { href: 'admin.php?page=wpbc-settings&tab=email' , key: 'wpbc_bcl8_' + cid_key }, 'email' )
1463 , '.'
1464 )
1465 } );
1466 rows_in_content.push( { block_text:
1467 el( 'div', { key: 'wpbc_bcl9_' + cid_key }
1468 , el( 'span', { key: 'wpbc_bcl10_' + cid_key }, wp.i18n.__( 'If you open this page directly, then you will see this error' ) )
1469 , ': "'
1470 , el( 'strong', { key: 'wpbc_bcl11_' + cid_key }, wp.i18n.__( 'You do not set any parameters for booking editing' ) )
1471 , '".'
1472 )
1473 } );
1474 return rows_in_content;
1475 }
1476
1477
1478
1479
1480 /**
1481 * Generate Visual Preview Block of Showing booking resource Info
1482 *
1483 * @param shortcode_obj - shortcode JavaScript obj.
1484 * @returns
1485 */
1486 function wpbc_gt_get_visual_block_for_bookingresource( shortcode_obj, params ){
1487
1488 // Booking Form Parameters // FixIn: 10.0.0.16.
1489 var shortcode_defaults = {
1490 type : 1,
1491 resource_id : 1,
1492 show : 'title'
1493 };
1494
1495
1496 var props = _.defaults( shortcode_obj.attrs.named, shortcode_defaults );
1497
1498 var el = wp.element.createElement;
1499
1500 //FixIn: 8.7.3.18 Start
1501 var inner_header = el( 'div', {className: 'wpbc_gb_block_preview_inner_header', key: 'header_' + params[ 'cid_key' ]}
1502 , wpbc_gb_tpl_header( { header: wp.i18n.__( 'Show Info of Booking Resource' ), cid_key: 'header_' + params[ 'cid_key' ] } )
1503 );
1504 var inner_body = el( 'div', {className: 'wpbc_gb_block_preview_inner_body', key: 'body_' + params[ 'cid_key' ] }
1505 , wpbc_gb_tpl_shortcode_parameters( wpbc_parse_params_into_rows_arr_for_bookingresource( props ), { cid_key: 'body_' + params[ 'cid_key' ] } )
1506 );
1507 var inner_footer = el( 'div', {className: 'wpbc_gb_block_preview_inner_footer' , key: 'footer_' + params[ 'cid_key' ] }
1508 , wpbc_gb_tpl_footer( { shortcode_in_text: params[ 'shortcode_in_text' ], cid_key: 'footer_' + params[ 'cid_key' ] } )
1509 );
1510
1511 return el( 'div', { className: 'wpbc_gb_block_shortcode_preview_wrapper wpbc_gb_block_preview_bookingresource' , key: 'preview_wrapper_' + params[ 'cid_key' ] }
1512
1513 , el( 'div', { className: 'wpbc_gb_block_shortcode_preview_content' , key: 'preview_content_' + params[ 'cid_key' ] }
1514 , [ inner_header, inner_body ]
1515 )
1516 , inner_footer
1517 );
1518 //FixIn: 8.7.3.18 End
1519 }
1520
1521
1522 /**
1523 * Parse parameters into array of rows objects for showing in content of block
1524 *
1525 * @param props
1526 */
1527 function wpbc_parse_params_into_rows_arr_for_bookingresource( props ){
1528
1529 // Parameters Description /////////////////////////////////
1530 var rows_in_content = [];
1531 if ( (undefined != props[ 'type' ]) && ( 1 != props[ 'type' ]) ){
1532 rows_in_content.push( {name: wp.i18n.__( 'Booking resource' ), value: 'ID = ' + props[ 'type' ]} );
1533 }
1534 // FixIn: 10.0.0.16.
1535 if ( (undefined != props[ 'resource_id' ]) && ( 1 != props[ 'resource_id' ]) ){
1536 rows_in_content.push( {name: wp.i18n.__( 'Booking resource' ), value: 'ID = ' + props[ 'resource_id' ]} );
1537 }
1538
1539 if ( undefined != props[ 'show' ] ) {
1540 rows_in_content.push( { name: wp.i18n.__( 'Show' ), value: props[ 'show' ] } );
1541 /*
1542 if ( 'title' == props[ 'show' ] ) {
1543 rows_in_content.push( { name: wp.i18n.__( 'Show' ), value: props[ 'show' ] } );
1544 }
1545 if ( 'cost' == props[ 'show' ] ) {
1546 rows_in_content.push( { name: wp.i18n.__( 'Show' ), value: props[ 'show' ] } );
1547 }
1548 if ( 'capacity' == props[ 'show' ] ) {
1549 rows_in_content.push( { name: wp.i18n.__( 'Show' ), value: props[ 'show' ] } );
1550 }
1551 */
1552 }
1553 return rows_in_content;
1554 }
1555
1556
1557
1558 // Templates ///////////////////////////////////////////////////////////////////////////////////////////////////////////
1559
1560 /**
1561 * Header template for Block Preview
1562 *
1563 * @param props - object of parameters
1564 * @returns array of createElements - react elements
1565 */
1566 function wpbc_gb_tpl_header( props ){
1567
1568 var el = wp.element.createElement;
1569 // FixIn: 8.7.3.18.
1570 return [
1571 el( 'h3', {className: 'wpbc_gb_block_preview_inner_title_text', key: 'h3header_' + props[ 'cid_key' ] }, props.header ),
1572
1573 el( 'a', {className: 'wpbc_gb_block_preview_inner_title_edit', key: 'a_clickedit_' + props[ 'cid_key' ] }, wp.i18n.__( 'Click to edit' ) ),
1574
1575 el( 'div', {className: 'wpbc_gb_block_preview_inner_title_desc', key: 'div_notreal_' + props[ 'cid_key' ] }, wp.i18n.__( 'This is not real preview. Its configuration block of "Booking Calendar".' ) )
1576 ];
1577 }
1578
1579
1580 /**
1581 * Parameters template for shortcode params in Body of Block Preview
1582 *
1583 * @param props - array of objects of parameters [ {name: 'title', value: 'data'}, ... ]
1584 * @returns array of createElements - react elements
1585 */
1586 function wpbc_gb_tpl_shortcode_parameters( props , params ){ // FixIn: 8.7.3.18.
1587
1588 var el = wp.element.createElement;
1589
1590 var shortcode_parameters_arr = [];
1591
1592 var propsLength = props.length;
1593
1594 var cid_key = params[ 'cid_key' ]; // FixIn: 8.7.3.18.
1595 for ( var i = 0; i < propsLength; i++ ){
1596
1597 cid_key = 'internal' + i + params[ 'cid_key' ];
1598
1599 if ( undefined != props[i]['block_text'] ) {
1600
1601 shortcode_parameters_arr.push(
1602 el( 'div', {className: 'wpbc_gb_block_preview_inner_params_row', key: 'div_text' + cid_key }
1603 , el( 'span', { key: 'inner_params_row_span' + cid_key }, props[ i ]['block_text'] )
1604 )
1605 );
1606
1607 }
1608
1609 if ( ( undefined != props[i]['name'] ) && ( undefined != props[i]['value'] ) ) {
1610
1611 shortcode_parameters_arr.push(
1612 el( 'div', {className: 'wpbc_gb_block_preview_inner_params_row', key: 'div_name' + cid_key }
1613 , el( 'strong', { key: 'strong_name' + cid_key }, props[ i ].name )
1614 , el( 'span', { key: 'span_name' + cid_key }, ': ' )
1615 , el( 'em', { key: 'em_value' + cid_key }, props[ i ].value )
1616 )
1617 );
1618 }
1619 }
1620
1621 return shortcode_parameters_arr;
1622 }
1623
1624
1625 /**
1626 * Header template for Block Preview
1627 *
1628 * @param props - object of parameters
1629 * @returns array of createElements - react elements
1630 */
1631 function wpbc_gb_tpl_footer( props ){
1632
1633 var el = wp.element.createElement;
1634 // FixIn: 8.7.3.18.
1635 return [
1636 el( 'div', { className: 'wpbc_gb_block_preview_inner_shortcode', key: 'div_foot_' + props[ 'cid_key' ] }, props.shortcode_in_text )
1637 ];
1638 }