BuyTicket.cshtml 72 KB

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