CaiWuXiTong/resources/views/business/pages/posting-data/partials/kuka-reconciliation-source-table.blade.php

359 lines
12 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@php
$salesRoundingAdjustment = $salesRoundingAdjustment ?? null;
$salesRoundingAdjustmentColumn = $salesRoundingAdjustmentColumn ?? null;
@endphp
<section
class="kuka-source-table"
data-kuka-reconciliation-template="{{ $sourceSheet }}"
aria-label="{{ $title }}表头"
>
@if ($showHeader ?? true)
<header class="kuka-source-table__header">
<span class="kuka-source-table__icon" aria-hidden="true">
<span class="material-icons-outlined">{{ $icon }}</span>
</span>
<div class="kuka-source-table__heading">
<h2>{{ $title }}</h2>
<p>{{ $description }}</p>
</div>
<span class="kuka-source-table__meta">
工作簿4 · {{ $sourceSheet }} · {{ count($headers) }} 列
</span>
</header>
@endif
@if ($notice)
<div class="kuka-source-table__notice">{{ $notice }}</div>
@endif
<div class="kuka-source-table__scroll">
<table @class([
'kuka-source-table__grid',
'is-wide-spacing' => $viewSlug === 'posting-data',
])>
<thead>
<tr>
@foreach ($headers as $header)
<th scope="col">
<span>{{ $header['label'] }}</span>
@if ($header['code'] !== '')
<code>{{ $header['code'] }}</code>
@endif
</th>
@endforeach
</tr>
</thead>
<tbody>
@forelse ($rows as $row)
<tr>
@foreach ($headers as $columnIndex => $header)
@php
$cellValue = $row[$columnIndex] ?? '';
$normalizedMoney = str_replace(',', '', (string) $cellValue);
@endphp
<td @class(['is-number' => in_array($columnIndex, $numericColumns, true)])>
@if (in_array($columnIndex, $moneyColumns ?? [], true) && is_numeric($normalizedMoney))
{{ number_format((float) $normalizedMoney, 2, '.', '') }}
@else
{{ $cellValue }}
@endif
</td>
@endforeach
</tr>
@empty
<tr class="is-empty">
<td colspan="{{ count($headers) }}">{{ $emptyMessage }}</td>
</tr>
@endforelse
</tbody>
@if (
$salesRoundingAdjustment !== null
&& $salesRoundingAdjustmentColumn !== null
&& abs((float) $salesRoundingAdjustment) > 0.00001
&& $pagination['page'] === $pagination['last_page']
)
<tfoot>
<tr class="is-adjustment" aria-label="销售金额尾差调整">
<td colspan="{{ $salesRoundingAdjustmentColumn }}">销售金额尾差调整</td>
<td class="is-number">
{{ number_format((float) $salesRoundingAdjustment, 2, '.', '') }}
</td>
@if (count($headers) - $salesRoundingAdjustmentColumn - 1 > 0)
<td colspan="{{ count($headers) - $salesRoundingAdjustmentColumn - 1 }}"></td>
@endif
</tr>
</tfoot>
@endif
</table>
</div>
<footer class="kuka-source-table__footer">
<span>
第 {{ number_format($pagination['from']) }}–{{ number_format($pagination['to']) }} 行,
共 {{ number_format($pagination['total']) }} 行
</span>
@if ($pagination['last_page'] > 1)
<div class="kuka-source-table__pagination">
@if ($pagination['page'] > 1)
<a href="{{ request()->fullUrlWithQuery([
'reconciliation_view' => $viewSlug,
'reconciliation_page' => $pagination['page'] - 1,
]) }}">上一页</a>
@endif
<span>{{ $pagination['page'] }} / {{ $pagination['last_page'] }}</span>
@if ($pagination['page'] < $pagination['last_page'])
<a href="{{ request()->fullUrlWithQuery([
'reconciliation_view' => $viewSlug,
'reconciliation_page' => $pagination['page'] + 1,
]) }}">下一页</a>
@endif
</div>
@endif
</footer>
</section>
<style>
.kuka-source-table {
display: grid;
min-width: 0;
overflow: hidden;
border: 1px solid var(--vip-border, #d8d2c7);
border-radius: 12px;
background: var(--vip-surface, #fff);
color: var(--vip-content-ink, #171717);
}
.kuka-source-table__header {
display: flex;
min-width: 0;
align-items: center;
gap: 10px;
padding: 12px 14px;
border-bottom: 1px solid var(--vip-border, #d8d2c7);
background: #fff;
}
.kuka-source-table__icon {
display: grid;
width: 30px;
height: 30px;
flex: 0 0 30px;
place-items: center;
border: 1px solid #d9c89c;
border-radius: 8px;
background: var(--vip-content-accent-soft, #f7f0de);
color: var(--vip-content-accent-dark, #856632);
}
.kuka-source-table__icon .material-icons-outlined {
font-size: 17px;
}
.kuka-source-table__heading {
display: grid;
min-width: 0;
flex: 1 1 auto;
gap: 2px;
}
.kuka-source-table__heading h2 {
margin: 0;
font-size: 13px;
font-weight: 600;
line-height: 1.35;
}
.kuka-source-table__heading p {
margin: 0;
color: var(--vip-content-muted, #595959);
font-size: 11px;
line-height: 1.5;
}
.kuka-source-table__meta {
flex: 0 0 auto;
padding: 3px 8px;
border: 1px solid #d9c89c;
border-radius: 999px;
background: #fbf7ec;
color: var(--vip-content-accent-dark, #856632);
font-size: 10px;
font-weight: 600;
white-space: nowrap;
}
.kuka-source-table__scroll {
max-width: 100%;
max-height: min(50vh, 34rem);
overflow: auto;
scrollbar-color: var(--vip-content-accent, #b9954f) #efede8;
scrollbar-width: thin;
}
.kuka-source-table__grid {
width: max-content;
min-width: 100%;
border-collapse: separate;
border-spacing: 0;
font-size: 12px;
}
.kuka-source-table__grid.is-wide-spacing {
width: 100%;
min-width: 84rem;
table-layout: fixed;
}
.kuka-source-table__grid th {
position: sticky;
top: 0;
z-index: 2;
min-width: 8rem;
max-width: 15rem;
padding: 9px 10px;
border-right: 1px solid var(--vip-border, #d8d2c7);
border-bottom: 1px solid var(--vip-border, #d8d2c7);
background: var(--vip-content-accent-soft, #f7f0de);
color: var(--vip-content-ink, #171717);
font-size: 11px;
font-weight: 600;
line-height: 1.45;
text-align: left;
vertical-align: top;
white-space: normal;
}
.kuka-source-table__grid th:last-child {
border-right: 0;
}
.kuka-source-table__grid th span,
.kuka-source-table__grid th code {
display: block;
}
.kuka-source-table__grid th code {
margin-top: 3px;
color: var(--vip-content-muted, #595959);
font-family: inherit;
font-size: 9px;
font-weight: 500;
overflow-wrap: anywhere;
}
.kuka-source-table__grid td {
max-width: 18rem;
padding: 8px 10px;
border-right: 1px solid var(--vip-border, #d8d2c7);
border-bottom: 1px solid var(--vip-border, #d8d2c7);
background: #fff;
font-size: 12px;
line-height: 1.5;
text-align: left;
vertical-align: top;
overflow-wrap: anywhere;
}
.kuka-source-table__grid tbody tr:nth-child(even) td {
background: #fcfbf7;
}
.kuka-source-table__grid tbody tr:hover td {
background: var(--vip-content-accent-soft, #f7f0de);
}
.kuka-source-table__grid tfoot tr.is-adjustment td {
border-top: 2px solid var(--vip-content-accent, #b9954f);
border-bottom: 0;
background: var(--vip-content-accent-soft, #f7f0de);
color: var(--vip-content-accent-dark, #856632);
font-weight: 600;
}
.kuka-source-table__grid td:last-child {
border-right: 0;
}
.kuka-source-table__grid td.is-number {
text-align: right;
white-space: nowrap;
font-variant-numeric: tabular-nums;
}
.kuka-source-table__grid.is-wide-spacing th,
.kuka-source-table__grid.is-wide-spacing td {
min-width: 0;
max-width: none;
padding-right: 16px;
padding-left: 16px;
}
.kuka-source-table__grid.is-wide-spacing th:nth-child(1),
.kuka-source-table__grid.is-wide-spacing td:nth-child(1),
.kuka-source-table__grid.is-wide-spacing th:nth-child(2),
.kuka-source-table__grid.is-wide-spacing td:nth-child(2) {
width: 6%;
}
.kuka-source-table__grid.is-wide-spacing th:nth-child(3),
.kuka-source-table__grid.is-wide-spacing td:nth-child(3) {
width: 17%;
}
.kuka-source-table__grid.is-wide-spacing td:nth-child(3) {
white-space: nowrap;
}
.kuka-source-table__grid.is-wide-spacing th:nth-child(4),
.kuka-source-table__grid.is-wide-spacing td:nth-child(4) {
width: 30%;
}
.kuka-source-table__grid.is-wide-spacing th:nth-child(5),
.kuka-source-table__grid.is-wide-spacing td:nth-child(5) {
width: 10%;
}
.kuka-source-table__grid.is-wide-spacing th:nth-child(6),
.kuka-source-table__grid.is-wide-spacing td:nth-child(6) {
width: 11%;
}
.kuka-source-table__grid.is-wide-spacing th:nth-child(7),
.kuka-source-table__grid.is-wide-spacing td:nth-child(7) {
width: 20%;
}
.kuka-source-table__grid tr.is-empty td {
padding: 28px 16px;
color: var(--vip-content-muted, #595959);
text-align: center;
}
.kuka-source-table__notice {
padding: 8px 14px;
border-bottom: 1px solid #ead7ae;
background: #fffaf0;
color: var(--vip-warning, #935f07);
font-size: 11px;
line-height: 1.5;
}
.kuka-source-table__footer {
display: flex;
min-height: 36px;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 6px 12px;
border-top: 1px solid var(--vip-border, #d8d2c7);
color: var(--vip-content-muted, #595959);
font-size: 11px;
}
.kuka-source-table__pagination {
display: inline-flex;
align-items: center;
gap: 8px;
}
.kuka-source-table__pagination a {
padding: 3px 8px;
border: 1px solid var(--vip-border, #d8d2c7);
border-radius: 4px;
background: #fff;
color: var(--vip-content-accent-dark, #856632);
font-weight: 600;
text-decoration: none;
}
.kuka-source-table__pagination a:hover,
.kuka-source-table__pagination a:focus-visible {
border-color: var(--vip-content-accent, #b9954f);
background: var(--vip-content-accent-soft, #f7f0de);
outline: none;
}
@media (max-width: 720px) {
.kuka-source-table__header {
align-items: flex-start;
flex-wrap: wrap;
}
.kuka-source-table__meta {
margin-left: 40px;
}
.kuka-source-table__footer {
align-items: flex-start;
flex-direction: column;
}
.kuka-source-table__grid th {
min-width: 7rem;
}
}
</style>