@page "/Project/AssignPoint/{id}"

<PageContainer>
    <Breadcrumb>
        <Breadcrumb>
            <BreadcrumbItem>
                <a href="/Home"><Icon Type="home"></Icon></a>
            </BreadcrumbItem>
            <BreadcrumbItem>
                <span>项目</span>
            </BreadcrumbItem>
            <BreadcrumbItem>
                <span>分配项目点数</span>
            </BreadcrumbItem>
        </Breadcrumb>
    </Breadcrumb>
    <Content></Content>
    <ChildContent>
        <Card>
            <Card>
                <div>
                    <Row>
                        <AntDesign.Col Span="4"><b>我方文号:</b></AntDesign.Col>
                        <AntDesign.Col Span="8">@task.ProjectInfo.CaseNo</AntDesign.Col>
                        <AntDesign.Col Span="4"><b>处理事项:</b></AntDesign.Col>
                        <AntDesign.Col Span="8">@task.ProjectInfo.DoItem</AntDesign.Col>
                    </Row>
                    <Row><AntDesign.Col Span="24">&nbsp;</AntDesign.Col></Row>
                    <Row>
                        <AntDesign.Col Span="4"><b>案件名称:</b></AntDesign.Col>
                        <AntDesign.Col Span="16">@task.ProjectInfo.CaseName</AntDesign.Col>
                        <AntDesign.Col Span="4"><Button Type="primary" Icon="plus" OnClick="AddNew" Style="float:right">添加</Button></AntDesign.Col>
                    </Row>
                </div>
            </Card>
            <Card>
                <AntDesign.Table TItem="wispro.sp.web.Models.ProjectPoint"
                                 DataSource="projectPoints"
                                 Bordered=@true
                                 Size=@TableSize.Small>
                    <ChildContent Context="pp">
                        <AntDesign.Column Title="处理事项" @bind-Field="@pp.doItem" Sortable Filterable />
                        <AntDesign.Column Title="难度系数" @bind-Field="@pp.DoItemCoefficient" Sortable Filterable />
                        <AntDesign.Column Title="处理人" @bind-Field="@pp.person" Sortable Filterable />
                        <AntDesign.Column Title="分配点数"  @bind-Field="@pp.Point" TData="double">
                            @if (editId == pp.person)
                            {
                                <Input Type="text" @bind-Value="pp.Point" OnBlur="stopEdit" AutoFocus />
                            }
                            else
                            {
                                <div class="editable-cell-value-wrap" style="padding-right:10px" @onclick="()=>startEdit(pp.person)">
                                    @pp.Point
                                </div>
                            }
                        </AntDesign.Column>
                        <ActionColumn>
                            <Space>
                                <SpaceItem><Button Danger OnClick="()=>Delete(pp.person)">删除</Button></SpaceItem>
                            </Space>
                        </ActionColumn>
                    </ChildContent>

                </AntDesign.Table>
            </Card>
            
            <Card>
                <Space Style="float:right">
                    <SpaceItem><Button Type="primary" Icon="save" OnClick="OnSave" Style="float:right">保存</Button></SpaceItem>
                    <SpaceItem><Button Icon="cancel" OnClick="OnCancel" Style="float:right">取消</Button></SpaceItem>
                </Space>
            </Card>
        </Card>
        
    </ChildContent>
</PageContainer>


<Modal  Title="分配点数"
       Visible="@_visible"
       OnOk="@HandleOk"
       OnCancel="@HandleCancel" 
       MaskClosable="false"
       DestroyOnClose="true"
       @ref="model">
    <Form Model="addDoItem" LabelColSpan="6"
          WrapperColSpan="16">
        <FormItem Label="处理事项">
            <Input @bind-Value="@context.Name" />
        </FormItem>
        <FormItem Label="难度系数">
            <Input @bind-Value="@context.nanduxishu" />
        </FormItem>
        <AntDesign.Table 
                         TItem="ProjectPoint"
                         DataSource="addDoItem.AddprojectPoints"
                         Bordered=@true
                         Size=@TableSize.Small>
            <ChildContent Context="pp">
                <AntDesign.Column Title="处理人" @bind-Field="@pp.person" Sortable Filterable />
                <AntDesign.Column Width="30%" Title="分配点数" TData="double">
                    @if (editId == pp.person)
                    {
                        <Input Type="text" @bind-Value="pp.Point" OnBlur="stopEdit" AutoFocus />
                    }
                    else
                    {
                        <div class="editable-cell-value-wrap" style="padding-right:10px" @onclick="()=>startEdit(pp.person)">
                            @pp.Point  
                        </div>
                    }
                </AntDesign.Column>
                <ActionColumn>
                    <Space>
                        <SpaceItem><Button Danger OnClick="()=>Delete(pp.person)">删除</Button></SpaceItem>
                    </Space>
                </ActionColumn>
            </ChildContent>

        </AntDesign.Table>
    </Form>
</Modal>