aboutsummaryrefslogtreecommitdiffstats
path: root/app/assets/javascripts
diff options
context:
space:
mode:
authorcedricnjanga2017-08-14 15:04:52 +0200
committercedricnjanga2017-08-16 09:28:48 +0200
commitefbd9f90ae41b357ad8559fbc3b29fc59524bb73 (patch)
tree40e0baefe7c2b91456606747e7b820f1379483ee /app/assets/javascripts
parentd1c1e5628679ee41956d0b05e24807ef84b98928 (diff)
downloadchouette-core-efbd9f90ae41b357ad8559fbc3b29fc59524bb73.tar.bz2
Timetable Period form update
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/actions/index.js4
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/components/PeriodForm.js4
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/containers/PeriodForm.js7
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js2
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js2
5 files changed, 10 insertions, 9 deletions
diff --git a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js
index a1e41027a..f88d64d4d 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js
+++ b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js
@@ -105,12 +105,12 @@ const actions = {
group,
selectType
}),
- validatePeriodForm: (modalProps, timeTablePeriods, metas, timeTableDates) => ({
+ validatePeriodForm: (modalProps, timeTablePeriods, metas, currentMonthDaysIn) => ({
type: 'VALIDATE_PERIOD_FORM',
modalProps,
timeTablePeriods,
metas,
- timeTableDates
+ currentMonthDaysIn
}),
includeDateInPeriod: (index, dayTypes) => ({
type: 'INCLUDE_DATE_IN_PERIOD',
diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodForm.js b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodForm.js
index 2194bd46a..1426a5908 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodForm.js
+++ b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodForm.js
@@ -32,7 +32,7 @@ const makeYearsOptions = (yearSelected) => {
return arr
}
-const PeriodForm = ({modal, timetable, metas, onOpenAddPeriodForm, onClosePeriodForm, onUpdatePeriodForm, onValidatePeriodForm}) => (
+const PeriodForm = ({modal, timetable, metas, currentMonthDaysIn, onOpenAddPeriodForm, onClosePeriodForm, onUpdatePeriodForm, onValidatePeriodForm}) => (
<div className="container-fluid">
<div className="row">
<div className="col lg-6 col-lg-offset-3">
@@ -108,7 +108,7 @@ const PeriodForm = ({modal, timetable, metas, onOpenAddPeriodForm, onClosePeriod
<button
type='button'
className='btn btn-outline-primary mr-sm'
- onClick={() => onValidatePeriodForm(modal.modalProps, timetable.time_table_periods, metas, _.reject(timetable.current_month, ['include_date', false]))}
+ onClick={() => onValidatePeriodForm(modal.modalProps, timetable.time_table_periods, metas, currentMonthDaysIn)}
>
Valider
</button>
diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/PeriodForm.js b/app/assets/javascripts/es6_browserified/time_tables/containers/PeriodForm.js
index d6ba64241..813f9d795 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/containers/PeriodForm.js
+++ b/app/assets/javascripts/es6_browserified/time_tables/containers/PeriodForm.js
@@ -7,7 +7,8 @@ const mapStateToProps = (state) => {
return {
modal: state.modal,
timetable: state.timetable,
- metas: state.metas
+ metas: state.metas,
+ currentMonthDaysIn: _.filter(state.timetable.current_month, ['include_date', true])
}
}
@@ -27,8 +28,8 @@ const mapDispatchToProps = (dispatch) => {
val = (val < 10) ? '0' + String(val) : String(val)
dispatch(actions.updatePeriodForm(val, group, 'day'))
},
- onValidatePeriodForm: (modalProps, timeTablePeriods, metas, timeTableDates) => {
- dispatch(actions.validatePeriodForm(modalProps, timeTablePeriods, metas, timeTableDates))
+ onValidatePeriodForm: (modalProps, timeTablePeriods, metas, currentMonthDaysIn) => {
+ dispatch(actions.validatePeriodForm(modalProps, timeTablePeriods, metas, currentMonthDaysIn))
}
}
}
diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js b/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js
index 4af2dc307..eaa5ad385 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js
+++ b/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js
@@ -64,7 +64,7 @@ const modal = (state = {}, action) => {
}
let newPeriods = JSON.parse(JSON.stringify(action.timeTablePeriods))
- let newDays = JSON.parse(JSON.stringify(action.timeTableDates))
+ let newDays = JSON.parse(JSON.stringify(action.currentMonthDaysIn))
let error = actions.checkErrorsInPeriods(period_start, period_end, action.modalProps.index, newPeriods)
if (error == '') error = actions.checkErrorsInDates(period_start, period_end, newDays)
newModalProps.error = error
diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js b/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js
index aa3ea55e3..057e9a380 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js
+++ b/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js
@@ -64,7 +64,7 @@ const timetable = (state = {}, action) => {
return state
}
let newPeriods = JSON.parse(JSON.stringify(action.timeTablePeriods))
- let newDays = JSON.parse(JSON.stringify(action.timeTableDates))
+ let newDays = JSON.parse(JSON.stringify(action.currentMonthDaysIn))
let error = actions.checkErrorsInPeriods(period_start, period_end, action.modalProps.index, newPeriods)
if (error == '') error = actions.checkErrorsInDates(period_start, period_end, newDays)