switch from ownCloud to minIO

buttons in table are buttons and do edit and delete properly
This commit is contained in:
2025-07-29 18:51:09 +03:00
parent 4603953458
commit c1183c22ea
40 changed files with 1263 additions and 241 deletions
+3 -44
View File
@@ -1,46 +1,5 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Line Operator Dashboard | Container Depot</title>
<link rel="stylesheet" href="{% static 'styles/tables.css' %}">
<link rel="stylesheet" href="{% static 'styles/forms.css' %}">
<link rel="stylesheet" href="{% static 'styles/sidebar.css' %}">
<link rel="stylesheet" href="{% static 'styles/base.css' %}">
<link rel="stylesheet" href="{% static 'styles/dashboard-content.css' %}">
</head>
{% extends "common/base.html" %}
<body>
<aside class="sidebar">
{% block aside %}
{% include 'client-sidebar.html' %}
</aside>
<main class="content-area">
<div class="content">
{% block content %}
{% endblock content %}
</div>
</main>
{% block custom_styles %}
{% endblock custom_styles %}
{% block extra_js %}
<script>
const validateContainerUrl = "{% url 'validate_container' 'placeholder' %}".replace('placeholder/', '');
</script>
<script src="{% static 'js/container_validation.js' %}"></script>
{% endblock extra_js %}
{% block crud_js %}
{% endblock crud_js %}
</body>
</html>
{% endblock aside %}
+8 -3
View File
@@ -31,7 +31,12 @@
{% endblock %}
{% block buttons %}
<a href="{% url 'client_booking_create' %}" class="btn btn-primary">Create Preinfo</a>
<a href="#" id="editBtn" data-url="{% url 'client_booking_update' pk=0 %}" class="btn btn-primary" disabled>Edit Preinfo</a>
<button id="deleteButton" class="btn btn-danger">Delete Preinfo</button>
{# <a href="{% url 'client_booking_create' %}" class="btn btn-primary">Create booking</a>#}
{# <a href="#" id="editBtn" data-url="{% url 'client_booking_update' pk=0 %}" class="btn btn-primary" disabled>Edit Preinfo</a>#}
{# <button id="deleteButton" class="btn btn-danger">Delete Preinfo</button>#}
{# #}
<button class="btn btn-primary" type="button" onclick="window.location.href='{% url 'client_booking_create' %}'">Create booking</button>
<button class="btn btn-primary" type="button" id="editBtn" data-url="{% url 'client_booking_update' pk=0 %}" data-requires-selection disabled>Edit booking</button>
<button class="btn btn-primary" type="button" id="deleteBtn" data-url="{% url 'client_booking_active' pk=0 %}" data-requires-selection disabled>Delete booking</button>
{% endblock buttons %}
+7 -10
View File
@@ -15,15 +15,12 @@
{% endblock %}
{% block buttons %}
<a href="{% url 'client_line_create' %}" class="btn btn-primary">Create line</a>
<a href="#" id="editBtn" data-url="{% url 'client_line_update' pk=0 %}" class="btn btn-primary" disabled>Edit Preinfo</a>
<button id="deleteButton" class="btn btn-danger">Delete Preinfo</button>
{# <a href="{% url 'client_line_create' %}" class="btn btn-primary">Create line</a>#}
{# <a href="#" id="editBtn" data-url="{% url 'client_line_update' pk=0 %}" class="btn btn-primary" disabled>Edit Preinfo</a>#}
{# <button id="deleteButton" class="btn btn-danger">Delete Preinfo</button>#}
<button class="btn btn-primary" type="button" onclick="window.location.href='{% url 'client_line_create' %}'">Create line</button>
<button class="btn btn-primary" type="button" id="editBtn" data-url="{% url 'client_line_update' pk=0 %}" data-requires-selection disabled>Edit line</button>
<button class="btn btn-primary" type="button" id="deleteBtn" data-url="{% url 'client_line_active' pk=0 %}" data-requires-selection disabled>Delete line</button>
{% endblock buttons %}
{% block create_modal_header %}
<h2>Create line</h2>
{% endblock %}
{% block modal_header %}
<h2>edit line</h2>
{% endblock modal_header %}
+10 -3
View File
@@ -1,6 +1,10 @@
{% extends 'list-crud.html' %}
{% load static %}
{% block filter %}
{% endblock filter %}
{% block table_header %}
<th style="display: none;">Select</th>
<th>Preinfo №</th>
@@ -23,9 +27,12 @@
{% endblock %}
{% block buttons %}
<a href="{% url 'client_preinfo_create' %}" class="btn btn-primary">Create Preinfo</a>
<a href="#" id="editBtn" data-url="{% url 'client_preinfo_update' pk=0 %}" class="btn btn-primary" disabled>Edit Preinfo</a>
<button id="deleteButton" class="btn btn-danger">Delete Preinfo</button>
{# <a href="{% url 'client_preinfo_create' %}" class="btn btn-primary">Create Preinfo</a>#}
{# <a href="#" id="editBtn" data-url="{% url 'client_preinfo_update' pk=0 %}" class="btn btn-primary" disabled>Edit Preinfo</a> #}
{# <button id="deleteButton" class="btn btn-danger">Delete Preinfo</button>#}
<button class="btn btn-primary" type="button" onclick="window.location.href='{% url 'client_preinfo_create' %}'">Create Preinfo</button>
<button class="btn btn-primary" type="button" id="deleteBtn" data-url="{% url 'client_preinfo_delete' pk=0 %}" data-requires-selection disabled>Delete Preinfo</button>
{% endblock buttons %}
{% block create_modal_header %}
+48
View File
@@ -0,0 +1,48 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Line Operator Dashboard | Container Depot</title>
<link rel="stylesheet" href="{% static 'styles/tables.css' %}">
<link rel="stylesheet" href="{% static 'styles/forms.css' %}">
<link rel="stylesheet" href="{% static 'styles/sidebar.css' %}">
<link rel="stylesheet" href="{% static 'styles/base.css' %}">
<link rel="stylesheet" href="{% static 'styles/dashboard-content.css' %}">
{% block extra_styles %}
{% endblock extra_styles %}
</head>
<body>
<aside class="sidebar">
{% block aside %}
{% endblock aside %}
</aside>
<main class="content-area">
<div class="content">
{% block content_header %}
{% endblock content_header%}
{% block content %}
{% endblock content %}
{% block content_footer %}
{% endblock content_footer%}
</div>
</main>
{% block custom_styles %}
{% endblock custom_styles %}
{% block extra_js %}
<script>
const validateContainerUrl = "{% url 'validate_container' 'placeholder' %}".replace('placeholder/', '');
</script>
<script src="{% static 'js/container_validation.js' %}"></script>
{% endblock extra_js %}
</body>
</html>
+303
View File
@@ -0,0 +1,303 @@
{% extends 'list-crud.html' %}
{% load static %}
{% block extra_styles %}
<link rel="stylesheet" href="{% static 'styles/details.css' %}">
<style>
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.9);
}
.modal-content {
position: relative;
margin: auto;
padding: 20px;
width: 90%;
max-width: 1200px;
height: 90vh;
display: flex;
flex-direction: column;
}
.close-modal {
color: #fff;
position: absolute;
right: 25px;
top: 10px;
font-size: 35px;
cursor: pointer;
}
.gallery-item iframe {
width: 100%;
height: 100%;
border: none;
background: white;
}
.gallery-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 1rem;
padding: 1rem;
overflow-y: auto;
background: rgba(255, 255, 255, 0.1);
border-radius: 8px;
}
.gallery-item {
position: relative;
aspect-ratio: 1;
background: white;
border-radius: 4px;
overflow: hidden;
}
.gallery-item img {
width: 100%;
height: 100%;
object-fit: contain;
background: white;
}
.photo-list {
display: flex;
flex-direction: column;
gap: 1rem;
padding: 1rem;
background: rgba(255, 255, 255, 0.1);
border-radius: 8px;
}
.photo-link {
background: #E1C6A8;
padding: 1rem;
border-radius: 4px;
text-decoration: none;
color: #000;
display: flex;
align-items: center;
justify-content: space-between;
}
.photo-link:hover {
background: #d4b08c;
}
</style>
{% endblock %}
{% block content_header %}
<div class="search-card">
<div class="search-body">
<form method="post">
{% csrf_token %}
<div class="search-group">
{{ form.container_number }}
<div class="search-button">
<button type="submit" class="btn-primary">Search</button>
</div>
</div>
</form>
</div>
</div>
{% if show_results and container %}
<div class="details-card">
<div class="card-header">
<h5>Container Details</h5>
{% if container.photos.exists %}
<button type="button" class="btn-primary" onclick="openGallery()">
<i class="fas fa-images"></i> View Photos
</button>
{% endif %}
</div>
<div class="details-body">
<div class="details-grid">
<div class="details-column">
<div class="detail-row">
<div class="detail-label">Container Type:</div>
<div class="detail-value">{{ container.container_type }}</div>
</div>
<div class="detail-row">
<div class="detail-label">Line:</div>
<div class="detail-value">{{ container.line }}</div>
</div>
<div class="detail-row">
<div class="detail-label">Preinfo:</div>
<div class="detail-value">{{ container.preinfo }}</div>
</div>
<div class="detail-row">
<div class="detail-label">Received On:</div>
<div class="detail-value">{{ container.received_on|date:"Y-m-d H:i" }}</div>
</div>
<div class="detail-row">
<div class="detail-label">Receive Vehicle:</div>
<div class="detail-value">{{ container.receive_vehicle }}</div>
</div>
</div>
<div class="details-column">
<div class="detail-row">
<div class="detail-label">Swept:</div>
<div class="detail-value">{{ container.swept|yesno:"Yes,No" }}</div>
</div>
<div class="detail-row">
<div class="detail-label">Washed:</div>
<div class="detail-value">{{ container.washed|yesno:"Yes,No" }}</div>
</div>
<div class="detail-row">
<div class="detail-label">Booking:</div>
<div class="detail-value">
{% if container.booking %}
{{ container.booking.name }}
{% else %}
-
{% endif %}
</div>
</div>
<div class="detail-row">
<div class="detail-label">Expedited On:</div>
<div class="detail-value">{{ container.expedited_on|date:"Y-m-d H:i"|default:"-" }}</div>
</div>
<div class="detail-row">
<div class="detail-label">Expedition Vehicle:</div>
<div class="detail-value">{{ container.expedition_vehicle|default:"-" }}</div>
</div>
<div class="detail-row">
<div class="detail-label">Damages:</div>
<div class="detail-value">{{ container.damages|default:"-" }}</div>
</div>
<div class="detail-row">
<div class="detail-label">Heavy Damaged:</div>
<div class="detail-value">{{ container.heavy_damaged|yesno:"Yes,No" }}</div>
</div>
</div>
</div>
</div>
</div>
<div id="galleryModal" class="modal">
<div class="modal-content">
<span class="close-modal" onclick="closeGallery()">&times;</span>
<h3 style="color: white; margin-bottom: 1rem;">Photos for Container {{ container.number }}</h3>
<div class="gallery-grid">
</div>
</div>
</div>
{% endif %}
{% endblock content_header %}
{% block table_header %}
<th style="display: none;">Select</th>
<th>Company name</th>
<th>Company short name</th>
<th>Description</th>
{% endblock table_header %}
{% block table_data %}
<td>{{ object.number }}</td>
<td>{{ object.number }}</td>
<td>{{ object.number }}</td>
{% endblock %}
{% block buttons %}
{% endblock buttons %}
{% block crud_js %}
<script src="{% static 'js/container-details.js' %}"></script>
<script>
function loadPhotos(containerId) {
const photoGrid = document.querySelector('.gallery-grid');
photoGrid.innerHTML = '<div class="loading">Loading photos...</div>';
fetch(`/api/damages/${containerId}/`)
.then(response => response.json())
.then(data => {
photoGrid.innerHTML = '';
if (data.length === 0) {
photoGrid.innerHTML = '<div style="color: white;">No photos available</div>';
return;
}
data.forEach(photo => {
const photoDiv = document.createElement('div');
photoDiv.className = 'gallery-item';
const img = document.createElement('img');
img.src = photo.url; // Use the presigned URL directly
img.alt = `Container photo`;
img.onerror = function() {
console.error('Failed to load image:', img.src);
this.style.display = 'none';
photoDiv.innerHTML += '<div style="color: red;">Failed to load image</div>';
};
photoDiv.appendChild(img);
photoGrid.appendChild(photoDiv);
});
})
.catch(error => {
console.error('Error loading photos:', error);
photoGrid.innerHTML = '<div style="color: white;">Error loading photos</div>';
});
}
function openGallery() {
const container = {{ container.id|default:'null' }};
if (container) {
loadPhotos(container);
}
document.getElementById('galleryModal').style.display = 'block';
document.body.style.overflow = 'hidden';
}
function closeGallery() {
document.getElementById('galleryModal').style.display = 'none';
document.body.style.overflow = 'auto';
document.querySelector('.gallery-grid').innerHTML = '';
}
// Close modal when clicking outside
window.onclick = function(event) {
const modal = document.getElementById('galleryModal');
if (event.target === modal) {
closeGallery();
}
}
// Close modal on escape key
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
closeGallery();
}
});
// Add loading indicator styles
const style = document.createElement('style');
style.textContent = `
.loading {
color: white;
text-align: center;
padding: 2rem;
}
`;
document.head.appendChild(style);
</script>
{% endblock %}
+3 -36
View File
@@ -1,38 +1,5 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Depot Employee Dashboard | Container Depot</title>
<link rel="stylesheet" href="{% static 'styles/tables.css' %}">
<link rel="stylesheet" href="{% static 'styles/forms.css' %}">
<link rel="stylesheet" href="{% static 'styles/sidebar.css' %}">
<link rel="stylesheet" href="{% static 'styles/base.css' %}">
<link rel="stylesheet" href="{% static 'styles/dashboard-content.css' %}">
</head>
{% extends "common/base.html" %}
<body>
<aside class="sidebar">
{% block aside %}
{% include 'employee-sidebar.html' %}
</aside>
<main class="content-area">
<div class="content">
{% block content %}
{% endblock content %}
</div>
</main>
{% block extra_js %}
<script>
const validateContainerUrl = "{% url 'validate_container' 'placeholder' %}".replace('placeholder/', '');
</script>
<script src="{% static 'js/container_validation.js' %}"></script>
{% endblock %}
</body>
</html>
{% endblock aside %}
+7
View File
@@ -6,6 +6,7 @@
</div>
{% url 'employee_dashboard' as dashboard_url %}
{% url 'employee_containers' as employee_containers_url %}
{% url 'container_details' as container_details_url %}
{% url 'employee_bookings' as employee_bookings_url %}
{% url 'employee_preinfo' as employee_preinfo_url %}
{% url 'register' as register_url %}
@@ -28,6 +29,12 @@
</svg>
Containers
</a>
<a href="{{ container_details_url }}" class="nav-item {% if request.path == container_details_url %}active{% endif %}" id="preinfoNav">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />
</svg>
Container details
</a>
<a href="{{ employee_preinfo_url }}" class="nav-item {% if request.path == employee_preinfo_url %}active{% endif %}" id="preinfoNav">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />
+5 -9
View File
@@ -1,4 +1,5 @@
{% extends 'list-crud.html' %}
{% load custom_filters %}
{% load static %}
{% block table_header %}
@@ -13,6 +14,7 @@
<th>Vehicles left</th>
<th>Created on</th>
<th>Created by</th>
<th>Status</th>
{% endblock table_header %}
{% block table_data %}
@@ -22,10 +24,11 @@
<td>{{ object.container_number }}</td>
<td>{{ object.container_count }}</td>
<td>{{ object.containers_left }}</td>
<td>{{ object.vehicles }}</td>
<td>{{ object.vehicles_left }}</td>
<td>{{ object.vehicles|distinct_vehicles }}</td>
<td>{{ object.vehicles_left|distinct_vehicles }}</td>
<td>{{ object.created_on }}</td>
<td>{{ object.created_by.username }}</td>
<td>{{ object.status }}</td>
{% endblock %}
{% block buttons %}
@@ -34,10 +37,3 @@
{# <button id="deleteButton" class="btn btn-danger">Delete Preinfo</button>#}
{% endblock buttons %}
{% block create_modal_header %}
<h2>Create Booking</h2>
{% endblock %}
{% block modal_header %}
<h2>Edit Booking</h2>
{% endblock modal_header %}
+8 -3
View File
@@ -15,9 +15,14 @@
{% endblock %}
{% block buttons %}
<a href="{% url 'employee_company_create' %}" class="btn btn-primary">Create company</a>
<a href="#" id="editBtn" data-url="{% url 'employee_company_update' pk=0 %}" class="btn btn-primary" disabled>Edit Preinfo</a>
<button id="deleteButton" class="btn btn-danger">Delete Preinfo</button>
{# <a href="{% url 'employee_company_create' %}" class="btn btn-primary">Create company</a>#}
{# <a href="#" id="editBtn" data-url="{% url 'employee_company_update' pk=0 %}" class="btn btn-primary" disabled>Edit Preinfo</a>#}
{# <button id="deleteButton" class="btn btn-danger">Delete company</button>#}
<button class="btn btn-primary" type="button" onclick="window.location.href='{% url 'employee_company_create' %}'">Create company</button>
<button class="btn btn-primary" type="button" id="editBtn" data-url="{% url 'employee_company_update' pk=0 %}" data-requires-selection disabled>Edit company</button>
<button class="btn btn-primary" type="button" id="deleteBtn" data-url="{% url 'employee_company_active' pk=0 %}" data-requires-selection disabled>Delete company</button>
{% endblock buttons %}
{% block create_modal_header %}
+8 -3
View File
@@ -17,9 +17,14 @@
{% endblock %}
{% block buttons %}
<a href="{% url 'employee_line_create' %}" class="btn btn-primary">Create line</a>
<a href="#" id="editBtn" data-url="{% url 'employee_line_update' pk=0 %}" class="btn btn-primary" disabled>Edit Preinfo</a>
<button id="deleteButton" class="btn btn-danger">Delete Preinfo</button>
{# <a href="{% url 'employee_line_create' %}" class="btn btn-primary">Create line</a>#}
{# <a href="#" id="editBtn" data-url="{% url 'employee_line_update' pk=0 %}" class="btn btn-primary" disabled>Edit Preinfo</a>#}
{# <button id="deleteButton" class="btn btn-danger">Delete Preinfo</button>#}
<button class="btn btn-primary" type="button" onclick="window.location.href='{% url 'employee_line_create' %}'">Create line</button>
<button class="btn btn-primary" type="button" id="editBtn" data-url="{% url 'employee_line_update' pk=0 %}" data-requires-selection disabled>Edit line</button>
<button class="btn btn-primary" type="button" id="deleteBtn" data-url="{% url 'employee_line_active' pk=0 %}" data-requires-selection disabled>Delete line</button>
{% endblock buttons %}
{% block create_modal_header %}
+2 -3
View File
@@ -9,6 +9,7 @@
<th>Line</th>
<th>Created on</th>
<th>Created by</th>
<th>Status</th>
{% endblock table_header %}
{% block table_data %}
@@ -18,8 +19,6 @@
<td>{{ object.line.short_name }}</td>
<td>{{ object.created_on }}</td>
<td>{{ object.created_by.username }}</td>
<td>{{ object.received|yesno:"Received,Pending" }}</td>
{% endblock %}
{% block modal_header %}
<h2>Edit Preinfo</h2>
{% endblock modal_header %}
+15 -20
View File
@@ -128,27 +128,22 @@ header {
&copy; 2025 Kikimor EOOD | K-DepoT - All rights reserved.
</footer>
<script>
function initMap() {
const map = new google.maps.Map(document.getElementById("map"), {
center: { lat: 43.2121, lng: 27.9204 },
zoom: 15
});
new google.maps.Marker({
position: { lat: 43.2121, lng: 27.9204 },
map: map,
title: "K-DepoT - Kikimor EOOD"
});
}
</script>
<script
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBboGDgiCrc9yp2uSLmVcfVVIVK-kOQqc4&callback=initMap"
async
defer>
</script>
<script>
function initMap() {
const depot = { lat: 43.2121, lng: 27.9204 };
const map = new google.maps.Map(document.getElementById('map'), {
zoom: 15,
center: depot,
});
const marker = new google.maps.Marker({
position: depot,
map: map,
title: 'K-DepoT'
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBboGDgiCrc9yp2uSLmVcfVVIVK-kOQqc4&callback=initMap" async defer></script>
</body>
</html>
+45
View File
@@ -83,6 +83,51 @@
<script src="{% static 'js/crud-list.js' %}"></script>
{% endblock crud_js %}
<div id="deleteModal" class="modal" style="display: none;">
<div class="modal-content">
<h3>Confirm Delete</h3>
<p>Are you sure you want to delete this item?</p>
<div class="modal-buttons">
<button class="btn btn-secondary" id="cancelDelete">Cancel</button>
<button class="btn btn-danger" id="confirmDelete">Delete</button>
</div>
</div>
</div>
{% block modal_styles %}
<style>
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1000;
}
.modal-content {
position: relative;
background-color: #EDDECB;
margin: 15% auto;
padding: 20px;
border: 1px solid #a57d52;
border-radius: 8px;
width: 80%;
max-width: 500px;
}
.modal-buttons {
display: flex;
justify-content: flex-end;
gap: 10px;
margin-top: 20px;
}
</style>
{% endblock modal_styles %}
{% endblock content %}
+6 -3
View File
@@ -24,9 +24,12 @@
{% endblock %}
{% block buttons %}
<a href="{% url 'user_register' %}" class="btn btn-primary" type="button">Create user</a>
<a href="#" id="editBtn" data-url="{% url 'user_update' pk=0 %}" class="btn btn-primary" type="button" disabled>Edit user</a>
<button id="deleteButton" class="btn btn-danger">Delete user</button>
{# <a href="{% url 'user_register' %}" class="btn btn-primary" type="button">Create user</a>#}
{# <a href="#" id="editBtn" data-url="{% url 'user_update' pk=0 %}" class="btn btn-primary" type="button" disabled>Edit user</a>#}
{# <button id="deleteButton" class="btn btn-danger">Delete user</button>#}
<button class="btn btn-primary" type="button" onclick="window.location.href='{% url 'user_register' %}'">Create user</button>
<button class="btn btn-primary" type="button" id="editBtn" data-url="{% url 'user_update' pk=0 %}" data-requires-selection disabled>Edit user</button>
<button class="btn btn-primary" type="button" id="deleteBtn" data-url="{% url 'user_active' pk=0 %}" data-requires-selection disabled>Delete user</button>
{% endblock buttons %}
{% block create_modal_header %}