mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Mail form tweaks
Include add button Include add button
This commit is contained in:
@@ -4,7 +4,6 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { EditDialogComponent } from 'src/app/components/common/edit-dialog/edit-dialog.component'
|
||||
import {
|
||||
IMAPSecurity,
|
||||
IMAPSecurityLabels,
|
||||
PaperlessMailAccount,
|
||||
} from 'src/app/data/paperless-mail-account'
|
||||
import { MailAccountService } from 'src/app/services/rest/mail-account.service'
|
||||
@@ -40,6 +39,10 @@ export class MailAccountEditDialogComponent extends EditDialogComponent<Paperles
|
||||
}
|
||||
|
||||
get imapSecurityOptions() {
|
||||
return IMAPSecurityLabels
|
||||
return [
|
||||
{ id: IMAPSecurity.None, name: $localize`No encryption` },
|
||||
{ id: IMAPSecurity.SSL, name: $localize`SSL` },
|
||||
{ id: IMAPSecurity.STARTTLS, name: $localize`STARTTLS` },
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@@ -10,24 +10,25 @@
|
||||
<app-input-text i18n-title title="Name" formControlName="name" [error]="error?.name"></app-input-text>
|
||||
<app-input-text i18n-title title="Order" formControlName="order" [error]="error?.order"></app-input-text>
|
||||
<app-input-select i18n-title title="Account" [items]="accounts" formControlName="account"></app-input-select>
|
||||
<app-input-text i18n-title title="Folder" formControlName="folder" [error]="error?.folder"></app-input-text>
|
||||
<app-input-number i18n-title title="Maximum age" formControlName="maximum_age" [error]="error?.maximum_age"></app-input-number>
|
||||
<app-input-text i18n-title title="Folder" formControlName="folder" i18n-hint hint="Subfolders must be separated by a delimiter, often a dot ('.') or slash ('/'), but it varies by mail server." [error]="error?.folder"></app-input-text>
|
||||
<app-input-number i18n-title title="Maximum age (days)" formControlName="maximum_age" [showAdd]="false" [error]="error?.maximum_age"></app-input-number>
|
||||
<app-input-select i18n-title title="Attachment type" [items]="attachmentTypeOptions" formControlName="attachment_type"></app-input-select>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="small" i18n>Paperless will only process mails that match <em>all</em> of the filters specified below.</p>
|
||||
<app-input-text i18n-title title="Filter from" formControlName="filter_from" [error]="error?.filter_from"></app-input-text>
|
||||
<app-input-text i18n-title title="Filter subject" formControlName="filter_subject" [error]="error?.filter_subject"></app-input-text>
|
||||
<app-input-text i18n-title title="Filter body" formControlName="filter_body" [error]="error?.filter_body"></app-input-text>
|
||||
<app-input-text i18n-title title="Filter attachment filename" formControlName="filter_attachment_filename" [error]="error?.filter_attachment_filename"></app-input-text>
|
||||
<app-input-select i18n-title title="Action" [items]="actionOptions" formControlName="attachment_type"></app-input-select>
|
||||
<app-input-text i18n-title title="Action parameter" formControlName="action_parameter" [error]="error?.action_parameter"></app-input-text>
|
||||
<app-input-text i18n-title title="Filter attachment filename" formControlName="filter_attachment_filename" i18n-hint hint="Only consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive." [error]="error?.filter_attachment_filename"></app-input-text>
|
||||
</div>
|
||||
<div class="col">
|
||||
<app-input-select i18n-title title="Action" [items]="actionOptions" formControlName="attachment_type" i18n-hint hint="Action is only performed when documents are consumed from the mail. Mails without attachments remain entirely untouched."></app-input-select>
|
||||
<app-input-text i18n-title title="Action parameter" formControlName="action_parameter" [error]="error?.action_parameter"></app-input-text>
|
||||
<app-input-select i18n-title title="Assign title from" [items]="metadataTitleOptions" formControlName="assign_title_from"></app-input-select>
|
||||
<app-input-tags [allowCreate]="false" formControlName="assign_tags"></app-input-tags>
|
||||
<app-input-select i18n-title title="Assign document type" [items]="documentTypes" formControlName="assign_document_type"></app-input-select>
|
||||
<app-input-select i18n-title title="Assign document type" [items]="documentTypes" [allowNull]="true" formControlName="assign_document_type"></app-input-select>
|
||||
<app-input-select i18n-title title="Assign correspondent from" [items]="metadataCorrespondentOptions" formControlName="assign_correspondent_from"></app-input-select>
|
||||
<app-input-select i18n-title title="Assign correspondent" [items]="correspondents" formControlName="assign_correspondent"></app-input-select>
|
||||
<app-input-select *ngIf="showCorrespondentField" i18n-title title="Assign correspondent" [items]="correspondents" [allowNull]="true" formControlName="assign_correspondent"></app-input-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -8,13 +8,9 @@ import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'
|
||||
import { PaperlessMailAccount } from 'src/app/data/paperless-mail-account'
|
||||
import {
|
||||
MailAction,
|
||||
MailActionOptions,
|
||||
MailFilterAttachmentType,
|
||||
MailFilterAttachmentTypeOptions,
|
||||
MailMetadataCorrespondentOption,
|
||||
MailMetadataCorrespondentOptionOptions,
|
||||
MailMetadataTitleOption,
|
||||
MailMetadataTitleOptionOptions,
|
||||
PaperlessMailRule,
|
||||
} from 'src/app/data/paperless-mail-rule'
|
||||
import { CorrespondentService } from 'src/app/services/rest/correspondent.service'
|
||||
@@ -89,19 +85,82 @@ export class MailRuleEditDialogComponent extends EditDialogComponent<PaperlessMa
|
||||
})
|
||||
}
|
||||
|
||||
get showCorrespondentField(): boolean {
|
||||
return (
|
||||
this.objectForm?.get('assign_correspondent_from')?.value ==
|
||||
MailMetadataCorrespondentOption.FromCustom
|
||||
)
|
||||
}
|
||||
|
||||
get attachmentTypeOptions() {
|
||||
return MailFilterAttachmentTypeOptions
|
||||
return [
|
||||
{
|
||||
id: MailFilterAttachmentType.Attachments,
|
||||
name: $localize`Only process attachments.`,
|
||||
},
|
||||
{
|
||||
id: MailFilterAttachmentType.Everything,
|
||||
name: $localize`Process all files, including 'inline' attachments.`,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
get actionOptions() {
|
||||
return MailActionOptions
|
||||
return [
|
||||
{
|
||||
id: MailAction.Delete,
|
||||
name: $localize`Delete`,
|
||||
},
|
||||
{
|
||||
id: MailAction.Move,
|
||||
name: $localize`Move to specified folder`,
|
||||
},
|
||||
{
|
||||
id: MailAction.MarkRead,
|
||||
name: $localize`Mark as read, don't process read mails`,
|
||||
},
|
||||
{
|
||||
id: MailAction.Flag,
|
||||
name: $localize`Flag the mail, don't process flagged mails`,
|
||||
},
|
||||
{
|
||||
id: MailAction.Tag,
|
||||
name: $localize`Tag the mail with specified tag, don't process tagged mails`,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
get metadataTitleOptions() {
|
||||
return MailMetadataTitleOptionOptions
|
||||
return [
|
||||
{
|
||||
id: MailMetadataTitleOption.FromSubject,
|
||||
name: $localize`Use subject as title`,
|
||||
},
|
||||
{
|
||||
id: MailMetadataTitleOption.FromFilename,
|
||||
name: $localize`Use attachment filename as title`,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
get metadataCorrespondentOptions() {
|
||||
return MailMetadataCorrespondentOptionOptions
|
||||
return [
|
||||
{
|
||||
id: MailMetadataCorrespondentOption.FromNothing,
|
||||
name: $localize`Do not assign a correspondent`,
|
||||
},
|
||||
{
|
||||
id: MailMetadataCorrespondentOption.FromEmail,
|
||||
name: $localize`Use mail address`,
|
||||
},
|
||||
{
|
||||
id: MailMetadataCorrespondentOption.FromName,
|
||||
name: $localize`Use name (or mail address if not available)`,
|
||||
},
|
||||
{
|
||||
id: MailMetadataCorrespondentOption.FromCustom,
|
||||
name: $localize`Use correspondent selected below`,
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user