Commit 23fdbe18 authored by Emiliano Balbuena's avatar Emiliano Balbuena

(chore): Disallow cancelling if not created or approved

1 merge request!387WIP: Boost Campaigns (&24)
Pipeline #71166146 passed with stages
in 29 minutes and 3 seconds
......@@ -7,7 +7,7 @@
<div class="m-page--section-button-bar">
<h1>
<ng-container *ngIf="!isEditing; else titleIsEditing" i18n>New Campaign</ng-container>
<ng-template #titleIsEditing>Edit Campaign</ng-template>
<ng-template #titleIsEditing i18n>Edit Campaign</ng-template>
</h1>
<div class="m-page--section-button-bar--buttons">
......@@ -185,7 +185,7 @@
<div class="m-form--error" *ngIf="currentError && !inProgress">{{currentError}}</div>
</div>
<div class="m-form--field" *ngIf="isEditing">
<div class="m-form--field" *ngIf="canCancel()">
<button
type="button"
(click)="cancel($event);"
......
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from '@angular/router';
import { Campaign, CampaignPayment } from "../campaigns.type";
import { Campaign, CampaignDeliveryStatus, CampaignPayment } from "../campaigns.type";
import { CampaignsService } from '../campaigns.service';
import { Subscription } from 'rxjs';
import { Tag } from '../../../hashtags/types/tag';
......@@ -148,6 +148,10 @@ export class BoostCampaignsCreatorComponent implements OnInit, OnDestroy {
}
}
canCancel() {
return this.isEditing && (['created', 'approved'] as CampaignDeliveryStatus[]).indexOf(this.campaign.delivery_status) > -1;
}
get types() {
return this.service.getTypes();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment