custom_date_popup.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. module.exports = Em.Object.create({
  20. startTime: null,
  21. endTime: null,
  22. customDuration: null,
  23. showCustomDatePopup: function (primary, secondary, defaults) {
  24. var self = this;
  25. defaults = defaults || {
  26. startDate: null,
  27. hoursForStart: null,
  28. minutesForStart: null,
  29. middayPeriodForStart: null,
  30. duration: null,
  31. endDate: null,
  32. hoursForEnd: null,
  33. minutesForEnd: null,
  34. middayPeriodForEnd: null
  35. };
  36. return App.ModalPopup.show({
  37. header: Em.I18n.t('jobs.table.custom.date.header'),
  38. onPrimary: function () {
  39. if (primary) {
  40. primary();
  41. }
  42. this._super();
  43. },
  44. onSecondary: function () {
  45. if (secondary) {
  46. secondary();
  47. }
  48. this._super();
  49. },
  50. onClose: function () {
  51. if (secondary) {
  52. secondary();
  53. }
  54. this._super();
  55. },
  56. disablePrimary: false,
  57. bodyClass: App.JobsCustomDatesSelectView.extend({
  58. controller: self,
  59. customDateFormFields: Em.Object.create(defaults)
  60. })
  61. });
  62. }
  63. });