From 88819c3a5f67ee76834be32d7a76084dff9ccd9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Mon, 26 Oct 2026 11:07:00 -0300 Subject: [PATCH] feat: one price per product; the grade is shown but no longer prices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dropstar asked on 2026-10-23 to drop the five-band ladder by grade: textile R$ 19,90 a ready sheet and R$ 21,90 loose art, UV R$ 79,90 and R$ 89,90. - the server charges PRICES (app/core/pricing.py) whatever the grade; the grade is still validated and kept with the item, and discount_cents is gone - a file opened by hand pays the product's price plus MANUAL_FILE_EXTRA_CENTS - the Site's PRECO replaces FAIXAS, TABELA and MONTAGEM; the top chip, the home example, the product cards, the selector and the price table read it (data-preco), so no page still says "a partir de R$ 14,90" - no "Desconto pela nota", ladder, "cai até" or "sai mais barato" anywhere; the buy box shows "Nota da arte" on its own line, the 96 DPI refusal and the resolution warning stay - the review reason "Nota informada sem análise da arte" is removed: it only stopped a discount. The server still checks the grade against the files, so the grade shown on the Kanban and in Tiny stays honest - the Tiny probe's test order uses the single price - docs/CONTEXT.md: Commercial rules and Still to do Co-Authored-By: Claude Opus 5.5 --- app/api/quotes.py | 5 ++-- app/core/pricing.py | 31 +++++++++----------- app/grade_check.py | 12 ++++---- app/quote_review.py | 17 +++++------ app/tiny_probe.py | 4 +-- docs/CONTEXT.md | 52 +++++++++++++++++++++++---------- docs/ROADMAP.md | 2 ++ tests/artwork_browser_test.mjs | 23 +++++++++++++-- tests/smoke_test.py | 16 ++++++---- tests/test_pricing.py | 52 ++++++++++++++++++++------------- tests/test_quote_review.py | 6 ++-- tests/test_tiny.py | 4 ++- web/checkout.js | 9 ++++-- web/index.html | 53 ++++++++++++++-------------------- web/kanban.js | 5 ++-- web/site-cart.js | 24 +++------------ web/site-compra.js | 21 ++++---------- web/site-config.js | 21 ++++---------- web/site-modes.js | 10 +++---- web/site-pdf.js | 20 +++++++------ web/site-quality.js | 14 ++++----- web/site-steps.js | 6 ++-- web/site-v2.css | 14 --------- 23 files changed, 211 insertions(+), 210 deletions(-) diff --git a/app/api/quotes.py b/app/api/quotes.py index 0647817..0111fab 100644 --- a/app/api/quotes.py +++ b/app/api/quotes.py @@ -48,8 +48,9 @@ def create_quote(body: QuoteRequest, session_id=Depends(owner)): raise HTTPException(422, 'JPG não tem fundo transparente. Envie a arte em PNG ou PDF.') require_clean(row) rows[str(uid)] = row - # The grade sets the price and came from the browser: before a cart is - # approved at checkout, the server works it out from the files. + # The grade came from the browser and is shown with the order (it no + # longer sets the price): before a cart is approved at checkout, the + # server works it out from the files. note = mismatch(Files(storage), draft['items'], rows) if reason is None else None reason = reason or note uid = uuid4() diff --git a/app/core/pricing.py b/app/core/pricing.py index 21444e7..0702d86 100644 --- a/app/core/pricing.py +++ b/app/core/pricing.py @@ -1,23 +1,19 @@ -"""Exact approved Site DTF price ladders; integer BRL cents at the boundary. +"""Dropstar's single price per metre for each product; integer BRL cents at the boundary. -Quantity/grade must be supplied by an authenticated commercial reviewer. -This module does not inspect artwork or perform pre-flight. +One price per product (Dropstar, 2026-10-23). The grade is still recorded with +each item, for the customer and the print room, but it no longer changes the +price. This module does not inspect artwork or perform pre-flight. """ import os import re from decimal import Decimal, ROUND_CEILING -TIERS = { - 'file': [(90,1490),(75,1620),(60,1750),(40,1870),(0,1990)], - 'avulsa': [(90,2490),(75,2620),(60,2750),(40,2870),(0,2990)], - 'uvfile': [(90,6990),(75,7390),(60,7790),(40,8190),(0,8590)], - 'uv': [(90,8390),(75,8790),(60,9190),(40,9590),(0,9990)], -} +PRICES = {'file': 1990, 'avulsa': 2190, 'uvfile': 7990, 'uv': 8990} # A finished sheet the Site cannot open (CDR, AI, PSD, TIFF) is opened by a -# person before printing. It is priced at the top of the ladder, plus this per -# metre when the business sets it, to make the formats the robot reads the -# cheaper path. Zero (the default) adds nothing. +# person before printing. It pays this per metre on top of the product's price +# when the business sets it, to make the formats the robot reads the cheaper +# path. Zero adds nothing. MANUAL_FORMATS = re.compile(r'\.(cdr|ai|psd|psb|tiff?)$', re.I) @@ -37,21 +33,20 @@ def is_manual(item, names) -> bool: def price(mode: str, metres: str, grade: int, extra_cents: int = 0) -> dict: + """The item's charge. The grade is validated and kept with the item; the + price does not depend on it.""" length = Decimal(str(metres)) - if mode not in TIERS or not length.is_finite() or not 0 < length <= 12000: + if mode not in PRICES or not length.is_finite() or not 0 < length <= 12000: raise ValueError('Invalid product or length') if isinstance(grade, bool) or not isinstance(grade, int) or not 0 <= grade <= 100: raise ValueError('Grade must be an integer between 0 and 100') billed = max(Decimal('1'), (length * 10).to_integral_value(rounding=ROUND_CEILING) / 10) if isinstance(extra_cents, bool) or not isinstance(extra_cents, int) or extra_cents < 0: raise ValueError('Invalid extra charge') - tier = next(cents for minimum, cents in TIERS[mode] if grade >= minimum) - unit = tier + extra_cents + unit = PRICES[mode] + extra_cents priced = {'mode': mode, 'metres': str(length), 'grade': grade, 'billed_metres': str(billed), 'unit_cents': unit, - 'total_cents': int(billed * unit), - 'discount_cents': int(billed * (TIERS[mode][-1][1] - tier))} + 'total_cents': int(billed * unit)} if extra_cents: priced['manual_extra_cents'] = extra_cents return priced - diff --git a/app/grade_check.py b/app/grade_check.py index b7a63e3..ab8ba43 100644 --- a/app/grade_check.py +++ b/app/grade_check.py @@ -1,9 +1,11 @@ -"""The grade (the resolution discount) recomputed from the uploaded files. +"""The grade recomputed from the uploaded files. The Site grades the art in the customer's browser and sends the grade with the -cart, and the price depends on it. A customer who edits the page could claim a -better grade, so before a cart is approved at checkout the server reads the -files it already has and works the grade out again, by the Site's own rules: +cart. The price no longer depends on it (one price per product, 2026-10-23), +but the grade is shown with the order on the Kanban and in Tiny. A customer +who edits the page could claim a better grade, so before a cart is approved at +checkout the server reads the files it already has and works the grade out +again, by the Site's own rules: - a finished sheet: its pixel width over the sheet width is its DPI, and the item's grade comes from the worst sheet (web/site-quality.js); @@ -180,7 +182,7 @@ def mismatch(files, items, rows): """Why a cart's grades cannot be approved at checkout, or None.""" for item in items: if item['grade'] == 0: - continue # full price: nothing to verify + continue # no grade claimed: nothing to verify verified = item_grade(files, item, rows) if verified is None: return 'Nota não conferida no servidor' diff --git a/app/quote_review.py b/app/quote_review.py index da30f7c..9fab3de 100644 --- a/app/quote_review.py +++ b/app/quote_review.py @@ -1,16 +1,17 @@ """Quote approval: automatic at checkout, by an operator for the exceptions. -A quote the customer can pay is priced here from the server's own ladders, +A quote the customer can pay is priced here from the server's own prices, whether an operator approved it on the Kanban or the Site approved it the moment it was created. The Site is a shop: a customer who can price the order should be able to pay for it straight away, at any hour, so only orders a person must look at before charging wait for the Kanban (review_reason). -The grade (and so the discount) is worked out in the customer's browser and -checked against the files before an automatic approval (app/grade_check.py); -a grade the files do not support waits for review. The layout is still the -browser's (roadmap 3.9): the API checks its geometry. Operators see every -order's grade and artwork at Arte recebida. +Each product has one price (Dropstar, 2026-10-23): the grade no longer changes +what is charged. It is still worked out in the customer's browser and shown +with the order, so it is checked against the files before an automatic +approval (app/grade_check.py); a grade the files do not support waits for +review. The layout is still the browser's (roadmap 3.9): the API checks its +geometry. Operators see every order's grade and artwork at Arte recebida. """ import os from decimal import Decimal @@ -45,10 +46,6 @@ def review_reason(draft): for item in draft['items']: if item.get('production', {}).get('version') not in PRODUCTION_VERSIONS: return 'Montagem antiga' - # The Site grades only the art it could analyse; anything else is - # priced at the full rate. A discount on it did not come from the Site. - if item['quality_status'] == 'unverified' and item['grade'] != 0: - return 'Nota informada sem análise da arte' return None diff --git a/app/tiny_probe.py b/app/tiny_probe.py index 134fa2a..cdfe0d6 100644 --- a/app/tiny_probe.py +++ b/app/tiny_probe.py @@ -28,7 +28,7 @@ import time from datetime import datetime from decimal import Decimal, InvalidOperation -from .core.pricing import TIERS +from .core.pricing import PRICES from .core.secrets import load as load_secret_files from . import tiny @@ -38,7 +38,7 @@ FIND_WAIT_SECONDS = 5 def test_order(cnpj, email, celular, mode, now=None, metres='1'): number = 'TESTE-' + (now or datetime.now(tiny.BRASILIA)).strftime('%Y%m%d%H%M') - unit = TIERS[mode][0][1] + unit = PRICES[mode] total = int(Decimal(metres) * unit) return {'order_id': 'teste-integracao', 'number': number, 'event': 'payment_approved', 'order': {'customer': {'cnpj': cnpj, 'mail': email, 'zap': celular}, diff --git a/docs/CONTEXT.md b/docs/CONTEXT.md index 7b895d1..8e8a4d4 100644 --- a/docs/CONTEXT.md +++ b/docs/CONTEXT.md @@ -143,14 +143,32 @@ taxes, and payment-provider fees before presenting a commercial quote. ## Commercial rules -The existing rules in `web/index.html` are approved as the current source of -truth. Do **not** redesign, simplify, or change prices, discounts, minimums, -rounding, or product modes without explicit approval. +The rules in `web/index.html` and `app/core/pricing.py` are approved as the +current source of truth. Do **not** redesign, simplify, or change prices, +minimums, rounding, or product modes without explicit approval. -The current site contains four product modes, quality-based price tiers (to be -replaced by a single price per product, see "Still to do" below), -artwork-ready discounts, separate assembly charges for loose artwork, a -one-metre minimum, and ten-centimetre billing rounding. +The Site has four product modes, each with one price per metre (Dropstar, +2026-10-23, live in the code since 2026-10-26). It replaced the five-band +ladder by grade, its "a partir de R$ 14,90" and the separate assembly charge +for loose artwork: + +| Product | Ready sheet | Loose artwork | +|---|---:|---:| +| DTF textile, 57 cm | R$ 19,90 | R$ 21,90 | +| UV sticker, 28,5 cm | R$ 79,90 | R$ 89,90 | + +The grade (nota) is still computed and shown, to the customer, on the Kanban +and in Tiny's item note: it explains the file and no longer changes the price. +Artwork below 96 DPI is still refused, and a resolution warning must still be +acknowledged. The server still recomputes the grade from the files at checkout +(`app/grade_check.py`) and holds for review a cart whose grade the files do not +support, so the grade shown stays honest; the review reason "Nota informada sem +análise da arte" existed only to stop a discount and was removed. One-metre +minimum and ten-centimetre billing rounding. The prices are `PRECO` in +`web/site-config.js` and `PRICES` in `app/core/pricing.py`, and +`tests/test_pricing.py` checks they agree; every price on the Site's pages (top +chip, home example, product cards, product selector, price table) is filled +from `PRECO` through `data-preco`. Customers buy with a CPF (a person) or a CNPJ (a company), check digits validated on both sides. The value keeps the `cnpj` key in orders, quotes and @@ -158,7 +176,7 @@ accounts; Tiny gets a CPF contact as `tipoPessoa` F, Mercado Pago the matching identification type, and only CNPJs are looked up in the company registry. The browser may display the calculation, but production payment creation must -recalculate and validate all price, quantity, freight, and discount values on +recalculate and validate all price, quantity, and freight values on the server. Client-provided totals are never authoritative. Normal JPG/PNG uploads are individual artwork by default, including when uploaded @@ -166,14 +184,17 @@ from the by-metre panel. They use the existing loose-artwork editor, printed width, quantity, and live packing canvas; packed height determines metres. Customers uploading an already assembled film-width image must explicitly select the ready-sheet option before uploading. PDF and manual-format ready sheets keep -their existing workflow. These models retain their separate approved price tiers; +their existing workflow. These models keep their separate prices; image dimensions alone must never classify a normal artwork as a finished sheet. A finished sheet someone must open by hand (CDR, AI, PSD, TIFF, or a length the -customer typed) pays the top of the ladder plus `MANUAL_FILE_EXTRA_CENTS` per +customer typed) pays the product's price plus `MANUAL_FILE_EXTRA_CENTS` per metre (2026-10-13, asked at the 7 October meeting to steer customers to PNG). -It defaults to 0; the amount is the client's to set. The Site reads it from -`/api/session` and shows it before checkout; `app/core/pricing.py` charges it. +The production stack sets it to 200, R$ 2,00 a metre (Dropstar, 2026-10-23); +a value set in Portainer overrides it, and it is 0 locally and in CI. The +amount is the client's to set. The Site reads it from `/api/session` and shows +it before checkout (product page, help text, price table); +`app/core/pricing.py` charges it. ## Freight @@ -373,11 +394,10 @@ mirror stays, the designer does not move to the print queue, and Aguardando contato has no deadline of its own. There is no videocall: open points are settled in writing. +Done on 2026-10-26: the single price per product Dropstar asked for on +2026-10-23 (see Commercial rules), on the Site and the server. + Still to do (2026-10-26): -- Single price per product, asked by Dropstar on 2026-10-23 (not started): - ready sheet R$ 19,90 and loose art R$ 21,90 (textile), R$ 79,90 and R$ 89,90 - (UV). The grade stays on screen but no longer sets the price. Every "a - partir de R$ 14,90", the price table and the home example change with it. - The DTF number in Tiny's `numeroPedidoEcommerce` (today it is the purchase order, `numeroOrdemCompra`); confirm at the supervised Tiny test order. - Waiting on Dropstar: the DTF SITE category's numeric id (CATEGORY in diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 0e1a384..8d3e11d 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -847,6 +847,8 @@ print-file evidence still need correction before this item can close. where a server-side packer (3.2) has to agree, which was the point of splitting. - `[ ]` 5.7 — Commercial rules duplicated between `FAIXAS` (JS) and `TIERS` (Python) `(F26)`. `test_pricing` guards parity; generate one from the other instead. + 2026-10-26: one price per product now, `PRECO` (JS) and `PRICES` (Python); + `test_pricing` still guards parity. - `[ ]` 5.11 — Nothing tests the schema against an empty database. The 4.1 indexes were added next to the existing one, which sits before the tables they name, so `CREATE INDEX ... ON dtf_local.order_files` ran before that table existed. Every diff --git a/tests/artwork_browser_test.mjs b/tests/artwork_browser_test.mjs index 41d35af..76ec7be 100644 --- a/tests/artwork_browser_test.mjs +++ b/tests/artwork_browser_test.mjs @@ -151,6 +151,14 @@ try{ // Reproduce the reported entry path, with no navigation workaround. // Navigation links must reach the chooser, never preselect a product. assert.equal(await evaluate(`document.querySelectorAll('[data-modo-cta]').length`),0); + // One price per product (Dropstar, 2026-10-23), the same in the top chip, the + // home example, the product cards and the price table; nothing on the page + // still prices by the grade. + assert.deepEqual(await evaluate(`(()=>{const de=m=>[...document.querySelectorAll('[data-preco="'+m+'"]')].map(e=>e.textContent); + return {file:de('file'),avulsa:de('avulsa'),uvfile:de('uvfile'),uv:de('uv'), + stale:/14,90|conforme a nota|desconto|escada|menor preço da tabela/i.test(document.body.textContent)};})()`), + {file:['R$ 19,90','R$ 19,90','R$ 19,90','R$ 19,90'],avulsa:['R$ 21,90','R$ 21,90'], + uvfile:['R$ 79,90','R$ 79,90'],uv:['R$ 89,90','R$ 89,90'],stale:false}); await click('[data-modo="file"]'); // Opening a product paints on the next frame; on a busy runner the check // must wait for it rather than race it. @@ -178,7 +186,7 @@ try{ await evaluate(`sel([new File(['x'],'arte.jpg',{type:'image/jpeg'})])`); assert.equal(await evaluate(`artes.length===0 && $('recusa').textContent.includes('JPG não dá para enviar')`),true); // A large WebP artwork cannot be read in parts: it is measured from its - // header and placed as a full box, with the discount, instead of refused. + // header and placed as a full box, with its grade, instead of refused. await evaluate(`(()=>{const h=new Uint8Array(30);h.set([0x52,0x49,0x46,0x46,0,0,0,0,0x57,0x45,0x42,0x50,0x56,0x50,0x38,0x58]); h.set([0x39,0x09,0x00,0x39,0x09,0x00],24); const f=new File([h],'arte-grande.webp');Object.defineProperty(f,'size',{value:400*1048576});sel([f]);})()`); @@ -277,7 +285,16 @@ try{ await click('#bVoltar');await click('[data-modo="file"]'); await evaluate('sendSheet()'); await waitFor(()=>evaluate('folhas.length===1 && !!folhas[0].previewSrc && metros===0.342'),'ready-sheet image'); - assert.deepEqual(await evaluate(`({mode:modo,art:artes.length,title:$('montcabTit').textContent,rate:precoBase(100)})`),{mode:'file',art:0,title:'Sua folha',rate:14.9}); + assert.deepEqual(await evaluate(`({mode:modo,art:artes.length,title:$('montcabTit').textContent,rate:precoMetro()})`),{mode:'file',art:0,title:'Sua folha',rate:19.9}); + // One price per product (Dropstar, 2026-10-23): the sheet is graded, and the + // grade is shown, but the metre costs the same as for any other grade. + await waitFor(()=>evaluate('itemAtual?.nota>0'),'graded ready sheet'); + assert.deepEqual(await evaluate(`({unit:itemAtual.unit,total:itemAtual.total,shown:$('cNota').textContent===itemAtual.nota+'/100', + metre:$('cMetro').textContent,ladder:!!document.getElementById('cEscada'), + discount:/desconto/i.test($('carrLin').textContent+$('resLin').textContent+$('compra').textContent)})`), + {unit:19.9,total:19.9,shown:true,metre:'R$ 19,90',ladder:false,discount:false}); + assert.deepEqual(await evaluate(`({folha:$('tipoFolhaPreco').textContent,avulsa:$('tipoAvulsaPreco').textContent})`), + {folha:'R$ 19,90 /m',avulsa:'R$ 21,90 /m'}); assert.equal(await evaluate(`document.querySelectorAll('[data-cm]').length`),0); // With a sheet loaded the declaration is locked; it cannot flip under the customer. assert.equal(await evaluate(`document.querySelector('#tipoEnvio .cam[data-tipo="avulsa"]').disabled`),true); @@ -285,7 +302,7 @@ try{ await waitFor(()=>evaluate('metros===0.684'),'ready-sheet repetitions'); assert.equal(await evaluate(`document.querySelectorAll('.folhaPrevia').length`),1); await evaluate(`(()=>{folhas.push({f:new File(['manual'],'manual.cdr'),med:null,rep:1,m:1,an:null});pintaFolha();})()`); - await waitFor(()=>evaluate(`itemAtual?.nota===0 && itemAtual?.unit===TABELA[modo]`),'mixed analyzed and manual sheets use table pricing'); + await waitFor(()=>evaluate(`itemAtual?.nota===0 && itemAtual?.unit===PRECO[modo]+TAXA_MANUAL`),'mixed analyzed and manual sheets: the price plus the manual charge'); // Residue and a solid background stop the order before payment (Dropstar, // 2026-10-21). A residue is ink under 2 mm on both sides, measured in real // millimetres: the same dot, wherever it falls on the 1 mm grid, gets the diff --git a/tests/smoke_test.py b/tests/smoke_test.py index 35198a2..290048b 100644 --- a/tests/smoke_test.py +++ b/tests/smoke_test.py @@ -182,10 +182,12 @@ def run(): 'sources':[{**items[0]['production']['sources'][0],'measurement':'file'}]}} client.call('/operator/quotes/'+qid+'/approve',{'items':[altered,*items[1:]]},operator=True,expected=422) # Reviewer corrects a browser-supplied grade and length. Browser values are proposals. + # One price per product (2026-10-23): the grade is kept, the price ignores it. corrected=[{**items[0],'metres':'1.01','grade':0},*items[1:]] approved=client.call('/operator/quotes/'+qid+'/approve',{'items':corrected},operator=True) - assert approved['items'][0]['total_cents']==2189 - assert approved['total_cents']==2189+32370+90870+109070+int(os.environ.get('MOCK_FREIGHT_CENTS','1500')) + assert approved['items'][0]['total_cents']==2189 and approved['items'][0]['grade']==0 + assert [i['unit_cents'] for i in approved['items'][1:]]==[2190,7990,8990] + assert approved['total_cents']==2189+28470+103870+116870+int(os.environ.get('MOCK_FREIGHT_CENTS','1500')) assert approved['destination']=={**draft['destination'],'complement':''} client.call('/operator/quotes/'+qid+'/approve',{'items':items},operator=True,expected=409) assert not client.call('/quotes/'+qid)['auto_approved'] @@ -200,15 +202,17 @@ def run(): assert auto['status']=='approved' seen=client.call('/quotes/'+auto['id']) assert seen['auto_approved'] and seen['review_reason'] is None - assert seen['approved']['total_cents']==6972+int(os.environ.get('MOCK_FREIGHT_CENTS','1500')) + assert seen['approved']['total_cents']==6132+int(os.environ.get('MOCK_FREIGHT_CENTS','1500')) assert client.call('/quotes',small)['status']=='approved' client.call('/operator/quotes/'+auto['id']+'/approve',{'items':small['items']},operator=True,expected=409) - # The Site grades only art it analysed; a discount on unanalysed art waits for a person. + # The Site grades only art it analysed. A grade on art it did not analyse + # is checked against the file like any other, and this one cannot be. claimed={**item_spec('avulsa','2.75',0,uid),'grade':90} held=client.call('/quotes',{**small,'request_key':str(uuid4()),'items':[claimed]}) assert held['status']=='pending_review' - assert client.call('/quotes/'+held['id'])['review_reason']=='Nota informada sem análise da arte' - # A better grade than the file supports, or one the server cannot check, waits too. + assert client.call('/quotes/'+held['id'])['review_reason']=='Nota não conferida no servidor' + # A better grade than the file supports, or one the server cannot check, waits too: + # the price ignores the grade, but the order shows it. inflated=client.call('/quotes',{**small,'request_key':str(uuid4()),'items':[item_spec('avulsa','2.75',100,graded)]}) assert inflated['status']=='pending_review' assert client.call('/quotes/'+inflated['id'])['review_reason']=='Nota 100 maior que a do arquivo (90)' diff --git a/tests/test_pricing.py b/tests/test_pricing.py index 7ba7d3e..c9d8c9f 100644 --- a/tests/test_pricing.py +++ b/tests/test_pricing.py @@ -3,39 +3,51 @@ import json from pathlib import Path import subprocess import unittest -from app.core.pricing import is_manual, price, TIERS +from app.core.pricing import is_manual, price, PRICES class PricingTests(unittest.TestCase): - def test_every_grade_against_actual_site_javascript(self): - # The ladders live with the rest of the Site's behaviour; this test exists + def test_every_length_against_actual_site_javascript(self): + # The prices live with the rest of the Site's behaviour; this test exists # to prove the server agrees with whatever the customer is shown. source = Path('web/site-config.js').read_text() - tiers = source.split('const FAIXAS=')[1].split('\n};',1)[0]+'\n}' + prices = source.split('const PRECO=')[1].split(';',1)[0] calculator = source.split('const cobrar=')[1].split(';',1)[0] - js = f'const FAIXAS={tiers};const MINIMO_M=1;const cobrar={calculator};' - js += '''const results=[];for(const mode of Object.keys(FAIXAS))for(let grade=0;grade<=100;grade++) + js = f'const PRECO={prices};const MINIMO_M=1;const cobrar={calculator};' + js += '''const results=[];for(const mode of Object.keys(PRECO)) for(const metres of [0.01,0.99,1,1.01,1.1,2.75,2.8,2.8000000000000003,19.99,60,12000]){ - const unit=FAIXAS[mode].find(x=>grade>=x[0])[1]; - results.push([mode,String(metres),grade,cobrar(metres),Math.round(unit*100),Math.round(cobrar(metres)*unit*100)]); + const unit=PRECO[mode]; + results.push([mode,String(metres),cobrar(metres),Math.round(unit*100),Math.round(cobrar(metres)*unit*100)]); }process.stdout.write(JSON.stringify(results));''' cases = json.loads(subprocess.check_output(['node','-e',js],text=True)) - for mode,metres,grade,billed,unit,total in cases: - with self.subTest(mode=mode,metres=metres,grade=grade): - result=price(mode,metres,grade) - self.assertEqual(float(result['billed_metres']),billed) - self.assertEqual(result['unit_cents'],unit) - self.assertEqual(result['total_cents'],total) + self.assertEqual({mode for mode, *_ in cases}, set(PRICES)) + for mode,metres,billed,unit,total in cases: + for grade in (0, 39, 40, 75, 90, 100): + with self.subTest(mode=mode,metres=metres,grade=grade): + result=price(mode,metres,grade) + self.assertEqual(float(result['billed_metres']),billed) + self.assertEqual(result['unit_cents'],unit) + self.assertEqual(result['total_cents'],total) - def test_assembly_is_included_at_every_tier(self): - for grade in range(101): - self.assertEqual(price('avulsa','1',grade)['total_cents']-price('file','1',grade)['total_cents'],1000) - self.assertEqual(price('uv','1',grade)['total_cents']-price('uvfile','1',grade)['total_cents'],1400) + def test_one_price_per_product(self): + # Dropstar, 2026-10-23: textile R$ 19,90 ready sheet and R$ 21,90 loose + # art; UV R$ 79,90 and R$ 89,90. + self.assertEqual(PRICES, {'file': 1990, 'avulsa': 2190, 'uvfile': 7990, 'uv': 8990}) + self.assertEqual(price('avulsa', '2.75', 90)['total_cents'], 6132) - def test_manual_file_extra_is_per_metre_and_not_a_discount(self): + def test_the_grade_never_changes_the_price(self): + for mode in PRICES: + charges = {(p['unit_cents'], p['total_cents']) for p in (price(mode, '2.75', g) for g in range(101))} + self.assertEqual(len(charges), 1, mode) + self.assertNotIn('discount_cents', price(mode, '1', 100)) + # The grade is still kept with the item, for the Kanban and Tiny. + self.assertEqual(price('file', '1', 92)['grade'], 92) + + def test_manual_file_extra_is_per_metre(self): plain, extra = price('file', '1.01', 0), price('file', '1.01', 0, 500) self.assertEqual(extra['unit_cents'], plain['unit_cents'] + 500) self.assertEqual(extra['total_cents'], plain['total_cents'] + 550) - self.assertEqual(extra['discount_cents'], 0) + # On top of the single price, whatever grade the item carries. + self.assertEqual(price('file', '1', 100, 200)['unit_cents'], 2190) self.assertEqual(extra['manual_extra_cents'], 500) self.assertNotIn('manual_extra_cents', plain) for bad in (-1, True, 1.5): diff --git a/tests/test_quote_review.py b/tests/test_quote_review.py index a276489..330368b 100644 --- a/tests/test_quote_review.py +++ b/tests/test_quote_review.py @@ -26,8 +26,10 @@ class ReviewReasonTest(unittest.TestCase): self.assertEqual(self.reason(item(metres='30'), item(metres='20.1')), 'Pedido acima de 50 m') self.assertEqual(self.reason(item(metres='6'), QUOTE_AUTO_MAX_METRES='5'), 'Pedido acima de 5 m') - def test_a_discount_the_site_could_not_have_given_waits(self): - self.assertEqual(self.reason(item(grade=90, quality='unverified')), 'Nota informada sem análise da arte') + def test_a_grade_on_unanalysed_art_no_longer_waits_here(self): + # The grade no longer sets the price; the server checks it against the + # files instead (app/grade_check.py), as for any other cart. + self.assertIsNone(self.reason(item(grade=90, quality='unverified'))) def test_old_layouts_and_switching_it_off(self): self.assertEqual(self.reason(item(version=1)), 'Montagem antiga') diff --git a/tests/test_tiny.py b/tests/test_tiny.py index 3ec4f30..91a1fac 100644 --- a/tests/test_tiny.py +++ b/tests/test_tiny.py @@ -462,8 +462,10 @@ class TinySkuTests(FakeTinyCase): tiny_probe.main(['pedido', '--cnpj', '11222333000181', '--email', 'a@example.test', '--celular', '16999999999', '--metros', '1,3'], orders=self.tiny, out=lines.append) text = '\n'.join(lines) + # 1,30 m at the single price, R$ 19,90: one "1 metro" and three "10 cm". self.assertIn('"quantidade": 1', text) - self.assertIn('"valorUnitario": 4.47', text) + self.assertIn('"valorUnitario": 19.9', text) + self.assertIn('"valorUnitario": 5.97', text) # A new contact is previewed with the name it will get. self.assertIn('será criado como "a@example.test"', text) self.tiny.names = lambda cnpj: {'legal': 'EMPRESA TESTE LTDA', 'trade': 'Teste'} diff --git a/web/checkout.js b/web/checkout.js index e7ab452..3a3f18f 100644 --- a/web/checkout.js +++ b/web/checkout.js @@ -59,8 +59,13 @@ if(limit)limit.textContent='Até '+(session.max_upload_bytes/1073741824).toFixed(0)+' GB por arquivo.'; // What the server charges for a file opened by hand, never the page's own text. const zona=document.getElementById('zManual'); - if(zona)zona.innerHTML='Tem CDR, AI, PSD ou TIFF? Pode mandar também. Alguém abre na mão, e o '+ - 'metro sai pelo preço cheio'+(session.manual_extra_cents>0?' mais '+rs(session.manual_extra_cents/100):'')+'.'; + const extra=session.manual_extra_cents>0?rs(session.manual_extra_cents/100):''; + if(zona)zona.innerHTML='Tem CDR, AI, PSD ou TIFF? Pode mandar também. Alguém abre na mão'+ + (extra?', e o metro custa '+extra+' a mais':'')+'.'; + const duvida=document.getElementById('duvidaManual'); + if(duvida)duvida.textContent='alguém abre na mão'+(extra?', sai mais devagar e o metro custa '+extra+' a mais':' e sai mais devagar'); + const tabela=document.getElementById('tabelaManual'); + if(tabela){tabela.hidden=!extra;tabela.textContent='Arquivo em CDR, AI, PSD ou TIFF, que alguém abre na mão: + '+extra+' por metro.';} if(session.manual_extra_cents>0){ TAXA_MANUAL=session.manual_extra_cents/100; if(typeof folhas!=='undefined'&&folhas.length&&typeof pintaFolha==='function')pintaFolha(); diff --git a/web/index.html b/web/index.html index 5c2d5f7..24ddbdf 100644 --- a/web/index.html +++ b/web/index.html @@ -713,7 +713,7 @@ h2 em{font-style:normal;color:var(--laranja)}
- Metro a partir de R$ 14,90 + Metro a partir de R$ 19,90 Franca · SP · envio em até 24 h

A gente encaixa sua folha e você paga menos metro

@@ -737,7 +737,7 @@ h2 em{font-style:normal;color:var(--laranja)}
Metragem0,60 m
Nota da arte92
-
Preço do metroR$ 14,90
+
Preço do metroR$ 19,90
@@ -767,7 +767,7 @@ h2 em{font-style:normal;color:var(--laranja)}
Escolha o produto

Qual é o seu caso?

-

O preço do metro depende da nota da arte: quanto melhor o arquivo, menor o preço.

+

Preço único por produto. A nota da arte aparece na tela para você entender o seu arquivo; ela não muda o preço.

@@ -784,7 +784,7 @@ h2 em{font-style:normal;color:var(--laranja)}

Artes avulsas

Cada arte num arquivo. A gente monta a folha com o melhor encaixe. Montagem inclusa no preço.

-
de—a — /m conforme a nota da arte
+
R$ 21,90por metro
Enviar minhas artes
@@ -793,7 +793,7 @@ h2 em{font-style:normal;color:var(--laranja)}

Arquivo por metro · UV

Sua folha de UV montada. Para rígidos: caneca, garrafa, case. Não precisa de prensa.

-
de—a — /m conforme a nota da arte
+
R$ 79,90por metro
Enviar folha de UV
@@ -802,7 +802,7 @@ h2 em{font-style:normal;color:var(--laranja)}

Artes avulsas · UV

Cada arte num arquivo. Montamos a folha de UV com o melhor encaixe. Montagem inclusa no preço.

-
de—a — /m conforme a nota da arte
+
R$ 89,90por metro
Enviar artes de UV
@@ -843,7 +843,7 @@ h2 em{font-style:normal;color:var(--laranja)} ou escolher no computador Adicionar outra folha ou arraste aqui Tem CDR, AI, PSD ou TIFF? Pode mandar também. - Alguém abre na mão, e o metro sai pelo preço cheio mais R$ 2,00. + Alguém abre na mão, e o metro custa R$ 2,00 a mais.
@@ -851,18 +851,16 @@ h2 em{font-style:normal;color:var(--laranja)}

Dúvidas:

- Como pagar o menor metro + Dicas para o seu arquivo
    -
  • 300 DPI no tamanho que vai imprimir. É a nota máxima - e o menor preço da tabela
  • +
  • 300 DPI no tamanho que vai imprimir. É a nota máxima
  • O tamanho manda mais que o arquivo. A mesma arte passa - em 20 cm e não passa em 40. Reduzir um pouco costuma pular uma faixa - de preço inteira
  • + em 20 cm e não passa em 40. Reduzir um pouco costuma subir a nota
  • Larguras parecidas rendem mais. Se as suas artes têm medidas próximas, cabem mais por fileira e a folha encolhe
-

Resolução é a única coisa que mexe no preço — porque é a - única que a gente não consegue melhorar por você.

+

A nota não muda o preço do metro: ela serve para você + entender o seu arquivo.

@@ -889,8 +887,8 @@ h2 em{font-style:normal;color:var(--laranja)}
  • PDF grande. Sem UserUnit, a página passa do limite de 508 cm do formato; divida a folha ou mande PNG. Envie um PDF de uma página por folha.
  • TIFF, PSD, AI e CDR a gente aceita, mas ninguém consegue - conferir sozinho: alguém abre na mão, sai mais devagar e o metro vai pela - tabela, sem desconto de nota
  • + conferir sozinho: alguém abre na mão, sai mais devagar + e o metro custa R$ 2,00 a mais
  • JPG não passa: não tem fundo transparente, e o branco do fundo sai no filme. Exporte a folha em PNG ou PDF
  • Em artes avulsas só PNG com fundo transparente: a montagem @@ -929,15 +927,11 @@ h2 em{font-style:normal;color:var(--laranja)}
  • ').join(''); - const analisadas=ehFolha(it.modo) && folhas.length && folhas.every(x=>x.an); - $('cMetroLbl').textContent = it.extra ? 'Metro · cheio + '+rs(it.extra)+' manual' - : semNota ? 'Metro · preço cheio' - : analisadas && folhas.every(x=>x.an.vetor) ? 'Metro · arte vetorial' - : analisadas ? 'Metro · '+Math.min(...folhas.map(x=>x.an.dpi))+' DPI' - : 'Metro'; + // One price per product (Dropstar, 2026-10-23): the grade is shown to explain + // the file, on its own line, and never changes the metre. + $('cNota').textContent = it.nota ? it.nota+'/100' : '—'; + $('cMetroLbl').textContent = it.extra ? 'Metro · com '+rs(it.extra)+' de arquivo manual' : 'Metro'; $('cMetro').textContent=rs(it.unit); $('cMetragem').textContent=fmtM(it.cob)+' m'; - const economia=(TABELA[it.modo]-(it.unit-(it.extra||0)))*it.cob; - $('cEco').textContent = economia>0.005 ? rs(economia)+' a menos pela resolução da arte' : ''; const partes=ehFolha(it.modo) ? Math.ceil(it.metros/20) : 1; $('cPartes').textContent = partes>1 ? ' Sai em '+partes+' partes de até 20 m.' : ''; const sobraCm=Math.round((it.cob-it.metros)*100); diff --git a/web/site-config.js b/web/site-config.js index 02ae8ed..91fea81 100644 --- a/web/site-config.js +++ b/web/site-config.js @@ -1,4 +1,4 @@ -/* Site DTF — Product tables, commercial ladders, shared state and field validation. +/* Site DTF — Product tables, prices, shared state and field validation. Extracted verbatim from the single inline script in web/index.html. Loaded as classic scripts in the order listed there: they share one global scope and run top to bottom, exactly as the original did. */ @@ -45,22 +45,16 @@ const MODOS={ zt:'Arraste suas artes de UV', zs:'PNG com fundo transparente · informe a largura de cada arte'} }; -// Quatro escadas. A de artes avulsas e a da folha pronta mais a montagem: -// R$ 10,00 no têxtil, R$ 14,00 no UV, constante em todas as faixas. -const FAIXAS={ - file: [[90,14.90],[75,16.20],[60,17.50],[40,18.70],[0,19.90]], - avulsa:[[90,24.90],[75,26.20],[60,27.50],[40,28.70],[0,29.90]], - uvfile:[[90,69.90],[75,73.90],[60,77.90],[40,81.90],[0,85.90]], - uv: [[90,83.90],[75,87.90],[60,91.90],[40,95.90],[0,99.90]] -}; -const TABELA={file:19.90, avulsa:29.90, uvfile:85.90, uv:99.90}; // teto de cada escada -const MONTAGEM={avulsa:10.00, uv:14.00}; // o que a montagem soma sobre a folha pronta +// Preço único por produto (Dropstar, 23/10/2026). A nota da arte continua na +// tela, para o cliente entender o arquivo dele, mas não mexe no preço. +// O servidor cobra o mesmo (app/core/pricing.py, conferido em tests/test_pricing.py). +const PRECO={file:19.90, avulsa:21.90, uvfile:79.90, uv:89.90}; // Folha que alguém abre na mão (CDR, AI, PSD, TIFF): R$ a mais por metro. // Vem do servidor (/api/session), que cobra o mesmo; zero não soma nada. let TAXA_MANUAL=0; const folhaManual=()=>ehFolha() && folhas.some(x=>!x.med); const ehFolha=m=>!!MODOS[m||modo].folha; -const pisoEscada=m=>FAIXAS[m||modo][0][1]; +const precoMetro=m=>PRECO[m||modo]; const MINIMO_M=1, GAP_CM=0.5, RODAPE_CM=5; const RENDERIZA=/[.](png|jpe?g|webp|gif|bmp)$/i; // Folha pronta: dá para medir PNG e PDF. PSD, AI, TIFF e CDR entram, mas @@ -162,9 +156,6 @@ const larguraFilme=()=>MODOS[modo].larg; // cobrança proporcional: arredonda para cima em 10 cm · 2,75 m vira 2,80 m const cobrar=m=>Math.max(MINIMO_M, Math.ceil(m*10)/10); const fmtM=m=>m.toFixed(2).replace('.',','); -const precoBase=n=> - (FAIXAS[modo].find(f=>n>=f[0])||FAIXAS[modo][FAIXAS[modo].length-1])[1]; -const descontoMetragem=()=>0; // sem progressão por quantidade const cls=n=>n>=85?'ok':n>=50?'av':'er'; const dpiDe=a=>a.cm>0? (a.giro?a.py:a.px)/(a.cm/2.54) : 0; // girar 90° inverte a proporção · espelhar não muda medida, só o desenho diff --git a/web/site-modes.js b/web/site-modes.js index 4f00780..24c24fb 100644 --- a/web/site-modes.js +++ b/web/site-modes.js @@ -30,8 +30,8 @@ function pintaModo(){ $('zOutra').textContent = ehFolha(m) ? 'Adicionar outra folha' : 'Adicionar mais artes'; $('zona').classList.remove('compacta'); $('inp').multiple=c.multi; - // The file decides the price: PNG and PDF are checked here, the others by hand. - // JPG has no transparency and is refused (ACEITA, web/site-config.js). + // The file decides how it is checked: PNG and PDF here, the others by hand + // (TAXA_MANUAL). JPG has no transparency and is refused (ACEITA, web/site-config.js). $('inp').accept = ehFolha(m) ? '.png,.pdf,.tif,.tiff,.psd,.psb,.ai,.cdr' : '.png,.webp'; $('catFoco').className='cat '+(ehFolha(m)?'file':'av'); @@ -50,8 +50,8 @@ function pintaTipoEnvio(){ if(el.hidden) return; const folha = ehFolha() ? modo : PAR[modo]; const avulsa = ehFolha() ? PAR[modo] : modo; - $('tipoFolhaPreco').textContent=rs(pisoEscada(folha))+' a '+rs(TABELA[folha]).slice(3)+' /m'; - $('tipoAvulsaPreco').textContent='+ '+rs(MONTAGEM[avulsa])+' /m'; + $('tipoFolhaPreco').textContent=rs(PRECO[folha])+' /m'; + $('tipoAvulsaPreco').textContent=rs(PRECO[avulsa])+' /m'; $('larguraFolhaPronta').textContent=String(MODOS[folha].larg).replace('.',','); const atual = ehFolha() ? 'folha' : 'avulsa'; el.querySelectorAll('.cam').forEach(b=>{ @@ -73,7 +73,7 @@ function recusaFolha(x, md){ 'Para ocupar os '+n1(larguraFilme())+' cm do filme ela teria só '+md.dpiFolha+ ' DPI, e o mínimo para imprimir é '+DPI_RECUSA+'. '+ 'Se for uma arte para montarmos, use '+MODOS[destino].tit+', '+ - 'a partir de '+rs(pisoEscada(destino))+'/m. '+ + 'a '+rs(PRECO[destino])+' o metro. '+ ''); const botao=$('usarAvulsa'); if(botao) botao.addEventListener('click',()=>{ diff --git a/web/site-pdf.js b/web/site-pdf.js index f263241..4bf751c 100644 --- a/web/site-pdf.js +++ b/web/site-pdf.js @@ -502,7 +502,7 @@ function pintaFolha(){ (x.pdfGrande? 'Conferência manual · sem conferência no site'+ '

    Este PDF tem mais de 150 MB, e o site não confere arquivo desse tamanho: '+ 'resíduo de recorte, fundo e resolução ficam para a equipe, que abre antes de imprimir, e o '+ - 'pedido pode voltar depois de pago. O metro sai pela tabela, '+rs(TABELA[modo])+'. '+ + 'pedido pode voltar depois de pago. '+ 'Exportando em PNG, ou num PDF menor, a conferência sai aqui, antes de pagar.

    ' : '')+ (suspeito? '

    Este PDF passa do tamanho que o formato comporta. '+ 'A especificação para em 508 cm e o seu tem '+n1(x.med.alt)+' cm. '+ @@ -518,14 +518,16 @@ function pintaFolha(){ medida=''+escapeHTML(extDe(x.f.name))+' · '+fmt(x.f.size)+''+ '

    Este PDF não pode ser orçado. '+escapeHTML(x.measurementError)+'

    '; }else{ - const teto=TABELA[modo], piso=pisoEscada(); - const dif=(x.m>0)? (teto+TAXA_MANUAL-piso)*cobrar(x.m*(x.rep||1)) : 0; - medida='Conferência manual · preço cheio'+ + // Só a abertura manual muda o metro (TAXA_MANUAL); a nota não mexe no preço. + const dif=(x.m>0)? TAXA_MANUAL*cobrar(x.m*(x.rep||1)) : 0; + medida='Conferência manual'+ '

    O navegador não abre '+escapeHTML(extDe(x.f.name))+', então alguém da equipe '+ - 'confere antes de imprimir e o metro sai pela tabela, '+rs(teto)+''+ - (TAXA_MANUAL? ', mais '+rs(TAXA_MANUAL)+' pela abertura manual' : '')+'. '+ - 'Exportando em PNG ou PDF, o metro pode cair até '+rs(piso)+''+ - (dif>0.5? ' — '+rs(dif)+' a menos só nesta folha' : '')+'.

    '; + 'confere antes de imprimir'+ + (TAXA_MANUAL? ' e o metro sai a '+rs(precoMetro()+TAXA_MANUAL)+', com '+rs(TAXA_MANUAL)+ + ' pela abertura manual' : '')+'. '+ + 'Exportando em PNG ou PDF, a conferência sai aqui, antes de pagar'+ + (TAXA_MANUAL? ', e o metro fica em '+rs(precoMetro())+''+ + (dif>0.5? ' — '+rs(dif)+' a menos só nesta folha' : '') : '')+'.

    '; manual='
    '+ 'm
    '; @@ -535,7 +537,7 @@ function pintaFolha(){ ''+textoProgresso(x)+'' : x.semAnalise ? '
    Não conseguimos conferir esta folha. '+escapeHTML(x.semAnalise)+ - '. Seguimos com o preço de tabela — se quiser a nota e o desconto, exporte a mesma '+ + '. Seguimos sem a nota, e a conferência é feita na mão. Se quiser a nota, exporte a mesma '+ 'folha em PNG, que a conferência é bem mais leve.
    ' : ''; // A small thumbnail made once: the list is rebuilt on every change, and the diff --git a/web/site-quality.js b/web/site-quality.js index 4e07884..4825048 100644 --- a/web/site-quality.js +++ b/web/site-quality.js @@ -32,18 +32,16 @@ function avaliar(){ reencaixado=false; const ans=folhas.map(x=>x.an).filter(Boolean); if(ans.length!==folhas.length){ - // A nota precisa cobrir cada folha faturada. Uma folha sem análise não - // herda a nota/desconto de outra folha que o navegador conseguiu abrir. + // A nota precisa cobrir cada folha. Uma folha sem análise não herda a + // nota de outra folha que o navegador conseguiu abrir. const ausentes=folhas.filter(f=>!f.an); const exts=[...new Set(ausentes.map(f=>extDe(f.f.name)))].join(', '); mostraNota([ ['av','Sem nota · '+exts+' sem análise completa', ausentes.length+' de '+folhas.length+' folha(s) precisam de conferência manual'], - ['er','Metro pela tabela · '+rs(TABELA[modo]), - 'exportando em PNG ou PDF, cai até '+rs(pisoEscada())], ['fix','Alguém abre seu arquivo','a conferência é feita na mão, na sala'] ], 0, folhas.length>1? folhas.length+' folhas' : folhas[0].f.name, - larguraFilme()+' cm · '+fmtM(metros)+' m · preço de tabela'); + larguraFilme()+' cm · '+fmtM(metros)+' m'); return {pronto:true}; } const dpi=Math.min(...ans.map(a=>a.dpi)); @@ -91,7 +89,7 @@ function avaliar(){ const media=Math.round(notas.reduce((s,n)=>s+n,0)/notas.length), pior=Math.min(...notas); mostraNota([ ['ok','Montagem por nossa conta','5 mm garantidos'], - [cls(pior),'Pior arte em '+pior+'%',pior>=85?'todas em boa resolução':'reenviar maior sai mais barato'] + [cls(pior),'Pior arte em '+pior+'%',pior>=85?'todas em boa resolução':'há arte abaixo da resolução ideal'] ],media,artes.length+' arte'+(artes.length>1?'s':''), 'folha montada por nós · '+fmtM(metros)+' m'); return {pronto:true}; @@ -142,7 +140,7 @@ function ressalvaResolucao(){ const box=$('ciente'), chk=$('cienteOk'); let baixas=[], geral=300, recusadas=[]; if(ehFolha()){ - // Uma régua só: o número que precifica é o número que bloqueia. + // Uma régua só: o número da nota é o número que bloqueia. // Recusa quando a média por área fica abaixo de 96 DPI — a folha inteira não // vale o filme. Se a média passa mas há peças ruins, é ressalva com aceite. folhas.forEach((x,k)=>{ @@ -166,7 +164,7 @@ function ressalvaResolucao(){ const todas=comTamanho.map(a=>dpiDe(a)); geral = todas.length? Math.round(Math.max(...todas)) : 300; } - // Abaixo de 96 DPI a sala não imprime. Não é desconto, é recusa — + // Abaixo de 96 DPI a sala não imprime. Não é ressalva, é recusa — // e não existe aceite que destrave. if(recusadas.length){ $('cienteTxt').innerHTML= diff --git a/web/site-steps.js b/web/site-steps.js index 396f015..ff5bcec 100644 --- a/web/site-steps.js +++ b/web/site-steps.js @@ -3,9 +3,9 @@ switches which page is shown and reads the page's state (the open product, the cart, the checkout status); orders, prices and files stay with the other site-*.js files. */ -// Card prices come from the same table the checkout uses, so they cannot drift. -document.querySelectorAll('[data-de]').forEach(el=>{ el.textContent=rs(pisoEscada(el.dataset.de)); }); -document.querySelectorAll('[data-ate]').forEach(el=>{ el.textContent=rs(TABELA[el.dataset.ate]); }); +// Every price on the page (top chip, home example, product cards, price table) +// comes from the same table the checkout uses, so they cannot drift. +document.querySelectorAll('[data-preco]').forEach(el=>{ el.textContent=rs(PRECO[el.dataset.preco]); }); const TITULO_INICIO=document.title; function tituloPagina(){ diff --git a/web/site-v2.css b/web/site-v2.css index 9c1aa95..174e11a 100644 --- a/web/site-v2.css +++ b/web/site-v2.css @@ -78,7 +78,6 @@ section+section{border-top:0} .ec-pe{display:flex;align-items:flex-end;gap:12px;padding-top:14px;border-top:1px solid #EFEFEF} .ec-preco{display:flex;flex-direction:column;gap:2px} .ec-preco span{font-size:15px;color:#707070} -.ec-preco em{font-style:normal} .ec-preco b{font-family:"Inter",sans-serif;font-size:29px;font-weight:900;letter-spacing:-.02em;color:var(--preto)} .ec-go{margin-left:auto;height:46px;padding:0 18px;border-radius:var(--raio2);background:var(--preto);color:#fff;font-family:"Inter",sans-serif;font-weight:700;font-size:16.5px;display:flex;align-items:center;white-space:nowrap} .ec:hover .ec-go{background:var(--laranja);color:var(--preto)} @@ -238,20 +237,8 @@ section+section{border-top:0} .ampliar:hover{border-color:var(--preto)} .ampliar[hidden]{display:none} .cat.file #vArea{max-height:340px} -.cEscada{display:flex;flex-direction:column;gap:8px;margin-bottom:4px} -.cEscada>span{font-size:15px;font-weight:600} -.cEscada ol{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px} -.cEscada li{padding:8px 2px;border-radius:8px;background:#F4F4F2;border:1.5px solid transparent;display:flex;flex-direction:column;align-items:center;gap:2px} -.cEscada li span{font-size:13.5px;color:var(--fraco);white-space:nowrap} -.cEscada li b{font-size:15px;font-weight:500;color:var(--texto2)} -.cEscada li.on{background:var(--verde-fundo);border-color:var(--verde)} -.cEscada li.on span,.cEscada li.on b{font-weight:700;color:var(--verde)} -.cEscada li.on:last-child{background:#F1F1F1;border-color:var(--preto)} -.cEscada li.on:last-child span,.cEscada li.on:last-child b{color:var(--preto)} .cLin>span:first-child{color:var(--texto2)} .cLin small{font-size:14.5px;color:var(--fraco)} -.cEco{margin:-6px 0 0;text-align:right;font-size:15px;font-weight:600;color:var(--verde)} -.cEco:empty{display:none} #cPartes{display:block} .ampliaDlg{width:min(960px,calc(100vw - 32px));max-height:calc(100vh - 48px);padding:0;border:0;border-radius:16px;box-shadow:0 20px 60px rgba(3,6,11,.3)} .ampliaDlg::backdrop{background:rgba(3,6,11,.55)} @@ -433,7 +420,6 @@ html:is([data-rota="pagamento"],[data-rota="pix"]) .pagGrid{display:grid;grid-te .info2 table{border-collapse:collapse;background:#fff;border:1px solid var(--linha);border-radius:12px;overflow:hidden;font-size:16.5px} .info2 th{text-align:left;background:var(--preto);color:#fff;font-family:"Inter",sans-serif;font-size:15px;padding:12px 18px} .info2 td{padding:11px 18px;border-top:1px solid #EFEFEF} -.info2 td.melhor{font-weight:700;color:var(--verde)} .info2 .nota2{font-size:15px;color:#707070} .info2-vant{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px} .info2-vant>div{padding:22px;border-radius:var(--raio);background:#fff;border:1px solid var(--linha);display:flex;flex-direction:column;gap:6px}