GameHome.cshtml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. @model LotteryWebApp.Models.HomeIndex_ViewModel
  2. @{
  3. ViewData["Title"] = "LotteryV2 - Game Home";
  4. Layout = "~/Areas/LotteryV2/Views/Shared/_Layout.cshtml";
  5. }
  6. @using LotteryWebApp.Languages;
  7. @using LotteryWebApp.Controllers;
  8. @using LotteryWebApp.Common;
  9. <div class="main-container animate__animated animate__fadeIn bg-[#F5F5F5] min-h-screen">
  10. <!-- Top Account Profile Bar / Backgound Red header -->
  11. <div class="w-full bg-[#EE0033] p-4 text-white rounded-b-0xl shadow-md">
  12. <!-- Row 1: Profile Info -->
  13. <div class="flex items-center gap-4">
  14. <div class="w-16 h-16 rounded-full border-2 border-white/60 overflow-hidden bg-[#FFE] shadow-sm">
  15. <img src="https://api.dicebear.com/7.x/avataaars/svg?seed=Ngan" alt="Avatar" class="w-full h-full object-cover">
  16. </div>
  17. <div>
  18. <div class="font-bold text-sm tracking-wide opacity-90">@(Model?.profile?.users ?? "User")</div>
  19. <div class="flex items-center gap-1 mt-0.5">
  20. <span class="text-3xl font-black text-[#FBF3A7]" style="text-shadow: 0 1px 2px rgba(0,0,0,0.2)">@(Model?.userStatus?.bet_coin ?? "0")</span>
  21. <span class="text-xs font-bold text-[#FBF3A7] uppercase mt-1">@Lang.v2_htg</span>
  22. </div>
  23. </div>
  24. </div>
  25. <!-- Row 2: Pill Actions Full Width Split -->
  26. <div class="grid grid-cols-2 gap-3 mt-4">
  27. <a onclick="checkTerm('@Constants.PIC10_BASIC_CODE')" class="btn-pulse border border-white/50 rounded-xl py-2 px-3 flex items-center justify-center gap-1 text-xr font-extrabold bg-white/10 hover:bg-white/20 transition-all text-white no-underline">
  28. <span class="text-yellow-300 text-xl">⚡</span> @Lang.quick_pick
  29. </a>
  30. <a href="/LotteryV2/Home/Results" class="btn-pulse border border-white/50 rounded-xl py-2 px-3 flex items-center justify-center gap-1 text-xr font-extrabold bg-white/10 hover:bg-white/20 transition-all text-white no-underline">
  31. <span class="text-yellow-300 text-xl">🎫</span> @Lang.results
  32. </a>
  33. </div>
  34. <!-- Row 3: Withdraw Button Full Width -->
  35. <div class="w-full mt-3">
  36. <button onclick="location.href='@Url.Action("TransferWinMoney", "Home")'" class="btn-pulse w-full text-black font-black py-3 rounded-2xl text-[18px] flex items-center justify-center gap-2 shadow-lg transition-all" style="background: linear-gradient(118deg, #19EF4B 0%, #C0FF4B 100%);">
  37. <span>@Lang.tranfer_win_money</span>
  38. <img src="/LotteryV2/img/gold_wallet.png" alt="Wallet" class="w-6 h-6 object-contain">
  39. </button>
  40. </div>
  41. </div>
  42. <!-- Countdown Timer Bar with Scalloped bottom divider background -->
  43. <div class="relative w-full overflow-hidden" style="background-image: url('/LotteryV2/img/wavy_border.svg'); background-size: 102% 100%; background-position: center; background-repeat: no-repeat; height: 114px;">
  44. <!-- Top border red line -->
  45. <div class="absolute top-0 left-0 w-full h-[1.5px] bg-[#EE0033]"></div>
  46. <div class="flex items-center justify-between px-5 pt-7 relative z-10">
  47. <!-- Left: Draw Date -->
  48. <div class="flex items-center gap-1 flex-1 min-w-0">
  49. <div class="w-8 h-8 flex-shrink-0">
  50. <img src="/LotteryV2/img/calendar_icon_3d.png" alt="Calendar" class="w-full h-full object-contain" onerror="this.src='/LotteryV2/img/icon_calendar.svg'">
  51. </div>
  52. <div class="flex flex-col min-w-0">
  53. <span class="text-[11px] text-[#A1A1A1] font-bold leading-none mb-1">Next Pick 10 draw</span>
  54. <span class="text-[12px] font-[900] text-black tracking-tight leading-none" id="draw-date">Friday, Mar 20, 2026</span>
  55. </div>
  56. </div>
  57. <!-- Middle: Dashed Divider -->
  58. <div class="h-10 w-px border-l border-dashed border-gray-300 mx-2"></div>
  59. <!-- Right: Timer -->
  60. <div class="flex gap-3.5 shrink-0">
  61. <div class="flex flex-col items-center">
  62. <span class="text-[12px] text-black font-semibold">@Lang.hours</span>
  63. <span class="text-[26px] font-[1000] text-black leading-none font-bricolage" id="countdown-hours">82</span>
  64. </div>
  65. <div class="flex flex-col items-center">
  66. <span class="text-[12px] text-black font-semibold">@Lang.Minutes</span>
  67. <span class="text-[26px] font-[1000] text-black leading-none font-bricolage" id="countdown-minutes">50</span>
  68. </div>
  69. <div class="flex flex-col items-center">
  70. <span class="text-[12px] text-black font-semibold">@Lang.Secs</span>
  71. <span class="text-[26px] font-[1000] text-black leading-none font-bricolage" id="countdown-seconds">55</span>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. <!-- Anti-forgery token for AJAX -->
  77. @Html.AntiForgeryToken()
  78. <!-- Card list items with accurate illustrations -->
  79. <div class="px-3 flex flex-col gap-2 pb-40 relative z-10 mt-[14px]">
  80. <!-- Game item 1: Basic Pick 10 -->
  81. <div class="relative w-full h-[120px] rounded-2xl overflow-hidden shadow-xl font-bricolage transition-all duration-300 active:scale-[0.98] cursor-pointer card-red" onclick="checkTerm('@Constants.PIC10_BASIC_CODE')">
  82. <!-- 1. Premium Gradient Border -->
  83. <div class="absolute inset-0 rounded-2xl border-[1.5px] border-white/40 pointer-events-none z-20"></div>
  84. <!-- 2. Decorative Highlights -->
  85. <img src="/LotteryV2/img/decorations/ellipse_1183.png" class="absolute -left-[80px] -top-[130px] w-[220px] h-[220px] pointer-events-none z-10 mix-blend-screen scale-y-[-1]" alt="highlight">
  86. <img src="/LotteryV2/img/decorations/ellipse_1181.png" class="absolute -right-[60px] -top-[20px] w-[200px] h-[200px] pointer-events-none z-10 mix-blend-screen" alt="highlight">
  87. <div class="absolute inset-0 grid grid-cols-10 items-center px-3 z-20 gap-0">
  88. <!-- Left: Basic Pick + Ball (3 columns) -->
  89. <div class="col-span-3 flex items-center h-full pl-1 relative">
  90. <!-- Text Layout -->
  91. <div class="flex flex-col items-center leading-[0.85] relative z-10 font-UTM_Futura_Extra">
  92. <span class="text-white font-[900] text-[16px] drop-shadow-md">@Lang.Basic</span>
  93. <span class="font-[900] text-[30px] drop-shadow-lg leading-[0.9]" style="background: linear-gradient(180deg, #FFFFFF 20%, #FFF307 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">@Lang.Pick</span>
  94. <!-- Floating Bubbles (Matching Image) -->
  95. <div class="absolute top-[-4px] right-[-4px] w-2.5 h-2.5 bg-white rounded-full shadow-sm"></div>
  96. <div class="absolute top-[18px] right-[-6px] w-2 h-2 bg-yellow-400 rounded-full shadow-sm"></div>
  97. <div class="absolute bottom-[-6px] left-[10px] w-1.5 h-1.5 bg-white rounded-full opacity-80"></div>
  98. </div>
  99. <!-- Single Ball 10 (Yellow) -->
  100. <div class="relative w-[36px] h-[36px] flex-shrink-0 -ml-18 aspect-square z-20">
  101. <div class="w-full h-full bg-[#FFDE59] rounded-full border-[2.5px] border-white flex items-center justify-center shadow-lg">
  102. <span class="text-black font-[900] text-[18px] leading-none mb-0.5">10</span>
  103. </div>
  104. <!-- Extra decorative dot overlapping ball -->
  105. <div class="absolute top-1 -left-1 w-2 h-2 bg-white rounded-full shadow-sm"></div>
  106. </div>
  107. </div>
  108. <!-- Center: Jackpot info (4 columns) -->
  109. <div class="col-span-4 flex flex-col items-center justify-center text-center">
  110. <div class="text-[14px] font-bold text-white mb-0.5 whitespace-nowrap opacity-90">@Lang.jackpot_prize</div>
  111. <div class="flex items-start gap-0.5">
  112. <span class="text-[26px] font-black text-[#FBF3A7] leading-none" style="text-shadow: 0 4px 8px rgba(0,0,0,0.3)">100.000</span>
  113. <span class="text-[9px] font-bold text-white uppercase opacity-90 mt-1">@Lang.v2_htg</span>
  114. </div>
  115. <div class="text-[12px] text-white/90 font-medium whitespace-nowrap mt-1">@Lang.next_round <span class="font-black text-yellow-300 ml-1 countdown-timer">00:00:00</span></div>
  116. </div>
  117. <!-- Right: Action Section (3 columns) -->
  118. <div class="col-span-3 flex flex-col items-center justify-end h-full pb-3.5 relative">
  119. <img src="/LotteryV2/img/gold_chest.png" alt="Chest" class="absolute bottom-[38px] w-18 h-20 object-contain filter drop-shadow-lg z-10">
  120. <button class="text-black font-black px-3 w-full py-1.5 rounded-[12px] text-[13px] shadow-xl border border-white/50 hover:brightness-110 active:scale-95 transition-all relative z-0" style="background: linear-gradient(180deg, #FFF385 0%, #EFAD19 100%);">@Lang.rule_play_now</button>
  121. </div>
  122. </div>
  123. </div>
  124. <!-- Game item 2: Big/Small -->
  125. <div class="relative w-full h-[120px] rounded-2xl overflow-hidden shadow-xl font-bricolage transition-all duration-300 active:scale-[0.98] cursor-pointer card-shadow text-white border border-white/10" style="background-color: rgb(38 163 30);" onclick="checkTerm('@Constants.PIC10_BIGSMALL_CODE')">
  126. <!-- 1. Premium Gradient Border -->
  127. <div class="absolute inset-0 rounded-2xl border-[1.5px] border-white/40 pointer-events-none z-20"></div>
  128. <!-- 2. Decorative Highlights -->
  129. <img src="/LotteryV2/img/decorations/ellipse_1183.png" class="absolute -left-[80px] -top-[130px] w-[220px] h-[220px] pointer-events-none z-10 mix-blend-screen scale-y-[-1]" alt="highlight">
  130. <img src="/LotteryV2/img/decorations/ellipse_1181.png" class="absolute -right-[60px] -top-[20px] w-[200px] h-[200px] pointer-events-none z-10 mix-blend-screen" alt="highlight">
  131. <div class="absolute inset-0 grid grid-cols-10 items-center px-3 z-20 gap-0">
  132. <!-- Left: Big/Small + Ball (3 columns) -->
  133. <div class="col-span-3 flex items-center h-full pl-1 relative">
  134. <!-- Text Layout -->
  135. <div class="flex flex-col items-center leading-[0.85] relative z-10 font-UTM_Futura_Extra">
  136. <span class="text-white font-[900] text-[16px] drop-shadow-md">@Lang.Small</span>
  137. <span class="font-[900] text-[30px] drop-shadow-lg leading-[0.9]" style="background: linear-gradient(180deg, #FFFFFF 20%, #89FF77 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">@Lang.Big</span>
  138. <!-- Decorative dots (Bubbles) -->
  139. <div class="absolute -top-1 -right-1 w-2.5 h-2.5 bg-white/40 rounded-full blur-[1px]"></div>
  140. <div class="absolute top-1/2 -right-5 w-2 h-2 bg-white rounded-full shadow-sm opacity-90"></div>
  141. <div class="absolute -bottom-2 left-6 w-1.5 h-1.5 bg-yellow-200 rounded-full opacity-80"></div>
  142. <div class="absolute top-2 -left-2 w-1.5 h-1.5 bg-white/60 rounded-full"></div>
  143. </div>
  144. <!-- Single Ball 88 -->
  145. <div class="relative w-[48px] h-[48px] flex-shrink-0 -ml-18 mt-1 aspect-square z-20">
  146. <img src="/LotteryV2/img/ball_88.png" alt="88" class="w-full h-full object-contain filter drop-shadow-[0_4px_10px_rgba(0,0,0,0.5)]">
  147. <!-- Extra small decorative white dot near ball -->
  148. <div class="absolute -top-1 -right-1 w-2.5 h-2.5 bg-white rounded-full shadow-sm"></div>
  149. <div class="absolute -bottom-1 left-0 w-1.5 h-1.5 bg-white/50 rounded-full"></div>
  150. </div>
  151. </div>
  152. <!-- Center: Jackpot info (4 columns) -->
  153. <div class="col-span-4 flex flex-col items-center justify-center text-center">
  154. <div class="text-[14px] font-bold text-white mb-0.5 whitespace-nowrap opacity-90">@Lang.jackpot_prize</div>
  155. <div class="flex items-start gap-0.5">
  156. <span class="text-[26px] font-black text-[#FBF3A7] leading-none" style="text-shadow: 0 4px 8px rgba(0,0,0,0.3)">100</span>
  157. <span class="text-[9px] font-bold text-white uppercase opacity-90 mt-1">@Lang.v2_htg</span>
  158. </div>
  159. <div class="text-[12px] text-white/90 font-medium whitespace-nowrap mt-1">@Lang.next_round <span class="font-black text-yellow-300 ml-1 countdown-timer">00:00:00</span></div>
  160. </div>
  161. <!-- Right: Action Section (3 columns) -->
  162. <div class="col-span-3 flex flex-col items-center justify-end h-full pb-3.5 relative">
  163. <img src="/LotteryV2/img/gold_bag.png" alt="Bag" class="absolute bottom-[38px] w-18 h-20 object-contain filter drop-shadow-lg z-10">
  164. <button class="text-black font-black px-3 w-full py-1.5 rounded-[12px] text-[13px] shadow-xl border border-white/50 hover:brightness-110 active:scale-95 transition-all relative z-0" style="background: linear-gradient(180deg, #FFF385 0%, #EFAD19 100%);">@Lang.rule_play_now</button>
  165. </div>
  166. </div>
  167. </div>
  168. <!-- Game item 3: @Lang.odd_even -->
  169. <div class="relative w-full h-[120px] rounded-2xl overflow-hidden shadow-xl font-bricolage transition-all duration-300 active:scale-[0.98] cursor-pointer card-shadow text-white border border-white/10" style="background-color: rgb(213 45 233);" onclick="checkTerm('@Constants.PIC10_ODDEVEN_CODE')">
  170. <!-- 1. Premium Gradient Border -->
  171. <div class="absolute inset-0 rounded-2xl border-[1.5px] border-white/40 pointer-events-none z-20"></div>
  172. <!-- 2. Decorative Highlights -->
  173. <img src="/LotteryV2/img/decorations/ellipse_1183.png" class="absolute -left-[80px] -top-[130px] w-[220px] h-[220px] pointer-events-none z-10 mix-blend-screen scale-y-[-1]" alt="highlight">
  174. <img src="/LotteryV2/img/decorations/ellipse_1181.png" class="absolute -right-[60px] -top-[20px] w-[200px] h-[200px] pointer-events-none z-10 mix-blend-screen" alt="highlight">
  175. <div class="absolute inset-0 grid grid-cols-10 items-center px-3 z-20 gap-0">
  176. <!-- Left: Odd/Even + Balls (3 columns) -->
  177. <div class="col-span-3 flex items-center h-full pl-1 relative">
  178. <!-- Text Layout -->
  179. <div class="flex flex-col items-center leading-[0.85] relative z-10 font-UTM_Futura_Extra">
  180. <span class="text-white font-[900] text-[16px] drop-shadow-md">@Lang.Odd</span>
  181. <span class="font-[900] text-[30px] drop-shadow-lg leading-[0.9]" style="background: linear-gradient(180deg, #FFFFFF 20%, #F29CFF 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">@Lang.Even</span>
  182. <!-- Decorative dots (Bubbles) -->
  183. <div class="absolute -top-2 -right-2 w-3 h-3 bg-white/30 rounded-full blur-[1px]"></div>
  184. <div class="absolute top-1/2 -right-5 w-2 h-2 bg-yellow-300 rounded-full shadow-sm"></div>
  185. <div class="absolute -top-1 -left-1 w-1.5 h-1.5 bg-white/50 rounded-full"></div>
  186. <div class="absolute -bottom-2 right-2 w-1.5 h-1.5 bg-white rounded-full opacity-80"></div>
  187. </div>
  188. <!-- Balls Overlapping -->
  189. <div class="relative w-[60px] h-[60px] flex-shrink-0 -ml-18 -mt-1 aspect-square z-20">
  190. <!-- Ball 3 (Yellow) -->
  191. <div class="absolute left-0 top-0 w-8 h-8 rounded-full shadow-lg z-0">
  192. <img src="/LotteryV2/img/ball_3.png" alt="3" class="w-full h-full object-contain">
  193. </div>
  194. <!-- Ball 20 (Pink/Magenta) -->
  195. <div class="absolute left-4 top-3 w-9 h-9 rounded-full shadow-xl z-10">
  196. <img src="/LotteryV2/img/ball_20.png" alt="20" class="w-full h-full object-contain border-2 border-white/20 rounded-full">
  197. </div>
  198. <!-- Small highlight dot near ball -->
  199. <div class="absolute -top-1 right-2 w-1.5 h-1.5 bg-white rounded-full shadow-sm opacity-90"></div>
  200. </div>
  201. </div>
  202. <!-- Center: Jackpot info (4 columns) -->
  203. <div class="col-span-4 flex flex-col items-center justify-center text-center">
  204. <div class="text-[14px] font-bold text-white mb-0.5 whitespace-nowrap opacity-90">@Lang.jackpot_prize</div>
  205. <div class="flex items-start gap-0.5">
  206. <span class="text-[26px] font-black text-[#FBF3A7] leading-none" style="text-shadow: 0 4px 8px rgba(0,0,0,0.3)">200</span>
  207. <span class="text-[9px] font-bold text-white uppercase opacity-90 mt-1">@Lang.v2_htg</span>
  208. </div>
  209. <div class="text-[12px] text-white/90 font-medium whitespace-nowrap mt-1">@Lang.next_round <span class="font-black text-yellow-300 ml-1 countdown-timer">00:00:00</span></div>
  210. </div>
  211. <!-- Right: Action Section (3 columns) -->
  212. <div class="col-span-3 flex flex-col items-center justify-end h-full pb-3.5 relative">
  213. <img src="/LotteryV2/img/gold_wallet.png" alt="Wallet" class="absolute bottom-[38px] w-18 h-20 object-contain filter drop-shadow-lg z-10">
  214. <button class="text-black font-black px-3 w-full py-1.5 rounded-[12px] text-[13px] shadow-xl border border-white/50 hover:brightness-110 active:scale-95 transition-all relative z-0" style="background: linear-gradient(180deg, #FFF385 0%, #EFAD19 100%);">@Lang.rule_play_now</button>
  215. </div>
  216. </div>
  217. </div>
  218. </div>
  219. <!-- Banner Info Section centered red text bar -->
  220. <div class="fixed bottom-[74px] left-0 md:left-1/2 md:-translate-x-1/2 w-full md:max-w-[414px] bg-[#EE0033] text-white py-2 text-center text-[13px] font-bold tracking-wide z-40 flex flex-col items-center justify-center overflow-hidden h-auto shadow-md">
  221. <div class="flex flex-col items-center w-full animate-slide-up">
  222. <!-- Row 1 -->
  223. <div class="opacity-90">@Lang.have_chance_to_get</div>
  224. <!-- Row 2 -->
  225. <div class="text-[20px] font-black text-[#FBF3A7] mt-0.5">
  226. @Lang.jackpot_today_htg
  227. </div>
  228. </div>
  229. </div>
  230. <!-- Custom Notification Modal (Branded design from Profile) -->
  231. <div id="notificationModal" class="fixed inset-0 z-[100] flex items-center justify-center hidden px-6 font-bricolage" style="background: linear-gradient(135deg, rgba(26, 26, 46, 0.9) 0%, rgba(22, 33, 62, 0.9) 100%);">
  232. <div class="w-full max-w-[343px] min-h-[480px] bg-white rounded-[24px] overflow-hidden flex flex-col items-center p-8 animate__animated animate__zoomIn animate__faster shadow-2xl">
  233. <!-- Alert Icon -->
  234. <div class="w-full flex justify-center mb-8 mt-6">
  235. <img src="/LotteryV2/img/modal/fail_icon.png" class="w-[180px] h-auto object-contain" alt="Notificaton icon" />
  236. </div>
  237. <!-- Message Area -->
  238. <div class="px-2 text-center mb-10 flex-1 flex items-center justify-center">
  239. <p id="notificationMessage" class="text-black font-[800] text-[22px] leading-snug">
  240. <!-- Message content -->
  241. </p>
  242. </div>
  243. <!-- Action Button -->
  244. <div class="w-full">
  245. <button onclick="closeNotificationModal()" class="w-full bg-[#EE0033] text-white font-[800] text-[20px] py-[12px] rounded-[14px] shadow-lg active:scale-95 transition-all">
  246. @Lang.try_again
  247. </button>
  248. </div>
  249. </div>
  250. </div>
  251. <!-- Bottom Navbar shared component -->
  252. <partial name="_BottomNavbar" />
  253. </div>
  254. @section Scripts {
  255. <script>
  256. function showNotification(message) {
  257. $("#notificationMessage").text(message);
  258. $("#notificationModal").removeClass("hidden").addClass("flex");
  259. }
  260. function closeNotificationModal() {
  261. $("#notificationModal").addClass("hidden").removeClass("flex");
  262. }
  263. let isCheckingTerm = false;
  264. function checkTerm(termType) {
  265. if (isCheckingTerm) return;
  266. isCheckingTerm = true;
  267. // Get anti-forgery token from the page
  268. var token = $('input[name="__RequestVerificationToken"]').val();
  269. // Show loading or disable buttons if needed
  270. $.ajax({
  271. url: subDomain + '/LotteryV2/Home/TermResult',
  272. type: 'POST',
  273. data: {
  274. __RequestVerificationToken: token,
  275. termType: termType
  276. },
  277. success: function (res) {
  278. if (res.responseCode === "0") {
  279. if (res.listTerm && res.listTerm.length > 0) {
  280. var status = res.listTerm[0].status;
  281. if (status === "0" || status === "1") {
  282. location.href = subDomain + '/LotteryV2/Home/BuyTicket?termType=' + termType;
  283. return;
  284. } else if (status === "2") {
  285. showNotification("@Lang.v2_game_locked");
  286. } else if (status === "3") {
  287. showNotification("@Lang.v2_updating_results");
  288. } else {
  289. showNotification("@Lang.v2_game_locked");
  290. }
  291. } else {
  292. showNotification("@Lang.no_results_found");
  293. }
  294. } else if (res.responseCode === "401") {
  295. window.location.href = subDomain + "/Account/Login";
  296. return;
  297. } else {
  298. showNotification(res.responseMessage || "@Lang.error_happened");
  299. }
  300. isCheckingTerm = false;
  301. },
  302. error: function (err) {
  303. showNotification("@Lang.error_happened");
  304. isCheckingTerm = false;
  305. }
  306. });
  307. }
  308. function startCountdown() {
  309. const targetHour = 20; // 20:00 (8h tối)
  310. const now = new Date();
  311. let target = new Date();
  312. target.setHours(targetHour, 0, 0, 0);
  313. if (now >= target) {
  314. target.setDate(target.getDate() + 1);
  315. }
  316. // Định dạng ngày hiển thị (VD: Friday, Mar 20, 2026)
  317. const options = { weekday: 'long', month: 'short', day: 'numeric', year: 'numeric' };
  318. const dateText = target.toLocaleDateString('en-US', options);
  319. document.getElementById('draw-date').innerText = dateText;
  320. function updateTime() {
  321. const current = new Date();
  322. const diff = target - current;
  323. if (diff <= 0) {
  324. target.setDate(target.getDate() + 1);
  325. const updatedDateText = target.toLocaleDateString('en-US', options);
  326. document.getElementById('draw-date').innerText = updatedDateText;
  327. updateTime();
  328. return;
  329. }
  330. const hours = Math.floor((diff / (1000 * 60 * 60)));
  331. const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
  332. const seconds = Math.floor((diff % (1000 * 60)) / 1000);
  333. document.getElementById('countdown-hours').innerText = hours.toString().padStart(2, '0');
  334. document.getElementById('countdown-minutes').innerText = minutes.toString().padStart(2, '0');
  335. document.getElementById('countdown-seconds').innerText = seconds.toString().padStart(2, '0');
  336. // Update all card timers
  337. const timeStr = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
  338. document.querySelectorAll('.countdown-timer').forEach(t => t.innerText = timeStr);
  339. }
  340. updateTime();
  341. setInterval(updateTime, 1000);
  342. }
  343. document.addEventListener('DOMContentLoaded', startCountdown);
  344. </script>
  345. }