Initial catalog maker baseline

This commit is contained in:
2026-08-05 12:25:23 +02:00
commit 2e7d83b679
30 changed files with 5437 additions and 0 deletions
+1151
View File
File diff suppressed because it is too large Load Diff
+190
View File
@@ -0,0 +1,190 @@
<!doctype html>
<html lang="cs">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Catalog Maker</title>
<link rel="stylesheet" href="/styles.css" />
<script src="/app.js" type="module"></script>
</head>
<body>
<main class="catalog-screen">
<aside class="control-panel">
<div class="app-status">
<span class="safe-mode" id="databaseStatus">DB read-only</span>
</div>
<div class="record-id" id="recordId">&nbsp;</div>
<div class="arrow-row">
<button class="arrow-button arrow-button-prev" id="previousProductButton" type="button" title="Previous product" aria-label="Previous product"></button>
<button class="arrow-button arrow-button-next" id="nextProductButton" type="button" title="Next product" aria-label="Next product"></button>
</div>
<div class="parser-actions" aria-label="Parser actions">
<button class="action-button" id="findSourcesButton" type="button">Find sources</button>
<button class="action-button" id="getPicturesButton" type="button">Get pictures</button>
<button class="action-button" type="button">Get features</button>
<button class="action-button" type="button">Get texts</button>
<button class="action-button" type="button">Preview parsed data</button>
<button class="action-button" type="button" disabled>Apply / Save</button>
</div>
<button class="action-button" id="loadProductButton" type="button">Get product info - 00</button>
<button class="action-button" type="button">Creat combin. - 02</button>
<input class="input-like" id="scanInput" aria-label="Scan EAN" placeholder="Scan EAN" />
<div class="picture-slot" id="pictureSlot">
<span>No picture</span>
</div>
<select class="input-like" id="languageSelect" aria-label="Language">
<option value="">Select language</option>
</select>
<select class="input-like" id="manufacturerSelect" aria-label="Manufacturer">
<option value="">Select manufacturer</option>
</select>
<div class="mapping-box" id="mappingBox">
<details class="mapping-details" id="mappingDetails">
<summary>
<span class="mapping-state is-missing" id="mappingState">Mapping not loaded</span>
<span class="mapping-toggle" aria-hidden="true"></span>
</summary>
<div class="mapping-list" id="mappingList"></div>
</details>
</div>
<button class="action-button primary" type="button">Show menu (20)</button>
<button class="action-button" type="button">Scraper - 03</button>
<button class="action-button" type="button">BG remover - 04</button>
<button class="action-button" id="settingsButton" type="button">Settings</button>
</aside>
<section class="product-panel">
<div class="field-grid" id="fieldGrid"></div>
</section>
<section class="data-panel">
<div class="table-wrap">
<table class="variant-table">
<thead>
<tr id="variantHeader"></tr>
</thead>
<tbody>
<tr>
<td class="empty-row" id="emptyTableMessage" colspan="13">Select manufacturer to load data.</td>
</tr>
</tbody>
</table>
</div>
</section>
</main>
<div class="modal-backdrop" id="suggestedModal" hidden>
<section class="suggested-dialog" aria-labelledby="suggestedTitle">
<header class="suggested-header">
<h2 id="suggestedTitle">Sugested product for</h2>
<button class="modal-close" id="suggestedCloseButton" type="button">Close</button>
</header>
<div class="suggested-list" id="suggestedList"></div>
</section>
</div>
<div class="modal-backdrop" id="sourceModal" hidden>
<section class="source-dialog" aria-labelledby="sourceTitle">
<header class="suggested-header">
<h2 id="sourceTitle">Source candidates</h2>
<button class="modal-close" id="sourceCloseButton" type="button">Close</button>
</header>
<div class="source-list" id="sourceList"></div>
</section>
</div>
<div class="modal-backdrop" id="settingsModal" hidden>
<section class="settings-dialog" aria-labelledby="settingsTitle">
<header class="suggested-header">
<h2 id="settingsTitle">Settings</h2>
<button class="modal-close" id="settingsCloseButton" type="button">Close</button>
</header>
<div class="settings-content">
<fieldset class="settings-group">
<legend>Database</legend>
<label class="settings-option">
<input type="radio" name="databaseMode" value="local" checked />
<span>Local DB</span>
</label>
<label class="settings-option">
<input type="radio" name="databaseMode" value="live" />
<span>Live DB</span>
</label>
<div class="local-db-fields" id="localDbFields">
<label class="settings-field">
<span>Host</span>
<input id="localDbHost" type="text" autocomplete="off" value="127.0.0.1" />
</label>
<label class="settings-field">
<span>Port</span>
<input id="localDbPort" type="number" inputmode="numeric" value="3306" />
</label>
<label class="settings-field">
<span>Database</span>
<input id="localDbName" type="text" autocomplete="off" value="catalog_maker_test" />
</label>
<label class="settings-field">
<span>User</span>
<input id="localDbUser" type="text" autocomplete="username" value="root" />
</label>
<label class="settings-field">
<span>Password</span>
<input id="localDbPassword" type="text" autocomplete="off" />
</label>
<button class="settings-test-button" id="testLocalDbButton" type="button">Test connection</button>
<p class="settings-note" id="localDbTestResult">Connection not tested.</p>
</div>
<p class="settings-note" id="databaseModeNote">Local test database selected.</p>
</fieldset>
<fieldset class="settings-group">
<legend>Access permissions</legend>
<label class="settings-option">
<input type="checkbox" id="allowReadToggle" checked disabled />
<span>Allow read</span>
</label>
<label class="settings-option">
<input type="checkbox" id="allowInsertToggle" />
<span>Allow insert</span>
</label>
<label class="settings-option">
<input type="checkbox" id="allowUpdateToggle" />
<span>Allow update</span>
</label>
<label class="settings-option">
<input type="checkbox" id="allowDeleteToggle" />
<span>Allow delete</span>
</label>
<p class="settings-note">Live DB is always read-only. Write permissions apply only to Local DB.</p>
</fieldset>
<fieldset class="settings-group">
<legend>Execution safety</legend>
<label class="settings-option">
<input type="radio" name="transactionMode" value="transaction" checked />
<span>Transaction mode: confirm before commit</span>
</label>
<label class="settings-option">
<input type="radio" name="transactionMode" value="dry-run" />
<span>Dry-run: preview SQL only</span>
</label>
<div class="settings-permissions">
<span>DROP, TRUNCATE and ALTER remain blocked.</span>
<span>Every write will be logged before execution.</span>
</div>
</fieldset>
</div>
</section>
</div>
</body>
</html>
+852
View File
@@ -0,0 +1,852 @@
:root {
color-scheme: light;
--surface: #f4f6f8;
--panel: #22272e;
--panel-soft: #2d333b;
--panel-line: #3e4651;
--detail-label: #e2e6ea;
--detail-value: #eefdf9;
--detail-border: #c8d3d9;
--table-head: #d9dee4;
--table-row: #f5f6f7;
--table-row-alt: #eceff2;
--table-line: #cfd6dd;
--text: #15181c;
--muted: #68717d;
--accent: #7ee34d;
--accent-text: #10220b;
--safe: #0f7b4d;
--danger: #e02424;
--focus: #2f6fed;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
min-height: 100vh;
color: var(--text);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial,
sans-serif;
background: var(--surface);
}
button,
input,
select {
font: inherit;
}
.catalog-screen {
min-height: 100vh;
display: grid;
grid-template-columns: 172px 292px minmax(720px, 1fr);
}
.control-panel {
min-height: 100vh;
max-height: 100vh;
padding: 6px;
background: var(--panel);
display: flex;
flex-direction: column;
gap: 6px;
overflow-y: auto;
}
.control-panel > #settingsButton {
order: 99;
}
.app-status {
order: 98;
margin-top: auto;
display: flex;
flex-wrap: wrap;
gap: 3px;
padding: 5px;
border: 1px solid var(--panel-line);
border-radius: 6px;
background: var(--panel-soft);
color: #f3f6f8;
font-size: 11px;
line-height: 1.2;
}
.record-id {
height: 39px;
display: grid;
place-items: center;
border: 1px solid rgba(126, 227, 77, 0.42);
border-radius: 6px;
background: linear-gradient(180deg, #9aff60, var(--accent));
color: var(--accent-text);
font-size: 26px;
font-weight: 700;
line-height: 1;
font-variant-numeric: tabular-nums;
}
.arrow-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 5px;
}
.arrow-button,
.action-button,
.input-like {
width: 100%;
border: 1px solid var(--panel-line);
border-radius: 5px;
background: #f8fafc;
color: #111827;
}
.arrow-button,
.action-button {
cursor: pointer;
}
.arrow-button {
height: 31px;
position: relative;
display: grid;
place-items: center;
}
.arrow-button::before {
content: "";
width: 0;
height: 0;
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
}
.arrow-button-prev::before {
border-right: 11px solid #111827;
}
.arrow-button-next::before {
border-left: 11px solid #111827;
}
.arrow-button:disabled::before {
opacity: 0.55;
}
.parser-actions {
display: grid;
gap: 4px;
}
.parser-actions .action-button {
min-height: 28px;
font-size: 11px;
}
.action-button {
min-height: 32px;
padding: 0 8px;
font-size: 12px;
display: grid;
place-items: center;
text-align: center;
}
.action-button.primary {
min-height: 34px;
font-size: 14px;
font-weight: 700;
}
.arrow-button:hover:not(:disabled),
.action-button:hover:not(:disabled) {
border-color: #7a8492;
background: #ffffff;
}
.arrow-button:disabled,
.action-button:disabled {
cursor: default;
opacity: 0.45;
}
.input-like {
height: 28px;
padding: 3px 7px;
font-size: 12px;
outline: none;
}
select.input-like {
text-align: center;
text-align-last: center;
}
#scanInput {
background: #e5e8ec;
text-align: center;
}
.input-like:focus {
border-color: var(--focus);
box-shadow: 0 0 0 2px rgba(47, 111, 237, 0.18);
}
.input-like::placeholder {
color: #8b95a1;
}
.picture-slot {
aspect-ratio: 1 / 1;
width: 100%;
min-height: 0;
display: grid;
place-items: center;
border: 1px dashed #6d7784;
border-radius: 5px;
background: var(--panel-soft);
color: #b8c0ca;
font-size: 12px;
overflow: hidden;
}
.picture-slot img {
width: 100%;
height: 100%;
display: block;
object-fit: contain;
}
.mapping-box {
display: grid;
gap: 3px;
font-size: 11px;
}
.mapping-state {
height: 28px;
display: flex;
align-items: center;
min-width: 0;
padding: 3px 7px;
border: 1px solid var(--panel-line);
border-right: 0;
border-radius: 5px 0 0 5px;
background: #f8fafc;
color: #111827;
font-weight: 400;
line-height: 1.15;
}
.mapping-state.is-ready {
background: #f8fafc;
color: #111827;
}
.mapping-state.is-missing {
background: #fff0f0;
color: #b42318;
font-weight: 700;
}
.mapping-list {
display: grid;
gap: 3px;
}
.mapping-details {
min-width: 0;
}
.mapping-details summary {
display: grid;
grid-template-columns: minmax(0, 1fr) 22px;
align-items: center;
cursor: pointer;
list-style: none;
}
.mapping-details summary::-webkit-details-marker {
display: none;
}
.mapping-details summary:hover {
filter: brightness(1.04);
}
.mapping-toggle {
width: 22px;
height: 28px;
display: grid;
place-items: center;
border: 1px solid var(--panel-line);
border-left: 0;
border-radius: 0 5px 5px 0;
background: #f8fafc;
}
.mapping-toggle::before {
content: ">";
color: #111827;
font-size: 11px;
font-weight: 900;
line-height: 1;
}
.mapping-details[open] .mapping-toggle::before {
transform: rotate(90deg);
}
.mapping-source-row {
min-width: 0;
max-width: 100%;
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
align-items: center;
gap: 4px;
padding: 3px 4px;
border: 1px solid #46505c;
border-radius: 5px;
background: #1b2026;
color: #f3f6f8;
}
.mapping-source-row.is-disabled {
opacity: 0.55;
}
.mapping-source-name {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: 800;
}
.mapping-source-status {
flex: 0 0 auto;
padding: 1px 4px;
border-radius: 4px;
font-size: 9px;
font-weight: 400;
}
.mapping-source-status.is-ok {
background: #e8edf3;
color: #303944;
}
.mapping-source-status.is-bad {
background: #ffe0dc;
color: #b42318;
font-weight: 700;
}
.mapping-source-status.is-muted {
background: #4b5563;
color: #e5e7eb;
}
.product-panel {
min-width: 0;
padding: 22px 0 8px;
background: #d3d8de;
border-right: 1px solid #bdc6cf;
}
.field-grid {
display: grid;
grid-template-columns: 132px minmax(0, 168px);
}
.field-label,
.field-value {
min-height: 22px;
padding: 4px 8px;
border-bottom: 1px solid var(--detail-border);
font-size: 12px;
line-height: 1.15;
}
.field-label {
color: #26313d;
background: var(--detail-label);
}
.field-value {
background: var(--detail-value);
text-align: right;
overflow-wrap: anywhere;
font-variant-numeric: tabular-nums;
}
.field-value[data-field="manufacturer_name"] {
color: #b42318;
font-weight: 700;
}
.data-panel {
min-width: 0;
background: var(--surface);
}
.safe-mode,
#modePill {
padding: 2px 6px;
border-radius: 5px;
background: #e8f7ef;
color: var(--safe);
font-weight: 700;
}
#databaseStatus.database-error {
background: #fde8e7;
color: #b42318;
}
#modePill {
background: #edf1f5;
color: #4d5966;
font-weight: 600;
}
.table-wrap {
height: 100vh;
overflow: auto;
}
.variant-table {
width: 100%;
min-width: 820px;
border-collapse: separate;
border-spacing: 0;
table-layout: fixed;
font-size: 12px;
background: var(--table-row);
}
.variant-table th,
.variant-table td {
height: 22px;
border-right: 1px solid var(--table-line);
border-bottom: 1px solid var(--table-line);
padding: 2px 7px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-variant-numeric: tabular-nums;
}
.variant-table th {
position: sticky;
top: 0;
z-index: 2;
background: var(--table-head);
color: #303944;
font-weight: 700;
text-align: center;
}
.variant-table td {
background: var(--table-row);
}
.variant-table tr:nth-child(even) td {
background: var(--table-row-alt);
}
.variant-table tr:hover td {
background: #fff7df;
}
.empty-row {
color: var(--muted);
text-align: center;
font-style: italic;
}
.variant-table .problem-ean {
background: var(--danger) !important;
color: #ffffff;
font-weight: 700;
}
.modal-backdrop {
position: fixed;
inset: 0;
z-index: 20;
display: grid;
place-items: center;
padding: 24px;
background: rgba(17, 24, 39, 0.38);
}
.modal-backdrop[hidden] {
display: none;
}
.suggested-dialog {
width: min(900px, 94vw);
max-height: min(620px, 88vh);
display: grid;
grid-template-rows: auto minmax(0, 1fr);
border: 1px solid #9aa5b1;
border-radius: 8px;
overflow: hidden;
background: #f8fafc;
box-shadow: 0 18px 60px rgba(15, 23, 42, 0.34);
}
.source-dialog {
width: min(820px, 94vw);
max-height: min(620px, 88vh);
display: grid;
grid-template-rows: auto minmax(0, 1fr);
border: 1px solid #9aa5b1;
border-radius: 8px;
overflow: hidden;
background: #f8fafc;
box-shadow: 0 18px 60px rgba(15, 23, 42, 0.34);
}
.settings-dialog {
width: min(520px, 94vw);
max-height: 92vh;
display: grid;
grid-template-rows: auto minmax(0, 1fr);
border: 1px solid #9aa5b1;
border-radius: 8px;
overflow: hidden;
background: #f8fafc;
box-shadow: 0 18px 60px rgba(15, 23, 42, 0.34);
}
.settings-content {
display: grid;
gap: 8px;
padding: 10px;
overflow: visible;
}
.settings-group {
display: grid;
gap: 6px;
margin: 0;
padding: 8px;
border: 1px solid var(--table-line);
border-radius: 6px;
background: #ffffff;
}
.settings-group legend {
padding: 0 5px;
font-size: 12px;
font-weight: 700;
}
.settings-option {
display: flex;
align-items: center;
gap: 8px;
font-size: 12px;
}
.local-db-fields {
display: grid;
gap: 6px;
padding: 8px;
border: 1px solid var(--table-line);
border-radius: 5px;
background: #f7f9fb;
}
.local-db-fields[hidden] {
display: none;
}
.settings-field {
display: grid;
grid-template-columns: 82px minmax(0, 1fr);
align-items: center;
gap: 8px;
font-size: 11px;
}
.settings-field input {
min-width: 0;
padding: 4px 6px;
border: 1px solid #cbd3dc;
border-radius: 4px;
font: inherit;
}
.settings-test-button {
width: 100%;
padding: 5px 8px;
border: 1px solid #b8c3ce;
border-radius: 4px;
background: #eef2f5;
color: #26323d;
cursor: pointer;
}
.settings-test-button:disabled {
opacity: 0.6;
cursor: wait;
}
.connection-ok {
color: #18794e;
}
.connection-error {
color: #b42318;
font-weight: 600;
}
.settings-option input {
margin: 0;
}
.settings-option input:disabled + span {
color: var(--muted);
}
.settings-note,
.settings-permissions {
margin: 0;
color: var(--muted);
font-size: 11px;
line-height: 1.35;
}
.settings-permissions {
display: grid;
gap: 3px;
padding-top: 3px;
}
.suggested-header {
min-height: 42px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 8px 10px;
border-bottom: 1px solid var(--table-line);
background: #e8edf3;
}
.suggested-header h2 {
margin: 0;
font-size: 14px;
}
.modal-close {
border: 1px solid #b6c0ca;
border-radius: 5px;
padding: 5px 10px;
background: #ffffff;
cursor: pointer;
font-size: 12px;
}
.suggested-list {
overflow: auto;
}
.suggested-row {
display: grid;
grid-template-columns: 58px 92px 1fr 160px 64px 84px;
align-items: center;
gap: 8px;
padding: 6px 10px;
border-bottom: 1px solid var(--table-line);
font-size: 12px;
}
.suggested-row:nth-child(even) {
background: #eef2f6;
}
.suggested-row img {
width: 46px;
height: 46px;
object-fit: contain;
border: 1px solid #d3dae2;
background: #ffffff;
}
.suggested-id,
.suggested-active {
text-align: center;
font-variant-numeric: tabular-nums;
}
.suggested-name,
.suggested-reference {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.suggested-pick {
border: 1px solid #2f6fed;
border-radius: 5px;
padding: 5px 8px;
background: #2f6fed;
color: #ffffff;
cursor: pointer;
font-size: 12px;
}
.source-list {
display: grid;
gap: 8px;
padding: 10px;
overflow: auto;
}
.source-section {
display: grid;
gap: 4px;
border: 1px solid var(--table-line);
border-radius: 6px;
overflow: hidden;
background: #ffffff;
}
.source-section-header,
.source-row {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
align-items: center;
gap: 10px;
min-height: 32px;
padding: 6px 8px;
font-size: 12px;
}
.source-section-header {
background: #e8edf3;
}
.source-section-actions {
display: flex;
align-items: center;
gap: 6px;
}
.source-picture-action {
border: 1px solid #9aa8b7;
border-radius: 4px;
padding: 3px 6px;
background: #ffffff;
color: #172033;
cursor: pointer;
font-size: 10px;
}
.source-picture-action:hover {
background: #e9f2ff;
border-color: #2f6fed;
}
.source-row {
color: #172033;
text-decoration: none;
border-top: 1px solid var(--table-line);
}
.source-row:hover {
background: #fff7df;
}
.source-row-title {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.source-status,
.source-row-action {
padding: 2px 6px;
border-radius: 5px;
font-size: 10px;
font-weight: 800;
}
.picture-candidate {
display: grid;
grid-template-rows: 132px auto;
gap: 6px;
color: inherit;
text-decoration: none;
font-size: 11px;
min-width: 132px;
}
.picture-candidate img {
width: 132px;
height: 132px;
object-fit: contain;
background: #fff;
border: 1px solid #d5dce5;
}
.picture-candidate span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.source-status.is-ok {
background: #dff7e7;
color: #0f7b4d;
}
.source-status.is-muted,
.source-row-action {
background: #edf1f5;
color: #4d5966;
}
@media (max-width: 980px) {
.catalog-screen {
grid-template-columns: 1fr;
}
.control-panel {
min-height: auto;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.record-id,
.arrow-row,
.parser-actions,
.app-status,
.mapping-box,
.picture-slot {
grid-column: span 2;
}
.product-panel {
padding: 0;
}
.field-grid {
grid-template-columns: 160px minmax(0, 1fr);
}
.table-wrap {
height: auto;
max-height: 70vh;
}
}