1
0

main.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Copyright (c) UNA, Inc - https://una.io
  3. * MIT License - https://opensource.org/licenses/MIT
  4. *
  5. * @defgroup Donations Donations
  6. * @ingroup UnaModules
  7. *
  8. * @{
  9. */
  10. function BxDonationsMain(oOptions) {
  11. this._sActionsUri = oOptions.sActionUri;
  12. this._sActionsUrl = oOptions.sActionUrl;
  13. this._sObjName = oOptions.sObjName == undefined ? 'oBxDonationsMain' : oOptions.sObjName;
  14. this._iOwnerId = oOptions.iOwnerId == undefined ? 0 : oOptions.iOwnerId;
  15. this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'slide' : oOptions.sAnimationEffect;
  16. this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
  17. this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
  18. this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
  19. }
  20. BxDonationsMain.prototype.changeType = function(oLink, sType) {
  21. var sClsMi = 'bx-menu-item';
  22. var sClsMa = 'bx-menu-tab-active';
  23. var sClsCi = 'bx-dnt-make-billing-type';
  24. var sClsCa = 'active';
  25. $(oLink).parents('.' + sClsMi + ':first').toggleClass(sClsMa, true).siblings('.' + sClsMi + '.' + sClsMa).toggleClass(sClsMa, false);
  26. $(oLink).parents('.bx-dnt-make:first').find('.' + sClsCi + '.' + sType).toggleClass(sClsCa, true).siblings('.' + sClsCi + '.' + sClsCa).toggleClass(sClsCa, false);
  27. };
  28. BxDonationsMain.prototype.other = function(oLink, sBillingType) {
  29. var $this = this;
  30. var fOnOk = function(oPopup) {
  31. var oParams = jQuery.extend({}, $this._getDefaultParams(), {
  32. btype: sBillingType,
  33. amount: $(oPopup).find("input[type = 'text']").val()
  34. });
  35. $.get(
  36. $this._sActionsUrl + 'make_other/',
  37. oParams,
  38. function(oData){
  39. processJsonData(oData);
  40. },
  41. 'json'
  42. );
  43. };
  44. bx_prompt('', '', fOnOk);
  45. };
  46. BxDonationsMain.prototype._getDefaultParams = function() {
  47. var oDate = new Date();
  48. return {_t:oDate.getTime()};
  49. };
  50. /** @} */