LocalGovIMS_localgov-ims/src/Admin/Views/FundMetadata/_EditList.cshtml
@model Admin.Models.FundMetadata.ListViewModel

@if (Model.Items != null && Model.Items.Any())
{
    <div class="table-responsive">
        <table class="table table-striped table-bordered table-hover mt-2">
            <thead>
                <tr>
                    <th scope="col">
                        Description
                    </th>
                    <th scope="col">
                        Value
                    </th>
                    <th scope="col">
                        <span class="visually-hidden">Actions</span>
                    </th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.Items.OrderBy(x => x.Description))
                {
                    <tr>
                        <td>
                            @item.Description
                        </td>
                        <td>
                            @item.Value
                        </td>
                        <td class="text-end">
                            @Html.ActionLink("Edit", "Edit", "FundMetadata", new { id = item.Id }, new { @class = "btn btn-secondary" })
                            @Html.ActionLink("Delete", "Delete", "FundMetadata", new { id = item.Id, mopCode = item.ParentCode }, new { @class = "btn btn-secondary delete-action" })
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
}
else
{
    Html.RenderPartial("_NothingSpecified", "metadata");
}

<script type="text/javascript">
    $(document).ready(function () {

        $(".delete-action").on("click",
            function (e) {
                if (window.confirm("Are you sure you want to delete this piece of metadata?")) {

                } else {
                    e.preventDefault();
                    e.stopPropogation();
                    return false;
                }
            });

    });
</script>
