Skip to content
Snippets Groups Projects
Commit 21a006cc authored by Carolin Wimmer's avatar Carolin Wimmer Committed by Benjamin Ulrich
Browse files

[Projekt: xRM-Sales][TicketNr.: 1079788][Besuchsvorschlag - Erweiterung der...

[Projekt: xRM-Sales][TicketNr.: 1079788][Besuchsvorschlag - Erweiterung der FilterView um die Kartendarstellung analog in der Firma]
parent eb8b473f
No related branches found
No related tags found
No related merge requests found
Showing
with 274 additions and 11 deletions
......@@ -188,7 +188,12 @@
</entityField>
<entityField>
<name>VISITRECOMMENDATION_ID</name>
<title>Visit Recommendation</title>
<consumer>Visitrecommendations</consumer>
<stateProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/visitrecommendation_id/stateProcess.js</stateProcess>
<valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/visitrecommendation_id/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/visitrecommendation_id/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/visitrecommendation_id/onValueChange.js</onValueChange>
</entityField>
<entityField>
<name>APPOINTMENT_ID</name>
......@@ -285,6 +290,28 @@
<name>VisitrecommendationId_param</name>
<expose v="true" />
</entityParameter>
<entityConsumer>
<name>Visitrecommendations</name>
<dependency>
<name>dependency</name>
<entityName>VisitRecommendation_entity</entityName>
<fieldName>#PROVIDER</fieldName>
</dependency>
<children>
<entityParameter>
<name>VisitrecommendationId_param</name>
<valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/visitrecommendations/children/visitrecommendationid_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>PrioritySource_param</name>
<valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/visitrecommendations/children/prioritysource_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityParameter>
<name>PrioritySource_param</name>
<expose v="true" />
</entityParameter>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......
import("system.vars");
import("system.result");
import("Context_lib");
result.string(ContextUtils.loadContentTitle("VisitRecommendation_entity", vars.get("$field.VISITRECOMMENDATION_ID")));
\ No newline at end of file
import("system.neon");
import("Sql_lib");
import("KeywordRegistry_basic");
import("system.vars");
if(vars.get("$param.PrioritySource_param") == $KeywordRegistry.visitRecommendationPrioSource$manual())
{
var Ids = newSelect("CONTACT_ID, CONTACT_PERSON_ID").from("VISITRECOMMENDATION")
.where("VISITRECOMMENDATION.VISITRECOMMENDATIONID", vars.get("$local.value"))
.arrayRow()
neon.setFieldValue("$field.CONTACT_ID", Ids[1]);
neon.setFieldValue("$field.ORGANISATION_CONTACT_ID", Ids[0]);
}
import("system.result");
import("KeywordRegistry_basic");
import("system.vars");
import("Sql_lib");
import("system.neon")
if(vars.get("$param.PrioritySource_param") == $KeywordRegistry.visitRecommendationPrioSource$visitFrequency())
{
result.string(neon.COMPONENTSTATE_INVISIBLE)
}
import("KeywordRegistry_basic");
import("system.result");
result.string($KeywordRegistry.visitRecommendationPrioSource$manual());
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.get("$field.VISITRECOMMENDATION_ID"));
\ No newline at end of file
......@@ -7,6 +7,7 @@
<grantCreate v="true" />
<grantUpdateProcess>%aditoprj%/entity/VisitRecommendation_entity/grantUpdateProcess.js</grantUpdateProcess>
<grantDeleteProcess>%aditoprj%/entity/VisitRecommendation_entity/grantDeleteProcess.js</grantDeleteProcess>
<contentTitleProcess>%aditoprj%/entity/VisitRecommendation_entity/contentTitleProcess.js</contentTitleProcess>
<initFilterProcess>%aditoprj%/entity/VisitRecommendation_entity/initFilterProcess.js</initFilterProcess>
<iconId>VAADIN:BRIEFCASE</iconId>
<image>VAADIN:BRIEFCASE</image>
......@@ -18,6 +19,20 @@
<targetContextField>TARGET_CONTEXT</targetContextField>
<targetIdField>TARGET_ID</targetIdField>
<documentation>%aditoprj%/entity/VisitRecommendation_entity/entityfields/#provider/documentation.adoc</documentation>
<dependencies>
<entityDependency>
<name>d39ab3e0-0b61-4a6d-a6f9-5c5fef20a801</name>
<entityName>VisitPlanEmployeeWeek_entity</entityName>
<fieldName>recommendations</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>3c5d510c-f7b3-401a-99cc-36b8e86c18f1</name>
<entityName>VisitPlanEntry_entity</entityName>
<fieldName>Visitrecommendations</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
</entityProvider>
<entityField>
<name>CONTACT_ID</name>
......@@ -155,6 +170,10 @@
<contentType>IMAGE</contentType>
<valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/icon/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>MAP_MARKER_COLOR</name>
<valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/map_marker_color/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>TARGET_CONTEXT</name>
<valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/target_context/valueProcess.js</valueProcess>
......@@ -247,6 +266,44 @@
<name>TARGET_ID</name>
<valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/target_id/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>LAT</name>
<contentType>NUMBER</contentType>
</entityField>
<entityField>
<name>LON</name>
<contentType>NUMBER</contentType>
</entityField>
<entityField>
<name>ADDRESS_ID</name>
</entityField>
<entityField>
<name>MAP_CONFIG</name>
<valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/map_config/valueProcess.js</valueProcess>
</entityField>
<entityParameter>
<name>MapViewCenterLat_param</name>
<valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/mapviewcenterlat_param/valueProcess.js</valueProcess>
<expose v="true" />
<documentation>%aditoprj%/entity/VisitRecommendation_entity/entityfields/mapviewcenterlat_param/documentation.adoc</documentation>
</entityParameter>
<entityParameter>
<name>MapViewCenterLon_param</name>
<valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/mapviewcenterlon_param/valueProcess.js</valueProcess>
<expose v="true" />
<documentation>%aditoprj%/entity/VisitRecommendation_entity/entityfields/mapviewcenterlon_param/documentation.adoc</documentation>
</entityParameter>
<entityField>
<name>MAP_FEATURE_COLLECTION</name>
</entityField>
<entityParameter>
<name>VisitrecommendationId_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>PrioritySource_param</name>
<expose v="true" />
</entityParameter>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......@@ -336,6 +393,18 @@
<isFilterable v="true" />
<isLookupFilter v="true" />
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>LON.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>LAT.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>ADDRESS_ID.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>ADDRESS_ID.displayValue</name>
</jDitoRecordFieldMapping>
</recordFieldMappings>
<filterExtensions>
<filterExtensionSet>
......
import("system.result");
import("system.datetime");
import("system.translate");
import("system.vars");
title = vars.get("$field.ORGANISATION_NAME") + " - " + translate.text("Due") + ": " + datetime.toDate(vars.get("$field.DUE_DATE"), "dd.MM.yyyy")
result.string(title);
\ No newline at end of file
import("system.result");
import("system.vars");
import("MapViewTemplate_lib");
var config = MapViewConfigUtils.getBaseConfiguration();
config.startingCenterPosition.lat = parseFloat(vars.get("$param.MapViewCenterLat_param"));
config.startingCenterPosition.lon = parseFloat(vars.get("$param.MapViewCenterLon_param"));
config.startingCenterPosition.zoomLevel = 5;
var tileConfig = MapViewConfigUtils.getMainTileConfig();
config.tiles = tileConfig;
//when opening the AroundLocation view we do want to have the source organisation as center, so let's not overwrite the starting center position by
//looking for the users current location
if ( vars.exists("$param.MapViewAdditionalFeatures_param") && vars.get("$param.MapViewAdditionalFeatures_param") )
{
config.startingCenterPosition.zoomLevel = 10;//max amount of km is 100, so let's zoom in
config.startingCenterPosition.autoLocate = false;
}
var res = JSON.stringify(config);
result.string(res);
\ No newline at end of file
import("system.vars");
import("KeywordRegistry_basic");
import("system.result");
import("system.neon");
var res = ""
switch(vars.getString("$field.PRIORITY"))
{
case $KeywordRegistry.visitRecommendationPriority$low():
res = neon.PRIORITY_NONE_COLOR;
break;
case $KeywordRegistry.visitRecommendationPriority$medium():
res = neon.PRIORITY_LOW_COLOR;
break;
case $KeywordRegistry.visitRecommendationPriority$high():
res = neon.PRIORITY_MEDIUM_COLOR;
break;
case $KeywordRegistry.visitRecommendationPriority$veryHigh():
res = neon.PRIORITY_MEDIUM_COLOR;
break;
case $KeywordRegistry.visitRecommendationPriority$critical():
res = neon.PRIORITY_HIGH_COLOR;
break;
}
result.string(res);
\ No newline at end of file
Pass a valid default decimal (or string-decimal) latitude-value to set the default center position of the Map-view which is based on the parameters
`MapViewCenterLat_param` and `MapViewCenterLon_param`.
\ No newline at end of file
import("system.result");
result.string("50.989791");
\ No newline at end of file
Pass a valid default decimal (or string-decimal) latitude-value to set the default center position of the Map-view which is based on the parameters
`MapViewCenterLat_param` and `MapViewCenterLon_param`.
\ No newline at end of file
import("system.result");
result.string("4.772377");
\ No newline at end of file
......@@ -9,6 +9,7 @@ params["NoVisitPlanEmployeeWeek_param"] = true;
params["ComingFromRecommendation_param"] = true;
params["ContactId_param"] = vars.get("$field.CONTACT_PERSON_ID");
params["Entrydate_param"] = vars.get("$field.DUE_DATE");
params["PrioritySource_param"] = vars.get("$field.PRIORITY_SOURCE");
params["VisitrecommendationId_param"] = vars.get("$field.UID");
neon.openContext("VisitPlanEntry", null, null, neon.OPERATINGSTATE_NEW, params);
\ No newline at end of file
......@@ -36,6 +36,10 @@ var recommendationSQLData = newSelect(
"VISITRECOMMENDATION.USER_NEW", //10
"VISITRECOMMENDATION.CONTACT_PERSON_ID",//11
"VISITRECOMMENDATION.RESPONSIBLE", //12
//Fields for MapView
"ADDRESS.LON", //13
"ADDRESS.LAT", //14
"ADDRESS.ADDRESSID" //15
])
.from("VISITRECOMMENDATION")
.join("CONTACT", "coalesce(VISITRECOMMENDATION.CONTACT_PERSON_ID, VISITRECOMMENDATION.CONTACT_ID) = CONTACT.CONTACTID")
......@@ -45,21 +49,36 @@ var recommendationSQLData = newSelect(
var idValues = false;
if (vars.exists("$local.idvalues") && vars.get("$local.idvalues"))
{
idValues = true;
}
if(idValues == true)
{
recommendationSQLData.and("VISITRECOMMENDATION.VISITRECOMMENDATIONID", vars.get("$local.idvalues"), SqlBuilder.IN())
}
else if(vars.get("$param.VisitrecommendationId_param"))
{
recommendationSQLData.and("VISITRECOMMENDATION.VISITRECOMMENDATIONID", vars.get("$param.VisitrecommendationId_param"));
}
recommendationSQLData = recommendationSQLData.table();
for( let i = 0; i < recommendationSQLData.length; i++)
{
var prio = ""
if(recommendationSQLData[i][2])
var prio = recommendationSQLData[i][2];
{
prio = recommendationSQLData[i][2];
}
else if(recommendationSQLData[i][3])
{
prio = getPrioByDueDate(recommendationSQLData[i][3]);
}
else
{
prio = $KeywordRegistry.visitRecommendationPriority$low();
}
tmpData = [
recommendationSQLData[i][0], //UID.value
......@@ -80,7 +99,12 @@ for( let i = 0; i < recommendationSQLData.length; i++)
ContactUtils.getFullTitleByContactId(recommendationSQLData[i][11], false), //CONTACT_PERSON_ID.displayvalue
recommendationSQLData[i][11], //CONTACT_PERSON_ID.value
ContactUtils.getFullTitleByContactId(recommendationSQLData[i][12], false), //RESPONSIBLE.displayvalue
recommendationSQLData[i][12] //RESPONSIBLE.value
recommendationSQLData[i][12], //RESPONSIBLE.value
recommendationSQLData[i][13], //LON.value
recommendationSQLData[i][14], //LAT.value
recommendationSQLData[i][15], //ADDRESS_ID.value
AddressUtils.getFormattedOnlineAddressById(recommendationSQLData[i][15]) //ADDRESS_ID.displayValue
];
recommendationData.push(tmpData);
......@@ -121,6 +145,10 @@ if(idValues == false)
, activitySubQuery //8
, "org.NAME" //9
, "PERSON.PERSONID" //10
//Fields for MapView
, "ADDRESS.LON"//11
, "ADDRESS.LAT"//12
, "ADDRESS.ADDRESSID"//13
])
.from("CONTACT")
.join("ORGANISATION", "CONTACT.ORGANISATION_ID = org.ORGANISATIONID", "org")
......@@ -181,7 +209,12 @@ if(idValues == false)
ContactUtils.getFullTitleByContactId(visitFrequencyData[i][1], false), //CONTACT_PERSON_ID.displayValue
isPersonContact ? visitFrequencyData[i][1]: "", //CONTACT_PERSON_ID.value
"", //RESPONSIBLE.displayValue
"" //RESPONSIBLE.value
"", //RESPONSIBLE.value
visitFrequencyData[i][11], //LON.value
visitFrequencyData[i][12], //LAT.value
visitFrequencyData[i][13], //ADDRESS_ID.value
AddressUtils.getFormattedOnlineAddressById(visitFrequencyData[i][13]) //ADDRESS_ID.displayValue
];
......@@ -200,9 +233,12 @@ if(idValues == false)
visitEntry = visitEntry.and(newWhere("VISITPLANENTRY.ENTRYDATE", eMath.subInt(vars.get("$sys.today"), datetime.ONE_DAY * 7), SqlBuilder.LESS_OR_EQUAL())
.and("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$Visitreportcreated(), SqlBuilder.NOT_EQUAL()))
.or("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$Visitreportcreated(), SqlBuilder.EQUAL()).cell()
.or("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$Visitreportcreated(), SqlBuilder.EQUAL())
.cell()
var prioritySource = vars.get("$param.PrioritySource_param");
if(!manualRec) //if manual Record was created, visitfrequency is not relevant
if(prioritySource != $KeywordRegistry.visitRecommendationPrioSource$manual() && !manualRec) //if manual Record was created, visitfrequency is not relevant
{
//!visitEntryExists - if no visitplanentry for the organisation/person from recommendation was created -> show recommendation so it can be planned
if(!visitEntryExists || visitEntry)
......@@ -216,7 +252,7 @@ if(idValues == false)
var filter = vars.get("$local.filter");
//TODO: this is a workaround that filters the records manually, it should be possible to filter the users with a tools.* method
var filterFields = ["", "ORGANISATION_NAME", "STREET", "COUNTRY" , "ZIP", "CITY", "PRIORITY", "PRIORITY_SOURCE", "", "DUE_DATE", "INFO", "CONTACT_ID"
, "", "", "USER_NEW", "", "CONTACT_PERSON_ID", "", "RESPONSIBLE"];
, "", "", "USER_NEW", "", "CONTACT_PERSON_ID", "", "RESPONSIBLE", "LON", "LAT", "", ""];
var filterFns = {
"$$$LOOKUPFIELD$$$" : function (pRecordValue, pFilterValue, pOperator, pRow)
{
......@@ -235,6 +271,7 @@ var filterFns = {
return false;
}
};
recommendationData = JditoFilterUtils.filterRecords(filterFields, recommendationData, filter.filter, filterFns);
......@@ -264,7 +301,9 @@ for (let field in order)
}
if (!sortOrder.length)
{
sortOrder = [9, false]; //default sort by duedate
}
ArrayUtils.sortMulti(recommendationData, sortOrder);
result.object(recommendationData);
......@@ -279,15 +318,25 @@ function getPrioByDueDate(pDueDate)
var dateDifference = pDueDate - currentDate;
if(dateDifference < 0)
{
prio = $KeywordRegistry.visitRecommendationPriority$critical();
}
else if(dateDifference < datetime.ONE_DAY * 3)
{
prio = $KeywordRegistry.visitRecommendationPriority$veryHigh();
}
else if(dateDifference < datetime.ONE_DAY * 7)
{
prio = $KeywordRegistry.visitRecommendationPriority$high();
}
else if(dateDifference < datetime.ONE_DAY * 14)
{
prio = $KeywordRegistry.visitRecommendationPriority$medium();
}
else
{
prio = $KeywordRegistry.visitRecommendationPriority$low();
}
}
return prio;
......
......@@ -4,6 +4,7 @@
<majorModelMode>DISTRIBUTED</majorModelMode>
<filterView>VisitRecommendationFilter_view</filterView>
<editView>VisitRecommendationEdit_view</editView>
<lookupView>VisitRecommendationFilter_view</lookupView>
<entity>VisitRecommendation_entity</entity>
<references>
<neonViewReference>
......
......@@ -16,6 +16,10 @@
<entityField>#ENTITY</entityField>
<isEditable v="true" />
<fields>
<entityFieldLink>
<name>3f3cb663-2649-4c49-9b98-9bab67282cd5</name>
<entityField>VISITRECOMMENDATION_ID</entityField>
</entityFieldLink>
<entityFieldLink>
<name>8c3a2df7-3928-43d4-baa9-686747ed020c</name>
<entityField>ORGANISATION_CONTACT_ID</entityField>
......
......@@ -130,5 +130,15 @@
</neonTreeTableColumn>
</columns>
</treeTableViewTemplate>
<mapViewTemplate>
<name>Map</name>
<configField>MAP_CONFIG</configField>
<autoGeneratedMarkerLatitudeField>LAT</autoGeneratedMarkerLatitudeField>
<autoGeneratedMarkerLongitudeField>LON</autoGeneratedMarkerLongitudeField>
<autoGeneratedMarkerIconField>#ICON</autoGeneratedMarkerIconField>
<autoGeneratedMarkerColorField>MAP_MARKER_COLOR</autoGeneratedMarkerColorField>
<autoGeneratedMarkerPopupField>ADDRESS_ID</autoGeneratedMarkerPopupField>
<maxDBRow v="400" />
</mapViewTemplate>
</children>
</neonView>
......@@ -314,14 +314,15 @@ JditoFilter.prototype.checkRecord = function (pRow)
return (new RegExp("^" + RegExpUtils.escapePatternStr(pFilterValue) + "$", regexFlags)).test(pRowValue);
case "NOT_EQUAL":
return !(new RegExp("^" + RegExpUtils.escapePatternStr(pFilterValue) + "$", regexFlags)).test(pRowValue);
//String-comparison returns false values < <= > >= are just relevant for numbervalues
case "LESS":
return pRowValue < pFilterValue;
return new Number(pRowValue) < new Number(pFilterValue);
case "LESS_OR_EQUAL":
return pRowValue <= pFilterValue;
return new Number(pRowValue) <= new Number(pFilterValue);
case "GREATER":
return pRowValue > pFilterValue;
return new Number(pRowValue) > new Number(pFilterValue);
case "GREATER_OR_EQUAL":
return pRowValue >= pFilterValue;
return new Number(pRowValue) >= new Number(pFilterValue);
case "ISNULL":
return pRowValue == "";
case "ISNOTNULL":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment