The Status Validation Logic

This code snippet checks if a charity’s status is either approved or expired and ensures that a purpose is provided. If the purpose is missing and the category is not one of the specified types, it triggers an alert dialog. The dialog prompts the user to enter a value for the “Primary Charity Purpose.” If the user confirms, a success message is logged; otherwise, a failure message is displayed. If all conditions are met, the function returns true, allowing the process to continue smoothly.

  if ((charityStatus == APPROVED_ACTIVE || charityStatus == EXPIRED_ACTIVE) && !checkForParameter(charityPurpose) && (category != OTHER_VENDORS && category != TAX_AGENCY && category != CONTRACTOR && category != CONSULTANT)) {
                        function success(result) {
                            console.log('Success with value: ' + result)
                        }
                        function failure(reason) {
                            console.log('Failure: ' + reason)
                        }
                        dialog.alert({
                            title: 'Alert',
                            message: 'Please enter value for: Primary Charity Purpose.'
                        }).then(success).catch(failure);
                    } else {
                        return true;
                    }

Leave a comment

Your email address will not be published. Required fields are marked *