/
ProjectX
/
01
Обзор
Документация
Войти
/
ProjectX
/
01
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
new_file
258 строк
11 KB
ProjectX
create: new_file
08 май 2026, 23:15
Верифицирован
08 май 2026, 23:15
0386e37
Код
Авторство
О чём код?
```html <!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Биржа труда</title> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 20px; background-color: #f0f0f0; } header { background-color: #333; color: white; padding: 10px 20px; text-align: center; margin-bottom: 20px; } .container { max-width: 1200px; margin: 0 auto; } .section { background-color: white; padding: 20px; margin-bottom: 20px; border-radius: 5px; box-shadow: 0 0 10px rgba(0,0,0,0.1); } .form-group { margin-bottom: 15px; } label { display: block; margin-bottom: 5px; } input, textarea { width: 100%; padding: 8px; box-sizing: border-box; } button { background-color: #4CAF50; color: white; padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; } button:hover { background-color: #45a049; } .order-list { display: grid; gap: 20px; } .order-item { border: 1px solid #ddd; padding: 15px; border-radius: 5px; } .sort-buttons { margin-bottom: 20px; } </style> </head> <body> <header> <h1>Биржа труда</h1> </header> <div class="container"> <!-- Форма для создания заказа (для заказчика) --> <div class="section"> <h2>Создать заказ</h2> <div class="form-group"> <label for="orderTitle">Название заказа:</label> <input type="text" id="orderTitle" placeholder="Введите название"> </div> <div class="form-group"> <label for="orderDescription">Техническое задание:</label> <textarea id="orderDescription" rows="5" placeholder="Опишите задание"></textarea> </div> <div class="form-group"> <label for="orderDeadline">Срок выполнения (дата):</label> <input type="date" id="orderDeadline"> </div> <div class="form-group"> <label for="orderSearchTime">Время поиска исполнителя (часы):</label> <input type="number" id="orderSearchTime" min="1" placeholder="Введите количество часов"> </div> <div class="form-group"> <label for="orderMaxPrice">Максимальная цена (руб.):</label> <input type="number" id="orderMaxPrice" min="1" placeholder="Введите максимальную цену"> </div> <button onclick="createOrder()">Создать заказ</button> </div> <!-- Список заказов с сортировкой --> <div class="section"> <h2>Доступные заказы</h2> <div class="sort-buttons"> <button onclick="sortOrders('deadline')">Сортировать по сроку</button> <button onclick="sortOrders('price')">Сортировать по цене</button> </div> <div id="orderList" class="order-list"></div> </div> <!-- Форма для отправки предложения (для подрядчика) --> <div class="section"> <h2>Отправить предложение</h2> <div class="form-group"> <label for="proposalOrderId">ID заказа:</label> <input type="number" id="proposalOrderId" placeholder="Введите ID заказа"> </div> <div class="form-group"> <label for="proposalPrice">Ваша цена (руб.):</label> <input type="number" id="proposalPrice" min="1" placeholder="Введите вашу цену"> </div> <button onclick="sendProposal()">Отправить предложение</button> </div> <!-- Оценка подрядчика --> <div class="section"> <h2>Оценить подрядчика</h2> <div class="form-group"> <label for="contractorId">ID подрядчика:</label> <input type="number" id="contractorId" placeholder="Введите ID подрядчика"> </div> <div class="form-group"> <label for="rating">Оценка (1-5):</label> <input type="number" id="rating" min="1" max="5" placeholder="Оцените от 1 до 5"> </div> <button onclick="rateContractor()">Оценить</button> </div> </div> <script> // Имитация базы данных (в реальном проекте это будет сервер и БД) let orders = []; let contractors = [ { id: 1, name: "Подрядчик 1", rating: 0, totalRatings: 0, countRatings: 0 }, { id: 2, name: "Подрядчик 2", rating: 0, totalRatings: 0, countRatings: 0 } ]; let proposals = []; // Создание заказа function createOrder() { const title = document.getElementById('orderTitle').value; const description = document.getElementById('orderDescription').value; const deadline = document.getElementById('orderDeadline').value; const searchTime = document.getElementById('orderSearchTime').value; const maxPrice = parseFloat(document.getElementById('orderMaxPrice').value); if (title && description && deadline && searchTime && maxPrice) { const order = { id: orders.length + 1, title, description, deadline, searchTime, maxPrice, proposals: [] }; orders.push(order); alert(`Заказ #${order.id} создан!`); clearOrderForm(); displayOrders(); } else { alert('Заполните все поля!'); } } // Очистка формы создания заказа function clearOrderForm() { document.getElementById('orderTitle').value = ''; document.getElementById('orderDescription').value = ''; document.getElementById('orderDeadline').value = ''; document.getElementById('orderSearchTime').value = ''; document.getElementById('orderMaxPrice').value = ''; } // Отображение списка заказов function displayOrders() { const orderList = document.getElementById('orderList'); orderList.innerHTML = ''; orders.forEach(order => { const orderItem = document.createElement('div'); orderItem.className = 'order-item'; orderItem.innerHTML = ` <h3>Заказ #${order.id}: ${order.title}</h3> <p>Описание: ${order.description}</p> <p>Срок выполнения: ${order.deadline}</p> <p>Время поиска: ${order.searchTime} часов</p> <p>Макс. цена: ${order.maxPrice} руб.</p> <p>Предложения: ${order.proposals.length > 0 ? order.proposals.map(p => `Цена: ${p.price} руб. (Подрядчик ${p.contractorId})`).join('<br>') : 'Нет предложений'}</p> `; orderList.appendChild(orderItem); }); } // Сортировка заказов function sortOrders(criteria) { if (criteria === 'deadline') { orders.sort((a, b) => new Date(a.deadline) - new Date(b.deadline)); } else if (criteria === 'price') { orders.sort((a, b) => a.maxPrice - b.maxPrice); } displayOrders(); } // Отправка предложения подрядчиком function sendProposal() { const orderId = parseInt(document.getElementById('proposalOrderId').value); const price = parseFloat(document.getElementById('proposalPrice').value); const contractorId = 1; // Имитация текущего подрядчика (в реальном проекте будет авторизация) const order = orders.find(o => o.id === orderId); if (order) { if (price <= order.maxPrice) { const proposal = { contractorId, price }; order.proposals.push(proposal); proposals.push({ orderId, contractorId, price }); alert(`Предложение на заказ #${orderId} отправлено!`); document.getElementById('proposalOrderId').value = ''; document.getElementById('proposalPrice').value = ''; displayOrders(); } else { alert('Ваша цена превышает максимальную!'); } } else { alert('Заказ не найден!'); } } // Оценка подрядчика function rateContractor() { const contractorId = parseInt(document.getElementById('contractorId').value); const rating = parseInt(document.getElementById('rating').value); const contractor = contractors.find(c => c.id === contractorId); if (contractor && rating >= 1 && rating <= 5) { contractor.totalRatings += rating; contractor.countRatings += 1; contractor.rating = contractor.totalRatings / contractor.countRatings; alert(`Подрядчик #${contractorId} оценен на ${rating}. Новый рейтинг: ${contractor.rating.toFixed(1)}`); document.getElementById('contractorId').value = ''; document.getElementById('rating').value = ''; } else { alert('Неверный ID подрядчика или оценка вне диапазона 1-5!'); } } </script> </body> </html> ```