Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

<section class="wrapper">
<div class="ocr-root">

  <style>
  /* Scoped to .ocr-root. Colours use rgb() and selectors use classes, never id-hashes -
     Velocity parses a leading "#" as a directive. Namespaced away from .oc-root so the
     review screen's delegated handlers can never bind to this screen's controls. */
  .ocr-root {
    --ocr-bg: rgb(248, 250, 252);
    --ocr-surface: rgb(255, 255, 255);
    --ocr-border: rgb(226, 232, 240);
    --ocr-line: rgb(241, 245, 249);
    --ocr-text: rgb(15, 23, 42);
    --ocr-muted: rgb(100, 116, 139);
    --ocr-accent: rgb(79, 70, 229);
    --ocr-accent-soft: rgb(238, 242, 255);
    --ocr-ok: rgb(22, 163, 74);
    --ocr-ok-soft: rgb(240, 253, 244);
    --ocr-warn: rgb(180, 83, 9);
    --ocr-warn-soft: rgb(255, 251, 235);
    --ocr-danger: rgb(190, 18, 60);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ocr-text);
    font-size: 13px;
    line-height: 1.5;
    padding: 18px 22px 32px;
    box-sizing: border-box;
  }
  .ocr-root *, .ocr-root *::before, .ocr-root *::after { box-sizing: border-box; }
  .ocr-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
  .ocr-num { color: var(--ocr-muted); font-size: 12px; }

  /* ---- header ---- */
  .ocr-head { display: flex; align-items: flex-start; justify-content: space-between;
              gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
  .ocr-title { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
  .ocr-sub { color: var(--ocr-muted); margin: 4px 0 0; font-size: 12.5px; max-width: 74ch; }
  .ocr-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

  .ocr-btn { border: 1px solid var(--ocr-border); background: var(--ocr-surface);
             color: var(--ocr-text); border-radius: 7px; padding: 0 13px; height: 32px;
             font-size: 12.5px; cursor: pointer; white-space: nowrap; }
  .ocr-btn:hover { border-color: var(--ocr-accent); color: var(--ocr-accent); }
  .ocr-btn:disabled { opacity: 0.55; cursor: default; }
  .ocr-btn-primary { background: var(--ocr-accent); border-color: var(--ocr-accent);
                     color: rgb(255, 255, 255); }
  .ocr-btn-primary:hover { color: rgb(255, 255, 255); opacity: 0.92; }
  .ocr-btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
  .ocr-input { border: 1px solid var(--ocr-border); border-radius: 7px; padding: 0 9px;
               height: 32px; font-size: 13px; width: 100%; background: var(--ocr-surface);
               color: var(--ocr-text); }
  .ocr-input:focus, .ocr-btn:focus-visible { outline: 2px solid var(--ocr-accent);
                                             outline-offset: 1px; }

  /* ---- status strip ---- */
  .ocr-strip { display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
               margin: 14px 0 16px; }
  .ocr-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 11px;
              border: 1px solid var(--ocr-border); border-radius: 999px;
              background: var(--ocr-surface); font-size: 12.5px; }
  .ocr-chip b { font-weight: 650; font-variant-numeric: tabular-nums; }
  .ocr-chip-pending { background: var(--ocr-warn-soft); border-color: rgb(253, 230, 138);
                      color: var(--ocr-warn); }

  /* ---- two-pane: queue left, one decision right ---- */
  .ocr-split { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px;
               align-items: start; }
  @media (max-width: 1180px) { .ocr-split { grid-template-columns: minmax(0, 1fr); } }

  .ocr-card { background: var(--ocr-surface); border: 1px solid var(--ocr-border);
              border-radius: 10px; overflow: hidden; }
  .ocr-card-head { display: flex; align-items: center; justify-content: space-between;
                   gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--ocr-border);
                   background: var(--ocr-bg); }
  .ocr-card-title { font-weight: 650; font-size: 13px; }

  /* tabs encode a real split: coverage rows cannot be answered with an alias at all */
  .ocr-tabs { display: flex; gap: 4px; }
  .ocr-tab { border: 1px solid transparent; background: none; border-radius: 7px;
             padding: 4px 11px; font-size: 12.5px; color: var(--ocr-muted); cursor: pointer; }
  .ocr-tab.is-on { background: var(--ocr-surface); border-color: var(--ocr-border);
                   color: var(--ocr-text); font-weight: 600; }

  /* fixed layout so the columns do not reflow as the text length changes */
  table.ocr-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  table.ocr-table th { text-align: left; font-weight: 600; color: var(--ocr-muted);
                       font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
                       padding: 9px 14px; border-bottom: 1px solid var(--ocr-border);
                       white-space: nowrap; }
  table.ocr-table td { padding: 10px 14px; border-bottom: 1px solid var(--ocr-line);
                       vertical-align: middle; font-size: 12.5px; }
  table.ocr-table tr:last-child td { border-bottom: 0; }
  .ocr-col-product { width: auto; }
  .ocr-col-oem     { width: 130px; }
  .ocr-col-affects { width: 132px; }
  .ocr-col-state   { width: 190px; }
  .ocr-col-act     { width: 96px; text-align: right; }
  .ocr-row-on td { background: var(--ocr-accent-soft); }
  .ocr-rowlink { cursor: pointer; }
  .ocr-rowlink:hover td { background: var(--ocr-bg); }

  /* product text is the thing being judged, so it gets room and never truncates away */
  .ocr-product { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
                 font-size: 12.5px; word-break: break-word; }
  .ocr-affects { font-variant-numeric: tabular-nums; color: var(--ocr-muted);
                 white-space: nowrap; }

  .ocr-pill { display: inline-block; border-radius: 999px; padding: 1px 8px;
              font-size: 11.5px; font-weight: 600; white-space: nowrap; }
  .ocr-pill-todo { background: var(--ocr-warn-soft); color: var(--ocr-warn); }
  .ocr-pill-done { background: var(--ocr-ok-soft); color: var(--ocr-ok); }
  .ocr-pill-muted { background: rgb(241, 245, 249); color: var(--ocr-muted); }

  .ocr-empty { text-align: center; color: var(--ocr-muted); padding: 34px 14px; }
  .ocr-scroll { max-height: 64vh; overflow-y: auto; }

  /* ---- decision panel ---- */
  .ocr-panel { position: sticky; top: 12px; }
  @media (max-width: 1180px) { .ocr-panel { position: static; } }
  .ocr-panel-body { padding: 14px; }
  .ocr-panel-empty { padding: 40px 18px; text-align: center; color: var(--ocr-muted);
                     font-size: 12.5px; }

  .ocr-subject { font-family: ui-monospace, Menlo, monospace; font-size: 13.5px;
                 font-weight: 600; word-break: break-word; margin-bottom: 3px; }
  .ocr-context { color: var(--ocr-muted); font-size: 12px; margin-bottom: 14px; }

  /* one radio per line - three across wrapped mid-word at panel width */
  .ocr-choices { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
  .ocr-choice { display: flex; gap: 8px; align-items: flex-start; padding: 7px 9px;
                border: 1px solid var(--ocr-border); border-radius: 8px; cursor: pointer; }
  .ocr-choice + .ocr-choice { margin-top: 4px; }
  .ocr-choice.is-on { border-color: var(--ocr-accent); background: var(--ocr-accent-soft); }
  .ocr-choice input { margin: 2px 0 0; }
  .ocr-choice-text { display: flex; flex-direction: column; }
  .ocr-choice-text b { font-weight: 600; font-size: 12.5px; }
  .ocr-choice-text span { color: var(--ocr-muted); font-size: 11.5px; }

  .ocr-field { margin-bottom: 12px; }
  .ocr-field label { display: block; font-size: 11px; color: var(--ocr-muted);
                     text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 5px; }
  .ocr-help { color: var(--ocr-muted); font-size: 11.5px; margin: 5px 0 0; }

  .ocr-hits { border: 1px solid var(--ocr-border); border-radius: 8px; margin-top: 8px;
              max-height: 210px; overflow-y: auto; }
  .ocr-hit { display: block; width: 100%; text-align: left; border: 0;
             border-bottom: 1px solid var(--ocr-line); background: none; padding: 8px 10px;
             font-size: 12.5px; cursor: pointer; color: var(--ocr-text); }
  .ocr-hit:last-child { border-bottom: 0; }
  .ocr-hit:hover { background: var(--ocr-accent-soft); }
  .ocr-hit[data-picked="1"] { background: var(--ocr-accent-soft); font-weight: 600; }
  .ocr-hint { padding: 10px; color: var(--ocr-muted); font-size: 12px; }

  .ocr-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
                 padding-top: 12px; border-top: 1px solid var(--ocr-line); }
  .ocr-msg { font-size: 12px; margin-top: 10px; min-height: 16px; }
  .ocr-msg-bad { color: var(--ocr-danger); }
  .ocr-msg-ok { color: var(--ocr-ok); }

  .ocr-note { background: var(--ocr-warn-soft); border: 1px solid rgb(253, 230, 138);
              color: var(--ocr-warn); border-radius: 8px; padding: 10px 12px;
              font-size: 12.5px; }
  </style>

  <div class="ocr-head">
    <div>
      <h2 class="ocr-title">Resolve products</h2>
      <p class="ocr-sub">Each entry is one product name the matcher could not place. Answer
         it once and every row carrying that text is resolved &mdash; on this circular and
         on every later one.</p>
    </div>
    <div class="ocr-tools">
      <select class="ocr-input" data-ocr-doc style="width:auto;min-width:230px;"></select>
      <select class="ocr-input" data-ocr-brand style="width:auto;min-width:150px;"
              title="Show only one OEM's decisions"></select>
      <button class="ocr-btn" type="button" data-ocr-export
              title="Emit every saved decision as SQL so it can be replayed on another environment">Export as SQL</button>
      <button class="ocr-btn ocr-btn-primary" type="button" data-ocr-reingest
              title="Decisions are read when the circular is parsed, so they need a re-parse to take effect">Re-ingest to apply</button>
    </div>
  </div>

  <div class="ocr-strip">
    <span class="ocr-chip">Naming <b data-ocr-count-naming>&ndash;</b></span>
    <span class="ocr-chip">Coverage <b data-ocr-count-coverage>&ndash;</b></span>
    <span class="ocr-chip ocr-chip-pending" data-ocr-pending style="display:none;"></span>
  </div>

  <div class="ocr-split">

    <div class="ocr-card">
      <div class="ocr-card-head">
        <div class="ocr-tabs">
          <button class="ocr-tab is-on" type="button" data-ocr-tab="NAMING">Naming</button>
          <button class="ocr-tab" type="button" data-ocr-tab="COVERAGE">Coverage</button>
        </div>
        <span class="ocr-num" data-ocr-listnote></span>
      </div>
      <div class="ocr-scroll">
        <table class="ocr-table">
          <thead>
            <tr>
              <th class="ocr-col-product">Product as printed</th>
              <th class="ocr-col-oem">OEM</th>
              <th class="ocr-col-affects">Affects</th>
              <th class="ocr-col-state">Decision</th>
              <th class="ocr-col-act"></th>
            </tr>
          </thead>
          <tbody data-ocr-body>
            <tr><td colspan="5" class="ocr-empty">Loading&hellip;</td></tr>
          </tbody>
        </table>
      </div>
    </div>

    <div class="ocr-panel">
      <div class="ocr-card">
        <div class="ocr-card-head">
          <span class="ocr-card-title">Decision</span>
          <span class="ocr-num" data-ocr-panel-state></span>
        </div>
        <div data-ocr-panel-body>
          <div class="ocr-panel-empty">Pick a product on the left to resolve it.</div>
        </div>
      </div>
    </div>

  </div>

