2021-02-03 22:24:49 +01:00
|
|
|
import {
|
|
|
|
Component,
|
|
|
|
NgZone,
|
|
|
|
OnInit,
|
|
|
|
} from '@angular/core';
|
|
|
|
|
|
|
|
import { EnvironmentService } from 'jslib/abstractions/environment.service';
|
|
|
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
|
|
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
|
|
|
import { SearchService } from 'jslib/abstractions/search.service';
|
|
|
|
import { SendService } from 'jslib/abstractions/send.service';
|
|
|
|
|
|
|
|
import { SendComponent as BaseSendComponent } from 'jslib/angular/components/send/send.component';
|
|
|
|
|
|
|
|
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
|
|
|
|
|
|
|
import { SendView } from 'jslib/models/view/sendView';
|
|
|
|
|
|
|
|
enum Action {
|
|
|
|
None = '',
|
|
|
|
Add = 'add',
|
|
|
|
Edit = 'edit',
|
|
|
|
}
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-send',
|
|
|
|
templateUrl: 'send.component.html',
|
|
|
|
})
|
|
|
|
export class SendComponent extends BaseSendComponent implements OnInit {
|
|
|
|
sendId: string;
|
|
|
|
action: Action = Action.None;
|
|
|
|
|
|
|
|
constructor(sendService: SendService, i18nService: I18nService,
|
|
|
|
platformUtilsService: PlatformUtilsService, environmentService: EnvironmentService,
|
|
|
|
broadcasterService: BroadcasterService, ngZone: NgZone,
|
2021-02-04 05:21:17 +01:00
|
|
|
searchService: SearchService) {
|
2021-02-03 22:24:49 +01:00
|
|
|
super(sendService, i18nService, platformUtilsService,
|
|
|
|
environmentService, broadcasterService, ngZone, searchService);
|
|
|
|
}
|
|
|
|
|
|
|
|
addSend() {
|
|
|
|
this.sendId = null;
|
2021-02-04 05:50:41 +01:00
|
|
|
this.action = Action.Add;
|
2021-02-03 22:24:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
editSend(send: SendView) {
|
2021-02-04 05:12:23 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
selectSend(send: SendView) {
|
2021-02-03 22:24:49 +01:00
|
|
|
this.sendId = send.id;
|
2021-02-04 05:50:41 +01:00
|
|
|
this.action = Action.Edit;
|
2021-02-03 22:24:49 +01:00
|
|
|
}
|
|
|
|
|
2021-02-04 05:50:41 +01:00
|
|
|
get selectedSendType() {
|
2021-02-08 18:20:12 +01:00
|
|
|
return this.sends.find(s => s.id === this.sendId).type;
|
2021-02-03 22:24:49 +01:00
|
|
|
}
|
|
|
|
}
|