GameHome.cshtml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. @model LotteryWebApp.Models.HomeIndex_ViewModel
  2. @{
  3. ViewData["Title"] = "Millions - Game Home";
  4. Layout = "~/Areas/Millions/Views/Shared/_Layout.cshtml";
  5. }
  6. @using LotteryWebApp.Languages;
  7. @using LotteryWebApp.Controllers;
  8. @using LotteryWebApp.Common;
  9. @section Styles {
  10. <link rel="preconnect" href="https://fonts.googleapis.com">
  11. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  12. <link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800&family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700;12..96,800&display=swap" rel="stylesheet">
  13. <link rel="stylesheet" href="/Millions/css/all.min.css"/>
  14. <link rel="stylesheet" href="/Millions/css/game-home.css"/>
  15. }
  16. <div class="main-content h-dvh w-full max-w-[430px] mx-auto bg-[#f5f7fb] relative overflow-hidden font-bricolage" style="background-color:#f5f7fb;">
  17. <!-- Scrollable content area -->
  18. @{
  19. var hasResult = !string.IsNullOrEmpty(Model.lastResult);
  20. var resultBalls = hasResult ? Model.lastResult.Split(',') : null;
  21. if (hasResult && resultBalls.Length < 6) {
  22. var temp = new string[6];
  23. for (int i = 0; i < 6; i++) temp[i] = i < resultBalls.Length ? resultBalls[i] : "0";
  24. resultBalls = temp;
  25. }
  26. }
  27. <div class="absolute inset-x-0 top-0 bottom-[64px] overflow-y-auto flex flex-col" style="background-color:#f5f7fb; overscroll-behavior:contain;">
  28. <!-- Top section with header + cards -->
  29. <div class="relative">
  30. <!-- Header gradient background -->
  31. <div class="header-bg relative h-[160px] rounded-b-[40px] overflow-hidden">
  32. <!-- Top bar -->
  33. <div class="flex items-center justify-between px-3 pt-3 relative z-10">
  34. <button onclick='location.href=subDomain + "@Url.Action("Index", "Home", new { area = "LotteryV2" })";' class="w-6 h-6 flex items-center justify-center">
  35. <img src="/Millions/assets/icons/arrow-left.svg" alt="Back" class="w-6 h-6"/>
  36. </button>
  37. @{
  38. var currentLang = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
  39. var isEnglish = currentLang == "fr";
  40. }
  41. <div class="relative">
  42. <button type="button" id="langSwitchBtn" class="flex items-center gap-2 bg-white/15 rounded-full px-3 py-1 text-white text-sm">
  43. <img src="@(isEnglish ? "/img/en_flag.png" : "/img/Flag_of_Haiti.png")" alt="" class="lang-flag-icon"/>
  44. <span>@(isEnglish ? "English" : "Natcom")</span>
  45. <img src="/Millions/assets/icons/chevron-down.svg" alt="" class="w-2 h-2"/>
  46. </button>
  47. <div id="langSwitchMenu" class="hidden absolute right-0 mt-2 bg-white rounded-xl shadow-lg overflow-hidden z-50 min-w-[140px] py-1">
  48. <button type="button" onclick="setLanguage('fr')" class="w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-800 hover:bg-gray-100 @(isEnglish ? "font-bold" : "")">
  49. <img src="/img/en_flag.png" alt="" class="lang-flag-icon"/>
  50. <span>English</span>
  51. </button>
  52. <button type="button" onclick="setLanguage('en')" class="w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-800 hover:bg-gray-100 @(!isEnglish ? "font-bold" : "")">
  53. <img src="/img/Flag_of_Haiti.png" alt="" class="lang-flag-icon"/>
  54. <span>Natcom</span>
  55. </button>
  56. </div>
  57. </div>
  58. </div>
  59. <!-- User profile -->
  60. <div class="flex items-center gap-2 px-3 min-[380px]:gap-4 min-[380px]:px-4 -mt-2">
  61. <div class="w-16 h-16 min-[380px]:w-[84px] min-[380px]:h-[84px] rounded-full overflow-hidden bg-white/20 border-[3px] border-white shrink-0">
  62. <img src="/Millions/assets/images/avatar.png" alt="Avatar" class="w-full h-full object-cover"/>
  63. </div>
  64. <div class="flex-1 min-w-0">
  65. <p class="text-white text-base font-semibold leading-tight">@(Model?.profile?.users ?? "User")</p>
  66. <div class="mt-1.5 min-[380px]:mt-2 flex items-center justify-between gap-1.5 min-[380px]:gap-2 rounded-full border border-white/35 bg-white/10 px-2 py-1.5 min-[380px]:px-3 min-[380px]:py-2">
  67. <div class="flex items-center gap-0.5 min-[380px]:gap-1 min-w-0">
  68. <span class="text-xl min-[340px]:text-2xl min-[380px]:text-3xl font-condensed text-gold-gradient leading-none whitespace-nowrap">@Utils.FormatMoney(Model?.userStatus?.bet_coin)</span>
  69. <img src="/Millions/assets/icons/coin.png" alt="" class="w-5 h-5 shrink-0"/>
  70. <span class="text-white text-sm shrink-0">@Lang.millions_htg</span>
  71. </div>
  72. <button type="button" onclick="transferWinMoney()" class="redeem-pulse shrink-0 rounded-full px-3 py-2 min-h-[40px] w-[4.9rem] font-extrabold text-[#0a1f44] text-[9px] leading-[1.12] text-center active:scale-[0.98] transition-transform" style="background: linear-gradient(90deg, #ffcf0f 0%, #fff1b8 100%); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);">
  73. @Lang.millions_redeem_rewards
  74. </button>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. <!-- Floating info card -->
  80. <div class="absolute left-5 right-5 -bottom-[52px] bg-white rounded-2xl shadow-md flex items-center h-20 px-4">
  81. <div class="flex items-center gap-2 flex-1">
  82. <img src="/Millions/assets/icons/calendar.png" alt="" class="w-6 h-6"/>
  83. <div>
  84. <p class="text-xs text-[#797979]">@Lang.millions_next_round</p>
  85. <p class="text-xs font-bold text-black" id="draw-date">@Utils.FormatResultDate(Model.nextRoundDate)</p>
  86. </div>
  87. </div>
  88. <div class="w-px h-12 bg-gray-200"></div>
  89. <div class="flex items-center gap-2 flex-1 pl-4">
  90. <img src="/Millions/assets/icons/money-bag.png" alt="" class="w-6 h-[34px] object-contain"/>
  91. <div>
  92. <p class="text-xs text-[#797979]">@Lang.millions_jackpot_prize_to</p>
  93. <p class="leading-none ">
  94. <span class="text-base font-extrabold text-[#002bff]">30.000.000</span><span class="text-[10.32px] font-extrabold text-black align-top">@Lang.millions_htg</span>
  95. </p>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. <!-- Result section -->
  101. @if (hasResult)
  102. {
  103. <div class="px-4 mt-10">
  104. <div class="result-box rounded-[32px] py-3 flex flex-col gap-2">
  105. <div class="flex items-center justify-between px-4">
  106. <div class="flex items-center gap-2 text-xs">
  107. <span class="text-[#797979]">@Lang.results</span>
  108. <span class="font-bold text-black">@Utils.FormatResultDate(Model.lastResultDate)</span>
  109. </div>
  110. <a href="/Millions/Home/Results" class="flex items-center gap-1 text-[10px] font-bold text-black border border-[#c2c2c2] rounded-lg px-2 py-1">
  111. @Lang.millions_view_all_results
  112. <img src="/Millions/assets/icons/chevron-right.svg" alt="" class="w-[5px] h-2" />
  113. </a>
  114. </div>
  115. <!-- Result balls -->
  116. <div class="flex items-center justify-between gap-1 px-4">
  117. @for (int i = 0; i < 5; i++)
  118. {
  119. <div class="ball ball-blue">@resultBalls[i]</div>
  120. }
  121. <div class="relative">
  122. <img src="/Millions/assets/icons/crown.png" alt="" class="absolute -top-4 -right-1 w-7 h-auto pointer-events-none rotate-[15deg] z-0" />
  123. <div class="ball ball-mb relative z-10">
  124. <span>@resultBalls[5]</span>
  125. <span class="absolute -bottom-1 -right-2 bg-[#ee0033] text-white text-[8px] font-bold px-1.5 py-0.5 rounded z-20">MB</span>
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. }
  132. else
  133. {
  134. <div class="mt-14"></div>
  135. }
  136. <!-- Mega Jackpot banner -->
  137. <div class="px-2 mt-6">
  138. <a href="@Url.Action("JackpotResults", "Home", new { area = "Millions", termType = Model.termType })" class="mega-banner relative rounded-[20px] overflow-hidden px-4 py-3 flex flex-col">
  139. <span class="mega-glow" style="left:-79px; top:-101px;"></span>
  140. <span class="mega-glow" style="right:-78px; top:9px;"></span>
  141. <span class="mega-glow" style="right:-107px; top:20px;"></span>
  142. <p class="mega-title relative inline-block text-white text-[22px] font-futura leading-none">
  143. <img src="/Millions/assets/icons/crown.png" alt="" class="absolute -top-[5px] left-[26px] w-[12px] h-auto rotate-[10deg] pointer-events-none"/>
  144. @Lang.millions_mega_jackpot
  145. </p>
  146. <p class="text-white text-xs mt-2">@Lang.millions_estimate_jackpot_prize</p>
  147. <p class="leading-none mt-1" style="margin-bottom:18px;">
  148. <span class="mega-jackpot-spiral inline-flex items-start">
  149. <span class="mega-amount text-[40px] font-condensed text-gold-gradient tracking-tight leading-none">@Utils.FormatMoney(Model.bolet ?? "30000000")</span>
  150. <span class="text-gold-gradient text-sm font-bold uppercase ml-2 mt-0.5">@Lang.v2_htg</span>
  151. </span>
  152. </p>
  153. <p class="text-white text-[10px] mt-1 ">@Lang.millions_be_the_next_millionaire</p>
  154. <div class="relative z-10 mt-1 flex items-end justify-between gap-2">
  155. <p class="text-white text-[10px] leading-snug flex-1 pr-1 max-w-[68%]">@Lang.millions_jackpot_disclaimer</p>
  156. <span class="shrink-0 inline-flex items-center gap-1 bg-white/20 hover:bg-white/30 rounded-full px-2 py-0.5 text-white text-[10px] font-semibold">
  157. @Lang.millions_view
  158. <img src="/Millions/assets/icons/chevron-right.svg" alt="" class="w-[5px] h-2 invert"/>
  159. </span>
  160. </div>
  161. <!-- Decorative elements -->
  162. <img src="/Millions/assets/images/crown-balls.png" alt="" class="absolute right-2 top-1/2 -translate-y-1/2 w-44 h-auto pointer-events-none"/>
  163. </a>
  164. </div>
  165. <!-- Play now button + decorative balls -->
  166. <div class="relative shrink-0 mt-4 z-10">
  167. <img src="/Millions/assets/images/play-decor.png" alt="" class="block w-full h-auto pointer-events-none"/>
  168. <a onclick="checkTerm('@Constants.Millions_CODE')" class="play-now-outer rounded-full animate-pulse-play" style="position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:155px; height:155px; padding:11px; cursor:pointer;">
  169. <div class="play-now-ring rounded-full" style="width:100%;height:100%;padding:4px;">
  170. <div class="play-now-btn rounded-full flex flex-col items-center justify-center text-white text-[32px] font-black border-[1.8px] border-white animate-pulse-play" style="width:100%;height:100%;line-height:24px;">
  171. <span class="uppercase">@Lang.millions_play</span>
  172. <span class="uppercase">@Lang.millions_now</span>
  173. </div>
  174. </div>
  175. </a>
  176. </div>
  177. </div>
  178. @{
  179. ViewData["ActiveTab"] = "Home";
  180. }
  181. <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%);">
  182. <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">
  183. <div class="w-full flex justify-center mb-8 mt-6">
  184. <img src="/Millions/img/modal/fail_icon.png" class="w-[180px] h-auto object-contain" alt="Notification icon" />
  185. </div>
  186. <div class="px-2 text-center mb-10 flex-1 flex items-center justify-center">
  187. <p id="notificationMessage" class="text-black font-[800] text-[22px] leading-snug"></p>
  188. </div>
  189. <div class="w-full">
  190. <button onclick="closeNotificationModal()" class="w-full bg-[#0062FF] text-white font-[800] text-[20px] py-[12px] rounded-[14px] shadow-lg active:scale-95 transition-all">
  191. @Lang.try_again
  192. </button>
  193. </div>
  194. </div>
  195. </div>
  196. @await Html.PartialAsync("~/Areas/Millions/Views/Shared/_BottomNavbar.cshtml")
  197. </div>
  198. @section Scripts {
  199. <script src="/Millions/js/all.min.js"></script>
  200. <script>
  201. var systemUpgrading = false;
  202. let isCheckingTerm = false;
  203. function showNotification(message, code) {
  204. $("#notificationMessage").text(message);
  205. const $btn = $("#notificationModal button");
  206. if (code === "-2" || (message && message.includes("System is upgrading"))) {
  207. systemUpgrading = true;
  208. $btn.text("@Lang.login");
  209. } else {
  210. systemUpgrading = false;
  211. $btn.text("@Lang.try_again");
  212. }
  213. $("#notificationModal").removeClass("hidden").addClass("flex");
  214. }
  215. function closeNotificationModal() {
  216. $("#notificationModal").addClass("hidden").removeClass("flex");
  217. if (systemUpgrading) {
  218. window.location.href = subDomain + "/Account/Login";
  219. }
  220. }
  221. function checkTerm(termType) {
  222. if (isCheckingTerm) return;
  223. isCheckingTerm = true;
  224. var token = $('input[name="__RequestVerificationToken"]').val();
  225. $.ajax({
  226. url: subDomain + '/Millions/Home/TermResult',
  227. type: 'POST',
  228. data: {
  229. __RequestVerificationToken: token,
  230. termType: termType
  231. },
  232. success: function (res) {
  233. if (res.responseCode === "0") {
  234. if (res.listTerm && res.listTerm.length > 0) {
  235. var status = res.listTerm[0].status;
  236. if (status === "0" || status === "1") {
  237. location.href = subDomain + '/Millions/Home/BuyTicket?termType=' + termType;
  238. return;
  239. } else if (status === "2") {
  240. showNotification("@Lang.millions_game_locked");
  241. } else if (status === "3") {
  242. showNotification("@Lang.millions_updating_results");
  243. } else {
  244. showNotification("@Lang.millions_game_locked");
  245. }
  246. } else {
  247. showNotification("@Lang.no_results_found");
  248. }
  249. } else if (res.responseCode === "401") {
  250. window.location.href = subDomain + "/Account/Login";
  251. return;
  252. } else {
  253. showNotification(res.responseMessage || "@Lang.error_happened", res.responseCode);
  254. }
  255. isCheckingTerm = false;
  256. },
  257. error: function (err) {
  258. showNotification("@Lang.error_happened");
  259. isCheckingTerm = false;
  260. }
  261. });
  262. }
  263. function startCountdown() {
  264. const targetHour = 23;
  265. const now = new Date();
  266. let target = new Date();
  267. target.setHours(targetHour, 0, 0, 0);
  268. if (now >= target) {
  269. target.setDate(target.getDate() + 1);
  270. }
  271. const options = { weekday: 'long', month: 'short', day: 'numeric', year: 'numeric' };
  272. const dateText = target.toLocaleDateString('en-US', options);
  273. const drawDateEl = document.getElementById('draw-date');
  274. if(drawDateEl) drawDateEl.innerText = dateText;
  275. }
  276. // Withdraw money function
  277. function transferWinMoney() {
  278. location.href = subDomain + '@Url.Action("TransferWinMoney", "Home", new { area = "Millions" })';
  279. }
  280. document.addEventListener('DOMContentLoaded', startCountdown);
  281. function setLanguage(newLang) {
  282. fetch(subDomain + '/Home/SetCulture?lang=' + newLang)
  283. .then(function () { location.reload(); })
  284. .catch(function () { location.reload(); });
  285. }
  286. document.addEventListener('DOMContentLoaded', function () {
  287. var btn = document.getElementById('langSwitchBtn');
  288. var menu = document.getElementById('langSwitchMenu');
  289. if (!btn || !menu) return;
  290. btn.addEventListener('click', function (e) {
  291. e.stopPropagation();
  292. menu.classList.toggle('hidden');
  293. });
  294. document.addEventListener('click', function () {
  295. menu.classList.add('hidden');
  296. });
  297. });
  298. </script>
  299. }