#478 refactoring

This commit is contained in:
Hamid Reza Mohammadi 2025-03-29 15:35:55 +03:30
parent 1dd1a39ba1
commit c803cef0bc
5 changed files with 17 additions and 17 deletions

View File

@ -106,7 +106,7 @@
گنجور » مشارکت‌های کاربران
</h2>
<div id="wordcounts-placeholder">
<div id="days-placeholder">
</div>
</div>
@ -136,20 +136,20 @@
<script>
function loadGroupedByDate(dataType) {
var divParent = document.getElementById('wordcounts-placeholder');
var divParent = document.getElementById('days-placeholder');
var imgElementId = 'loadingwordcountsimg';
divParent.innerHTML = divParent.innerHTML + '<div class="bnumdiv" id="remove-this-wordcounts"><img id="' + imgElementId + '" src="/image/loading.gif" alt="بارگذاری"/></div>';
divParent.innerHTML = divParent.innerHTML + '<div class="bnumdiv" id="remove-days-placeholder"><img id="' + imgElementId + '" src="/image/loading.gif" alt="بارگذاری"/></div>';
$.ajax({
type: "GET",
url: '?Handler=GroupedByDate&dataType=' + dataType,
error: function () {
if (document.getElementById("remove-this-wordcounts") != null) {
document.getElementById("remove-this-wordcounts").remove();
if (document.getElementById("remove-days-placeholder") != null) {
document.getElementById("remove-days-placeholder").remove();
}
},
success: function (data) {
if (document.getElementById("remove-this-wordcounts") != null) {
document.getElementById("remove-this-wordcounts").remove();
if (document.getElementById("remove-days-placeholder") != null) {
document.getElementById("remove-days-placeholder").remove();
if (document.getElementById("load-word-counts") != null) {
document.getElementById("load-word-counts").remove();
}

View File

@ -157,7 +157,7 @@ namespace GanjooRazor.Pages
{
Model = new _GroupedByDateViewPartialModel()
{
Array = result.ToArray()
Days = result.ToArray()
}
}
};

View File

@ -5,7 +5,7 @@ namespace GanjooRazor.Pages
{
public class _GroupedByDateViewPartialModel : PageModel
{
public GroupedByDateViewModel[] Array { get; set; }
public GroupedByDateViewModel[] Days { get; set; }
public _GroupedByDateViewTablePartialModel TableModel
{
@ -13,7 +13,7 @@ namespace GanjooRazor.Pages
{
return new _GroupedByDateViewTablePartialModel()
{
Array = Array
Days = Days
};
}
}

View File

@ -3,7 +3,7 @@
@using System.Globalization
@{
}
@if (Model.Array == null || Model.Array.Length == 0) return;
@if (Model.Days == null || Model.Days.Length == 0) return;
<table class="stats" id="grouped-by-date">
<thead>
@ -14,14 +14,14 @@
</tr>
</thead>
<tbody>
@for (int i = 0; i < Model.Array.Length; i++)
@for (int i = 0; i < Model.Days.Length; i++)
{
@if (i % 2 == 0)
{
<tr class="e">
<td class="c1">@((i+1).ToPersianNumbers())</td>
<td class="c2">@RMuseum.Services.Implementation.LanguageUtils.FormatInShortDate(DateTime.Parse(Model.Array[i].Date))</td>
<td class="c3">@RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.Array[i].Number)</td>
<td class="c2">@RMuseum.Services.Implementation.LanguageUtils.FormatInShortDate(DateTime.Parse(Model.Days[i].Date))</td>
<td class="c3">@RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.Days[i].Number)</td>
</tr>
}
@ -29,8 +29,8 @@
{
<tr>
<td class="c1">@((i + 1).ToPersianNumbers())</td>
<td class="c2">@RMuseum.Services.Implementation.LanguageUtils.FormatInShortDate(DateTime.Parse(Model.Array[i].Date))</td>
<td class="c3">@RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.Array[i].Number)</td>
<td class="c2">@RMuseum.Services.Implementation.LanguageUtils.FormatInShortDate(DateTime.Parse(Model.Days[i].Date))</td>
<td class="c3">@RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.Days[i].Number)</td>
</tr>
}
}

View File

@ -5,6 +5,6 @@ namespace GanjooRazor.Pages
{
public class _GroupedByDateViewTablePartialModel : PageModel
{
public GroupedByDateViewModel[] Array { get; set; }
public GroupedByDateViewModel[] Days { get; set; }
}
}