|
@@ -125,10 +125,9 @@
|
|
text-align: left;
|
|
text-align: left;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
.orders-header {
|
|
.orders-header {
|
|
display: grid;
|
|
display: grid;
|
|
- grid-template-columns: 1fr 305px 184px;
|
|
|
|
|
|
+ grid-template-columns: 1fr 305px 184px 40px;
|
|
margin-bottom: 15px;
|
|
margin-bottom: 15px;
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
font-weight: normal;
|
|
font-weight: normal;
|
|
@@ -142,7 +141,6 @@
|
|
display: grid;
|
|
display: grid;
|
|
gap: 15px;
|
|
gap: 15px;
|
|
width: 100%;
|
|
width: 100%;
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
.order-card {
|
|
.order-card {
|
|
@@ -150,13 +148,14 @@
|
|
border-radius: 8px;
|
|
border-radius: 8px;
|
|
padding: 15px;
|
|
padding: 15px;
|
|
display: grid;
|
|
display: grid;
|
|
- grid-template-columns: 1fr 305px 184px;
|
|
|
|
|
|
+ grid-template-columns: 1fr 305px 184px 40px;
|
|
gap: 15px;
|
|
gap: 15px;
|
|
align-items: center;
|
|
align-items: center;
|
|
}
|
|
}
|
|
|
|
+
|
|
.order-card:last-child {
|
|
.order-card:last-child {
|
|
- border-bottom: none;
|
|
|
|
-}
|
|
|
|
|
|
+ border-bottom: none;
|
|
|
|
+ }
|
|
|
|
|
|
.order-title {
|
|
.order-title {
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
@@ -202,6 +201,25 @@
|
|
justify-content: center;
|
|
justify-content: center;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ .delete-button {
|
|
|
|
+ background-color: #FF6464;
|
|
|
|
+ color: white;
|
|
|
|
+ width: 40px;
|
|
|
|
+ height: 40px;
|
|
|
|
+ border-radius: 50%;
|
|
|
|
+ font-size: 20px;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ border: none;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .delete-button:hover {
|
|
|
|
+ background-color: #e05555;
|
|
|
|
+ }
|
|
|
|
+
|
|
.history-button-container {
|
|
.history-button-container {
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
justify-content: flex-end;
|
|
@@ -224,6 +242,7 @@
|
|
justify-content: center;
|
|
justify-content: center;
|
|
text-decoration: none;
|
|
text-decoration: none;
|
|
}
|
|
}
|
|
|
|
+
|
|
.footer {
|
|
.footer {
|
|
margin-top: 40px;
|
|
margin-top: 40px;
|
|
text-align: center;
|
|
text-align: center;
|
|
@@ -272,27 +291,27 @@
|
|
<div>Название</div>
|
|
<div>Название</div>
|
|
<div>Прогресс</div>
|
|
<div>Прогресс</div>
|
|
<div></div>
|
|
<div></div>
|
|
|
|
+ <div></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="orders-grid">
|
|
<div class="orders-grid">
|
|
-
|
|
|
|
<div class="order-card">
|
|
<div class="order-card">
|
|
<div class="order-title">Тревелблог про Чикаго</div>
|
|
<div class="order-title">Тревелблог про Чикаго</div>
|
|
<div class="order-status status-accepted">Принят</div>
|
|
<div class="order-status status-accepted">Принят</div>
|
|
<button class="details-button">Подробнее</button>
|
|
<button class="details-button">Подробнее</button>
|
|
|
|
+ <button class="delete-button">×</button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
-
|
|
|
|
<div class="order-card">
|
|
<div class="order-card">
|
|
<div class="order-title">Видеоролик "Культурные различия Китая и России"</div>
|
|
<div class="order-title">Видеоролик "Культурные различия Китая и России"</div>
|
|
<div class="order-status status-in-progress">В процессе...</div>
|
|
<div class="order-status status-in-progress">В процессе...</div>
|
|
<button class="details-button">Подробнее</button>
|
|
<button class="details-button">Подробнее</button>
|
|
|
|
+ <button class="delete-button">×</button>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="history-button-container">
|
|
<div class="history-button-container">
|
|
- <a href="order-history.html" class="history-button">Добавить заказ</a>
|
|
|
|
|
|
+ <a href="add-order-customer.html" class="history-button">Добавить заказ</a>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
@@ -300,4 +319,95 @@
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</body>
|
|
|
|
+<script>
|
|
|
|
+ let orders = [];
|
|
|
|
+
|
|
|
|
+ function generateId() {
|
|
|
|
+ return Math.floor(Math.random() * 1000000);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function initializeOrders() {
|
|
|
|
+ const savedOrders = JSON.parse(localStorage.getItem('orders'));
|
|
|
|
+
|
|
|
|
+ if (!savedOrders || savedOrders.length === 0) {
|
|
|
|
+ orders = [
|
|
|
|
+ { id: generateId(), title: "Тревелблог про Чикаго", status: "Принят" },
|
|
|
|
+ { id: generateId(), title: "Видеоролик \"Культурные различия Китая и России\"", status: "В процессе..." }
|
|
|
|
+ ];
|
|
|
|
+ localStorage.setItem('orders', JSON.stringify(orders));
|
|
|
|
+ } else {
|
|
|
|
+ orders = savedOrders;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function renderOrders() {
|
|
|
|
+ const ordersGrid = document.querySelector('.orders-grid');
|
|
|
|
+ const ordersCount = document.querySelector('.orders-count');
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ while (ordersGrid.children.length > 1) {
|
|
|
|
+ ordersGrid.removeChild(ordersGrid.lastChild);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ orders.forEach(order => {
|
|
|
|
+ const orderCard = document.createElement('div');
|
|
|
|
+ orderCard.className = 'order-card';
|
|
|
|
+ orderCard.dataset.id = order.id; // Добавляем ID в data-атрибут карточки
|
|
|
|
+ orderCard.innerHTML = `
|
|
|
|
+ <div class="order-title">${order.title || 'Без названия'}</div>
|
|
|
|
+ <div class="order-status ${getStatusClass(order.status)}">${order.status || 'Принят'}</div>
|
|
|
|
+ <button class="details-button">Подробнее</button>
|
|
|
|
+ <button class="delete-button" data-id="${order.id}">×</button>
|
|
|
|
+ `;
|
|
|
|
+ ordersGrid.appendChild(orderCard);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ ordersCount.textContent = `Всего: ${orders.length}`;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function getStatusClass(status) {
|
|
|
|
+ if (status.includes("процесс")) return "status-in-progress";
|
|
|
|
+ return "status-accepted";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //удаление
|
|
|
|
+ function deleteOrder(id) {
|
|
|
|
+ const initialLength = orders.length;
|
|
|
|
+ orders = orders.filter(order => order.id !== id);
|
|
|
|
+
|
|
|
|
+ if (orders.length < initialLength) {
|
|
|
|
+ localStorage.setItem('orders', JSON.stringify(orders));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ const cardToRemove = document.querySelector(`.order-card[data-id="${id}"]`);
|
|
|
|
+ if (cardToRemove) {
|
|
|
|
+ cardToRemove.remove();
|
|
|
|
+ document.querySelector('.orders-count').textContent = `Всего: ${orders.length}`;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ alert('Не удалось найти заказ для удаления');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
+ initializeOrders();
|
|
|
|
+ renderOrders();
|
|
|
|
+
|
|
|
|
+ //"добавить заказ"
|
|
|
|
+ document.querySelector('.history-button').addEventListener('click', function(e) {
|
|
|
|
+ e.preventDefault();
|
|
|
|
+ window.location.href = 'add-order-customer.html';
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ document.addEventListener('click', function(e) {
|
|
|
|
+ if (e.target.classList.contains('delete-button')) {
|
|
|
|
+ const orderId = parseInt(e.target.getAttribute('data-id'));
|
|
|
|
+ if (confirm('Вы точно хотите удалить этот заказ?')) {
|
|
|
|
+ deleteOrder(orderId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+</script>
|
|
|
|
+</html>
|
|
</html>
|
|
</html>
|