// Indicative price list — generated from the supplier price sheet.
// Prices are rounded UP to the nearest 0.50 (4.00 stays 4.00, 4.20 becomes 4.50,
// 4.70 becomes 5.00). GBP and USD are indicative conversions from the euro —
// update the rates below and re-round if they move materially.
const GBP_RATE = 0.85;
const USD_RATE = 1.08;
const AED_RATE = 3.95;
const ZAR_RATE = 20.5;

// ZAR is derived from the euro at display time rather than stored per row, then
// rounded UP to the nearest 0.50 like every other currency in this list.
const zarOf = r => Math.ceil(r.e * ZAR_RATE * 2) / 2;

const PRICE_LIST = [
  { n:"Apple, Gala", o:"France", g:"Cat I, 201-270g, 1-Layer Tray", u:"kg", e:3.5, p:3, d:4, a:14, c:"F" },
  { n:"Apple, Golden Delicious", o:"France", g:"Cat I, 170-220g, 2-Layer Tray", u:"kg", e:2.5, p:2, d:2.5, a:10, c:"F" },
  { n:"Apple, Granny Smith", o:"France", g:"Cat I, 201-270g, 1-Layer Tray", u:"kg", e:3, p:2.5, d:3, a:12, c:"F" },
  { n:"Apricot, Orange type", o:"France", g:"Cat I, 45-50mm", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"F" },
  { n:"Apricot, Orange type", o:"France", g:"Cat I, 50-55mm", u:"kg", e:5.5, p:4.5, d:5.5, a:22, c:"F" },
  { n:"Aubergine", o:"France", g:"Cat I", u:"kg", e:3, p:2.5, d:3.5, a:12, c:"V" },
  { n:"Aubergine", o:"Netherlands", g:"Cat I", u:"kg", e:2.5, p:2, d:2.5, a:10, c:"V" },
  { n:"Aubergine", o:"Spain", g:"Cat I", u:"kg", e:2.5, p:2, d:2.5, a:10, c:"V" },
  { n:"Avocado, Hass", o:"Peru", g:"Box of 16", u:"box of 16", e:22, p:18.5, d:23.5, a:87, c:"F" },
  { n:"Avocado, Hass", o:"Peru", g:"Box of 20", u:"box of 20", e:20.5, p:17.5, d:22, a:81, c:"F" },
  { n:"Banana", o:"Central America", g:"Extra", u:"kg", e:1.5, p:1.5, d:2, a:6, c:"F" },
  { n:"Banana", o:"", g:"Extra", u:"kg", e:2, p:1.5, d:2, a:8, c:"F" },
  { n:"Basil", o:"", g:"", u:"10 bunches", e:6.5, p:5.5, d:7, a:26, c:"V" },
  { n:"Basil", o:"France", g:"", u:"10 bunches", e:6.5, p:5.5, d:7, a:26, c:"V" },
  { n:"Bay Leaf", o:"France", g:"", u:"10 bunches", e:6.5, p:5.5, d:7, a:26, c:"V" },
  { n:"Beefsteak Tomato (Coeur de Boeuf)", o:"France", g:"", u:"kg", e:5, p:4.5, d:5.5, a:20, c:"V" },
  { n:"Beetroot, Red, Round, Cooked", o:"France", g:"", u:"kg", e:3.5, p:3, d:3.5, a:14, c:"V" },
  { n:"Beetroot, Red, Round, Raw", o:"France", g:"", u:"kg", e:2.5, p:2, d:2.5, a:10, c:"V" },
  { n:"Black Crimea Tomato", o:"France", g:"", u:"kg", e:5, p:4.5, d:5.5, a:20, c:"V" },
  { n:"Blackberry", o:"EU", g:"Covered Crop, Punnet 125g", u:"punnet", e:3, p:2.5, d:3, a:12, c:"F" },
  { n:"Blackberry", o:"France", g:"Punnet 125g", u:"punnet", e:3.5, p:3, d:3.5, a:14, c:"F" },
  { n:"Blueberry", o:"France", g:"Punnet 125g", u:"punnet", e:3, p:2.5, d:3.5, a:12, c:"F" },
  { n:"Blueberry", o:"Portugal", g:"Punnet 125g", u:"punnet", e:3, p:2.5, d:3.5, a:12, c:"F" },
  { n:"Blueberry", o:"Spain", g:"Punnet 125g", u:"punnet", e:2.5, p:2, d:2.5, a:10, c:"F" },
  { n:"Broad Bean", o:"France", g:"", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"V" },
  { n:"Broccoli", o:"France", g:"Cat I", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"V" },
  { n:"Broccoli", o:"Spain", g:"Cat I", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"V" },
  { n:"Button Mushroom", o:"Poland", g:"Trimmed Stem, Cat I, Tray", u:"kg", e:4.5, p:4, d:5, a:18, c:"V" },
  { n:"Button Mushroom", o:"France", g:"Whole Stem, Cat I, Tray", u:"kg", e:5, p:4.5, d:5.5, a:20, c:"V" },
  { n:"Cabbage, Green", o:"France", g:"Cat I, Box of 6", u:"box of 6", e:18, p:15.5, d:19.5, a:71.5, c:"V" },
  { n:"Cabbage, Red", o:"France", g:"Cat I", u:"kg", e:2, p:1.5, d:2, a:8, c:"V" },
  { n:"Cabbage, Red", o:"Netherlands", g:"Cat I", u:"kg", e:2, p:1.5, d:2, a:8, c:"V" },
  { n:"Cabbage, White", o:"France", g:"Cat I", u:"kg", e:2, p:1.5, d:2, a:8, c:"V" },
  { n:"Cabbage, White", o:"Netherlands", g:"Cat I", u:"kg", e:2, p:1.5, d:2, a:8, c:"V" },
  { n:"Carrot", o:"France", g:"Cat I", u:"bunch", e:2, p:2, d:2.5, a:8, c:"V" },
  { n:"Carrot", o:"Spain", g:"Cat I", u:"bunch", e:2, p:2, d:2.5, a:8, c:"V" },
  { n:"Carrot", o:"France", g:"Extra, Box 12kg", u:"kg", e:2, p:1.5, d:2, a:8, c:"V" },
  { n:"Cauliflower", o:"France", g:"Crowned, Cat I, Large, Pack of 6", u:"pack of 6", e:27.5, p:23.5, d:30, a:109, c:"V" },
  { n:"Celeriac", o:"France", g:"", u:"kg", e:2, p:1.5, d:2, a:8, c:"V" },
  { n:"Celery (Stick), Green", o:"EU", g:"Cat I", u:"kg", e:2.5, p:2.5, d:3, a:10, c:"V" },
  { n:"Celery (Stick), Green", o:"France", g:"Cat I", u:"kg", e:3, p:2.5, d:3, a:12, c:"V" },
  { n:"Chanterelle Mushroom", o:"Eastern Europe", g:"Tray", u:"kg", e:14.5, p:12.5, d:15.5, a:57.5, c:"V" },
  { n:"Charentais Melon", o:"France", g:"Cat.I C11 (11pcs/box)", u:"piece", e:6.5, p:5.5, d:7, a:26, c:"F" },
  { n:"Cherry", o:"Belgium", g:"Cat I, +28mm", u:"kg", e:9.5, p:8, d:10.5, a:37, c:"F" },
  { n:"Cherry", o:"Belgium", g:"Cat I, +30mm", u:"kg", e:12, p:10, d:12.5, a:46, c:"F" },
  { n:"Cherry", o:"Belgium", g:"Cat I, +32mm", u:"kg", e:13, p:11, d:14, a:50, c:"F" },
  { n:"Cherry", o:"Belgium", g:"Cat I, +34mm", u:"kg", e:15.5, p:13.5, d:17, a:61, c:"F" },
  { n:"Chicory (Endive), Red", o:"France", g:"Extra, Box 5kg", u:"kg", e:5, p:4.5, d:5.5, a:20, c:"V" },
  { n:"Chicory (Endive)", o:"France", g:"Extra, Box 5kg", u:"kg", e:5, p:4.5, d:5.5, a:20, c:"V" },
  { n:"Chinese Cabbage", o:"", g:"Cat I", u:"kg", e:3, p:2.5, d:3, a:12, c:"V" },
  { n:"Chives", o:"", g:"", u:"10 bunches", e:6, p:5, d:6.5, a:24, c:"V" },
  { n:"Chives", o:"France", g:"", u:"10 bunches", e:6, p:5, d:6.5, a:24, c:"V" },
  { n:"Coriander", o:"", g:"", u:"10 bunches", e:8, p:6.5, d:8.5, a:32, c:"V" },
  { n:"Coriander", o:"France", g:"", u:"10 bunches", e:8, p:6.5, d:8.5, a:32, c:"V" },
  { n:"Courgette, Green", o:"France", g:"Cat I, 14-21cm", u:"kg", e:2, p:1.5, d:2, a:8, c:"V" },
  { n:"Courgette, Round", o:"France", g:"Cat I", u:"kg", e:2, p:1.5, d:2, a:8, c:"V" },
  { n:"Cucumber", o:"France", g:"Cat I, 500-600g, Box of 12", u:"piece", e:2, p:2, d:2.5, a:8, c:"V" },
  { n:"Cucumber", o:"Netherlands", g:"Cat I, 500-600g, Box of 12", u:"piece", e:2, p:1.5, d:2, a:8, c:"V" },
  { n:"Cucumber", o:"Spain", g:"Cat I, 500-600g, Box of 12", u:"piece", e:2, p:1.5, d:2, a:8, c:"V" },
  { n:"Cucumber, Mini", o:"Netherlands", g:"Cat I, Box of 32", u:"box of 32", e:22, p:19, d:24, a:87, c:"V" },
  { n:"Cucumber, Mini", o:"Spain", g:"Cat I", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"V" },
  { n:"Curly Endive (Frisée)", o:"France", g:"Cat I, Box of 6", u:"box of 6", e:20.5, p:17.5, d:22, a:81, c:"V" },
  { n:"Dill", o:"", g:"", u:"10 bunches", e:8, p:6.5, d:8.5, a:32, c:"V" },
  { n:"Dill", o:"France", g:"", u:"10 bunches", e:8, p:6.5, d:8.5, a:32, c:"V" },
  { n:"Escarole", o:"France", g:"Cat I, Box of 6", u:"box of 6", e:20.5, p:17.5, d:22, a:81, c:"V" },
  { n:"Fennel", o:"Italy", g:"", u:"kg", e:3, p:2.5, d:3, a:12, c:"V" },
  { n:"Fig, Black, Fresh", o:"Spain", g:"Large", u:"kg", e:11, p:9.5, d:12, a:43.5, c:"F" },
  { n:"Fig, Fresh", o:"France", g:"Large, Tray", u:"kg", e:13.5, p:11.5, d:14.5, a:53.5, c:"F" },
  { n:"Fig, Green", o:"EU", g:"", u:"kg", e:9, p:7.5, d:10, a:36, c:"F" },
  { n:"Flat Peach, White Flesh", o:"France", g:"Cat I A", u:"kg", e:3.5, p:3, d:3.5, a:14, c:"F" },
  { n:"Flat Peach, White Flesh", o:"France", g:"Cat I AA", u:"kg", e:4, p:3, d:4, a:16, c:"F" },
  { n:"Flat Peach, White Flesh", o:"Spain", g:"Cat I A", u:"kg", e:3.5, p:3, d:3.5, a:14, c:"F" },
  { n:"Flat Peach, White Flesh", o:"Spain", g:"Cat I AA", u:"kg", e:4, p:3, d:4, a:16, c:"F" },
  { n:"Garlic, Fresh", o:"France", g:"Cat I, 60-80mm", u:"kg", e:8, p:6.5, d:8.5, a:32, c:"V" },
  { n:"Garlic, Purple Dried", o:"France", g:"Cat I, 60-80mm", u:"kg", e:9.5, p:8.5, d:10.5, a:38, c:"V" },
  { n:"Garlic, Purple Dried", o:"Spain", g:"Cat I, 60-80mm", u:"kg", e:5.5, p:4.5, d:5.5, a:22, c:"V" },
  { n:"Garlic, White Dried", o:"Spain", g:"Cat I, 60-80mm", u:"kg", e:6, p:5, d:6.5, a:24, c:"V" },
  { n:"Ginger", o:"Brazil", g:"", u:"kg", e:6, p:5, d:6.5, a:24, c:"V" },
  { n:"Grape, Black Magic", o:"Italy", g:"Cat I", u:"kg", e:4.5, p:4, d:5, a:18, c:"F" },
  { n:"Grape, Cotton Candy", o:"EU", g:"Cat I", u:"kg", e:8, p:6.5, d:8.5, a:32, c:"F" },
  { n:"Grape, Muscat Hamburg", o:"France", g:"Cat I", u:"kg", e:7.5, p:6.5, d:8, a:30, c:"F" },
  { n:"Grape, Muscat Hamburg", o:"France", g:"Extra", u:"kg", e:8, p:7, d:8.5, a:32, c:"F" },
  { n:"Grape, Red Globe", o:"Italy", g:"Cat I", u:"kg", e:4, p:3.5, d:4, a:16, c:"F" },
  { n:"Grape, Vittoria", o:"Italy", g:"Cat I", u:"kg", e:5.5, p:5, d:6, a:22, c:"F" },
  { n:"Grape, White Seedless", o:"EU", g:"Cat I", u:"kg", e:6.5, p:5.5, d:7, a:26, c:"F" },
  { n:"Green Bean", o:"Kenya", g:"Extra Fine", u:"kg", e:11, p:9.5, d:12, a:43.5, c:"V" },
  { n:"Green Bean", o:"France", g:"Machine-Harvested, Cat I, Fine", u:"kg", e:4.5, p:4, d:5, a:18, c:"V" },
  { n:"Green Zebra Tomato", o:"France", g:"", u:"kg", e:8, p:7, d:8.5, a:32, c:"V" },
  { n:"Greengage Plum (Reine-Claude Dorée)", o:"France", g:"Cat I, 35-40mm, Tray", u:"kg", e:5, p:4.5, d:5.5, a:20, c:"F" },
  { n:"Greengage Plum (Reine-Claude Dorée)", o:"France", g:"Cat I, 40-45mm, Tray", u:"kg", e:5.5, p:4.5, d:5.5, a:22, c:"F" },
  { n:"Greengage Plum (Reine-Claude Dorée)", o:"France", g:"Cat I, 45-50mm", u:"kg", e:6.5, p:5.5, d:7, a:26, c:"F" },
  { n:"Hazelnut, Dried", o:"France", g:"+24mm", u:"kg", e:8.5, p:7.5, d:9, a:34, c:"F" },
  { n:"Hazelnut, Fresh", o:"France", g:"", u:"kg", e:8, p:6.5, d:8.5, a:32, c:"F" },
  { n:"Leek", o:"Belgium", g:"", u:"kg", e:3, p:2.5, d:3, a:12, c:"V" },
  { n:"Leek", o:"France", g:"Cat I", u:"kg", e:3, p:2.5, d:3, a:12, c:"V" },
  { n:"Lettuce, Batavia Blonde", o:"France", g:"Cat I, Box of 12", u:"box of 12", e:19, p:16, d:20.5, a:75.5, c:"V" },
  { n:"Lettuce, Iceberg", o:"Spain", g:"Cat I, Box of 10", u:"box of 10", e:19, p:16, d:20.5, a:75.5, c:"V" },
  { n:"Lettuce, Oak Leaf Blond", o:"France", g:"Cat I, Box of 12", u:"box of 12", e:19, p:16, d:20.5, a:75.5, c:"V" },
  { n:"Lettuce, Oak Leaf Red", o:"France", g:"Cat I, Box of 12", u:"box of 12", e:19, p:16, d:20.5, a:75.5, c:"V" },
  { n:"Lime", o:"Brazil", g:"", u:"kg", e:5.5, p:4.5, d:5.5, a:22, c:"F" },
  { n:"Mango, Kent", o:"Mexico", g:"", u:"kg", e:10.5, p:9, d:11, a:41.5, c:"F" },
  { n:"Melon, Charentais Yellow", o:"France", g:"Cat I, 1150-1450g, Tray", u:"piece", e:4.5, p:4, d:5, a:18, c:"F" },
  { n:"Melon, Charentais Yellow", o:"France", g:"Cat I, 600-780g, Tray", u:"piece", e:3.5, p:3, d:4, a:14, c:"F" },
  { n:"Melon, Charentais Yellow", o:"France", g:"Cat I, 750-975g, Tray", u:"piece", e:4, p:3.5, d:4.5, a:16, c:"F" },
  { n:"Melon, Charentais Yellow", o:"France", g:"Cat I, 975-1250g, Tray", u:"piece", e:4.5, p:4, d:5, a:18, c:"F" },
  { n:"Mint", o:"", g:"", u:"10 bunches", e:5.5, p:4.5, d:5.5, a:22, c:"V" },
  { n:"Mint", o:"France", g:"", u:"10 bunches", e:5.5, p:4.5, d:5.5, a:22, c:"V" },
  { n:"Mirabelle Plum, Yellow", o:"France", g:"Cat I, 20-25mm, Tray", u:"kg", e:6.5, p:5.5, d:7, a:26, c:"F" },
  { n:"Mixed Salad Leaves", o:"France", g:"", u:"kg", e:10, p:8.5, d:11, a:39.5, c:"V" },
  { n:"Nectarine, White Flesh", o:"France", g:"Cat I A", u:"kg", e:4, p:3, d:4, a:16, c:"F" },
  { n:"Nectarine, White Flesh", o:"France", g:"Cat I AA", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"F" },
  { n:"Nectarine, White Flesh", o:"Spain", g:"Cat I A", u:"kg", e:4, p:3, d:4, a:16, c:"F" },
  { n:"Nectarine, White Flesh", o:"Spain", g:"Cat I AA", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"F" },
  { n:"Nectarine, Yellow Flesh", o:"France", g:"Cat I A", u:"kg", e:4, p:3, d:4, a:16, c:"F" },
  { n:"Nectarine, Yellow Flesh", o:"France", g:"Cat I AA", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"F" },
  { n:"Nectarine, Yellow Flesh", o:"Spain", g:"Cat I A", u:"kg", e:4, p:3, d:4, a:16, c:"F" },
  { n:"Nectarine, Yellow Flesh", o:"Spain", g:"Cat I AA", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"F" },
  { n:"Onion, White, Fresh", o:"France", g:"Cat I", u:"bunch", e:2, p:2, d:2.5, a:8, c:"V" },
  { n:"Oyster Mushroom", o:"", g:"", u:"kg", e:6.5, p:5.5, d:7, a:26, c:"V" },
  { n:"Oyster Mushroom", o:"France", g:"", u:"kg", e:10, p:8.5, d:10.5, a:39.5, c:"V" },
  { n:"Parsley, Curly", o:"EU", g:"", u:"10 bunches", e:6.5, p:5.5, d:7, a:26, c:"V" },
  { n:"Parsley, Flat-Leaf", o:"France", g:"", u:"10 bunches", e:6, p:5, d:6.5, a:24, c:"V" },
  { n:"Passion Fruit, Purple", o:"Vietnam", g:"", u:"kg", e:13.5, p:11.5, d:14.5, a:53.5, c:"F" },
  { n:"Pea, Shelling", o:"France", g:"", u:"kg", e:9, p:7.5, d:10, a:36, c:"V" },
  { n:"Peach, White Flesh", o:"France", g:"Cat I A", u:"kg", e:4, p:3, d:4, a:16, c:"F" },
  { n:"Peach, White Flesh", o:"France", g:"Cat I AA", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"F" },
  { n:"Peach, White Flesh", o:"Spain", g:"Cat I A", u:"kg", e:4, p:3, d:4, a:16, c:"F" },
  { n:"Peach, White Flesh", o:"Spain", g:"Cat I AA", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"F" },
  { n:"Peach, Yellow Flesh", o:"France", g:"Cat I A", u:"kg", e:4, p:3, d:4, a:16, c:"F" },
  { n:"Peach, Yellow Flesh", o:"France", g:"Cat I AA", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"F" },
  { n:"Peach, Yellow Flesh", o:"Spain", g:"Cat I A", u:"kg", e:4, p:3, d:4, a:16, c:"F" },
  { n:"Peach, Yellow Flesh", o:"Spain", g:"Cat I AA", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"F" },
  { n:"Conference Pear", o:"Netherlands", g:"Cat I, 65-70mm, 1-Layer Tray", u:"kg", e:2.5, p:2, d:2.5, a:10, c:"F" },
  { n:"Guyot Pear", o:"France", g:"Cat I, 60-65mm, 1-Layer Tray", u:"kg", e:3, p:2.5, d:3, a:12, c:"F" },
  { n:"Guyot Pear", o:"France", g:"Cat I, 65-70mm, 1-Layer Tray", u:"kg", e:3.5, p:3, d:3.5, a:14, c:"F" },
  { n:"Guyot Pear", o:"France", g:"Cat I, 70-75mm, 1-Layer Tray", u:"kg", e:3.5, p:3, d:3.5, a:14, c:"F" },
  { n:"Pepper, Green Block", o:"Netherlands", g:"Cat I, Large", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"V" },
  { n:"Pepper, Red Block", o:"Netherlands", g:"Cat I, Large", u:"kg", e:5, p:4, d:5, a:20, c:"V" },
  { n:"Pepper, Yellow Block", o:"Netherlands", g:"Cat I, Large", u:"kg", e:7.5, p:6.5, d:8, a:30, c:"V" },
  { n:"Pineapple, Sugarloaf", o:"", g:"", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"F" },
  { n:"Pineapple, Sweet", o:"Central America", g:"Size B (1100-1500g)", u:"kg", e:5.5, p:4.5, d:5.5, a:22, c:"F" },
  { n:"Pineapple, Victoria", o:"Mauritius", g:"", u:"kg", e:6, p:5, d:6.5, a:24, c:"F" },
  { n:"Pineapple, Victoria", o:"Reunion", g:"", u:"kg", e:6.5, p:5.5, d:7, a:26, c:"F" },
  { n:"Plum, Blue", o:"", g:"Cat I, 35-40mm", u:"kg", e:2.5, p:2, d:2.5, a:10, c:"F" },
  { n:"Plum, Red", o:"France", g:"Cat I, 50-55mm", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"F" },
  { n:"Plum, Red", o:"Spain", g:"Cat I, 50-55mm", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"F" },
  { n:"Plum, Yellow", o:"France", g:"Cat I, 55-60mm", u:"kg", e:4.5, p:4, d:5, a:18, c:"F" },
  { n:"Pomegranate", o:"", g:"", u:"kg", e:5, p:4.5, d:5.5, a:20, c:"F" },
  { n:"Radish", o:"France", g:"", u:"bunch", e:1.5, p:1.5, d:2, a:6, c:"V" },
  { n:"Raspberry", o:"France", g:"Punnet 125g", u:"punnet", e:3, p:2.5, d:3.5, a:12, c:"F" },
  { n:"Raspberry", o:"Portugal", g:"Punnet 125g", u:"punnet", e:3.5, p:3, d:4, a:14, c:"F" },
  { n:"Redcurrant", o:"France", g:"Punnet 125g", u:"punnet", e:3, p:2.5, d:3, a:12, c:"F" },
  { n:"Redcurrant", o:"Netherlands", g:"Punnet 125g", u:"punnet", e:3, p:2.5, d:3, a:12, c:"F" },
  { n:"Rhubarb", o:"France", g:"", u:"kg", e:5, p:4, d:5, a:20, c:"F" },
  { n:"Rosemary", o:"France", g:"", u:"10 bunches", e:8, p:6.5, d:8.5, a:32, c:"V" },
  { n:"Sage", o:"France", g:"", u:"10 bunches", e:8, p:6.5, d:8.5, a:32, c:"V" },
  { n:"Shallot", o:"France", g:"Cat.I 30/50mm", u:"kg", e:2, p:1.5, d:2, a:8, c:"V" },
  { n:"Shelling Bean, Coco de Paimpol PDO", o:"France", g:"Cat I", u:"kg", e:4, p:3.5, d:4.5, a:16, c:"V" },
  { n:"Shiitake Mushroom", o:"", g:"", u:"kg", e:11, p:9.5, d:12, a:43.5, c:"V" },
  { n:"Shiitake Mushroom", o:"France", g:"", u:"kg", e:11, p:9.5, d:12, a:43.5, c:"V" },
  { n:"Sorrel", o:"France", g:"", u:"10 bunches", e:8, p:6.5, d:8.5, a:32, c:"V" },
  { n:"Spinach", o:"France", g:"Cat I", u:"kg", e:3, p:2.5, d:3, a:12, c:"V" },
  { n:"Strawberry, Charlotte", o:"France", g:"Cat I, Punnet 500g", u:"punnet", e:7, p:6, d:7.5, a:28, c:"F" },
  { n:"Strawberry, Mara des Bois", o:"France", g:"Cat I, Punnet 250g", u:"punnet", e:4.5, p:4, d:5, a:18, c:"F" },
  { n:"Tarragon", o:"France", g:"", u:"10 bunches", e:8, p:6.5, d:8.5, a:32, c:"V" },
  { n:"Thyme", o:"France", g:"", u:"10 bunches", e:8, p:6.5, d:8.5, a:32, c:"V" },
  { n:"Tomato, Cherry", o:"France", g:"Extra, Punnet 250g", u:"punnet", e:9.5, p:8, d:10, a:38, c:"V" },
  { n:"Tomato, Cherry, On-the-Vine", o:"France", g:"Cat I", u:"kg", e:9.5, p:8, d:10, a:38, c:"V" },
  { n:"Tomato, Cherry, On-the-Vine", o:"Netherlands", g:"Cat I", u:"kg", e:6.5, p:5.5, d:7, a:26, c:"V" },
  { n:"Tomato, Mixed Coloured Varieties", o:"France", g:"Cat I", u:"kg", e:6.5, p:5.5, d:7, a:26, c:"V" },
  { n:"Tomato, Ribbed Black", o:"France", g:"Cat I", u:"kg", e:5, p:4, d:5, a:20, c:"V" },
  { n:"Tomato, Ribbed Yellow", o:"France", g:"Cat I", u:"kg", e:5, p:4, d:5, a:20, c:"V" },
  { n:"Tomato, Ribbed (Aumônière)", o:"France", g:"Cat I", u:"kg", e:5, p:4, d:5, a:20, c:"V" },
  { n:"Tomato, Round, On-the-Vine", o:"Belgium", g:"Cat I", u:"kg", e:2.5, p:2.5, d:3, a:10, c:"V" },
  { n:"Tomato, Round, On-the-Vine", o:"Netherlands", g:"Cat I", u:"kg", e:2.5, p:2.5, d:3, a:10, c:"V" },
  { n:"Tomato, Round, On-the-Vine", o:"France", g:"Extra", u:"kg", e:2.5, p:2.5, d:3, a:10, c:"V" },
  { n:"Turnip, Round, Purple", o:"France", g:"", u:"kg", e:2.5, p:2, d:2.5, a:10, c:"V" },
  { n:"Walnut, Grenoble PDO, Dried", o:"France", g:"Cat I, +30mm", u:"kg", e:6.5, p:5.5, d:7, a:26, c:"F" },
  { n:"Walnut, Grenoble PDO, Dried", o:"France", g:"Cat I, +32mm", u:"kg", e:6.5, p:5.5, d:7, a:26, c:"F" },
  { n:"Watermelon, Seedless", o:"Spain", g:"Box of 2", u:"kg", e:2, p:1.5, d:2, a:8, c:"F" },
  { n:"Watermelon, Striped Elongated", o:"Spain", g:"Box of 2", u:"kg", e:1.5, p:1.5, d:2, a:6, c:"F" },
  { n:"Yellow Pineapple Tomato", o:"France", g:"", u:"kg", e:5, p:4.5, d:5.5, a:20, c:"V" },
];

