<commit_before>import {action, model} from '../common';

export default {
	namespace: model.order,
	state: {
		currentStep: 0,
		display: 'none',
		disabled: false,
		displayConfirm: 'block',
		displayBack: 'block',
		displayNew: 'none',
		submitDisabled: false,
	},
	reducers: {
		initState: ( state ) => {
			console.log( '===orderModal_init===' );
			return {
				currentStep: 0,
				display: 'none',
				disabled: false,
				displayConfirm: 'block',
				displayBack: 'block',
				displayNew: 'none',
				submitDisabled: false,
			}
		},
		changeConfirmState: ( state ) => {
			return {
				...state,
				currentStep: state.currentStep == 1 ? 0 : 1,
				display: state.display == 'none' ? 'block' : 'none',
				disabled: !state.disabled,
				displayConfirm: state.displayConfirm == 'none' ? 'block' : 'none',
			}
		},
		changeSubmitSate: ( state ) => {
			return {
				...state,
				currentStep: 3,
				displayBack: 'none',
				displayNew: 'block',
				submitDisabled: true,
			}
		}
	},
	effects: {},
	subscriptions: {
		setup ( { dispatch, history } ) {
			history.listen( location => {
				if ( location.pathname.indexOf( 'order' ) < 0 ) {
					dispatch( { type: action.order_init } );
				}<commit_msg>orderModel<commit_after>import {action, model} from '../common';

export default {
	namespace: model.order,
	state: {
		currentStep: 0,
		display: 'none',
		disabled: false,
		displayConfirm: 'block',
		displayBack: 'block',
		displayNew: 'none',
		submitDisabled: false,
	},
	reducers: {
		initState: ( state, { payload: { currentData } } ) => {
			console.log( '===initState===' );
			return {
				currentStep: 0,
				display: 'none',
				disabled: false,
				displayConfirm: 'block',
				displayBack: 'block',
				displayNew: 'none',
				submitDisabled: false,
				currentData,
			}
		},
		initWorkerState: ( state, { payload: { currentData } } ) => {
			console.log( '===initWorkerState===' );
			return {
				display: 'block',
				disabled: true,
				currentData,
			}
		},
		changeConfirmState: ( state ) => {
			return {
				...state,
				currentStep: state.currentStep == 1 ? 0 : 1,
				display: state.display == 'none' ? 'block' : 'none',
				disabled: !state.disabled,
				displayConfirm: state.displayConfirm == 'none' ? 'block' : 'none',
			}
		},
		changeSubmitSate: ( state ) => {
			return {
				...state,
				currentStep: 3,
				displayBack: 'none',
				displayNew: 'block',
				submitDisabled: true,
			}
		}
	},
	effects: {
		*initWorker( {}, { put, select } ){
			const currentData = yield select( state => state.workerModel.currentData );
			yield put( {
				type: 'initWorkerState',
				payload: {
					currentData: currentData,
				},
			} );
		},
		*initDoctor( {}, { put, select } ){
			const currentData = yield select( state => state.appModel.user );
			yield put( {
				type: 'initState',
				payload: { currentData: currentData },
			} );
		}
	},
	subscriptions: {
		setup ( { dispatch, history } ) {
			history.listen( location => {
				if ( location.pathname.indexOf( 'worker' ) >= 0 ) {
					dispatch( { type: action.order_initWorker } );
				} else if ( location.pathname !== '/orderList' ) {
					dispatch( { type: action.order_init } );
				}
{'fraction_non_alphanumeric': 0.16666666666666666, 'fraction_numerical': 0.004394224733207784, 'mean_word_length': 2.9248768472906406, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1970428', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1042, 'n_words': 236}