35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { Component, inject } from '@angular/core';
|
|
import { Chain } from '../../models/Chain';
|
|
import { ChainFormGroup } from '../../pages/settings/chains/chain-formgroup';
|
|
import { ActionBtn } from '../action-btn/action-btn';
|
|
import { TranslatePipe } from '@ngx-translate/core';
|
|
import { UpperfirstPipe } from '../../pipes/upperfirst-pipe';
|
|
import { ChainSettings } from '../../services/chain-settings';
|
|
import { SettingsBaseAddEdit } from '../settings-base-add-edit/settings-base-add-edit';
|
|
|
|
@Component({
|
|
selector: 'app-chain-add',
|
|
imports: [
|
|
ActionBtn,
|
|
TranslatePipe,
|
|
UpperfirstPipe,
|
|
],
|
|
templateUrl: './../settings-base-add-edit/settings-base-add-edit.html',
|
|
styleUrl: './../settings-base-add-edit/settings-base-add-edit.scss',
|
|
})
|
|
export class ChainAdd extends SettingsBaseAddEdit {
|
|
private readonly chainSettings = inject(ChainSettings);
|
|
|
|
readonly form = new ChainFormGroup();
|
|
btnText = 'common.save';
|
|
title = 'settings.chain.new_chain';
|
|
|
|
async submit() {
|
|
const name = this.form.controls.name.value;
|
|
const img = this.form.controls.image.value;
|
|
//TODO: the sqlite bridge can't handle null as param
|
|
const chain = new Chain(name, '');
|
|
await this.chainSettings.save(chain, img);
|
|
}
|
|
}
|