- Dashboard/Logs: Total column with 2 decimals (order_total) - Order detail modal: totals summary row (items total + order total) - Order detail modal mobile: compact article cards (d-md-none) - Mappings: openEditModal loads all CODMATs for SKU, saveMapping replaces entire set via delete-all + batch POST - Add project-specific team agents: ui-templates, ui-js, ui-verify, backend-api - CLAUDE.md: mandatory preview approval before implementation, fix-loop after verification, server must start via start.sh Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
186 lines
10 KiB
HTML
186 lines
10 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Jurnale Import - GoMag Import{% endblock %}
|
|
{% block nav_logs %}active{% endblock %}
|
|
|
|
{% block content %}
|
|
<h4 class="mb-4">Jurnale Import</h4>
|
|
|
|
<!-- Sync Run Selector + Status + Controls (single card) -->
|
|
<div class="card mb-3">
|
|
<div class="card-body py-2">
|
|
<!-- Desktop layout -->
|
|
<div class="d-none d-md-flex align-items-center gap-3 flex-wrap">
|
|
<label class="form-label mb-0 fw-bold text-nowrap">Sync Run:</label>
|
|
<select class="form-select form-select-sm" id="runsDropdown" onchange="selectRun(this.value)" style="max-width:400px">
|
|
<option value="">Se incarca...</option>
|
|
</select>
|
|
<button class="btn btn-sm btn-outline-secondary text-nowrap" onclick="loadRuns()" title="Reincarca lista"><i class="bi bi-arrow-clockwise"></i></button>
|
|
<span id="logStatusBadge" style="font-weight:600">-</span>
|
|
<div class="form-check form-switch mb-0">
|
|
<input class="form-check-input" type="checkbox" id="autoRefreshToggle" checked>
|
|
<label class="form-check-label small" for="autoRefreshToggle">Auto-refresh</label>
|
|
</div>
|
|
<button class="btn btn-sm btn-outline-secondary" id="btnShowTextLog" onclick="toggleTextLog()">
|
|
<i class="bi bi-file-text"></i> Log text brut
|
|
</button>
|
|
</div>
|
|
<!-- Mobile compact layout -->
|
|
<div class="d-flex d-md-none align-items-center gap-2">
|
|
<span id="mobileRunDot" class="sync-status-dot idle" style="width:8px;height:8px"></span>
|
|
<select class="form-select form-select-sm flex-grow-1" id="runsDropdownMobile" onchange="selectRun(this.value)" style="font-size:0.8rem">
|
|
<option value="">Se incarca...</option>
|
|
</select>
|
|
<button class="btn btn-sm btn-outline-secondary" onclick="loadRuns()" title="Reincarca"><i class="bi bi-arrow-clockwise"></i></button>
|
|
<div class="dropdown">
|
|
<button class="btn btn-sm btn-outline-secondary" data-bs-toggle="dropdown"><i class="bi bi-three-dots-vertical"></i></button>
|
|
<ul class="dropdown-menu dropdown-menu-end">
|
|
<li>
|
|
<label class="dropdown-item d-flex align-items-center gap-2">
|
|
<input class="form-check-input" type="checkbox" id="autoRefreshToggleMobile" checked> Auto-refresh
|
|
</label>
|
|
</li>
|
|
<li><a class="dropdown-item" href="#" onclick="toggleTextLog();return false"><i class="bi bi-file-text me-1"></i> Log text brut</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Detail Viewer (shown when run selected) -->
|
|
<div id="logViewerSection" style="display:none;">
|
|
<!-- Filter pills -->
|
|
<div class="filter-bar mb-3" id="orderFilterPills">
|
|
<button class="filter-pill active d-none d-md-inline-flex" data-log-status="all">Toate <span class="filter-count fc-neutral" id="countAll">0</span></button>
|
|
<button class="filter-pill d-none d-md-inline-flex" data-log-status="IMPORTED">Importate <span class="filter-count fc-green" id="countImported">0</span></button>
|
|
<button class="filter-pill d-none d-md-inline-flex" data-log-status="ALREADY_IMPORTED">Deja imp. <span class="filter-count fc-blue" id="countAlreadyImported">0</span></button>
|
|
<button class="filter-pill d-none d-md-inline-flex" data-log-status="SKIPPED">Omise <span class="filter-count fc-yellow" id="countSkipped">0</span></button>
|
|
<button class="filter-pill d-none d-md-inline-flex" data-log-status="ERROR">Erori <span class="filter-count fc-red" id="countError">0</span></button>
|
|
</div>
|
|
<div class="d-md-none mb-2" id="logsMobileSeg"></div>
|
|
|
|
<!-- Orders table -->
|
|
<div class="card mb-3">
|
|
<div id="ordersPaginationTop" class="pag-strip"></div>
|
|
<div class="card-body p-0">
|
|
<div id="logsMobileList" class="mobile-list"></div>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th class="sortable" onclick="sortOrdersBy('order_date')">Data comanda <span class="sort-icon" data-col="order_date"></span></th>
|
|
<th class="sortable" onclick="sortOrdersBy('order_number')">Nr. comanda <span class="sort-icon" data-col="order_number"></span></th>
|
|
<th class="sortable" onclick="sortOrdersBy('customer_name')">Client <span class="sort-icon" data-col="customer_name"></span></th>
|
|
<th class="sortable" onclick="sortOrdersBy('items_count')">Articole <span class="sort-icon" data-col="items_count"></span></th>
|
|
<th class="sortable" onclick="sortOrdersBy('status')">Status <span class="sort-icon" data-col="status"></span></th>
|
|
<th>Total</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="runOrdersBody">
|
|
<tr><td colspan="7" class="text-center text-muted py-3">Selecteaza un sync run</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div id="ordersPagination" class="pag-strip pag-strip-bottom"></div>
|
|
</div>
|
|
|
|
<!-- Collapsible text log -->
|
|
<div id="textLogSection" style="display:none;">
|
|
<div class="card">
|
|
<div class="card-header">Log text brut</div>
|
|
<pre class="log-viewer" id="logContent">Se incarca...</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Order Detail Modal -->
|
|
<div class="modal fade" id="orderDetailModal" tabindex="-1">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Comanda <code id="detailOrderNumber"></code></h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="row mb-3">
|
|
<div class="col-md-6">
|
|
<small class="text-muted">Client:</small> <strong id="detailCustomer"></strong><br>
|
|
<small class="text-muted">Data comanda:</small> <span id="detailDate"></span><br>
|
|
<small class="text-muted">Status:</small> <span id="detailStatus"></span>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<small class="text-muted">ID Comanda ROA:</small> <span id="detailIdComanda">-</span><br>
|
|
<small class="text-muted">ID Partener:</small> <span id="detailIdPartener">-</span><br>
|
|
<small class="text-muted">ID Adr. Facturare:</small> <span id="detailIdAdresaFact">-</span><br>
|
|
<small class="text-muted">ID Adr. Livrare:</small> <span id="detailIdAdresaLivr">-</span>
|
|
</div>
|
|
</div>
|
|
<div class="d-flex justify-content-end gap-3 mb-2" id="detailTotals">
|
|
<span><small class="text-muted">Valoare articole:</small> <strong id="detailItemsTotal">-</strong></span>
|
|
<span><small class="text-muted">Total comanda:</small> <strong id="detailOrderTotal">-</strong></span>
|
|
</div>
|
|
<div class="table-responsive d-none d-md-block">
|
|
<table class="table table-sm table-bordered mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>SKU</th>
|
|
<th>Produs</th>
|
|
<th>Cant.</th>
|
|
<th>Pret</th>
|
|
<th>TVA</th>
|
|
<th>CODMAT</th>
|
|
<th>Status</th>
|
|
<th>Actiune</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="detailItemsBody">
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="d-md-none" id="detailItemsMobile"></div>
|
|
<div id="detailError" class="alert alert-danger mt-3" style="display:none;"></div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Inchide</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Quick Map Modal (used from order detail) -->
|
|
<div class="modal fade" id="quickMapModal" tabindex="-1" data-bs-backdrop="static">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Mapeaza SKU: <code id="qmSku"></code></h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="mb-2">
|
|
<small class="text-muted">Produs web:</small> <strong id="qmProductName"></strong>
|
|
</div>
|
|
<div id="qmCodmatLines">
|
|
<!-- Dynamic CODMAT lines -->
|
|
</div>
|
|
<button type="button" class="btn btn-sm btn-outline-secondary mt-2" onclick="addQmCodmatLine()">
|
|
<i class="bi bi-plus"></i> Adauga CODMAT
|
|
</button>
|
|
<div id="qmPctWarning" class="text-danger mt-2" style="display:none;"></div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Anuleaza</button>
|
|
<button type="button" class="btn btn-primary" onclick="saveQuickMapping()">Salveaza</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Hidden field for pre-selected run from URL/server -->
|
|
<input type="hidden" id="preselectedRun" value="{{ selected_run }}">
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script src="/static/js/logs.js?v=6"></script>
|
|
{% endblock %}
|