Commodity.cshtml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. @model economy.Models.View<economy.Models.Price.Global.Commodity.Request, economy.Models.Price.Global.Commodity.Response>
  2. @{
  3. bool hasKrw = (ViewBag.HasKrw == true);
  4. }
  5. <div class="container">
  6. <h3>@ViewData["Title"]</h3>
  7. <div class="row mt-3">
  8. <div class="col align-self-center">
  9. @((Model?.Response?.Data?.Count ?? 0).ToString("N0")) 개
  10. </div>
  11. <div class="col-auto">
  12. <div class="row g-2">
  13. <div class="col">
  14. <select name="interval" id="interval" class="form-select" form="fSearch">
  15. <option value="monthly" selected="@(Model.Request.Interval == "monthly")">월간</option>
  16. <option value="quarterly" selected="@(Model.Request.Interval == "quarterly")">분기</option>
  17. <option value="annual" selected="@(Model.Request.Interval == "annual")">연간</option>
  18. </select>
  19. </div>
  20. <div class="col">
  21. <select name="perPage" id="perPage" class="form-select" asp-for="SelectedListPerPage" asp-items="Model.ListPerPage" form="fSearch"></select>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. @await Html.PartialAsync("~/Views/Component/Chart.cshtml", Model.Chart)
  27. <div class="table-responsive">
  28. <table id="globalPriceList" class="table table-bordered table-hover">
  29. <caption class="caption-top">
  30. 단위: @Model.Response.Unit
  31. </caption>
  32. <thead>
  33. <tr>
  34. <th>번호</th>
  35. <th>날짜</th>
  36. @if (hasKrw)
  37. {
  38. <th>달러($)</th>
  39. <th>원화(\)</th>
  40. }
  41. else
  42. {
  43. <th>지수</th>
  44. }
  45. </tr>
  46. </thead>
  47. <tbody>
  48. @if (Model.Response.Data != null && Model.Response.Data?.Count > 0)
  49. {
  50. @foreach (var row in Model.Response.Data)
  51. {
  52. <tr>
  53. <td>@row.Num</td>
  54. <td>@row.Date</td>
  55. <td>@row.Value</td>
  56. @if (hasKrw)
  57. {
  58. <td>@row.KRW.ToString("N0")</td>
  59. }
  60. </tr>
  61. }
  62. }
  63. else
  64. {
  65. <tr>
  66. <td colspan="@(hasKrw ? 4 : 3)">
  67. No data.
  68. </td>
  69. </tr>
  70. }
  71. </tbody>
  72. </table>
  73. </div>
  74. <form id="fSearch" method="get" accept-charset="UTF-8" rel="search" autocomplete="off" asp-controller="Global" asp-action="Commodity" asp-route-commodity="@Model.Request.Commodity">
  75. <input type="hidden" name="page" value="@Model.Request.PageNo" />
  76. </form>
  77. @await Html.PartialAsync("~/Views/Component/Pagination.cshtml", Model.Pagination)
  78. </div>
  79. @section Scripts {
  80. <script src="~/js/commodity.js" asp-append-version="true"></script>
  81. }
  82. @section Styles {
  83. <link href="~/css/style.css" rel="stylesheet" asp-append-version="true" />
  84. }