mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Add new fields to admin panel (#14943)
* Add new fields to admin panel * fix lint * Update hall.js * fix(plab): plab * fix(lint): destructure assignment * fix(subs): coerce offset to number --------- Co-authored-by: SabreCat <sabe@habitica.com>
This commit is contained in:
@@ -21,22 +21,40 @@
|
|||||||
Group plan ID:
|
Group plan ID:
|
||||||
<strong>{{ hero.purchased.plan.owner }}</strong>
|
<strong>{{ hero.purchased.plan.owner }}</strong>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="hero.purchased.plan.dateCreated">
|
<div v-if="hero.purchased.plan.dateCreated" class="form-inline">
|
||||||
|
<label>
|
||||||
Creation date:
|
Creation date:
|
||||||
<strong>{{ dateFormat(hero.purchased.plan.dateCreated) }}</strong>
|
<input
|
||||||
|
v-model="hero.purchased.plan.dateCreated"
|
||||||
|
class="form-control"
|
||||||
|
type="text"
|
||||||
|
> <strong class="ml-2">{{ dateFormat(hero.purchased.plan.dateCreated) }}</strong>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="hero.purchased.plan.dateCurrentTypeCreated">
|
<div v-if="hero.purchased.plan.dateCurrentTypeCreated" class="form-inline">
|
||||||
|
<label>
|
||||||
Start date for current subscription type:
|
Start date for current subscription type:
|
||||||
<strong>{{ dateFormat(hero.purchased.plan.dateCurrentTypeCreated) }}</strong>
|
<input
|
||||||
|
v-model="hero.purchased.plan.dateCurrentTypeCreated"
|
||||||
|
class="form-control"
|
||||||
|
type="text"
|
||||||
|
>
|
||||||
|
</label>
|
||||||
|
<strong class="ml-2">{{dateFormat(hero.purchased.plan.dateCurrentTypeCreated)}}</strong>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="form-inline">
|
||||||
|
<label>
|
||||||
Termination date:
|
Termination date:
|
||||||
<strong
|
<div
|
||||||
v-if="hero.purchased.plan.dateTerminated"
|
v-if="hero.purchased.plan.dateTerminated">
|
||||||
>
|
<input
|
||||||
{{ dateFormat(hero.purchased.plan.dateTerminated) }}
|
v-model="hero.purchased.plan.dateTerminated"
|
||||||
</strong>
|
class="form-control"
|
||||||
<strong v-else> None </strong>
|
type="text"
|
||||||
|
> <strong class="ml-2">{{ dateFormat(hero.purchased.plan.dateTerminated) }}</strong>
|
||||||
|
</div>
|
||||||
|
<strong v-else> None</strong>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-inline">
|
<div class="form-inline">
|
||||||
<label>
|
<label>
|
||||||
@@ -50,9 +68,17 @@
|
|||||||
>
|
>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="form-inline">
|
||||||
Perk offset months:
|
<label>
|
||||||
<strong>{{ hero.purchased.plan.consecutive.offset }}</strong>
|
Perk offset months:
|
||||||
|
<input
|
||||||
|
v-model="hero.purchased.plan.consecutive.offset"
|
||||||
|
class="form-control"
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
step="1"
|
||||||
|
>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-inline">
|
<div class="form-inline">
|
||||||
Perk month count:
|
Perk month count:
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ export function getPlanContext (user, now) {
|
|||||||
const planMonths = subscriptionBlocks[plan.planId] ? subscriptionBlocks[plan.planId].months : 1;
|
const planMonths = subscriptionBlocks[plan.planId] ? subscriptionBlocks[plan.planId].months : 1;
|
||||||
let monthsTillNextHourglass;
|
let monthsTillNextHourglass;
|
||||||
if (planMonths > 1) {
|
if (planMonths > 1) {
|
||||||
monthsTillNextHourglass = plan.consecutive.offset + 1;
|
monthsTillNextHourglass = Number(plan.consecutive.offset) + 1;
|
||||||
} else {
|
} else {
|
||||||
monthsTillNextHourglass = 3 - plan.perkMonthCount;
|
monthsTillNextHourglass = 3 - plan.perkMonthCount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,15 +275,25 @@ api.updateHero = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (updateData.purchased && updateData.purchased.plan) {
|
if (updateData.purchased && updateData.purchased.plan) {
|
||||||
if (updateData.purchased.plan.gemsBought) {
|
const { plan } = updateData.purchased;
|
||||||
hero.purchased.plan.gemsBought = updateData.purchased.plan.gemsBought;
|
if (plan.gemsBought) {
|
||||||
|
hero.purchased.plan.gemsBought = plan.gemsBought;
|
||||||
}
|
}
|
||||||
if (updateData.purchased.plan.perkMonthCount) {
|
if (plan.dateCreated) {
|
||||||
hero.purchased.plan.perkMonthCount = updateData.purchased.plan.perkMonthCount;
|
hero.purchased.plan.dateCreated = plan.dateCreated;
|
||||||
}
|
}
|
||||||
if (updateData.purchased.plan.consecutive) {
|
if (plan.dateCurrentTypeCreated) {
|
||||||
if (updateData.purchased.plan.consecutive.trinkets) {
|
hero.purchased.plan.dateCurrentTypeCreated = plan.dateCurrentTypeCreated;
|
||||||
const changedHourglassTrinkets = updateData.purchased.plan.consecutive.trinkets
|
}
|
||||||
|
if (plan.dateTerminated) {
|
||||||
|
hero.purchased.plan.dateTerminated = plan.dateTerminated;
|
||||||
|
}
|
||||||
|
if (plan.perkMonthCount) {
|
||||||
|
hero.purchased.plan.perkMonthCount = plan.perkMonthCount;
|
||||||
|
}
|
||||||
|
if (plan.consecutive) {
|
||||||
|
if (plan.consecutive.trinkets) {
|
||||||
|
const changedHourglassTrinkets = plan.consecutive.trinkets
|
||||||
- hero.purchased.plan.consecutive.trinkets;
|
- hero.purchased.plan.consecutive.trinkets;
|
||||||
|
|
||||||
if (changedHourglassTrinkets !== 0) {
|
if (changedHourglassTrinkets !== 0) {
|
||||||
@@ -293,13 +303,16 @@ api.updateHero = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
hero.purchased.plan.consecutive.trinkets = updateData.purchased.plan.consecutive.trinkets;
|
hero.purchased.plan.consecutive.trinkets = plan.consecutive.trinkets;
|
||||||
}
|
}
|
||||||
if (updateData.purchased.plan.consecutive.gemCapExtra) {
|
if (plan.consecutive.gemCapExtra) {
|
||||||
hero.purchased.plan.consecutive.gemCapExtra = updateData.purchased.plan.consecutive.gemCapExtra; // eslint-disable-line max-len
|
hero.purchased.plan.consecutive.gemCapExtra = plan.consecutive.gemCapExtra; // eslint-disable-line max-len
|
||||||
}
|
}
|
||||||
if (updateData.purchased.plan.consecutive.count) {
|
if (plan.consecutive.count) {
|
||||||
hero.purchased.plan.consecutive.count = updateData.purchased.plan.consecutive.count; // eslint-disable-line max-len
|
hero.purchased.plan.consecutive.count = plan.consecutive.count; // eslint-disable-line max-len
|
||||||
|
}
|
||||||
|
if (plan.consecutive.offset) {
|
||||||
|
hero.purchased.plan.consecutive.offset = plan.consecutive.offset; // eslint-disable-line max-len
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user