﻿@model ComicBookShared.Models.ComicBook

@{
    ViewBag.Title = "Comic Book Detail";
}

@Html.Partial("_Message")

<h2>@Model.DisplayText</h2>

<h3>Main Information</h3>

<div class="row">
    <div class="col-md-6">

        <div class="row">
            <div class="col-xs-4 col-sm-4">
                @Html.LabelFor(m => m.SeriesId)
            </div>
            <div class="col-xs-8 col-sm-8">
                @Model.Series.Title
            </div>
        </div>

        <div class="row">
            <div class="col-xs-4 col-sm-4">
                @Html.LabelFor(m => m.IssueNumber)
            </div>
            <div class="col-xs-8 col-sm-8">
                @Model.IssueNumber
            </div>
        </div>

        <div class="row">
            <div class="col-xs-4 col-sm-4">
                @Html.LabelFor(m => m.PublishedOn)
            </div>
            <div class="col-xs-8 col-sm-8">
                @Model.PublishedOn.ToShortDateString()
            </div>
        </div>

        <div class="row">
            <div class="col-xs-4 col-sm-4">
                @Html.LabelFor(m => m.AverageRating)
            </div>
            <div class="col-xs-8 col-sm-8">
                @(Model.AverageRating != null ? Model.AverageRating.Value.ToString("n1") : "N/A")
            </div>
        </div>

    </div>
    <div class="col-md-6">

        <div>
            @Html.LabelFor(m => m.Description)
        </div>
        <div>
            @(!string.IsNullOrWhiteSpace(Model.Description) ? Model.Description : "N/A")
        </div>

    </div>
</div>

<h3>Artists</h3>

<div class="pull-right">
    <a href="@Url.Action("Add", "ComicBookArtists", new { comicbookid = Model.Id })" class="btn btn-primary">
        <span class="glyphicon glyphicon-plus"></span> Add Artist
    </a>
</div>

<table class="table table-striped table-condensed">
    <thead>
        <tr>
            <th>Role</th>
            <th>Artist</th>
            <th>&nbsp;</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var artist in Model.Artists)
        {
            <tr>
                <td>@artist.Role.Name</td>
                <td>@artist.Artist.Name</td>
                <td>
                    <div class="pull-right">
                        <a href="@Url.Action("Delete", "ComicBookArtists", new { comicbookid = Model.Id, id = artist.Id })" class="btn btn-danger btn-xs margin-right">
                            <span class="glyphicon glyphicon-trash"></span><span class="hidden-xs"> Delete</span>
                        </a>
                    </div>
                </td>
            </tr>
        }
    </tbody>
</table>

<div class="pad-top">
    <a href="@Url.Action("Edit", new { id = Model.Id })" class="btn btn-primary btn-lg margin-right">
        <span class="glyphicon glyphicon-edit"></span> Edit
    </a>
    <a href="@Url.Action("Delete", new { id = Model.Id })" class="btn btn-danger btn-lg margin-right">
        <span class="glyphicon glyphicon-trash"></span> Delete
    </a>
    <a href="@Url.Action("Index")" class="btn btn-default btn-lg">
        <span class="glyphicon glyphicon-step-backward"></span> Back
    </a>
</div>

