
    t+j4H                     "   d dl Z d dlZd dlmZ d dlmZ d dlmZ i dg ddg dd	g d
dg ddg ddg ddg ddg ddg ddg ddg ddg ddg ddg d d!g d"d#g d"d$g d%g d&g d'g d(g dg d&g d)g d*g d+g d,g d-g d&d.Zd=d/Zd0 Z	d1 Z
d2 Zd3 Zd4 Zed5k(  rb eej                         d6k7  r ed7        ed8      ej                   d8   Z ee      \  ZZ ed9e d:        ed;e         ed<e        yy)>    N)copy)copy2)load_workbookcafe)
3 b ' i< i: i  e 鐾   coffee)r   r   r	   r
   I	 鯵> espresso)r   r   i latte)r   r   r	   pastry)r   r   r r
   burger)r    07 pasta)r   i ( grill)r   r   r   cake)r   r   L dessert)r   r   r   r
   bakery)r   r   r   r
   sushi)i i is# ramen)i, iD7 r   curry)( r   70 salad)r   b r   acaivegan)r   r%   r%   )r#   r"   r   )r#   r"   r   )r"   r   r   )r   r   r
   )r   r   r   )r   r   r   )r   r   r   )r   r%   r   )hotpotkebabricenoodledumplingteafriedchickensmoothiewrapsoupc           	          d}| xs dj                         }t        D ]
  }||v s|} n t        |   }||t        |      z     }d| d| d| d| d	S )Nr    z!https://images.pexels.com/photos/z/pexels-photo-z".jpeg?auto=compress&cs=tinysrgb&w=z&h=z	&fit=crop)lower
PEXELS_IDSlen)	keywordseedwhkeyr5   	candidatepoolphoto_ids	            app/update_excel_products.py
pexels_urlrA   )   s    
C]!!#E	C   c?DD3t9$%H.xjxjPrstruuxyzx{  |E  F  F    c                    | xs dj                         t        fddD              ryt        fddD              ryt        fdd	D              ry
t        fddD              ryt        fddD              ryt        fddD              ryt        fddD              ryt        fddD              ryt        fddD              ry|xs dS )Nr4   c              3   &   K   | ]  }|v  
 y wN .0knames     r@   	<genexpr>zinfer_theme.<locals>.<genexpr>7   s     
|{19{   )
r   r   r   r   toastbaristabeanbrewkopir   Cafes & Coffeec              3   &   K   | ]  }|v  
 y wrE   rF   rG   s     r@   rK   zinfer_theme.<locals>.<genexpr>9   s     
fe19erL   )r   r    izakayaudonyakitoridonburiomakaseJapanese Foodc              3   &   K   | ]  }|v  
 y wrE   rF   rG   s     r@   rK   zinfer_theme.<locals>.<genexpr>;   s     
FE19ErL   )koreankimchibbqbibimbapKoreanc              3   &   K   | ]  }|v  
 y wrE   rF   rG   s     r@   rK   zinfer_theme.<locals>.<genexpr>=   s     
KJ19JrL   )thaiztom yumbasilzmango stickyThaic              3   &   K   | ]  }|v  
 y wrE   rF   rG   s     r@   rK   zinfer_theme.<locals>.<genexpr>?   s     
RQ19QrL   )indianbiryanitandoorimasalanaanIndianc              3   &   K   | ]  }|v  
 y wrE   rF   rG   s     r@   rK   zinfer_theme.<locals>.<genexpr>A   s     
PO19OrL   )halalnasisatayz	mee rebuspenyetMalay / Halalc              3   &   K   | ]  }|v  
 y wrE   rF   rG   s     r@   rK   zinfer_theme.<locals>.<genexpr>C   s     
>=19=rL   )r(   	steamboatmalaHotpotc              3   &   K   | ]  }|v  
 y wrE   rF   rG   s     r@   rK   zinfer_theme.<locals>.<genexpr>E   s     
