Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 64 additions & 37 deletions README.md

Large diffs are not rendered by default.

396 changes: 390 additions & 6 deletions assets/app-extra.js

Large diffs are not rendered by default.

456 changes: 189 additions & 267 deletions assets/app.js

Large diffs are not rendered by default.

45 changes: 41 additions & 4 deletions assets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,7 @@ body{font-family:var(--font-body);background:var(--bg);color:var(--text);min-hei
.field input{border:none;outline:none;background:transparent;padding:0 10px;height:38px;font-size:15px;font-family:var(--font-mono);font-weight:500;color:var(--text);width:100%;min-width:0}
.field-next{display:none;flex-shrink:0;width:30px;height:30px;border-radius:50%;border:none;background:var(--accent);color:var(--accent-fg);cursor:pointer;margin-right:4px;align-items:center;justify-content:center;transition:opacity .15s;opacity:0.7}
.field-next:hover{opacity:1}
/* "% on MRP + 18% GST" on one line would take a third of the field. Wrapped to
two it still clears the 38px row, and it balances the two-line mode tabs
directly above. */
.field .field-suf{padding:0 10px;font-size:12px;font-weight:500;color:var(--text3);border-left:1px solid var(--border);height:38px;display:flex;align-items:center;text-align:right;line-height:1.2;max-width:86px;background:var(--surface2);flex-shrink:0}
.field .field-suf{padding:0 10px;font-size:12px;font-weight:500;color:var(--text3);border-left:1px solid var(--border);height:38px;display:flex;align-items:center;white-space:nowrap;background:var(--surface2);flex-shrink:0}
/* The hint is not the data — at the input's own size it would not fit what is
left of a narrow field. */
.field input::placeholder{font-family:var(--font-body);font-size:12.5px}
Expand Down Expand Up @@ -497,6 +494,11 @@ html[data-theme="dark"] .hist-del-btn:hover{background:rgba(239,68,68,0.15);bord
.ob-tip{font-size:11.5px;color:var(--text2);text-align:center;background:var(--surface2);border:1px solid var(--border);border-radius:10px;padding:10px 14px;line-height:1.5}

.hmenu-dropdown{display:none;position:absolute;right:0;top:calc(100% + 8px);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-modal);min-width:160px;overflow:hidden;z-index:400}
/* The Tools menu reuses the hamburger's dropdown, but hangs off a button that
sits mid-row rather than at the right edge of the header. */
.tools-wrap{position:relative;display:inline-flex}
.tools-menu{left:0;right:auto;min-width:196px;text-align:left}
.hbtn-caret{margin-left:1px;opacity:.75}
.hmenu-dropdown.open{display:block;animation:modalIn .15s ease}
.hmenu-item{display:flex;align-items:center;gap:10px;padding:11px 16px;font-size:13px;font-weight:500;color:var(--text);cursor:pointer;font-family:var(--font-body);border:none;background:none;width:100%;text-align:left;transition:background .12s}
.hmenu-item:hover{background:var(--surface2)}
Expand Down Expand Up @@ -884,6 +886,22 @@ html[data-theme="dark"] .lbl-field:focus-within{box-shadow:0 0 0 3px rgba(240,23
.cv-input::after{content:'%';font-size:12px;color:var(--text3);margin-left:4px}
.cv-hint{font-size:10.5px;color:var(--text3);line-height:1.4}
.cv-swap{align-self:center;margin-top:14px;font-size:16px;color:var(--text3);flex-shrink:0}
/* Currency converter: same two-field shape, but each side carries a currency
picker instead of the fixed "%" the GP converter appends. */
/* Amounts here run long — ₹20,833.33 against a GP figure's "25" — so the
currency converter's boxes take a smaller size than the GP one's. */
.cv-input.cc-input::after{content:none}
.cc-input input{font-size:15px}
/* 400px is right for a confirmation. This one carries two currency pickers
and two amounts, and ₹20,833.33 was being cut off at the last digit. */
.cc-modal{max-width:500px}
.cv-ccy{border:none;background:transparent;font-family:var(--font-body);font-size:12px;font-weight:600;
color:var(--text2);outline:none;cursor:pointer;padding:0 8px 0 0;margin-right:8px;
border-right:1px solid var(--border);align-self:stretch}
.cv-swap-btn{background:none;border:1px solid var(--border-ctrl);border-radius:50%;width:30px;height:30px;
display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:15px;
color:var(--text2);font-family:var(--font-body);transition:all .15s;padding:0}
.cv-swap-btn:hover{border-color:var(--text2);color:var(--text)}
.cv-out{font-size:11.5px;line-height:1.55;color:var(--text2);min-height:34px;margin:14px 0 0}
.cv-out.bad{color:var(--amber)}
.feat-intro{font-size:12px;color:var(--text2);line-height:1.55;margin:0 0 12px}
Expand Down Expand Up @@ -988,6 +1006,7 @@ html[data-theme="dark"] .qt-del:hover{background:rgba(239,68,68,0.15)}
.control-bar .divider{display:none}
.cv-pair{flex-direction:column;gap:14px}
.cv-swap{align-self:flex-start;margin-top:0;transform:rotate(90deg)}
.cv-swap-btn{width:44px;height:44px}
.cv-input input{min-height:44px}
.solver{grid-column:1/-1;padding-top:10px;border-top:1px solid rgba(255,255,255,0.16)}
.fx-note{white-space:normal;width:100%}
Expand Down Expand Up @@ -1048,6 +1067,24 @@ html[data-theme="dark"] .qt-del:hover{background:rgba(239,68,68,0.15)}
.sum-lbl{font-size:10.5px}
}

/* ── NARROW PHONES (must come after the mobile block) ──
"% on MRP + 18% GST" stays on one line — the input beside it never holds
more than a couple of digits — but on a 320px screen the label and the
prefix together leave it nothing. Both step down to the 10.5px floor here,
and only here. */
@media(max-width:380px){
/* No amount of trimming fits an 18-character label, a prefix, a number and a
next button across 264px. The label drops to its own row underneath
instead — still one line, and the input gets the width back. */
.field{flex-wrap:wrap}
/* width:100% would claim a whole row for the input alone; it has to share the
first one with the prefix and the next button. */
.field input{width:auto;flex:1 1 60px}
.field .field-suf{order:9;flex:0 0 100%;height:auto;padding:5px 10px;
justify-content:flex-end;border-left:none;border-top:1px solid var(--border)}
.field .sym{padding:0 8px}
}

/* ── MOTION ──
One easing scale so movement feels consistent. --ease-spring overshoots
slightly, which reads as physical on elements that travel (modals, toast,
Expand Down
Binary file modified docs/screenshot-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 77 additions & 15 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,28 @@ <h1 class="header-brand">Price Calc</h1>
<svg width="13" height="13" viewBox="0 0 14 14" fill="none" aria-hidden="true"><rect x="2" y="2" width="10" height="3" rx="1" stroke="currentColor" stroke-width="1.3"/><rect x="2" y="7.5" width="10" height="4.5" rx="1" stroke="currentColor" stroke-width="1.3"/></svg>
Presets
</button>
<button class="hbtn" id="hbtn-convert" data-click="openConvert" title="Convert between GP % and markup %">
<svg width="13" height="13" viewBox="0 0 14 14" fill="none" aria-hidden="true"><path d="M2 5h9l-2.2-2.2M12 9H3l2.2 2.2" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>
GP ⇄ Markup
</button>
<button class="hbtn" id="hbtn-quote" data-click="a6" title="Multi-line quote builder (M)">
<svg width="12" height="12" viewBox="0 0 12 12" fill="none"><rect x="1.5" y="1.5" width="9" height="9" rx="1" stroke="currentColor" stroke-width="1.3"/><path d="M3.5 4.5h5M3.5 6.5h5M3.5 8.5h3" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/></svg>
Quote
</button>
<div class="tools-wrap" id="hbtn-tools-wrap">
<button class="hbtn" id="hbtn-tools" data-click="toolsToggle" aria-expanded="false"
aria-controls="tools-menu" title="Quote builder and converters (T)">
<svg width="13" height="13" viewBox="0 0 14 14" fill="none" aria-hidden="true"><path d="M9.4 1.6a2.8 2.8 0 00-3.2 3.7L1.9 9.6a1.1 1.1 0 001.6 1.6l4.3-4.3a2.8 2.8 0 003.7-3.2L9.9 5.3 8.3 3.7l1.1-2.1z" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>
Tools
<svg class="hbtn-caret" width="9" height="9" viewBox="0 0 10 10" fill="none" aria-hidden="true"><path d="M2 4l3 3 3-3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
</button>
<div class="hmenu-dropdown tools-menu" id="tools-menu">
<button class="hmenu-item" id="tool-quote" data-click="toolQuote">
<svg width="14" height="14" viewBox="0 0 12 12" fill="none" aria-hidden="true"><rect x="1.5" y="1.5" width="9" height="9" rx="1" stroke="currentColor" stroke-width="1.3"/><path d="M3.5 4.5h5M3.5 6.5h5M3.5 8.5h3" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/></svg>
Quote builder
</button>
<button class="hmenu-item" id="tool-convert" data-click="toolConvert">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true"><path d="M2 5h9l-2.2-2.2M12 9H3l2.2 2.2" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>
GP &#8646; Markup
</button>
<button class="hmenu-item" id="tool-ccy" data-click="toolCcy">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true"><circle cx="7" cy="7" r="5.2" stroke="currentColor" stroke-width="1.3"/><path d="M8.8 5.2A2 2 0 007 4.4c-1 0-1.8.6-1.8 1.4 0 1.9 3.6.9 3.6 2.8 0 .8-.8 1.4-1.8 1.4a2 2 0 01-1.8-.8M7 3.2v7.6" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>
Currency converter
</button>
</div>
</div>
<div class="hdivider"></div>
<button class="hbtn hbtn-icon" id="undo-btn" data-click="a7" title="Undo (⌘Z)" aria-label="Undo" disabled>
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true"><path d="M3 6h5.5a3 3 0 010 6H6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M5 3.5L2.5 6 5 8.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
Expand Down Expand Up @@ -156,6 +170,14 @@ <h1 class="header-brand">Price Calc</h1>
<svg width="14" height="14" viewBox="0 0 12 12" fill="none"><rect x="1.5" y="1.5" width="9" height="9" rx="1" stroke="currentColor" stroke-width="1.3"/><path d="M3.5 4.5h5M3.5 6.5h5M3.5 8.5h3" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/></svg>
Quote builder
</button>
<button class="hmenu-item" id="hmenu-convert" data-click="toolConvert">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true"><path d="M2 5h9l-2.2-2.2M12 9H3l2.2 2.2" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>
GP &#8646; Markup
</button>
<button class="hmenu-item" id="hmenu-ccy" data-click="toolCcy">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true"><circle cx="7" cy="7" r="5.2" stroke="currentColor" stroke-width="1.3"/><path d="M8.8 5.2A2 2 0 007 4.4c-1 0-1.8.6-1.8 1.4 0 1.9 3.6.9 3.6 2.8 0 .8-.8 1.4-1.8 1.4a2 2 0 01-1.8-.8M7 3.2v7.6" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>
Currency converter
</button>
<div class="hmenu-sep"></div>
<button class="hmenu-item" id="hmenu-undo" data-click="a17">
<svg width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M3 6h5.5a3 3 0 010 6H6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M5 3.5L2.5 6 5 8.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
Expand Down Expand Up @@ -350,7 +372,7 @@ <h1 class="header-brand">Price Calc</h1>
<div class="mode-tabs" id="pmt" style="display:none">
<button class="mtab on" id="pmv" data-click="a52"><span id="sym-pmv">₹</span> Value</button>
<button class="mtab" id="pmg" data-click="a53">GP %</button>
<button class="mtab" id="pmm" data-click="a54">Margin %</button>
<button class="mtab" id="pmm" data-click="a54">Markup %</button>
</div>
<div class="field" id="prf" style="display:none">
<span class="sym" id="pru">₹</span>
Expand All @@ -359,7 +381,7 @@ <h1 class="header-brand">Price Calc</h1>
<div class="rows">
<div class="row"><span class="row-lbl">Profit (excl GST basis)</span><span class="row-val big" id="pvv">—</span></div>
<div class="row"><span class="row-lbl">GP % <span style="font-weight:300;font-size:10px">(profit ÷ SP)</span></span><span class="row-val" id="pgp">—</span></div>
<div class="row"><span class="row-lbl">Margin % <span style="font-weight:300;font-size:10px">(profit ÷ eff. CP)</span></span><span class="row-val" id="pmrg">—</span></div>
<div class="row"><span class="row-lbl">Markup % <span style="font-weight:300;font-size:10px">(profit ÷ eff. CP)</span></span><span class="row-val" id="pmrg">—</span></div>
<div class="row"><span class="row-lbl">Absolute spread</span><span class="row-val dim" id="pspd">—</span></div>
</div>
<div class="rows rows-be" id="pf-be-block" style="display:none">
Expand Down Expand Up @@ -444,7 +466,7 @@ <h2 class="summary-title">Summary</h2>
<div class="sum-item"><div class="sum-lbl">SP Incentives <span id="sym-s-spinc">₹</span></div><div class="sum-val dim" id="s-spinc">—</div></div>
<div class="sum-item"><div class="sum-lbl">Profit <span id="sym-s-pr">₹</span></div><div class="sum-val dim" id="s-pr">—</div></div>
<div class="sum-item"><div class="sum-lbl">GP %</div><div class="sum-val dim" id="s-gp">—</div></div>
<div class="sum-item"><div class="sum-lbl">Margin %</div><div class="sum-val dim" id="s-mg">—</div></div>
<div class="sum-item"><div class="sum-lbl">Markup %</div><div class="sum-val dim" id="s-mg">—</div></div>
<div class="sum-order-sep" id="s-order-sep" style="display:none"></div>
<div class="sum-item sum-order" id="s-item-qty" style="display:none"><div class="sum-lbl">Quantity</div><div class="sum-val dim" id="s-qty">—</div></div>
<div class="sum-item sum-order" id="s-item-order" style="display:none"><div class="sum-lbl">Order Value (incl GST)</div><div class="sum-val dim" id="s-order">—</div></div>
Expand Down Expand Up @@ -811,9 +833,9 @@ <h2 class="modal-title" id="modal-title-settings">Settings</h2>
</div>
</div>
<div style="display:flex;align-items:center;gap:6px;flex:1">
<span style="font-size:12px;color:var(--text2);white-space:nowrap">Min Margin %</span>
<span style="font-size:12px;color:var(--text2);white-space:nowrap">Min Markup %</span>
<div class="floor-input-wrap" style="flex:1">
<input type="number" inputmode="decimal" id="floor-mg" value="" placeholder="—" min="0" max="100" step="0.1" data-input="a106" aria-label="Minimum Margin percentage floor">
<input type="number" inputmode="decimal" id="floor-mg" value="" placeholder="—" min="0" max="100" step="0.1" data-input="a106" aria-label="Minimum Markup percentage floor">
<span>%</span>
</div>
</div>
Expand Down Expand Up @@ -976,6 +998,45 @@ <h2 class="modal-title" id="modal-title-compare">Comparison</h2>
<!-- GP % and markup % are the same profit over different denominators, and
suppliers quote whichever suits them. Two fields, either one drives the
other. -->
<!-- ═══ CURRENCY CONVERTER ═══ -->
<div class="modal-overlay" id="overlay-ccyconv" data-click="ccyConvOverlay" role="presentation">
<div class="modal confirm-modal cc-modal" role="dialog" aria-modal="true" aria-labelledby="modal-title-ccyconv">
<div class="modal-header">
<h2 class="modal-title" id="modal-title-ccyconv">Currency converter</h2>
<button class="modal-close" data-click="ccyConvClose" aria-label="Close currency converter">&times;</button>
</div>
<div class="modal-body">
<p class="cv-intro">Convert an amount between any two currencies at today&#8217;s rates.
A scratch pad — it does not change what the calculator is showing.</p>
<div class="cv-pair">
<label class="cv-field">
<span class="cv-lbl">From</span>
<span class="cv-input cc-input">
<select class="cv-ccy" id="cc-from" data-change="ccyConvFrom" aria-label="Convert from"></select>
<input type="number" id="cc-from-amt" step="0.01" inputmode="decimal" autocomplete="off"
placeholder="100" data-input="ccyConvFromAmt" aria-label="Amount to convert">
</span>
</label>
<button class="cv-swap cv-swap-btn" data-click="ccyConvSwap"
title="Swap the two currencies" aria-label="Swap the two currencies">&#8646;</button>
<label class="cv-field">
<span class="cv-lbl">To</span>
<span class="cv-input cc-input">
<select class="cv-ccy" id="cc-to" data-change="ccyConvTo" aria-label="Convert to"></select>
<input type="number" id="cc-to-amt" step="0.01" inputmode="decimal" autocomplete="off"
placeholder="8,320" data-input="ccyConvToAmt" aria-label="Converted amount">
</span>
</label>
</div>
<p class="cv-out" id="cc-out" role="status" aria-live="polite"></p>
<div class="confirm-actions">
<button class="confirm-btn" id="cc-refresh" data-click="ccyConvRefresh">Update rates</button>
<button class="confirm-btn primary" data-click="ccyConvClose">Done</button>
</div>
</div>
</div>
</div>

<div class="modal-overlay" id="overlay-convert" data-click="convertOverlay" role="presentation">
<div class="modal confirm-modal" role="dialog" aria-modal="true" aria-labelledby="modal-title-convert">
<div class="modal-header">
Expand All @@ -997,7 +1058,7 @@ <h2 class="modal-title" id="modal-title-convert">GP % &#8646; Markup %</h2>
<span class="cv-lbl">Markup %</span>
<span class="cv-input"><input type="number" id="cv-mk" step="0.01" inputmode="decimal"
autocomplete="off" placeholder="25" data-input="convertFromMk"></span>
<small class="cv-hint">profit &divide; cost price — the app calls this Margin %</small>
<small class="cv-hint">profit &divide; cost price — shown as Markup % on the calculator</small>
</label>
</div>
<p class="cv-out" id="cv-out" role="status" aria-live="polite"></p>
Expand Down Expand Up @@ -1025,6 +1086,7 @@ <h2 class="modal-title" id="modal-title-shortcuts">Keyboard Shortcuts</h2>
<div class="kb-row"><span class="kb-desc">Copy summary</span><span class="kb-keys"><span class="kbd kbd-mod">⌘</span><span class="kbd">C</span></span></div>
<div class="kb-row"><span class="kb-desc">Undo</span><span class="kb-keys"><span class="kbd kbd-mod">⌘</span><span class="kbd">Z</span></span></div>
<div class="kb-row"><span class="kb-desc">Redo</span><span class="kb-keys"><span class="kbd kbd-mod">⌘</span><span class="kbd">⇧</span><span class="kbd">Z</span></span></div>
<div class="kb-row"><span class="kb-desc">Open Tools</span><span class="kb-keys"><span class="kbd">T</span></span></div>
<div class="kb-row"><span class="kb-desc">Open quote builder</span><span class="kb-keys"><span class="kbd">M</span></span></div>
<div class="kb-row"><span class="kb-desc">Open saved presets</span><span class="kb-keys"><span class="kbd">E</span></span></div>
<div class="kb-section-title">Mode &amp; GST</div>
Expand Down Expand Up @@ -1133,7 +1195,7 @@ <h2 class="modal-title" id="confirm-title">Confirm</h2>
<div class="mini-sep"></div>
<div class="mini-item"><span class="mini-lbl">GP %</span><span class="mini-val" id="mini-gp">—</span></div>
<div class="mini-sep"></div>
<div class="mini-item"><span class="mini-lbl">Margin %</span><span class="mini-val" id="mini-mg">—</span></div>
<div class="mini-item"><span class="mini-lbl">Markup %</span><span class="mini-val" id="mini-mg">—</span></div>
</div>

<!-- ═══ FLOATING ACTION BUTTON (mobile, Default mode only) ═══ -->
Expand Down
Loading
Loading