Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task(402683): Customer block node customization #17

Merged
merged 7 commits into from
Dec 30, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</ng-template>

<ng-template #nodeTemplate let-data>
@if(data.data.chatWorkflowBlockId !== chatWorkflowBlockTypeEnum.SendTextMessage){
@if(data.data.chatWorkflowBlockId !== chatWorkflowBlockTypeEnum.SendTextMessage && data.data.chatWorkflowBlockId !== chatWorkflowBlockTypeEnum.GetCustomerDetails) {
<div><label style="padding: 5px;">{{ data.data.fieldDetails.description }}</label></div>
}
@switch (data.data.chatWorkflowBlockId){
Expand All @@ -51,6 +51,17 @@
</div>
</ng-container>
}
@case(chatWorkflowBlockTypeEnum.GetCustomerDetails){
<ng-container>
<div><label>Get Email details</label></div>
@if (data.data.customerBlockFieldInfo.isNameEditorEnabled){
<div><label>Get Name details</label></div>
}
@if (data.data.customerBlockFieldInfo.isPhoneEditorEnabled){
<div><label>Get Phone number details</label></div>
}
</ng-container>
}
@case(chatWorkflowBlockTypeEnum.GetPickerInput){
@switch (data.data.chatWorkflowEditorTypeId){
@case (chatWorkflowEditorTypeEnum.Boolean){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ComplexHierarchicalTree, ConnectionPointOrigin, ConnectorConstraints, C
SelectorConstraints, SelectorModel, SnapSettingsModel, TextModel, UserHandleEventsArgs, UserHandleModel, DataSourceModel,
DataBindingService} from '@syncfusion/ej2-angular-diagrams';
import { ChatWorkflowRulesData, FieldDetails, FieldOptionDetail, FieldValidation, MessageDetails, RuleData2 } from '../../models/appModel';
import { RULE_DATA, RULE_DATA2, RULE_DATA3 } from '../../data/rule-data';
import { RULE_DATA3 } from '../../data/rule-data';
import { DialogModule } from '@syncfusion/ej2-angular-popups';
import { BeforeOpenCloseMenuEventArgs, DropDownButtonComponent, DropDownButtonModule, ItemModel, OpenCloseMenuEventArgs } from '@syncfusion/ej2-angular-splitbuttons';
import { CommonModule } from '@angular/common';
Expand Down Expand Up @@ -293,8 +293,9 @@ export class WorkflowDiagramComponent implements AfterViewInit {
this.isParentListItem = false; // The value is reset here, to handle document click case of dropdown
// Reset ListView to its initial state before opening
if (this.listView) {
this.listView.dataSource = this.listdata; // Reset data
this.listView.refresh();
while ((this.listView as any).curDSLevel.length > 0) {
this.listView.back();
}
}
}

Expand Down Expand Up @@ -346,5 +347,4 @@ export class WorkflowDiagramComponent implements AfterViewInit {
this.diagram.loadDiagram(jsonString);
this.fileInput.nativeElement.value = '';
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="content">
<form (ngSubmit)="onFormSubmit()" class="full-size-form">
<div class="form-header"> {{sidebarHeader}}</div>
<div>
<div [hidden]="nodeBlockType === chatWorkflowBlockTypeEnum.GetCustomerDetails">
<label>
Description: <input type="text" [(ngModel)]="sideBarDescription" name="singleDescription" placeholder="Enter description..." class="description-box" />
</label>
Expand Down Expand Up @@ -166,6 +166,13 @@
</div>
</div>
}
@case(chatWorkflowBlockTypeEnum.GetCustomerDetails){
<div>
<ejs-checkbox label="Get Customer Email" [(ngModel)]="getEmailInfo" name="getEmailInfo" [checked]="true" [disabled] = "true"></ejs-checkbox>
<ejs-checkbox label="Get Customer Name" [(ngModel)]="getNameInfo" name="getNameInfo"></ejs-checkbox>
<ejs-checkbox label="Get Customer Phone Number" [(ngModel)]="getPhoneNumberInfo" name="getPhoneNumberInfo"></ejs-checkbox>
</div>
}
}
</form>
</div>
Expand Down
50 changes: 32 additions & 18 deletions src/app/components/workflow-sidebar/workflow-sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import { SidebarComponent, SidebarModule } from '@syncfusion/ej2-angular-navigat
import { TextFormatEnum, ChatWorkflowEditorTypeEnum, ChatWorkflowBlockTypeEnum } from '../../models/enum';
import { FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { FieldDetails, FieldOptionDetail, FieldValidation, MessageDetails, RuleData2 } from '../../models/appModel';
import { CustomerBlockFieldDetails, FieldDetails, FieldOptionDetail, FieldValidation, MessageDetails, RuleData2 } from '../../models/appModel';
import { NodeModel } from '@syncfusion/ej2-angular-diagrams';
import { DropDownListComponent, DropDownListModule } from '@syncfusion/ej2-angular-dropdowns';
import { DatePickerModule, DateTimePickerModule } from '@syncfusion/ej2-angular-calendars';
import { ButtonModule, SwitchModule } from '@syncfusion/ej2-angular-buttons';
import { ButtonModule, CheckBoxModule, SwitchModule } from '@syncfusion/ej2-angular-buttons';


@Component({
selector: 'app-workflow-sidebar',
standalone: true,
imports: [SidebarModule, FormsModule, CommonModule, DatePickerModule, DateTimePickerModule, ButtonModule, SwitchModule, DropDownListModule ],
imports: [SidebarModule, FormsModule, CommonModule, DatePickerModule, DateTimePickerModule, ButtonModule, CheckBoxModule, SwitchModule, DropDownListModule ],
templateUrl: './workflow-sidebar.component.html',
styleUrl: './workflow-sidebar.component.scss'
})
Expand Down Expand Up @@ -59,6 +59,10 @@ export class WorkflowSidebarComponent {
ddlTextFormatFields: Object = { text: 'text', value: 'value' };
public value = 1;

public getEmailInfo: boolean = true;
public getNameInfo: boolean = false;
public getPhoneNumberInfo: boolean = false;

@Input() nodeEditType!: number;
@Input() nodeBlockType!: number;
@Input() sidebarHeader!: string;
Expand Down Expand Up @@ -208,42 +212,42 @@ export class WorkflowSidebarComponent {
isPrivate: this.checkedIsPrivate,
textFormat: this.ddlTextFormat.value as TextFormatEnum
}
this.newNodeInfo = this.createNodeInfo(null, this.nodeBlockType, this.selectedWorkFlowId, null, null, messageInfo);
this.newNodeInfo = this.createNodeInfo(null, this.nodeBlockType, this.selectedWorkFlowId, null, null, messageInfo, null);
break;
}
case (this.chatWorkflowBlockTypeEnum.GetPickerInput): {
switch (this.nodeEditType) {
case (this.chatWorkflowEditorTypeEnum.Boolean): {
let fieldInfo = this.createFieldInfo(null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null);
break;
}
case (this.chatWorkflowEditorTypeEnum.Buttons): {
let fieldOptionInfo = this.mapOptionsToFieldOptions();
let fieldInfo = this.createFieldInfo(null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null, null);
this.newNodeHeight += (this.options.length * 25);
break;
}
case this.chatWorkflowEditorTypeEnum.DropDown: {
let fieldOptionInfo = this.mapOptionsToFieldOptions();
let fieldInfo = this.createFieldInfo(null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null, null);
this.newNodeHeight += (this.options.length * 25);
break;
}
case (this.chatWorkflowEditorTypeEnum.MultiSelect): {
let fieldValidationInfo = this.createFieldValidationInfo(this.fieldOptionMinValue.toString(), this.fieldOptionMaxValue.toString(), null);
let fieldOptionInfo = this.mapOptionsToFieldOptions();
let fieldInfo = this.createFieldInfo(fieldValidationInfo);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null, null);
this.newNodeHeight += (this.options.length * 25);
break;
}
case (this.chatWorkflowEditorTypeEnum.List): {
let fieldOptionInfo = this.mapOptionsToFieldOptions();
let fieldInfo = this.createFieldInfo(null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, fieldOptionInfo, null, null);
this.newNodeHeight += (this.options.length * 25);
break;
}
Expand All @@ -255,13 +259,13 @@ export class WorkflowSidebarComponent {
case (this.chatWorkflowEditorTypeEnum.Text): {
let fieldValidationInfo = this.createFieldValidationInfo(null, this.fieldOptionMaxValue.toString(), null);
let fieldInfo = this.createFieldInfo(fieldValidationInfo);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null);
break;
}
case (this.chatWorkflowEditorTypeEnum.TextArea): {
let fieldValidationInfo = this.createFieldValidationInfo(null, this.fieldOptionMaxValue.toString(), null);
let fieldInfo = this.createFieldInfo(fieldValidationInfo);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null);
break;
}
case (this.chatWorkflowEditorTypeEnum.Date): {
Expand All @@ -272,7 +276,7 @@ export class WorkflowSidebarComponent {

let fieldValidationInfo = this.createFieldValidationInfo(minDate, maxDate, null);
let fieldInfo = this.createFieldInfo(fieldValidationInfo);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null);
break;
}
case (this.chatWorkflowEditorTypeEnum.DateTime): {
Expand All @@ -282,30 +286,39 @@ export class WorkflowSidebarComponent {

let fieldValidationInfo = this.createFieldValidationInfo(minDateTime, maxDateTime, null);
let fieldInfo = this.createFieldInfo(fieldValidationInfo);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null);
break;
}
case (this.chatWorkflowEditorTypeEnum.Number): {
let fieldValidationInfo = this.createFieldValidationInfo(this.fieldOptionMinValue.toString(), this.fieldOptionMaxValue.toString(), null);
let fieldInfo = this.createFieldInfo(fieldValidationInfo);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null);
break;
}
case (this.chatWorkflowEditorTypeEnum.Decimal): {
let fieldValidationInfo = this.createFieldValidationInfo(this.fieldOptionMinValue.toString(), this.fieldOptionMaxValue.toString(), null);
let fieldInfo = this.createFieldInfo(fieldValidationInfo);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null);
break;
}
case (this.chatWorkflowEditorTypeEnum.Regex): {
let fieldValidationInfo = this.createFieldValidationInfo(null, null, this.fieldOptionRegexValue);
let fieldInfo = this.createFieldInfo(fieldValidationInfo);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null);
this.newNodeInfo = this.createNodeInfo(this.nodeEditType, this.nodeBlockType, this.selectedWorkFlowId, fieldInfo, null, null, null);
break;
}
}
break;
}
case (this.chatWorkflowBlockTypeEnum.GetCustomerDetails): {
let customerBlockFieldInfo : CustomerBlockFieldDetails = {
isEmailEditorEnabled: this.getEmailInfo,
isNameEditorEnabled: this.getNameInfo,
isPhoneEditorEnabled: this.getPhoneNumberInfo,
}
this.newNodeInfo = this.createNodeInfo(null, this.nodeBlockType, this.selectedWorkFlowId, null, null, null, customerBlockFieldInfo);
break;
}
}
if (this.isEdit) {
this.updateNode.emit([sourceNodeId, this.newNodeInfo]);
Expand All @@ -316,7 +329,7 @@ export class WorkflowSidebarComponent {
}
}

