BuyTicket.cshtml 99 KB

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