BuyTicket.cshtml 79 KB

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