Gold.cshtml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. @model economy.Models.View<economy.Models.Price.Domestic.Gold.Request, economy.Models.Price.Domestic.Gold.Response>
  2. @{
  3. ViewData["Title"] = "금 시세";
  4. }
  5. <div class="container">
  6. <h3>금 시세</h3>
  7. <div class="row mt-3">
  8. <div class="col align-self-center">
  9. @((Model?.Response?.Body?.TotalCount ?? 0).ToString("N0")) 개
  10. </div>
  11. <div class="col-auto">
  12. <div class="row g-2">
  13. <div class="col">
  14. <input type="date" name="sDate" id="sDate" class="form-control" value="@Model.Request.StartDate.ToString("yyyy-MM-dd")" form="fSearch" />
  15. </div>
  16. <div class="col">
  17. <input type="date" name="eDate" id="eDate" class="form-control" value="@Model.Request.EndDate.ToString("yyyy-MM-dd")" form="fSearch" />
  18. </div>
  19. <div class="col">
  20. <select name="perPage" id="perPage" class="form-select" asp-for="SelectedListPerPage" asp-items="Model.ListPerPage" form="fSearch"></select>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="table-responsive">
  26. <table id="goldPriceInfo" class="table table-bordered table-hover">
  27. <caption class="caption-top">
  28. </caption>
  29. <thead>
  30. <tr>
  31. <th>번호</th>
  32. <th>기준일자</th>
  33. <th>종목명</th>
  34. <th>종가</th>
  35. <th>대비</th>
  36. <th>등락률</th>
  37. <th>시가</th>
  38. <th>고가</th>
  39. <th>저가</th>
  40. <th>거래량</th>
  41. <th>거래대금</th>
  42. </tr>
  43. </thead>
  44. <tbody>
  45. @if (Model.Response.Body != null && Model.Response.Body?.TotalCount > 0)
  46. {
  47. @foreach (var row in Model.Response.Body.Items.ItemList)
  48. {
  49. <tr>
  50. <td>@row.Num</td>
  51. <td>@row.BasDt</td>
  52. <td>
  53. <a asp-controller="Gold" asp-action="Index" asp-route-code="@row.SrtnCd" asp-route-sDate="@Model.Request.StartDate.ToString("yyyy-MM-dd")" asp-route-eDate="@Model.Request.EndDate.ToString("yyyy-MM-dd")">@row.ItmsNm</a>
  54. <span class="text-primary" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-html="true" data-bs-title="코드: @row.SrtnCd<br/>ISIN: @row.IsinCd">
  55. <i class="bi bi-exclamation-circle"></i>
  56. </span>
  57. </td>
  58. <td>@row.Clpr</td>
  59. <td>@row.Vs</td>
  60. <td>
  61. @{
  62. double tmpNum;
  63. bool isPlus = double.TryParse(row.FltRt, out tmpNum);
  64. }
  65. @if (isPlus && tmpNum > 0)
  66. {
  67. <span class="text-danger">▲ @row.FltRt</span>
  68. } else{
  69. <span class="text-primary">▼ @row.FltRt</span>
  70. }
  71. </td>
  72. <td>@row.Mkp</td>
  73. <td>@row.Hipr</td>
  74. <td>@row.Lopr</td>
  75. <td>@row.Trqu</td>
  76. <td>@row.TrPrc</td>
  77. </tr>
  78. }
  79. }
  80. else
  81. {
  82. <tr>
  83. <td colspan="11">
  84. No data.
  85. </td>
  86. </tr>
  87. }
  88. </tbody>
  89. </table>
  90. </div>
  91. <form id="fSearch" method="get" accept-charset="UTF-8" rel="search" autocomplete="off" asp-controller="Gold" asp-action="Index">
  92. <input type="hidden" name="page" value="@Model.Request.PageNo" />
  93. </form>
  94. @await Html.PartialAsync("~/Views/Component/Pagination.cshtml", Model.Pagination)
  95. </div>
  96. @section Scripts {
  97. <script src="~/js/gold.js" asp-append-version="true"></script>
  98. }
  99. @section Styles {
  100. <link href="~/css/style.css" rel="stylesheet" asp-append-version="true" />
  101. }