Index.cshtml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. @{
  2. ViewData["Title"] = "Home Page";
  3. }
  4. @using LotteryWebApp.Languages;
  5. @using LotteryWebApp.Controllers;
  6. @using LotteryWebApp.Common;
  7. @model HomeIndex_ViewModel
  8. @*@{
  9. if (Model.uuid != null)
  10. {
  11. // nhan dien thue bao
  12. <script>
  13. console.log("nhan dien thue bao");
  14. var formData = new FormData();
  15. formData.append('uuid', '@Model.uuid');
  16. let url = '@Constants.URL_GET_MSISDN';
  17. startLoading();
  18. $.ajax({
  19. type: "POST",
  20. url: url,
  21. processData: false,
  22. contentType: false,
  23. datatype: "jsonp",
  24. data: formData,
  25. success: function (data) {
  26. console.log("res: " + data);
  27. if (data.code == "200") {
  28. let errorCode = data.errorCode;
  29. if (errorCode == "200") {
  30. msisdnAuto = data.data.msisdn;
  31. console.log("msisdnAuto: " + msisdnAuto);
  32. window.location.href = '@Model.subDomain' + "/Home?phoneNumber=" + msisdnAuto;
  33. }
  34. }
  35. stopLoading();
  36. },
  37. failure: function (data) {
  38. console.log("failure: " + data.responseText);
  39. window.location.href = '@Model.subDomain' + "/Account/Login";
  40. stopLoading();
  41. },
  42. error: function (data) {
  43. console.log("error: " + data.responseText);
  44. window.location.href = '@Model.subDomain' + "/Account/Login";
  45. stopLoading();
  46. }
  47. });
  48. console.log("nhan dien thue bao done");
  49. </script>
  50. }
  51. else
  52. {*@
  53. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  54. <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
  55. <div class="app-content content">
  56. <div class="">
  57. <div class="content-body">
  58. <section class="flexbox-container">
  59. <div class="align-items-center justify-content-center">
  60. <div>
  61. @await Component.InvokeAsync("HeaderHome", new { profile = Model.profile, userStatus = Model.userStatus })
  62. </div>
  63. <div class="row tabs-style" style="">
  64. <div col-12>
  65. <select id="gameTypeSelect" style="width:200px" asp-for="termType" onchange="changeGame()">
  66. <option value="@Constants.NEW_YORK_BOLET_CODE" data-img="../img/logo-deebef36ed9bb3f8e07e8492eecbb7ae (1) 1.png" >
  67. NEW YORK
  68. </option>
  69. <option value="@Constants.FLORIDA_BOLET_CODE" data-img="../img/siteLogo 2.png">FLORIDA</option>
  70. <option value="@Constants.BOULCHANS_CODE" data-img="">BOULCHANS</option>
  71. <option value="@Constants.GEORGIA_BOLET_CODE" data-img="../img/logo/Georgia_Lottery.jpg">GEORGIA</option>
  72. <option value="@Constants.TEXAS_BOLET_CODE" data-img="../img/logo/logo_tx.png">TEXAS</option>
  73. <option value="@Constants.TENNESSEE_BOLET_CODE" data-img="../img/logo/TN_Lottery.png">TENNESSEE</option>
  74. </select>
  75. </div>
  76. @* <div class="col-4 tab-style">
  77. <input type="radio" id="tab-1" name="tab-group-1" @(Model.termType == Constants.NEW_YORK_BOLET_CODE ? "checked" : "")>
  78. <label for="tab-1">
  79. <a style="font-size: 12px;" href="@ViewBag.MyConfig.MyValue/Home?termType=@Constants.NEW_YORK_BOLET_CODE"
  80. class="@(Model.termType == Constants.NEW_YORK_BOLET_CODE ? "active-tab" : "")">
  81. <img style="height: 30px;" src="~/img/logo-deebef36ed9bb3f8e07e8492eecbb7ae (1) 1.png" />
  82. NEW YORK
  83. </a>
  84. </label>
  85. </div>
  86. <div class="col-4 tab-style">
  87. <input type="radio" id="tab-2" name="tab-group-1" @(Model.termType == Constants.FLORIDA_BOLET_CODE ? "checked" : "")>
  88. <label for="tab-2">
  89. <a style="font-size: 12px;" href="@ViewBag.MyConfig.MyValue/Home?termType=@Constants.FLORIDA_BOLET_CODE"
  90. class="@(Model.termType == Constants.FLORIDA_BOLET_CODE ? "active-tab" : "")">
  91. <img style="height: 30px;" src="~/img/siteLogo 2.png" />
  92. FLORIDA
  93. </a>
  94. </label>
  95. </div>
  96. <div class="col-4 tab-style">
  97. <input type="radio" id="tab-2" name="tab-group-1" @(Model.termType == Constants.BOULCHANS_CODE ? "checked" : "")>
  98. <label for="tab-2">
  99. <a style="font-size: 12px;" href="@ViewBag.MyConfig.MyValue/Home?termType=@Constants.BOULCHANS_CODE"
  100. class="@(Model.termType == Constants.BOULCHANS_CODE ? "active-tab" : "")">
  101. BOULCHANS
  102. </a>
  103. </label>
  104. </div> *@
  105. </div>
  106. <hr class="line2" style="border-top: 15px solid rgba(0,0,0,.1); margin-top: 0.2rem" />
  107. @*see more*@
  108. <div class="button-end">
  109. <a class="text-main-color" href="@ViewBag.MyConfig.MyValue/BuyTicket?termType=@Model.termType">@Lang.see_more</a> <i class="fas fa-solid fa-angle-right"></i>
  110. </div>
  111. <div id="term-result-data">
  112. </div>
  113. <script>
  114. getResultTermData(@Model.termType);
  115. </script>
  116. </div>
  117. </section>
  118. </div>
  119. </div>
  120. </div>
  121. @*}*@
  122. @*}*@
  123. <div>
  124. @await Component.InvokeAsync("AdvertiseArea", new { listTerm = Model.listTerm })
  125. </div>
  126. <script>
  127. stopLoading();
  128. </script>
  129. <script>
  130. $('#gameTypeSelect').select2({
  131. templateResult: formatOption,
  132. templateSelection: formatOption,
  133. minimumResultsForSearch: Infinity
  134. });
  135. function formatOption (state) {
  136. if (!state.id) return state.text;
  137. var img = $(state.element).data('img');
  138. return $('<span><img src="'+img+'" style="width:30px;height:30px;margin-right:5px"/> '+state.text+'</span>');
  139. }
  140. function changeGame() {
  141. var termType = $("#gameTypeSelect").val();
  142. location.href = "@ViewBag.MyConfig.MyValue/Home?termType=" + termType;
  143. }
  144. </script>