mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Cleaned redundant js from Locations view, added missing localization to Locations view
This commit is contained in:
@@ -22,10 +22,10 @@
|
||||
<data name="Location ID" xml:space="preserve">
|
||||
<value>Ort ID</value>
|
||||
</data>
|
||||
<data name="Location name" xml:space="preserve">
|
||||
<data name="Location Name" xml:space="preserve">
|
||||
<value>Ort Name</value>
|
||||
</data>
|
||||
<data name="Room number" xml:space="preserve">
|
||||
<data name="Room Number" xml:space="preserve">
|
||||
<value>Raumnummer</value>
|
||||
</data>
|
||||
<data name="Seat" xml:space="preserve">
|
||||
@@ -61,4 +61,25 @@
|
||||
<data name="Location creation failed" xml:space="preserve">
|
||||
<value>Erstellung des Ortes ist fehlgeschlagen</value>
|
||||
</data>
|
||||
<data name="Edit Location" xml:space="preserve">
|
||||
<value>Ort anpassen</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>Abbrechen</value>
|
||||
</data>
|
||||
<data name="Save changes" xml:space="preserve">
|
||||
<value>Sitzplatz</value>
|
||||
</data>
|
||||
<data name="Create" xml:space="preserve">
|
||||
<value>Erstellen</value>
|
||||
</data>
|
||||
<data name="DeleteLocationConfirmation" xml:space="preserve">
|
||||
<value>Sind Sie sich sicher, dass Sie den Ort {0} löschen möchten?</value>
|
||||
</data>
|
||||
<data name="Yes, Delete" xml:space="preserve">
|
||||
<value>Ja, löschen</value>
|
||||
</data>
|
||||
<data name="Confirm Delete" xml:space="preserve">
|
||||
<value>Löschen bestätigen</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
19
src/Resources/Views.Home.Locations.en.resx
Normal file
19
src/Resources/Views.Home.Locations.en.resx
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, ...</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, ...</value>
|
||||
</resheader>
|
||||
|
||||
<data name="DeleteLocationConfirmation" xml:space="preserve">
|
||||
<value>Are you sure you want to delete the location {0}?</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,3 +1,4 @@
|
||||
@using Microsoft.AspNetCore.Html
|
||||
@using Microsoft.AspNetCore.Mvc.Localization
|
||||
@using Berufsschule_HAM.Models
|
||||
@model LocationsIndexViewModel
|
||||
@@ -21,8 +22,8 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>@T["Location ID"]</th>
|
||||
<th>@T["Location name"]</th>
|
||||
<th>@T["Room number"]</th>
|
||||
<th>@T["Location Name"]</th>
|
||||
<th>@T["Room Number"]</th>
|
||||
<th>@T["Seat"]</th>
|
||||
<th>@T["Action"]</th>
|
||||
</tr>
|
||||
@@ -68,52 +69,24 @@
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-danger text-white">
|
||||
<h5 class="modal-title" id="deleteModalLabel">Confirm Delete</h5>
|
||||
<h5 class="modal-title" id="deleteModalLabel">@T["Confirm Delete"]</h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are you sure you want to delete the location <strong id="locationName"></strong> (ID: <span id="locationId"></span>)?</p>
|
||||
<p>
|
||||
@T["DeleteLocationConfirmation", new HtmlString("<strong id=\"locationId\"></strong>")]
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">@T["Cancel"]</button>
|
||||
<form id="deleteForm" method="post" action="">
|
||||
<button type="submit" class="btn btn-danger">Yes, Delete</button>
|
||||
<button type="submit" class="btn btn-danger">@T["Yes, Delete"]</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script defer>
|
||||
|
||||
function createToastContainer() {
|
||||
const container = document.createElement('div');
|
||||
container.id = 'toastContainer';
|
||||
container.className = 'toast-container position-fixed bottom-0 end-0 p-3';
|
||||
document.body.appendChild(container);
|
||||
return container;
|
||||
}
|
||||
|
||||
// Simple toast helper
|
||||
function showToast(message, type) {
|
||||
const toastContainer = document.getElementById('toastContainer') || createToastContainer();
|
||||
const toast = document.createElement('div');
|
||||
toast.className = `toast align-items-center text-white bg-${type} border-0`;
|
||||
toast.role = 'alert';
|
||||
toast.innerHTML = `
|
||||
<div class="d-flex">
|
||||
<div class="toast-body">${message}</div>
|
||||
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"></button>
|
||||
</div>
|
||||
`;
|
||||
toastContainer.appendChild(toast);
|
||||
const bsToast = new bootstrap.Toast(toast, { delay: 3000 });
|
||||
bsToast.show();
|
||||
toast.addEventListener('hidden.bs.toast', () => toast.remove());
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const deleteModal = document.getElementById('deleteModal');
|
||||
@@ -125,7 +98,6 @@
|
||||
const locationName = currentButton.getAttribute('data-location-name');
|
||||
|
||||
deleteModal.querySelector('#locationId').textContent = locationId;
|
||||
deleteModal.querySelector('#locationName').textContent = locationName;
|
||||
|
||||
// Store the delete URL for later use
|
||||
deleteModal.querySelector('#deleteForm').dataset.url = `/Locations/Delete?cn=${locationId}`;
|
||||
@@ -178,7 +150,7 @@
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-warning text-dark">
|
||||
<h5 class="modal-title" id="editModalLabel">Edit Location</h5>
|
||||
<h5 class="modal-title" id="editModalLabel">@T["Edit Location"]</h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form id="editForm">
|
||||
@@ -186,23 +158,23 @@
|
||||
<input type="hidden" id="editLocationId" name="LocationID">
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="editLocationName" class="form-label">Location Name</label>
|
||||
<label for="editLocationName" class="form-label">@T["Location Name"]</label>
|
||||
<input type="text" class="form-control" id="editLocationName" name="LocationName" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="editRoomNumber" class="form-label">Room Number</label>
|
||||
<label for="editRoomNumber" class="form-label">@T["Room Number"]</label>
|
||||
<input type="text" class="form-control" id="editRoomNumber" name="RoomNumber">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="editSeat" class="form-label">Seat</label>
|
||||
<label for="editSeat" class="form-label">@T["Seat"]</label>
|
||||
<input type="text" class="form-control" id="editSeat" name="Seat">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-warning">Save changes</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">@T["Cancel"]</button>
|
||||
<button type="submit" class="btn btn-warning">@T["Save changes"]</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -290,30 +262,30 @@
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-primary text-white">
|
||||
<h5 class="modal-title" id="createModalLabel">Create Location</h5>
|
||||
<h5 class="modal-title" id="createModalLabel">@T["Create location"]</h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form id="createForm">
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="createLocationName" class="form-label">Location Name</label>
|
||||
<label for="createLocationName" class="form-label">@T["Location Name"]</label>
|
||||
<input type="text" class="form-control" id="createLocationName" name="LocationName" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="createRoomNumber" class="form-label">Room Number</label>
|
||||
<label for="createRoomNumber" class="form-label">@T["Room Number"]</label>
|
||||
<input type="text" class="form-control" id="createRoomNumber" name="RoomNumber">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="createSeat" class="form-label">Seat</label>
|
||||
<label for="createSeat" class="form-label">@T["Seat"]</label>
|
||||
<input type="text" class="form-control" id="createSeat" name="Seat">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">@T["Cancel"]</button>
|
||||
<button type="submit" class="btn btn-primary">@T["Create"]</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -373,14 +345,14 @@
|
||||
data-seat="${newLoc.Seat}"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#editModal">
|
||||
Edit
|
||||
@T["Edit"]
|
||||
</button>
|
||||
<button class="btn btn-sm btn-danger btn-delete"
|
||||
data-location-id="${slugifiedLocationID}"
|
||||
data-location-name="${newLoc.Location}"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#deleteModal">
|
||||
Delete
|
||||
@T["Delete"]
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user