mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
57 lines
1.5 KiB
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { Component, Input } from '@angular/core';
|
|
import { DialogModel } from '@app/shared';
|
|
import { Observable, of, Subject } from 'rxjs';
|
|
|
|
const OPTION_IMMEDIATELY = 'Immediately';
|
|
|
|
@Component({
|
|
selector: 'sqx-due-time-selector',
|
|
styleUrls: ['./due-time-selector.component.scss'],
|
|
templateUrl: './due-time-selector.component.html'
|
|
})
|
|
export class DueTimeSelectorComponent {
|
|
private dueTimeResult: Subject<string | null>;
|
|
|
|
@Input()
|
|
public disabled?: boolean | null;
|
|
|
|
public dueTimeDialog = new DialogModel();
|
|
public dueTime: string | null = '';
|
|
public dueTimeAction: string | null = '';
|
|
public dueTimeMode = OPTION_IMMEDIATELY;
|
|
|
|
public selectDueTime(action: string): Observable<string | null> {
|
|
if (this.disabled) {
|
|
return of(null);
|
|
}
|
|
|
|
this.dueTimeAction = action;
|
|
this.dueTimeResult = new Subject<string | null>();
|
|
this.dueTimeDialog.show();
|
|
|
|
return this.dueTimeResult;
|
|
}
|
|
|
|
public confirmStatusChange() {
|
|
const result = this.dueTimeMode === OPTION_IMMEDIATELY ? null : this.dueTime;
|
|
|
|
this.dueTimeResult.next(result);
|
|
this.dueTimeResult.complete();
|
|
|
|
this.cancelStatusChange();
|
|
}
|
|
|
|
public cancelStatusChange() {
|
|
this.dueTimeMode = OPTION_IMMEDIATELY;
|
|
this.dueTimeDialog.hide();
|
|
this.dueTimeResult = null!;
|
|
this.dueTime = null;
|
|
}
|
|
}
|