GameHome.cshtml 17 KB

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