add customer name, service info, second pickup location, and structured address fields to deliveries
This commit is contained in:
@@ -46,7 +46,7 @@ const Dashboard = ({ onDateSelect, onAddDelivery }: DashboardProps) => {
|
||||
};
|
||||
|
||||
const printDeliveries = (date: Date, dayDeliveries: Delivery[]) => {
|
||||
|
||||
|
||||
const printWindow = window.open('', '_blank');
|
||||
if (!printWindow) return;
|
||||
|
||||
@@ -58,31 +58,35 @@ const Dashboard = ({ onDateSelect, onAddDelivery }: DashboardProps) => {
|
||||
<style>
|
||||
body { font-family: system-ui, sans-serif; margin: 20px; }
|
||||
h1 { font-size: 18px; margin-bottom: 16px; }
|
||||
table { width: 100%; border-collapse: collapse; }
|
||||
th, td { text-align: left; padding: 8px; border-bottom: 1px solid #ddd; }
|
||||
table { width: 100%; border-collapse: collapse; font-size: 12px; }
|
||||
th, td { text-align: left; padding: 6px; border-bottom: 1px solid #ddd; }
|
||||
th { font-weight: 600; background: #f5f5f5; }
|
||||
.status-new { background: #ffdcc3; padding: 2px 8px; border-radius: 12px; font-size: 12px; }
|
||||
.status-delivered { background: #dcfce7; padding: 2px 8px; border-radius: 12px; font-size: 12px; }
|
||||
.address-details { font-size: 11px; color: #666; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Доставки на ${format(date, 'dd MMMM yyyy', { locale: ru })}</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Статус</th>
|
||||
<th>Загрузка</th>
|
||||
<th>Товар</th>
|
||||
<th>Клиент</th>
|
||||
<th>Адрес</th>
|
||||
<th>Телефон</th>
|
||||
<th>Услуги</th>
|
||||
<th>Комментарий</th>
|
||||
</tr>
|
||||
${dayDeliveries.map((d: Delivery) => `
|
||||
<tr>
|
||||
<td><span class="status-${d.status}">${d.status === 'new' ? 'Новое' : 'Доставлено'}</span></td>
|
||||
<td>${pickupLocationLabels[d.pickupLocation]}</td>
|
||||
<td>${d.productName}</td>
|
||||
<td>${d.address}</td>
|
||||
<td>${d.pickupLocation2 ? pickupLocationLabels[d.pickupLocation] + ' + ' + pickupLocationLabels[d.pickupLocation2] : pickupLocationLabels[d.pickupLocation]}</td>
|
||||
<td>${d.productName}${d.productName2 ? '<br><small>+ ' + d.productName2 + '</small>' : ''}</td>
|
||||
<td>${d.customerName}</td>
|
||||
<td>
|
||||
ул. ${d.street}, д. ${d.house}${d.apartment ? ', кв. ' + d.apartment : ''}
|
||||
${d.entrance || d.floor ? '<br><span class="address-details">' + (d.entrance ? 'Подъезд ' + d.entrance : '') + (d.entrance && d.floor ? ', ' : '') + (d.floor ? 'этаж ' + d.floor : '') + '</span>' : ''}
|
||||
</td>
|
||||
<td>${d.phone}</td>
|
||||
<td>${d.serviceInfo || '-'}</td>
|
||||
<td>${d.comment || '-'}</td>
|
||||
</tr>
|
||||
`).join('')}
|
||||
@@ -90,7 +94,7 @@ const Dashboard = ({ onDateSelect, onAddDelivery }: DashboardProps) => {
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
|
||||
|
||||
printWindow.document.write(html);
|
||||
printWindow.document.close();
|
||||
printWindow?.print();
|
||||
|
||||
Reference in New Issue
Block a user