2024-05-05 18:15:37 +03:30
|
|
|
@using System.Reflection
|
|
|
|
@using System.ComponentModel.DataAnnotations
|
|
|
|
@using Shared.DTOs
|
|
|
|
@typeparam T
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="mb-4">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="card">
|
|
|
|
<div class="table-responsive text-nowrap">
|
|
|
|
<table class="table">
|
|
|
|
<thead class="table-light">
|
|
|
|
<tr>
|
|
|
|
@{
|
|
|
|
PropertyInfo[] properties = typeof(T).GetProperties();
|
|
|
|
foreach (var item in properties)
|
|
|
|
{
|
|
|
|
if (item.GetCustomAttributes(typeof(DisplayAttribute), false).Length > 0)
|
|
|
|
{
|
|
|
|
<th>
|
|
|
|
@item.CustomAttributes.Where(w => w.AttributeType.Name == "DisplayAttribute").Select(s => s.NamedArguments.Where(w => w.MemberName == "Name").Select(ss => ss.TypedValue.Value).First()).First().ToString()
|
|
|
|
</th>
|
|
|
|
}
|
2024-05-08 17:25:02 +03:30
|
|
|
|
2024-05-05 18:15:37 +03:30
|
|
|
}
|
2024-05-08 17:25:02 +03:30
|
|
|
<th>عملیات</th>
|
2024-05-05 18:15:37 +03:30
|
|
|
}
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="table-border-bottom-0">
|
|
|
|
@{
|
|
|
|
foreach (var item in ModelinComponent)
|
|
|
|
{
|
2024-05-08 17:25:02 +03:30
|
|
|
<tr>
|
2024-05-05 18:15:37 +03:30
|
|
|
@{
|
|
|
|
properties = item.GetType().GetProperties();
|
2024-05-08 17:25:02 +03:30
|
|
|
int id = 0;
|
2024-05-05 18:15:37 +03:30
|
|
|
foreach (PropertyInfo property in properties)
|
|
|
|
{
|
2024-06-08 21:48:26 +03:30
|
|
|
if (property.Name.ToLower() == "id")
|
|
|
|
id = Convert.ToInt32(property.GetValue(item, null));
|
|
|
|
|
2024-05-05 18:15:37 +03:30
|
|
|
if (property.CustomAttributes.Any(w => w.AttributeType.Name == "DisplayAttribute"))
|
|
|
|
{
|
2024-05-28 15:03:08 +03:30
|
|
|
if (property.PropertyType == typeof(Nullable<System.Decimal>) || property.PropertyType == typeof(System.Decimal))
|
|
|
|
{
|
|
|
|
<td>
|
|
|
|
@decimal.Parse(property.GetValue(item, null).ToString()).ToString("N0") ريال
|
2024-06-08 21:48:26 +03:30
|
|
|
</td>
|
|
|
|
}
|
2024-06-10 17:26:31 +03:30
|
|
|
else if (property.Name.ToLower() == "id" && item.ToString() != "Shared.DTOs.SentTaxDto")
|
2024-06-08 21:48:26 +03:30
|
|
|
{
|
|
|
|
if (id > 0)
|
|
|
|
{
|
2025-01-21 19:06:37 +03:30
|
|
|
if (OnMultipleOfThree.HasValue)
|
|
|
|
{
|
|
|
|
<td><button @onclick="()=>OnMultipleOfThree.Value.InvokeAsync(Convert.ToInt32(id))" type="button" class="btn btn-link">@property.GetValue(item, null)</button></td>
|
|
|
|
}
|
|
|
|
else if (OnMultipleOfThreeGeneric.HasValue)
|
|
|
|
{
|
|
|
|
<td><button @onclick="()=>OnMultipleOfThreeGeneric.Value.InvokeAsync(item)" type="button" class="btn btn-link">@property.GetValue(item, null)</button></td>
|
|
|
|
}
|
2024-06-08 21:48:26 +03:30
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<td><button type="button" class="btn btn-link disabled">@property.GetValue(item, null)</button></td>
|
|
|
|
}
|
|
|
|
|
2024-05-28 15:03:08 +03:30
|
|
|
}
|
2024-06-10 17:26:31 +03:30
|
|
|
else if (property.Name.ToLower() == "msgsentstatus" && item.ToString() == "Shared.DTOs.SentTaxDto")
|
|
|
|
{
|
|
|
|
var convertmodel = (SentTaxDto)Convert.ChangeType(item, typeof(SentTaxDto));
|
|
|
|
switch (convertmodel.SentStatus)
|
|
|
|
{
|
2025-01-21 19:06:37 +03:30
|
|
|
case SentStatus.Send:
|
2024-06-10 17:26:31 +03:30
|
|
|
<td style="background-color:#6495ED">@property.GetValue(item, null)</td>
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SentStatus.Successful:
|
|
|
|
<td style="background-color:#2AD51B">@property.GetValue(item, null)</td>
|
|
|
|
break;
|
|
|
|
|
2025-01-21 19:06:37 +03:30
|
|
|
case SentStatus.Unsuccessful:
|
2024-06-10 17:26:31 +03:30
|
|
|
<td style="background-color:#C70000">@property.GetValue(item, null)</td>
|
|
|
|
break;
|
|
|
|
|
2025-01-21 19:06:37 +03:30
|
|
|
case SentStatus.pending:
|
2024-06-10 17:26:31 +03:30
|
|
|
<td style="background-color:#FCFF2A">@property.GetValue(item, null)</td>
|
|
|
|
break;
|
|
|
|
|
2025-01-21 19:06:37 +03:30
|
|
|
case SentStatus.IN_PROGRESS:
|
2024-06-10 17:26:31 +03:30
|
|
|
<td style="background-color:#FCFF2A">@property.GetValue(item, null)</td>
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SentStatus.NOT_FOUND:
|
|
|
|
<td style="background-color:#F19109">@property.GetValue(item, null)</td>
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SentStatus.Unknown:
|
|
|
|
<td style="background-color:#932D2D">@property.GetValue(item, null)</td>
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
<td>@property.GetValue(item, null)</td>
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2024-05-28 15:03:08 +03:30
|
|
|
else
|
|
|
|
{
|
|
|
|
<td>@property.GetValue(item, null)</td>
|
|
|
|
}
|
2024-06-08 21:48:26 +03:30
|
|
|
|
2024-05-05 18:15:37 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2024-06-10 17:26:31 +03:30
|
|
|
if (item.ToString() == "Shared.DTOs.SentTaxDto")
|
2024-05-08 17:25:02 +03:30
|
|
|
{
|
2024-06-10 17:26:31 +03:30
|
|
|
var convertmodel = (SentTaxDto)Convert.ChangeType(item, typeof(SentTaxDto));
|
|
|
|
if (convertmodel.SentStatus == SentStatus.Send
|
2025-01-21 19:06:37 +03:30
|
|
|
|| convertmodel.SentStatus == SentStatus.pending
|
2024-06-10 17:26:31 +03:30
|
|
|
|| convertmodel.SentStatus == SentStatus.IN_PROGRESS)
|
|
|
|
{
|
2025-01-21 19:06:37 +03:30
|
|
|
if (OnMultipleOfThree.HasValue)
|
|
|
|
{
|
|
|
|
<td><button @onclick="()=>OnMultipleOfThree.Value.InvokeAsync(Convert.ToInt32(id))" type="button" class="btn btn-link">تعیین وضعیت</button></td>
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (OnMultipleOfThreeGeneric.HasValue)
|
|
|
|
{
|
|
|
|
<td><button @onclick="()=>OnMultipleOfThreeGeneric.Value.InvokeAsync(item)" type="button" class="btn btn-link">تعیین وضعیت</button></td>
|
|
|
|
|
|
|
|
}
|
2024-06-10 17:26:31 +03:30
|
|
|
}
|
|
|
|
else if (convertmodel.SentStatus == SentStatus.Unsuccessful)
|
|
|
|
{
|
2025-01-21 19:06:37 +03:30
|
|
|
if (OnMultipleOfThree.HasValue)
|
|
|
|
{
|
|
|
|
<td><button @onclick="()=>OnMultipleOfThree.Value.InvokeAsync(Convert.ToInt32(id))" type="button" class="btn btn-link">نمایش خطا</button></td>
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (OnMultipleOfThreeGeneric.HasValue)
|
|
|
|
{
|
|
|
|
<td><button @onclick="()=>OnMultipleOfThreeGeneric.Value.InvokeAsync(item)" type="button" class="btn btn-link">نمایش خطا</button></td>
|
|
|
|
|
|
|
|
}
|
2024-06-10 17:26:31 +03:30
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<td><button type="button" class="btn btn-link disabled">...</button></td>
|
|
|
|
}
|
2024-05-08 17:25:02 +03:30
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2025-01-21 19:06:37 +03:30
|
|
|
if (id > 0 /* || item.ToString() == "Shared.DTOs.Warehouse.CirculationDto" */)
|
2024-06-10 17:26:31 +03:30
|
|
|
{
|
2025-01-21 19:06:37 +03:30
|
|
|
if (OnMultipleOfThree.HasValue)
|
|
|
|
{
|
|
|
|
<td><button @onclick="()=>OnMultipleOfThree.Value.InvokeAsync(Convert.ToInt32(id))" type="button" class="btn btn-link">ویرایش</button></td>
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (OnMultipleOfThreeGeneric.HasValue)
|
|
|
|
{
|
|
|
|
<td><button @onclick="()=>OnMultipleOfThreeGeneric.Value.InvokeAsync(item)" type="button" class="btn btn-link">ویرایش</button></td>
|
|
|
|
|
|
|
|
}
|
2024-06-10 17:26:31 +03:30
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<td><button type="button" class="btn btn-link disabled">ویرایش</button></td>
|
|
|
|
}
|
2024-05-08 17:25:02 +03:30
|
|
|
}
|
2025-01-21 19:06:37 +03:30
|
|
|
|
2024-06-08 21:48:26 +03:30
|
|
|
|
2024-05-08 17:25:02 +03:30
|
|
|
}
|
2024-05-05 18:15:37 +03:30
|
|
|
</tr>
|
|
|
|
}
|
2024-05-08 17:25:02 +03:30
|
|
|
|
2024-05-05 18:15:37 +03:30
|
|
|
}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
@code {
|
|
|
|
[Parameter]
|
|
|
|
public List<T> ModelinComponent { get; set; } = new List<T>();
|
2025-01-21 19:06:37 +03:30
|
|
|
[Parameter] public EventCallback<int>? OnMultipleOfThree { get; set; }
|
|
|
|
[Parameter] public EventCallback<T>? OnMultipleOfThreeGeneric { get; set; }
|
|
|
|
|
2024-05-05 18:15:37 +03:30
|
|
|
}
|