// Opens a clean, print-styled window of one produce group so the user can save
// it as a PDF from the browser print dialog — same approach as the catalogue
// export, no PDF library needed. `kind` is 'F' (fruit) or 'V' (vegetables).
function downloadPriceListPDF(kind, ccy){
  const group = kind === 'F' ? 'Fruit' : 'Vegetables';
  const sym = ccy === 'EUR' ? '\u20AC' : ccy === 'GBP' ? '\u00A3' : ccy === 'USD' ? '$' : ccy === 'ZAR' ? 'R ' : 'AED ';
  const priceOf = r => ccy === 'EUR' ? r.e : ccy === 'GBP' ? r.p : ccy === 'USD' ? r.d : ccy === 'ZAR' ? zarOf(r) : r.a;
  const items = PRICE_LIST.filter(r => r.c === kind).slice().sort((a,b)=>a.n.localeCompare(b.n));
  const today = new Date().toLocaleDateString('en-GB', { day:'numeric', month:'long', year:'numeric' });
  const rows = items.map(r => `<tr><td class="nm">${r.n}</td><td>${r.o || '\u2014'}</td><td>${r.g || '\u2014'}</td><td>${r.u}</td><td class="pr">${sym}${priceOf(r).toFixed(2)}</td></tr>`).join('');
  const html = `<!doctype html><html><head><meta charset="utf-8"/><title>P&amp;L England \u2014 ${group} price list</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet"/>
<style>
@page{size:A4;margin:14mm}
*{box-sizing:border-box}
body{font-family:'Poppins',Helvetica,Arial,sans-serif;color:#0E2A47;margin:0;font-size:10.5pt;-webkit-print-color-adjust:exact;print-color-adjust:exact}
header{display:flex;justify-content:space-between;align-items:flex-end;border-bottom:2px solid #0E2A47;padding-bottom:12px;margin-bottom:18px}
h1{font-size:19pt;font-weight:500;margin:0 0 4px}
.sub{font-size:9pt;color:#3D5773}
.meta{font-size:9pt;color:#8A99AB;text-align:right;line-height:1.5}
table{width:100%;border-collapse:collapse}
thead th{text-align:left;font-size:8pt;font-weight:500;color:#8A99AB;border-bottom:1px solid #DCE0E6;padding:0 8px 7px}
thead th:last-child{text-align:right}
tbody td{padding:7px 8px;border-bottom:1px solid #EAEDF1;font-size:9.5pt;color:#3D5773;vertical-align:top}
tbody td.nm{color:#0E2A47;font-weight:500}
tbody td.pr{text-align:right;color:#D63B27;font-weight:600;white-space:nowrap}
tbody tr{page-break-inside:avoid}
thead{display:table-header-group}
footer{margin-top:20px;padding-top:12px;border-top:1px solid #DCE0E6;font-size:8pt;color:#8A99AB;line-height:1.6}
</style></head><body>
<header><div><h1>${group} price list</h1><div class="sub">P&amp;L England Ltd \u2014 sourced at Rungis International Market, Paris</div></div>
<div class="meta">${items.length} lines \u00B7 prices in ${ccy}<br/>${today}</div></header>
<table><thead><tr><th>Item</th><th>Origin</th><th>Size / grade</th><th>Unit</th><th>Price</th></tr></thead><tbody>${rows}</tbody></table>
<footer>Prices are ex-Rungis per unit and exclude air freight, documentation and duties. Rungis is a live market \u2014 prices move week to week with supply and demand, so treat these as indicative and contact us for a firm quote. Minimum order 500\u00A0kg.<br/>sales@plengland.co.uk \u00B7 +44 7808 034216 \u00B7 www.plengland.co.uk</footer>
<script>window.onload=function(){setTimeout(function(){window.print()},350)}<\/script>
</body></html>`;
  const w = window.open('', '_blank');
  if (!w) return;
  w.document.write(html);
  w.document.close();
}

