Skip to content
Open
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
56 changes: 38 additions & 18 deletions src/components/forms/selection-plan-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class SelectionPlanForm extends React.Component {
showSection: "main",
newMemberEmail: "",
showImportModal: false,
importFile: null
importFile: null,
selectedTimezone: props.currentSummit.time_zone_id
};

this.handleTrackGroupLink = this.handleTrackGroupLink.bind(this);
Expand Down Expand Up @@ -144,6 +145,7 @@ class SelectionPlanForm extends React.Component {
if (!shallowEqual(prevProps.entity, this.props.entity)) {
state.entity = { ...this.props.entity };
state.errors = {};
state.selectedTimezone = this.props.currentSummit.time_zone_id;
}

if (!shallowEqual(prevProps.errors, this.props.errors)) {
Expand Down Expand Up @@ -314,16 +316,20 @@ class SelectionPlanForm extends React.Component {
}

render() {
const { entity, showSection, newMemberEmail, showImportModal } = this.state;
const { entity, showSection, newMemberEmail, showImportModal, selectedTimezone } =
this.state;
const {
currentSummit,
timezones,
extraQuestionsOrderDir,
extraQuestionsOrder,
actionTypesOrderDir,
actionTypesOrder,
allowedMembers
} = this.props;

const timezoneDdl = (timezones || []).map((tz) => ({ label: tz, value: tz }));

const trackGroupsColumns = [
{ columnKey: "name", value: T.translate("edit_selection_plan.name") },
{
Expand Down Expand Up @@ -428,8 +434,6 @@ class SelectionPlanForm extends React.Component {
}
};

console.log("CHECK...", entity, currentSummit);

return (
<form className="selection-plan-form">
<input type="hidden" id="id" value={entity.id} />
Expand Down Expand Up @@ -508,6 +512,22 @@ class SelectionPlanForm extends React.Component {
</div>
</div>

<div className="row form-group">
<div className="col-md-12">
<label>
{T.translate("edit_selection_plan.time_zone_for_dates")}
</label>
<Dropdown
id="selectedTimezone"
value={selectedTimezone}
onChange={(ev) =>
this.setState({ selectedTimezone: ev.target.value })
}
options={timezoneDdl}
/>
</div>
</div>

<div className="row form-group">
<div className="col-md-6">
<label>
Expand All @@ -518,10 +538,10 @@ class SelectionPlanForm extends React.Component {
id="submission_begin_date"
onChange={this.handleChange}
format={{ date: "YYYY-MM-DD", time: "HH:mm" }}
timezone={currentSummit.time_zone_id}
timezone={selectedTimezone}
value={epochToMomentTimeZone(
entity.submission_begin_date,
currentSummit.time_zone_id
selectedTimezone
)}
/>
</div>
Expand All @@ -534,10 +554,10 @@ class SelectionPlanForm extends React.Component {
id="submission_end_date"
onChange={this.handleChange}
format={{ date: "YYYY-MM-DD", time: "HH:mm" }}
timezone={currentSummit.time_zone_id}
timezone={selectedTimezone}
value={epochToMomentTimeZone(
entity.submission_end_date,
currentSummit.time_zone_id
selectedTimezone
)}
/>
</div>
Expand Down Expand Up @@ -573,10 +593,10 @@ class SelectionPlanForm extends React.Component {
id="submission_lock_down_presentation_status_date"
onChange={this.handleChange}
format={{ date: "YYYY-MM-DD", time: "HH:mm" }}
timezone={currentSummit.time_zone_id}
timezone={selectedTimezone}
value={epochToMomentTimeZone(
entity.submission_lock_down_presentation_status_date,
currentSummit.time_zone_id
selectedTimezone
)}
/>
</div>
Expand All @@ -591,10 +611,10 @@ class SelectionPlanForm extends React.Component {
id="voting_begin_date"
onChange={this.handleChange}
format={{ date: "YYYY-MM-DD", time: "HH:mm" }}
timezone={currentSummit.time_zone_id}
timezone={selectedTimezone}
value={epochToMomentTimeZone(
entity.voting_begin_date,
currentSummit.time_zone_id
selectedTimezone
)}
/>
</div>
Expand All @@ -607,10 +627,10 @@ class SelectionPlanForm extends React.Component {
id="voting_end_date"
onChange={this.handleChange}
format={{ date: "YYYY-MM-DD", time: "HH:mm" }}
timezone={currentSummit.time_zone_id}
timezone={selectedTimezone}
value={epochToMomentTimeZone(
entity.voting_end_date,
currentSummit.time_zone_id
selectedTimezone
)}
/>
</div>
Expand All @@ -625,10 +645,10 @@ class SelectionPlanForm extends React.Component {
id="selection_begin_date"
onChange={this.handleChange}
format={{ date: "YYYY-MM-DD", time: "HH:mm" }}
timezone={currentSummit.time_zone_id}
timezone={selectedTimezone}
value={epochToMomentTimeZone(
entity.selection_begin_date,
currentSummit.time_zone_id
selectedTimezone
)}
/>
</div>
Expand All @@ -641,10 +661,10 @@ class SelectionPlanForm extends React.Component {
id="selection_end_date"
onChange={this.handleChange}
format={{ date: "YYYY-MM-DD", time: "HH:mm" }}
timezone={currentSummit.time_zone_id}
timezone={selectedTimezone}
value={epochToMomentTimeZone(
entity.selection_end_date,
currentSummit.time_zone_id
selectedTimezone
)}
/>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@
"email": "Email",
"enabled": "Enabled",
"hidden": "Hidden",
"time_zone_for_dates": "Time Zone for Dates",
"submission_begin_date": "Submissions Start",
"submission_end_date": "Submissions End",
"submission_lock_down_presentation_status_date": "Submissions Status Lock Down Date",
Expand Down
6 changes: 5 additions & 1 deletion src/pages/selection-plans/edit-selection-plan-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const EditSelectionPlanPage = ({
allowedMembers,
errors,
history,
timezones,
extraQuestionsOrder,
extraQuestionsOrderDir,
updateSelectionPlanExtraQuestionOrder,
Expand Down Expand Up @@ -194,6 +195,7 @@ const EditSelectionPlanPage = ({
entity={entity}
allowedMembers={allowedMembers}
currentSummit={currentSummit}
timezones={timezones}
errors={errors}
extraQuestionsOrder={extraQuestionsOrder}
extraQuestionsOrderDir={extraQuestionsOrderDir}
Expand Down Expand Up @@ -228,9 +230,11 @@ const EditSelectionPlanPage = ({

const mapStateToProps = ({
currentSummitState,
currentSelectionPlanState
currentSelectionPlanState,
baseState
}) => ({
currentSummit: currentSummitState.currentSummit,
timezones: baseState.timezones,
...currentSelectionPlanState
});

Expand Down