BuyTicket.cshtml 79 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431
  1. @model LotteryWebApp.Models.HomeIndex_ViewModel
  2. @{
  3. ViewData["Title"] = "Millions - Buy Ticket";
  4. Layout = "~/Areas/Millions/Views/Shared/_Layout.cshtml";
  5. var currentTerm = Model.listTerm?.FirstOrDefault();
  6. }
  7. @using LotteryWebApp.Languages;
  8. @using LotteryWebApp.Common;
  9. @section Styles {
  10. <link rel="stylesheet" href="/Millions/css/buy-ticket.css" />
  11. <style>
  12. /* BuyTicket has its own bottom bar; avoid global navbar padding gap */
  13. body.millions-bg { padding-bottom: 0 !important; }
  14. body.millions-bg .main-container { padding-bottom: 0 !important; }
  15. </style>
  16. }
  17. @if (Model.termType == Constants.PIC10_BIGSMALL_CODE || Model.termType == Constants.PIC10_ODDEVEN_CODE)
  18. {
  19. var isBigSmall = Model.termType == Constants.PIC10_BIGSMALL_CODE;
  20. var themeColor = isBigSmall ? "#0A9800" : "#AA3DC8";
  21. var gameTitle = isBigSmall ? Lang.millions_big_small : Lang.millions_odd_even;
  22. var prizeAmount = isBigSmall ? "100.000" : "200.000";
  23. <!-- ==================== CARD SELECTION GAME UI (BIG/SMALL or ODD/EVEN) ==================== -->
  24. <div class="millions-buy-ticket-page main-container animate__animated animate__fadeIn overflow-hidden">
  25. <!-- Header -->
  26. <div class="header">
  27. <button onclick="location.href='@Url.Action("GameHome", "Home")'" class="back-btn" type="button">
  28. <i class="fa-solid fa-arrow-left"></i>
  29. </button>
  30. <div class="header-title">@gameTitle</div>
  31. </div>
  32. <div class="content-card">
  33. <!-- Sticky Term Info sub-header -->
  34. <div class="ticket-subheader">
  35. <div class="flex items-center justify-between">
  36. <div class="flex items-center gap-2 border border-[#E5E7EB] rounded-lg px-3 py-1.5 bg-gray-50">
  37. <i class="fa-regular fa-calendar text-[[@themeColor]] text-sm" style="color: @themeColor"></i>
  38. <span class="text-[12px] font-bold text-gray-700">@DateTime.Now.ToString("dddd, MMM dd, yyyy", System.Globalization.CultureInfo.InvariantCulture)</span>
  39. </div>
  40. <div class="flex items-center gap-1 ml-4 flex-1 justify-end">
  41. <span class="text-[12px] font-bold text-gray-400">@Lang.millions_round</span>
  42. <span class="text-[18px] font-black text-brown-main">#@(currentTerm?.id ?? "123")</span>
  43. </div>
  44. </div>
  45. </div>
  46. <!-- Scrollable Content Area -->
  47. <div class="ticket-scroll-area bg-white pb-40" id="bsContent">
  48. <!-- Results for the last 5 days -->
  49. <div class="px-5 pt-4 pb-2">
  50. <h3 class="text-[17px] font-bold text-black text-center mb-3">Results for the last 5 days</h3>
  51. <div id="last5Results" class="flex justify-between gap-1.5 px-1">
  52. @{
  53. var pastTerms = ViewBag.PastTerms as List<LotteryWebApp.Service.Term> ?? new List<LotteryWebApp.Service.Term>();
  54. foreach (var term in pastTerms) {
  55. var rawResult = (term.result ?? "").Trim().ToUpper();
  56. var dateStr = "--";
  57. DateTime dt;
  58. if (DateTime.TryParse(term.date_random, out dt)) {
  59. dateStr = dt.ToString("MMM dd", System.Globalization.CultureInfo.InvariantCulture);
  60. }
  61. var resKey = rawResult;
  62. var resTitle = rawResult;
  63. if (isBigSmall) {
  64. if (rawResult == "S") { resKey = "Small"; resTitle = Lang.Small; }
  65. else if (rawResult == "B") { resKey = "Big"; resTitle = Lang.Big; }
  66. } else {
  67. if (rawResult == "O") { resKey = "Odd"; resTitle = Lang.Odd; }
  68. else if (rawResult == "E") { resKey = "Even"; resTitle = Lang.Even; }
  69. }
  70. var resColor = "";
  71. var bgStyle = "background: linear-gradient(136deg, #FFFAE6 0%, #FFE588 100%);";
  72. var textStyle = "-webkit-text-stroke: 0.5px #000;";
  73. if (resKey == "NA" || string.IsNullOrEmpty(rawResult)) {
  74. bgStyle = "background: #EAEAEA;";
  75. resTitle = "";
  76. textStyle = "";
  77. } else {
  78. if (isBigSmall) {
  79. resColor = resKey == "Big" ? "#A2FF00" : "#FF4157";
  80. } else {
  81. resColor = resKey == "Odd" ? "#FFC700" : "#B33BD0";
  82. }
  83. textStyle += $" color: {resColor};";
  84. }
  85. <div class="flex flex-col items-center justify-center min-h-[64px] flex-1 rounded-lg py-1.5 border border-gray-200" style="@bgStyle">
  86. <span class="text-[11px] font-bold text-black whitespace-nowrap opacity-70">@dateStr</span>
  87. <span class="text-[22px] font-black leading-tight" style="@textStyle">@resTitle</span>
  88. </div>
  89. }
  90. for(int r = pastTerms.Count; r < 5; r++) {
  91. <div class="flex flex-col items-center justify-center min-h-[64px] flex-1 rounded-lg py-1.5 border border-gray-200" style="background: #EAEAEA; opacity: 0.7;">
  92. <span class="text-[11px] font-bold text-black whitespace-nowrap opacity-70">--</span>
  93. <span class="text-[22px] font-black leading-tight" style="color: transparent;"></span>
  94. </div>
  95. }
  96. }
  97. </div>
  98. </div>
  99. <!-- Selection Cards -->
  100. <!-- Selection Cards -->
  101. <div class="px-5 pt-4 flex gap-3 h-[245px]">
  102. <!-- Card 1 (Big or Odd) -->
  103. <div id="cardBig" onclick="selectBigSmall('big')" class="bigsmall-card flex-1 rounded-2xl relative cursor-pointer transition-all duration-300 active:scale-[0.97] border-2 border-transparent overflow-hidden flex flex-col" style="background: linear-gradient(180deg, #FFF7DB 0%, #FFEEB3 100%);">
  104. <img src="/Millions/img/bigsmall/light_effect_1.png" class="absolute top-0 left-0 w-full opacity-60 pointer-events-none" alt="" />
  105. <img src="/Millions/img/bigsmall/light_effect_2.png" class="absolute bottom-12 left-0 w-full opacity-60 pointer-events-none" alt="" />
  106. <div class="flex flex-col items-center pt-4 pb-3 px-3 relative z-10 h-full justify-between">
  107. <div class="flex flex-col items-center w-full">
  108. <div class="h-[34px] flex items-center justify-center">
  109. <div class="text-[40px] font-[800] leading-none" style="-webkit-text-stroke: 1px #000; text-shadow: 1px 2px 2px rgba(0,0,0,0.15); color: @(isBigSmall ? "#A2FF00" : "#FFC700");">@(isBigSmall ? "Big" : "Odd")</div>
  110. </div>
  111. <div class="text-[11px] font-medium text-gray-500 mt-1 h-[28px] text-center leading-tight">
  112. @(isBigSmall ? "13 number from" : "Odd numbers") <br/> <b>@(isBigSmall ? "41-80" : "1, 3, 5, 7, 9")</b>
  113. </div>
  114. </div>
  115. <div class="flex items-center justify-center -space-x-2 my-2">
  116. @if (isBigSmall) {
  117. <img src="/Millions/img/bigsmall/ball_42_dark.png" class="w-12 h-12 relative z-[1]" alt="42" />
  118. <img src="/Millions/img/bigsmall/ball_88_big.png" class="w-16 h-16 relative z-[2]" alt="88" />
  119. <img src="/Millions/img/bigsmall/ball_54_dark.png" class="w-12 h-12 relative z-[1]" alt="54" />
  120. } else {
  121. <img src="/Millions/img/oddeven/ball_3.png" class="w-12 h-12 relative z-[1]" alt="3" />
  122. <img src="/Millions/img/oddeven/ball_1.png" class="w-16 h-16 relative z-[2]" alt="1" />
  123. <img src="/Millions/img/oddeven/ball_19.png" class="w-12 h-12 relative z-[1]" alt="19" />
  124. }
  125. </div>
  126. <button class="bigsmall-btn w-full py-2.5 rounded-xl font-black text-[15px] transition-all shadow-md" style="background: @themeColor; color: white;">@Lang.millions_select</button>
  127. </div>
  128. </div>
  129. <!-- Card 2 (Small or Even) -->
  130. <div id="cardSmall" onclick="selectBigSmall('small')" class="bigsmall-card flex-1 rounded-2xl relative cursor-pointer transition-all duration-300 active:scale-[0.97] border-2 border-transparent overflow-hidden flex flex-col" style="background: linear-gradient(180deg, #FFF7DB 0%, #FFEEB3 100%);">
  131. <img src="/Millions/img/bigsmall/light_effect_1.png" class="absolute top-0 left-0 w-full opacity-60 pointer-events-none" alt="" />
  132. <img src="/Millions/img/bigsmall/light_effect_2.png" class="absolute bottom-12 left-0 w-full opacity-60 pointer-events-none" alt="" />
  133. <div class="flex flex-col items-center pt-4 pb-3 px-3 relative z-10 h-full justify-between">
  134. <div class="flex flex-col items-center w-full">
  135. <div class="h-[34px] flex items-center justify-center">
  136. <div class="text-[40px] font-[800] leading-none italic" style="-webkit-text-stroke: 1px #000; text-shadow: 1px 2px 2px rgba(0,0,0,0.15); color: @(isBigSmall ? "#FF4157" : "#B33BD0");">@(isBigSmall ? "Small" : "Even")</div>
  137. </div>
  138. <div class="text-[11px] font-medium text-gray-500 mt-1 h-[28px] text-center leading-tight">
  139. @(isBigSmall ? "13 number from" : "Even numbers") <br/> <b>@(isBigSmall ? "01-40" : "0, 2, 4, 6, 8")</b>
  140. </div>
  141. </div>
  142. <div class="flex items-center justify-center -space-x-2 my-2">
  143. @if (isBigSmall) {
  144. <img src="/Millions/img/bigsmall/ball_5_blue.png" class="w-12 h-12 relative z-[1]" alt="5" />
  145. <img src="/Millions/img/bigsmall/ball_1_big.png" class="w-16 h-16 relative z-[2]" alt="1" />
  146. <img src="/Millions/img/bigsmall/ball_8_pink.png" class="w-12 h-12 relative z-[1]" alt="8" />
  147. } else {
  148. <img src="/Millions/img/oddeven/ball_66.png" class="w-12 h-12 relative z-[1]" alt="66" />
  149. <img src="/Millions/img/oddeven/ball_68.png" class="w-16 h-16 relative z-[2]" alt="68" />
  150. <img src="/Millions/img/oddeven/ball_88.png" class="w-12 h-12 relative z-[1]" alt="88" />
  151. }
  152. </div>
  153. <button class="bigsmall-btn w-full py-2.5 rounded-xl font-black text-[15px] transition-all shadow-md"
  154. style="background: @themeColor; color: white;">@Lang.millions_select</button>
  155. </div>
  156. </div>
  157. </div>
  158. <!-- You Choose + Prize Section -->
  159. <div class="px-5 pt-6 flex flex-col items-center gap-4">
  160. <div class="flex flex-col items-center">
  161. <span class="text-[15px] font-medium text-black">@Lang.millions_you_choose</span>
  162. <span id="choiceDisplay" class="text-[42px] font-[800] leading-tight" style="-webkit-text-stroke: 1px #000;">—</span>
  163. </div>
  164. <div class="flex flex-col items-center">
  165. <span class="text-[18px] font-medium text-black">@Lang.millions_prize_if_win</span>
  166. <div class="flex items-baseline gap-1">
  167. <span class="text-[28px] font-black text-black">@prizeAmount</span>
  168. <span class="text-[14px] font-black text-[#E56B23]">HTG</span>
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. <!-- Bottom Action Bar -->
  174. <div class="p-4 bg-white border-t border-gray-200 z-[70] shadow-[0px_-4px_10px_rgba(0,0,0,0.03)] absolute bottom-0 w-full left-0">
  175. <div class="flex items-center justify-between">
  176. <div class="flex flex-col">
  177. <div class="flex items-center gap-1.5 mb-0.5">
  178. <span class="text-[11px] text-black font-black uppercase">@Lang.total_ticket:</span>
  179. <span id="bsTotalTicketCount" class="text-[12px] font-black text-black">0</span>
  180. </div>
  181. <span class="text-[11px] text-black font-black uppercase">@Lang.millions_estimated_ticket_price</span>
  182. <div class="flex items-baseline gap-1">
  183. <span id="bsTotalPrice" class="text-[28px] font-black text-black">0</span>
  184. <span class="text-[13px] font-black" style="color: @themeColor">HTG</span>
  185. </div>
  186. </div>
  187. <button id="bsPaymentBtn" onclick="bsShowPayment()" class="text-white text-[20px] font-black px-10 py-3.5 rounded-xl shadow-lg active:scale-95 transition-all" style="background: @themeColor;">
  188. @Lang.millions_payment
  189. </button>
  190. </div>
  191. </div>
  192. </div>
  193. </div>
  194. }
  195. else
  196. {
  197. <!-- ==================== Basic Pick 10 / Odd-Even GAME UI ==================== -->
  198. <div class="millions-buy-ticket-page main-container animate__animated animate__fadeIn overflow-hidden">
  199. <!-- Header -->
  200. <div class="header">
  201. <button onclick="location.href='@Url.Action("GameHome", "Home")'" class="back-btn" type="button">
  202. <i class="fa-solid fa-arrow-left"></i>
  203. </button>
  204. <div class="header-title">
  205. @if (Model.termType == Constants.PIC10_BASIC_CODE) { <text>Basic Pick 10</text> }
  206. else if (Model.termType == Constants.Millions_CODE) { <text>Millions</text> }
  207. else { @Lang.millions_odd_even }
  208. </div>
  209. </div>
  210. <div class="content-card">
  211. <!-- Sticky Term Info sub-header -->
  212. <div class="ticket-subheader">
  213. <div class="flex items-center justify-between">
  214. <div class="flex items-center gap-2 border border-[#E5E7EB] rounded-lg px-3 py-1.5 bg-gray-50">
  215. <i class="fa-regular fa-calendar text-[#0062FF] text-sm"></i>
  216. <span class="text-[12px] font-bold text-gray-700">@DateTime.Now.ToString("dddd, MMM dd, yyyy", System.Globalization.CultureInfo.InvariantCulture)</span>
  217. </div>
  218. <div class="flex items-center gap-1 ml-4 flex-1 justify-end">
  219. <span class="text-[12px] font-bold text-gray-400">@Lang.millions_round</span>
  220. <span class="text-[18px] font-black text-brown-main">#@(currentTerm?.id ?? "12459")</span>
  221. </div>
  222. </div>
  223. </div>
  224. <!-- Ticket Scrollable List Area -->
  225. <div id="ticketContainer" class="ticket-scroll-area p-4 flex flex-col gap-6 bg-[#F5F5F5] pb-6">
  226. @for (int i = 1; i <= 2; i++)
  227. {
  228. <div class="ticket-card relative group active:bg-gray-50 transition-colors cursor-pointer animate__animated animate__fadeIn">
  229. <button onclick="removeEntry(this)" class="absolute -right-2 top-2 w-7 h-7 bg-[#FF0000] text-white rounded-full flex items-center justify-center text-[11px] shadow-sm z-[10] hover:bg-red-700 transition-all border-2 border-red-600">
  230. <i class="fa-solid fa-xmark"></i>
  231. </button>
  232. <div class="absolute left-2 top-4 w-9 h-9 rounded-full border-[3px] border-white flex items-center justify-center text-white font-black text-sm shadow-md ticket-index">@i</div>
  233. <div class="flex flex-col gap-1 pl-8">
  234. <span class="text-[16px] font-extrabold text-[#333]">@Lang.millions_select_10_lucky_numbers</span>
  235. <div class="flex items-center gap-4">
  236. <div class="grid grid-cols-6 gap-y-2 gap-x-1 flex-1">
  237. @for (int j = 0; j < (Model.termType == Constants.PIC10_BASIC_CODE ? 10 : (Model.termType == Constants.Millions_CODE ? 6 : 15)); j++)
  238. {
  239. <div class="relative w-fit">
  240. <div class="ball-circle ball-empty"></div>
  241. @if (Model.termType == Constants.Millions_CODE && j == 5)
  242. {
  243. <div class="absolute -bottom-1 -right-1 bg-[#FFD700] text-black text-[9px] font-black px-[3px] py-[2px] rounded-[3px] shadow-sm leading-none z-10 border border-[#EAA800]">MB</div>
  244. }
  245. </div>
  246. }
  247. </div>
  248. <div class="w-[90px] action-area flex flex-col gap-2">
  249. <button onclick="randomizeTicket(this)" class="rand-btn w-full bg-[#2B83F2] text-white flex items-center justify-center gap-1.5 py-1.5 rounded-xl font-extrabold text-[11px] shadow-sm active:scale-95 transition-all">
  250. <i class="fa-solid fa-arrows-rotate text-[10px]"></i> @Lang.Random
  251. </button>
  252. <div class="edit-delete-group hidden flex flex-col gap-2">
  253. <button onclick="editFullTicket(this)" class="w-full bg-[#16A34A] text-white flex items-center justify-center gap-1.5 py-1.5 rounded-xl font-black text-[12px] shadow-sm active:scale-95 transition-all">
  254. <img src="/Millions/img/icons/icon_edit.png" onerror="this.style.display='none'" class="w-[16px] h-[16px] object-contain"> @Lang.millions_edit
  255. </button>
  256. <button onclick="clearTicket(this)" class="w-full bg-[#A855F7] text-white flex items-center justify-center gap-1.5 py-1.5 rounded-xl font-black text-[12px] shadow-sm active:scale-95 transition-all">
  257. <img src="/Millions/img/icons/icon_delete.png" onerror="this.style.display='none'" class="w-[16px] h-[16px] object-contain"> @Lang.millions_delete
  258. </button>
  259. </div>
  260. </div>
  261. </div>
  262. </div>
  263. </div>
  264. }
  265. <div class="w-full pt-2" id="addButtonWrapper">
  266. <button onclick="addNewTicket()" class="w-fit min-w-[220px] mx-auto bg-[#2B83F2] text-white font-black text-md py-2.5 px-6 rounded-xl shadow-md border-b-[4px] border-[#1F66D6] active:translate-y-[1px] active:border-b-[1px] transition-all flex items-center justify-center gap-2">
  267. @Lang.millions_add_more_ticket
  268. </button>
  269. </div>
  270. <div class="h-4"></div>
  271. </div>
  272. <!-- Bottom Action Bar -->
  273. <div class="ticket-bottom-bar p-4 bg-white border-t border-gray-200 z-[70] shadow-[0px_-4px_10px_rgba(0,0,0,0.03)]">
  274. <div class="flex items-center justify-between">
  275. <div class="flex flex-col">
  276. <div class="flex items-center gap-1.5 mb-0.5">
  277. <span class="text-[11px] text-black font-black uppercase">@Lang.total_ticket:</span>
  278. <span id="totalTicketCount" class="text-[12px] font-black text-black">0</span>
  279. </div>
  280. <span class="text-[11px] text-black font-black uppercase">@Lang.millions_estimated_ticket_price</span>
  281. <div class="flex items-baseline gap-1">
  282. <span id="totalPrice" class="text-[28px] font-black text-black">0</span>
  283. <span class="text-[13px] font-black text-[#0062FF]">HTG</span>
  284. </div>
  285. </div>
  286. <button onclick="preparePayment()" class="bg-[#0062FF] text-white text-[20px] font-black px-10 py-3.5 rounded-xl shadow-[0px_6px_15px_rgba(238,0,51,0.25)] active:scale-95 transition-all">
  287. @Lang.millions_payment
  288. </button>
  289. </div>
  290. </div>
  291. </div>
  292. </div>
  293. }
  294. <!-- Order Summary Screen (from Figma) -->
  295. <div id="orderSummaryModal" class="hidden fixed inset-0 z-[150] bg-black/60 flex items-center justify-center p-0 font-bricolage backdrop-blur-[2px]">
  296. <div class="w-full h-full bg-white flex flex-col animate__animated animate__fadeInRight animate__faster shadow-2xl relative lg:max-w-[414px]">
  297. <!-- Header đồng bộ tuyệt đối -->
  298. <div class="buy-ticket-modal-header sticky top-0 z-[60]">
  299. <button onclick="hideOrderSummary()" class="back-btn" type="button">
  300. <i class="fa-solid fa-arrow-left"></i>
  301. </button>
  302. <div class="header-title">
  303. @if (Model.termType == Constants.PIC10_BASIC_CODE) { <text>Basic Pick 10</text> }
  304. else if (Model.termType == Constants.Millions_CODE) { <text>Millions</text> }
  305. else if (Model.termType == Constants.PIC10_BIGSMALL_CODE) { @Lang.millions_big_small }
  306. else { @Lang.millions_odd_even }
  307. </div>
  308. </div>
  309. <!-- Content Area: Split into scrollable list and static summary -->
  310. <div class="flex-1 flex flex-col min-h-0 bg-gray-50">
  311. <!-- Scrollable Ticket List -->
  312. <div class="flex-1 overflow-y-auto p-5 pb-2">
  313. <div class="flex justify-between items-center px-1 mb-3">
  314. <span class="text-[14px] font-bold text-gray-800">Selected Tickets</span>
  315. <span class="text-[14px] font-bold text-gray-800">@Lang.price</span>
  316. </div>
  317. <!-- Ticket List -->
  318. <div id="summaryTicketList" class="flex flex-col gap-4">
  319. <!-- Populated dynamically via JS -->
  320. </div>
  321. </div>
  322. <!-- Static Summary Info (Dates & Totals) -->
  323. <div class="shrink-0 bg-white p-5 space-y-4 border-t border-gray-100 shadow-[0px_-10px_20px_rgba(0,0,0,0.03)]">
  324. <!-- Dates Section -->
  325. <div class="grid grid-cols-2 gap-4">
  326. <div class="space-y-1">
  327. <span class="text-[11px] font-black text-[#0062FF] block text-center uppercase tracking-tight">@Lang.date_purchase</span>
  328. <div class="bg-white border border-gray-100 rounded-xl py-2.5 px-2 text-center font-black text-[11px] text-gray-700 shadow-sm">
  329. @DateTime.Now.ToString("dddd MMM dd, yyyy", System.Globalization.CultureInfo.InvariantCulture)
  330. </div>
  331. </div>
  332. <div class="space-y-1">
  333. <span class="text-[11px] font-black text-[#0062FF] block text-center uppercase tracking-tight">@Lang.draw_date</span>
  334. <div class="bg-white border border-gray-100 rounded-xl py-2.5 px-2 text-center font-black text-[11px] text-gray-700 shadow-sm" id="summaryResultDate">
  335. @{
  336. DateTime drawDate;
  337. bool isValidDate = DateTime.TryParse(currentTerm?.date_end, out drawDate);
  338. if (isValidDate) {
  339. @drawDate.ToString("dddd MMM dd, yyyy", System.Globalization.CultureInfo.InvariantCulture)
  340. } else {
  341. @:N/A
  342. }
  343. }
  344. </div>
  345. </div>
  346. </div>
  347. <!-- Totals Section -->
  348. <div class="space-y-1 px-1">
  349. <div class="flex justify-between items-center">
  350. <span class="text-[14px] font-bold text-black">@Lang.total_ticket</span>
  351. <span id="summaryTotalCount" class="text-[16px] font-black text-black">0</span>
  352. </div>
  353. <div class="flex justify-between items-center">
  354. <span class="text-[14px] font-bold text-black">@Lang.total_money</span>
  355. <div class="flex items-baseline gap-1">
  356. <span id="summaryTotalAmount" class="text-[32px] font-black text-black">0</span>
  357. <span class="text-[16px] font-black text-[#0062FF]">HTG</span>
  358. </div>
  359. </div>
  360. </div>
  361. </div>
  362. </div>
  363. <div class="shrink-0 p-4 bg-white border-t border-gray-100 grid grid-cols-2 gap-4 pb-8 shadow-[0px_-4px_20px_rgba(0,0,0,0.05)]">
  364. <button onclick="hideOrderSummary()" class="bg-[#FFB000] text-white py-2.5 rounded-2xl font-black text-[18px] shadow-lg shadow-orange-200 active:scale-95 transition-all uppercase tracking-wide">
  365. @Lang.reorder
  366. </button>
  367. <button id="finalPaymentBtn" onclick="confirmCheckout(this)" class="bg-[#0062FF] text-white py-2.5 rounded-2xl font-black text-[18px] shadow-lg shadow-red-200 active:scale-95 transition-all uppercase tracking-wide">
  368. @Lang.millions_payment
  369. </button>
  370. </div>
  371. </div>
  372. </div>
  373. <!-- OTP Verification Modal (V2 Design Overhaul - Matching Figma) -->
  374. <div id="otpModal" class="fixed inset-0 bg-black/80 backdrop-blur-sm z-[200] hidden items-center justify-center p-4">
  375. <!-- Outer container to hold the modal + external overflowing elements (like stars/glitter) -->
  376. <div class="relative w-full max-w-[360px] mt-6 animate__animated animate__zoomIn animate__faster">
  377. <!-- Glitter effect (external to the white box) -->
  378. <div class="absolute -top-[100px] -left-[10px] w-[380px] h-[160px] mix-blend-screen pointer-events-none z-0 overflow-visible opacity-90" style="background: url('/Millions/img/modal/otp_glitter.png') no-repeat center center; background-size: contain;"></div>
  379. <!-- The White Box -->
  380. <div class="bg-white rounded-[32px] w-full relative z-10 shadow-[0px_0px_30px_rgba(255,255,255,0.15)] pb-5 border border-yellow-500/20">
  381. <!-- Floating Coins from Figma -->
  382. <div class="absolute -top-[40px] -right-[10px] z-[80] w-[120px] pointer-events-none drop-shadow-2xl">
  383. <img src="/Millions/img/modal/otp_coins.png" class="w-full object-contain" />
  384. </div>
  385. <!-- Red Header Section -->
  386. <div class="relative w-full pt-4 pb-4 bg-[#0062FF] rounded-t-[32px] flex flex-col items-center justify-center z-20" style="border-bottom-left-radius: 50% 20px; border-bottom-right-radius: 50% 20px;">
  387. <h2 class="text-white text-[17px] sm:text-[20px] font-[900] uppercase tracking-wide relative z-10 font-bricolage drop-shadow-md text-center px-4 leading-tight w-[80%] mr-auto">@Lang.millions_confirm_purchase</h2>
  388. </div>
  389. <!-- Modal Body Content -->
  390. <div class="relative px-6 pt-3 flex flex-col items-center gap-3 z-10">
  391. <!-- Shield Icon: mix-blend-mode multiply to remove the white square background -->
  392. <div class="relative w-full flex justify-center mb-0 mt-1">
  393. <img src="/Millions/img/modal/otp_shield.png" alt="Success" class="w-[90px] object-contain">
  394. </div>
  395. <!-- Info Rows (Aligned exactly like screenshot) -->
  396. <div class="w-full flex flex-col gap-2 items-center mt-0">
  397. <!-- Ticket Info -->
  398. <div class="grid grid-cols-[90px_auto] items-center gap-3 w-full justify-center">
  399. <span class="text-[15px] font-bold text-[#555] text-right font-bricolage">@Lang.millions_ticket</span>
  400. <div id="otpTicketTypeContainer" class="flex justify-start">
  401. <img id="otpTicketTypeImg" src="/Millions/img/even_text.png" class="h-6 object-contain drop-shadow-sm" />
  402. </div>
  403. </div>
  404. <!-- Amount Info -->
  405. <div class="grid grid-cols-[90px_auto] items-center gap-3 w-full justify-center">
  406. <span class="text-[15px] font-bold text-[#555] text-right font-bricolage">@Lang.millions_amount</span>
  407. <div class="flex items-baseline gap-1.5 justify-start">
  408. <span id="otpTotalAmount" class="text-[22px] font-[900] text-black leading-none tracking-tight">1.000</span>
  409. <span class="text-[15px] font-[900] text-[#F37021] font-bricolage">HTG</span>
  410. </div>
  411. </div>
  412. </div>
  413. <p class="text-[14px] font-bold text-[#555] text-center px-4 leading-snug mt-0 font-bricolage">@Lang.millions_otp_instruction</p>
  414. <!-- 6-Slots OTP Grid (Large Gray Blocks) -->
  415. <div class="flex items-center justify-center gap-2 w-full mt-1 px-2" id="otpInputs">
  416. @for (int i = 1; i <= 6; i++)
  417. {
  418. <input type="tel" maxlength="1" id="otp@(i)"
  419. oninput="moveToNext(this, '@(i < 6 ? "otp" + (i + 1) : "")')"
  420. class="w-[42px] h-[48px] bg-[#757575] rounded-[10px] text-white text-[26px] font-bold text-center appearance-none focus:bg-[#555] focus:scale-[1.03] focus:ring-2 focus:ring-[#0062FF]/50 transition-all outline-none shadow-inner otp-slot"
  421. placeholder="-">
  422. }
  423. </div>
  424. <!-- OTP Error Message -->
  425. <p id="otpError" class="text-[#0062FF] font-bold text-[14px] text-center mb-1 hidden animate__animated animate__shakeX"></p>
  426. <!-- Timer & Resend -->
  427. <div class="flex flex-col items-center gap-1 mt-0">
  428. <span id="otpTimer" class="text-[15px] font-black text-[#0062FF] font-bricolage">60s</span>
  429. <button id="resendOtpBtn" onclick="sendOtpRequest()" class="hidden text-[14px] font-black text-[#0A9800] underline decoration-solid underline-offset-[3px] transition-all hover:text-[#087a00] disabled:opacity-40 disabled:no-underline font-bricolage">@Lang.millions_request_new_otp</button>
  430. </div>
  431. <!-- Action Buttons: Cancel / Confirm -->
  432. <div class="grid grid-cols-2 gap-3 w-full mt-2">
  433. <button onclick="hideOtpModal()" class="bg-[#FF0000] text-white py-[12px] rounded-[16px] font-[900] text-[17px] shadow-[0_8px_15px_rgba(255,0,0,0.2)] active:scale-95 transition-all tracking-wide">@Lang.millions_cancel</button>
  434. <button id="otpConfirmBtn" disabled onclick="finalizePurchase(this)" class="bg-[#0A9800] text-white py-[12px] rounded-[16px] font-[900] text-[17px] shadow-[0_8px_15px_rgba(10,152,0,0.2)] active:scale-95 transition-all tracking-wide disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed">@Lang.millions_confirm</button>
  435. </div>
  436. </div>
  437. </div>
  438. </div>
  439. </div>
  440. @section Scripts {
  441. <script>
  442. const maxBalls = @(Model.termType == Constants.PIC10_BASIC_CODE ? 10 : (Model.termType == Constants.Millions_CODE ? 6 : (Model.termType == Constants.PIC10_BIGSMALL_CODE ? 13 : 15)));
  443. function reindexTickets() {
  444. $(".ticket-card").each(function(index) {
  445. $(this).find(".ticket-index").text(index + 1);
  446. });
  447. }
  448. function removeEntry(btn) {
  449. var card = $(btn).closest('.ticket-card');
  450. card.addClass('animate__animated animate__fadeOutRight animate__faster');
  451. setTimeout(function() {
  452. card.remove();
  453. reindexTickets();
  454. updateTotalPrice();
  455. }, 300);
  456. }
  457. function randomizeTicket(btn) {
  458. var icon = $(btn).find('i');
  459. icon.addClass('fa-spin');
  460. var card = $(btn).closest('.ticket-card');
  461. var balls = card.find('.ball-circle');
  462. // Generate unique random numbers 1-80
  463. var numbers = [];
  464. while(numbers.length < maxBalls){
  465. var r = Math.floor(Math.random() * 80) + 1;
  466. if(numbers.indexOf(r) === -1) numbers.push(r);
  467. }
  468. numbers.sort((a, b) => a - b);
  469. // Update balls with staggered animation
  470. balls.each(function(index) {
  471. var ball = $(this);
  472. setTimeout(function() {
  473. var formattedNum = numbers[index].toString().padStart(2, '0');
  474. ball.removeClass('ball-empty').addClass('ball-filled').text(formattedNum);
  475. ball.addClass('animate__animated animate__flipInY');
  476. if(index === maxBalls - 1) {
  477. setTimeout(() => {
  478. icon.removeClass('fa-spin');
  479. // Replace button with Edit/Delete group
  480. $(btn).hide();
  481. card.find('.edit-delete-group').removeClass('hidden').addClass('animate__animated animate__fadeInRight animate__faster');
  482. updateTotalPrice();
  483. }, 300);
  484. }
  485. }, index * 40);
  486. });
  487. }
  488. function clearTicket(btn) {
  489. var card = $(btn).closest('.ticket-card');
  490. var balls = card.find('.ball-circle');
  491. balls.removeClass('ball-filled animate__animated animate__flipInY shadow-inner').addClass('ball-empty').text('');
  492. // Hide Edit/Delete group and show Rand button
  493. card.find('.edit-delete-group').addClass('hidden');
  494. card.find('.rand-btn').show().addClass('animate__animated animate__fadeInLeft animate__faster');
  495. updateTotalPrice();
  496. }
  497. // Open Number Picker Modal
  498. var activeBall = null;
  499. var activeTicketCard = null;
  500. var selectedNumbers = []; // For Edit mode, this will be an array of fixed size with nulls
  501. var isMultiMode = false;
  502. function editFullTicket(btn) {
  503. isMultiMode = true;
  504. activeTicketCard = $(btn).closest('.ticket-card');
  505. activeBall = null;
  506. // Initialize fixed slots for slot-based editing
  507. selectedNumbers = new Array(maxBalls).fill(null);
  508. let existing = [];
  509. activeTicketCard.find('.ball-filled').each(function() {
  510. var num = $(this).text().trim();
  511. if(num) existing.push(num);
  512. });
  513. // Initial fill from left to right
  514. existing.forEach((num, idx) => {
  515. if(idx < maxBalls) selectedNumbers[idx] = num;
  516. });
  517. openNumberPicker(true);
  518. }
  519. function openNumberPicker(isMulti) {
  520. var modal = $("#numberPickerModal");
  521. var grid = $("#numberGrid");
  522. var title = $("#modalTitle");
  523. var countArea = $(".selection-count-area");
  524. var confirmBtn = $("#confirmBtn");
  525. grid.empty();
  526. if (isMulti) {
  527. title.text("Edit Ticket");
  528. countArea.removeClass('hidden');
  529. confirmBtn.removeClass('hidden').text("@Lang.confirm");
  530. } else {
  531. title.text("Pick Number");
  532. countArea.addClass('hidden');
  533. confirmBtn.removeClass('hidden').text("@Lang.confirm");
  534. // Single mode logic is handled by setting selectedNumbers previously or here
  535. }
  536. updateSelectionCount();
  537. liveUpdateTicket();
  538. // Focus card
  539. if (activeTicketCard && activeTicketCard.length) {
  540. var container = $("#ticketContainer");
  541. var scrollPos = activeTicketCard.offset().top - container.offset().top + container.scrollTop();
  542. container.stop().animate({ scrollTop: scrollPos - 15 }, 500);
  543. }
  544. // Populate Grid
  545. for (var i = 1; i <= 80; i++) {
  546. var formatted = i.toString().padStart(2, '0');
  547. var isSelected = selectedNumbers.includes(formatted);
  548. var btnClass = isSelected
  549. ? 'bg-[#0062FF] text-white shadow-md scale-105 active-num'
  550. : 'bg-white text-gray-700 hover:bg-gray-100 border border-gray-100';
  551. grid.append(`<button type="button" class="num-btn w-8 h-8 rounded-full font-black text-[11px] transition-all focus:outline-none flex items-center justify-center ${btnClass}">${formatted}</button>`);
  552. }
  553. // Cleanup old listeners and add new one to the grid (event delegation)
  554. grid.off('click', '.num-btn').on('click', '.num-btn', function(e) {
  555. e.preventDefault();
  556. var $btn = $(this);
  557. var picked = $btn.text().trim();
  558. if (isMultiMode) {
  559. if (selectedNumbers.includes(picked)) {
  560. // Remove
  561. let idx = selectedNumbers.indexOf(picked);
  562. if (idx !== -1) selectedNumbers[idx] = null;
  563. $btn.removeClass('bg-[#0062FF] text-white shadow-md scale-105 active-num').addClass('bg-white text-gray-700 border border-gray-100');
  564. } else {
  565. // Add
  566. let firstEmpty = selectedNumbers.indexOf(null);
  567. if (firstEmpty !== -1) {
  568. selectedNumbers[firstEmpty] = picked;
  569. $btn.addClass('bg-[#0062FF] text-white shadow-md scale-105 active-num').removeClass('bg-white text-gray-700 border border-gray-100');
  570. }
  571. }
  572. liveUpdateTicket();
  573. } else {
  574. // Single Select mode
  575. var exists = false;
  576. if (activeTicketCard) {
  577. activeTicketCard.find('.ball-filled').each(function() {
  578. if (activeBall && this !== activeBall[0] && $(this).text().trim() === picked) {
  579. exists = true;
  580. }
  581. });
  582. }
  583. if (exists) {
  584. if (typeof showNotification === "function") {
  585. showNotification("Number already selected", "warning");
  586. }
  587. return;
  588. }
  589. grid.find('.num-btn').removeClass('bg-[#0062FF] text-white shadow-md scale-105 active-num').addClass('bg-white text-gray-700 border border-gray-100');
  590. selectedNumbers = [picked];
  591. $btn.addClass('bg-[#0062FF] text-white shadow-md scale-105 active-num').removeClass('bg-white text-gray-700 border border-gray-100');
  592. }
  593. updateSelectionCount();
  594. });
  595. modal.removeClass('hidden').addClass('flex');
  596. modal.find('.modal-content').removeClass('animate__zoomOut').addClass('animate__zoomIn');
  597. }
  598. function updateSelectionCount() {
  599. var count = selectedNumbers.filter(n => n !== null && n !== "").length;
  600. $("#selectionCount").text(count);
  601. $("#maxSelectionCount").text(maxBalls);
  602. var isValid = isMultiMode ? (count === maxBalls) : (count === 1);
  603. if (isValid) {
  604. $("#confirmBtn").prop('disabled', false).removeClass('opacity-50 cursor-not-allowed').addClass('cursor-pointer');
  605. } else {
  606. $("#confirmBtn").prop('disabled', true).addClass('opacity-50 cursor-not-allowed').removeClass('cursor-pointer');
  607. }
  608. }
  609. function liveUpdateTicket() {
  610. if (!activeTicketCard) return;
  611. var balls = activeTicketCard.find('.ball-circle');
  612. if (isMultiMode) {
  613. // Update Ticket Card balls
  614. for(var i=0; i < maxBalls; i++){
  615. var val = selectedNumbers[i];
  616. if (i < balls.length) {
  617. var tBall = $(balls[i]);
  618. if (val) {
  619. tBall.removeClass('ball-empty').addClass('ball-filled').text(val);
  620. } else {
  621. tBall.removeClass('ball-filled').addClass('ball-empty').text('');
  622. }
  623. }
  624. }
  625. // Toggle Rand/Edit button visibility
  626. if (selectedNumbers.filter(n => n !== null && n !== "").length > 0) {
  627. activeTicketCard.find('.rand-btn').hide();
  628. activeTicketCard.find('.edit-delete-group').removeClass('hidden').show();
  629. } else {
  630. activeTicketCard.find('.rand-btn').show();
  631. activeTicketCard.find('.edit-delete-group').addClass('hidden');
  632. }
  633. updateTotalPrice();
  634. }
  635. }
  636. // All immediate jQuery event bindings must wait for DOM + jQuery to be ready
  637. document.addEventListener("DOMContentLoaded", function() {
  638. // Click on a ball (filled or empty) to edit the full ticket
  639. $(document).on('click', '.ball-filled, .ball-empty', function() {
  640. editFullTicket(this);
  641. });
  642. updateTotalPrice();
  643. // Confirm button handler
  644. $(document).off('click', '#confirmBtn').on('click', '#confirmBtn', function(e) {
  645. e.preventDefault();
  646. // Check non-null count
  647. var count = selectedNumbers.filter(n => n !== null && n !== "").length;
  648. if (count === 0) return;
  649. if (isMultiMode && activeTicketCard && activeTicketCard.length > 0) {
  650. // Collect and sort for final storage/display (lottery numbers are usually sorted)
  651. var finalSorted = selectedNumbers.filter(n => n !== null && n !== "").sort((a, b) => parseInt(a) - parseInt(b));
  652. var balls = activeTicketCard.find('.ball-circle');
  653. balls.removeClass('ball-filled').addClass('ball-empty').text('');
  654. finalSorted.forEach((num, index) => {
  655. if (index < balls.length) {
  656. $(balls[index]).removeClass('ball-empty').addClass('ball-filled').text(num);
  657. $(balls[index]).addClass('animate__animated animate__pulse');
  658. setTimeout(() => $(balls[index]).removeClass('animate__animated animate__pulse'), 500);
  659. }
  660. });
  661. activeTicketCard.find('.rand-btn').hide();
  662. activeTicketCard.find('.edit-delete-group').removeClass('hidden').show();
  663. updateTotalPrice();
  664. } else if (!isMultiMode && activeBall && activeBall.length > 0) {
  665. // Single mode: Update only the active ball
  666. activeBall.text(selectedNumbers[0]).removeClass('ball-empty').addClass('ball-filled');
  667. activeBall.addClass('animate__animated animate__pulse');
  668. setTimeout(() => activeBall.removeClass('animate__animated animate__pulse'), 500);
  669. var card = activeBall.closest('.ticket-card');
  670. var filledBalls = card.find('.ball-filled').length;
  671. if (filledBalls > 0) {
  672. card.find('.rand-btn').hide();
  673. card.find('.edit-delete-group').removeClass('hidden').show();
  674. } else {
  675. card.find('.rand-btn').show();
  676. card.find('.edit-delete-group').addClass('hidden');
  677. }
  678. updateTotalPrice();
  679. }
  680. closeNumberPicker();
  681. });
  682. });
  683. function closeNumberPicker() {
  684. var modal = $("#numberPickerModal");
  685. modal.find('.modal-content').removeClass('animate__zoomIn').addClass('animate__zoomOut');
  686. setTimeout(() => {
  687. modal.removeClass('flex').addClass('hidden');
  688. // Reset state
  689. activeBall = null;
  690. activeTicketCard = null;
  691. }, 200);
  692. }
  693. function updateTotalPrice() {
  694. var filledTickets = 0;
  695. $(".ticket-card").each(function() {
  696. if ($(this).find(".ball-filled").length === maxBalls) {
  697. filledTickets++;
  698. }
  699. });
  700. const pricePerTicket = @(Model.termType == Constants.PIC10_BASIC_CODE ? "10" : (Model.termType == Constants.Millions_CODE ? "20" : "50"));
  701. $("#totalPrice").text(formatMoneyV2(filledTickets * pricePerTicket));
  702. $("#totalTicketCount").text(filledTickets);
  703. }
  704. function addNewTicket() {
  705. var container = $("#ticketContainer");
  706. var wrapper = $("#addButtonWrapper");
  707. var currentIndex = $(".ticket-card").length + 1;
  708. var ballsHtml = '';
  709. var isMillions = @(Model.termType == Constants.Millions_CODE ? "true" : "false");
  710. for (var i = 0; i < maxBalls; i++) {
  711. var mbIndicator = (isMillions && i === 5) ? '<div class="absolute -bottom-1 -right-1 bg-[#FFD700] text-black text-[9px] font-black px-[3px] py-[2px] rounded-[3px] shadow-sm leading-none z-10 border border-[#EAA800]">MB</div>' : '';
  712. ballsHtml += '<div class="relative w-fit"><div class="ball-circle ball-empty"></div>' + mbIndicator + '</div>';
  713. }
  714. var ticketHtml = `
  715. <div class="ticket-card relative group active:bg-gray-50 transition-colors cursor-pointer animate__animated animate__fadeInUp animate__faster">
  716. <button onclick="removeEntry(this)" class="absolute -right-2 top-1 w-7 h-7 bg-[#FF0000] text-white rounded-full flex items-center justify-center text-[11px] shadow-sm z-[10] hover:bg-red-700 transition-all border-2 border-red-600">
  717. <i class="fa-solid fa-xmark"></i>
  718. </button>
  719. <div class="absolute left-2 top-4 w-9 h-9 rounded-full border-[3px] border-white flex items-center justify-center text-white font-black text-sm shadow-md ticket-index">${currentIndex}</div>
  720. <div class="flex flex-col gap-1 pl-8">
  721. <span class="text-[16px] font-extrabold text-[#333]">@Lang.millions_select_10_lucky_numbers</span>
  722. <div class="flex items-center gap-4">
  723. <div class="grid grid-cols-6 gap-y-2 gap-x-1 flex-1">
  724. ${ballsHtml}
  725. </div>
  726. <div class="w-[90px] action-area flex flex-col gap-2">
  727. <button onclick="randomizeTicket(this)" class="rand-btn w-full bg-[#2B83F2] text-white flex items-center justify-center gap-1.5 py-1.5 rounded-xl font-extrabold text-[11px] shadow-sm active:scale-95 transition-all">
  728. <i class="fa-solid fa-arrows-rotate text-[10px]"></i> @Lang.Random
  729. </button>
  730. <div class="edit-delete-group hidden flex flex-col gap-2">
  731. <button onclick="editFullTicket(this)" class="w-full bg-[#16A34A] text-white flex items-center justify-center gap-1.5 py-1.5 rounded-xl font-black text-[12px] shadow-sm active:scale-95 transition-all">
  732. <img src="/Millions/img/icons/icon_edit.png" onerror="this.style.display='none'" class="w-[16px] h-[16px] object-contain"> @Lang.millions_edit
  733. </button>
  734. <button onclick="clearTicket(this)" class="w-full bg-[#A855F7] text-white flex items-center justify-center gap-1.5 py-1.5 rounded-xl font-black text-[12px] shadow-sm active:scale-95 transition-all">
  735. <img src="/Millions/img/icons/icon_delete.png" onerror="this.style.display='none'" class="w-[16px] h-[16px] object-contain"> @Lang.millions_delete
  736. </button>
  737. </div>
  738. </div>
  739. </div>
  740. </div>
  741. </div>
  742. `;
  743. $(ticketHtml).insertBefore(wrapper);
  744. container.animate({ scrollTop: container.prop("scrollHeight") }, 300);
  745. }
  746. // --- Order Summary Modal Logic ---
  747. // --- Payment Preparation & Order Summary Logic ---
  748. function preparePayment(event) {
  749. const isBSMode = @(Model.termType == Constants.PIC10_BIGSMALL_CODE || Model.termType == Constants.PIC10_ODDEVEN_CODE ? "true" : "false");
  750. const tickets = [];
  751. if (isBSMode) {
  752. if (!bsChoice) {
  753. showNotification("Please select a choice first.", "warning");
  754. return;
  755. }
  756. let bsCode = "";
  757. if ('@Model.termType' === '@Constants.PIC10_BIGSMALL_CODE') {
  758. bsCode = (bsChoice === 'big') ? "B" : "S";
  759. } else {
  760. bsCode = (bsChoice === 'big') ? "O" : "E"; // Odd = O, Even = E
  761. }
  762. tickets.push({
  763. code: bsCode,
  764. money: "50"
  765. });
  766. } else {
  767. $(".ticket-card").each(function() {
  768. const balls = $(this).find(".ball-filled");
  769. if (balls.length === maxBalls) {
  770. const selectedNumbers = [];
  771. balls.each(function() { selectedNumbers.push($(this).text().trim()); });
  772. const itemPrice = "@(Model.termType == Constants.PIC10_BASIC_CODE ? "10" : (Model.termType == Constants.Millions_CODE ? "20" : "50"))";
  773. tickets.push({
  774. code: selectedNumbers.join(','),
  775. money: itemPrice
  776. });
  777. }
  778. });
  779. if (tickets.length === 0) {
  780. showNotification("@Lang.millions_ticket_not_valid", "warning");
  781. return;
  782. }
  783. }
  784. const requestData = {
  785. gameId: "@Model.termType",
  786. ticket: tickets
  787. };
  788. const btn = event ? event.currentTarget : null;
  789. const originalText = btn ? btn.innerHTML : "@Lang.millions_payment";
  790. if (btn) {
  791. btn.innerHTML = '<i class="fa-solid fa-circle-notch fa-spin"></i> Loading...';
  792. btn.disabled = true;
  793. }
  794. $.ajax({
  795. url: subDomain + '@Url.Action("ConfirmTicketData", "Home")',
  796. type: 'POST',
  797. contentType: 'application/json',
  798. data: JSON.stringify(requestData),
  799. success: function(data) {
  800. if (btn) {
  801. btn.innerHTML = originalText;
  802. btn.disabled = false;
  803. }
  804. if (data.responseCode === "0") {
  805. showOrderSummary(data, tickets);
  806. } else {
  807. showNotification(data.responseMessage || "Confirmation failed", data.responseCode);
  808. }
  809. },
  810. error: function(err) {
  811. if (btn) {
  812. btn.innerHTML = originalText;
  813. btn.disabled = false;
  814. }
  815. showNotification("Network error occurred.", "warning");
  816. }
  817. });
  818. }
  819. let currentTransId = null;
  820. function showOrderSummary(apiData, localTickets) {
  821. currentTransId = apiData.transId;
  822. const summaryModal = $("#orderSummaryModal");
  823. const summaryList = $("#summaryTicketList");
  824. summaryList.empty();
  825. const displayTickets = (apiData && apiData.ticket) ? apiData.ticket : (localTickets || []);
  826. if (!displayTickets || !Array.isArray(displayTickets)) {
  827. console.warn("No tickets found to display in summary.");
  828. return;
  829. }
  830. displayTickets.forEach((t, index) => {
  831. const numbers = t.code.split(',');
  832. let contentHtml = '';
  833. if (numbers.length > 1) {
  834. let numbersBalls = '';
  835. numbers.forEach(n => {
  836. numbersBalls += `<div class="w-7 h-7 rounded-full flex items-center justify-center text-white text-[11px] font-black shadow-[0_4px_10px_rgba(186,15,33,0.3)]" style="background: linear-gradient(135deg, #FF3D63 0%, #E3132D 60%, #BA0F21 100%); border: 1px solid rgba(255, 255, 255, 0.3); text-shadow: 0px 1px 2px rgba(0,0,0,0.1); transition: transform 0.2s;">${n.trim()}</div>`;
  837. });
  838. contentHtml = `<div class="grid grid-cols-5 gap-y-2 relative z-10 px-2 justify-items-center">${numbersBalls}</div>`;
  839. } else {
  840. const isBS = @(Model.termType == Constants.PIC10_BIGSMALL_CODE ? "true" : "false");
  841. const isFirstChoice = (numbers[0] === 'B' || numbers[0] === 'O');
  842. const label = isFirstChoice ? (isBS ? "Big" : "Odd") : (isBS ? "Small" : "Even");
  843. const color = isFirstChoice ? (isBS ? "#A2FF00" : "#FFC700") : (isBS ? "#FF4157" : "#B33BD0");
  844. contentHtml = `<div class="w-full flex justify-center"><span class="text-[28px] font-black italic uppercase" style="-webkit-text-stroke: 1px #000; color: ${color};">${label}</span></div>`;
  845. }
  846. const itemHtml = `
  847. <div class="flex items-center gap-3">
  848. <div class="flex-1 rounded-2xl p-3 relative overflow-hidden flex flex-col gap-2 min-h-[80px] justify-center shadow-sm"
  849. style="background: white; border: 1.5px solid #0062FF;">
  850. ${contentHtml}
  851. </div>
  852. <div class="w-24 shrink-0 bg-white border border-gray-200 rounded-2xl p-2.5 flex items-center justify-center shadow-sm">
  853. <div class="flex items-baseline gap-0.5">
  854. <span class="text-[20px] font-black text-black">${formatMoneyV2(t.money)}</span>
  855. <span class="text-[12px] font-black text-[#0062FF]">HTG</span>
  856. </div>
  857. </div>
  858. </div>
  859. `;
  860. summaryList.append(itemHtml);
  861. });
  862. $("#summaryTotalCount").text(displayTickets.length);
  863. const totalMoney = apiData.totalMoneyPayment || apiData.totalMoney || "0";
  864. $("#summaryTotalAmount").text(formatMoneyV2(totalMoney));
  865. summaryModal.removeClass("hidden").addClass("flex");
  866. }
  867. function hideOrderSummary() {
  868. $("#orderSummaryModal").removeClass("flex").addClass("hidden");
  869. }
  870. function confirmCheckout(btn) {
  871. const originalText = $(btn).html();
  872. $(btn).prop('disabled', true).html('<i class="fa-solid fa-spinner fa-spin mr-2"></i>Processing...');
  873. // Trigger SendOTP API
  874. $.ajax({
  875. url: subDomain + '@Url.Action("SendOTP", "Home")',
  876. type: 'POST',
  877. success: function(data) {
  878. $(btn).prop('disabled', false).html(originalText);
  879. if (data.responseCode === "0") {
  880. showOtpModal();
  881. } else {
  882. showNotification(data.responseMessage || "Failed to send OTP", data.responseCode);
  883. }
  884. },
  885. error: function() {
  886. $(btn).prop('disabled', false).html(originalText);
  887. showNotification("Network error occurred.", "warning");
  888. }
  889. });
  890. }
  891. let otpInterval;
  892. function showOtpModal() {
  893. hideOrderSummary();
  894. $("#otpModal").removeClass("hidden").addClass("flex");
  895. $("#otpInputs input").val("");
  896. $("#otpConfirmBtn").prop('disabled', true);
  897. $("#otpError").addClass("hidden").text("");
  898. $("#otp1").focus();
  899. // Map game type to readable name & image
  900. let gameTypeStr = "@Model.termType";
  901. let displayName = gameTypeStr === "@Constants.Millions_CODE" ? "@Lang.millions" : "Basic Pick 10";
  902. let imgSrc = "";
  903. if (gameTypeStr === "@Constants.PIC10_BIGSMALL_CODE") {
  904. // Get the specific choice from summary
  905. let firstTicketText = $("#summaryTicketList").find("span.font-black").first().text().trim();
  906. if (firstTicketText) {
  907. displayName = firstTicketText.charAt(0).toUpperCase() + firstTicketText.slice(1).toLowerCase(); // Normalize to "Big" or "Small"
  908. } else {
  909. displayName = "Big / Small";
  910. }
  911. } else if (gameTypeStr === "@Constants.PIC10_ODDEVEN_CODE") {
  912. let firstTicketText = $("#summaryTicketList").find("span.font-black").first().text().trim();
  913. if (firstTicketText) {
  914. displayName = firstTicketText.charAt(0).toUpperCase() + firstTicketText.slice(1).toLowerCase(); // Normalize to "Odd" or "Even"
  915. } else {
  916. displayName = "Odd / Even";
  917. }
  918. }
  919. // Determine color based on game type
  920. let typeColorClass = "text-purple-700"; // default
  921. if (gameTypeStr === "@Constants.PIC10_BASIC_CODE") typeColorClass = "text-[#0062FF]";
  922. else if (gameTypeStr === "@Constants.Millions_CODE") typeColorClass = "text-[#0062FF]";
  923. else if (gameTypeStr === "@Constants.PIC10_BIGSMALL_CODE") typeColorClass = "text-[#0A9800]";
  924. else if (gameTypeStr === "@Constants.PIC10_ODDEVEN_CODE") typeColorClass = "text-[#9333ea]";
  925. // Hide image for now and use the beautiful text style as requested
  926. $("#otpTicketTypeImg").hide();
  927. $("#otpTicketTypeContainer").find("span").remove();
  928. $("#otpTicketTypeContainer").append(`<span class='text-[17px] font-[900] ${typeColorClass} italic'>${displayName}</span>`);
  929. $("#otpTotalAmount").text($("#summaryTotalAmount").text());
  930. startOtpTimer(60);
  931. }
  932. // Add backspace support for OTP inputs
  933. $("#otpInputs input").on("keyup", function() {
  934. let otp = "";
  935. $("#otpInputs input").each(function() { otp += $(this).val(); });
  936. $("#otpConfirmBtn").prop('disabled', otp.length < 6);
  937. });
  938. $("#otpInputs input").on("keydown", function(e) {
  939. if (e.key === "Backspace" && this.value.length === 0) {
  940. $(this).prev('input').focus();
  941. }
  942. });
  943. function hideOtpModal() {
  944. $("#otpModal").removeClass("flex").addClass("hidden");
  945. clearInterval(otpInterval);
  946. }
  947. function startOtpTimer(seconds) {
  948. let timeLeft = seconds;
  949. $("#resendOtpBtn").addClass("hidden");
  950. $("#otpTimer").removeClass("hidden").text(timeLeft + "s");
  951. clearInterval(otpInterval);
  952. otpInterval = setInterval(() => {
  953. timeLeft--;
  954. $("#otpTimer").text(timeLeft + "s");
  955. if (timeLeft <= 0) {
  956. clearInterval(otpInterval);
  957. $("#otpTimer").addClass("hidden");
  958. $("#resendOtpBtn").removeClass("hidden");
  959. }
  960. }, 1000);
  961. }
  962. function moveToNext(el, nextId) {
  963. if (el.value.length >= 1) {
  964. if (nextId) document.getElementById(nextId).focus();
  965. }
  966. let otp = "";
  967. $("#otpInputs input").each(function() { otp += $(this).val(); });
  968. $("#otpConfirmBtn").prop('disabled', otp.length < 6);
  969. // Clear error when typing
  970. $("#otpError").addClass("hidden").text("");
  971. }
  972. function sendOtpRequest() {
  973. // Re-trigger SendOTP
  974. $.ajax({
  975. url: subDomain + '@Url.Action("SendOTP", "Home")',
  976. type: 'POST',
  977. success: function(data) {
  978. if (data.responseCode === "0") {
  979. startOtpTimer(60);
  980. showNotification("OTP has been resent.", "success");
  981. } else {
  982. showNotification(data.responseMessage || "Failed to resend OTP", data.responseCode);
  983. }
  984. }
  985. });
  986. }
  987. function showReceiptSuccess(transId, amount, phone, totalTickets, drawDate) {
  988. // Setup data dynamically
  989. $("#receiptAmount").text(formatMoneyV2(amount) + " HTG");
  990. if(phone) $("#receiptPhone").text(phone);
  991. if(totalTickets) $("#receiptTotalTickets").text(totalTickets);
  992. if(drawDate) $("#receiptDrawDate").text(drawDate);
  993. let gameTypeStr = "@Model.termType";
  994. let displayName = "Basic Pick 10";
  995. if (gameTypeStr === "@Constants.PIC10_BIGSMALL_CODE") displayName = "@Lang.millions_big_small";
  996. else if (gameTypeStr === "@Constants.PIC10_ODDEVEN_CODE") displayName = "@Lang.millions_odd_even";
  997. else if (gameTypeStr === "@Constants.Millions_CODE") displayName = "Millions";
  998. $("#receiptGameType").text("@Lang.buy " + displayName);
  999. $("#receiptTicketCode").text("#" + transId);
  1000. let choiceText = "-";
  1001. if (gameTypeStr === "@Constants.PIC10_BIGSMALL_CODE" || gameTypeStr === "@Constants.PIC10_ODDEVEN_CODE") {
  1002. choiceText = $("#summaryTicketList .flex.items-center span.font-black").first().text().trim();
  1003. } else {
  1004. choiceText = gameTypeStr === "@Constants.Millions_CODE" ? "Millions 6" : "PICK 10";
  1005. }
  1006. $("#receiptChoice").text(choiceText);
  1007. // Format current date "dd/MM/yyyy - HH:mm:ss"
  1008. let now = new Date();
  1009. let ds = now.getDate().toString().padStart(2, '0') + '/' + (now.getMonth() + 1).toString().padStart(2, '0') + '/' + now.getFullYear() + ' - ' + now.getHours().toString().padStart(2, '0') + ':' + now.getMinutes().toString().padStart(2, '0') + ':' + now.getSeconds().toString().padStart(2, '0');
  1010. $("#receiptTime").text(ds);
  1011. hideOtpModal();
  1012. $("#receiptSuccessModal").removeClass("hidden").addClass("flex");
  1013. }
  1014. function finalizePurchase(btn) {
  1015. let otpCode = "";
  1016. $("#otpInputs input").each(function() {
  1017. otpCode += $(this).val();
  1018. });
  1019. if (otpCode.length < 6) {
  1020. showNotification("Please enter full 6-digit OTP", "warning");
  1021. return;
  1022. }
  1023. const originalText = $(btn).html();
  1024. $(btn).prop('disabled', true).html('<i class="fa-solid fa-spinner fa-spin mr-2"></i> ...');
  1025. const finalData = {
  1026. transIdByTicket: currentTransId,
  1027. paymentCode: otpCode
  1028. };
  1029. // Call the unified backend action that verifies OTP and then buys the ticket
  1030. $.ajax({
  1031. url: subDomain + '@Url.Action("ConfirmBuyingTicketV2", "Home")',
  1032. type: 'POST',
  1033. contentType: 'application/json',
  1034. data: JSON.stringify(finalData),
  1035. success: function(res) {
  1036. $(btn).prop('disabled', false).html(originalText);
  1037. if (res.responseCode === "0" || res.responseCode === "0000") {
  1038. // Success: Show receipt Modal
  1039. showReceiptSuccess(res.orderId || currentTransId, $("#summaryTotalAmount").text(), "@(Model.userStatus?.msisdn ?? "-")", $("#summaryTotalCount").text(), "@(currentTerm?.date_random ?? "-")");
  1040. } else {
  1041. if (res.responseCode === "-2" || (res.responseMessage && res.responseMessage.includes("System is upgrading"))) {
  1042. hideOtpModal();
  1043. showNotification(res.responseMessage || "System is upgrading", res.responseCode);
  1044. } else {
  1045. $("#otpError").text(res.responseMessage || "Invalid OTP").removeClass("hidden");
  1046. $("#otpInputs input").val("");
  1047. $("#otp1").focus();
  1048. }
  1049. }
  1050. },
  1051. error: function() {
  1052. $(btn).prop('disabled', false).html(originalText);
  1053. showNotification("Network error occurred during payment completion.", "warning");
  1054. }
  1055. });
  1056. }
  1057. var systemUpgrading = false;
  1058. function showNotification(message, code) {
  1059. const msgEl = $("#notificationMessage");
  1060. const iconEl = $("#notificationModal img");
  1061. const btnEl = $("#notificationModal button");
  1062. msgEl.text(message);
  1063. if (code === "-2" || (message && message.includes("System is upgrading"))) {
  1064. systemUpgrading = true;
  1065. btnEl.text("@Lang.login");
  1066. } else {
  1067. systemUpgrading = false;
  1068. btnEl.text("OK");
  1069. }
  1070. // Toggle icon based on type (warning or success)
  1071. const warningIcon = '/Millions/img/modal/warning_icon.png';
  1072. const successIcon = '/Millions/img/modal/success_icon_v2.png';
  1073. const fallbackWarning = 'https://cdn-icons-png.flaticon.com/512/564/564619.png';
  1074. const fallbackSuccess = 'https://cdn-icons-png.flaticon.com/512/190/190411.png';
  1075. if (code === "-2" || code === "warning" || code === "error") {
  1076. iconEl.attr('src', warningIcon);
  1077. iconEl.attr('onerror', `this.src='${fallbackWarning}'`);
  1078. } else {
  1079. iconEl.attr('src', successIcon);
  1080. iconEl.attr('onerror', `this.src='${fallbackSuccess}'`);
  1081. }
  1082. $("#notificationModal").removeClass("hidden").addClass("flex");
  1083. }
  1084. function closeNotificationModal() {
  1085. $("#notificationModal").addClass("hidden").removeClass("flex");
  1086. if (systemUpgrading) {
  1087. window.location.href = subDomain + "/Account/Login";
  1088. }
  1089. }
  1090. // ==================== CARD SELECTION GAME LOGIC (BIG/SMALL / ODD/EVEN) ====================
  1091. var bsChoice = null; // 'big' or 'small' (reused as 'odd' or 'even')
  1092. const isBigSmall = @(Model.termType == Constants.PIC10_BIGSMALL_CODE ? "true" : "false");
  1093. const themeColor = isBigSmall ? "#0A9800" : "#AA3DC8";
  1094. const labelBig = isBigSmall ? "Big" : "Odd";
  1095. const labelSmall = isBigSmall ? "Small" : "Even";
  1096. const colorBig = isBigSmall ? "#A2FF00" : "#FFC700";
  1097. const colorSmall = isBigSmall ? "#FF4157" : "#B33BD0";
  1098. // Loclized text from resources
  1099. const langSelect = "@Lang.millions_select";
  1100. const langSelected = "@Lang.millions_selected";
  1101. function selectBigSmall(choice) {
  1102. bsChoice = choice;
  1103. var cardBig = document.getElementById('cardBig');
  1104. var cardSmall = document.getElementById('cardSmall');
  1105. var choiceDisplay = document.getElementById('choiceDisplay');
  1106. if (!cardBig || !cardSmall) return;
  1107. if (choice === 'big') {
  1108. // Highlight Big/Odd card with theme glow
  1109. cardBig.style.border = '2px solid ' + themeColor;
  1110. cardBig.style.boxShadow = '0px 0px 12px 0px ' + (isBigSmall ? 'rgba(162, 255, 0, 1)' : 'rgba(179, 59, 208, 0.6)');
  1111. cardBig.querySelector('.bigsmall-btn').textContent = langSelected;
  1112. cardBig.querySelector('.bigsmall-btn').style.background = '#333';
  1113. // Reset Small/Even card
  1114. cardSmall.style.border = '2px solid transparent';
  1115. cardSmall.style.boxShadow = 'none';
  1116. cardSmall.querySelector('.bigsmall-btn').textContent = langSelect;
  1117. cardSmall.querySelector('.bigsmall-btn').style.background = themeColor;
  1118. // Update display
  1119. if (choiceDisplay) {
  1120. choiceDisplay.textContent = labelBig;
  1121. choiceDisplay.style.color = colorBig;
  1122. choiceDisplay.style.webkitTextStroke = '1px #000';
  1123. }
  1124. } else {
  1125. // Highlight Small/Even card with theme glow
  1126. cardSmall.style.border = '2px solid ' + themeColor;
  1127. cardSmall.style.boxShadow = '0px 0px 12px 0px ' + (isBigSmall ? 'rgba(162, 255, 0, 1)' : 'rgba(179, 59, 208, 0.6)');
  1128. cardSmall.querySelector('.bigsmall-btn').textContent = langSelected;
  1129. cardSmall.querySelector('.bigsmall-btn').style.background = '#333';
  1130. // Reset Big/Odd card
  1131. cardBig.style.border = '2px solid transparent';
  1132. cardBig.style.boxShadow = 'none';
  1133. cardBig.querySelector('.bigsmall-btn').textContent = langSelect;
  1134. cardBig.querySelector('.bigsmall-btn').style.background = themeColor;
  1135. // Update display
  1136. if (choiceDisplay) {
  1137. choiceDisplay.textContent = labelSmall;
  1138. choiceDisplay.style.color = colorSmall;
  1139. choiceDisplay.style.webkitTextStroke = '1px #000';
  1140. }
  1141. }
  1142. $("#bsTotalTicketCount").text(1);
  1143. $("#bsTotalPrice").text(formatMoneyV2(50));
  1144. }
  1145. function bsShowPayment(e) {
  1146. preparePayment(e);
  1147. }
  1148. </script>
  1149. <!-- Number Picker Modal (Refined Bottom Sheet) -->
  1150. <div id="numberPickerModal" class="fixed inset-0 bg-black/10 z-[200] hidden items-end justify-center p-0 transition-all">
  1151. <div class="modal-content bg-white w-full md:max-w-[414px] mx-auto shadow-2xl animate__animated animate__slideInUp animate__faster rounded-t-[20px] overflow-hidden">
  1152. <div class="px-4 py-3 bg-[#0062FF] text-white flex justify-between items-center relative">
  1153. <div class="flex flex-col">
  1154. <h3 class="font-black text-[15px] uppercase tracking-wide" id="modalTitle">@Lang.Pick_Number</h3>
  1155. <div class="selection-count-area">
  1156. <span class="text-[10px] font-bold text-white/80 uppercase">Selected: <span id="selectionCount" class="text-white">0</span>/<span id="maxSelectionCount">10</span></span>
  1157. </div>
  1158. </div>
  1159. <button onclick="closeNumberPicker()" class="w-9 h-9 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20 transition-all">
  1160. <i class="fa-solid fa-xmark text-lg"></i>
  1161. </button>
  1162. </div>
  1163. <style>
  1164. #numberGrid::-webkit-scrollbar { width: 3px; }
  1165. #numberGrid::-webkit-scrollbar-track { background: transparent; }
  1166. #numberGrid::-webkit-scrollbar-thumb { background: #FFD700; border-radius: 10px; }
  1167. #numberGrid { scrollbar-width: thin; scrollbar-color: #FFD700 transparent; }
  1168. </style>
  1169. <div class="p-1 px-2 grid grid-cols-10 gap-1.5 h-[160px] overflow-y-auto bg-gray-50 border-b" id="numberGrid">
  1170. <!-- 1-80 populated via JS -->
  1171. </div>
  1172. <div class="p-3 bg-white border-t flex gap-3">
  1173. <button onclick="closeNumberPicker()" class="flex-1 py-1 bg-gray-100 text-gray-600 rounded-lg font-black text-[12px] active:bg-gray-200 transition-all uppercase">
  1174. @Lang.millions_back
  1175. </button>
  1176. <button id="confirmBtn" class="hidden flex-[2] py-2 bg-[#0062FF] text-white rounded-lg font-black text-[13px] active:bg-[#CC002D] transition-all uppercase shadow-md">
  1177. @Lang.confirm
  1178. </button>
  1179. </div>
  1180. </div>
  1181. </div>
  1182. <div id="notificationModal" class="fixed inset-0 z-[300] bg-black/60 flex items-center justify-center hidden px-4 font-bricolage backdrop-blur-sm">
  1183. <div class="w-full max-w-[360px] bg-white rounded-[32px] overflow-hidden flex flex-col items-center px-6 pt-5 pb-6 animate__animated animate__zoomIn animate__faster shadow-2xl relative border border-white/50">
  1184. <!-- Alert Icon -->
  1185. <div class="w-full flex justify-center mb-2 mt-0">
  1186. <img src="/Millions/img/modal/success_icon_v2.png" class="w-full max-w-[240px] h-auto object-contain" alt="Notificaton icon" onerror="this.src='https://cdn-icons-png.flaticon.com/512/190/190411.png'" />
  1187. </div>
  1188. <!-- Message Area -->
  1189. <div class="px-2 text-center mb-5">
  1190. <p id="notificationMessage" class="text-black font-[800] text-[17px] leading-snug">
  1191. <!-- Message content -->
  1192. </p>
  1193. </div>
  1194. <!-- Action Button -->
  1195. <div class="w-full">
  1196. <button onclick="closeNotificationModal()" class="w-full bg-[#0062FF] text-white font-[900] text-[18px] py-[13px] rounded-[18px] shadow-[0_8px_20px_rgba(238,0,51,0.25)] active:scale-95 transition-all uppercase tracking-wide">
  1197. OK
  1198. </button>
  1199. </div>
  1200. </div>
  1201. </div>
  1202. <!-- Beautiful Success Receipt Modal (Matches Figma 161:3722) -->
  1203. <div id="receiptSuccessModal" class="fixed inset-0 z-[300] bg-black/80 hidden items-center justify-center px-4 font-bricolage backdrop-blur-md">
  1204. <div class="w-full max-w-[360px] bg-[#F9F9F9] rounded-[32px] overflow-hidden flex flex-col items-center px-6 pt-4 pb-5 shadow-2xl relative animate__animated animate__zoomIn animate__faster border border-white/50">
  1205. <!-- Confetti/Celebration background effect (Subtle removed) -->
  1206. <h2 class="text-[#534A4A] font-[800] text-[19px] tracking-tight relative z-10 w-full text-center mt-1">@Lang.millions_payment_successfully</h2>
  1207. <!-- Ticket / Success Graphic -->
  1208. <div class="relative w-full flex justify-center mt-2 mb-0 z-10 px-4">
  1209. <img src="/Millions/img/modal/success_icon_v2.png" alt="Success" class="w-full h-auto object-contain">
  1210. </div>
  1211. <h3 class="text-[#0A9800] font-[900] text-[20px] uppercase tracking-wide relative z-10">@Lang.success</h3>
  1212. <div class="w-full h-px border-t-[2px] border-dashed border-gray-300 my-3 relative z-10"></div>
  1213. <div class="w-full flex justify-between items-center mb-2 relative z-10 px-1">
  1214. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.phone_number</span>
  1215. <span class="font-black text-[14px] text-gray-800" id="receiptPhone">-</span>
  1216. </div>
  1217. <div class="w-full flex justify-between items-center mb-2 relative z-10 px-1">
  1218. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.millions_your_choice</span>
  1219. <span class="text-[#0062FF] font-[900] text-[15px] uppercase" id="receiptChoice">-</span>
  1220. </div>
  1221. <div class="w-full flex justify-between items-center mb-2 relative z-10 px-1">
  1222. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.ticket_code</span>
  1223. <span class="font-black text-[13px] text-gray-800" id="receiptTicketCode">#</span>
  1224. </div>
  1225. <div class="w-full flex justify-between items-center mb-2 relative z-10 px-1">
  1226. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.total_ticket</span>
  1227. <span class="font-black text-[14px] text-gray-800" id="receiptTotalTickets">-</span>
  1228. </div>
  1229. <div class="w-full flex justify-between items-center mb-2 relative z-10 px-1">
  1230. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.millions_draw_date</span>
  1231. <span class="font-black text-[14px] text-gray-800" id="receiptDrawDate">-</span>
  1232. </div>
  1233. <div class="w-full flex justify-between items-center mb-1 relative z-10 px-1">
  1234. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.total_payment</span>
  1235. <span class="text-[#0062FF] font-[900] text-[15px]" id="receiptAmount">0 HTG</span>
  1236. </div>
  1237. <div class="w-full h-px border-t-[2px] border-dashed border-gray-300 my-3 relative z-10"></div>
  1238. <div class="w-full flex justify-between items-center mb-2 relative z-10 px-1">
  1239. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.time</span>
  1240. <span class="font-bold text-[13px] text-gray-600" id="receiptTime">00:00:00</span>
  1241. </div>
  1242. <div class="w-full flex justify-start items-center relative z-10 px-1 mt-1">
  1243. <span class="text-[#534A4A] font-bold text-[13px] italic text-gray-500" id="receiptGameType">@Lang.millions_buy_ticket_label</span>
  1244. </div>
  1245. <div class="text-[#534A4A] font-[900] text-[18px] relative z-10 text-center mt-3">@Lang.thank_you <span class="text-[#0062FF]">♥️</span></div>
  1246. <div class="w-full flex gap-2.5 mt-4 relative z-10">
  1247. <button type="button" onclick="window.location.href = subDomain + '@Url.Action("BuyTicket", "Home", new { termType = Model.termType })';" class="flex-1 min-w-0 border-2 border-[#0062FF] bg-white text-[#0062FF] font-[900] text-[15px] py-3 rounded-[18px] active:scale-95 transition-all uppercase tracking-wide shadow-sm">
  1248. @Lang.millions_continue
  1249. </button>
  1250. <button type="button" onclick="window.location.href = subDomain + '@Url.Action("GameHome", "Home", new { termType = Model.termType })';" class="flex-1 min-w-0 bg-[#0062FF] text-white font-[900] text-[15px] py-3 rounded-[18px] shadow-[0_8px_20px_rgba(0,98,255,0.25)] active:scale-95 transition-all uppercase tracking-wide">
  1251. @Lang.close
  1252. </button>
  1253. </div>
  1254. </div>
  1255. </div>
  1256. }