| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * Item Details | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * Display the item data meta box. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | if ( ! defined( 'ABSPATH' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |     exit; // Exit if accessed directly | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * GetPaid_Meta_Box_Item_Details Class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | class GetPaid_Meta_Box_Item_Details { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |      * Output the metabox. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |      * @param WP_Post $post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     public static function output( $post ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 		global $aui_bs5; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         // Prepare the item. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         $item = new WPInv_Item( $post ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         // Nonce field. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |         wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         // Variable prices. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         $variable_prices = $item->get_variable_prices(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         // Set the currency position. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         $position = wpinv_currency_position(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         if ( $position == 'left_space' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |             $position = 'left'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         if ( $position == 'right_space' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |             $position = 'right'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr( $item->get_type( 'edit' ) ); ?>" /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         <style> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |             #poststuff .input-group-text, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |             #poststuff .form-control { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |                 border-color: #7e8993; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |             .bsui label.col-sm-3.col-form-label { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |                 font-weight: 600; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         </style> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         <div class="bsui" style="max-width: 600px;padding-top: 10px;"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |             <?php do_action( 'wpinv_item_details_metabox_before_price', $item ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |             <div class="form-group mb-3 row"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |                 <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php esc_html_e( 'Item Price', 'invoicing' ); ?></span></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |                 <div class="col-sm-8"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |                     <div class="row wpinv_hide_if_variable_pricing"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |                         <div class="col-sm-4 getpaid-price-input mb-3"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |                             <div class="input-group input-group-sm"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |                                 <?php if ( 'left' == $position ) : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |                                     <?php if ( empty( $aui_bs5 ) ) : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |                                         <div class="input-group-prepend"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |                                             <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |                                         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |                                     <?php else : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |                                         <span class="input-group-text"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |                                             <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |                                         </span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |                                     <?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |                                 <?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |                                 <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_price( 'edit' ) ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control wpinv-force-integer" autocomplete="off"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |                                 <?php if ( 'left' != $position ) : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |                                     <?php if ( empty( $aui_bs5 ) ) : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |                                         <div class="input-group-append"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |                                             <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |                                         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |                                     <?php else : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |                                         <span class="input-group-text"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |                                             <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |                                         </span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |                                     <?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |                                 <?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |                             </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |                         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |                         <div class="col-sm-4 wpinv_show_if_recurring"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |                             <div class="mb-3 input-group input-group-sm"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |                                 <?php if ( empty( $aui_bs5 ) ) : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |                                     <div class="input-group-prepend"><span class="input-group-text pl-0 pr-2 border-0 bg-transparent"><?php esc_html_e( 'every' ); ?></span></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |                                 <?php else : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |                                     <span class="input-group-text ps-0 pe-2 border-0"><?php esc_html_e( 'every' ); ?></span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |                                 <?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |                                 <input type="number" name="wpinv_recurring_interval" id="wpinv_recurring_interval" value="<?php echo esc_attr( $item->get_recurring_interval( 'edit' ) ); ?>" placeholder="1" class="form-control rounded-1 rounded-sm"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |                             </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |                         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |                         <div class="col-sm-4 wpinv_show_if_recurring"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |                             <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |                             aui()->select( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |                                 array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |                                     'id'               => 'wpinv_recurring_period', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |                                     'name'             => 'wpinv_recurring_period', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |                                     'label'            => __( 'Period', 'invoicing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |                                     'placeholder'      => __( 'Select Period', 'invoicing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |                                     'value'            => $item->get_recurring_period( 'edit' ), | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |                                     'options'          => array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |                                         'D' => __( 'day(s)', 'invoicing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |                                         'W' => __( 'week(s)', 'invoicing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |                                         'M' => __( 'month(s)', 'invoicing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |                                         'Y' => __( 'year(s)', 'invoicing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |                                     ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |                                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |                                 true | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |                             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |                             ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |                         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |                     </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |                     <div class="row"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |                         <div class="col-sm-12"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |                             <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |                             // Variable pricing. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |                             do_action( 'wpinv_item_details_metabox_before_variable_pricing_checkbox', $item ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |                             aui()->input( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |                                 array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |                                     'id'      => 'wpinv_variable_pricing', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |                                     'name'    => 'wpinv_variable_pricing', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |                                     'type'    => 'checkbox', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |                                     'label'   => apply_filters( 'wpinv_variable_pricing_toggle_text', __( 'Enable variable pricing', 'invoicing' ) ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |                                     'value'   => '1', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |                                     'checked' => $item->has_variable_pricing(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |                                     'no_wrap' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |                                     'switch'  => 'sm' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |                                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |                                 true | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |                             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |                             do_action( 'wpinv_item_details_metabox_variable_pricing_checkbox', $item ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |                             ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |                         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |                     </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |                     <div class="row wpinv_hide_if_variable_pricing"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |                         <div class="col-sm-12"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |                             <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |                             // Dynamic pricing. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |                             if ( $item->supports_dynamic_pricing() ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |                                 do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |                                 // NYP toggle. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |                                 aui()->input( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |                                     array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |                                         'id'      => 'wpinv_name_your_price', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |                                         'name'    => 'wpinv_name_your_price', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |                                         'type'    => 'checkbox', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |                                         'label'   => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |                                         'value'   => '1', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |                                         'checked' => $item->user_can_set_their_price(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |                                         'no_wrap' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 										'switch'  => 'sm', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |                                     ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |                                     true | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |                                 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |                                 do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |                             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |                             // Subscriptions. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |                             do_action( 'wpinv_item_details_metabox_before_subscription_checkbox', $item ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |                             aui()->input( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |                                 array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |                                     'id'      => 'wpinv_is_recurring', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |                                     'name'    => 'wpinv_is_recurring', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |                                     'type'    => 'checkbox', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |                                     'label'   => apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Charge customers a recurring amount for this item', 'invoicing' ) ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |                                     'value'   => '1', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |                                     'checked' => $item->is_recurring(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |                                     'no_wrap' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |                                     'switch'  => 'sm' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |                                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |                                 true | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |                             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |                             do_action( 'wpinv_item_details_metabox_subscription_checkbox', $item ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |                             ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |                             <div class="wpinv_show_if_recurring"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |                                 <em><?php echo wp_kses_post( wpinv_get_recurring_gateways_text() ); ?></em> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |                             </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |                         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |                     </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |                 </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |                 <div class="col-sm-1 pt-2 pl-0 wpinv_hide_if_variable_pricing"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |                     <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e( 'Set the subscription price, billing interval and period.', 'invoicing' ); ?>"></span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |                 </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |             </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |             <?php do_action( 'wpinv_item_details_metabox_after_price', $item ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |             <?php if ( $item->supports_dynamic_pricing() ) : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |                 <?php do_action( 'wpinv_item_details_metabox_before_minimum_price', $item ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |                 <div class="wpinv_show_if_dynamic wpinv_minimum_price wpinv_hide_if_variable_pricing"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |                     <div class="form-group mb-3 row"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |                         <label for="wpinv_minimum_price" class="col-sm-3 col-form-label"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |                             <?php esc_html_e( 'Minimum Price', 'invoicing' ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |                         </label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |                         <div class="col-sm-8"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |                             <div class="input-group input-group-sm"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |                                 <?php if ( 'left' == $position ) : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |                                     <?php if ( empty( $aui_bs5 ) ) : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |                                         <div class="input-group-prepend"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |                                             <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |                                         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |                                     <?php else : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |                                         <span class="input-group-text"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |                                             <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |                                         </span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |                                     <?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |                                 <?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |                                 <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_minimum_price( 'edit' ) ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control wpinv-force-integer"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |                                 <?php if ( 'left' != $position ) : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |                                     <?php if ( empty( $aui_bs5 ) ) : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |                                         <div class="input-group-append"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |                                             <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |                                         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |                                     <?php else : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |                                         <span class="input-group-text"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |                                             <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |                                         </span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |                                     <?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |                                 <?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |                             </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |                         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |                         <div class="col-sm-1 pt-2 pl-0"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |                             <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the minimum amount that users are allowed to set', 'invoicing' ); ?>"></span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |                         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |                     </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |                 </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |                 <?php do_action( 'wpinv_item_details_metabox_minimum_price', $item ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |             <?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |             <?php do_action( 'wpinv_item_details_metabox_before_maximum_renewals', $item ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |             <div class="wpinv_show_if_recurring wpinv_hide_if_variable_pricing wpinv_maximum_renewals"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |                 <div class="form-group mb-3 row"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |                     <label for="wpinv_recurring_limit" class="col-sm-3 col-form-label"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |                         <?php esc_html_e( 'Maximum Renewals', 'invoicing' ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |                     </label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |                     <div class="col-sm-8"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |                         <input type="number" value="<?php echo esc_attr( $item->get_recurring_limit( 'edit' ) ); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" class="form-control form-control-sm" /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |                     </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |                     <div class="col-sm-1 pt-2 pl-0"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |                         <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing' ); ?>"></span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |                     </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |                 </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |             </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |             <?php do_action( 'wpinv_item_details_metabox_maximum_renewals', $item ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |             <?php do_action( 'wpinv_item_details_metabox_before_free_trial', $item ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |             <div class="wpinv_show_if_recurring wpinv_hide_if_variable_pricing wpinv_free_trial"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |                 <div class="form-group mb-3 row"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |                     <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php defined( 'GETPAID_PAID_TRIALS_VERSION' ) ? esc_html_e( 'Free/Paid Trial', 'invoicing' ) : esc_html_e( 'Free Trial', 'invoicing' ); ?></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |                     <div class="col-sm-8"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |                         <div class="row"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |                             <div class="col-sm-6"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |                                 <?php $value = $item->has_free_trial() ? $item->get_trial_interval( 'edit' ) : 0; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |                                 <div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |                                     <input type="number" name="wpinv_trial_interval" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr( $value ); ?>" class="form-control form-control-sm wpinv-force-integer"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |                                 </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |                             </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |                             <div class="col-sm-6"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |                                 <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |                                 aui()->select( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |                                     array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |                                         'id'               => 'wpinv_trial_period', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |                                         'name'             => 'wpinv_trial_period', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |                                         'label'            => __( 'Trial Period', 'invoicing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |                                         'placeholder'      => __( 'Trial Period', 'invoicing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |                                         'value'            => $item->get_trial_period( 'edit' ), | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |                                         'select2'          => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |                                         'data-allow-clear' => 'false', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |                                         'no_wrap'          => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |                                         'options'          => array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |                                             'D' => __( 'day(s)', 'invoicing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |                                             'W' => __( 'week(s)', 'invoicing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |                                             'M' => __( 'month(s)', 'invoicing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |                                             'Y' => __( 'year(s)', 'invoicing' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |                                         ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |                                     ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |                                     true | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |                                 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |                                 ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |                             </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |                         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |                     </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |                     <div class="col-sm-1 pt-2 pl-0"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |                         <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'An optional period of time to wait before charging the first recurring payment.', 'invoicing' ); ?>"></span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |                     </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |                 </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |             </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |             <?php do_action( 'wpinv_item_details_metabox__free_trial', $item ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |         <div class="bsui"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |             <?php do_action( 'wpinv_item_details_metabox_before_variable_pricing', $item ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |             <div class="wpinv_show_if_variable_pricing wpinv_variable_pricing"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |                  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |                 <div id="wpinv_price_fields" class="wpinv_meta_table_wrap mb-3"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |                     <div class="widefat getpaid_repeatable_table"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |                         <div class="wpinv-price-option-fields getpaid-repeatables-wrap"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |                             <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |                             if ( ! empty( $variable_prices ) ) : | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |                                 foreach ( $variable_prices as $key => $value ) : | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |                                     $name   = (isset( $value['name'] ) && ! empty( $value['name'] )) ? $value['name'] : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |                                     $index  = (isset( $value['index'] ) && $value['index'] !== '') ? $value['index'] : $key; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |                                     $amount = isset( $value['amount'] ) ? $value['amount'] : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |                                     $args   = apply_filters( 'wpinv_price_row_args', compact( 'name', 'amount' ), $value ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |                                     $args = wp_parse_args( $args, $value ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |                                     ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |                                     <div class="wpinv_variable_prices_wrapper getpaid_repeatable_row" data-key="<?php echo esc_attr( $key ); ?>"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |                                         <?php self::render_price_row( $key, $args, $item, $index ); ?> | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |                                     </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |                                 <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |                                 endforeach; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |                             else : | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |                                 ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |                                 <div class="wpinv_variable_prices_wrapper getpaid_repeatable_row" data-key="1"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |                                     <?php self::render_price_row( 1, array(), $item, 1 ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |                                 </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |                             <?php endif; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |                             <div class="wpinv-add-repeatable-row"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |                                 <div class="float-none pt-2 clear"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |                                     <button type="button" class="button-secondary getpaid-add-variable-price-row"><?php _e( 'Add New Price', 'invoicing' ); ?></button> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |                                 </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |                             </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |                         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |                     </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |                 </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |             </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |             <?php do_action( 'wpinv_item_details_metabox_variable_pricing', $item ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |         <div class="bsui" style="max-width: 600px;"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |             <?php do_action( 'wpinv_item_details_metabox_item_details', $item ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |         <script type="text/html" id="tmpl-getpaid-variable-price-row"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |             <div class="wpinv_variable_prices_wrapper getpaid_repeatable_row" data-key="1"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |                 <?php self::render_price_row( 1, array(), $item, 1 ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |             </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |         </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |         <script type="text/javascript"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |             jQuery(function($) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |                 // Inserts a new row | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |                 $('.getpaid-add-variable-price-row').on('click', function(e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |                     e.preventDefault(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |                     const html = $('#tmpl-getpaid-variable-price-row').html(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |                     const price_row = $(html); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |                     const last_price_row = $(this).parents('.wpinv-price-option-fields').find('.wpinv_variable_prices_wrapper').last(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |                     // Retrieve the highest current key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |                     var key = highest = 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |                     $(this).parents('.wpinv-price-option-fields').find('.getpaid_repeatable_row').each(function() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |                         var current = $(this).data('key'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |                         if (parseInt(current) > highest) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |                             highest = current; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |                     }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |                     key = highest += 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |                     price_row.attr('data-key', key); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |                     price_row.find('input, select, textarea').each(function() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |                         var name = $(this).attr('name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |                         var id = $(this).attr('id'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |                         if (name) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |                             name = name.replace(/\[(\d+)\]/, '[' + parseInt(key) + ']'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |                             $(this).attr('name', name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |                         $(this).attr('data-key', key); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |                         if (typeof id != 'undefined') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |                             id = id.replace(/(\d+)/, parseInt(key)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |                             $(this).attr('id', id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |                     }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |                     price_row.find('span.getpaid_price_id').each(function() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |                         $(this).text(parseInt(key)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |                     }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |                     price_row.find('.getpaid_repeatable_default_input').each(function() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |                         $(this).val(parseInt(key)).removeAttr('checked'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |                     }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |                     $(price_row).insertAfter(last_price_row) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |                 }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |                 // Remove a row. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |                 $(document).on('click', '.getpaid-remove-price-option-row', function(e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |                     e.preventDefault(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |                     var row = $(this).parents('.getpaid_repeatable_row'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |                         count = row.parent().find('.getpaid_repeatable_row').length, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |                         price_id = parseInt(row.data("key")); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |                     $('.getpaid_repeatable_condition_field option[value="' + price_id + '"]').remove() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |                     if (count > 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |                         $('input, select', row).val(''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |                         row.fadeOut('fast').remove(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |                 }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |                 $(".getpaid_repeatable_table .getpaid-repeatables-wrap").sortable({ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |                     handle: '.getpaid-draghandle-cursor', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |                     items: '.getpaid_repeatable_row', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |                     opacity: 0.6, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |                     cursor: 'move', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |                     axis: 'y', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |                     update: function() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |                         var count = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |                         $(this).find('.getpaid_repeatable_row').each(function() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |                             $(this).find('input.getpaid_repeatable_index').each(function() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |                                 $(this).val(count); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |                             }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |                             count++; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |                         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |                 }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |             }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |         </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |     <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |      * Render a price row with advanced settings for a WPINV Item. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |      * This function generates HTML markup for displaying a price row with advanced settings, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |      * including recurring payment options. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |      * @since 2.8.9 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |      * @param string $key   The unique identifier for the price row. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |      * @param array  $args  Optional. Array of arguments for customizing the price row. Default empty array. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |      * @param WP_Post $item  WPINV Itemm object. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |      * @param int    $index The index of the price row. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 481 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 482 |  |  |     public static function render_price_row( $key, $args = array(), $item, $index ) {    | 
            
                                                                        
                            
            
                                    
            
            
                | 483 |  |  | 		global $aui_bs5; | 
            
                                                                        
                            
            
                                    
            
            
                | 484 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 485 |  |  |         $defaults = array( | 
            
                                                                        
                            
            
                                    
            
            
                | 486 |  |  |             'name'               => null, | 
            
                                                                        
                            
            
                                    
            
            
                | 487 |  |  |             'amount'             => null, | 
            
                                                                        
                            
            
                                    
            
            
                | 488 |  |  |             'is-recurring'       => 'no', | 
            
                                                                        
                            
            
                                    
            
            
                | 489 |  |  |             'trial-interval'     => 0, | 
            
                                                                        
                            
            
                                    
            
            
                | 490 |  |  |             'trial-period'       => null, | 
            
                                                                        
                            
            
                                    
            
            
                | 491 |  |  |             'recurring-interval' => 1, | 
            
                                                                        
                            
            
                                    
            
            
                | 492 |  |  |             'recurring-period'   => null, | 
            
                                                                        
                            
            
                                    
            
            
                | 493 |  |  |             'recurring-limit'    => 0, | 
            
                                                                        
                            
            
                                    
            
            
                | 494 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 495 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 496 |  |  |         $args = wp_parse_args( $args, $defaults ); | 
            
                                                                        
                            
            
                                    
            
            
                | 497 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 498 |  |  |         $default_price_id = $item->get_default_price_id(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 499 |  |  |         $is_recurring = ('yes' === $args['is-recurring']) ? true : false; | 
            
                                                                        
                            
            
                                    
            
            
                | 500 |  |  |         $position = wpinv_currency_position(); | 
            
                                                                        
                            
            
                                    
            
            
                | 501 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 502 |  |  |         $extra_attributes = array( | 
            
                                                                        
                            
            
                                    
            
            
                | 503 |  |  |             'min'   => 0, | 
            
                                                                        
                            
            
                                    
            
            
                | 504 |  |  |             'step'  => 1, | 
            
                                                                        
                            
            
                                    
            
            
                | 505 |  |  |             'size'  => 1, | 
            
                                                                        
                            
            
                                    
            
            
                | 506 |  |  |             'style' => 'width: 70px', | 
            
                                                                        
                            
            
                                    
            
            
                | 507 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 508 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 509 |  |  |         if ( ! $is_recurring ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 510 |  |  |             $extra_attributes['disabled'] = true; | 
            
                                                                        
                            
            
                                    
            
            
                | 511 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 512 |  |  |         ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 513 |  |  |         <div class="getpaid-repeatable-row-header getpaid-draghandle-cursor"> | 
            
                                                                        
                            
            
                                    
            
            
                | 514 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 515 |  |  |             <span class="getpaid-repeatable-row-title" title="<?php _e( 'Click and drag to re-order price options', 'invoicing' ); ?>"> | 
            
                                                                        
                            
            
                                    
            
            
                | 516 |  |  |                 <?php printf( __( 'Price ID: %s', 'invoicing' ), '<span class="getpaid_price_id">' . $key . '</span>' ); ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 517 |  |  |                 <input type="hidden" name="wpinv_variable_prices[<?php echo $key; ?>][index]" class="getpaid_repeatable_index" value="<?php echo $index; ?>"/> | 
            
                                                                        
                            
            
                                    
            
            
                | 518 |  |  |             </span> | 
            
                                                                        
                            
            
                                    
            
            
                | 519 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 520 |  |  |             <span class="getpaid-repeatable-row-actions"> | 
            
                                                                        
                            
            
                                    
            
            
                | 521 |  |  |                 <a href="#" class="wpinv-toggle-custom-price-option-settings" data-show="<?php _e( 'Show advanced settings', 'invoicing' ); ?>" data-hide="<?php _e( 'Hide advanced settings', 'invoicing' ); ?>"><?php _e( 'Show advanced settings', 'invoicing' ); ?></a>  | 
            
                                                                        
                            
            
                                    
            
            
                | 522 |  |  |                  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 523 |  |  |                 <a class="getpaid-remove-price-option-row text-danger"> | 
            
                                                                        
                            
            
                                    
            
            
                | 524 |  |  |                     <?php _e( 'Remove', 'invoicing' ); ?> <span class="screen-reader-text"><?php printf( __( 'Remove price option %s', 'invoicing' ), esc_attr( $key ) ); ?></span> | 
            
                                                                        
                            
            
                                    
            
            
                | 525 |  |  |                 </a> | 
            
                                                                        
                            
            
                                    
            
            
                | 526 |  |  |             </span> | 
            
                                                                        
                            
            
                                    
            
            
                | 527 |  |  |         </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 528 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 529 |  |  |         <div class="getpaid-repeatable-row-standard-fields"> | 
            
                                                                        
                            
            
                                    
            
            
                | 530 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 531 |  |  |             <div class="getpaid-option-name"> | 
            
                                                                        
                            
            
                                    
            
            
                | 532 |  |  |                 <label class="form-label"><?php _e( 'Option Name', 'invoicing' ); ?></label> | 
            
                                                                        
                            
            
                                    
            
            
                | 533 |  |  |                 <?php | 
            
                                                                        
                            
            
                                    
            
            
                | 534 |  |  |                 aui()->input( | 
            
                                                                        
                            
            
                                    
            
            
                | 535 |  |  |                     array( | 
            
                                                                        
                            
            
                                    
            
            
                | 536 |  |  |                         'name'        => 'wpinv_variable_prices[' . $key . '][name]', | 
            
                                                                        
                            
            
                                    
            
            
                | 537 |  |  |                         'placeholder' => __( 'Option Name', 'invoicing' ), | 
            
                                                                        
                            
            
                                    
            
            
                | 538 |  |  |                         'value'       => esc_attr( $args['name'] ), | 
            
                                                                        
                            
            
                                    
            
            
                | 539 |  |  |                         'class'       => 'wpinv_variable_price_name form-control-sm', | 
            
                                                                        
                            
            
                                    
            
            
                | 540 |  |  |                         'no_wrap'     => true, | 
            
                                                                        
                            
            
                                    
            
            
                | 541 |  |  |                     ), | 
            
                                                                        
                            
            
                                    
            
            
                | 542 |  |  |                     true | 
            
                                                                        
                            
            
                                    
            
            
                | 543 |  |  |                 ); | 
            
                                                                        
                            
            
                                    
            
            
                | 544 |  |  |                 ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 545 |  |  |             </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 546 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 547 |  |  |             <div class="getpaid-option-price"> | 
            
                                                                        
                            
            
                                    
            
            
                | 548 |  |  |                 <label class="form-label"><?php _e( 'Price', 'invoicing' ); ?></label> | 
            
                                                                        
                            
            
                                    
            
            
                | 549 |  |  |                 <div class="input-group input-group-sm"> | 
            
                                                                        
                            
            
                                    
            
            
                | 550 |  |  |                     <?php if ( 'left' == $position ) : ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 551 |  |  |                         <?php if ( empty( $aui_bs5 ) ) : ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 552 |  |  |                             <div class="input-group-prepend"> | 
            
                                                                        
                            
            
                                    
            
            
                | 553 |  |  |                                 <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 554 |  |  |                             </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 555 |  |  |                         <?php else : ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 556 |  |  |                             <span class="input-group-text"> | 
            
                                                                        
                            
            
                                    
            
            
                | 557 |  |  |                                 <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 558 |  |  |                             </span> | 
            
                                                                        
                            
            
                                    
            
            
                | 559 |  |  |                         <?php endif; ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 560 |  |  |                     <?php endif; ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 561 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 562 |  |  |                     <input type="text" name="wpinv_variable_prices[<?php echo $key; ?>][amount]" id="wpinv_variable_prices[<?php echo $key; ?>][amount]" value="<?php echo esc_attr( getpaid_unstandardize_amount( $args['amount'] ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 9.99 ) ); ?>" class="form-control form-control-sm wpinv-force-integer getpaid-price-field" autocomplete="off"> | 
            
                                                                        
                            
            
                                    
            
            
                | 563 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 564 |  |  |                     <?php if ( 'left' != $position ) : ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 565 |  |  |                         <?php if ( empty( $aui_bs5 ) ) : ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 566 |  |  |                             <div class="input-group-append"> | 
            
                                                                        
                            
            
                                    
            
            
                | 567 |  |  |                                 <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> | 
            
                                                                        
                            
            
                                    
            
            
                | 568 |  |  |                             </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 569 |  |  |                         <?php else : ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 570 |  |  |                             <span class="input-group-text"> | 
            
                                                                        
                            
            
                                    
            
            
                | 571 |  |  |                                 <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 572 |  |  |                             </span> | 
            
                                                                        
                            
            
                                    
            
            
                | 573 |  |  |                         <?php endif; ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 574 |  |  |                     <?php endif; ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 575 |  |  |                 </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 576 |  |  |             </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 577 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 578 |  |  |             <div class="getpaid_repeatable_default getpaid_repeatable_default_wrapper"> | 
            
                                                                        
                            
            
                                    
            
            
                | 579 |  |  |                 <label class="form-label d-block"><?php _e( 'Default', 'invoicing' ); ?></label> | 
            
                                                                        
                            
            
                                    
            
            
                | 580 |  |  |                 <label class="getpaid-default-price"> | 
            
                                                                        
                            
            
                                    
            
            
                | 581 |  |  |                     <input type="radio" <?php checked( $default_price_id, $key, true ); ?> class="getpaid_repeatable_default_input" name="_wpinv_default_price_id" value="<?php echo $key; ?>" /> | 
            
                                                                        
                            
            
                                    
            
            
                | 582 |  |  |                     <span class="screen-reader-text"><?php printf( __( 'Set ID %s as default price', 'invoicing' ), $key ); ?></span> | 
            
                                                                        
                            
            
                                    
            
            
                | 583 |  |  |                 </label> | 
            
                                                                        
                            
            
                                    
            
            
                | 584 |  |  |             </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 585 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 586 |  |  |         </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 587 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 588 |  |  |         <div class="wpinv-custom-price-option-settings-wrap"> | 
            
                                                                        
                            
            
                                    
            
            
                | 589 |  |  |             <div class="wpinv-custom-price-option-settings"> | 
            
                                                                        
                            
            
                                    
            
            
                | 590 |  |  |                 <div class="wpinv-custom-price-option-setting"> | 
            
                                                                        
                            
            
                                    
            
            
                | 591 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 592 |  |  |                     <div class="wpinv-custom-price-option-setting-title"><?php _e( 'Recurring Payments Settings', 'invoicing' ); ?></div> | 
            
                                                                        
                            
            
                                    
            
            
                | 593 |  |  |                      | 
            
                                                                        
                            
            
                                    
            
            
                | 594 |  |  |                     <div class="wpinv-recurring-enabled"> | 
            
                                                                        
                            
            
                                    
            
            
                | 595 |  |  |                         <label class="form-label"><?php _e( 'Recurring', 'invoicing' ); ?></label> | 
            
                                                                        
                            
            
                                    
            
            
                | 596 |  |  |                         <?php | 
            
                                                                        
                            
            
                                    
            
            
                | 597 |  |  |                         aui()->select( | 
            
                                                                        
                            
            
                                    
            
            
                | 598 |  |  |                             array( | 
            
                                                                        
                            
            
                                    
            
            
                | 599 |  |  |                                 'name'    => 'wpinv_variable_prices[' . $key . '][is-recurring]', | 
            
                                                                        
                            
            
                                    
            
            
                | 600 |  |  |                                 'value'   => esc_attr( $args['is-recurring'] ), | 
            
                                                                        
                            
            
                                    
            
            
                | 601 |  |  |                                 'class'   => 'custom-select-sm', | 
            
                                                                        
                            
            
                                    
            
            
                | 602 |  |  |                                 'no_wrap' => true, | 
            
                                                                        
                            
            
                                    
            
            
                | 603 |  |  |                                 'options' => array( | 
            
                                                                        
                            
            
                                    
            
            
                | 604 |  |  |                                     'no'  => __( 'No', 'invoicing' ), | 
            
                                                                        
                            
            
                                    
            
            
                | 605 |  |  |                                     'yes' => __( 'Yes', 'invoicing' ), | 
            
                                                                        
                            
            
                                    
            
            
                | 606 |  |  |                                 ), | 
            
                                                                        
                            
            
                                    
            
            
                | 607 |  |  |                             ), | 
            
                                                                        
                            
            
                                    
            
            
                | 608 |  |  |                             true | 
            
                                                                        
                            
            
                                    
            
            
                | 609 |  |  |                         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 610 |  |  |                         ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 611 |  |  |                     </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 612 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 613 |  |  |                     <div class="wpinv-recurring-free-trial"> | 
            
                                                                        
                            
            
                                    
            
            
                | 614 |  |  |                         <label class="form-label"><?php _e( 'Free Trial', 'invoicing' ); ?></label> | 
            
                                                                        
                            
            
                                    
            
            
                | 615 |  |  |                         <?php | 
            
                                                                        
                            
            
                                    
            
            
                | 616 |  |  |                         aui()->input( | 
            
                                                                        
                            
            
                                    
            
            
                | 617 |  |  |                             array( | 
            
                                                                        
                            
            
                                    
            
            
                | 618 |  |  |                                 'type'             => 'number', | 
            
                                                                        
                            
            
                                    
            
            
                | 619 |  |  |                                 'id'               => 'wpinv_variable_prices[' . $key . '][trial-interval]', | 
            
                                                                        
                            
            
                                    
            
            
                | 620 |  |  |                                 'name'             => 'wpinv_variable_prices[' . $key . '][trial-interval]', | 
            
                                                                        
                            
            
                                    
            
            
                | 621 |  |  |                                 'value'            => absint( $args['trial-interval'] ), | 
            
                                                                        
                            
            
                                    
            
            
                | 622 |  |  |                                 'class'            => 'form-control-sm d-inline-block', | 
            
                                                                        
                            
            
                                    
            
            
                | 623 |  |  |                                 'no_wrap'          => true, | 
            
                                                                        
                            
            
                                    
            
            
                | 624 |  |  |                                 'extra_attributes' => $extra_attributes, | 
            
                                                                        
                            
            
                                    
            
            
                | 625 |  |  |                             ), | 
            
                                                                        
                            
            
                                    
            
            
                | 626 |  |  |                             true | 
            
                                                                        
                            
            
                                    
            
            
                | 627 |  |  |                         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 628 |  |  |                         ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 629 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 630 |  |  |                         <?php | 
            
                                                                        
                            
            
                                    
            
            
                | 631 |  |  |                         aui()->select( | 
            
                                                                        
                            
            
                                    
            
            
                | 632 |  |  |                             array( | 
            
                                                                        
                            
            
                                    
            
            
                | 633 |  |  |                                 'id'               => 'wpinv_variable_prices[' . $key . '][trial-period]', | 
            
                                                                        
                            
            
                                    
            
            
                | 634 |  |  |                                 'name'             => 'wpinv_variable_prices[' . $key . '][trial-period]', | 
            
                                                                        
                            
            
                                    
            
            
                | 635 |  |  |                                 'value'            => esc_attr( $args['trial-period'] ), | 
            
                                                                        
                            
            
                                    
            
            
                | 636 |  |  |                                 'class'            => 'custom-select-sm w-auto d-inline-block', | 
            
                                                                        
                            
            
                                    
            
            
                | 637 |  |  |                                 'no_wrap'          => true, | 
            
                                                                        
                            
            
                                    
            
            
                | 638 |  |  |                                 'extra_attributes' => ( ! $is_recurring ? array( 'disabled' => true ) : array()), | 
            
                                                                        
                            
            
                                    
            
            
                | 639 |  |  |                                 'options'          => array( | 
            
                                                                        
                            
            
                                    
            
            
                | 640 |  |  |                                     'D' => __( 'Day(s)', 'invoicing' ), | 
            
                                                                        
                            
            
                                    
            
            
                | 641 |  |  |                                     'W' => __( 'Week(s)', 'invoicing' ), | 
            
                                                                        
                            
            
                                    
            
            
                | 642 |  |  |                                     'M' => __( 'Month(s)', 'invoicing' ), | 
            
                                                                        
                            
            
                                    
            
            
                | 643 |  |  |                                     'Y' => __( 'Year(s)', 'invoicing' ), | 
            
                                                                        
                            
            
                                    
            
            
                | 644 |  |  |                                 ), | 
            
                                                                        
                            
            
                                    
            
            
                | 645 |  |  |                             ), | 
            
                                                                        
                            
            
                                    
            
            
                | 646 |  |  |                             true | 
            
                                                                        
                            
            
                                    
            
            
                | 647 |  |  |                         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 648 |  |  |                         ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 649 |  |  |                     </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 650 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 651 |  |  |                     <div class="wpinv-recurring-interval"> | 
            
                                                                        
                            
            
                                    
            
            
                | 652 |  |  |                         <label class="form-label"><?php _e( 'Every', 'invoicing' ); ?></label> | 
            
                                                                        
                            
            
                                    
            
            
                | 653 |  |  |                         <?php | 
            
                                                                        
                            
            
                                    
            
            
                | 654 |  |  |                         aui()->input( | 
            
                                                                        
                            
            
                                    
            
            
                | 655 |  |  |                             array( | 
            
                                                                        
                            
            
                                    
            
            
                | 656 |  |  |                                 'type'             => 'number', | 
            
                                                                        
                            
            
                                    
            
            
                | 657 |  |  |                                 'id'               => 'wpinv_variable_prices[' . $key . '][recurring-interval]', | 
            
                                                                        
                            
            
                                    
            
            
                | 658 |  |  |                                 'name'             => 'wpinv_variable_prices[' . $key . '][recurring-interval]', | 
            
                                                                        
                            
            
                                    
            
            
                | 659 |  |  |                                 'value'            => absint( $args['recurring-interval'] ), | 
            
                                                                        
                            
            
                                    
            
            
                | 660 |  |  |                                 'class'            => 'form-control-sm', | 
            
                                                                        
                            
            
                                    
            
            
                | 661 |  |  |                                 'no_wrap'          => true, | 
            
                                                                        
                            
            
                                    
            
            
                | 662 |  |  |                                 'extra_attributes' => $extra_attributes, | 
            
                                                                        
                            
            
                                    
            
            
                | 663 |  |  |                             ), | 
            
                                                                        
                            
            
                                    
            
            
                | 664 |  |  |                             true | 
            
                                                                        
                            
            
                                    
            
            
                | 665 |  |  |                         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 666 |  |  |                         ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 667 |  |  |                     </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 668 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 669 |  |  |                     <div class="wpinv-recurring-period"> | 
            
                                                                        
                            
            
                                    
            
            
                | 670 |  |  |                         <label class="form-label"><?php _e( 'Period', 'invoicing' ); ?></label> | 
            
                                                                        
                            
            
                                    
            
            
                | 671 |  |  |                         <?php | 
            
                                                                        
                            
            
                                    
            
            
                | 672 |  |  |                         aui()->select( | 
            
                                                                        
                            
            
                                    
            
            
                | 673 |  |  |                             array( | 
            
                                                                        
                            
            
                                    
            
            
                | 674 |  |  |                                 'id'               => 'wpinv_variable_prices[' . $key . '][recurring-period]', | 
            
                                                                        
                            
            
                                    
            
            
                | 675 |  |  |                                 'name'             => 'wpinv_variable_prices[' . $key . '][recurring-period]', | 
            
                                                                        
                            
            
                                    
            
            
                | 676 |  |  |                                 'value'            => esc_attr( $args['recurring-period'] ), | 
            
                                                                        
                            
            
                                    
            
            
                | 677 |  |  |                                 'class'            => 'custom-select-sm', | 
            
                                                                        
                            
            
                                    
            
            
                | 678 |  |  |                                 'extra_attributes' => ( ! $is_recurring ? array( 'disabled' => true ) : array()), | 
            
                                                                        
                            
            
                                    
            
            
                | 679 |  |  |                                 'no_wrap'          => true, | 
            
                                                                        
                            
            
                                    
            
            
                | 680 |  |  |                                 'options'          => array( | 
            
                                                                        
                            
            
                                    
            
            
                | 681 |  |  |                                     'D' => __( 'Day(s)', 'invoicing' ), | 
            
                                                                        
                            
            
                                    
            
            
                | 682 |  |  |                                     'W' => __( 'Week(s)', 'invoicing' ), | 
            
                                                                        
                            
            
                                    
            
            
                | 683 |  |  |                                     'M' => __( 'Month(s)', 'invoicing' ), | 
            
                                                                        
                            
            
                                    
            
            
                | 684 |  |  |                                     'Y' => __( 'Year(s)', 'invoicing' ), | 
            
                                                                        
                            
            
                                    
            
            
                | 685 |  |  |                                 ), | 
            
                                                                        
                            
            
                                    
            
            
                | 686 |  |  |                             ), | 
            
                                                                        
                            
            
                                    
            
            
                | 687 |  |  |                             true | 
            
                                                                        
                            
            
                                    
            
            
                | 688 |  |  |                         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 689 |  |  |                         ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 690 |  |  |                     </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 691 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 692 |  |  |                     <div class="wpinv-recurring-limit"> | 
            
                                                                        
                            
            
                                    
            
            
                | 693 |  |  |                         <label class="form-label"><?php _e( 'Maximum Renewals', 'invoicing' ); ?></label> | 
            
                                                                        
                            
            
                                    
            
            
                | 694 |  |  |                         <?php | 
            
                                                                        
                            
            
                                    
            
            
                | 695 |  |  |                         aui()->input( | 
            
                                                                        
                            
            
                                    
            
            
                | 696 |  |  |                             array( | 
            
                                                                        
                            
            
                                    
            
            
                | 697 |  |  |                                 'type'             => 'number', | 
            
                                                                        
                            
            
                                    
            
            
                | 698 |  |  |                                 'id'               => 'wpinv_variable_prices[' . $key . '][recurring-limit]', | 
            
                                                                        
                            
            
                                    
            
            
                | 699 |  |  |                                 'name'             => 'wpinv_variable_prices[' . $key . '][recurring-limit]', | 
            
                                                                        
                            
            
                                    
            
            
                | 700 |  |  |                                 'value'            => esc_attr( $args['recurring-limit'] ), | 
            
                                                                        
                            
            
                                    
            
            
                | 701 |  |  |                                 'class'            => 'form-control-sm', | 
            
                                                                        
                            
            
                                    
            
            
                | 702 |  |  |                                 'no_wrap'          => true, | 
            
                                                                        
                            
            
                                    
            
            
                | 703 |  |  |                                 'extra_attributes' => array_merge( | 
            
                                                                        
                            
            
                                    
            
            
                | 704 |  |  |                                     $extra_attributes, | 
            
                                                                        
                            
            
                                    
            
            
                | 705 |  |  |                                     array( 'size' => 4 ) | 
            
                                                                        
                            
            
                                    
            
            
                | 706 |  |  |                                 ), | 
            
                                                                        
                            
            
                                    
            
            
                | 707 |  |  | 							), | 
            
                                                                        
                            
            
                                    
            
            
                | 708 |  |  |                             true | 
            
                                                                        
                            
            
                                    
            
            
                | 709 |  |  |                         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 710 |  |  |                         ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 711 |  |  |                     </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 712 |  |  |                 </div> | 
            
                                                                        
                            
            
                                    
            
            
                | 713 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 714 |  |  |                 <?php do_action( 'wpinv_download_price_option_row', $item->ID, $key, $args ); ?> | 
            
                                                                        
                            
            
                                    
            
            
                | 715 |  |  |             </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 716 |  |  |         </div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 717 |  |  |     <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 718 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 719 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 720 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 721 |  |  |      * Save meta box data. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 722 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 723 |  |  |      * @param int $post_id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 724 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 725 |  |  |     public static function save( $post_id ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 726 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 727 |  |  |         // Prepare the item. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 728 |  |  |         $item = new WPInv_Item( $post_id ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 729 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 730 |  |  |         $is_dynamic_pricing = ! empty( $_POST['wpinv_name_your_price'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 731 |  |  |         $is_recurring = ! empty( $_POST['wpinv_is_recurring'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 732 |  |  |         $is_free_trial = isset( $_POST['wpinv_trial_interval'] ) ? (0 != (int) $_POST['wpinv_trial_interval']) : null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 733 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 734 |  |  |         $has_variable_pricing = ! empty( $_POST['wpinv_variable_pricing'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 735 |  |  |         if ( true === $has_variable_pricing ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 736 |  |  |             $is_dynamic_pricing = $is_recurring = $is_free_trial = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 737 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 738 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 739 |  |  |         // Load new data. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 740 |  |  |         $item->set_props( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 741 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 742 |  |  |                 'price'                => isset( $_POST['wpinv_item_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_item_price'] ) : null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 743 |  |  |                 'vat_rule'             => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 744 |  |  |                 'vat_class'            => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 745 |  |  |                 'type'                 => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 746 |  |  |                 'is_dynamic_pricing'   => $is_dynamic_pricing, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 747 |  |  |                 'minimum_price'        => isset( $_POST['wpinv_minimum_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_minimum_price'] ) : null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 748 |  |  |                 'has_variable_pricing' => $has_variable_pricing, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 749 |  |  |                 'default_price_id'     => isset( $_POST['_wpinv_default_price_id'] ) ? absint( $_POST['_wpinv_default_price_id'] ) : null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 750 |  |  |                 'variable_prices'      => isset( $_POST['wpinv_variable_prices'] ) ? wpinv_clean( $_POST['wpinv_variable_prices'] ) : array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 751 |  |  |                 'is_recurring'         => $is_recurring, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 752 |  |  |                 'recurring_period'     => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 753 |  |  |                 'recurring_interval'   => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 754 |  |  |                 'recurring_limit'      => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 755 |  |  |                 'is_free_trial'        => $is_free_trial, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 756 |  |  |                 'trial_period'         => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 757 |  |  |                 'trial_interval'       => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 758 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 759 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 760 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 761 |  |  |         $item->save(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 762 |  |  |         do_action( 'getpaid_item_metabox_save', $post_id, $item ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 763 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 764 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 765 |  |  |  |