@model PantheonRA.WebApi.Contracts.TravelOrder
@using PantheonRA.BackOffice.Models;
@using PAW.Contracts.Enums;

@Html.Hidden("DeleteOne", Url.Action("DeleteOne", "TravelOrders", new { acKey = Model.AcKey }))
@Html.Hidden("DeleteStatus", Url.Action("GetDeleteStatus", "TravelOrders", new { acKey = Model.AcKey }))
@Html.Hidden("DeleteTravelOrder", Loc.DeleteTravelOrder)
@Html.Hidden("Confirm", Loc.Confirm)
@Html.Hidden("Cancel", Loc.Cancel)

<div class="row buttons-tabbed">
    <div class="travel-order-buttons">
        @if (!string.IsNullOrEmpty(Model.AcKey))
        {
            if (Loc.CurrentLocalization == Localization.Code.HR
             || Loc.CurrentLocalization == Localization.Code.BA
             || Loc.CurrentLocalization == Localization.Code.MK)
            {
                @Html.Partial("_FormButtons", new FormButtonsViewModel
                {
               ShowCloseBtn = true,
               BackUrl = Url.Action("Index", "TravelOrders"),
               PrintButtonGroup = new FormButtonGroup
               {
                   Buttons = new List<FormButton>
               {
                   new FormButton {
                       Text = Loc.PrintTravelOrder,
                       Target = "_self",
                       Icon = "far fa-print",
                       OnClick="saveAndPrint('" + Url.Action("PrintPdf", "TravelOrders", new { acKey = Model.AcKey }) +"')"
                   },
                   new FormButton
                   {
                       Text = Loc.CurrentLocalization.GetTravelOrderReportName(),
                       Target = "_self",
                       Icon = "far fa-print",
                       OnClick="saveAndPrint('" + Url.Action("PrintPdf", "TravelOrders", new { acKey = Model.AcKey, loc = Loc.CurrentLocalization }) +"')"
                   }
               }
                    }
                })
            }
            else
            {
                @Html.Partial("_FormButtons", new FormButtonsViewModel
                {
                    ShowCloseBtn = true,
                    BackUrl = Url.Action("Index", "TravelOrders"),
                    PrintButtonGroup = new FormButtonGroup
                    {
                        Buttons = new List<FormButton>
                        {
                            new FormButton
                            {
                                Text = Loc.PrintTravelOrder,
                                Target = "_self",
                                Icon = "far fa-print",
                                OnClick="saveAndPrint('" + Url.Action("PrintPdf", "TravelOrders", new { acKey = Model.AcKey }) +"')"
                            }
                        }
                    }
            });
            }

            @Html.Partial("_FormButtons", new FormButtonsViewModel
            {
                ShowCloseBtn = false,
                SaveButtonGroup = new FormButtonGroup
                {
                    Buttons = new List<FormButton>
                    {
                        new FormButton { IsSubmit=true, OnClick="saveAndDisableSaveButton()" }
                    }
                }
            })

            <div class="visible-lg-inline visible-md-inline">
                <button type="button" onclick="deleteSingleTravelOrder()" title="@Loc.Delete"
                        class="btn btn-primary btn-outline pull-right @(string.IsNullOrEmpty(Model.AcKey) ? "hidden" : string.Empty)">
                    <i class="far fa-trash-alt m-r-xs"></i>
                    <span class="visible-lg-inline">@Loc.Delete</span>
                </button>

                <a href="@Url.Action("CopyOne", "TravelOrders", new { acKey = Model.AcKey })" title="@Loc.Duplicate"
                   class="btn btn-primary btn-outline pull-right @(string.IsNullOrEmpty(Model.AcKey) ? "hidden" : string.Empty)">
                    <i class="fa fa-files-o m-r-xs"></i>
                    <span class="visible-lg-inline">@Loc.Duplicate</span>
                </a>

                <a title="@Loc.New" onclick="createNewInvoice('@Url.Action("Create", "TravelOrderAllData")', 'HeaderDocumentType')"
                   class="btn btn-primary btn-outline pull-right @(string.IsNullOrEmpty(Model.AcKey) ? "hidden" : string.Empty)">
                    <i class="fas fa-plus m-r-xs"></i>
                    <span class="visible-lg-inline">@Loc.New</span>
                </a>
            </div>

            <div class="btn-group dropdown visible-sm-inline-block visible-xs-inline-block">
                <a role="button" data-toggle="dropdown" class="btn btn-default btn-outline">
                    <i class="fas fa-bars"></i>
                </a>

                <ul class="dropdown-menu multi-level dropdown-position" role="menu" aria-labelledby="dropdownMenu">
                    <li>
                        <a role="button"
                           onclick="createNewInvoice('@Url.Action("Create", "TravelOrderAllData")', 'HeaderDocumentType')"
                           title="@Loc.New"
                           class="@(string.IsNullOrEmpty(Model.AcKey) ? "hidden" : string.Empty)">
                            <i class="fas fa-plus m-r-xs text-primary"></i>
                            <span>@Loc.New</span>
                        </a>
                    </li>
                    <li>
                        <a role="button"
                           href="@Url.Action("CopyOne", "TravelOrders", new { acKey = Model.AcKey })"
                           title="@Loc.Duplicate"
                           class="@(string.IsNullOrEmpty(Model.AcKey) ? "hidden" : string.Empty)">
                            <i class="fa fa-files-o m-r-xs text-primary"></i>
                            <span>@Loc.Duplicate</span>
                        </a>
                    </li>
                    <li>
                        <a role="button"
                           onclick="deleteSingleTravelOrder()"
                           title="@Loc.Delete"
                           class="@(string.IsNullOrEmpty(Model.AcKey) ? "hidden" : string.Empty)">
                            <i class="far fa-trash-alt m-r-xs text-primary"></i>
                            <span>@Loc.Delete</span>
                        </a>
                    </li>
                </ul>
            </div>
        }
        else
        {
            @Html.Partial("_FormButtons", new FormButtonsViewModel
            {
                ShowCloseBtn = false,
                BackUrl = Url.Action("Index", "TravelOrders"),
                SaveButtonGroup = new FormButtonGroup
                {
                    Buttons = new List<FormButton>
                    {
                        new FormButton { IsSubmit=true,  OnClick="saveAndDisableSaveButton()" }
                    }
                }
            })
        }
    </div>
        </div>
