compucorp / uk.co.compucorp.membershipextras

Membership Extras for CiviCRM
Other
5 stars 8 forks source link

MAE-517: Fix schedule instalment display on non payment plan tab #374

Closed erawat closed 3 years ago

erawat commented 3 years ago

Overview

This PR fixes the issue when select membership type then instalments schedule table is shown on the non payment plan tab (contribution).

Before

Instalment Schedule displays on the contribution tab.

01a70289-0574-4be4-bc50-3949e66d9f84

After

Instalment Schedule displays ONLY when select payment plan tab.

Peek 2021-03-30 11-38

Technical Details

Since we refactored the code and separate the javascript to the different file in this PR.

The constant variables that requires to exist when smart template is completed have not been passed to the javascript in the separate file because they are the indifferent scope therefore, the screen are not working correctly

How this was addressed?

In order to maintain the javascript logic from the smart template and javascript logic relies on the constant values on the template, we would need to put the function in jquery anonymous function inside the global scope function so it can be called from anywhere.

Alternatively, we could define a namespace to reduce risk of name collisions instead of using a global scope function but in this case, we are less likely to run into any issue as this function will only be used for payment toggler screen.