BuyTicket.cshtml 79 KB

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