main.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /**
  2. * Copyright (c) UNA, Inc - https://una.io
  3. * MIT License - https://opensource.org/licenses/MIT
  4. *
  5. * @defgroup Events Events
  6. * @ingroup UnaModules
  7. *
  8. * @{
  9. */
  10. function BxEventsMain(oOptions) {
  11. BxBaseModGroupsMain.call(this, oOptions);
  12. this._sObjName = oOptions.sObjName == undefined ? 'oBxEventsMain' : oOptions.sObjName;
  13. this._oBrowsingFiltersPopupOptionsDefaults = jQuery.extend(this._oBrowsingFiltersPopupOptionsDefaults, {
  14. onShow: function(oPopup) {
  15. var oTimezone = $(oPopup).find("[name = 'timezone']");
  16. if(oTimezone && oTimezone.length != 0)
  17. oTimezone.val(moment.tz.guess());
  18. $(oPopup).find("[name = 'cancel']").focus();
  19. }
  20. });
  21. }
  22. BxEventsMain.prototype = Object.create(BxBaseModGroupsMain.prototype);
  23. BxEventsMain.prototype.constructor = BxEventsMain;
  24. BxEventsMain.prototype.onChangeBrowsingFiltersByDate = function(oElement) {
  25. var sAction = $(oElement).val() == 'date_range' ? 'show' : 'hide';
  26. $(oElement).parents('.bx-form-element-wrapper:first').siblings('.date-range').each(function() {
  27. $(this).bx_anim(sAction);
  28. });
  29. };
  30. BxEventsMain.prototype.applyBrowsingFilter = function(oElement, oRequestParams)
  31. {
  32. var oFilters = $(oElement).parents('.bx-base-general-browsing-filters:first');
  33. if(oRequestParams == undefined)
  34. oRequestParams = {};
  35. oRequestParams.by_location_country = oFilters.find("[name='by_location_country']").val();
  36. oRequestParams.by_location_state = oFilters.find("input[name='by_location_state']").val();
  37. oRequestParams.by_location_city = oFilters.find("input[name='by_location_city']").val();
  38. oRequestParams.by_date = oFilters.find("input[name='by_date']:checked").val();
  39. if(oRequestParams.by_date == 'date_range') {
  40. oRequestParams.date_start = oFilters.find("input[name='date_start']").val();
  41. oRequestParams.date_end = oFilters.find("input[name='date_end']").val();
  42. }
  43. oRequestParams.timezone = oFilters.find("input[name='timezone']").val();
  44. BxBaseModGroupsMain.prototype.applyBrowsingFilter.call(this, oElement, oRequestParams);
  45. };
  46. /** @} */