NM19MrL   )r&   r$   r'   grainr0   $Health (Vegan / Acai / Clean eating)c              3   &   K   | ]  }|v  
 y wrE   rF   rG   s     r@   rK   zinfer_theme.<locals>.<genexpr>G   s     
TS19SrL   )r   r   r   
patisserier   Desserts / BakeryOthers (F&B))r5   any)merchant_namecategoryrJ   s     @r@   infer_themer   5   s    R&&(D

|{
||

fe
ff

FE
FF

KJ
KK

RQ
RR

PO
PP

>=
>>

NM
NN5

TS
TT"%~%rB   c                 :   | dd| ddddddd	d
dddddddddddddddddddddg| dd| ddddddd d!d"d#dd$d%d&d"d'dd(d)d*d+d,dd-d.d/dddg| d0d1| d2d3d4d5dd6d7d/d+d8dd9d:d;d<d=dd>d?d
d"d@ddAdBdCddDdg| dEdF| dGdHdId5ddJdKddLdMddNdOd&d<dPddQdRd3d+d,ddSdTddddg| dUdV| dWd&dId5ddXdYd3dZd[dd\d]d;d"d^dd_d`d/d+d,ddadbdCddDdg| dcdd| ded;d<d=ddfdgd3dZd[ddhdid
d4d^ddjdkdddddldmdddDdg| dndo| dpd!d"d@ddqdrdHd4d5ddsdtd/dud,ddvdwd&dxd^ddydzdCddDdg| d{d|| d}d~d4d5dddd
d+ddddd/d<d=dddd3d"d^ddddCddDdg| dd| dddddddddddddddddddddddddddddg| dd| dddddddddddddd3ddddddddddddd<d=dg| dd| dddddddd~dddddd
dddddddddddd/dddg| dd| dddd#dddd~d<d=dddd3dd^ddddddddddCddDdgdɜ}|j                  | |d         S )Nz Signature ToastzHouse toast at zC layered with premium toppings for a warm and satisfying cafe bite.   Brunchr   )rJ   descpricecatr8   zSmoked Salmon BagelzkA toasted bagel layered with smoked salmon, cream cheese, and crisp greens for a premium all-day cafe bite.   zBerry Yogurt ParfaitzmLayers of yogurt, house granola, and mixed berries come together for a light and refreshing breakfast option.   Dessertr   zCold Brew CoffeezjSlow-steeped cold brew served chilled with a smooth body and low acidity for a bold but refreshing finish.   Beverager   zChocolate Muffinz]A moist chocolate muffin with a rich cocoa profile, baked fresh for a comforting sweet treat.   Pastryz Signature PastazA house-style pasta at zK finished with a rich sauce and balanced garnish for a hearty western main.   Pastar   zGrilled Chicken Chopz_Juicy chicken chop grilled to order and served with sides for a familiar western comfort plate.   Mainr   zClassic Beef Burgerz]A stacked beef burger with crisp greens, sauce, and fries for a satisfying all-day favourite.   r   zTruffle Fries BasketzbCrisp fries tossed with truffle seasoning and served hot as a savoury sharing snack for the table.   Starterr.   zButtermilk Wafflesz`Golden waffles served warm with syrup and cream, created as a sweet western-style dessert plate.   z Signature Fried RicezWok-fried rice at zJ tossed with aromatics, egg, and savoury toppings for a comforting staple.   Ricer*   zChicken Dumpling BasketzXA basket of juicy dumplings served warm with dipping sauce as a classic sharing starter.r,   zBraised Beef NoodleszYSpringy noodles in a savoury braised broth with tender beef for a deeply satisfying bowl.   Noodlesr+   zMapo Tofu Bowlz_Silken tofu simmered in a bold savoury sauce and served with rice for a comforting meal option.r!   zChrysanthemum TeazRA lightly floral tea served chilled to refresh the palate alongside richer dishes.   r-   z Signature DonburizA generous donburi bowl from z0 topped with premium ingredients over warm rice.   z	Rice BowlzSalmon Sushi SetzdFresh salmon sushi arranged as a balanced set for guests who enjoy a clean Japanese flavour profile.Sushir   zTonkotsu RamenzVA rich ramen broth with noodles and toppings, served hot for a deeply comforting meal.r    zCrispy Tempura PlatterzPLightly battered tempura served crisp and golden with dipping sauce for sharing.zMatcha Mochi DessertzUA sweet matcha-forward dessert with chewy mochi texture for a gentle Japanese finish.z Signature BibimbapzA colourful bibimbap bowl from z1 with rice, vegetables, protein, and house sauce.zKimchi Stewz_A warming stew with kimchi and savoury depth, served bubbling hot for a comforting Korean meal.Soupr2   zSoy Garlic ChickenzTCrisp chicken glazed in soy garlic sauce for a sweet-savoury Korean crowd favourite.r/   zTteokbokki BiteszVChewy rice cakes coated in a bold Korean sauce and served as a popular snack to share.zKorean Barley TeazQA roasted barley tea served chilled for a mellow and refreshing beverage pairing.z Signature Pad ThaizA wok-tossed pad thai from z/ with balanced sweet, savoury, and tangy notes.zTom Yum Seafood SoupzSA bright, spicy soup with seafood and herbs, created as a bold Thai signature bowl.zBasil Chicken RicezHFragrant basil chicken served over rice for a punchy Thai comfort plate.zMango Sticky RicezVA classic Thai dessert with sweet mango and coconut sticky rice for a tropical finish.zThai Milk TeazJCreamy Thai milk tea served iced as a rich and refreshing beverage choice.z Signature CurryzA rich house curry from z3 simmered with spices and served with hearty sides.zLamb BiryanizUFragrant biryani rice layered with tender lamb and spices for a complete Indian main.zMasala DosazSA crisp dosa wrapped around spiced potato filling, served with chutneys and sambar.SnackzTandoori Chicken PlatterzRA smoky chicken platter marinated in spices and roasted for a bold Indian flavour.Grillz	Teh TarikzPPulled milk tea served hot or iced as a familiar South Asian beverage companion.z Signature Nasi LemakzA house nasi lemak at z8 with fragrant rice, sambal, and classic accompaniments.   zSatay PlatterzSSkewered satay grilled and served with sauce for a popular halal sharing appetiser.r)   zMee Rebus BowlzPA hearty noodle bowl in thick savoury gravy, topped for a comforting local meal.zAyam Penyet SetzQCrispy smashed chicken with rice and sambal, plated as a satisfying halal staple.zBandung SodazQA chilled rose syrup beverage with a creamy finish for a sweet local refreshment.z Signature CroissantzA buttery croissant at z+, baked to a flaky finish and served fresh.   zStrawberry TartzTA fruit tart with smooth filling and fresh strawberries for a bright bakery dessert.	   r   zCinnamon RollzUA soft roll layered with cinnamon sugar and glaze, baked for a warm comforting treat.r   zChocolate Layer CakezgA rich chocolate cake slice with soft layers and a smooth finish, ideal for sharing or solo indulgence.
   zVanilla EclairzTA delicate pastry filled with vanilla cream for a light but satisfying sweet option.z Signature BrothzA signature broth from z* prepared to anchor a warming hotpot meal.   z
Broth Baser(   zWagyu Hotpot PlatterzOThinly sliced wagyu arranged for quick cooking in a rich bubbling hotpot broth.$   zPremium MeatzFish Paste AssortmentzWA selection of handmade fish paste pieces created to add texture and flavour to hotpot.SidezVegetable BasketzOA fresh basket of leafy greens, mushrooms, and vegetables prepared for the pot.	Vegetabler$   zHandmade NoodleszMFresh noodles designed to soak up broth and round out a complete hotpot meal.z Signature Acai BowlzA colourful acai bowl from z. topped with fruits, seeds, and house granola.Bowlr&   zQuinoa Salad Platez[A balanced salad with quinoa, greens, and vegetables designed for a clean and filling meal.SaladzGrilled Tofu Protein Bowlz^A protein-focused bowl with tofu, grains, and vegetables for a wholesome plant-forward option.r'   zGreen Detox SmoothiezQA fresh smoothie blended with greens and fruit for a bright and energising drink.r0   zAvocado WrapzXA soft wrap filled with avocado and crunchy vegetables for an easy healthy lunch choice.Wrapr1   z House PlatterzA mixed house platter from z7 combining popular bites into one satisfying selection.PlatterzSignature NoodleszXA savoury noodle dish built as an easy all-day choice with balanced flavour and texture.zGrilled Chicken BowlzSA hearty bowl of grilled chicken, rice, and vegetables for a satisfying daily main.zSeasonal Dessert CupzOA compact dessert cup made to finish the meal with a sweet and refreshing note.zIced Lemon TeazXA chilled tea beverage with citrus brightness to refresh the palate throughout the meal.)rR   zWestern / FusionzChinese CuisinerY   r_   rc   rj   rp   rz   rt   rw   r{   r{   )get)themer}   productss      r@   extra_productsr   L   s	
    &&67?S`Ra  be  Bf  qs  |D  QY  Z*  5b  mo  x@  MU  V+  6e  pr  {D  QZ  ['  2^  ij  s}  JR  S'  2Q  \]  fn  {C  D
 &&67CZ[hZi  ju  Bv  AC  LS  `g  h+  6W  bd  ms  @G  H*  5T  _a  jp  }E  F+  6Z  eg  py  FM  N)  4V  ac  lu  BK  L
 &&;<HZ[hZi  jt  Gu  @B  KQ  ^d  e.  9S  ^`  ir  I  J+  6Q  \^  gp  }E  F%  0Q  \^  gm  zA  B(  3G  RS  \f  sx  y
 &&89Ebcpbq  rb  Dc  np  yD  QW  X'  2X  ce  nu  BI  J%  0H  SU  ^g  t{  |-  8J  UW  `i  v}  ~+  6M  XZ  cl  yB  C
 &&9:Fefset  uf  Eg  rt  }H  U[  \"  -N  Y[  dj  w}  ~)  4J  UW  `f  s|  }'  2J  UW  `i  v}  ~(  3F  QR  [e  rw  x
 &&9:Faboap  q`  Ea  ln  w@  MU  V+  6K  VX  ag  tz  {)3}  IK  TZ  gp  q(  3K  VX  aj  w@  A$.z  FG  PZ  gl  m
 &&67C[\i[j  k^  B_  jl  u{  HO  P#  .E  PR  [a  nt  u"  -B  MO  X_  ls  t/  :N  Y[  dk  xA  B *|  HI  R\  in  o
 &&;<H^_l^m  nf  Gg  rt  }C  PV  W$  /D  OQ  Zc  pw  x%  0B  MO  Xa  nv  w&  1D  OQ  Z`  mv  w#  .A  LM  V`  mr  s
 &&:;G^_l^m  nY  FZ  ef  ow  DL  M&  1G  RS  \e  rx  y$  /F  QR  [c  px  y+  6_  jl  u~  KQ  R%  0F  QR  [c  py  z
 &&67CZ[hZi  jT  BU  `b  kw  DL  M+  6G  RT  ]k  x@  A,  7P  []  fl  yA  B'  2C  NP  Yd  qx  y'  2A  LM  V_  lt  u
 &&:;Gbcpbq  r`  Fa  ln  w}  JP  Q)  4Q  \^  gn  {B  C0  ;[  fh  qw  DK  L+  6I  TU  ^h  u  @#  .H  SU  ^d  qw  x1
 &n5A\]j\k  lc  @d  oq  zC  PW  X(  3M  XZ  cl  yA  B+  6K  VX  ag  t}  ~+  6G  RS  \e  r{  |%  0J  UV  _i  v{  |
]UHl <<x788rB   c                     i }| j                  dd      D ]=  }|d d \  }}}}|r|s|xs t        |      j                  dd      d   |xs dd	||<   ? |S )
Nr   T)min_rowvalues_only       r{   )r}   r~   )	iter_rowsstrsplit)index_wsresultrowmerchant_id
sheet_namer}   r~   s          r@   load_index_metar      sv    F!!!!>;>r78Z**Oc*o.C.CC.KB.O 2N
z	 ? MrB   c                     t        d| j                  dz         D ]%  }| j                  |d      j                  dk(  s#|c S  y )Nr   zITEM INFORMATION / PRODUCTS)rangemax_rowcellvalue)wsis     r@   find_product_sectionr      s>    1bjj1n%771a="??H & rB   c           
      H   | j                  dd      }t        j                  j                  |      st	        | |       t        |       }t        |d         }d}|j                  D ]  }|j                  dk(  rt        |      }|s"|dz   }|}|j                  |d      j                  "|dz  }|j                  |d      j                  "||z
  }	|j                  |j                  i       }
