Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove date and time validations #3672

Merged
merged 8 commits into from
Nov 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 1 addition & 46 deletions app/components/forms/events/view/create-discount-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { computed } from '@ember/object';
import FormMixin from 'open-event-frontend/mixins/form';
import { later } from '@ember/runloop';
import { currencySymbol } from 'open-event-frontend/helpers/currency-symbol';
import moment from 'moment';
export default Component.extend(FormMixin, {
getValidationRules() {
window.$.fn.form.settings.rules.checkMaxMin = () => {
Expand All @@ -22,11 +21,7 @@ export default Component.extend(FormMixin, {
return false;
};

window.$.fn.form.settings.rules.checkDates = () => {
let startDatetime = moment(this.get('data.validFrom'));
let endDatetime = moment(this.get('data.validTill'));
return (endDatetime.diff(startDatetime, 'minutes') > 0);
};
// TODO: Removing the Discount Code Time Validations due to the weird and buggy behaviour. Will be restored once a perfect solution is found. Please check issue: https://github.com/fossasia/open-event-frontend/issues/3667
return {
inline : true,
delay : false,
Expand Down Expand Up @@ -113,46 +108,6 @@ export default Component.extend(FormMixin, {
prompt : this.l10n.t('Please select atleast 1 ticket.')
}
]
},
startDate: {
optional : true,
identifier : 'start_date',
rules : [
{
type : 'checkDates',
prompt : this.l10n.t('Valid Till date & time should be after valid from date and time')
}
]
},
startTime: {
optional : true,
identifier : 'start_time',
rules : [
{
type : 'checkDates',
prompt : '.'
}
]
},
endDate: {
optional : true,
identifier : 'end_date',
rules : [
{
type : 'checkDates',
prompt : this.l10n.t('Valid Till date & time should be after valid from date and time')
}
]
},
endTime: {
optional : true,
identifier : 'end_time',
rules : [
{
type : 'checkDates',
prompt : '.'
}
]
}
}
};
Expand Down
22 changes: 1 addition & 21 deletions app/components/forms/wizard/basic-details-step.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,8 @@ export default Component.extend(FormMixin, EventWizardMixin, {
}
},

// TODO: Removing the Event Time Validations due to the weird and buggy behaviour. Will be restored once a perfect solution is found. Please check issue: https://github.com/fossasia/open-event-frontend/issues/3667
getValidationRules() {
window.$.fn.form.settings.rules.checkDates = () => {
let startDatetime = moment(this.get('data.event.startsAt'));
let endDatetime = moment(this.get('data.event.endsAt'));
return (endDatetime.diff(startDatetime, 'minutes') > 0);
};

let validationRules = {
inline : true,
Expand Down Expand Up @@ -165,10 +161,6 @@ export default Component.extend(FormMixin, EventWizardMixin, {
{
type : 'date',
prompt : this.l10n.t('Please give a valid start date')
},
{
type : 'checkDates',
prompt : this.l10n.t('Start date & time should be before End date and time')
}
]
},
Expand All @@ -182,10 +174,6 @@ export default Component.extend(FormMixin, EventWizardMixin, {
{
type : 'date',
prompt : this.l10n.t('Please give a valid end date')
},
{
type : 'checkDates',
prompt : this.l10n.t('Start date & time should be before End date and time')
}
]
},
Expand All @@ -196,10 +184,6 @@ export default Component.extend(FormMixin, EventWizardMixin, {
{
type : 'empty',
prompt : this.l10n.t('Please give a start time')
},
{
type : 'checkDates',
prompt : '..'
}
]
},
Expand All @@ -210,10 +194,6 @@ export default Component.extend(FormMixin, EventWizardMixin, {
{
type : 'empty',
prompt : this.l10n.t('Please give an end time')
},
{
type : 'checkDates',
prompt : '..'
}
]
},
Expand Down
23 changes: 1 addition & 22 deletions app/components/forms/wizard/sessions-speakers-step.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@ import { computed } from '@ember/object';
import FormMixin from 'open-event-frontend/mixins/form';
import EventWizardMixin from 'open-event-frontend/mixins/event-wizard';
import { groupBy } from 'lodash-es';
import moment from 'moment';

export default Component.extend(EventWizardMixin, FormMixin, {

// TODO: Removing the Session & Speaker Time Validations due to the weird and buggy behaviour. Will be restored once a perfect solution is found. Please check issue: https://github.com/fossasia/open-event-frontend/issues/3667
getValidationRules() {
window.$.fn.form.settings.rules.checkDates = () => {
let startDatetime = moment(this.get('data.speakersCall.startsAt'));
let endDatetime = moment(this.get('data.speakersCall.endsAt'));
return (endDatetime.diff(startDatetime, 'minutes') > 0);
};
return {
inline : true,
delay : false,
Expand Down Expand Up @@ -60,10 +55,6 @@ export default Component.extend(EventWizardMixin, FormMixin, {
{
type : 'empty',
prompt : this.l10n.t('Please tell us when your event starts')
},
{
type : 'checkDates',
prompt : this.l10n.t('Start date & time ')
}
]
},
Expand All @@ -73,10 +64,6 @@ export default Component.extend(EventWizardMixin, FormMixin, {
{
type : 'empty',
prompt : this.l10n.t('Please tell us when your event ends')
},
{
type : 'checkDates',
prompt : this.l10n.t('Start date & time should be after End date and time')
}
]
},
Expand All @@ -87,10 +74,6 @@ export default Component.extend(EventWizardMixin, FormMixin, {
{
type : 'empty',
prompt : this.l10n.t('Please give a start time')
},
{
type : 'checkDates',
prompt : '.'
}
]
},
Expand All @@ -101,10 +84,6 @@ export default Component.extend(EventWizardMixin, FormMixin, {
{
type : 'empty',
prompt : this.l10n.t('Please give an end time')
},
{
type : 'checkDates',
prompt : '.'
}
]
}
Expand Down