Files
FSI.BT.IR.Organization/scr/FSI.BT.IR.Organization.Web/Views/Home/_ViewAll.cshtml
2024-10-25 13:25:15 +02:00

150 lines
5.3 KiB
Plaintext

@using FSI.BT.IR.Organization.Db.Models
@model IEnumerable<Organization>
<table id="dtMain" class="display" style="width:100%">
<thead>
<tr>
<th>
@Html.DisplayNameFor(x => x.GetEnumerator().Current.FullShortName)
</th>
<th>
@Html.DisplayNameFor(x => x.GetEnumerator().Current.ShortName)
</th>
<th>
@Html.DisplayNameFor(x => x.GetEnumerator().Current.Name)
</th>
<th>
@Html.DisplayNameFor(x => x.GetEnumerator().Current.Description)
</th>
<th>
@Html.DisplayNameFor(x => x.GetEnumerator().Current.Type)
</th>
<th>
@Html.DisplayNameFor(x => x.GetEnumerator().Current.ParentId)
</th>
<th>
Bearbeitung
</th>
</tr>
</thead>
<tbody>
@{
foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => @item.FullShortName)
</td>
<td>
@Html.DisplayFor(modelItem => item.ShortName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@(string.IsNullOrEmpty(item.Description) ? "-" : @Html.DisplayFor(modelItem => item.Description))
</td>
<td>
@Html.DisplayFor(modelItem => @item.Type)
</td>
<td>
@Html.DisplayFor(modelItem => @item.Parent.Name) @(item.Parent == null ? "" : "(")@Html.DisplayFor(modelItem => @item.Parent.ShortName)@(item.Parent == null ? "" : ")")
</td>
<td>
<div class="btn-group" style="flex-direction:row">
<!-- bearbeiten -->
<a onclick="showInPopup('@Url.Action("AddOrEdit", "Home",new {id = item.Id}, Context.Request.Scheme)','Organisation bearbeiten')" class="btn btn-success text-white">
<i class="bi bi-pencil-square"></i>
</a>
<!-- löschen -->
<form asp-action="Delete" asp-route-id="@item.Id" onsubmit="return jQueryAjaxDelete(this)" class="d-inline">
<button type="submit" value="bi bi-trash" class="btn btn-danger text-white">
<i class="bi bi-trash"></i>
</button>
</form>
</div>
</td>
</tr>
}
}
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function () {
$("#dtMain").DataTable({
dom: "Blfrtip",
pageLength: 25,
buttons: [
{
text: "<i class='bi bi-plus-square'></i> Neu",
className: "btn-dark",
key: {
shiftKey: true,
key: 'n'
},
action: function (e, dt, node, conf) {
showInPopup("@Url.Action("AddOrEdit", "Home", new { id = 0 }, Context.Request.Scheme)", "neue Organisation erstellen");
},
},
{
extend: "spacer",
},
{
extend: "spacer",
},
"searchBuilder",
{
extend: "collection",
text: "Export",
autoClose: true,
buttons: [
{
extend: "copyHtml5",
text: "<i class='bi bi-copy'></i> kopieren",
titleAttr: "Copy"
},
{
extend: "excelHtml5",
autoFilter: true,
text: "<i class='bi bi-file-earmark-excel'></i> Excel",
titleAttr: "Excel"
},
{
extend: "csvHtml5",
text: "<i class='bi bi-filetype-csv'></i> csv-Datei",
titleAttr: "CSV"
},
{
extend: "pdfHtml5",
text: "<i class='bi bi-file-earmark-pdf'> Pdf</i>",
titleAttr: "PDF"
},
]
},
{
extend: "colvis",
collectionLayout: "fixed columns",
collectionTitle: "Column visibility control"
},
{
extend: "spacer",
},
],
lengthMenu: [
[10, 25, 50, -1],
[10, 25, 50, 'All']
]
});
});
</script>