@page "/Project/Reviewer/{ProjectNo?}"
@attribute [Authorize]
<PageContainer>
    <Breadcrumb>
        <Breadcrumb>
            <BreadcrumbItem>
                <a href="/Home"><Icon Type="home"></Icon></a>
            </BreadcrumbItem>
            <BreadcrumbItem>
                <span>专案审核</span>
            </BreadcrumbItem>
        </Breadcrumb>
    </Breadcrumb>
    <Content>
        <Button Type="primary" Icon="plus" OnClick="Save" Style="float:right">保存</Button>
    </Content>
    <ChildContent>
        <Space>
            @if (string.IsNullOrEmpty(ProjectNo))
            {

            }
            else
            {
                <SpaceItem>@ProjectNo</SpaceItem>
                <SpaceItem><Button Type="primary" Icon="" OnClick="ReviewHistory">查看往期点数</Button></SpaceItem>
            }
        </Space>

        @if (projectContents != null)
        {
            foreach (var pContent in projectContents)
            {
                <Card Title="@pContent.ProjectContentRecord.Staff.Name">
                    <Extra>
                        <Space>
                            <SpaceItem>
                                最终绩效点数:
                                <AntDesign.InputNumber @bind-Value="@pContent.ProjectContentRecord.PointS" Step="0.01" Size="@InputSize.Small" />S
                            </SpaceItem>
                            <SpaceItem><AntDesign.InputNumber @bind-Value="@pContent.ProjectContentRecord.PointA" Step="0.01" Size="@InputSize.Small" />A</SpaceItem>
                            <SpaceItem><AntDesign.InputNumber @bind-Value="@pContent.ProjectContentRecord.PointB" Step="0.01" Size="@InputSize.Small" />B</SpaceItem>
                            <SpaceItem><AntDesign.InputNumber @bind-Value="@pContent.ProjectContentRecord.PointC" Step="0.01" Size="@InputSize.Small" />C</SpaceItem>
                            <SpaceItem><AntDesign.InputNumber @bind-Value="@pContent.ProjectContentRecord.PointD" Step="0.01" Size="@InputSize.Small" />D</SpaceItem>
                        </Space>
                    </Extra>
                    <Body>
                        <Table DataSource="pContent.ProjectWorkContents" Context="pp" Size="@TableSize.Small" Title="工作内容" HidePagination="@true">
                            <ChildContent>
                                <AntDesign.Column Title="工作内容" TData="string">
                                    @pp.Content
                                </AntDesign.Column>
                                <AntDesign.Column Title="工作日期" TData="string">
                                    @pp.WorkDate.ToString("yyyy-MM-dd")
                                </AntDesign.Column>
                                <AntDesign.Column Title="时间跨度" TData="string">
                                    @pp.TimeSpan 天
                                </AntDesign.Column>
                                <AntDesign.Column Title="耗时" TData="string">
                                    @pp.TakeTime 小时
                                </AntDesign.Column>
                                <AntDesign.Column Title="工作难度系数" TData="string">
                                    <Input Type="text" @bind-Value="@pp.DifficultFactor" Size="20" @oninput="()=>ContentChanged(pp)" />
                                </AntDesign.Column>
                                <AntDesign.Column Title="实际绩效" TData="string">
                                    <Input Type="text" @bind-Value="@pp.ActualPerformance" OnBlur="stopEdit" Size="20" @oninput="()=>ContentChanged(pp)" />
                                </AntDesign.Column>
                                @*<AntDesign.Column Title="最终绩效" TData="string">
                                    <Input Type="text" @bind-Value="@pp.FinalPerformance" OnBlur="stopEdit" Size="20" @oninput="()=>ContentChanged(pp)" />
                                </AntDesign.Column>*@
                            </ChildContent>
                        </Table>

                    </Body>

                </Card>
            }
        }
        else
        {
            <Spin />
        }
    </ChildContent>
</PageContainer>

<Drawer Height="600" Visible="_ShowHistory" Placement="bottom" Title='($"【{ProjectNo}】历史点数")' OnClose="_=>CloseDetail()">

    @if(HistroyContents != null){
    <div>
        @foreach(CalMonth calMonth in GetMonth(HistroyContents))
        {
            <span><b>@($"{calMonth.Year}年{calMonth.Month}月")</b></span>
            <Divider/>

            foreach(share.ProjectContents pContent in GetByMonth(calMonth, HistroyContents))
            {
                <Card Title="@pContent.ProjectContentRecord.Staff.Name">
                    <Extra>
                        <Space>
                            <SpaceItem>
                                最终绩效点数:
                            </SpaceItem>
                            <SpaceItem><span style ="text-decoration:underline;">@($"{GetPointString(pContent.ProjectContentRecord,"S")}") </span><b>S</b></SpaceItem>
                            <SpaceItem><span style ="text-decoration:underline;">@($"{GetPointString(pContent.ProjectContentRecord,"A")}") </span><b>A</b></SpaceItem>
                            <SpaceItem><span style ="text-decoration:underline;">@($"{GetPointString(pContent.ProjectContentRecord,"B")}") </span><b>B</b></SpaceItem>
                            <SpaceItem><span style ="text-decoration:underline;">@($"{GetPointString(pContent.ProjectContentRecord,"C")}") </span><b>C</b></SpaceItem>
                            <SpaceItem><span style ="text-decoration:underline;">@($"{GetPointString(pContent.ProjectContentRecord,"D")}") </span><b>D</b></SpaceItem>
                        </Space>
                    </Extra>
                    <Body>
                        <Table DataSource="pContent.ProjectWorkContents" Context="pp" Size="@TableSize.Small" HidePagination="@true">
                            <ChildContent>
                                <AntDesign.Column Title="工作内容" TData="string">
                                    @pp.Content
                                </AntDesign.Column>
                                <AntDesign.Column Title="工作日期" TData="string">
                                    @pp.WorkDate.ToString("yyyy-MM-dd")
                                </AntDesign.Column>
                                <AntDesign.Column Title="时间跨度" TData="string">
                                    @pp.TimeSpan 天
                                </AntDesign.Column>
                                <AntDesign.Column Title="耗时" TData="string">
                                    @pp.TakeTime 小时
                                </AntDesign.Column>
                                <AntDesign.Column Title="工作难度系数" TData="string">
                                    @pp.DifficultFactor
                                </AntDesign.Column>
                                <AntDesign.Column Title="实际绩效" TData="string">
                                    @pp.ActualPerformance
                                </AntDesign.Column>
                            </ChildContent>
                        </Table>

                    </Body>
                </Card>
            }
        }
    </div>
    }
    
</Drawer>



