fix: Manage hooks functionality; Create hook, Edit Hook (#2346)

This commit is contained in:
Pranav Deshmukh
2025-03-23 10:58:35 -06:00
committed by GitHub
parent a218d3491b
commit 684a937af0
5 changed files with 95 additions and 16 deletions
@@ -33,7 +33,7 @@
</div>
<div fxLayout="row wrap" fxLayout.lt-md="column" fxLayoutGap="4%">
<mat-form-field fxFlex="48%" *ngIf="hookForm.controls.name.value === 'Web'">
<mat-form-field fxFlex="40%" *ngIf="hookForm.controls.name.value === 'Web'">
<mat-label>{{ 'labels.inputs.Content Type' | translate }}</mat-label>
<mat-select required formControlName="contentType">
<mat-option [value]="'json'">
@@ -49,7 +49,7 @@
</mat-error>
</mat-form-field>
<mat-form-field fxFlex="48%" *ngIf="hookForm.controls.name.value === 'SMS Bridge'">
<mat-form-field fxFlex="40%" *ngIf="hookForm.controls.name.value === 'SMS Bridge'">
<mat-label>{{ 'labels.inputs.Phone Number' | translate }}</mat-label>
<input matInput type="tel" #input maxlength="10" required formControlName="phoneNumber" />
<mat-hint align="end">{{ input.value?.length || 0 }}/10</mat-hint>
@@ -59,7 +59,7 @@
</mat-error>
</mat-form-field>
<mat-form-field fxFlex="48%">
<mat-form-field fxFlex="40%">
<mat-label>{{ 'labels.inputs.Payload URL' | translate }}</mat-label>
<input matInput required formControlName="payloadUrl" />
<mat-error *ngIf="hookForm.controls.payloadUrl.hasError('required')">
@@ -109,10 +109,19 @@
<br />
<div fxLayout="row wrap" fxLayoutGap="60%" fxLayout.lt-md="column">
<p fxFlex="20%" class="mat-title">{{ 'labels.inputs.Events' | translate }}</p>
<div fxLayout="row wrap" fxLayout.lt-md="column">
<p fxFlex="20%" class="mat-title">
{{ 'labels.inputs.Events' | translate }} <span style="color: red">*</span>
</p>
<button mat-raised-button fxFlex="20%" type="button" color="primary" (click)="addEvent()">
<button
mat-raised-button
class="AddEventButton"
fxFlex="20%"
type="button"
color="primary"
(click)="addEvent()"
>
<fa-icon icon="plus" class="m-r-10"></fa-icon>
{{ 'labels.buttons.Add' | translate }} {{ 'labels.inputs.Events' | translate }}
</button>
@@ -131,6 +140,10 @@
<td mat-cell *matCellDef="let event">{{ event.actionName }}</td>
</ng-container>
<div *ngIf="cannotDeleteLastEvent" class="error-message">
<p>At least one event is required. Cannot delete the last event.</p>
</div>
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Actions' | translate }}</th>
<td mat-cell *matCellDef="let i = index">
@@ -146,14 +159,16 @@
</mat-card-content>
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['../']">{{ 'labels.inputs.Cancel' | translate }}</button>
<button type="button" mat-raised-button [routerLink]="['../']">
{{ 'labels.buttons.Cancel' | translate }}
</button>
<button
mat-raised-button
color="primary"
[disabled]="(!hookForm.valid || hookForm.pristine) && !eventsDataChanged"
*mifosxHasPermission="'UPDATE_HOOK'"
>
{{ 'labels.inputs.Submit' | translate }}
{{ 'labels.buttons.Submit' | translate }}
</button>
</mat-card-actions>
</form>