BuyTicket.cshtml 99 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744
  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. @using Microsoft.AspNetCore.Http;
  10. @{
  11. var isFreeTicketMode = Context.Request.Query["freeTicketMode"] == "1"
  12. && Model.termType == Constants.Millions_CODE;
  13. var freeTicketPromotionCode = isFreeTicketMode
  14. ? Context.Session.GetString("Millions.FreeTicket.PromotionCode")
  15. : null;
  16. var hasFreeTicketPromotion = isFreeTicketMode
  17. && !string.IsNullOrWhiteSpace(freeTicketPromotionCode);
  18. }
  19. @section Styles {
  20. <link rel="stylesheet" href="/Millions/css/buy-ticket.css" asp-append-version="true" />
  21. <style>
  22. /* BuyTicket has its own bottom bar; avoid global navbar padding gap */
  23. body.millions-bg { padding-bottom: 0 !important; }
  24. body.millions-bg .main-container { padding-bottom: 0 !important; }
  25. </style>
  26. }
  27. @if (Model.termType == Constants.PIC10_BIGSMALL_CODE || Model.termType == Constants.PIC10_ODDEVEN_CODE)
  28. {
  29. var isBigSmall = Model.termType == Constants.PIC10_BIGSMALL_CODE;
  30. var themeColor = isBigSmall ? "#0A9800" : "#AA3DC8";
  31. var gameTitle = isBigSmall ? Lang.millions_big_small : Lang.millions_odd_even;
  32. var prizeAmount = isBigSmall ? "100.000" : "200.000";
  33. <!-- ==================== CARD SELECTION GAME UI (BIG/SMALL or ODD/EVEN) ==================== -->
  34. <div class="millions-buy-ticket-page main-container animate__animated animate__fadeIn overflow-hidden">
  35. <!-- Header -->
  36. <div class="header">
  37. <button onclick="location.href='@Url.Action("GameHome", "Home")'" class="back-btn" type="button">
  38. <i class="fa-solid fa-arrow-left"></i>
  39. </button>
  40. <div class="header-title">@gameTitle</div>
  41. </div>
  42. <div class="content-card">
  43. <!-- Sticky Term Info sub-header -->
  44. <div class="ticket-subheader">
  45. <div class="flex items-center justify-between">
  46. <div class="flex items-center gap-2 border border-[#E5E7EB] rounded-lg px-3 py-1.5 bg-gray-50">
  47. <i class="fa-regular fa-calendar text-[[@themeColor]] text-sm" style="color: @themeColor"></i>
  48. <span class="text-[12px] font-bold text-gray-700">@DateTime.Now.ToString("dddd, MMM dd, yyyy", new System.Globalization.CultureInfo("en-US"))</span>
  49. </div>
  50. <div class="flex items-center gap-1 ml-4 flex-1 justify-end">
  51. <span class="text-[12px] font-bold text-gray-400">@Lang.millions_round</span>
  52. <span class="text-[18px] font-black text-brown-main">#@(currentTerm?.id ?? "123")</span>
  53. </div>
  54. </div>
  55. </div>
  56. <!-- Scrollable Content Area -->
  57. <div class="ticket-scroll-area bg-white pb-40" id="bsContent">
  58. <!-- Results for the last 5 days -->
  59. <div class="px-5 pt-4 pb-2">
  60. <h3 class="text-[17px] font-bold text-black text-center mb-3">Results for the last 5 days</h3>
  61. <div id="last5Results" class="flex justify-between gap-1.5 px-1">
  62. @{
  63. var pastTerms = ViewBag.PastTerms as List<LotteryWebApp.Service.Term> ?? new List<LotteryWebApp.Service.Term>();
  64. foreach (var term in pastTerms) {
  65. var rawResult = (term.result ?? "").Trim().ToUpper();
  66. var dateStr = "--";
  67. DateTime dt;
  68. if (DateTime.TryParse(term.date_random, out dt)) {
  69. dateStr = dt.ToString("MMM dd", new System.Globalization.CultureInfo("en-US"));
  70. }
  71. var resKey = rawResult;
  72. var resTitle = rawResult;
  73. if (isBigSmall) {
  74. if (rawResult == "S") { resKey = "Small"; resTitle = Lang.Small; }
  75. else if (rawResult == "B") { resKey = "Big"; resTitle = Lang.Big; }
  76. } else {
  77. if (rawResult == "O") { resKey = "Odd"; resTitle = Lang.Odd; }
  78. else if (rawResult == "E") { resKey = "Even"; resTitle = Lang.Even; }
  79. }
  80. var resColor = "";
  81. var bgStyle = "background: linear-gradient(136deg, #FFFAE6 0%, #FFE588 100%);";
  82. var textStyle = "-webkit-text-stroke: 0.5px #000;";
  83. if (resKey == "NA" || string.IsNullOrEmpty(rawResult)) {
  84. bgStyle = "background: #EAEAEA;";
  85. resTitle = "";
  86. textStyle = "";
  87. } else {
  88. if (isBigSmall) {
  89. resColor = resKey == "Big" ? "#A2FF00" : "#FF4157";
  90. } else {
  91. resColor = resKey == "Odd" ? "#FFC700" : "#B33BD0";
  92. }
  93. textStyle += $" color: {resColor};";
  94. }
  95. <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">
  96. <span class="text-[11px] font-bold text-black whitespace-nowrap opacity-70">@dateStr</span>
  97. <span class="text-[22px] font-black leading-tight" style="@textStyle">@resTitle</span>
  98. </div>
  99. }
  100. for(int r = pastTerms.Count; r < 5; r++) {
  101. <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;">
  102. <span class="text-[11px] font-bold text-black whitespace-nowrap opacity-70">--</span>
  103. <span class="text-[22px] font-black leading-tight" style="color: transparent;"></span>
  104. </div>
  105. }
  106. }
  107. </div>
  108. </div>
  109. <!-- Selection Cards -->
  110. <!-- Selection Cards -->
  111. <div class="px-5 pt-4 flex gap-3 h-[245px]">
  112. <!-- Card 1 (Big or Odd) -->
  113. <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%);">
  114. <img src="/Millions/img/bigsmall/light_effect_1.png" class="absolute top-0 left-0 w-full opacity-60 pointer-events-none" alt="" />
  115. <img src="/Millions/img/bigsmall/light_effect_2.png" class="absolute bottom-12 left-0 w-full opacity-60 pointer-events-none" alt="" />
  116. <div class="flex flex-col items-center pt-4 pb-3 px-3 relative z-10 h-full justify-between">
  117. <div class="flex flex-col items-center w-full">
  118. <div class="h-[34px] flex items-center justify-center">
  119. <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>
  120. </div>
  121. <div class="text-[11px] font-medium text-gray-500 mt-1 h-[28px] text-center leading-tight">
  122. @(isBigSmall ? "13 number from" : "Odd numbers") <br/> <b>@(isBigSmall ? "41-80" : "1, 3, 5, 7, 9")</b>
  123. </div>
  124. </div>
  125. <div class="flex items-center justify-center -space-x-2 my-2">
  126. @if (isBigSmall) {
  127. <img src="/Millions/img/bigsmall/ball_42_dark.png" class="w-12 h-12 relative z-[1]" alt="42" />
  128. <img src="/Millions/img/bigsmall/ball_88_big.png" class="w-16 h-16 relative z-[2]" alt="88" />
  129. <img src="/Millions/img/bigsmall/ball_54_dark.png" class="w-12 h-12 relative z-[1]" alt="54" />
  130. } else {
  131. <img src="/Millions/img/oddeven/ball_3.png" class="w-12 h-12 relative z-[1]" alt="3" />
  132. <img src="/Millions/img/oddeven/ball_1.png" class="w-16 h-16 relative z-[2]" alt="1" />
  133. <img src="/Millions/img/oddeven/ball_19.png" class="w-12 h-12 relative z-[1]" alt="19" />
  134. }
  135. </div>
  136. <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>
  137. </div>
  138. </div>
  139. <!-- Card 2 (Small or Even) -->
  140. <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%);">
  141. <img src="/Millions/img/bigsmall/light_effect_1.png" class="absolute top-0 left-0 w-full opacity-60 pointer-events-none" alt="" />
  142. <img src="/Millions/img/bigsmall/light_effect_2.png" class="absolute bottom-12 left-0 w-full opacity-60 pointer-events-none" alt="" />
  143. <div class="flex flex-col items-center pt-4 pb-3 px-3 relative z-10 h-full justify-between">
  144. <div class="flex flex-col items-center w-full">
  145. <div class="h-[34px] flex items-center justify-center">
  146. <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>
  147. </div>
  148. <div class="text-[11px] font-medium text-gray-500 mt-1 h-[28px] text-center leading-tight">
  149. @(isBigSmall ? "13 number from" : "Even numbers") <br/> <b>@(isBigSmall ? "01-40" : "0, 2, 4, 6, 8")</b>
  150. </div>
  151. </div>
  152. <div class="flex items-center justify-center -space-x-2 my-2">
  153. @if (isBigSmall) {
  154. <img src="/Millions/img/bigsmall/ball_5_blue.png" class="w-12 h-12 relative z-[1]" alt="5" />
  155. <img src="/Millions/img/bigsmall/ball_1_big.png" class="w-16 h-16 relative z-[2]" alt="1" />
  156. <img src="/Millions/img/bigsmall/ball_8_pink.png" class="w-12 h-12 relative z-[1]" alt="8" />
  157. } else {
  158. <img src="/Millions/img/oddeven/ball_66.png" class="w-12 h-12 relative z-[1]" alt="66" />
  159. <img src="/Millions/img/oddeven/ball_68.png" class="w-16 h-16 relative z-[2]" alt="68" />
  160. <img src="/Millions/img/oddeven/ball_88.png" class="w-12 h-12 relative z-[1]" alt="88" />
  161. }
  162. </div>
  163. <button class="bigsmall-btn w-full py-2.5 rounded-xl font-black text-[15px] transition-all shadow-md"
  164. style="background: @themeColor; color: white;">@Lang.millions_select</button>
  165. </div>
  166. </div>
  167. </div>
  168. <!-- You Choose + Prize Section -->
  169. <div class="px-5 pt-6 flex flex-col items-center gap-4">
  170. <div class="flex flex-col items-center">
  171. <span class="text-[15px] font-medium text-black">@Lang.millions_you_choose</span>
  172. <span id="choiceDisplay" class="text-[42px] font-[800] leading-tight" style="-webkit-text-stroke: 1px #000;">—</span>
  173. </div>
  174. <div class="flex flex-col items-center">
  175. <span class="text-[18px] font-medium text-black">@Lang.millions_prize_if_win</span>
  176. <div class="flex items-baseline gap-1">
  177. <span class="text-[28px] font-black text-black">@prizeAmount</span>
  178. <span class="text-[14px] font-black text-[#E56B23]">HTG</span>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. <!-- Bottom Action Bar -->
  184. <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">
  185. <div class="flex items-center justify-between">
  186. <div class="flex flex-col">
  187. <div class="flex items-center gap-1.5 mb-0.5">
  188. <span class="text-[11px] text-black font-black uppercase">@Lang.total_ticket:</span>
  189. <span id="bsTotalTicketCount" class="text-[12px] font-black text-black">0</span>
  190. </div>
  191. <span class="text-[11px] text-black font-black uppercase">@Lang.millions_estimated_ticket_price</span>
  192. <div class="flex items-baseline gap-1">
  193. <span id="bsTotalPrice" class="text-[28px] font-black text-black">0</span>
  194. <span class="text-[13px] font-black" style="color: @themeColor">HTG</span>
  195. </div>
  196. </div>
  197. <button type="button" id="bsPaymentBtn" onpointerdown="armPaymentClick(event)" onkeydown="armPaymentKey(event)" onclick="bsShowPayment(event)" class="text-white text-[20px] font-black px-10 py-3.5 rounded-xl shadow-lg active:scale-95 transition-all" style="background: @themeColor;">
  198. @Lang.millions_payment
  199. </button>
  200. </div>
  201. </div>
  202. </div>
  203. </div>
  204. }
  205. else
  206. {
  207. <!-- ==================== Basic Pick 10 / Odd-Even GAME UI ==================== -->
  208. <div class="millions-buy-ticket-page main-container animate__animated animate__fadeIn overflow-hidden">
  209. <!-- Header -->
  210. <div class="header">
  211. <button onclick="location.href='@Url.Action("GameHome", "Home")'" class="back-btn" type="button">
  212. <i class="fa-solid fa-arrow-left"></i>
  213. </button>
  214. <div class="header-title">
  215. @if (Model.termType == Constants.PIC10_BASIC_CODE) { <text>Basic Pick 10</text> }
  216. else if (Model.termType == Constants.Millions_CODE) { <text>Millions</text> }
  217. else { @Lang.millions_odd_even }
  218. </div>
  219. </div>
  220. <div class="content-card">
  221. <!-- Sticky Term Info sub-header -->
  222. <div class="ticket-subheader">
  223. <div class="flex items-center justify-between">
  224. <div class="flex items-center gap-2 border border-[#E5E7EB] rounded-lg px-3 py-1.5 bg-gray-50">
  225. <i class="fa-regular fa-calendar text-[#0062FF] text-sm"></i>
  226. <span class="text-[12px] font-bold text-gray-700">@DateTime.Now.ToString("dddd, MMM dd, yyyy", new System.Globalization.CultureInfo("en-US"))</span>
  227. </div>
  228. <div class="flex items-center gap-1 ml-4 flex-1 justify-end">
  229. <span class="text-[12px] font-bold text-gray-400">@Lang.millions_round</span>
  230. <span class="text-[18px] font-black text-brown-main">#@(currentTerm?.id ?? "12459")</span>
  231. </div>
  232. </div>
  233. </div>
  234. <!-- Ticket Scrollable List Area -->
  235. <div id="ticketContainer" class="ticket-scroll-area p-4 flex flex-col gap-6 bg-[#F5F5F5] pb-6">
  236. @for (int i = 1; i <= (isFreeTicketMode ? 1 : 2); i++)
  237. {
  238. <div class="ticket-card relative group active:bg-gray-50 transition-colors cursor-pointer animate__animated animate__fadeIn">
  239. @if (!isFreeTicketMode)
  240. {
  241. <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">
  242. <i class="fa-solid fa-xmark"></i>
  243. </button>
  244. }
  245. <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>
  246. <div class="flex flex-col gap-1 pl-8">
  247. <span class="text-[16px] font-extrabold text-[#333]">@Lang.millions_select_10_lucky_numbers</span>
  248. <div class="flex items-center gap-4">
  249. <div class="grid grid-cols-6 gap-y-2 gap-x-1 flex-1">
  250. @for (int j = 0; j < (Model.termType == Constants.PIC10_BASIC_CODE ? 10 : (Model.termType == Constants.Millions_CODE ? 6 : 15)); j++)
  251. {
  252. var isMbBall = Model.termType == Constants.Millions_CODE && j == 5;
  253. <div class="relative w-fit">
  254. <div class="ball-circle ball-empty@(isMbBall ? " ball-mb-circle" : "")"></div>
  255. @if (isMbBall)
  256. {
  257. <div class="absolute -bottom-[6px] -right-[4px] bg-[#FFD700] text-black text-[8.5px] font-black px-[2.5px] py-[1.5px] rounded-[3px] shadow-sm leading-none z-10 border border-[#EAA800]">MB</div>
  258. }
  259. </div>
  260. }
  261. </div>
  262. <div class="w-[90px] action-area flex flex-col gap-2">
  263. <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">
  264. <i class="fa-solid fa-arrows-rotate text-[10px]"></i> @Lang.Random
  265. </button>
  266. <div class="edit-delete-group hidden flex flex-col gap-2">
  267. <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">
  268. <img src="/Millions/img/icons/icon_edit.png" onerror="this.style.display='none'" class="w-[16px] h-[16px] object-contain"> @Lang.millions_edit
  269. </button>
  270. <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">
  271. <img src="/Millions/img/icons/icon_delete.png" onerror="this.style.display='none'" class="w-[16px] h-[16px] object-contain"> @Lang.millions_delete
  272. </button>
  273. </div>
  274. </div>
  275. </div>
  276. </div>
  277. </div>
  278. }
  279. @if (!isFreeTicketMode)
  280. {
  281. <div class="w-full pt-2" id="addButtonWrapper">
  282. <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">
  283. @Lang.millions_add_more_ticket
  284. </button>
  285. </div>
  286. }
  287. <div class="h-4"></div>
  288. </div>
  289. <!-- Bottom Action Bar -->
  290. <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)]">
  291. <div class="flex items-center justify-between">
  292. <div class="flex flex-col">
  293. <div class="flex items-center gap-1.5 mb-0.5">
  294. <span class="text-[11px] text-black font-black uppercase">@Lang.total_ticket:</span>
  295. <span id="totalTicketCount" class="text-[12px] font-black text-black">0</span>
  296. </div>
  297. <span class="text-[11px] text-black font-black uppercase">@Lang.millions_estimated_ticket_price</span>
  298. <div class="flex items-baseline gap-1">
  299. <span id="totalPrice" class="text-[28px] font-black text-black">0</span>
  300. <span class="text-[13px] font-black text-[#0062FF]">HTG</span>
  301. </div>
  302. </div>
  303. <button type="button" onpointerdown="armPaymentClick(event)" onkeydown="armPaymentKey(event)" onclick="preparePayment(event)" 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">
  304. @Lang.millions_payment
  305. </button>
  306. </div>
  307. </div>
  308. </div>
  309. </div>
  310. }
  311. <!-- Payment channel selection -->
  312. <div id="paymentChannelModal" class="hidden fixed inset-0 z-[140] bg-black/70 backdrop-blur-[3px] items-center justify-center p-4 font-bricolage">
  313. <div class="relative w-full max-w-[370px] overflow-hidden rounded-[32px] bg-[#F8F9FC] shadow-[0_28px_70px_rgba(0,0,0,0.35)] animate__animated animate__zoomIn animate__faster">
  314. <div class="relative overflow-hidden bg-gradient-to-br from-[#0062FF] to-[#003FA8] px-6 pb-7 pt-6 text-white">
  315. <div class="absolute -right-8 -top-10 h-32 w-32 rounded-full bg-white/10"></div><div class="absolute -bottom-12 -left-8 h-28 w-28 rounded-full bg-black/10"></div>
  316. <button type="button" onclick="hidePaymentChannelModal()" class="absolute right-4 top-4 z-10 flex h-9 w-9 items-center justify-center rounded-full bg-white/15 text-white transition hover:bg-white/25 active:scale-90" aria-label="Close"><i class="fa-solid fa-xmark"></i></button>
  317. <div class="relative z-[1] flex items-center gap-4"><div class="flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl bg-white text-[25px] text-[#0062FF] shadow-lg"><i class="fa-solid fa-wallet"></i></div><div><h2 class="text-[21px] font-black leading-tight">@Lang.payment_method_title</h2><p class="mt-1 text-[13px] font-semibold text-white/80">@Lang.payment_method_subtitle</p></div></div>
  318. </div>
  319. <div class="space-y-3 p-5">
  320. <button type="button" onclick="selectPaymentChannel('@Constants.BASIC_WALLET_TICKET')" class="group flex w-full items-center gap-4 rounded-[20px] border-2 border-transparent bg-white p-4 text-left shadow-[0_5px_18px_rgba(31,41,55,0.07)] transition hover:-translate-y-0.5 hover:border-[#0062FF] active:scale-[0.98]">
  321. <span class="flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl bg-[#E7F0FF] text-[21px] text-[#0062FF]"><i class="fa-solid fa-mobile-screen-button"></i></span><span class="min-w-0 flex-1"><span class="block text-[16px] font-black text-[#171A24]">@Lang.payment_main_account</span><span class="mt-0.5 block text-[12px] font-semibold text-gray-500">@Lang.payment_main_account_desc</span></span><span class="flex h-8 w-8 items-center justify-center rounded-full bg-gray-100 text-gray-400 transition group-hover:bg-[#0062FF] group-hover:text-white"><i class="fa-solid fa-chevron-right text-[12px]"></i></span>
  322. </button>
  323. <!--
  324. <button type="button" onclick="selectPaymentChannel('@Constants.NATCASH_WALLET_TICKET')" class="group flex w-full items-center gap-4 rounded-[20px] border-2 border-transparent bg-white p-4 text-left shadow-[0_5px_18px_rgba(31,41,55,0.07)] transition hover:-translate-y-0.5 hover:border-[#0A9800] active:scale-[0.98]">
  325. <span class="flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl bg-[#E7F8E6] text-[21px] text-[#0A9800]"><i class="fa-solid fa-wallet"></i></span><span class="min-w-0 flex-1"><span class="flex items-center gap-2 text-[16px] font-black text-[#171A24]">@Lang.payment_wallet <span class="rounded-full bg-[#E7F8E6] px-2 py-0.5 text-[9px] font-black text-[#0A9800]">PIN</span></span><span class="mt-0.5 block text-[12px] font-semibold text-gray-500">@Lang.payment_wallet_desc</span></span><span class="flex h-8 w-8 items-center justify-center rounded-full bg-gray-100 text-gray-400 transition group-hover:bg-[#0A9800] group-hover:text-white"><i class="fa-solid fa-chevron-right text-[12px]"></i></span>
  326. </button>
  327. -->
  328. <p class="pt-1 text-center text-[11px] font-semibold text-gray-400"><i class="fa-solid fa-shield-halved mr-1 text-[#0A9800]"></i>@Lang.payment_security_message</p>
  329. </div>
  330. </div>
  331. </div>
  332. <!-- Order Summary Screen (from Figma) -->
  333. <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]">
  334. <div class="w-full h-full bg-white flex flex-col animate__animated animate__fadeInRight animate__faster shadow-2xl relative lg:max-w-[414px]">
  335. <!-- Header đồng bộ tuyệt đối -->
  336. <div class="buy-ticket-modal-header sticky top-0 z-[60]">
  337. <button onclick="hideOrderSummary()" class="back-btn" type="button">
  338. <i class="fa-solid fa-arrow-left"></i>
  339. </button>
  340. <div class="header-title">
  341. @if (Model.termType == Constants.PIC10_BASIC_CODE) { <text>Basic Pick 10</text> }
  342. else if (Model.termType == Constants.Millions_CODE) { <text>Millions</text> }
  343. else if (Model.termType == Constants.PIC10_BIGSMALL_CODE) { @Lang.millions_big_small }
  344. else { @Lang.millions_odd_even }
  345. </div>
  346. </div>
  347. <!-- Content Area: Split into scrollable list and static summary -->
  348. <div class="flex-1 flex flex-col min-h-0 bg-gray-50">
  349. <!-- Scrollable Ticket List -->
  350. <div class="flex-1 overflow-y-auto p-5 pb-2">
  351. <div class="flex justify-between items-center px-1 mb-3">
  352. <span class="text-[14px] font-bold text-gray-800">Selected Tickets</span>
  353. <span class="text-[14px] font-bold text-gray-800">@Lang.price</span>
  354. </div>
  355. <!-- Ticket List -->
  356. <div id="summaryTicketList" class="flex flex-col gap-4">
  357. <!-- Populated dynamically via JS -->
  358. </div>
  359. </div>
  360. <!-- Static Summary Info (Dates & Totals) -->
  361. <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)]">
  362. <!-- Dates Section -->
  363. <div class="grid grid-cols-2 gap-4">
  364. <div class="space-y-1">
  365. <span class="text-[11px] font-black text-[#0062FF] block text-center uppercase tracking-tight">@Lang.date_purchase</span>
  366. <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">
  367. @DateTime.Now.ToString("dddd MMM dd, yyyy", new System.Globalization.CultureInfo("en-US"))
  368. </div>
  369. </div>
  370. <div class="space-y-1">
  371. <span class="text-[11px] font-black text-[#0062FF] block text-center uppercase tracking-tight">@Lang.draw_date</span>
  372. <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">
  373. @{
  374. DateTime drawDate;
  375. bool isValidDate = DateTime.TryParse(currentTerm?.date_end, out drawDate);
  376. if (isValidDate) {
  377. @drawDate.ToString("dddd MMM dd, yyyy", new System.Globalization.CultureInfo("en-US"))
  378. } else {
  379. @:N/A
  380. }
  381. }
  382. </div>
  383. </div>
  384. </div>
  385. <!-- Totals Section -->
  386. <div class="space-y-1 px-1">
  387. <div class="flex justify-between items-center">
  388. <span class="text-[14px] font-bold text-black">@Lang.total_ticket</span>
  389. <span id="summaryTotalCount" class="text-[16px] font-black text-black">0</span>
  390. </div>
  391. <div class="flex justify-between items-center">
  392. <span class="text-[14px] font-bold text-black">@Lang.total_money</span>
  393. <div class="flex items-baseline gap-1">
  394. <span id="summaryTotalAmount" class="text-[32px] font-black text-black">0</span>
  395. <span class="text-[16px] font-black text-[#0062FF]">HTG</span>
  396. </div>
  397. </div>
  398. </div>
  399. </div>
  400. </div>
  401. <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)]">
  402. <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">
  403. @Lang.reorder
  404. </button>
  405. <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">
  406. @Lang.millions_payment
  407. </button>
  408. </div>
  409. </div>
  410. </div>
  411. <!-- OTP Verification Modal (V2 Design Overhaul - Matching Figma) -->
  412. <div id="otpModal" class="fixed inset-0 bg-black/80 backdrop-blur-sm z-[200] hidden items-center justify-center p-4">
  413. <!-- Outer container to hold the modal + external overflowing elements (like stars/glitter) -->
  414. <div class="relative w-full max-w-[360px] mt-6 animate__animated animate__zoomIn animate__faster">
  415. <!-- Glitter effect (external to the white box) -->
  416. <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>
  417. <!-- The White Box -->
  418. <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">
  419. <!-- Floating Coins from Figma -->
  420. <div class="absolute -top-[40px] -right-[10px] z-[80] w-[120px] pointer-events-none drop-shadow-2xl">
  421. <img src="/Millions/img/modal/otp_coins.png" class="w-full object-contain" />
  422. </div>
  423. <!-- Red Header Section -->
  424. <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;">
  425. <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>
  426. </div>
  427. <!-- Modal Body Content -->
  428. <div class="relative px-6 pt-3 flex flex-col items-center gap-3 z-10">
  429. <!-- Shield Icon: mix-blend-mode multiply to remove the white square background -->
  430. <div class="relative w-full flex justify-center mb-0 mt-1">
  431. <img src="/Millions/img/modal/otp_shield.png" alt="Success" class="w-[90px] object-contain">
  432. </div>
  433. <!-- Info Rows (Aligned exactly like screenshot) -->
  434. <div class="w-full flex flex-col gap-2 items-center mt-0">
  435. <!-- Ticket Info -->
  436. <div class="grid grid-cols-[90px_auto] items-center gap-3 w-full justify-center">
  437. <span class="text-[15px] font-bold text-[#555] text-right font-bricolage">@Lang.millions_ticket</span>
  438. <div id="otpTicketTypeContainer" class="flex justify-start">
  439. <img id="otpTicketTypeImg" src="/Millions/img/even_text.png" class="h-6 object-contain drop-shadow-sm" />
  440. </div>
  441. </div>
  442. <!-- Amount Info -->
  443. <div class="grid grid-cols-[90px_auto] items-center gap-3 w-full justify-center">
  444. <span class="text-[15px] font-bold text-[#555] text-right font-bricolage">@Lang.millions_amount</span>
  445. <div class="flex items-baseline gap-1.5 justify-start">
  446. <span id="otpTotalAmount" class="text-[22px] font-[900] text-black leading-none tracking-tight">1.000</span>
  447. <span class="text-[15px] font-[900] text-[#F37021] font-bricolage">HTG</span>
  448. </div>
  449. </div>
  450. </div>
  451. <p id="paymentCodeInstruction" class="text-[14px] font-bold text-[#555] text-center px-4 leading-snug mt-0 font-bricolage">@Lang.millions_otp_instruction</p>
  452. <!-- 6-Slots OTP Grid (Large Gray Blocks) -->
  453. <div class="flex items-center justify-center gap-2 w-full mt-1 px-2" id="otpInputs">
  454. @for (int i = 1; i <= 6; i++)
  455. {
  456. <input type="tel" maxlength="1" id="otp@(i)"
  457. oninput="moveToNext(this, '@(i < 6 ? "otp" + (i + 1) : "")')"
  458. 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"
  459. placeholder="-">
  460. }
  461. </div>
  462. <div id="walletPinContainer" class="hidden w-full mt-1 px-2">
  463. <div class="relative">
  464. <i class="fa-solid fa-lock absolute left-4 top-1/2 -translate-y-1/2 text-[#0A9800]"></i>
  465. <input id="walletPinInput" type="password" inputmode="numeric" autocomplete="off"
  466. oninput="this.value = this.value.replace(/[^0-9]/g, ''); updateWalletPinState()"
  467. class="h-[52px] w-full rounded-[14px] border-2 border-gray-200 bg-gray-50 pl-11 pr-12 text-center text-[22px] font-black tracking-[0.3em] text-gray-800 outline-none transition focus:border-[#0A9800] focus:bg-white focus:ring-4 focus:ring-green-100"
  468. placeholder="••••">
  469. <button type="button" onclick="toggleWalletPinVisibility()" class="absolute right-4 top-1/2 -translate-y-1/2 text-gray-400 active:scale-90" aria-label="Show PIN"><i id="walletPinEye" class="fa-solid fa-eye"></i></button>
  470. </div>
  471. </div>
  472. <!-- OTP Error Message -->
  473. <p id="otpError" class="text-[#0062FF] font-bold text-[14px] text-center mb-1 hidden animate__animated animate__shakeX"></p>
  474. <!-- Timer & Resend -->
  475. <div class="flex flex-col items-center gap-1 mt-0">
  476. <span id="otpTimer" class="text-[15px] font-black text-[#0062FF] font-bricolage">60s</span>
  477. <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>
  478. </div>
  479. <!-- Action Buttons: Cancel / Confirm -->
  480. <div class="grid grid-cols-2 gap-3 w-full mt-2">
  481. <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>
  482. <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>
  483. </div>
  484. </div>
  485. </div>
  486. </div>
  487. </div>
  488. @section Scripts {
  489. <script>
  490. const maxBalls = @(Model.termType == Constants.PIC10_BASIC_CODE ? 10 : (Model.termType == Constants.Millions_CODE ? 6 : (Model.termType == Constants.PIC10_BIGSMALL_CODE ? 13 : 15)));
  491. const isFreeTicketMode = @(isFreeTicketMode ? "true" : "false");
  492. const hasFreeTicketPromotion = @(hasFreeTicketPromotion ? "true" : "false");
  493. const freeTicketPromotionCode = @Html.Raw(System.Text.Json.JsonSerializer.Serialize(freeTicketPromotionCode));
  494. function reindexTickets() {
  495. $(".ticket-card").each(function(index) {
  496. $(this).find(".ticket-index").text(index + 1);
  497. });
  498. }
  499. function removeEntry(btn) {
  500. var card = $(btn).closest('.ticket-card');
  501. card.addClass('animate__animated animate__fadeOutRight animate__faster');
  502. setTimeout(function() {
  503. card.remove();
  504. reindexTickets();
  505. updateTotalPrice();
  506. }, 300);
  507. }
  508. function randomizeTicket(btn) {
  509. var icon = $(btn).find('i');
  510. icon.addClass('fa-spin');
  511. var card = $(btn).closest('.ticket-card');
  512. var balls = card.find('.ball-circle');
  513. // Generate unique random numbers
  514. var numbers = [];
  515. if ("@Model.termType" === "@Constants.Millions_CODE") {
  516. // First 5 standard balls (1-70)
  517. while(numbers.length < 5){
  518. var r = Math.floor(Math.random() * 70) + 1;
  519. if(numbers.indexOf(r) === -1) numbers.push(r);
  520. }
  521. numbers.sort((a, b) => a - b);
  522. // 6th Mega Ball (1-24)
  523. var mb = Math.floor(Math.random() * 24) + 1;
  524. numbers.push(mb);
  525. } else {
  526. while(numbers.length < maxBalls){
  527. var r = Math.floor(Math.random() * 80) + 1;
  528. if(numbers.indexOf(r) === -1) numbers.push(r);
  529. }
  530. numbers.sort((a, b) => a - b);
  531. }
  532. // Update balls with staggered animation
  533. balls.each(function(index) {
  534. var ball = $(this);
  535. setTimeout(function() {
  536. var formattedNum = numbers[index].toString().padStart(2, '0');
  537. ball.removeClass('ball-empty').addClass('ball-filled').text(formattedNum);
  538. ball.addClass('animate__animated animate__flipInY');
  539. if(index === maxBalls - 1) {
  540. setTimeout(() => {
  541. icon.removeClass('fa-spin');
  542. // Replace button with Edit/Delete group
  543. $(btn).hide();
  544. card.find('.edit-delete-group').removeClass('hidden').addClass('animate__animated animate__fadeInRight animate__faster');
  545. updateTotalPrice();
  546. }, 300);
  547. }
  548. }, index * 40);
  549. });
  550. }
  551. function clearTicket(btn) {
  552. var card = $(btn).closest('.ticket-card');
  553. var balls = card.find('.ball-circle');
  554. balls.removeClass('ball-filled animate__animated animate__flipInY shadow-inner').addClass('ball-empty').text('');
  555. // Hide Edit/Delete group and show Rand button
  556. card.find('.edit-delete-group').addClass('hidden');
  557. card.find('.rand-btn').show().addClass('animate__animated animate__fadeInLeft animate__faster');
  558. updateTotalPrice();
  559. }
  560. // Open Number Picker Modal
  561. var activeBall = null;
  562. var activeTicketCard = null;
  563. var selectedNumbers = []; // For Edit mode, this will be an array of fixed size with nulls
  564. var isMultiMode = false;
  565. function editFullTicket(btn) {
  566. isMultiMode = true;
  567. activeTicketCard = $(btn).closest('.ticket-card');
  568. activeBall = null;
  569. // Initialize fixed slots for slot-based editing
  570. selectedNumbers = new Array(maxBalls).fill(null);
  571. let existing = [];
  572. activeTicketCard.find('.ball-filled').each(function() {
  573. var num = $(this).text().trim();
  574. if(num) existing.push(num);
  575. });
  576. // Initial fill from left to right
  577. existing.forEach((num, idx) => {
  578. if(idx < maxBalls) selectedNumbers[idx] = num;
  579. });
  580. openNumberPicker(true);
  581. }
  582. function openNumberPicker(isMulti) {
  583. var modal = $("#numberPickerModal");
  584. var grid = $("#numberGrid");
  585. var title = $("#modalTitle");
  586. var countArea = $(".selection-count-area");
  587. var confirmBtn = $("#confirmBtn");
  588. grid.empty();
  589. if (isMulti) {
  590. title.text("Edit Ticket");
  591. countArea.removeClass('hidden');
  592. confirmBtn.removeClass('hidden').text("@Lang.confirm");
  593. } else {
  594. title.text("Pick Number");
  595. countArea.addClass('hidden');
  596. confirmBtn.removeClass('hidden').text("@Lang.confirm");
  597. }
  598. updateSelectionCount();
  599. liveUpdateTicket();
  600. // Focus card: append a tall spacer so even the last ticket can scroll up
  601. // above the number-picker sheet (a flex column container does not honor
  602. // padding-bottom as scrollable space), then bring the card to the top.
  603. if (activeTicketCard && activeTicketCard.length) {
  604. var container = $("#ticketContainer");
  605. $("#editScrollSpacer").remove();
  606. container.append('<div id="editScrollSpacer" aria-hidden="true" style="height:100vh;flex-shrink:0;"></div>');
  607. var scrollPos = activeTicketCard.offset().top - container.offset().top + container.scrollTop();
  608. container.stop().animate({ scrollTop: scrollPos - 15 }, 500);
  609. }
  610. var isMillions = "@Model.termType" === "@Constants.Millions_CODE";
  611. if (isMillions) {
  612. // Millions Split UI: 1-70 (cols-7) | Divider | 1-24 (cols-3)
  613. var splitHtml = `
  614. <div class="flex gap-3 h-full">
  615. <!-- Left: Standard (1-70) -->
  616. <div class="flex-1 flex flex-col h-full min-w-0">
  617. <span class="text-[10px] font-black text-blue-600 mb-1 uppercase tracking-wider shrink-0">Standard (1-70)</span>
  618. <div class="flex-1 overflow-y-auto grid grid-cols-7 gap-1 pr-1 pb-2" id="standardGrid" style="scrollbar-width: thin; scrollbar-color: #0062FF transparent;"></div>
  619. </div>
  620. <!-- Divider -->
  621. <div class="w-[1px] bg-gray-300 self-stretch my-1 shrink-0"></div>
  622. <!-- Right: Mega Ball (1-24) -->
  623. <div class="w-[105px] flex flex-col h-full shrink-0">
  624. <span class="text-[10px] font-black text-red-600 mb-1 uppercase tracking-wider shrink-0 text-center">Mega (1-24)</span>
  625. <div class="flex-1 overflow-y-auto grid grid-cols-3 gap-1 pl-1 pb-2" id="megaGrid" style="scrollbar-width: thin; scrollbar-color: #E3132D transparent;"></div>
  626. </div>
  627. </div>
  628. `;
  629. grid.append(splitHtml);
  630. var standardContainer = $("#standardGrid");
  631. var megaContainer = $("#megaGrid");
  632. // Populate Standard (1-70)
  633. for (var i = 1; i <= 70; i++) {
  634. var formatted = i.toString().padStart(2, '0');
  635. var isSelected = selectedNumbers.slice(0, 5).includes(formatted);
  636. var btnClass = isSelected
  637. ? 'bg-[#0062FF] text-white shadow-sm'
  638. : 'bg-white text-gray-700 hover:bg-gray-100 border border-gray-100';
  639. standardContainer.append(`<button type="button" class="std-num-btn w-[26px] h-[26px] rounded-full font-black text-[9.5px] transition-all flex items-center justify-center ${btnClass}">${formatted}</button>`);
  640. }
  641. // Populate Mega (1-24)
  642. for (var i = 1; i <= 24; i++) {
  643. var formatted = i.toString().padStart(2, '0');
  644. var isSelected = selectedNumbers[5] === formatted;
  645. var btnClass = isSelected
  646. ? 'bg-[#E3132D] text-white shadow-sm'
  647. : 'bg-white text-gray-700 hover:bg-gray-100 border border-gray-100';
  648. megaContainer.append(`<button type="button" class="mega-num-btn w-[26px] h-[26px] rounded-full font-black text-[9.5px] transition-all flex items-center justify-center ${btnClass}">${formatted}</button>`);
  649. }
  650. // Standard Grid Click Handler
  651. standardContainer.on('click', '.std-num-btn', function(e) {
  652. e.preventDefault();
  653. var $btn = $(this);
  654. var picked = $btn.text().trim();
  655. if (isMultiMode) {
  656. var stdSelected = selectedNumbers.slice(0, 5);
  657. if (stdSelected.includes(picked)) {
  658. // Deselect
  659. let idx = selectedNumbers.indexOf(picked);
  660. if (idx !== -1 && idx < 5) selectedNumbers[idx] = null;
  661. $btn.removeClass('bg-[#0062FF] text-white shadow-sm').addClass('bg-white text-gray-700 border border-gray-100');
  662. } else {
  663. // Select standard ball (first empty slot in 0-4)
  664. let emptyIdx = -1;
  665. for (var k = 0; k < 5; k++) {
  666. if (selectedNumbers[k] === null) {
  667. emptyIdx = k;
  668. break;
  669. }
  670. }
  671. if (emptyIdx !== -1) {
  672. selectedNumbers[emptyIdx] = picked;
  673. $btn.addClass('bg-[#0062FF] text-white shadow-sm').removeClass('bg-white text-gray-700 border border-gray-100');
  674. }
  675. }
  676. liveUpdateTicket();
  677. }
  678. updateSelectionCount();
  679. });
  680. // Mega Grid Click Handler
  681. megaContainer.on('click', '.mega-num-btn', function(e) {
  682. e.preventDefault();
  683. var $btn = $(this);
  684. var picked = $btn.text().trim();
  685. if (isMultiMode) {
  686. if (selectedNumbers[5] === picked) {
  687. // Deselect Mega Ball
  688. selectedNumbers[5] = null;
  689. $btn.removeClass('bg-[#E3132D] text-white shadow-sm').addClass('bg-white text-gray-700 border border-gray-100');
  690. } else {
  691. // Overwrite Mega Ball
  692. selectedNumbers[5] = picked;
  693. megaContainer.find('.mega-num-btn').removeClass('bg-[#E3132D] text-white shadow-sm').addClass('bg-white text-gray-700 border border-gray-100');
  694. $btn.addClass('bg-[#E3132D] text-white shadow-sm').removeClass('bg-white text-gray-700 border border-gray-100');
  695. }
  696. liveUpdateTicket();
  697. }
  698. updateSelectionCount();
  699. });
  700. } else {
  701. // Default Pick 10 UI: 1-80 Grid
  702. var normalHtml = `<div class="grid grid-cols-10 gap-1.5 w-full pb-2 h-full overflow-y-auto" id="normalGrid"></div>`;
  703. grid.append(normalHtml);
  704. var normalContainer = $("#normalGrid");
  705. for (var i = 1; i <= 80; i++) {
  706. var formatted = i.toString().padStart(2, '0');
  707. var isSelected = selectedNumbers.includes(formatted);
  708. var btnClass = isSelected
  709. ? 'bg-[#0062FF] text-white shadow-md scale-105 active-num'
  710. : 'bg-white text-gray-700 hover:bg-gray-100 border border-gray-100';
  711. normalContainer.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>`);
  712. }
  713. normalContainer.on('click', '.num-btn', function(e) {
  714. e.preventDefault();
  715. var $btn = $(this);
  716. var picked = $btn.text().trim();
  717. if (isMultiMode) {
  718. if (selectedNumbers.includes(picked)) {
  719. let idx = selectedNumbers.indexOf(picked);
  720. if (idx !== -1) selectedNumbers[idx] = null;
  721. $btn.removeClass('bg-[#0062FF] text-white shadow-md scale-105 active-num').addClass('bg-white text-gray-700 border border-gray-100');
  722. } else {
  723. let firstEmpty = selectedNumbers.indexOf(null);
  724. if (firstEmpty !== -1) {
  725. selectedNumbers[firstEmpty] = picked;
  726. $btn.addClass('bg-[#0062FF] text-white shadow-md scale-105 active-num').removeClass('bg-white text-gray-700 border border-gray-100');
  727. }
  728. }
  729. liveUpdateTicket();
  730. }
  731. updateSelectionCount();
  732. });
  733. }
  734. modal.removeClass('hidden').addClass('flex');
  735. modal.find('.modal-content').removeClass('animate__zoomOut').addClass('animate__zoomIn');
  736. }
  737. function updateSelectionCount() {
  738. var count = selectedNumbers.filter(n => n !== null && n !== "").length;
  739. $("#selectionCount").text(count);
  740. $("#maxSelectionCount").text(maxBalls);
  741. var isValid = isMultiMode ? (count === maxBalls) : (count === 1);
  742. if (isValid) {
  743. $("#confirmBtn").prop('disabled', false).removeClass('opacity-50 cursor-not-allowed').addClass('cursor-pointer');
  744. } else {
  745. $("#confirmBtn").prop('disabled', true).addClass('opacity-50 cursor-not-allowed').removeClass('cursor-pointer');
  746. }
  747. }
  748. function liveUpdateTicket() {
  749. if (!activeTicketCard) return;
  750. var balls = activeTicketCard.find('.ball-circle');
  751. if (isMultiMode) {
  752. // Update Ticket Card balls
  753. for(var i=0; i < maxBalls; i++){
  754. var val = selectedNumbers[i];
  755. if (i < balls.length) {
  756. var tBall = $(balls[i]);
  757. if (val) {
  758. tBall.removeClass('ball-empty').addClass('ball-filled').text(val);
  759. } else {
  760. tBall.removeClass('ball-filled').addClass('ball-empty').text('');
  761. }
  762. }
  763. }
  764. // Toggle Rand/Edit button visibility
  765. if (selectedNumbers.filter(n => n !== null && n !== "").length > 0) {
  766. activeTicketCard.find('.rand-btn').hide();
  767. activeTicketCard.find('.edit-delete-group').removeClass('hidden').show();
  768. } else {
  769. activeTicketCard.find('.rand-btn').show();
  770. activeTicketCard.find('.edit-delete-group').addClass('hidden');
  771. }
  772. updateTotalPrice();
  773. }
  774. }
  775. // All immediate jQuery event bindings must wait for DOM + jQuery to be ready
  776. document.addEventListener("DOMContentLoaded", function() {
  777. // Click on a ball (filled or empty) to edit the full ticket
  778. $(document).on('click', '.ball-filled, .ball-empty', function() {
  779. editFullTicket(this);
  780. });
  781. updateTotalPrice();
  782. // Confirm button handler
  783. $(document).off('click', '#confirmBtn').on('click', '#confirmBtn', function(e) {
  784. e.preventDefault();
  785. // Check non-null count
  786. var count = selectedNumbers.filter(n => n !== null && n !== "").length;
  787. if (count === 0) return;
  788. if (isMultiMode && activeTicketCard && activeTicketCard.length > 0) {
  789. // Double check validation for Mega Ball before confirming
  790. if ("@Model.termType" === "@Constants.Millions_CODE") {
  791. var mbVal = selectedNumbers[5];
  792. if (mbVal) {
  793. var mbValInt = parseInt(mbVal);
  794. if (mbValInt < 1 || mbValInt > 24) {
  795. showNotification("🎱 @Lang.millions_megaball_invalid_title\n@Lang.millions_megaball_invalid_desc", "warning");
  796. return;
  797. }
  798. }
  799. }
  800. // Keep exact selected order, do not sort!
  801. var finalSorted = [];
  802. if ("@Model.termType" === "@Constants.Millions_CODE") {
  803. var first5 = selectedNumbers.slice(0, 5).filter(n => n !== null && n !== "");
  804. var mb = selectedNumbers[5];
  805. finalSorted = first5;
  806. if (mb) finalSorted.push(mb);
  807. } else {
  808. finalSorted = selectedNumbers.filter(n => n !== null && n !== "");
  809. }
  810. var balls = activeTicketCard.find('.ball-circle');
  811. balls.removeClass('ball-filled').addClass('ball-empty').text('');
  812. finalSorted.forEach((num, index) => {
  813. if (index < balls.length) {
  814. $(balls[index]).removeClass('ball-empty').addClass('ball-filled').text(num);
  815. $(balls[index]).addClass('animate__animated animate__pulse');
  816. setTimeout(() => $(balls[index]).removeClass('animate__animated animate__pulse'), 500);
  817. }
  818. });
  819. activeTicketCard.find('.rand-btn').hide();
  820. activeTicketCard.find('.edit-delete-group').removeClass('hidden').show();
  821. updateTotalPrice();
  822. } else if (!isMultiMode && activeBall && activeBall.length > 0) {
  823. // Single mode: Update only the active ball
  824. activeBall.text(selectedNumbers[0]).removeClass('ball-empty').addClass('ball-filled');
  825. activeBall.addClass('animate__animated animate__pulse');
  826. setTimeout(() => activeBall.removeClass('animate__animated animate__pulse'), 500);
  827. var card = activeBall.closest('.ticket-card');
  828. var filledBalls = card.find('.ball-filled').length;
  829. if (filledBalls > 0) {
  830. card.find('.rand-btn').hide();
  831. card.find('.edit-delete-group').removeClass('hidden').show();
  832. } else {
  833. card.find('.rand-btn').show();
  834. card.find('.edit-delete-group').addClass('hidden');
  835. }
  836. updateTotalPrice();
  837. }
  838. closeNumberPicker();
  839. });
  840. });
  841. function closeNumberPicker() {
  842. var modal = $("#numberPickerModal");
  843. modal.find('.modal-content').removeClass('animate__zoomIn').addClass('animate__zoomOut');
  844. setTimeout(() => {
  845. modal.removeClass('flex').addClass('hidden');
  846. // Remove the temporary scroll spacer
  847. $("#editScrollSpacer").remove();
  848. // Reset state
  849. activeBall = null;
  850. activeTicketCard = null;
  851. }, 200);
  852. }
  853. function updateTotalPrice() {
  854. var filledTickets = 0;
  855. $(".ticket-card").each(function() {
  856. if ($(this).find(".ball-filled").length === maxBalls) {
  857. filledTickets++;
  858. }
  859. });
  860. const pricePerTicket = hasFreeTicketPromotion
  861. ? 0
  862. : @(Model.termType == Constants.PIC10_BASIC_CODE ? "10" : (Model.termType == Constants.Millions_CODE ? "20" : "50"));
  863. $("#totalPrice").text(formatMoneyV2(filledTickets * pricePerTicket));
  864. $("#totalTicketCount").text(filledTickets);
  865. }
  866. function addNewTicket() {
  867. if (isFreeTicketMode) return;
  868. var container = $("#ticketContainer");
  869. var wrapper = $("#addButtonWrapper");
  870. var currentIndex = $(".ticket-card").length + 1;
  871. var ballsHtml = '';
  872. var isMillions = @(Model.termType == Constants.Millions_CODE ? "true" : "false");
  873. for (var i = 0; i < maxBalls; i++) {
  874. var isMbBall = isMillions && i === 5;
  875. var mbIndicator = isMbBall ? '<div class="absolute -bottom-[6px] -right-[4px] bg-[#FFD700] text-black text-[8.5px] font-black px-[2.5px] py-[1.5px] rounded-[3px] shadow-sm leading-none z-10 border border-[#EAA800]">MB</div>' : '';
  876. ballsHtml += '<div class="relative w-fit"><div class="ball-circle ball-empty' + (isMbBall ? ' ball-mb-circle' : '') + '"></div>' + mbIndicator + '</div>';
  877. }
  878. var ticketHtml = `
  879. <div class="ticket-card relative group active:bg-gray-50 transition-colors cursor-pointer animate__animated animate__fadeInUp animate__faster">
  880. <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">
  881. <i class="fa-solid fa-xmark"></i>
  882. </button>
  883. <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>
  884. <div class="flex flex-col gap-1 pl-8">
  885. <span class="text-[16px] font-extrabold text-[#333]">@Lang.millions_select_10_lucky_numbers</span>
  886. <div class="flex items-center gap-4">
  887. <div class="grid grid-cols-6 gap-y-2 gap-x-1 flex-1">
  888. ${ballsHtml}
  889. </div>
  890. <div class="w-[90px] action-area flex flex-col gap-2">
  891. <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">
  892. <i class="fa-solid fa-arrows-rotate text-[10px]"></i> @Lang.Random
  893. </button>
  894. <div class="edit-delete-group hidden flex flex-col gap-2">
  895. <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">
  896. <img src="/Millions/img/icons/icon_edit.png" onerror="this.style.display='none'" class="w-[16px] h-[16px] object-contain"> @Lang.millions_edit
  897. </button>
  898. <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">
  899. <img src="/Millions/img/icons/icon_delete.png" onerror="this.style.display='none'" class="w-[16px] h-[16px] object-contain"> @Lang.millions_delete
  900. </button>
  901. </div>
  902. </div>
  903. </div>
  904. </div>
  905. </div>
  906. `;
  907. $(ticketHtml).insertBefore(wrapper);
  908. container.animate({ scrollTop: container.prop("scrollHeight") }, 300);
  909. }
  910. // --- Order Summary Modal Logic ---
  911. // --- Payment Preparation & Order Summary Logic ---
  912. let pendingTickets = [];
  913. let currentChannelPayment = '@Constants.BASIC_WALLET_TICKET';
  914. let isPreparingCheckout = false;
  915. let isSendingOtp = false;
  916. let isFinalizingPurchase = false;
  917. let paymentClickArmedAt = 0;
  918. function armPaymentClick(event) {
  919. if (event && event.isTrusted === true) paymentClickArmedAt = Date.now();
  920. }
  921. function armPaymentKey(event) {
  922. if (event && event.isTrusted === true && (event.key === "Enter" || event.key === " ")) {
  923. paymentClickArmedAt = Date.now();
  924. }
  925. }
  926. function preparePayment(event) {
  927. // Never prepare or confirm a ticket during page initialization.
  928. // A trusted pointer/key action on this button must immediately precede the click.
  929. const hasFreshPaymentIntent = paymentClickArmedAt > 0
  930. && Date.now() - paymentClickArmedAt <= 1500;
  931. paymentClickArmedAt = 0;
  932. if (!event || event.type !== "click" || event.isTrusted !== true || !hasFreshPaymentIntent) return;
  933. const isBSMode = @(Model.termType == Constants.PIC10_BIGSMALL_CODE || Model.termType == Constants.PIC10_ODDEVEN_CODE ? "true" : "false");
  934. const tickets = [];
  935. if (isBSMode) {
  936. if (!bsChoice) {
  937. showNotification("Please select a choice first.", "warning");
  938. return;
  939. }
  940. let bsCode = "";
  941. if ('@Model.termType' === '@Constants.PIC10_BIGSMALL_CODE') {
  942. bsCode = (bsChoice === 'big') ? "B" : "S";
  943. } else {
  944. bsCode = (bsChoice === 'big') ? "O" : "E"; // Odd = O, Even = E
  945. }
  946. tickets.push({
  947. code: bsCode,
  948. money: "50"
  949. });
  950. } else {
  951. $(".ticket-card").each(function() {
  952. if (isFreeTicketMode && tickets.length >= 1) return false;
  953. const balls = $(this).find(".ball-filled");
  954. if (balls.length === maxBalls) {
  955. const selectedNumbers = [];
  956. balls.each(function() { selectedNumbers.push($(this).text().trim()); });
  957. const itemPrice = "@(Model.termType == Constants.PIC10_BASIC_CODE ? "10" : (Model.termType == Constants.Millions_CODE ? "20" : "50"))";
  958. tickets.push({
  959. code: selectedNumbers.join(','),
  960. money: itemPrice
  961. });
  962. }
  963. });
  964. if (tickets.length === 0) {
  965. showNotification("@Lang.millions_ticket_not_valid", "warning");
  966. return;
  967. }
  968. }
  969. pendingTickets = tickets;
  970. if (hasFreeTicketPromotion) {
  971. selectPaymentChannel('@Constants.BASIC_WALLET_TICKET');
  972. return;
  973. }
  974. $("#paymentChannelModal").removeClass("hidden").addClass("flex");
  975. }
  976. function hidePaymentChannelModal() {
  977. $("#paymentChannelModal").removeClass("flex").addClass("hidden");
  978. }
  979. function selectPaymentChannel(channelPayment) {
  980. if (isPreparingCheckout) return;
  981. isPreparingCheckout = true;
  982. currentChannelPayment = channelPayment;
  983. hidePaymentChannelModal();
  984. const requestData = {
  985. gameId: isFreeTicketMode ? "@Constants.Millions_CODE" : "@Model.termType",
  986. ticket: pendingTickets,
  987. channelPayment: channelPayment,
  988. promotionCode: isFreeTicketMode ? freeTicketPromotionCode : null
  989. };
  990. $.ajax({
  991. url: subDomain + '@Url.Action("ConfirmTicketData", "Home")',
  992. type: 'POST',
  993. contentType: 'application/json',
  994. data: JSON.stringify(requestData),
  995. success: function(data) {
  996. if (data.responseCode === "0" || data.responseCode === "0000") {
  997. showOrderSummary(data, pendingTickets);
  998. } else {
  999. showNotification(data.responseMessage || "Confirmation failed", data.responseCode);
  1000. }
  1001. },
  1002. error: function(err) {
  1003. showNotification("Network error occurred.", "warning");
  1004. },
  1005. complete: function() {
  1006. isPreparingCheckout = false;
  1007. }
  1008. });
  1009. }
  1010. let currentTransId = null;
  1011. function showOrderSummary(apiData, localTickets) {
  1012. currentTransId = apiData.transId;
  1013. const summaryModal = $("#orderSummaryModal");
  1014. const summaryList = $("#summaryTicketList");
  1015. summaryList.empty();
  1016. const displayTickets = (apiData && apiData.ticket) ? apiData.ticket : (localTickets || []);
  1017. if (!displayTickets || !Array.isArray(displayTickets)) {
  1018. console.warn("No tickets found to display in summary.");
  1019. return;
  1020. }
  1021. displayTickets.forEach((t, index) => {
  1022. const numbers = t.code.split(',');
  1023. let contentHtml = '';
  1024. if (numbers.length > 1) {
  1025. const isMillionsGame = "@Model.termType" === "@Constants.Millions_CODE";
  1026. let numbersBalls = '';
  1027. numbers.forEach((n, ni) => {
  1028. var isMbBall = isMillionsGame && ni === numbers.length - 1;
  1029. var ballBg = isMbBall
  1030. ? 'background: radial-gradient(circle at 50% 50%, #0062ff 0%, #0062ff 60%, #0149f0 75%, #0231e0 85%, #0218d1 92%, #0300c2 100%); box-shadow: inset 0 0 6px 2px rgba(0,24,209,0.5), 0 4px 10px rgba(2,24,209,0.3);'
  1031. : 'background: linear-gradient(135deg, #FF3D63 0%, #E3132D 60%, #BA0F21 100%); box-shadow: 0 4px 10px rgba(186,15,33,0.3);';
  1032. numbersBalls += `<div class="w-7 h-7 rounded-full flex items-center justify-center text-white text-[11px] font-black" style="${ballBg} 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>`;
  1033. });
  1034. var summaryGridCols = isMillionsGame ? 'grid-cols-6' : 'grid-cols-5';
  1035. contentHtml = `<div class="grid ${summaryGridCols} gap-y-2 gap-x-1 relative z-10 px-1 justify-items-center">${numbersBalls}</div>`;
  1036. } else {
  1037. const isBS = @(Model.termType == Constants.PIC10_BIGSMALL_CODE ? "true" : "false");
  1038. const isFirstChoice = (numbers[0] === 'B' || numbers[0] === 'O');
  1039. const label = isFirstChoice ? (isBS ? "Big" : "Odd") : (isBS ? "Small" : "Even");
  1040. const color = isFirstChoice ? (isBS ? "#A2FF00" : "#FFC700") : (isBS ? "#FF4157" : "#B33BD0");
  1041. 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>`;
  1042. }
  1043. const itemHtml = `
  1044. <div class="flex items-center gap-3">
  1045. <div class="flex-1 rounded-2xl p-3 relative overflow-hidden flex flex-col gap-2 min-h-[80px] justify-center shadow-sm"
  1046. style="background: white; border: 1.5px solid #0062FF;">
  1047. ${contentHtml}
  1048. </div>
  1049. <div class="w-24 shrink-0 bg-white border border-gray-200 rounded-2xl p-2.5 flex items-center justify-center shadow-sm">
  1050. <div class="flex items-baseline gap-0.5">
  1051. <span class="text-[20px] font-black text-black">${formatMoneyV2(hasFreeTicketPromotion ? 0 : t.money)}</span>
  1052. <span class="text-[12px] font-black text-[#0062FF]">HTG</span>
  1053. </div>
  1054. </div>
  1055. </div>
  1056. `;
  1057. summaryList.append(itemHtml);
  1058. });
  1059. $("#summaryTotalCount").text(displayTickets.length);
  1060. const totalMoney = hasFreeTicketPromotion
  1061. ? "0"
  1062. : (apiData.totalMoneyPayment || apiData.totalMoney || "0");
  1063. $("#summaryTotalAmount").text(formatMoneyV2(totalMoney));
  1064. summaryModal.removeClass("hidden").addClass("flex");
  1065. }
  1066. function hideOrderSummary() {
  1067. $("#orderSummaryModal").removeClass("flex").addClass("hidden");
  1068. }
  1069. function confirmCheckout(btn) {
  1070. if (isSendingOtp) return;
  1071. if (currentChannelPayment === '@Constants.NATCASH_WALLET_TICKET') {
  1072. showOtpModal(true);
  1073. return;
  1074. }
  1075. isSendingOtp = true;
  1076. const originalText = $(btn).html();
  1077. $(btn).prop('disabled', true).html('<i class="fa-solid fa-spinner fa-spin mr-2"></i>Processing...');
  1078. // Trigger SendOTP API
  1079. $.ajax({
  1080. url: subDomain + '@Url.Action("SendOTP", "Home")',
  1081. type: 'POST',
  1082. success: function(data) {
  1083. $(btn).prop('disabled', false).html(originalText);
  1084. if (data.responseCode === "0") {
  1085. showOtpModal(false);
  1086. } else {
  1087. showNotification(data.responseMessage || "Failed to send OTP", data.responseCode);
  1088. }
  1089. },
  1090. error: function() {
  1091. $(btn).prop('disabled', false).html(originalText);
  1092. showNotification("Network error occurred.", "warning");
  1093. },
  1094. complete: function() {
  1095. isSendingOtp = false;
  1096. }
  1097. });
  1098. }
  1099. let otpInterval;
  1100. function showOtpModal(isWalletPin) {
  1101. hideOrderSummary();
  1102. $("#otpModal").removeClass("hidden").addClass("flex");
  1103. $("#otpInputs input").val("");
  1104. $("#walletPinInput").val("").attr("type", "password");
  1105. $("#walletPinEye").attr("class", "fa-solid fa-eye");
  1106. $("#otpConfirmBtn").prop('disabled', true);
  1107. $("#otpError").addClass("hidden").text("");
  1108. // Map game type to readable name & image
  1109. let gameTypeStr = "@Model.termType";
  1110. let displayName = gameTypeStr === "@Constants.Millions_CODE" ? "@Lang.millions" : "Basic Pick 10";
  1111. let imgSrc = "";
  1112. if (gameTypeStr === "@Constants.PIC10_BIGSMALL_CODE") {
  1113. // Get the specific choice from summary
  1114. let firstTicketText = $("#summaryTicketList").find("span.font-black").first().text().trim();
  1115. if (firstTicketText) {
  1116. displayName = firstTicketText.charAt(0).toUpperCase() + firstTicketText.slice(1).toLowerCase(); // Normalize to "Big" or "Small"
  1117. } else {
  1118. displayName = "Big / Small";
  1119. }
  1120. } else if (gameTypeStr === "@Constants.PIC10_ODDEVEN_CODE") {
  1121. let firstTicketText = $("#summaryTicketList").find("span.font-black").first().text().trim();
  1122. if (firstTicketText) {
  1123. displayName = firstTicketText.charAt(0).toUpperCase() + firstTicketText.slice(1).toLowerCase(); // Normalize to "Odd" or "Even"
  1124. } else {
  1125. displayName = "Odd / Even";
  1126. }
  1127. }
  1128. // Determine color based on game type
  1129. let typeColorClass = "text-purple-700"; // default
  1130. if (gameTypeStr === "@Constants.PIC10_BASIC_CODE") typeColorClass = "text-[#0062FF]";
  1131. else if (gameTypeStr === "@Constants.Millions_CODE") typeColorClass = "text-[#0062FF]";
  1132. else if (gameTypeStr === "@Constants.PIC10_BIGSMALL_CODE") typeColorClass = "text-[#0A9800]";
  1133. else if (gameTypeStr === "@Constants.PIC10_ODDEVEN_CODE") typeColorClass = "text-[#9333ea]";
  1134. // Hide image for now and use the beautiful text style as requested
  1135. $("#otpTicketTypeImg").hide();
  1136. $("#otpTicketTypeContainer").find("span").remove();
  1137. $("#otpTicketTypeContainer").append(`<span class='text-[17px] font-[900] ${typeColorClass} italic'>${displayName}</span>`);
  1138. $("#otpTotalAmount").text($("#summaryTotalAmount").text());
  1139. if (isWalletPin) {
  1140. $("#paymentCodeInstruction").text('@Html.Raw(Lang.payment_wallet_pin_instruction.Replace("'", "\\'"))');
  1141. $("#otpInputs").addClass("hidden");
  1142. $("#walletPinContainer").removeClass("hidden");
  1143. $("#otpTimer, #resendOtpBtn").addClass("hidden");
  1144. clearInterval(otpInterval);
  1145. $("#walletPinInput").focus();
  1146. } else {
  1147. $("#paymentCodeInstruction").text('@Html.Raw(Lang.millions_otp_instruction.Replace("'", "\\'"))');
  1148. $("#walletPinContainer").addClass("hidden");
  1149. $("#otpInputs").removeClass("hidden");
  1150. startOtpTimer(60);
  1151. $("#otp1").focus();
  1152. }
  1153. }
  1154. function updateWalletPinState() {
  1155. $("#otpConfirmBtn").prop('disabled', $("#walletPinInput").val().length === 0);
  1156. $("#otpError").addClass("hidden").text("");
  1157. }
  1158. function toggleWalletPinVisibility() {
  1159. const input = $("#walletPinInput");
  1160. const showPin = input.attr("type") === "password";
  1161. input.attr("type", showPin ? "text" : "password");
  1162. $("#walletPinEye").attr("class", showPin ? "fa-solid fa-eye-slash" : "fa-solid fa-eye");
  1163. input.focus();
  1164. }
  1165. // Add backspace support for OTP inputs
  1166. $("#otpInputs input").on("keyup", function() {
  1167. let otp = "";
  1168. $("#otpInputs input").each(function() { otp += $(this).val(); });
  1169. $("#otpConfirmBtn").prop('disabled', otp.length < 6);
  1170. });
  1171. $("#otpInputs input").on("keydown", function(e) {
  1172. if (e.key === "Backspace" && this.value.length === 0) {
  1173. $(this).prev('input').focus();
  1174. }
  1175. });
  1176. function hideOtpModal() {
  1177. $("#otpModal").removeClass("flex").addClass("hidden");
  1178. clearInterval(otpInterval);
  1179. }
  1180. function startOtpTimer(seconds) {
  1181. let timeLeft = seconds;
  1182. $("#resendOtpBtn").addClass("hidden");
  1183. $("#otpTimer").removeClass("hidden").text(timeLeft + "s");
  1184. clearInterval(otpInterval);
  1185. otpInterval = setInterval(() => {
  1186. timeLeft--;
  1187. $("#otpTimer").text(timeLeft + "s");
  1188. if (timeLeft <= 0) {
  1189. clearInterval(otpInterval);
  1190. $("#otpTimer").addClass("hidden");
  1191. $("#resendOtpBtn").removeClass("hidden");
  1192. }
  1193. }, 1000);
  1194. }
  1195. function moveToNext(el, nextId) {
  1196. if (el.value.length >= 1) {
  1197. if (nextId) document.getElementById(nextId).focus();
  1198. }
  1199. let otp = "";
  1200. $("#otpInputs input").each(function() { otp += $(this).val(); });
  1201. $("#otpConfirmBtn").prop('disabled', otp.length < 6);
  1202. // Clear error when typing
  1203. $("#otpError").addClass("hidden").text("");
  1204. }
  1205. function sendOtpRequest() {
  1206. // Re-trigger SendOTP
  1207. $.ajax({
  1208. url: subDomain + '@Url.Action("SendOTP", "Home")',
  1209. type: 'POST',
  1210. success: function(data) {
  1211. if (data.responseCode === "0") {
  1212. startOtpTimer(60);
  1213. showNotification("OTP has been resent.", "success");
  1214. } else {
  1215. showNotification(data.responseMessage || "Failed to resend OTP", data.responseCode);
  1216. }
  1217. }
  1218. });
  1219. }
  1220. function showReceiptSuccess(transId, amount, phone, totalTickets, drawDate) {
  1221. // Setup data dynamically
  1222. $("#receiptAmount").text(formatMoneyV2(amount) + " HTG");
  1223. if(phone) $("#receiptPhone").text(phone);
  1224. if(totalTickets) $("#receiptTotalTickets").text(totalTickets);
  1225. if(drawDate) $("#receiptDrawDate").text(drawDate);
  1226. let gameTypeStr = "@Model.termType";
  1227. let displayName = "Basic Pick 10";
  1228. if (gameTypeStr === "@Constants.PIC10_BIGSMALL_CODE") displayName = "@Lang.millions_big_small";
  1229. else if (gameTypeStr === "@Constants.PIC10_ODDEVEN_CODE") displayName = "@Lang.millions_odd_even";
  1230. else if (gameTypeStr === "@Constants.Millions_CODE") displayName = "Millions";
  1231. $("#receiptGameType").text("@Lang.buy " + displayName);
  1232. $("#receiptTicketCode").text("#" + transId);
  1233. let choiceText = "-";
  1234. if (gameTypeStr === "@Constants.PIC10_BIGSMALL_CODE" || gameTypeStr === "@Constants.PIC10_ODDEVEN_CODE") {
  1235. choiceText = $("#summaryTicketList .flex.items-center span.font-black").first().text().trim();
  1236. } else {
  1237. choiceText = gameTypeStr === "@Constants.Millions_CODE" ? "Millions" : "PICK 10";
  1238. }
  1239. $("#receiptChoice").text(choiceText);
  1240. // Format current date "dd/MM/yyyy - HH:mm:ss"
  1241. let now = new Date();
  1242. 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');
  1243. $("#receiptTime").text(ds);
  1244. hideOtpModal();
  1245. $("#receiptSuccessModal").removeClass("hidden").addClass("flex");
  1246. }
  1247. function finalizePurchase(btn) {
  1248. if (isFinalizingPurchase) return;
  1249. const isWalletPayment = currentChannelPayment === '@Constants.NATCASH_WALLET_TICKET';
  1250. let otpCode = isWalletPayment ? $("#walletPinInput").val().trim() : "";
  1251. if (!isWalletPayment) {
  1252. $("#otpInputs input").each(function() { otpCode += $(this).val(); });
  1253. }
  1254. if ((isWalletPayment && otpCode.length === 0) || (!isWalletPayment && otpCode.length < 6)) {
  1255. showNotification(isWalletPayment ? '@Html.Raw(Lang.payment_wallet_pin_instruction.Replace("'", "\\'"))' : "Please enter full 6-digit OTP", "warning");
  1256. return;
  1257. }
  1258. isFinalizingPurchase = true;
  1259. const originalText = $(btn).html();
  1260. $(btn).prop('disabled', true).html('<i class="fa-solid fa-spinner fa-spin mr-2"></i> ...');
  1261. if (isWalletPayment) {
  1262. submitFinalPurchase(btn, originalText, true, otpCode);
  1263. return;
  1264. }
  1265. // Confirm the OTP first. The final purchase API is called only after
  1266. // this request succeeds for the current prepared transaction.
  1267. $.ajax({
  1268. url: subDomain + '@Url.Action("ConfirmOTP", "Home")',
  1269. type: 'POST',
  1270. contentType: 'application/json',
  1271. data: JSON.stringify({
  1272. otp: otpCode,
  1273. transIdByTicket: currentTransId
  1274. }),
  1275. success: function(otpResult) {
  1276. if (otpResult.responseCode === "0" || otpResult.responseCode === "0000") {
  1277. submitFinalPurchase(btn, originalText, false, null);
  1278. return;
  1279. }
  1280. $(btn).prop('disabled', false).html(originalText);
  1281. isFinalizingPurchase = false;
  1282. $("#otpError").text(otpResult.responseMessage || "Invalid OTP").removeClass("hidden");
  1283. $("#otpInputs input").val("");
  1284. $("#otp1").focus();
  1285. },
  1286. error: function() {
  1287. $(btn).prop('disabled', false).html(originalText);
  1288. isFinalizingPurchase = false;
  1289. showNotification("Network error occurred during OTP verification.", "warning");
  1290. }
  1291. });
  1292. }
  1293. function submitFinalPurchase(btn, originalText, isWalletPayment, walletPin) {
  1294. const finalData = {
  1295. transIdByTicket: currentTransId,
  1296. gameId: isFreeTicketMode ? "@Constants.Millions_CODE" : "@Model.termType",
  1297. paymentCode: null,
  1298. walletPin: isWalletPayment ? walletPin : null,
  1299. channelPayment: currentChannelPayment
  1300. };
  1301. // This final API is unreachable until ConfirmOTP succeeds (or a wallet PIN is supplied).
  1302. $.ajax({
  1303. url: subDomain + '@Url.Action("ConfirmBuyingTicketV2", "Home")',
  1304. type: 'POST',
  1305. contentType: 'application/json',
  1306. data: JSON.stringify(finalData),
  1307. success: function(res) {
  1308. $(btn).prop('disabled', false).html(originalText);
  1309. if (res.responseCode === "0" || res.responseCode === "0000") {
  1310. // Success: Show receipt Modal
  1311. showReceiptSuccess(res.orderId || currentTransId, $("#summaryTotalAmount").text(), "@(Model.userStatus?.msisdn ?? "-")", $("#summaryTotalCount").text(), "@(currentTerm?.date_random ?? "-")");
  1312. } else {
  1313. if (res.responseCode === "-2" || (res.responseMessage && res.responseMessage.includes("System is upgrading"))) {
  1314. hideOtpModal();
  1315. showNotification(res.responseMessage || "System is upgrading", res.responseCode);
  1316. } else {
  1317. $("#otpError").text(res.responseMessage || "Invalid OTP").removeClass("hidden");
  1318. if (isWalletPayment) {
  1319. $("#walletPinInput").val("").focus();
  1320. } else {
  1321. $("#otpInputs input").val("");
  1322. $("#otp1").focus();
  1323. }
  1324. }
  1325. }
  1326. },
  1327. error: function() {
  1328. $(btn).prop('disabled', false).html(originalText);
  1329. showNotification("Network error occurred during payment completion.", "warning");
  1330. },
  1331. complete: function() {
  1332. isFinalizingPurchase = false;
  1333. }
  1334. });
  1335. }
  1336. var systemUpgrading = false;
  1337. function showNotification(message, code) {
  1338. const msgEl = $("#notificationMessage");
  1339. const iconEl = $("#notificationModal img");
  1340. const btnEl = $("#notificationModal button");
  1341. if (message && message.includes("\n")) {
  1342. msgEl.html(message.replace(/\n/g, '<br/>'));
  1343. } else {
  1344. msgEl.text(message);
  1345. }
  1346. if (code === "-2" || (message && message.includes("System is upgrading"))) {
  1347. systemUpgrading = true;
  1348. btnEl.text("@Lang.login");
  1349. } else {
  1350. systemUpgrading = false;
  1351. btnEl.text("OK");
  1352. }
  1353. // Toggle icon based on type (warning or success)
  1354. const warningIcon = '/Millions/img/modal/warning_icon.png';
  1355. const successIcon = '/Millions/img/modal/success_icon_v2.png';
  1356. const fallbackWarning = 'https://cdn-icons-png.flaticon.com/512/564/564619.png';
  1357. const fallbackSuccess = 'https://cdn-icons-png.flaticon.com/512/190/190411.png';
  1358. if (code === "-2" || code === "warning" || code === "error") {
  1359. iconEl.attr('src', warningIcon);
  1360. iconEl.attr('onerror', `this.src='${fallbackWarning}'`);
  1361. } else {
  1362. iconEl.attr('src', successIcon);
  1363. iconEl.attr('onerror', `this.src='${fallbackSuccess}'`);
  1364. }
  1365. $("#notificationModal").removeClass("hidden").addClass("flex");
  1366. }
  1367. function closeNotificationModal() {
  1368. $("#notificationModal").addClass("hidden").removeClass("flex");
  1369. if (systemUpgrading) {
  1370. window.location.href = subDomain + "/Account/Login";
  1371. }
  1372. }
  1373. // ==================== CARD SELECTION GAME LOGIC (BIG/SMALL / ODD/EVEN) ====================
  1374. var bsChoice = null; // 'big' or 'small' (reused as 'odd' or 'even')
  1375. const isBigSmall = @(Model.termType == Constants.PIC10_BIGSMALL_CODE ? "true" : "false");
  1376. const themeColor = isBigSmall ? "#0A9800" : "#AA3DC8";
  1377. const labelBig = isBigSmall ? "Big" : "Odd";
  1378. const labelSmall = isBigSmall ? "Small" : "Even";
  1379. const colorBig = isBigSmall ? "#A2FF00" : "#FFC700";
  1380. const colorSmall = isBigSmall ? "#FF4157" : "#B33BD0";
  1381. // Loclized text from resources
  1382. const langSelect = "@Lang.millions_select";
  1383. const langSelected = "@Lang.millions_selected";
  1384. function selectBigSmall(choice) {
  1385. bsChoice = choice;
  1386. var cardBig = document.getElementById('cardBig');
  1387. var cardSmall = document.getElementById('cardSmall');
  1388. var choiceDisplay = document.getElementById('choiceDisplay');
  1389. if (!cardBig || !cardSmall) return;
  1390. if (choice === 'big') {
  1391. // Highlight Big/Odd card with theme glow
  1392. cardBig.style.border = '2px solid ' + themeColor;
  1393. cardBig.style.boxShadow = '0px 0px 12px 0px ' + (isBigSmall ? 'rgba(162, 255, 0, 1)' : 'rgba(179, 59, 208, 0.6)');
  1394. cardBig.querySelector('.bigsmall-btn').textContent = langSelected;
  1395. cardBig.querySelector('.bigsmall-btn').style.background = '#333';
  1396. // Reset Small/Even card
  1397. cardSmall.style.border = '2px solid transparent';
  1398. cardSmall.style.boxShadow = 'none';
  1399. cardSmall.querySelector('.bigsmall-btn').textContent = langSelect;
  1400. cardSmall.querySelector('.bigsmall-btn').style.background = themeColor;
  1401. // Update display
  1402. if (choiceDisplay) {
  1403. choiceDisplay.textContent = labelBig;
  1404. choiceDisplay.style.color = colorBig;
  1405. choiceDisplay.style.webkitTextStroke = '1px #000';
  1406. }
  1407. } else {
  1408. // Highlight Small/Even card with theme glow
  1409. cardSmall.style.border = '2px solid ' + themeColor;
  1410. cardSmall.style.boxShadow = '0px 0px 12px 0px ' + (isBigSmall ? 'rgba(162, 255, 0, 1)' : 'rgba(179, 59, 208, 0.6)');
  1411. cardSmall.querySelector('.bigsmall-btn').textContent = langSelected;
  1412. cardSmall.querySelector('.bigsmall-btn').style.background = '#333';
  1413. // Reset Big/Odd card
  1414. cardBig.style.border = '2px solid transparent';
  1415. cardBig.style.boxShadow = 'none';
  1416. cardBig.querySelector('.bigsmall-btn').textContent = langSelect;
  1417. cardBig.querySelector('.bigsmall-btn').style.background = themeColor;
  1418. // Update display
  1419. if (choiceDisplay) {
  1420. choiceDisplay.textContent = labelSmall;
  1421. choiceDisplay.style.color = colorSmall;
  1422. choiceDisplay.style.webkitTextStroke = '1px #000';
  1423. }
  1424. }
  1425. $("#bsTotalTicketCount").text(1);
  1426. $("#bsTotalPrice").text(formatMoneyV2(50));
  1427. }
  1428. function bsShowPayment(e) {
  1429. preparePayment(e);
  1430. }
  1431. </script>
  1432. <!-- Number Picker Modal (Refined Bottom Sheet) -->
  1433. <div id="numberPickerModal" class="fixed inset-0 bg-black/10 z-[200] hidden items-end justify-center p-0 transition-all">
  1434. <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">
  1435. <div class="px-4 py-1.5 bg-[#0062FF] text-white flex justify-between items-center relative">
  1436. <div class="flex flex-col">
  1437. <h3 class="font-black text-[15px] uppercase tracking-wide" id="modalTitle">@Lang.Pick_Number</h3>
  1438. <div class="selection-count-area">
  1439. <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>
  1440. </div>
  1441. </div>
  1442. <button onclick="closeNumberPicker()" class="w-8 h-8 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20 transition-all">
  1443. <i class="fa-solid fa-xmark text-lg"></i>
  1444. </button>
  1445. </div>
  1446. <style>
  1447. #numberGrid::-webkit-scrollbar { width: 3px; }
  1448. #numberGrid::-webkit-scrollbar-track { background: transparent; }
  1449. #numberGrid::-webkit-scrollbar-thumb { background: #FFD700; border-radius: 10px; }
  1450. #numberGrid { scrollbar-width: thin; scrollbar-color: #FFD700 transparent; }
  1451. </style>
  1452. <div class="p-2 h-[220px] overflow-hidden bg-gray-50 border-b" id="numberGrid">
  1453. <!-- Populated via JS -->
  1454. </div>
  1455. <div class="p-3 bg-white border-t flex gap-3">
  1456. <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">
  1457. @Lang.millions_back
  1458. </button>
  1459. <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">
  1460. @Lang.confirm
  1461. </button>
  1462. </div>
  1463. </div>
  1464. </div>
  1465. <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">
  1466. <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">
  1467. <!-- Alert Icon -->
  1468. <div class="w-full flex justify-center mb-2 mt-0">
  1469. <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'" />
  1470. </div>
  1471. <!-- Message Area -->
  1472. <div class="px-2 text-center mb-5">
  1473. <p id="notificationMessage" class="text-black font-[800] text-[17px] leading-snug">
  1474. <!-- Message content -->
  1475. </p>
  1476. </div>
  1477. <!-- Action Button -->
  1478. <div class="w-full">
  1479. <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">
  1480. OK
  1481. </button>
  1482. </div>
  1483. </div>
  1484. </div>
  1485. <!-- Beautiful Success Receipt Modal (Matches Figma 161:3722) -->
  1486. <div id="receiptSuccessModal" class="fixed inset-0 z-[300] bg-black/80 hidden items-center justify-center px-4 font-bricolage backdrop-blur-md">
  1487. <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">
  1488. <!-- Confetti/Celebration background effect (Subtle removed) -->
  1489. <h2 class="text-[#534A4A] font-[800] text-[19px] tracking-tight relative z-10 w-full text-center mt-1">@Lang.millions_payment_successfully</h2>
  1490. <!-- Ticket / Success Graphic -->
  1491. <div class="relative w-full flex justify-center mt-2 mb-0 z-10 px-4">
  1492. <img src="/Millions/img/modal/success_icon_v2.png" alt="Success" class="w-full h-auto object-contain">
  1493. </div>
  1494. <h3 class="text-[#0A9800] font-[900] text-[20px] uppercase tracking-wide relative z-10">@Lang.success</h3>
  1495. <div class="w-full h-px border-t-[2px] border-dashed border-gray-300 my-3 relative z-10"></div>
  1496. <div class="w-full flex justify-between items-center mb-2 relative z-10 px-1">
  1497. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.phone_number</span>
  1498. <span class="font-black text-[14px] text-gray-800" id="receiptPhone">-</span>
  1499. </div>
  1500. <div class="w-full flex justify-between items-center mb-2 relative z-10 px-1">
  1501. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.millions_your_choice</span>
  1502. <span class="text-[#0062FF] font-[900] text-[15px] uppercase" id="receiptChoice">-</span>
  1503. </div>
  1504. <div class="w-full flex justify-between items-center mb-2 relative z-10 px-1">
  1505. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.ticket_code</span>
  1506. <span class="font-black text-[13px] text-gray-800" id="receiptTicketCode">#</span>
  1507. </div>
  1508. <div class="w-full flex justify-between items-center mb-2 relative z-10 px-1">
  1509. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.total_ticket</span>
  1510. <span class="font-black text-[14px] text-gray-800" id="receiptTotalTickets">-</span>
  1511. </div>
  1512. <div class="w-full flex justify-between items-center mb-2 relative z-10 px-1">
  1513. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.millions_draw_date</span>
  1514. <span class="font-black text-[14px] text-gray-800" id="receiptDrawDate">-</span>
  1515. </div>
  1516. <div class="w-full flex justify-between items-center mb-1 relative z-10 px-1">
  1517. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.total_payment</span>
  1518. <span class="text-[#0062FF] font-[900] text-[15px]" id="receiptAmount">0 HTG</span>
  1519. </div>
  1520. <div class="w-full h-px border-t-[2px] border-dashed border-gray-300 my-3 relative z-10"></div>
  1521. <div class="w-full flex justify-between items-center mb-2 relative z-10 px-1">
  1522. <span class="text-[#534A4A] font-bold text-[14px]">@Lang.time</span>
  1523. <span class="font-bold text-[13px] text-gray-600" id="receiptTime">00:00:00</span>
  1524. </div>
  1525. <div class="w-full flex justify-start items-center relative z-10 px-1 mt-1">
  1526. <span class="text-[#534A4A] font-bold text-[13px] italic text-gray-500" id="receiptGameType">@Lang.millions_buy_ticket_label</span>
  1527. </div>
  1528. <div class="text-[#534A4A] font-[900] text-[18px] relative z-10 text-center mt-3">@Lang.thank_you <span class="text-[#0062FF]">♥️</span></div>
  1529. <div class="w-full flex gap-2.5 mt-4 relative z-10">
  1530. <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">
  1531. @Lang.millions_continue
  1532. </button>
  1533. <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">
  1534. @Lang.close
  1535. </button>
  1536. </div>
  1537. </div>
  1538. </div>
  1539. }