mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Working mail rule & account edit
This commit is contained in:
@@ -234,8 +234,8 @@
|
||||
|
||||
<li *ngFor="let account of mailAccounts" class="list-group-item" [formGroupName]="account.id">
|
||||
<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 d-flex align-items-center"><button class="btn btn-link p-0" type="button" (click)="editMailAccount(account)">{{account.name}}</button></div>
|
||||
<div class="col d-flex align-items-center">{{account.imap_server}}</div>
|
||||
<div class="col">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" type="button" (click)="editMailAccount(account)" i18n>Edit</button>
|
||||
@@ -261,8 +261,8 @@
|
||||
|
||||
<li *ngFor="let rule of mailRules" class="list-group-item" [formGroupName]="rule.id">
|
||||
<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 d-flex align-items-center"><button class="btn btn-link p-0" type="button" (click)="editMailRule(rule)">{{rule.name}}</button></div>
|
||||
<div class="col d-flex align-items-center">{{(mailAccountService.getCached(rule.account) | async)?.name}}</div>
|
||||
<div class="col">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" type="button" (click)="editMailRule(rule)" i18n>Edit</button>
|
||||
|
@@ -31,7 +31,7 @@ import { ViewportScroller } from '@angular/common'
|
||||
import { TourService } from 'ngx-ui-tour-ng-bootstrap'
|
||||
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 { 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'
|
||||
@@ -477,28 +477,30 @@ export class SettingsComponent
|
||||
}
|
||||
|
||||
editMailAccount(account: PaperlessMailAccount) {
|
||||
console.log(account)
|
||||
|
||||
var modal = this.modalService.open(MailAccountEditDialogComponent, {
|
||||
backdrop: 'static',
|
||||
size: 'xl',
|
||||
})
|
||||
modal.componentInstance.dialogMode = 'edit'
|
||||
modal.componentInstance.object = account
|
||||
// TODO: saving
|
||||
// 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)
|
||||
// })
|
||||
modal.componentInstance.success
|
||||
.pipe(takeUntil(this.unsubscribeNotifier))
|
||||
.subscribe({
|
||||
next: (newMailAccount) => {
|
||||
this.toastService.showInfo(
|
||||
$localize`Saved account "${newMailAccount.name}".`
|
||||
)
|
||||
this.mailAccountService.listAll().subscribe((r) => {
|
||||
this.mailAccounts = r.results
|
||||
this.initialize()
|
||||
})
|
||||
},
|
||||
error: (e) => {
|
||||
this.toastService.showError(
|
||||
$localize`Error saving account: ${e.toString()}.`
|
||||
)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
deleteMailAccount(account: PaperlessMailAccount) {
|
||||
@@ -517,28 +519,31 @@ export class SettingsComponent
|
||||
}
|
||||
|
||||
editMailRule(rule: PaperlessMailRule) {
|
||||
console.log(rule)
|
||||
|
||||
var modal = this.modalService.open(MailRuleEditDialogComponent, {
|
||||
backdrop: 'static',
|
||||
size: 'xl',
|
||||
})
|
||||
modal.componentInstance.dialogMode = 'edit'
|
||||
modal.componentInstance.object = rule
|
||||
// TODO: saving
|
||||
// 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)
|
||||
// })
|
||||
modal.componentInstance.success
|
||||
.pipe(takeUntil(this.unsubscribeNotifier))
|
||||
.subscribe({
|
||||
next: (newMailRule) => {
|
||||
this.toastService.showInfo(
|
||||
$localize`Saved rule "${newMailRule.name}".`
|
||||
)
|
||||
this.mailRuleService.listAll().subscribe((r) => {
|
||||
this.mailRules = r.results
|
||||
|
||||
this.initialize()
|
||||
})
|
||||
},
|
||||
error: (e) => {
|
||||
this.toastService.showError(
|
||||
$localize`Error saving rule: ${e.toString()}.`
|
||||
)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
deleteMailRule(rule: PaperlessMailRule) {
|
||||
|
Reference in New Issue
Block a user