import React, { Fragment } from 'react';
import EmptyLayout from '~/Components/Layouts/EmptyLayout';
import Form from '~/Components/Form';
import { Util } from '~/Utils/utils';
import { View } from 'react-native';

export default Screen = ({navigation, data, setData, setValue, errors}) => {
    const action = navigation.getParam('action', Form.VIEW);
    const editable = navigation.getParam('editable', action == Form.VIEW ? false : true);
    const setEditable = (value) => { navigation.setParams({editable: value}) };
    const refreshList = navigation.getParam('refreshList', ()=>{});
    const siteId = navigation.getParam('siteId', 0);
    const addDate = navigation.getParam('addDate', new Date());
    const setAddDate = (value) => { navigation.setParams({addDate: value}) };
    const businessFieldId = navigation.getParam('businessFieldId', 0);

    return (
        <EmptyLayout>
            <Form.Container id="daily-report-work-count-form" style={{paddingLeft:0, paddingTop:0, paddingRight:0, paddingBottom:0}}>
                {Util.get(data, 'DataObject.WorkCounts', []).map((item, index) => {
                    return (
                        <Fragment key={`work-counts-${index}`}>
                            <Form.FieldSetHead>
                                <Form.Legend><Form.LegendLabel>{item.BusinessFieldName}</Form.LegendLabel></Form.Legend>
                            </Form.FieldSetHead>
                            <Form.FieldSet>
                                <Form.Field>
                                    <Form.Title style={{justifyContent:'flex-end'}}><Form.Label>계획</Form.Label></Form.Title>
                                    <Form.Input editable={false} defaultValue={Util.get(item, "RequestCount", 0)} />
        
                                    <Form.Title style={{justifyContent:'flex-end'}}><Form.Label>완료</Form.Label></Form.Title>
                                    <Form.Input editable={false} defaultValue={Util.get(item, "ApprovalCount", 0)} />
                                </Form.Field>
                            </Form.FieldSet>
                        </Fragment>
                    )
                })}

                <Form.Field style={{height:100}} />

            </Form.Container>
        </EmptyLayout>
    )
};