PluginProbe
Booking Calendar / 11.7
Booking Calendar v11.7
11.9 11.8.4 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 All 205 releases
booking / includes / page-bookings / booking_action / booking_cost.php

booking_cost.php in Booking Calendar 11.7, at includes/page-bookings/booking_action/booking_cost.php

112 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class to Cost Edit -- Option for "Actions Dropdown Menu"
4 *
5 * @package Support functions.
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit, if accessed directly.
10 }
11
12 /**
13 * Class WPBC_Action_Booking_Cost
14 */
15 class WPBC_Action_Booking_Cost {
16
17 const ACTION = 'set_booking_cost';
18
19 /**
20 * Get Action Button
21 *
22 * @return false|string
23 */
24 public static function get_button() {
25
26 if ( ! class_exists( 'wpdev_bk_biz_s' ) ) {
27 return false;
28 }
29 if ( ! wpbc_is_user_can( self::ACTION, wpbc_get_current_user_id() ) ) {
30 return false;
31 }
32
33 // Send payment request to visitor.
34 $html = "<a class='ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . esc_js( self::ACTION ) . "'
35 href=\"javascript:void(0)\"
36 onclick=\"wpbc_boo_listing__click__set_booking_cost( {{data['parsed_fields']['booking_id']}}, '{{data.parsed_fields.cost}}' );\"
37 >" .
38 esc_js( __( 'Edit pay price', 'booking' ) ) .
39 ' ' .
40 "<span class='hint_value_instead_icon'>{{{data['parsed_fields']['currency_symbol']}}} {{data['parsed_fields']['cost']}}</span>" .
41 '</a>';
42
43 return $html;
44 }
45
46
47 /**
48 * Get Template for Modal Window - Booking Cost Edit - Layout - Modal Window structure
49 *
50 * @return false|void
51 */
52 public static function template_for_modal() {
53
54 if ( ! class_exists( 'wpdev_bk_biz_s' ) ) {
55 return false;
56 }
57
58 ?>
59 <span class="wpdevelop">
60 <div id="wpbc_modal__booking_cost_edit__section" class="modal wpbc_popup_modal wpbc_modal_in_listing" tabindex="-1" role="dialog">
61 <div class="modal-dialog">
62 <div class="modal-content">
63 <div class="modal-header">
64 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
65 <h4 class="modal-title">
66 <?php
67 esc_html_e( 'Update the booking payment amount', 'booking' );
68 ?>
69 <sup class="wpbc_modal__booking_cost_edit__booking_id wpbc_modal__booking_id__in_title"></sup>
70 </h4>
71 </div>
72 <div class="modal-body">
73 <input type="text" id="wpbc_modal__booking_cost_edit__value" name="wpbc_modal__booking_cost_edit__value" style="width:100%;"/>
74 <label class="help-block">
75 <?php
76 esc_html_e( 'Enter the amount you will charge the user through the payment link', 'booking' );
77 ?>
78 </label>
79 <input type="hidden" id="wpbc_modal__booking_cost_edit__booking_id" value=""/>
80 </div>
81 <div class="modal-footer">
82 <a id="wpbc_modal__booking_cost_edit__button_send" class="button button-primary"
83 href="javascript:void(0);"
84 onclick="javascript: wpbc_ajx_booking_ajax_action_request( {
85 'booking_action' : '<?php echo esc_js( self::ACTION ); ?>',
86 'booking_id' : jQuery( '#wpbc_modal__booking_cost_edit__booking_id').val(),
87 'booking_cost' : jQuery( '#wpbc_modal__booking_cost_edit__value').val(),
88 'ui_clicked_element_id': 'wpbc_modal__booking_cost_edit__button_send'
89 } );
90 wpbc_button_enable_loading_icon( this );
91 jQuery( '#wpbc_modal__booking_cost_edit__section' ).wpbc_my_modal( 'hide' );" >
92 <?php
93 esc_html_e( 'Save Changes', 'booking' );
94 ?>
95 </a>
96 <a href="javascript:void(0)" class="button button-secondary" data-dismiss="modal">
97 <?php
98 esc_html_e( 'Cancel', 'booking' );
99 ?>
100 </a>
101 </div>
102 </div><!-- /.modal-content -->
103 </div><!-- /.modal-dialog -->
104 </div><!-- /.modal -->
105 </span>
106 <?php
107 }
108 }
109
110 // Loads hidden modal template.
111 add_action( 'wpbc_hook_booking_template__hidden_templates', array( new WPBC_Action_Booking_Cost(), 'template_for_modal' ) );
112