function PriceList(){
  const [ccy, setCcy] = React.useState('EUR');
  const [query, setQuery] = React.useState('');
  const [expanded, setExpanded] = React.useState(false);

  const filtered = PRICE_LIST.filter(r => {
    if (!query.trim()) return true;
    const q = query.toLowerCase();
    return (r.n + ' ' + r.o + ' ' + r.g).toLowerCase().includes(q);
  });
  const isFiltered = query.trim().length > 0;
  const shown = (expanded || isFiltered) ? filtered : filtered.slice(0, 16);
  const sym = ccy === 'EUR' ? '\u20AC' : ccy === 'GBP' ? '\u00A3' : ccy === 'USD' ? '$' : ccy === 'ZAR' ? 'R ' : 'AED ';
  const priceOf = r => ccy === 'EUR' ? r.e : ccy === 'GBP' ? r.p : ccy === 'USD' ? r.d : ccy === 'ZAR' ? zarOf(r) : r.a;
  const fmt = v => v.toFixed(2);
  const fruitCount = PRICE_LIST.filter(r=>r.c==='F').length;
  const vegCount = PRICE_LIST.filter(r=>r.c==='V').length;

  return (
    <section id="pricing" className="section-pad" style={{background:'var(--paper)'}}>
      <div className="container">
        <div style={{textAlign:'center', marginBottom:32}}>
          <div className="eyebrow" style={{marginBottom:20}}>Price list</div>
          <h2 className="h-1" style={{margin:'0 auto', maxWidth:'20ch'}}>Indicative pricing, <em>updated weekly.</em></h2>
          <p className="lead" style={{margin:'20px auto 0', maxWidth:520}}>
            Ex-Rungis prices per unit, before freight. Rungis is a live market — prices move week to week with supply and demand, so treat these as a guide and message us for a firm quote.
          </p>
        </div>

        <div className="price-controls" style={{display:'flex', justifyContent:'center', alignItems:'center', gap:12, flexWrap:'wrap', marginBottom:24}}>
          <div style={{display:'inline-flex', background:'var(--paper-2)', border:'1px solid var(--line)', borderRadius:999, padding:3}}>
            {['EUR','GBP','USD','AED','ZAR'].map(c => (
              <button key={c} onClick={()=>setCcy(c)} style={{
                border:'none', cursor:'pointer', borderRadius:999, padding:'7px 18px',
                fontFamily:'var(--sans)', fontSize:13, fontWeight:500,
                background: ccy===c ? 'var(--ink)' : 'transparent',
                color: ccy===c ? '#fff' : 'var(--ink-2)', transition:'background 0.18s, color 0.18s'
              }}>{c === 'EUR' ? '\u20AC EUR' : c === 'GBP' ? '\u00A3 GBP' : c === 'USD' ? '$ USD' : c === 'ZAR' ? 'R ZAR' : 'AED'}</button>
            ))}
          </div>
          <div style={{position:'relative'}}>
            <span style={{position:'absolute', left:14, top:'50%', transform:'translateY(-50%)', color:'var(--ink-3)', display:'flex'}}>
              <Icon.Search size={14}/>
            </span>
            <input value={query} onChange={e=>setQuery(e.target.value)} placeholder="Search item, origin, grade…"
              style={{paddingLeft:38, width:260, fontSize:13.5}}/>
          </div>
          <span className="mono">{filtered.length} lines</span>
        </div>

        <div style={{display:'flex', justifyContent:'center', alignItems:'center', gap:8, flexWrap:'wrap', marginBottom:24}}>
          <span style={{fontSize:12.5, color:'var(--ink-3)'}}>Download as PDF:</span>
          <button className="pill" onClick={()=>downloadPriceListPDF('F', ccy)}>
            <Icon.Download size={12}/> Fruit ({fruitCount})
          </button>
          <button className="pill" onClick={()=>downloadPriceListPDF('V', ccy)}>
            <Icon.Download size={12}/> Vegetables ({vegCount})
          </button>
        </div>

        <div style={{background:'#fff', border:'1px solid var(--line)', borderRadius:'var(--radius-lg)', overflow:'hidden'}}>
          <div style={{overflowX:'auto'}}>
            <table style={{width:'100%', borderCollapse:'collapse', fontFamily:'var(--sans)', minWidth:640}}>
              <thead>
                <tr style={{textAlign:'left', fontSize:11.5, letterSpacing:'0.06em', color:'var(--ink-3)', borderBottom:'1px solid var(--line)'}}>
                  <th style={{padding:'14px 20px', fontWeight:500}}>Item</th>
                  <th style={{padding:'14px 12px', fontWeight:500}}>Origin</th>
                  <th style={{padding:'14px 12px', fontWeight:500}}>Size / grade</th>
                  <th style={{padding:'14px 12px', fontWeight:500}}>Unit</th>
                  <th style={{padding:'14px 20px', fontWeight:500, textAlign:'right'}}>Price</th>
                </tr>
              </thead>
              <tbody>
                {shown.map((r,i)=>(
                  <tr key={i} style={{borderBottom:'1px solid var(--line-soft)', fontSize:14}}>
                    <td style={{padding:'13px 20px', color:'var(--ink)', fontWeight:500}}>{r.n}</td>
                    <td style={{padding:'13px 12px', color:'var(--ink-2)', fontSize:13}}>{r.o || '\u2014'}</td>
                    <td style={{padding:'13px 12px', color:'var(--ink-2)', fontSize:13}}>{r.g || '\u2014'}</td>
                    <td style={{padding:'13px 12px', color:'var(--ink-2)', fontSize:13}}>{r.u}</td>
                    <td style={{padding:'13px 20px', textAlign:'right', color:'var(--tomato)', fontWeight:600, whiteSpace:'nowrap'}}>{sym}{fmt(priceOf(r))}</td>
                  </tr>
                ))}
                {shown.length === 0 && (
                  <tr><td colSpan="5" style={{padding:'32px 20px', textAlign:'center', color:'var(--ink-2)', fontSize:14}}>
                    Nothing matches “{query}” — we can almost certainly still source it. Message us.
                  </td></tr>
                )}
              </tbody>
            </table>
          </div>
        </div>

        {!isFiltered && filtered.length > 16 && (
          <div style={{marginTop:20, textAlign:'center'}}>
            <button onClick={()=>setExpanded(!expanded)} className="pill">
              {expanded ? 'Collapse price list' : `Show all ${filtered.length} lines`}
            </button>
          </div>
        )}

        <p style={{margin:'28px auto 0', textAlign:'center', fontSize:13, color:'var(--ink-3)', maxWidth:'70ch', lineHeight:1.6}}>
          Prices are ex-Rungis per unit and exclude air freight, documentation and duties. GBP, USD, AED and ZAR shown at indicative rates of {GBP_RATE}, {USD_RATE}, {AED_RATE} and {ZAR_RATE} to the euro. All prices rounded to the nearest half unit. Minimum order 500 kg.
        </p>
      </div>
      <style>{`
        @media (max-width: 640px){
          #pricing .price-controls input { width: 100% !important; }
          #pricing .price-controls > div:nth-child(2) { flex: 1 1 100%; }
        }
      `}</style>
    </section>
  );
}

Object.assign(window, { PriceList });
