@page "/user/destinations"
@using AyCode.Models.Messages
@using TIAM.Entities.ServiceProviders
@using TIAM.Resources
@using TIAMSharedUI.Pages.Components
@using TIAMSharedUI.Shared
@using TIAMWebApp.Shared.Application.Models
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
@using TIAMWebApp.Shared.Application.Models.ClientSide.Messages
@using TIAMWebApp.Shared.Application.Utility
@layout AdminLayout
@inject LogToBrowserConsole logToBrowserConsole
@inject IStringLocalizer<TIAMResources> localizer
<PageTitle>Transfers</PageTitle>

<div class="text-center m-5">
    <h1>Destination management</h1>
    <h2 style="font-size:small">Manage transfers here!</h2>
</div>

<div class="container">
    <div class="row">        
        <div class=" col-12">
            <h3>@localizer.GetString("TransferDestination")</h3>
            

            <div class="d-flex flex-column mb-4 pb-2">
                <div class="align-self-end pl-2 pb-2">
                    <DxButton Text="Column Chooser"
                              RenderStyle="ButtonRenderStyle.Secondary"
                              IconCssClass="btn-column-chooser"
                              Click="ColumnChooserButton_Click" />
                </div>
                <DxGrid @ref="Grid"
                        Data="TransferData"
                        PageSize="8"
                        KeyFieldName="Id"
                        ValidationEnabled="false"
                        CustomizeElement="Grid_CustomizeElement"
                        CustomizeEditModel="Grid_CustomizeEditModel"                        
                        EditModelSaving="Grid_EditModelSaving"
                        DataItemDeleting="Grid_DataItemDeleting"
                        EditMode="GridEditMode.EditForm"
                        ColumnResizeMode="GridColumnResizeMode.ColumnsContainer"
                        KeyboardNavigationEnabled="true"
                        ShowFilterRow="true">
                    <Columns>
                        <DxGridCommandColumn Width="8%" FixedPosition="GridColumnFixedPosition.Left" />

                        <DxGridDataColumn FieldName="Id" MinWidth="80" Width="20%" Visible="false" />
                        <DxGridDataColumn FieldName="Name" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="20%">
                            <CellDisplayTemplate>
                                @{
                                    var keyField = context.Value;
                                    <a class="d-block text-left" href="transferdetails">@context.Value</a>
                                }
                            </CellDisplayTemplate>
                        </DxGridDataColumn>
                        <DxGridDataColumn FieldName="Description" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="20%" />
                        <DxGridDataColumn FieldName="AddressString" MinWidth="80" Width="20%" />
                        <DxGridDataColumn FieldName="Price" MinWidth="80" Width="20%" />
                        
                        
                    </Columns>

                    <EditFormTemplate Context="EditFormContext">
                        @{
                            var transfer = (TransferDestinationWizardModel)EditFormContext.EditModel;
                        }
                        <DxFormLayout CssClass="w-100">
                            <DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationName) ColSpanMd="6">
                                @EditFormContext.GetEditor("Name")
                            </DxFormLayoutItem>
                            <DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Destination) ColSpanMd="6">
                                @EditFormContext.GetEditor("Destination")
                            </DxFormLayoutItem>
                            <DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationAddress) ColSpanMd="6">
                                @EditFormContext.GetEditor("AddressString")
                            </DxFormLayoutItem>
                            <DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.Price) ColSpanMd="6">
                                @EditFormContext.GetEditor("Price")
                            </DxFormLayoutItem>
                            
                        </DxFormLayout>
                    </EditFormTemplate>                   

                </DxGrid>


            </div>

        </div>
        
        <div class=" col-12 col-xl-6">
        </div>

    </div>
</div>


@code {


}
