GameHome.cshtml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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-4 px-4 -mt-2">
  61. <div class="w-[84px] 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-2 flex items-center justify-between gap-2 rounded-full border border-white/35 bg-white/10 px-3 py-2">
  67. <div class="flex items-center gap-1 min-w-0">
  68. <span class="text-3xl font-condensed text-gold-gradient leading-none truncate">@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]">@Utils.FormatMoney(Model.bolet ?? "30000000")</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. @await Html.PartialAsync("~/Areas/Millions/Views/Shared/_BottomNavbar.cshtml")
  182. </div>
  183. @section Scripts {
  184. <script src="/Millions/js/all.min.js"></script>
  185. <script>
  186. let isCheckingTerm = false;
  187. function checkTerm(termType) {
  188. if (isCheckingTerm) return;
  189. isCheckingTerm = true;
  190. var token = $('input[name="__RequestVerificationToken"]').val();
  191. $.ajax({
  192. url: subDomain + '/Millions/Home/TermResult',
  193. type: 'POST',
  194. data: {
  195. __RequestVerificationToken: token,
  196. termType: termType
  197. },
  198. success: function (res) {
  199. if (res.responseCode === "0") {
  200. if (res.listTerm && res.listTerm.length > 0) {
  201. var status = res.listTerm[0].status;
  202. if (status === "0" || status === "1") {
  203. location.href = subDomain + '/Millions/Home/BuyTicket?termType=' + termType;
  204. return;
  205. } else {
  206. alert("@Lang.millions_game_locked");
  207. }
  208. } else {
  209. alert("@Lang.no_results_found");
  210. }
  211. } else if (res.responseCode === "401") {
  212. window.location.href = subDomain + "/Account/Login";
  213. return;
  214. } else {
  215. alert(res.responseMessage || "@Lang.error_happened");
  216. }
  217. isCheckingTerm = false;
  218. },
  219. error: function (err) {
  220. alert("@Lang.error_happened");
  221. isCheckingTerm = false;
  222. }
  223. });
  224. }
  225. function startCountdown() {
  226. const targetHour = 20;
  227. const now = new Date();
  228. let target = new Date();
  229. target.setHours(targetHour, 0, 0, 0);
  230. if (now >= target) {
  231. target.setDate(target.getDate() + 1);
  232. }
  233. const options = { weekday: 'long', month: 'short', day: 'numeric', year: 'numeric' };
  234. const dateText = target.toLocaleDateString('en-US', options);
  235. const drawDateEl = document.getElementById('draw-date');
  236. if(drawDateEl) drawDateEl.innerText = dateText;
  237. }
  238. // Withdraw money function
  239. function transferWinMoney() {
  240. location.href = subDomain + '@Url.Action("TransferWinMoney", "Home", new { area = "Millions" })';
  241. }
  242. document.addEventListener('DOMContentLoaded', startCountdown);
  243. function setLanguage(newLang) {
  244. fetch(subDomain + '/Home/SetCulture?lang=' + newLang)
  245. .then(function () { location.reload(); })
  246. .catch(function () { location.reload(); });
  247. }
  248. document.addEventListener('DOMContentLoaded', function () {
  249. var btn = document.getElementById('langSwitchBtn');
  250. var menu = document.getElementById('langSwitchMenu');
  251. if (!btn || !menu) return;
  252. btn.addEventListener('click', function (e) {
  253. e.stopPropagation();
  254. menu.classList.toggle('hidden');
  255. });
  256. document.addEventListener('click', function () {
  257. menu.classList.add('hidden');
  258. });
  259. });
  260. </script>
  261. }