BuyTicket.cshtml 104 KB

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