2018-06-25 14:40:43 +00:00
|
|
|
/* @flow */
|
|
|
|
|
|
|
|
import { combineReducers } from 'redux'
|
2018-07-12 08:09:41 +00:00
|
|
|
import type {
|
|
|
|
Action,
|
|
|
|
CompanyLegalStatus,
|
|
|
|
State
|
|
|
|
} from 'Types/companyStatusTypes'
|
2018-06-27 14:22:42 +00:00
|
|
|
|
|
|
|
function companyLegalStatus(
|
|
|
|
state: CompanyLegalStatus = {},
|
2018-06-26 15:57:50 +00:00
|
|
|
action: Action
|
2018-06-27 14:22:42 +00:00
|
|
|
): CompanyLegalStatus {
|
|
|
|
switch (action.type) {
|
|
|
|
case 'CHOOSE_COMPANY_LEGAL_SETUP':
|
2018-07-18 08:57:56 +00:00
|
|
|
return { ...state, liability: action.setup }
|
2018-06-26 15:57:50 +00:00
|
|
|
|
2018-06-27 14:22:42 +00:00
|
|
|
case 'DEFINE_DIRECTOR_STATUS':
|
|
|
|
return { ...state, directorStatus: action.status }
|
|
|
|
case 'COMPANY_HAVE_MULTIPLE_ASSOCIATE':
|
|
|
|
return { ...state, multipleAssociate: action.multipleAssociate }
|
2018-06-26 15:57:50 +00:00
|
|
|
}
|
2018-06-27 14:22:42 +00:00
|
|
|
return state
|
2018-06-26 15:57:50 +00:00
|
|
|
}
|
|
|
|
|
2018-07-04 09:42:41 +00:00
|
|
|
function checklists(
|
2018-07-06 14:03:25 +00:00
|
|
|
state: { [string]: { [string]: boolean } } = { hire: {}, register: {} },
|
2018-07-06 12:31:30 +00:00
|
|
|
action: Action
|
2018-07-04 09:42:41 +00:00
|
|
|
) {
|
2018-07-06 12:31:30 +00:00
|
|
|
switch (action.type) {
|
2018-07-04 09:42:41 +00:00
|
|
|
case 'CHANGE_CHECKLIST_ITEM':
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
[action.checklist]: {
|
2018-07-06 14:03:25 +00:00
|
|
|
...state[action.checklist],
|
2018-07-04 09:42:41 +00:00
|
|
|
...{ [action.name]: action.value }
|
|
|
|
}
|
|
|
|
}
|
2018-07-06 12:31:30 +00:00
|
|
|
default:
|
|
|
|
return state
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-06 13:48:41 +00:00
|
|
|
function existingCompanyDetails(
|
|
|
|
state: ?{ [string]: string } = null,
|
|
|
|
action: Action
|
|
|
|
): ?{ [string]: string } {
|
|
|
|
switch (action.type) {
|
|
|
|
case 'SAVE_EXISTING_COMPANY_DETAILS':
|
|
|
|
return action.details
|
|
|
|
default:
|
|
|
|
return state
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-12 08:09:41 +00:00
|
|
|
// $FlowFixMe
|
2018-07-06 13:48:41 +00:00
|
|
|
export default (combineReducers({
|
2018-07-06 12:31:30 +00:00
|
|
|
companyLegalStatus,
|
2018-07-04 09:42:41 +00:00
|
|
|
checklists,
|
2018-07-06 13:48:41 +00:00
|
|
|
existingCompanyDetails
|
|
|
|
}): (State, Action) => State)
|