GameHome.cshtml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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?.fullName ?? "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 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-xs 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. <button class="btn-pulse border border-white/50 rounded-xl py-2 px-3 flex items-center justify-center gap-1 text-xs font-extrabold bg-white/10 hover:bg-white/20 transition-all">
  31. <span>🎫</span> @Lang.my_ticket
  32. </button>
  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" style="background-image: url('/LotteryV2/img/wavy_border.svg'); background-size: 100% 100%; background-repeat: no-repeat; height: 114px;">
  44. <!-- Inner Absolute centering to match SVG border limits correctly -->
  45. <div class="absolute inset-0 flex items-start justify-between px-6 pt-6 text-gray-800">
  46. <div class="flex items-center gap-2">
  47. <div class="bg-red-50 p-1.5 rounded-lg text-[#EE0033]">
  48. <img src="/LotteryV2/img/icon_calendar.svg" alt="Calendar" class="w-5 h-5">
  49. </div>
  50. <div>
  51. <div class="text-[10px] text-gray-400 font-bold">@Lang.next_draw</div>
  52. <div class="text-xs font-black text-gray-800" id="draw-date">Friday, Mar 20, 2026</div>
  53. </div>
  54. </div>
  55. <!-- Timer Boxes -->
  56. <div class="flex gap-3 text-center">
  57. <div class="flex flex-col"><span class="text-xl font-black text-gray-800" id="countdown-hours">00</span><span class="text-[8px] text-gray-400 font-extrabold uppercase mt-0.5">@Lang.hours</span></div>
  58. <div class="text-gray-400 font-bold pt-1">:</div>
  59. <div class="flex flex-col"><span class="text-xl font-black text-gray-800" id="countdown-minutes">00</span><span class="text-[8px] text-gray-400 font-extrabold uppercase mt-0.5">@Lang.mins</span></div>
  60. <div class="text-gray-400 font-bold pt-1">:</div>
  61. <div class="flex flex-col"><span class="text-xl font-black text-gray-800" id="countdown-seconds">00</span><span class="text-[8px] text-gray-400 font-extrabold uppercase mt-0.5">@Lang.seconds</span></div>
  62. </div>
  63. </div>
  64. </div>
  65. <!-- Anti-forgery token for AJAX -->
  66. @Html.AntiForgeryToken()
  67. <!-- Card list items with accurate illustrations -->
  68. <div class="px-3 flex flex-col gap-3 pb-40 relative z-10 mt-[5px]">
  69. <!-- Game item 1: Basic Pick 10 -->
  70. <div class="w-full bg-[#E11D48] p-3.5 rounded-2xl relative overflow-hidden card-shadow text-white border border-white/10 filter brightness-105 cursor-pointer transform active:scale-[0.98] transition-all" onclick="checkTerm('@Constants.PIC10_BASIC_CODE')">
  71. <div class="absolute -left-6 -top-6 w-16 h-16 bg-white/10 rounded-full blur-xl"></div>
  72. <div class="grid grid-cols-10 items-center">
  73. <div class="col-span-3 flex flex-col items-start">
  74. <div class="text-[12px] font-black italic tracking-wider">@Lang.basic_account</div>
  75. <div class="text-xs font-black italic tracking-wider text-yellow-300 -mt-0.5 flex items-center gap-1">
  76. <span>Pick</span>
  77. <img src="/LotteryV2/img/ball_10.png" alt="10" class="w-5 h-5 object-contain">
  78. </div>
  79. </div>
  80. <div class="col-span-4 flex flex-col items-center text-center">
  81. <div class="text-[12px] uppercase font-bold text-white/80">@Lang.jackpot_prize</div>
  82. <div class="text-xl font-extrabold text-[#FBF3A7] tracking-wider">100.000 <span class="text-[10px] font-bold">@Lang.v2_htg</span></div>
  83. <div class="text-[10px] mt-1 flex gap-1 items-center">@Lang.next_round <span class="font-bold text-yellow-300">05:00</span></div>
  84. </div>
  85. <div class="col-span-3 flex flex-col justify-end items-center h-full relative">
  86. <img src="/LotteryV2/img/gold_chest.png" alt="Chest" class="w-14 h-14 object-contain filter drop-shadow-md">
  87. <button class="bg-gradient-to-b from-yellow-300 to-yellow-400 text-red-700 font-extrabold px-3 py-1 rounded-xl text-[12px] shadow-sm mt-1">@Lang.play</button>
  88. </div>
  89. </div>
  90. </div>
  91. <!-- Game item 2: Big/Small -->
  92. <div class="w-full p-3.5 rounded-2xl relative overflow-hidden card-shadow text-white border border-white/10 cursor-pointer transform active:scale-[0.98] transition-all" style="background-color: rgb(38 163 30);" onclick="checkTerm('@Constants.PIC10_BIGSMALL_CODE')">
  93. <div class="absolute -left-6 -top-6 w-16 h-16 bg-white/10 rounded-full blur-xl"></div>
  94. <div class="grid grid-cols-10 items-center">
  95. <div class="col-span-3 flex flex-col items-start">
  96. <div class="text-[12px] font-black italic tracking-wide">@Lang.small_big</div>
  97. <div class="flex items-center gap-1 mt-1">
  98. <img src="/LotteryV2/img/ball_88.png" alt="88" class="w-5 h-5 object-contain">
  99. </div>
  100. </div>
  101. <div class="col-span-4 flex flex-col items-center text-center">
  102. <div class="text-[12px] uppercase font-bold text-white/80">@Lang.jackpot_prize</div>
  103. <div class="text-xl font-extrabold text-[#FBF3A7] tracking-wider">100 <span class="text-[10px] font-bold">@Lang.v2_htg</span></div>
  104. <div class="text-[10px] mt-1 flex gap-1 items-center">@Lang.next_round <span class="font-bold text-yellow-300">05:00</span></div>
  105. </div>
  106. <div class="col-span-3 flex flex-col justify-end items-center h-full relative">
  107. <img src="/LotteryV2/img/gold_bag.png" alt="Bag" class="w-14 h-14 object-contain filter drop-shadow-md">
  108. <button class="bg-gradient-to-b from-yellow-300 to-yellow-400 text-emerald-800 font-extrabold px-3 py-1 rounded-xl text-[12px] shadow-sm mt-1">@Lang.play</button>
  109. </div>
  110. </div>
  111. </div>
  112. <!-- Game item 3: @Lang.odd_even -->
  113. <div class="w-full p-3.5 rounded-2xl relative overflow-hidden card-shadow text-white border border-white/10 cursor-pointer transform active:scale-[0.98] transition-all" style="background-color: rgb(213 45 233);" onclick="checkTerm('@Constants.PIC10_ODDEVEN_CODE')">
  114. <div class="absolute -left-6 -top-6 w-16 h-16 bg-white/10 rounded-full blur-xl"></div>
  115. <div class="grid grid-cols-10 items-center">
  116. <div class="col-span-3 flex flex-col items-start">
  117. <div class="text-[12px] font-black italic tracking-wide">@Lang.odd_even</div>
  118. <div class="flex items-center gap-1 mt-1">
  119. <img src="/LotteryV2/img/ball_3.png" alt="3" class="w-4 h-4 object-contain">
  120. <img src="/LotteryV2/img/ball_20.png" alt="20" class="w-5 h-5 object-contain -ml-1">
  121. </div>
  122. </div>
  123. <div class="col-span-4 flex flex-col items-center text-center">
  124. <div class="text-[12px] uppercase font-bold text-white/80">@Lang.jackpot_prize</div>
  125. <div class="text-xl font-extrabold text-[#FBF3A7] tracking-wider">200 <span class="text-[10px] font-bold">@Lang.v2_htg</span></div>
  126. <div class="text-[10px] mt-1 flex gap-1 items-center">@Lang.next_round <span class="font-bold text-yellow-300">05:00</span></div>
  127. </div>
  128. <div class="col-span-3 flex flex-col justify-end items-center h-full relative">
  129. <img src="/LotteryV2/img/gold_wallet.png" alt="Wallet" class="w-14 h-14 object-contain filter drop-shadow-md">
  130. <button class="bg-gradient-to-b from-yellow-300 to-yellow-400 text-blue-800 font-extrabold px-3 py-1 rounded-xl text-[12px] shadow-sm mt-1">@Lang.play</button>
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. <!-- Banner Info Section centered red text bar -->
  136. <div class="fixed bottom-[74px] left-1/2 -translate-x-1/2 w-full max-w-[414px] bg-[#EE0033] text-white py-2 text-center text-[12px] font-bold tracking-wide z-40 flex flex-col items-center justify-center overflow-hidden h-auto shadow-md">
  137. <div class="flex flex-col items-center w-full animate-slide-up">
  138. <!-- Row 1 -->
  139. <div class="opacity-90">@Lang.have_chance_to_get</div>
  140. <!-- Row 2 -->
  141. <div class="text-[18px] font-black text-[#FBF3A7] mt-0.5">
  142. @Lang.jackpot_today_htg
  143. </div>
  144. </div>
  145. </div>
  146. <!-- Custom Notification Modal (Branded design from Profile) -->
  147. <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%);">
  148. <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">
  149. <!-- Alert Icon -->
  150. <div class="w-full flex justify-center mb-8 mt-6">
  151. <img src="/LotteryV2/img/modal/fail_icon.png" class="w-[180px] h-auto object-contain" alt="Notificaton icon" />
  152. </div>
  153. <!-- Message Area -->
  154. <div class="px-2 text-center mb-10 flex-1 flex items-center justify-center">
  155. <p id="notificationMessage" class="text-black font-[800] text-[22px] leading-snug">
  156. <!-- Message content -->
  157. </p>
  158. </div>
  159. <!-- Action Button -->
  160. <div class="w-full">
  161. <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">
  162. @Lang.try_again
  163. </button>
  164. </div>
  165. </div>
  166. </div>
  167. <!-- Bottom Navbar shared component -->
  168. <partial name="_BottomNavbar" />
  169. </div>
  170. @section Scripts {
  171. <script>
  172. function showNotification(message) {
  173. $("#notificationMessage").text(message);
  174. $("#notificationModal").removeClass("hidden").addClass("flex");
  175. }
  176. function closeNotificationModal() {
  177. $("#notificationModal").addClass("hidden").removeClass("flex");
  178. }
  179. let isCheckingTerm = false;
  180. function checkTerm(termType) {
  181. if (isCheckingTerm) return;
  182. isCheckingTerm = true;
  183. // Get anti-forgery token from the page
  184. var token = $('input[name="__RequestVerificationToken"]').val();
  185. // Show loading or disable buttons if needed
  186. $.ajax({
  187. url: subDomain + '/LotteryV2/Home/TermResult',
  188. type: 'POST',
  189. data: {
  190. __RequestVerificationToken: token,
  191. termType: termType
  192. },
  193. success: function (res) {
  194. if (res.responseCode === "0") {
  195. if (res.listTerm && res.listTerm.length > 0) {
  196. var status = res.listTerm[0].status;
  197. if (status === "0" || status === "1") {
  198. location.href = subDomain + '/LotteryV2/Home/BuyTicket?termType=' + termType;
  199. return;
  200. } else if (status === "2") {
  201. showNotification("@Lang.v2_game_locked");
  202. } else if (status === "3") {
  203. showNotification("@Lang.v2_updating_results");
  204. } else {
  205. showNotification("@Lang.v2_game_locked");
  206. }
  207. } else {
  208. showNotification("@Lang.no_results_found");
  209. }
  210. } else if (res.responseCode === "401") {
  211. window.location.href = subDomain + "/Account/Login";
  212. return;
  213. } else {
  214. showNotification(res.responseMessage || "@Lang.error_happened");
  215. }
  216. isCheckingTerm = false;
  217. },
  218. error: function (err) {
  219. showNotification("@Lang.error_happened");
  220. isCheckingTerm = false;
  221. }
  222. });
  223. }
  224. function startCountdown() {
  225. const targetHour = 20; // 20:00 (8h tối)
  226. const now = new Date();
  227. let target = new Date();
  228. target.setHours(targetHour, 0, 0, 0);
  229. if (now >= target) {
  230. target.setDate(target.getDate() + 1);
  231. }
  232. // Định dạng ngày hiển thị (VD: Friday, Mar 20, 2026)
  233. const options = { weekday: 'long', month: 'short', day: 'numeric', year: 'numeric' };
  234. const dateText = target.toLocaleDateString('en-US', options);
  235. document.getElementById('draw-date').innerText = dateText;
  236. function updateTime() {
  237. const current = new Date();
  238. const diff = target - current;
  239. if (diff <= 0) {
  240. target.setDate(target.getDate() + 1);
  241. const updatedDateText = target.toLocaleDateString('en-US', options);
  242. document.getElementById('draw-date').innerText = updatedDateText;
  243. updateTime();
  244. return;
  245. }
  246. const hours = Math.floor((diff / (1000 * 60 * 60)));
  247. const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
  248. const seconds = Math.floor((diff % (1000 * 60)) / 1000);
  249. document.getElementById('countdown-hours').innerText = hours.toString().padStart(2, '0');
  250. document.getElementById('countdown-minutes').innerText = minutes.toString().padStart(2, '0');
  251. document.getElementById('countdown-seconds').innerText = seconds.toString().padStart(2, '0');
  252. }
  253. updateTime();
  254. setInterval(updateTime, 1000);
  255. }
  256. document.addEventListener('DOMContentLoaded', startCountdown);
  257. </script>
  258. }