|
j                  d|j                  j                  dd      d	         }|
j                  d
d      }t        ||      }t        ||      }|	dk  r|j!                  |d|	z
         n|	dkD  r|j#                  |dz   |	dz
         |j                  j                  dd      d   }|}t%        |d      D ]V  \  }}||z   dz
  }t'        dd      D ]<  }t)        |j                  ||      j*                        |j                  ||      _        > |j,                  |   j.                  |j,                  |   _        d|dd   d| |j                  |d      _        t1        |d   t3        |dd        |z         |j                  |d      _        |d   |j                  |d      _        |d   |j                  |d      _        |d   |j                  |d      _        |d   |j                  |d      _        d|j                  |d      _        Y |dz  } |j5                  |        ||fS )Nz.xlsxz_before_20_products.xlsxIndexr      r   r}   r   r   r~   r{   r   )amountr   )startr   I-r8   rJ      r   r   r   r   r   r   Regularr   )replaceospathexistsr   r   r   
worksheetstitler   r   r   r   r   r   r   insert_rowsdelete_rows	enumerater   r   _stylerow_dimensionsheightrA   intsave)r   backup_pathwbmeta	processedr   section_rowfirst_product_row	blank_rowexisting_countinfor}   r~   r   r   mid	style_rowindexproductrow_numcols                        r@   update_workbookr      s   ,,w(BCK77>>+&dK 	t	B2g;'DImm88w*2.'!O%	ggi#))5NI ggi#))5"%66xx"%"((..a2H2LM88J7M84!%7BNN9R.-@NAb NN,r1>B3FGhhnnS!$Q'%	';;NE7'%/!3GQ{/3BGGIs4K4R4R/S%, #020A0A)0L0S0SBg&-*+CG9AeW(=BGGGQ%(2793Es3qr7|V[G[(\BGGGQ%(/BGGGQ%(/BGGGQ%(/(8BGGGQ%(/BGGGQ%(1BGGGQ% < 	Q	Q T GGDMk!!rB   __main__r   zCUsage: python3 update_excel_products.py /absolute/path/to/file.xlsxr   zUpdated z merchant sheets.zBackup copy: zWorkbook updated: )i@  i  )r   sysr   shutilr   openpyxlr   r6   rA   r   r   r   r   r   __name__r7   argvprint
SystemExitworkbook_pathprocessed_countr   rF   rB   r@   <module>r      s   	 
   "
aA ( &	
 / ) ( ( % 0 / ' ( ( (  '!" (#$ *(')+#(**''9
@	F&.W9t
4"n z
388}STmHHQKM#2=#A O[	H_%%6
78	M+
'(	}o
./ rB   