mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-30 18:27:45 -05:00
Mail account edit dialog
This commit is contained in:
@@ -222,28 +222,48 @@
|
||||
<ng-template ngbNavContent>
|
||||
|
||||
<h4 i18n>Mail accounts</h4>
|
||||
<div formGroupName="mailAccounts">
|
||||
<ul formGroupName="mailAccounts">
|
||||
|
||||
<div *ngFor="let account of mailAccounts" [formGroupName]="account.id" class="row">
|
||||
<div class="mb-3 col">
|
||||
{{account.name}}
|
||||
<li class="row mb-1">
|
||||
<div class="row">
|
||||
<div class="col" i18n>Name</div>
|
||||
<div class="col" i18n>Server</div>
|
||||
<div class="col"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li *ngFor="let account of mailAccounts" [formGroupName]="account.id" class="row mb-1">
|
||||
<div class="row">
|
||||
<div class="col"><button class="btn btn-link p-0" type="button" (click)="editMailAccount(account)">{{account.name}}</button></div>
|
||||
<div class="col">{{account.imap_server}}</div>
|
||||
<div class="col"><button class="btn btn-primary" type="button" (click)="editMailAccount(account)" i18n>Edit</button></div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<div *ngIf="mailAccounts.length == 0" i18n>No mail accounts defined.</div>
|
||||
</div>
|
||||
</ul>
|
||||
|
||||
<h4 i18n>Mail rules</h4>
|
||||
<div formGroupName="mailRules">
|
||||
<h4 class="mt-4" i18n>Mail rules</h4>
|
||||
<ul formGroupName="mailRules">
|
||||
|
||||
<div *ngFor="let rule of mailRules" [formGroupName]="rule.id" class="row">
|
||||
<div class="mb-3 col">
|
||||
{{rule.name}}
|
||||
<li class="row mb-1">
|
||||
<div class="row">
|
||||
<div class="col" i18n>Name</div>
|
||||
<div class="col" i18n>Account</div>
|
||||
<div class="col"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li *ngFor="let rule of mailRules" [formGroupName]="rule.id" class="row">
|
||||
<div class="row">
|
||||
<div class="col"><button class="btn btn-link p-0" type="button" (click)="editMailRule(rule)">{{rule.name}}</button></div>
|
||||
<div class="col">{{rule.account.name}}</div>
|
||||
<div class="col"><button class="btn btn-primary" type="button" (click)="editMailRule(rule)" i18n>Edit</button></div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<div *ngIf="mailRules.length == 0" i18n>No mail rules defined.</div>
|
||||
</div>
|
||||
</ul>
|
||||
|
||||
</ng-template>
|
||||
</li>
|
||||
|
@@ -33,6 +33,8 @@ import { PaperlessMailAccount } from 'src/app/data/paperless-mail-account'
|
||||
import { PaperlessMailRule } from 'src/app/data/paperless-mail-rule'
|
||||
import { MailAccountService as MailAccountService } from 'src/app/services/rest/mail-account.service'
|
||||
import { MailRuleService } from 'src/app/services/rest/mail-rule.service'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { MailAccountEditDialogComponent } from '../../common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component'
|
||||
|
||||
@Component({
|
||||
selector: 'app-settings',
|
||||
@@ -104,7 +106,8 @@ export class SettingsComponent
|
||||
@Inject(LOCALE_ID) public currentLocale: string,
|
||||
private viewportScroller: ViewportScroller,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
public readonly tourService: TourService
|
||||
public readonly tourService: TourService,
|
||||
private modalService: NgbModal
|
||||
) {
|
||||
this.settings.settingsSaved.subscribe(() => {
|
||||
if (!this.savePending) this.initialize()
|
||||
@@ -470,4 +473,32 @@ export class SettingsComponent
|
||||
clearThemeColor() {
|
||||
this.settingsForm.get('themeColor').patchValue('')
|
||||
}
|
||||
|
||||
editMailAccount(account: PaperlessMailAccount) {
|
||||
console.log(account)
|
||||
|
||||
var modal = this.modalService.open(MailAccountEditDialogComponent, {
|
||||
backdrop: 'static',
|
||||
size: 'xl',
|
||||
})
|
||||
modal.componentInstance.dialogMode = 'edit'
|
||||
modal.componentInstance.object = account
|
||||
// modal.componentInstance.success
|
||||
// .pipe(
|
||||
// switchMap((newStoragePath) => {
|
||||
// return this.storagePathService
|
||||
// .listAll()
|
||||
// .pipe(map((storagePaths) => ({ newStoragePath, storagePaths })))
|
||||
// })
|
||||
// )
|
||||
// .pipe(takeUntil(this.unsubscribeNotifier))
|
||||
// .subscribe(({ newStoragePath, storagePaths }) => {
|
||||
// this.storagePaths = storagePaths.results
|
||||
// this.documentForm.get('storage_path').setValue(newStoragePath.id)
|
||||
// })
|
||||
}
|
||||
|
||||
editMailRule(rule: PaperlessMailRule) {
|
||||
console.log(rule)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user