Skip to content

Commit

Permalink
Add new Bottom Nav buttons Functionality
Browse files Browse the repository at this point in the history
Add Platform event and listening functionality
Disable buttons when editing and need to save
Add icon with tooltip column
Fix issue with Percentage fields
Show required fields on Bulk edition popup
Fix issue when adding and required fields
Remove initialWidth on columns by default
  • Loading branch information
engPabloMartinez committed May 7, 2024
1 parent ab2e63a commit 7c68980
Show file tree
Hide file tree
Showing 28 changed files with 837 additions and 288 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ public without sharing class OD_ConfigurationEditorController {

// flows
List<FlowDefinitionView> listFlows = [
SELECT Label, ApiName
SELECT Label, ApiName, ProcessType
FROM FlowDefinitionView
WHERE IsActive = TRUE AND ProcessType = 'Flow'
WHERE IsActive = TRUE AND ProcessType IN ('AutoLaunchedFlow', 'Flow') AND RecordTriggerType = NULL
ORDER BY Label
];

if (listFlows?.size() > 0) {
for (FlowDefinitionView flow : listFlows) {
result.flows.add(new RecordWrapper(flow.ApiName, flow.Label));
result.flows.add(new RecordWrapper(flow.ApiName, flow.Label, flow.ProcessType));
}
}

Expand Down Expand Up @@ -347,7 +347,13 @@ public without sharing class OD_ConfigurationEditorController {
* @param Set<Id> idsToQuery : Set of record ids to retrieve
* @return List of found records
**********************************************************************************************************/
private static List<SObject> getRecords(String objectName, String fields, Set<Id> idsToQuery) {
@AuraEnabled
public static List<SObject> getRecords(
String objectName,
String fields,
String fieldNameFilter,
List<Id> idsToQuery
) {
// build the query
String query = 'SELECT Id';

Expand All @@ -356,7 +362,7 @@ public without sharing class OD_ConfigurationEditorController {
query += ', ' + String.escapeSingleQuotes(fields);
}

query += ' FROM ' + objectName + ' WHERE Id IN :idsToQuery';
query += ' FROM ' + objectName + ' WHERE ' + fieldNameFilter + ' IN :idsToQuery';

SObjectAccessDecision securityDecision = Security.stripInaccessible(AccessType.READABLE, Database.query(query));

Expand Down Expand Up @@ -433,12 +439,12 @@ public without sharing class OD_ConfigurationEditorController {
delete listToDelete;
}

Set<Id> setIdsToQuery = new Set<Id>();
List<Id> listIdsToQuery = new List<Id>();
for (SObject record : result) {
setIdsToQuery.add(record.Id);
listIdsToQuery.add(record.Id);
}

return getRecords(objectName, fields, setIdsToQuery);
return getRecords(objectName, fields, 'Id', listIdsToQuery);
} catch (AuraHandledException e) {
throw e;
} catch (Exception exc) {
Expand Down Expand Up @@ -473,9 +479,19 @@ public without sharing class OD_ConfigurationEditorController {
@AuraEnabled
public String value;

@AuraEnabled
public String type;

public RecordWrapper(String value, String label) {
this.label = label;
this.value = value;
this.type = null;
}

public RecordWrapper(String value, String label, String type) {
this.label = label;
this.value = value;
this.type = type;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<status>Active</status>
</ApexClass>
</ApexClass>
18 changes: 17 additions & 1 deletion force-app/main/default/lwc/odDatatable/odDatatable.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<c-od-datatable-spinner text=" " show={isLoading}></c-od-datatable-spinner>
<template lwc:if={loaded}>
<c-od-datatable-error error-message={errorMessage}></c-od-datatable-error>
<c-od-datatable-spinner text=" " show={isSaving}></c-od-datatable-spinner>
<c-od-datatable-spinner text={savingMessage} show={isSaving}></c-od-datatable-spinner>
<template lwc:if={fieldsThatChanged.length}>
<div class="slds-m-bottom--small slds-p-bottom--x-large slds-theme--error">
<div class="slds-p-around--medium slds-text-heading_medium">
Expand Down Expand Up @@ -41,6 +41,7 @@
icon-name="utility:add"
onclick={handleAdd}
variant="brand"
disabled={hasChanges}
>
</lightning-button>
</template>
Expand All @@ -51,6 +52,7 @@
title="Add"
onclick={handleAdd}
variant="brand"
disabled={hasChanges}
>
</lightning-button-icon>
</template>
Expand Down Expand Up @@ -117,6 +119,20 @@
</lightning-button>
</template>
</template>
<template lwc:if={bottomNavButtons.length}>
<template for:each={bottomNavButtons} for:item="btn">
<lightning-button
key={btn.fieldName}
class="slds-m-left--medium"
label={btn.label}
title={btn.label}
data-name={btn.fieldName}
onclick={handleOpenBottomNavFlow}
disabled={hasChanges}
>
</lightning-button>
</template>
</template>
</div>
<template lwc:if={showSaveButtons}>
<div class="slds-align--absolute-center slds-grid slds-wrap">
Expand Down
Loading

0 comments on commit 7c68980

Please sign in to comment.