admin_url( 'admin-ajax.php' ), 'currency' => esc_attr( $currency ), 'deposit_color' => $deposit_color, ] ); $max_price = (int) ( $property && $property->get_price() ) ? $property->get_price() : opalestate_options( 'search_max_price', 10000000 ); $max_price = str_replace( [ ",", "." ], "", $max_price ); $start_price = apply_filters( 'opalestate_mortgage_start_price', $max_price ); $max_price = apply_filters( 'opalestate_mortgage_max_price', $max_price + ( $max_price * 20 / 100 ) ); $rate_start = apply_filters( 'opalestate_mortgage_rate_start', 10 ); $interest_rate_start = $rate_start / 100; $years_start = apply_filters( 'opalestate_mortgage_years_start', 2 ); $deposit_start = apply_filters( 'opalestate_mortgage_deposit_start', $max_price / 2 ); $loan_amount = $start_price - $deposit_start; $interest_rate_month = $interest_rate_start / 12; $number_of_payments_month = $years_start * 12; $monthly = round( ( $loan_amount * $interest_rate_month ) / ( 1 - pow( 1 + $interest_rate_month, -$number_of_payments_month ) ), 2 ); $total = $deposit_start + ( $monthly * $number_of_payments_month ); $price_percent = $loan_amount / $total * 100; $deposit_percent = $deposit_start / $total * 100; $data_sale_price = [ 'id' => 'sale_price', 'decimals' => opalestate_get_price_decimals(), 'unit' => $currency, 'ranger_min' => 0, 'ranger_max' => $max_price, 'input_min' => 0, 'input_max' => $max_price, 'mode' => 1, 'start' => $start_price, ]; $data_deposit = [ 'id' => 'deposit', 'decimals' => opalestate_get_price_decimals(), 'unit' => $currency, 'ranger_min' => 0, 'ranger_max' => $max_price, 'input_min' => 0, 'input_max' => $max_price, 'mode' => 1, 'start' => $deposit_start, ]; $data_interest_rate = [ 'id' => 'interest_rate', 'decimals' => 2, 'unit' => '%', 'ranger_min' => 0, 'ranger_max' => 100, 'input_min' => 0, 'input_max' => 100, 'mode' => 1, 'start' => $rate_start, 'step' => 0.05, ]; $data_years = [ 'id' => 'years', 'decimals' => 1, 'ranger_min' => 0, 'ranger_max' => 30, 'input_min' => 0, 'input_max' => 30, 'mode' => 1, 'start' => $years_start, 'step' => 0.5, ]; if ( opalestate_options( 'currency_position', 'before' ) === 'before' ) { $data_sale_price['unit_position'] = 'prefix'; $data_deposit['unit_position'] = 'prefix'; } ?>

/