Skip to content

Commit

Permalink
feature(405222): resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
VijayalakshmirSF4471 committed Dec 31, 2024
2 parents 5487b97 + a161a1b commit e6e1b53
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 242 deletions.
7 changes: 5 additions & 2 deletions src/app/api/workflowDesignerAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ export interface WorkflowListPathsType {
readonly addWorkflowRules: string;
}

// Define the path template once
const workflowRulesPath = `{baseUrl}/{workflowId}/rules/{ruleId}`;

const apiPaths: WorkflowListPathsType = {
updateWorkflowRules: `{baseUrl}/{workflowId}/rules/{ruleId}/update`,
deleteWorkflowRules: `{baseUrl}/{ruleId}/rules`,
updateWorkflowRules: workflowRulesPath,
deleteWorkflowRules: workflowRulesPath,
addWorkflowRules: `{baseUrl}`
}

Expand Down
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, ChatWorkflowRulesData2, 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 @@ -122,6 +122,7 @@ export class WorkflowDiagramComponent implements AfterViewInit {
if(data.chatWorkflowEditorTypeId == 2) {
buttonCount = data.fieldOptionDetails?.length || 0;
}
data.chatWorkflowId = this.workflowID;
nodeModel.id= `node${data.id}`;
nodeModel.width= 200;
nodeModel.height= 150 + (buttonCount * 25);
Expand Down Expand Up @@ -237,7 +238,7 @@ export class WorkflowDiagramComponent implements AfterViewInit {
public onDeleteNode(nodeObject) : void{
let ruleData : RuleData2 = nodeObject.data as RuleData2;
const index = this.diagram.nodes.findIndex(node => (node.data as RuleData2).successRuleId === ruleData.id);
this.workflowService.deleteRule(ruleData.id).then((result) => {
this.workflowService.deleteRule(ruleData.chatWorkflowId, ruleData.id).then((result) => {
console.log(result.message);
this.diagram.setProperties({ nodes: [], connectors: [] }, true);
this.diagram.refresh();
Expand Down Expand Up @@ -308,8 +309,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 @@ -361,5 +363,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,11 +3,11 @@
<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>
<label>
<label [hidden]="nodeBlockType === chatWorkflowBlockTypeEnum.SendTextMessage">
Label: <input type="text" [(ngModel)]="sideBarLabel" name="sideBarLabel" placeholder="Enter label..." class="description-box" required />
</label>
</div>
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,19 +3,19 @@ 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 { ChatWorkflowAddRuleRequest, FieldDetails, FieldOptionDetail, FieldValidation, MessageDetails, RuleData2 } from '../../models/appModel';
import { ChatWorkflowAddRuleRequest, 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';
import { WorkflowService } from '../../services/workflow.service';
import { HttpErrorResponse } from '@angular/common/http';


@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 @@ -60,6 +60,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(), "");
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("", this.fieldOptionMaxValue.toString(), "");
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("", this.fieldOptionMaxValue.toString(), "");
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, "");
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, "");
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(), "");
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(), "");
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("", "", 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([this.clickedNodeRuleId, this.newNodeInfo]);
Expand Down Expand Up @@ -340,7 +353,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 @@ -352,7 +365,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

0 comments on commit e6e1b53

Please sign in to comment.