Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update product attributes #107

Merged
merged 2 commits into from
Sep 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 97 additions & 101 deletions src/Web/Grand.Web/Views/Account/Auctions.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,58 +20,56 @@
<b-tab title="@Loc["Account.Auctions.Tab.Ongoing"]" active>
@if (Model.ProductBidList.Where(x => !x.Ended).Any())
{
<div id="auction-table-ongoing"></div>
<script>
var AuctionTableOngoing = Vue.extend({
template: '<b-table :fields="fields" :items="items"><template v-slot:cell(product)="data"><div v-html="data.value.nameraw"></div></template><template v-slot:cell(status)="data"><div v-html="data.value.statusraw"></div></template><template v-slot:cell(bid)="data"><div v-html="data.value.bidraw"></div></template><template v-slot:cell(endtime)="data"><div v-html="data.value.endtimeraw"></div></template></b-table>',
data: function () {
return {
fields: [
{ key: 'product', label: '@Loc["Account.CustomerAuctions.ProductName"]'},
{ key: 'status', label: '@Loc["Account.CustomerAuctions.Status"]'},
{ key: 'bid', label: '@Loc["Account.CustomerAuctions.Highestbid"]'},
{ key: 'endtime', label: '@Loc["Account.CustomerAuctions.AuctionEndTime"]'},
],
items: [
@{
var ongoing = Model.ProductBidList.Where(x => !x.Ended);
}
@foreach (var item in ongoing)
<div id="auction-table-ongoing" class="table-responsive">
<table class="table">
<thead role="rowgroup">
<tr role="row">
<th role="columnheader"><div>@Loc["Account.CustomerAuctions.ProductName"]</div></th>
<th role="columnheader"><div>@Loc["Account.CustomerAuctions.Status"]</div></th>
<th role="columnheader"><div>@Loc["Account.CustomerAuctions.Highestbid"]</div></th>
<th role="columnheader"><div>@Loc["Account.CustomerAuctions.AuctionEndTime"]</div></th>
</tr>
</thead>
<tbody role="rowgroup">
@{
var ongoing = Model.ProductBidList.Where(x => !x.Ended);
}
@foreach (var item in ongoing)
{
<tr role="row">
<td>
<div><a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })">@item.ProductName</a></div>
</td>
@if (item.HighestBidder)
{
<text>
<td>
<div>
<span class="text-success">@Loc["Account.CustomerAuctions.Status.HighestBidder"]</span>
</div>
</td>
}
else
{
product: {
nameraw: '<a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })">@item.ProductName</a>'
},
status: {
@if (item.HighestBidder)
{
<text>
statusraw: '<span class="text-success">@Loc["Account.CustomerAuctions.Status.HighestBidder"]</span>'
</text>
}
else
{
<text>
statusraw: '<span class="text-danger">@Loc["Account.CustomerAuctions.Status.Outbid"]</span>'
</text>
}
},
bid: {
bidraw: '@item.CurrentBidAmount @if (item.CurrentBidAmountValue > item.BidAmountValue) { <small>(@item.BidAmount)</small> }'
},
endtime: {
endtimeraw: '@item.EndBidDate'
}
},
</text>
}
]
}
}
})
new AuctionTableOngoing().$mount('#auction-table-ongoing')
</script>
<td>
<div>
<span class="text-danger">@Loc["Account.CustomerAuctions.Status.Outbid"]</span>
</div>
</td>
}
<td>
<div>
@item.CurrentBidAmount @if (item.CurrentBidAmountValue > item.BidAmountValue)
{<small>(@item.BidAmount)</small>}
</div>
</td>
<td>
<div>@item.EndBidDate</div>
</td>
</tr>
}
</tbody>
</table>
</div>
}
else
{
Expand All @@ -84,59 +82,57 @@
@if (Model.ProductBidList.Where(x => x.Ended).Any())
{

<div id="auction-table-ended"></div>
<script>
var AuctionTableEnded = Vue.extend({
template: '<b-table :fields="fields" :items="items"><template v-slot:cell(product)="data"><div v-html="data.value.nameraw"></div></template><template v-slot:cell(status)="data"><div v-html="data.value.statusraw"></div></template><template v-slot:cell(bid)="data"><div v-html="data.value.bidraw"></div></template><template v-slot:cell(endtime)="data"><div v-html="data.value.endtimeraw"></div></template></b-table>',
data: function () {
return {
fields: [
{ key: 'product', label: '@Loc["Account.CustomerAuctions.ProductName"]'},
{ key: 'status', label: '@Loc["Account.CustomerAuctions.Status"]'},
{ key: 'bid', label: '@Loc["Account.CustomerAuctions.Highestbid"]'},
{ key: 'endtime', label: '@Loc["Account.CustomerAuctions.AuctionEndTime"]'},
],
items: [
@{
var ended = Model.ProductBidList.Where(x => x.Ended);
}
<div id="auction-table-ended" class="table-responsive">
<table class="table">
<thead role="rowgroup">
<tr role="row">
<th role="columnheader"><div>@Loc["Account.CustomerAuctions.ProductName"]</div></th>
<th role="columnheader"><div>@Loc["Account.CustomerAuctions.Status"]</div></th>
<th role="columnheader"><div>@Loc["Account.CustomerAuctions.Highestbid"]</div></th>
<th role="columnheader"><div>@Loc["Account.CustomerAuctions.AuctionEndTime"]</div></th>
</tr>
</thead>
<tbody role="rowgroup">
@{
var ended = Model.ProductBidList.Where(x => x.Ended);
}

@foreach (var item in ended)
{
<text>
{
product: {
nameraw: '<a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })">@item.ProductName</a>'
},
status: {
@if (item.HighestBidder)
{
<text>
statusraw: '<span class="text-success">@Loc["Account.CustomerAuctions.Status.HighestBidder"]</span>'
</text>
}
else
{
<text>
statusraw: '<span class="text-danger">@Loc["Account.CustomerAuctions.Status.Outbid"]</span>'
</text>
}
},
bid: {
bidraw: '@item.CurrentBidAmount @if (item.CurrentBidAmountValue > item.BidAmountValue) { <small>(@item.BidAmount)</small> }'
},
endtime: {
endtimeraw: '@item.EndBidDate'
}
},
</text>
}
]
@foreach (var item in ended)
{
<tr role="row">
<td>
<div><a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })">@item.ProductName</a></div>
</td>
@if (item.HighestBidder)
{
<td>
<div>
<span class="text-success">@Loc["Account.CustomerAuctions.Status.HighestBidder"]</span>
</div>
</td>
}
else
{
<td>
<div>
<span class="text-danger">@Loc["Account.CustomerAuctions.Status.Outbid"]</span>
</div>
</td>
}
<td>
<div>
@item.CurrentBidAmount @if (item.CurrentBidAmountValue > item.BidAmountValue)
{<small>(@item.BidAmount)</small>}
</div>
</td>
<td>
<div>@item.EndBidDate</div>
</td>
</tr>
}
}
})
new AuctionTableEnded().$mount('#auction-table-ended')
</script>
</tbody>
</table>
</div>
}
else
{
Expand Down
Loading