Commodity.cshtml 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. <div class="table-responsive">
  27. <table id="globalPriceList" class="table table-bordered table-hover">
  28. <caption class="caption-top">
  29. 단위: @Model.Response.Unit
  30. </caption>
  31. <thead>
  32. <tr>
  33. <th>번호</th>
  34. <th>날짜</th>
  35. @if (hasKrw)
  36. {
  37. <th>달러($)</th>
  38. <th>원화(\)</th>
  39. }
  40. else
  41. {
  42. <th>지수</th>
  43. }
  44. </tr>
  45. </thead>
  46. <tbody>
  47. @if (Model.Response.Data != null && Model.Response.Data?.Count > 0)
  48. {
  49. @foreach (var row in Model.Response.Data)
  50. {
  51. <tr>
  52. <td>@row.Num</td>
  53. <td>@row.Date</td>
  54. <td>@row.Value</td>
  55. @if (hasKrw)
  56. {
  57. <td>@row.KRW.ToString("N0")</td>
  58. }
  59. </tr>
  60. }
  61. }
  62. else
  63. {
  64. <tr>
  65. <td colspan="@(hasKrw ? 4 : 3)">
  66. No data.
  67. </td>
  68. </tr>
  69. }
  70. </tbody>
  71. </table>
  72. </div>
  73. <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">
  74. <input type="hidden" name="page" value="@Model.Request.PageNo" />
  75. </form>
  76. @await Html.PartialAsync("~/Views/Component/Pagination.cshtml", Model.Pagination)
  77. </div>
  78. @section Scripts {
  79. <script src="~/js/commodity.js" asp-append-version="true"></script>
  80. }
  81. @section Styles {
  82. <link href="~/css/style.css" rel="stylesheet" asp-append-version="true" />
  83. }