152 lines
6.5 KiB
Plaintext
152 lines
6.5 KiB
Plaintext
@model Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Models.CustomerCreditModel
|
|
@using Nop.Web.Framework.UI
|
|
|
|
@{
|
|
// Layout = "_FruitBankAdminLayout";
|
|
var remaining = Model.RemainingCredit;
|
|
var statusClass = !Model.HasCreditLimit ? "status-unlimited"
|
|
: remaining <= 0 ? "status-blocked"
|
|
: remaining < Model.CreditLimit * 0.2m ? "status-warning"
|
|
: "status-ok";
|
|
}
|
|
|
|
<style>
|
|
.credit-summary { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
|
|
.credit-card { flex: 1; min-width: 160px; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 1rem 1.25rem; }
|
|
.credit-card .label { font-size: 0.78rem; color: #666; margin-bottom: .3rem; }
|
|
.credit-card .value { font-size: 1.4rem; font-weight: 700; }
|
|
.status-ok .value { color: #2d7a3a; }
|
|
.status-warning .value { color: #f4a236; }
|
|
.status-blocked .value { color: #c0392b; }
|
|
.status-unlimited .value { color: #555; }
|
|
.back-link { margin-bottom: 1rem; display: inline-block; }
|
|
</style>
|
|
|
|
<a class="back-link" href="/Admin/Customer/Edit/@Model.CustomerId">
|
|
<i class="fa fa-arrow-left"></i> @T("Plugins.Misc.FruitBankPlugin.CustomerCredit.BackToCustomer")
|
|
</a>
|
|
|
|
<div class="content-header clearfix">
|
|
<h1 class="pull-left">
|
|
@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.PageTitle") — @Model.CustomerName (@Model.CustomerEmail)
|
|
</h1>
|
|
</div>
|
|
|
|
@* ── Summary cards ── *@
|
|
<div class="credit-summary">
|
|
<div class="credit-card">
|
|
<div class="label">@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.CreditLimit")</div>
|
|
<div class="value">@(Model.HasCreditLimit ? Model.CreditLimit.ToString("N0") + " Ft" : "—")</div>
|
|
</div>
|
|
<div class="credit-card">
|
|
<div class="label">@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.OutstandingBalance")</div>
|
|
<div class="value">@Model.OutstandingBalance.ToString("N0") Ft</div>
|
|
</div>
|
|
<div class="credit-card @statusClass">
|
|
<div class="label">@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.RemainingCredit")</div>
|
|
<div class="value">
|
|
@if (!Model.HasCreditLimit)
|
|
{
|
|
@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.Unlimited")
|
|
}
|
|
else
|
|
{
|
|
@remaining!.Value.ToString("N0")
|
|
<span style="font-size:.9rem">Ft</span>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@* ── Edit form ── *@
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
<h3 class="panel-title">@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.EditTitle")</h3>
|
|
</div>
|
|
<div class="panel-body">
|
|
<form asp-action="Save" asp-controller="CustomerCredit" asp-area="Admin" method="post">
|
|
<input type="hidden" name="CustomerId" value="@Model.CustomerId" />
|
|
<input type="hidden" name="CreditId" value="@Model.CreditId" />
|
|
|
|
<div class="form-group row">
|
|
<div class="col-md-3 col-form-label">
|
|
<label>@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.CreditLimit")</label>
|
|
</div>
|
|
<div class="col-md-9">
|
|
<input type="number" name="CreditLimit" value="@Model.CreditLimit" min="0" step="1000" class="form-control" style="max-width:240px" />
|
|
<small class="form-text text-muted">@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.CreditLimitHint")</small>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<div class="col-md-3 col-form-label">
|
|
<label>@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.Comment")</label>
|
|
</div>
|
|
<div class="col-md-9">
|
|
<textarea name="Comment" class="form-control" rows="3" style="max-width:480px">@Model.Comment</textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<div class="col-md-9 offset-md-3">
|
|
<button type="submit" class="btn btn-primary">
|
|
<i class="fa fa-save"></i> @T("Plugins.Misc.FruitBankPlugin.CustomerCredit.Save")
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
@* ── Unpaid orders table ── *@
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
<h3 class="panel-title">@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.UnpaidOrdersTitle") (@Model.UnpaidOrders.Count)</h3>
|
|
</div>
|
|
<div class="panel-body">
|
|
@if (!Model.UnpaidOrders.Any())
|
|
{
|
|
<p class="text-muted">@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.NoUnpaidOrders")</p>
|
|
}
|
|
else
|
|
{
|
|
<table class="table table-bordered table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.OrderId")</th>
|
|
<th>@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.OrderDate")</th>
|
|
<th>@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.OrderTotal")</th>
|
|
<th>@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.OrderStatus")</th>
|
|
<th>@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.PaymentStatus")</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var o in Model.UnpaidOrders)
|
|
{
|
|
<tr>
|
|
<td>#@o.OrderId</td>
|
|
<td>@o.CreatedOnUtc.ToLocalTime().ToString("yyyy.MM.dd HH:mm")</td>
|
|
<td><strong>@o.OrderTotal.ToString("N0") Ft</strong></td>
|
|
<td>@o.OrderStatus</td>
|
|
<td>@o.PaymentStatus</td>
|
|
<td>
|
|
<a href="/Admin/Order/Edit/@o.OrderId" class="btn btn-xs btn-default" target="_blank">
|
|
<i class="fa fa-external-link"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td colspan="2"><strong>@T("Plugins.Misc.FruitBankPlugin.CustomerCredit.Total")</strong></td>
|
|
<td><strong>@Model.OutstandingBalance.ToString("N0") Ft</strong></td>
|
|
<td colspan="3"></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
}
|
|
</div>
|
|
</div>
|