</div>

<script type="text/javascript">
    window.ocrContext = "${rc.contextPath}";

    // Standalone bootstrap - the fragment arrives alone when the URL is opened directly,
    // with no include-scripts.vm, so the screen would never initialise.
    (function () {
        var base = window.ocrContext || '';
        function addScript(src, next) {
            var s = document.createElement('script');
            s.src = src;
            s.onload = next;
            document.head.appendChild(s);
        }
        // The script registers everything inside $(function(){...}), which runs on the
        // NEXT tick - so at this script's onload the init function does not exist yet.
        // Calling it here directly is a silent no-op that leaves the screen on "Loading".
        // Defer through jQuery's ready queue instead: our callback is registered after
        // the file's own, so it runs after it.
        function start() {
            if (!window.jQuery) { return; }
            window.jQuery(function () {
                if (window.initOfferCircularResolve) { window.initOfferCircularResolve(); }
            });
        }
        if (!window.jQuery) {
            addScript(base + '/resources/js/jquery-3.2.1.min.js', function () {
                addScript(base + '/resources/js/offer-circular-resolve.js?v=${version}', start);
            });
        } else if (!window.initOfferCircularResolve) {
            addScript(base + '/resources/js/offer-circular-resolve.js?v=${version}', start);
        } else {
            start();
        }
    })();
</script>
</section>