@using System.Web.Mvc.Html
@using MrCMS.Helpers
@using MrCMS.Web.Apps.Amazon.Models
@model AmazonSyncModel
@{
    ViewBag.Title = "Sync Amazon Listings";
    var amazonManageInventoryUrl = ViewData["AmazonManageInventoryUrl"] as string;
}
<fieldset>
    <legend>Sync Amazon Listings
            <span class="btn-group  display-inline  pull-right">
                @Html.ActionLink("Back to Listing Group", "Edit", "ListingGroup", new { id = Model.Id }, new { @class = "btn" })x
                @Html.ActionLink("Logs", "Index", "Logs", new { type = AmazonLogType.Listings }, new { @class = "btn" })
            </span>
    </legend>

    @Html.Hidden("Id", Model.Id)
    @Html.Hidden("Description", Model.Description)
    @Html.Hidden("TaskId", Guid.NewGuid())

    <div id="pb" style="display: none">
        <div class="progress progress-info progress-striped">
            <div class="bar" style="width: 0;"></div>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-6">
            Listing Group: <strong>@Model.Title</strong>
            <br />
            <br />
            <div>
                <strong>IMPORTANT :</strong>
                <ul>
                    <li>Please leave this tab open whilst syncing. Feel free to browse the admin/site in another tab</li>
                    <li>Syncing can take over 10 minutes to complete</li>
                    <li>More information can be viewed in the @Html.ActionLink("log", "Index", "Logs", new { type = AmazonLogType.Listings }, null)</li>
                    @if (!string.IsNullOrEmpty(amazonManageInventoryUrl))
                    {
                        <li>Check your inventory on <a href='@amazonManageInventoryUrl' target="_blank">Amazon</a> to confirm the listing has worked as expected.</li>
                    }
                </ul>
            </div>
            <br />
            <button type="button" class="btn btn-success" id="pb-start-task">
                Sync Now</button>
        </div>
        <div class="col-lg-6">
            <div id="pb-status" style="display: none">
                @{Html.RenderAction("ProgressBarMessages", "App", new { Model.TaskId }); }
            </div>
        </div>
    </div>

</fieldset>

@{ Html.IncludeScript("~/Apps/Amazon/Areas/Admin/Content/Scripts/custom/progress-bar-paged.js");}
@{ Html.IncludeScript("~/Apps/Amazon/Areas/Admin/Content/Scripts/custom/sync-many-listing.js");}

@{ Html.IncludeCss("~/Apps/Amazon/Areas/Admin/Content/Styles/progress-bar.css"); }