Plugin Directory

Changeset 3385174


Ignore:
Timestamp:
10/27/2025 11:15:04 AM (5 months ago)
Author:
worldweb
Message:

2.1.0 (October 27, 2025)

  • Add: Ability to reorder Repayment Frequency options
Location:
loan-calculator-wp
Files:
70 added
11 edited

Legend:

Unmodified
Added
Removed
  • loan-calculator-wp/trunk/includes/admin/forms/theme-templates/new-theme/css/style.css

    r3327581 r3385174  
    24652465    display: none;
    24662466}
     2467select.single-val-option {
     2468    appearance: none;
     2469    pointer-events: none;
     2470    padding: 10px;
     2471}
    24672472
    24682473/****************************************************/
  • loan-calculator-wp/trunk/includes/admin/forms/theme-templates/new-theme/ww-loan-calculator-loan-new-theme-form.php

    r3245518 r3385174  
    414414                                        <div class="input-container">
    415415                                            <?php $backgroud_arrow_logo = WW_LOAN_CALCULATOR_URL.'includes/images/down-arrow.svg'; ?>
    416                                             <style type="text/css"> .site-wrap-repayment-freq-section:after {background-image: url(<?php echo esc_attr($backgroud_arrow_logo); ?>); } </style>
     416                                            <style type="text/css">
     417                                            .site-wrap-repayment-freq-section:after {background-image: url(<?php echo esc_attr($backgroud_arrow_logo); ?>); }
     418                                            .site-wrap-repayment-freq-section.single-val-option-main:after {background-image: none; }
     419                                            </style>
    417420                                            <?php if (!empty($get_repayment_frequency)) {
    418421                                                $rpfclass = (count($get_repayment_frequency) == 1 ? 'single-val-option' : '');
     422                                                $rpfmainclass = (count($get_repayment_frequency) == 1 ? 'single-val-option-main' : '');
    419423                                                ?>
    420                                                 <div class="site-wrap-repayment-freq-section">
     424                                                <div class="site-wrap-repayment-freq-section <?php echo esc_attr($rpfmainclass); ?>">
    421425                                                    <select name="repayment_freq" id="repayment_freq" class="payment-opt-drop <?php echo esc_attr($rpfclass); ?>">
    422426                                                        <?php
  • loan-calculator-wp/trunk/includes/admin/forms/ww-loan-calculator-setting.php

    r3245518 r3385174  
    431431                    </th>
    432432                    <td>
    433                         <input type="checkbox" name="ww_loan_option[repayment_frequency][]" id="repayment_frequency_option_monthly" value="Monthly" class="regular-text" <?php echo ((!empty($get_repayment_frequency) && in_array('Monthly', $get_repayment_frequency)) ? "checked" : ""); ?>><label for="repayment_frequency_option_monthly"><?php esc_html_e('Monthly', 'loan-calculator-wp'); ?></label>
    434                         &nbsp;|&nbsp;
    435                         <input type="checkbox" name="ww_loan_option[repayment_frequency][]" id="repayment_frequency_option_quarterly" value="Quarterly" class="regular-text" <?php echo ((!empty($get_repayment_frequency) && in_array('Quarterly', $get_repayment_frequency)) ? "checked" : ""); ?>><label for="repayment_frequency_option_quarterly"><?php esc_html_e('Quarterly', 'loan-calculator-wp'); ?></label>
    436                         &nbsp;|&nbsp;
    437                         <input type="checkbox" name="ww_loan_option[repayment_frequency][]" id="repayment_frequency_option_yearly" value="Yearly" class="regular-text" <?php echo ((!empty($get_repayment_frequency) && in_array('Yearly', $get_repayment_frequency)) ? "checked" : ""); ?>><label for="repayment_frequency_option_yearly"><?php esc_html_e('Yearly', 'loan-calculator-wp'); ?></label>
    438                         &nbsp;|&nbsp;
    439                         <input type="checkbox" name="ww_loan_option[repayment_frequency][]" id="repayment_frequency_option_weekly" value="Weekly" class="regular-text" <?php echo ((!empty($get_repayment_frequency) && in_array('Weekly', $get_repayment_frequency)) ? "checked" : ""); ?>><label for="repayment_frequency_option_weekly"><?php esc_html_e('Weekly', 'loan-calculator-wp'); ?></label>
    440                          &nbsp;|&nbsp;
    441                         <input type="checkbox" name="ww_loan_option[repayment_frequency][]" id="repayment_frequency_option_fortnight" value="Fortnight" class="regular-text" <?php echo ((!empty($get_repayment_frequency) && in_array('Fortnight', $get_repayment_frequency)) ? "checked" : ""); ?>><label for="repayment_frequency_option_fortnight"><?php esc_html_e('Fortnightly', 'loan-calculator-wp'); ?></label>
    442                         </br>
    443                         </br>
    444                         <i><b style="color:red"><?php esc_html_e('Note', 'loan-calculator-wp') ?></b><?php esc_attr_e(": If no Repayment Frequency Options are selected, the monthly option will be automatically displayed on the frontend by default.", 'loan-calculator-wp') ?></i>
     433                        <?php
     434                        $frequencies = [
     435                            'Monthly'   => __('Monthly', 'loan-calculator-wp'),
     436                            'Yearly'    => __('Yearly', 'loan-calculator-wp'),
     437                            'Quarterly' => __('Quarterly', 'loan-calculator-wp'),
     438                            'Fortnight' => __('Fortnightly', 'loan-calculator-wp'),
     439                            'Weekly'    => __('Weekly', 'loan-calculator-wp'),
     440                        ];
     441
     442                        // Get saved selected repayment frequencies in order
     443                        $saved_selection = $get_repayment_frequency ?? []; // e.g. ['Yearly', 'Monthly']
     444
     445                        // Ensure default if nothing selected
     446                        if (empty($saved_selection)) {
     447                            $saved_selection = ['Monthly'];
     448                        }
     449
     450                        $selected_items = array_values(array_filter($saved_selection, function ($key) use ($saved_selection) {
     451                            return in_array($key, $saved_selection);
     452                        }));
     453
     454                        // Get unselected options
     455                        $default_order = array_keys($frequencies);
     456                        $unselected_items = array_diff($default_order, $selected_items);
     457
     458                    ?>
     459                            <div class="sortable-container">
     460                                <!-- Unselected + Not Sortable -->
     461                                <div class="sortable-wrapper">
     462                                    <h4><?php esc_html_e('Disabled Options', 'loan-calculator-wp'); ?></h4>
     463                                    <ul id="sortable-disabled" class="sortable-list disabled-options">
     464                                        <?php foreach ($unselected_items as $key): ?>
     465                                            <li data-key="<?= esc_attr($key); ?>">
     466                                                <label>
     467                                                    <input type="checkbox"
     468                                                           name="ww_loan_option[repayment_frequency][]"
     469                                                           value="<?= esc_attr($key); ?>" class="toggle-repayment">
     470                                                    <?= esc_html($frequencies[$key]); ?>
     471                                                </label>
     472                                            </li>
     473                                        <?php endforeach; ?>
     474                                    </ul>
     475                                </div>
     476
     477                                <!-- Selected + Sortable -->
     478                                <div class="sortable-wrapper">
     479                                    <h4><?php esc_html_e('Enabled Options ( Drag to Reorder )', 'loan-calculator-wp'); ?></h4>
     480                                    <ul id="sortable-enabled" class="sortable-list enabled-options">
     481                                        <?php foreach ($selected_items as $key): ?>
     482                                           <li data-key="<?= esc_attr($key); ?>">
     483                                                <span class="drag-handle" title="<?php esc_attr_e('Drag to reorder', 'loan-calculator-wp'); ?>">⋮⋮</span>
     484                                                <label>
     485                                                    <input type="checkbox" checked
     486                                                           name="ww_loan_option[repayment_frequency][]"
     487                                                           value="<?= esc_attr($key); ?>" class="toggle-repayment">
     488                                                    <?= esc_html($frequencies[$key]); ?>
     489                                                </label>
     490                                            </li>
     491
     492                                        <?php endforeach; ?>
     493                                    </ul>
     494                                </div>
     495                            </div>
     496
     497                        <p><i><b style="color:red"><?php esc_html_e('Note', 'loan-calculator-wp'); ?></b> <?php esc_html_e('If no Repayment Frequency Options are selected, the monthly option will be automatically displayed on the frontend by default.', 'loan-calculator-wp'); ?></i></p>
    445498                    </td>
    446499                </tr>
  • loan-calculator-wp/trunk/includes/class-ww-loan-calculator-scripts.php

    r3245518 r3385174  
    3232                true
    3333            );
     34
     35            // add jquery UI for Repayment Frequency drag & drop ability
     36            wp_enqueue_script('jquery-ui-sortable');
    3437
    3538            // Add JS
  • loan-calculator-wp/trunk/includes/css/frontend-style.css

    r3327581 r3385174  
    430430    background-color: var(--calc-bg-light-color) !important;
    431431
    432     height: 34px !important;
     432    height: 36px !important;
    433433
    434434    line-height: 34px;
     
    448448    font-size: 14px !important;
    449449
    450     padding: 4px 0px 5px 3px !important;
     450    padding: 5px 0px 5px 5px !important;
    451451
    452452    text-align: left !important;
  • loan-calculator-wp/trunk/includes/css/loan_calculator_admin_settings.css

    r3245518 r3385174  
    2020
    2121
     22/* Start css for Repayment Frequency */
     23.sortable-container {
     24    display: flex;
     25    gap: 20px;
     26    flex-wrap: wrap;
     27}
    2228
     29.sortable-wrapper {
     30    flex: 1;
     31    min-width: 250px;
     32}
     33
     34.sortable-wrapper h4 {
     35    font-size: 14px;
     36    margin: 8px 0 8px 0;
     37   
     38}
     39
     40.sortable-list {
     41    list-style: none;
     42    margin: 0;
     43    padding: 0;
     44    background: #f9f9f9;
     45    border: 1px solid #ccc;
     46    min-height: 40px;
     47}
     48
     49.sortable-list li {
     50    padding: 10px;
     51    border-bottom: 1px solid #ddd;
     52    background: #fff;
     53    display: flex;
     54    align-items: center;
     55}
     56
     57.sortable-list li:last-child {
     58    border-bottom: none;
     59}
     60
     61.sortable-list input[type="checkbox"] {
     62    margin-right: 10px;
     63}
     64
     65.disabled-options li {
     66    cursor: default;
     67    opacity: 0.8;
     68}
     69
     70.enabled-options li {
     71    cursor: move;
     72}
     73.drag-handle {
     74    cursor: move;
     75    margin-right: 10px;
     76    font-size: 18px;
     77    color: #888;
     78    user-select: none; /* prevent text selection on drag */
     79}
     80
     81
     82/* end css for Repayment Frequency */
     83
     84
  • loan-calculator-wp/trunk/includes/js/admin-script.js

    r3245518 r3385174  
    842842
    843843
     844    /* Start Drag and drop ability js for Repayment Frequency options */
     845    function updateOrderField() {
     846        var selectedKeys = jQuery('#sortable-enabled li').map(function() {
     847            return jQuery(this).data('key');
     848        }).get();
     849        jQuery('#repayment_frequency_order').val(selectedKeys.join(','));
     850    }
     851
     852                    // Init sortable with drag handle
     853    jQuery('#sortable-enabled').sortable({
     854        handle: '.drag-handle',
     855        update: updateOrderField
     856    });
     857
     858                    // When checkbox toggled
     859    jQuery('.toggle-repayment').on('change', function() {
     860        var li = jQuery(this).closest('li');
     861
     862        if (this.checked) {
     863                            // Add drag handle span if missing
     864            if (li.find('.drag-handle').length === 0) {
     865                li.prepend('<span class=\"drag-handle\" title=\"Drag to reorder\">⋮⋮</span>');
     866            }
     867            li.css('cursor', 'auto');
     868            jQuery('#sortable-enabled').append(li);
     869        } else {
     870                            // Remove drag handle
     871            li.find('.drag-handle').remove();
     872            li.css('cursor', 'default');
     873            jQuery('#sortable-disabled').append(li);
     874        }
     875        updateOrderField();
     876    });
     877
     878                    // Set initial cursor & drag handle states
     879    jQuery('#sortable-disabled li').css('cursor', 'default').find('.drag-handle').remove();
     880    jQuery('#sortable-enabled li').css('cursor', 'auto').each(function() {
     881        if (jQuery(this).find('.drag-handle').length === 0) {
     882            jQuery(this).prepend('<span class=\"drag-handle\" title=\"Drag to reorder\">⋮⋮</span>');
     883        }
     884    });
     885
     886    updateOrderField();
     887    /* End Drag and drop ability js for Repayment Frequency options */
     888
    844889
    845890});
  • loan-calculator-wp/trunk/includes/js/frequency_payment.js

    r3292676 r3385174  
    217217    } 
    218218
    219     /* 2025-05-13 */
    220219    return monthlyInterestAmount;
    221220
  • loan-calculator-wp/trunk/includes/js/frontend-script.js

    r3292676 r3385174  
    2020    //Condition For New theme
    2121    function loan_calculation_process() {
    22      var currency_symbol = setting_data.currency_symbols;
     22      var currency_symbol = setting_data.currency_symbols;
     23
     24      var default_nop_value = jQuery("input[name='loan_terms']").val();
     25      /* visible note below chart */
     26      if(default_nop_value > 120){
     27        jQuery('body').find('.chart-note').show();
     28      }else{
     29        jQuery('body').find('.chart-note').hide();
     30      }
     31
    2332     var loan_amount = jQuery("#loan_amount").val();     
    2433
     
    19671976
    19681977jQuery("#loan_terms").on("blur", function () {
    1969     /*on filled input check min max values 6-7-2023*/
     1978    /*on filled input check min max values*/
    19701979  var repayment_freq = jQuery("#repayment_freq option:selected").val();
    19711980  var old_repayment_freq = jQuery(
     
    24522461    });
    24532462    $(document).on("input", "#repayment_freq", function () {
    2454     /*========start 6-7-2023=========*/
    24552463      var repayment_freq = jQuery("#repayment_freq option:selected").val();
    24562464      var old_repayment_freq = jQuery(
     
    25112519      setting_data.back_ground_color +
    25122520      " 100%)";
    2513 
    2514     /*========End 6-7-2023=========*/
    25152521      loan_calculation_process();
    25162522    });
     
    28302836      repayment_frequency_val
    28312837      ); 
    2832     /* 2025-05-13 */
     2838   
    28332839    var default_nop_value = jQuery("input[name='loan_terms']").val();
    28342840    /* visible note below chart */
     
    47614767
    47624768jQuery("#loan_terms").on("blur", function () { 
    4763     /*on filled input check min max values 6-7-2023*/
     4769    /*on filled input check min max values */
    47644770  var repayment_freq = jQuery("#repayment_freq option:selected").val();
    47654771  var old_repayment_freq = jQuery(
     
    53705376
    53715377$(document).on("input", "#repayment_freq", function () {
    5372     /*========start 6-7-2023=========*/
     5378
    53735379  var repayment_freq = jQuery("#repayment_freq option:selected").val();
    53745380
     
    54355441  "%,  #c9a208 100%)";
    54365442
    5437     /*========End 6-7-2023=========*/
    54385443  loan_calculation_process();
    54395444});
  • loan-calculator-wp/trunk/loan-calculator-wp.php

    r3327581 r3385174  
    44 * Plugin URI: https://www.worldwebtechnology.com/
    55 * Description: Advanced Loan Calculator for Home Loans, Personal Loans, and various other types of loans. Includes features like a repayment chart, amortization table, video tab, balloon payment option, and supports all currencies. Use the contact form shortcode for easy access.
    6  * Version: 2.0.3
     6 * Version: 2.1.0
    77 * Author: World Web Technology
    88 * Author URI: https://www.worldwebtechnology.com/
     
    2727 */
    2828if (!defined('WW_LOAN_CALCULATOR_VERSION')) {
    29     define('WW_LOAN_CALCULATOR_VERSION', '2.0.3'); //version of plugin
     29    define('WW_LOAN_CALCULATOR_VERSION', '2.1.0'); //version of plugin
    3030}
    3131if (!defined('WW_LOAN_CALCULATOR_TEXT_DOMAIN')) { //check if variable is not defined previous then define it
  • loan-calculator-wp/trunk/readme.txt

    r3327581 r3385174  
    1010Requires PHP:      7.4
    1111Tested up to:      6.8
    12 Stable tag:        2.0.3
     12Stable tag:        2.1.0
    1313License:           GPLv2 or later
    1414License URI:       https://www.gnu.org/licenses/gpl-2.0.html
    15 Version:           2.0.3
     15Version:           2.1.0
    1616
    1717Loan / EMI Calculator for Home Loan and Personal Loan
     
    129129== Changelog ==
    130130
     131= 2.1.0 (October 27, 2025) =
     132* Add: Ability to reorder Repayment Frequency options
     133
    131134= 2.0.3 (July 14, 2025) =
    132135* Fix: Browser compatibility issue with field slider input
Note: See TracChangeset for help on using the changeset viewer.