prasadnarwadkar_ASPNETCorePostgreSQL/ASPNETIdentityPostgres/Areas/ADT/Views/Unnaturaldeaths/Index.cshtml
@model IEnumerable<Common.Models.Unnaturaldeaths>
@using Microsoft.AspNetCore.Mvc.ViewFeatures
@using Microsoft.AspNetCore.Mvc.Localization
@inject IViewLocalizer Localizer

@{
    ViewData["Title"] =Localizer["Unnatural"].Value + " " + Localizer["Death"].Value;
}

<h1>@Localizer["Unnatural"].Value @Localizer["Death"].Value</h1>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/js/moment.min.js"></script>

<h3>
    <a asp-action="Create">@Localizer["Add"].Value @Localizer["New"].Value</a>
</h3>
<table class="table table-bordered">
    <thead>
        <tr>
            <th>
                Time Of Postmortem Examination
            </th>
            <th>
                Gender
            </th>
            <th>
                Remark
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Dzongkhag)
            </th>
            <th>
                Scene of Death
            </th>
            <th>
                Police Station/Police Case Number
            </th>

            <th>
                Place of Examination
            </th>
            <th>
                Informant's relation with the deceased
            </th>
            <th>
                Informant Name
            </th>
            <th>
                Informant CID Number
            </th>
            <th>
                @Html.DisplayNameFor(model => model.History)
            </th>
            <th>
                General External Information
            </th>

            <th>
                @Html.DisplayNameFor(model => model.DeceasedName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.DateOfPostmortemExamination)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.CidOrPassport)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Age)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Address)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Isactive)
            </th>


            <th>
                @Html.DisplayNameFor(model => model.Nationality)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Lastchanged)
            </th>


            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>

                    @*@Html.Raw(item.TimeOfPostmortemExamination.Value.ToString("HH:mm:ssz"))*@
                    <p data-momentdate2="@item.TimeOfPostmortemExamination.Value.ToString("s", System.Globalization.CultureInfo.InvariantCulture)"></p>

                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Sex)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Remark)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Dzongkhag)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.SceneOfDeath)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.PoliceStation)/@Html.DisplayFor(modelItem => item.PoliceCaseNo)
                </td>

                <td>
                    @Html.DisplayFor(modelItem => item.PlaceOfExamination)
                </td>

                <td>
                    @Html.DisplayFor(modelItem => item.InformantRelationToDeceased)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.InformantName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ImformantCidNo)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.History)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.GeneralExternalInformation)
                </td>

                <td>
                    @Html.DisplayFor(modelItem => item.DeceasedName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.DateOfPostmortemExamination)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.CidOrPassport)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Age)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Address)
                </td>
                <td>
                    @Html.CheckBox("isactive", item.Isactive, htmlAttributes: new { @disabled = "disabled" })
                </td>


                <td>
                    @Html.DisplayFor(modelItem => item.Nationality)
                </td>
                <td>

                    <p data-momentdate="@item.Lastchanged.Value.ToString("s", System.Globalization.CultureInfo.InvariantCulture)"></p>

                </td>

                <td>
                    <a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
                    <a asp-action="Details" asp-route-id="@item.Id">Details</a> |
                    <a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
                </td>
            </tr>
        }
    </tbody>
</table>

<script>
    $(function () {
        $('[data-momentdate]').each(function () {
            var d = moment($(this).attr('data-momentdate'));

            $(this).html(d.format('lll'));
        });

        $('[data-momentdate2]').each(function () {
            var d = moment($(this).attr('data-momentdate2'));

            $(this).html(d.format('HH:mm'));
        });
    });
</script>