public createNodeInfo(editorTypeId: number | null, blockId: number, workflowId: number, fieldInfo: FieldDetails | null, fieldOptionInfo: FieldOptionDetail[] | null, messageInfo: MessageDetails | null): RuleData2 {
public createNodeInfo(editorTypeId: number | null, blockId: number, workflowId: number, fieldInfo: FieldDetails | null, fieldOptionInfo: FieldOptionDetail[] | null, messageInfo: MessageDetails | null, customerBlockFieldInfo: CustomerBlockFieldDetails | null): RuleData2 {
let ruleDataId = this.isEdit ? 0 : WorkflowSidebarComponent.nodeLength++; // Need to set value dynamically from db
return {
id: ruleDataId,
Expand All @@ -329,7 +342,8 @@ export class WorkflowSidebarComponent {
fieldDetails: fieldInfo,
branchDetails: null,
messageDetails: messageInfo,
fieldOptionDetails: fieldOptionInfo
fieldOptionDetails: fieldOptionInfo,
customerBlockFieldInfo: customerBlockFieldInfo
};
}

Expand Down
35 changes: 5 additions & 30 deletions src/app/data/list-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,13 @@ export const LIST_DATA: { [key: string]: any }[] = [
'text': 'Action',
'id': '01',
'category': 'Block Type',
'child': [{
'text': 'Identity',
'child': [
{
'text': 'Customer Block',
'id': '1',
'blockid': 3,
'editerTypeId': null,
'category': 'Action',
'child': [{
'text': 'Name',
'id': '1001',
'blockid': 3,
'editerTypeId': 18,
'category': 'Identity',
},
{
'text': 'Email',
'id': '1002',
'blockid': 3,
'editerTypeId': 19,
'category': 'Identity',
},
{
'text': 'Phone No',
'id': '1003',
'blockid': 3,
'editerTypeId': 20,
'category': 'Identity',
},
{
'text': 'Requester Linking',
'id': '1004',
'blockid': 3,
'editerTypeId': 21,
'category': 'Identity',
}]
},
{
'text': 'Custom Message',
Expand Down
Loading
Loading