storj/web/marketing/pages/referral-offers.html
Faris Huskovic 0d294103e9
satellite/rewards: nicer offers handling (#2390)
* organize offers

* revert changes to go.mod and go.sum

* change OfferStatus enums back to original

* revert modified auto-gen files

* don't render empty row if offers is empty

* change return val of ListAll to Offers

* fix build

* add method to check for empty offer when rendering template

* fix typo

* fix lint and typos

* lean out IsEmpty

* dont use named return vals

* better clarify offer statuses

* change back order of setting offer.Status

* lint

* satellite/marketingweb: allow disabling rewards (#2392)

* implement handler for stop offer endpoint

* use proper text and fix data-target for free-credit stop modal
2019-07-10 13:12:40 -04:00

69 lines
2.8 KiB
HTML

<!-- Copyright (C) 2019 Storj Labs, Inc.
See LICENSE for copying information. -->
{{define "referralOffers"}}
<div class="offers-table mt-2 mb-5 container">
<div class="row">
<div class="col col-heading">Name</div>
<div class="col col-heading">Give Credit</div>
<div class="col col-heading">Award Credit</div>
<div class="col col-heading">Referrals Used</div>
<div class="col col-heading">Redeemable Capacity</div>
<div class="col col-heading">Created</div>
<div class="col col-heading">Expiration</div>
<div class="col col-heading">Status</div>
</div><hr>
<div class="row offer-heading ">
<p class="offer-type">Default&nbsp;Offer</p>
</div>
{{$defaultOffer := .ReferralOffers.Default}}
{{if not $defaultOffer.IsEmpty}}
<div class="row data-row">
<div class="col ml-3">{{$defaultOffer.Name}}</div>
<div class="col">${{$defaultOffer.InviteeCredit}}</div>
<div class="col">${{$defaultOffer.AwardCredit}}</div>
<div class="col">{{$defaultOffer.NumRedeemed}}</div>
<div class="col">&#8734;</div>
<div class="col">{{printf "%.10s" $defaultOffer.CreatedAt}}</div>
<div class="col">&#8734;</div>
<div class="col"></div>
</div><hr>
{{end}}
<div class="row offer-heading ">
<p class="offer-type">Current&nbsp;Offer</p>
</div>
{{$currentOffer := .ReferralOffers.Active}}
{{if not $currentOffer.IsEmpty}}
<div class="row data-row">
<div class="col ml-3">{{$currentOffer.Name}}</div>
<div class="col">${{$currentOffer.InviteeCredit}}</div>
<div class="col">${{$currentOffer.AwardCredit}}</div>
<div class="col">{{$currentOffer.NumRedeemed}}</div>
<div class="col">{{$currentOffer.RedeemableCap}}</div>
<div class="col">{{printf "%.10s" $currentOffer.CreatedAt}}</div>
<div class="col">{{printf "%.10s" $currentOffer.ExpiresAt}}</div>
<div class="col stop-offer">
<span data-toggle="modal" data-target=".stop-referral-offer-modal">
<strong>Live &#183;</strong>
</span>
</div>
</div><hr>
{{end}}
{{template "stopReferralOffer" .}}
<div class="row offer-heading ">
<p class="offer-type">Other&nbsp;Offers</p>
</div>
{{range .ReferralOffers.Done}}
<div class="row data-row">
<div class="col ml-3">{{.Name}}</div>
<div class="col">${{.InviteeCredit}}</div>
<div class="col">${{.AwardCredit}}</div>
<div class="col">{{.NumRedeemed}}</div>
<div class="col">{{.RedeemableCap}}</div>
<div class="col">{{printf "%.10s" .CreatedAt}}</div>
<div class="col">{{printf "%.10s" .ExpiresAt}}</div>
<div class="col">off</div>
</div><hr>
{{end}}
</div>
{{end}}