Visit sheet
Backend
1. Variables
// picker variable for customer type
ensure var VarSetOfTextCustomerType kind: setOfText
deploy: fixedOnDeploy
value: "<root>
<node key='keyDistributor'>Distributor</node>
<node key='keyDealer'>Dealer</node>
</root>"
2. VisitBook
// this spreadsheet stores item information
ensure spreadsheet: VisitBook
withFields: [Date, VisitedBy, CustomerName, MobileNumber, CustomerType, GSTNo, Location, Image1, Image2, Remarks]
ofTypes: [date, pickUser, text, mobileNumber, pickText, text, location, camera, camera, paragraph]
removeRoleSet: [Owner]
insertRoleSet: [Owner, Agent]
updateRoleSet: [Owner, Agent]
readRoleSet: [Owner, $Manager]
ensure form EntityVisit
commentRoleSet: [Employee]
chatLabelField: Details.CustomerName
ensure section: Details
ensure field Date defaultValue: "now"
ensure field VisitedBy disabled: true roleDataSource: [$Self] defaultValue: $Self
ensure field CustomerType sourceVar: VarSetOfTextCustomerType defaultOptionId: "keyDealer"
ensure field Location disabled: false required: false captureUser: false captureMode: onInsert
ensure field Image1 label: "Image 1" showLabel: false
ensure field Image2 label: "Image 2" showLabel: false
ensure field GSTNo label: "GST No"
ensure field Remarks lineCount: 5
ensure spreadsheet VisitBook queryables: [Date, VisitedBy]
ensure layoutSpreadsheet ListLayout kind: list
filter.showSearchBar: true
firstLine.first.lineFields: [CustomerName]
firstLine.caption.lineFields: [CustomerType]
secondLine.first.lineFields: [MobileNumber]
secondLine.first.showLabels: true
thirdLine.first.lineFields: [Location]
thirdLine.first.showLabels: true
ensure layoutSpreadsheet TableLayout kind: table
columnSizeSet: ["AutoSize"]
showCommentCount: true
showComps: [Date, VisitedBy, CustomerName, MobileNumber, CustomerType, Location, Remarks]
3. Reports
a. ReportVisit
• Input form
// input form for report ReportVisit
ensure form FilterVisit
ensure section: Details
ensure field LabelFilterDate kind: label label: "Filter Date" bold: true textPattern: "Filter Date"
ensure field FromDate kind: date defaultValue: "startOfMonth"
ensure field ToDate kind: date defaultValue: "endOfMonth"
ensure field Divider kind: divider
ensure field LabelFilterEmployee kind: label label: "Filter Employee" bold: true textPattern: "Filter Employee"
ensure field Employee kind: pickUser roleDataSource: [Employee]
• Output form
// output form for report ReportVisit
ensure form OutputVisit
ensure grid: VisitSet
ensure field Date kind: date defaultValue: "now"
ensure field VisitedBy kind: pickUser roleDataSource: [Employee]
ensure field VisitRowId kind: rowId
ensure field CustomerName kind: text
ensure field MobileNumber kind: mobileNumber
ensure field CustomerType kind: pickText sourceVar: VarSetOfTextCustomerType
ensure field GSTNo kind: text label: "GST No"
ensure field Location kind: location
ensure field Remarks kind: paragraph
ensure field MapLineStroke kind: lineStroke defaultValue: solid
ensure field MapPinShape kind: pinShape defaultValue: pin
ensure field UserColor kind: color
ensure layoutGrid TableLayout kind: table columnSizeSet: ["AutoSize"]
showComps: [Date, VisitedBy, CustomerName, MobileNumber, CustomerType, GSTNo, Location, Remarks]
ensure layoutGrid MapLayout kind: map
locationField: Location
colorField: UserColor
shapeField: MapPinShape
groupByField: VisitedBy
strokeField: MapLineStroke
ensure formula ColorFormula
assignToField: VisitSet.UserColor
formula: "getUserColor(${f:VisitSet.VisitedBy})"
• Report
// this report returns visit information
// filter condition for report ReportVisit
ensure var VarFilterConditionReportVisit kind: condition
deploy: fixedOnDeploy
value: "<root>
<and>
<and>
<stmt>${f:Details.Date} >= ${in:Details.FromDate}</stmt>
<stmt>${f:Details.Date} <= ${in:Details.ToDate}</stmt>
</and>
<or>
<and>
<stmt>${in:Details.Employee} has value</stmt>
<stmt>${f:Details.VisitedBy} == ${in:Details.Employee}</stmt>
</and>
<stmt>${in:Details.Employee} has no value</stmt>
</or>
</and>
</root>"
sourceForm: EntityVisit
inputForm: FilterVisit
// mapping variable between spreadsheet form and output form
ensure var VarMappingVisit kind: mapping
deploy: fixedOnDeploy
fromForm: EntityVisit
toForm: OutputVisit
toGrid: VisitSet
fieldMappingMap: {
'map': {
'${f:Details.Date}': 'VisitSet.Date',
'${f:Details.VisitedBy}': 'VisitSet.VisitedBy',
'${f:Details.CustomerName}': 'VisitSet.CustomerName',
'${f:Details.MobileNumber}': 'VisitSet.MobileNumber',
'${f:Details.CustomerType}': 'VisitSet.CustomerType',
'${f:Details.GSTNo}': 'VisitSet.GSTNo',
'${f:Details.Location}': 'VisitSet.Location',
'${f:Details.Remarks}': 'VisitSet.Remarks',
'${f:SysRowId}': 'VisitSet.VisitRowId'
}
}
ensure report ReportVisit kind: spreadsheet
inputForm: FilterVisit
outputForm: OutputVisit
fromSpreadsheet: VisitBook
filterConditionVar: VarFilterConditionReportVisit
outputFormMappingVar: VarMappingVisit
b. ReportVisitInfo
• Input form
// input form for ReportVisitInfo created above
ensure form OutputVisit
• Output form
// Output form for ReportVisitInfo
ensure form OutputVisitInfo
ensure section: Details
ensure field CustomerType kind: pickText
sourceVar: VarSetOfTextCustomerType
ensure field Customer kind: text
ensure field VisitedBy kind: pickUser roleDataSource: [Employee]
ensure field Address kind: location
ensure field Remarks kind: paragraph
ensure layout ReportLayout kind: content
displayLabel: "Visit Info"
direction: vertical
start.fields: [CustomerType, Customer, Address, Remarks]
• Report
// report
ensure report ReportVisitInfo kind: query
label: "Visit Info"
inputForm: OutputVisit
outputForm: OutputVisitInfo
fromSpreadsheets: [VisitBook]
neoQL: "select
${ss:VisitBook.Details.CustomerType} as ${out:Details.CustomerType},
${ss:VisitBook.Details.CustomerName} as ${out:Details.Customer},
${ss:VisitBook.Details.VisitedBy} as ${out:Details.VisitedBy},
${ss:VisitBook.Details.Location} as ${out:Details.Address},
${ss:VisitBook.Details.Remarks} as ${out:Details.Remarks}
from ${ss}
where
${ctx:row.type} = ${ss:VisitBook}
and ${ctx:row.id} = ${arg:selectedGridId.selectedGridRowId.VisitRowId}"
Frontend
1. AddVisit
// this action inserts information of visit to spreadsheet
ensure action AddVisit kind: rowInsert
icon: "AddLocationRounded"
spreadsheet: VisitBook
sendMessageToInbox: true
2. CallReportVisit
// this action calls report ReportVisit
ensure form OutputVisit
ensure layout Map kind: content
direction: horizontal
renderingMode: fullScreen
flexCenter.gridLayouts: [VisitSet.MapLayout]
ensure layout Table kind: content
direction: vertical
allowToSwitchLayouts: [Map]
flexCenter.gridLayouts: [VisitSet.TableLayout]
ensure layout Map
allowToSwitchLayouts: [Table]
ensure action CallReportVisit kind: report
icon: "MapRounded"
report: ReportVisit
outputFormContentLayout: Map
sendMessageToInbox: false
3. CallReportVisitInfo
// this action calls report ReportVisitInfo
ensure action CallReportVisitInfo kind: report
label: "Visit Info"
report: ReportVisitInfo
outputFormContentLayout: ReportLayout
sendMessageToInbox: false
4. ViewVisitSheet
// this action opens visit sheet
ensure action ViewVisitSheet kind: spreadsheetEditor
icon: "EditNoteRounded"
spreadsheet: VisitBook
layoutSpreadsheet: TableLayout
5. Action permission
// action permission
ensure form OutputVisit
ensure composite VisitSet
actionPermission: {
'CallReportVisitInfo': {
'showMessageToolTip': true,
'roles': [
'Employee'
]
}
}
ensure form OutputVisit
ensure grid: VisitSet
actionPermission: {
'CallReportVisitInfo': {
'showMessageToolTip': true,
'roles': [
'Employee'
]
}
}
6. Group actions
// this group has all actions those can be performed for visit
ensure group MyVisits
pinnedActions: [AddVisit, ViewVisitSheet, CallReportVisit]
pinnedActionSetMobile: [AddVisit]
actionPermission: {
'AddVisit': {
'menuGroup': '1',
'roles': [
'Agent'
]
},
'ViewVisitSheet': {
'menuGroup': '2',
'roles': [
'Owner'
]
},
'CallReportVisit': {
'menuGroup': '3',
'roles': [
'Owner'
]
}
}