Migrate existing control flow directives to use new control-flow schematic
This commit is contained in:
committed by
Aditya Chandel
parent
246efdaa34
commit
0f852ef068
+15
-9
@@ -4,25 +4,31 @@
|
||||
<label class="w-40 text-right font-medium">Provider Name:</label>
|
||||
<input type="text" pInputText formControlName="name" placeholder="Enter provider name..." class="w-full md:w-80"/>
|
||||
</div>
|
||||
<small class="text-red-500 pl-44" *ngIf="emailProviderForm.get('name')?.invalid && (emailProviderForm.get('name')?.dirty || emailProviderForm.get('name')?.touched)">
|
||||
Provider name is required.
|
||||
</small>
|
||||
@if (emailProviderForm.get('name')?.invalid && (emailProviderForm.get('name')?.dirty || emailProviderForm.get('name')?.touched)) {
|
||||
<small class="text-red-500 pl-44">
|
||||
Provider name is required.
|
||||
</small>
|
||||
}
|
||||
|
||||
<div class="flex items-center gap-4">
|
||||
<label class="w-40 text-right font-medium">Host:</label>
|
||||
<input type="text" pInputText formControlName="host" placeholder="Enter host..." class="w-full md:w-80"/>
|
||||
</div>
|
||||
<small class="text-red-500 pl-44" *ngIf="emailProviderForm.get('host')?.invalid && (emailProviderForm.get('host')?.dirty || emailProviderForm.get('host')?.touched)">
|
||||
Host is required.
|
||||
</small>
|
||||
@if (emailProviderForm.get('host')?.invalid && (emailProviderForm.get('host')?.dirty || emailProviderForm.get('host')?.touched)) {
|
||||
<small class="text-red-500 pl-44">
|
||||
Host is required.
|
||||
</small>
|
||||
}
|
||||
|
||||
<div class="flex items-center gap-4">
|
||||
<label class="w-40 text-right font-medium">Port:</label>
|
||||
<input type="number" pInputText formControlName="port" placeholder="Enter port..." class="w-full md:w-80"/>
|
||||
</div>
|
||||
<small class="text-red-500 pl-44" *ngIf="emailProviderForm.get('port')?.invalid && (emailProviderForm.get('port')?.dirty || emailProviderForm.get('port')?.touched)">
|
||||
Port is required and must be a number.
|
||||
</small>
|
||||
@if (emailProviderForm.get('port')?.invalid && (emailProviderForm.get('port')?.dirty || emailProviderForm.get('port')?.touched)) {
|
||||
<small class="text-red-500 pl-44">
|
||||
Port is required and must be a number.
|
||||
</small>
|
||||
}
|
||||
|
||||
<div class="flex items-center gap-4">
|
||||
<label class="w-40 text-right font-medium">Username:</label>
|
||||
|
||||
+2
-3
@@ -2,7 +2,7 @@ import { Component, inject, OnInit } from '@angular/core';
|
||||
import { Button } from 'primeng/button';
|
||||
import { Checkbox } from 'primeng/checkbox';
|
||||
import { InputText } from 'primeng/inputtext';
|
||||
import { NgIf } from '@angular/common';
|
||||
|
||||
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { EmailProviderService } from '../email-provider/email-provider.service';
|
||||
import { MessageService } from 'primeng/api';
|
||||
@@ -14,9 +14,8 @@ import { DynamicDialogRef } from 'primeng/dynamicdialog';
|
||||
Button,
|
||||
Checkbox,
|
||||
InputText,
|
||||
NgIf,
|
||||
ReactiveFormsModule
|
||||
],
|
||||
],
|
||||
templateUrl: './create-email-provider-dialog.component.html',
|
||||
styleUrl: './create-email-provider-dialog.component.scss'
|
||||
})
|
||||
|
||||
+10
-6
@@ -4,17 +4,21 @@
|
||||
<label class="w-40 text-right font-medium">Recipient Name:</label>
|
||||
<input type="text" pInputText formControlName="name" placeholder="Enter recipient name..." class="w-full md:w-80"/>
|
||||
</div>
|
||||
<small class="text-red-500 pl-44" *ngIf="emailRecipientForm.get('name')?.invalid && (emailRecipientForm.get('name')?.dirty || emailRecipientForm.get('name')?.touched)">
|
||||
Recipient name is required.
|
||||
</small>
|
||||
@if (emailRecipientForm.get('name')?.invalid && (emailRecipientForm.get('name')?.dirty || emailRecipientForm.get('name')?.touched)) {
|
||||
<small class="text-red-500 pl-44">
|
||||
Recipient name is required.
|
||||
</small>
|
||||
}
|
||||
|
||||
<div class="flex items-center gap-4">
|
||||
<label class="w-40 text-right font-medium">Email Address:</label>
|
||||
<input type="email" pInputText formControlName="email" placeholder="Enter email address..." class="w-full md:w-80"/>
|
||||
</div>
|
||||
<small class="text-red-500 pl-44" *ngIf="emailRecipientForm.get('email')?.invalid && (emailRecipientForm.get('email')?.dirty || emailRecipientForm.get('email')?.touched)">
|
||||
Valid email is required.
|
||||
</small>
|
||||
@if (emailRecipientForm.get('email')?.invalid && (emailRecipientForm.get('email')?.dirty || emailRecipientForm.get('email')?.touched)) {
|
||||
<small class="text-red-500 pl-44">
|
||||
Valid email is required.
|
||||
</small>
|
||||
}
|
||||
|
||||
<div class="flex items-center gap-4">
|
||||
<label class="w-40 text-right font-medium">Default Recipient:</label>
|
||||
|
||||
+3
-4
@@ -5,7 +5,7 @@ import { DynamicDialogRef } from 'primeng/dynamicdialog';
|
||||
import { Checkbox } from 'primeng/checkbox';
|
||||
import { Button } from 'primeng/button';
|
||||
import { InputText } from 'primeng/inputtext';
|
||||
import { NgIf } from '@angular/common';
|
||||
|
||||
import { EmailRecipientService } from '../email-recipient/email-recipient.service';
|
||||
|
||||
@Component({
|
||||
@@ -14,9 +14,8 @@ import { EmailRecipientService } from '../email-recipient/email-recipient.servic
|
||||
Checkbox,
|
||||
ReactiveFormsModule,
|
||||
Button,
|
||||
InputText,
|
||||
NgIf
|
||||
],
|
||||
InputText
|
||||
],
|
||||
templateUrl: './create-email-recipient-dialog.component.html',
|
||||
styleUrls: ['./create-email-recipient-dialog.component.scss']
|
||||
})
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<h2 class="text-lg flex items-center gap-2">
|
||||
Email Providers
|
||||
<i class="pi pi-info-circle text-sky-600"
|
||||
pTooltip="Configure email-sending services like Gmail, Outlook, or custom SMTP servers for sending books via email. The default email provider will be used for 'Quick Book Send' located in the Book Card menu"
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;"></i>
|
||||
pTooltip="Configure email-sending services like Gmail, Outlook, or custom SMTP servers for sending books via email. The default email provider will be used for 'Quick Book Send' located in the Book Card menu"
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;"></i>
|
||||
</h2>
|
||||
<p-button outlined="true" icon="pi pi-plus" label="Create New Provider" (onClick)="openCreateProviderDialog()"></p-button>
|
||||
</div>
|
||||
@@ -38,33 +38,57 @@
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<input *ngIf="provider.isEditing" type="text" [(ngModel)]="provider.name" class="p-inputtext w-full"/>
|
||||
<span *ngIf="!provider.isEditing">{{ provider.name }}</span>
|
||||
@if (provider.isEditing) {
|
||||
<input type="text" [(ngModel)]="provider.name" class="p-inputtext w-full"/>
|
||||
}
|
||||
@if (!provider.isEditing) {
|
||||
<span>{{ provider.name }}</span>
|
||||
}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<input *ngIf="provider.isEditing" type="text" [(ngModel)]="provider.host" class="p-inputtext w-full"/>
|
||||
<span *ngIf="!provider.isEditing">{{ provider.host }}</span>
|
||||
@if (provider.isEditing) {
|
||||
<input type="text" [(ngModel)]="provider.host" class="p-inputtext w-full"/>
|
||||
}
|
||||
@if (!provider.isEditing) {
|
||||
<span>{{ provider.host }}</span>
|
||||
}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<input *ngIf="provider.isEditing" type="number" [(ngModel)]="provider.port" class="p-inputtext w-full"/>
|
||||
<span *ngIf="!provider.isEditing">{{ provider.port }}</span>
|
||||
@if (provider.isEditing) {
|
||||
<input type="number" [(ngModel)]="provider.port" class="p-inputtext w-full"/>
|
||||
}
|
||||
@if (!provider.isEditing) {
|
||||
<span>{{ provider.port }}</span>
|
||||
}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<input *ngIf="provider.isEditing" type="text" [(ngModel)]="provider.username" class="p-inputtext w-full"/>
|
||||
<span *ngIf="!provider.isEditing">{{ provider.username }}</span>
|
||||
@if (provider.isEditing) {
|
||||
<input type="text" [(ngModel)]="provider.username" class="p-inputtext w-full"/>
|
||||
}
|
||||
@if (!provider.isEditing) {
|
||||
<span>{{ provider.username }}</span>
|
||||
}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<input *ngIf="provider.isEditing" [(ngModel)]="provider.password" class="p-inputtext w-full"/>
|
||||
<span *ngIf="!provider.isEditing" class="text-gray-400 italic">Hidden</span>
|
||||
@if (provider.isEditing) {
|
||||
<input [(ngModel)]="provider.password" class="p-inputtext w-full"/>
|
||||
}
|
||||
@if (!provider.isEditing) {
|
||||
<span class="text-gray-400 italic">Hidden</span>
|
||||
}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<input *ngIf="provider.isEditing" type="text" [(ngModel)]="provider.fromAddress" class="p-inputtext w-full"/>
|
||||
<span *ngIf="!provider.isEditing">{{ provider.fromAddress }}</span>
|
||||
@if (provider.isEditing) {
|
||||
<input type="text" [(ngModel)]="provider.fromAddress" class="p-inputtext w-full"/>
|
||||
}
|
||||
@if (!provider.isEditing) {
|
||||
<span>{{ provider.fromAddress }}</span>
|
||||
}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
@@ -84,9 +108,15 @@
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
<p-button *ngIf="!provider.isEditing" icon="pi pi-pencil" outlined="true" severity="info" (onClick)="toggleEdit(provider)"></p-button>
|
||||
<p-button *ngIf="provider.isEditing" icon="pi pi-check" outlined="true" severity="success" (onClick)="saveProvider(provider)"></p-button>
|
||||
<p-button *ngIf="provider.isEditing" icon="pi pi-times" outlined="true" severity="danger" (onClick)="toggleEdit(provider)"></p-button>
|
||||
@if (!provider.isEditing) {
|
||||
<p-button icon="pi pi-pencil" outlined="true" severity="info" (onClick)="toggleEdit(provider)"></p-button>
|
||||
}
|
||||
@if (provider.isEditing) {
|
||||
<p-button icon="pi pi-check" outlined="true" severity="success" (onClick)="saveProvider(provider)"></p-button>
|
||||
}
|
||||
@if (provider.isEditing) {
|
||||
<p-button icon="pi pi-times" outlined="true" severity="danger" (onClick)="toggleEdit(provider)"></p-button>
|
||||
}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {Component, inject, OnInit} from '@angular/core';
|
||||
import {Button} from 'primeng/button';
|
||||
import {Checkbox} from 'primeng/checkbox';
|
||||
import {NgIf} from '@angular/common';
|
||||
|
||||
import {MessageService, PrimeTemplate} from 'primeng/api';
|
||||
import {RadioButton} from 'primeng/radiobutton';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
@@ -17,14 +17,13 @@ import {CreateEmailProviderDialogComponent} from '../create-email-provider-dialo
|
||||
imports: [
|
||||
Button,
|
||||
Checkbox,
|
||||
NgIf,
|
||||
PrimeTemplate,
|
||||
RadioButton,
|
||||
ReactiveFormsModule,
|
||||
TableModule,
|
||||
Tooltip,
|
||||
FormsModule
|
||||
],
|
||||
],
|
||||
templateUrl: './email-provider.component.html',
|
||||
styleUrl: './email-provider.component.scss'
|
||||
})
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<h2 class="text-lg flex items-center gap-2">
|
||||
Recipient Emails
|
||||
<i class="pi pi-info-circle text-sky-600"
|
||||
pTooltip="Manage the list of recipients who will receive books via email. The 'Default' recipient will be used for 'Quick Book Send,' located in the Book Card menu."
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;"></i>
|
||||
pTooltip="Manage the list of recipients who will receive books via email. The 'Default' recipient will be used for 'Quick Book Send,' located in the Book Card menu."
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;"></i>
|
||||
</h2>
|
||||
<p-button outlined="true" icon="pi pi-plus" label="Add New Recipient" (onClick)="openAddRecipientDialog()"></p-button>
|
||||
</div>
|
||||
@@ -32,19 +32,33 @@
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<input *ngIf="recipient.isEditing" type="email" [(ngModel)]="recipient.email" class="p-inputtext w-full"/>
|
||||
<span *ngIf="!recipient.isEditing">{{ recipient.email }}</span>
|
||||
@if (recipient.isEditing) {
|
||||
<input type="email" [(ngModel)]="recipient.email" class="p-inputtext w-full"/>
|
||||
}
|
||||
@if (!recipient.isEditing) {
|
||||
<span>{{ recipient.email }}</span>
|
||||
}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<input *ngIf="recipient.isEditing" type="text" [(ngModel)]="recipient.name" class="p-inputtext w-full"/>
|
||||
<span *ngIf="!recipient.isEditing">{{ recipient.name }}</span>
|
||||
@if (recipient.isEditing) {
|
||||
<input type="text" [(ngModel)]="recipient.name" class="p-inputtext w-full"/>
|
||||
}
|
||||
@if (!recipient.isEditing) {
|
||||
<span>{{ recipient.name }}</span>
|
||||
}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
<p-button *ngIf="!recipient.isEditing" icon="pi pi-pencil" outlined="true" severity="info" (onClick)="toggleEditRecipient(recipient)"></p-button>
|
||||
<p-button *ngIf="recipient.isEditing" icon="pi pi-check" outlined="true" severity="success" (onClick)="saveRecipient(recipient)"></p-button>
|
||||
<p-button *ngIf="recipient.isEditing" icon="pi pi-times" outlined="true" severity="danger" (onClick)="toggleEditRecipient(recipient)"></p-button>
|
||||
@if (!recipient.isEditing) {
|
||||
<p-button icon="pi pi-pencil" outlined="true" severity="info" (onClick)="toggleEditRecipient(recipient)"></p-button>
|
||||
}
|
||||
@if (recipient.isEditing) {
|
||||
<p-button icon="pi pi-check" outlined="true" severity="success" (onClick)="saveRecipient(recipient)"></p-button>
|
||||
}
|
||||
@if (recipient.isEditing) {
|
||||
<p-button icon="pi pi-times" outlined="true" severity="danger" (onClick)="toggleEditRecipient(recipient)"></p-button>
|
||||
}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Component, inject, OnInit} from '@angular/core';
|
||||
import {Button} from 'primeng/button';
|
||||
import {NgIf} from '@angular/common';
|
||||
|
||||
import {MessageService, PrimeTemplate} from 'primeng/api';
|
||||
import {RadioButton} from 'primeng/radiobutton';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
@@ -18,14 +18,13 @@ import {CreateEmailRecipientDialogComponent} from '../create-email-recipient-dia
|
||||
selector: 'app-email-recipient',
|
||||
imports: [
|
||||
Button,
|
||||
NgIf,
|
||||
PrimeTemplate,
|
||||
RadioButton,
|
||||
ReactiveFormsModule,
|
||||
TableModule,
|
||||
Tooltip,
|
||||
FormsModule
|
||||
],
|
||||
],
|
||||
templateUrl: './email-recipient.component.html',
|
||||
styleUrl: './email-recipient.component.scss'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user