The RAD Server Field Service Template utilizes a RAD Server based REST server module for the server side. On the admin side there is a FireMonkey based desktop client for adding, viewing, and managing appointments. Additionally, the admin client allows you to manage parts inventory and do user administration. The offline capable cross platform client app is built in FireMonkey and it can be deployed to Android, iOS, macOS, and Windows. There is a single codebase and single UI. It allows you to view pending and completed appointments, map their locations, and mark them as completed. You can also view parts inventory and receive local notifications when new appointments are synced from the server. Both LiveBindings and FireDAC are used extensively through the Field Service Template to provide a low code solution.
The Field Service Admin project is built in RAD Studio Delphi using FireMonkey (FMX). The Admin app connects to RAD Server on the backend via a REST API. You should be able to log into the Admin area by selecting a Branch ID (Tenant ID) plus entering the login and password for a user in the Managers Group. For this template the default user is manager1.
Be sure to configure the EMS_SERVER and EMS_PORT const in uMainForm.pas to point at your development server. The default is localhost 8080.
The Branch ID is stored with each data table so each branch will only see its own set of appointments, parts, and users. Each branch has its own users and groups as well. The Branch system is built on top of the Tenant functionality in RAD Server.
As of the time of this writing you can get a single site license for RAD Server with RAD Studio Enterprise and you can get a multi-site license for RAD Server with RAD Studio Architect edition.
Appointments
Appointments are records that can be created, viewed, and edited in the Admin client. They can also be assigned to a Technician. Appointments can be viewed and completed in the Field Service App. Appointments have various fields like Appointment date and time, customer title, description, address information, phone number, location, photo, status, and notes. The photo field supports PNGs and JPGs. Addresses can be converted to longitude and latitude using the Locate button utilizing the Google Geocoding API.
History
The Service History list is a view into the Appointments and only shows Appointments that have been their status set to Complete. Technicians using the Field Service App submit completed appointments and include notes. The History view utilizes TFDLocalSQL to show only the completed appointments.
Parts
Parts are records that can be created, viewed, and edited in the Admin client. They can also be viewed by Technicians. Parts have various fields like title, description, location, quantity, and photo. The photo field supports PNGs and JPGs.
Users
Users are records that can be be created, viewed, and edited in the Admin client. They also show up as an individual profile to logged in Technicians. When a user is created in the Field Service database it also creates a shadow user in the RAD Server Users API where their username and password are stored. By default users can be in the Managers Group or the Technicians Group. The Group information is also stored in the RAD Server Groups API and the server accesses the RAD Server User and Group data for the permissions.
Data Sync
The Data Sync tab in the Admin client is where JSON data is downloaded from the Field Service Server REST endpoint and loaded up into the various in memory TFDMemTable components. Data for the Appointments, Parts, Users, and Groups is all downloaded on this tab. You can also request to Refresh the data at any time to get new updates from the server. Additionally, there is a background TTimer which will refresh the data from the server automatically on an interval.
Architecture
The architecture of the app is built in a low code rapid application development style using TTabControls for handling pages and individual frames for each page. TActionList is used to consolidate much of the code in the MainForm. There are two TTabControls on the MainForm. The first one contains the Login frame and the second TTabControl. The second TTabControl contains the rest of the frames. Within the ApptsFrame, HistoryFrame, PartsFrame, and TechsFrame there are additional Master/Detail TTabControls.
If you want to make changes to the design time frames be sure to edit the frame itself and not the version of it that is embedded in the MainForm. This will keep your changes consolidated in one place. If your changes don't update in the MainForm you can delete the Frame from the MainForm and re-add it. Be sure to add it to the correct Tab and set to Align Client after you add the frame.
The frames are built to be as modular as possible with TBindSourceDB components used as endpoints for the LiveBindings. This allows you to easily re-use the frames in your own projects by connecting the TBindSourceDBs to your own datasets.
A TFDLocalSQL component is used to provide SQL access to the various TFDMemTables via TFDQuery components. This allows the App to provide query results for filtering some of the datasets.
-
uDataModule in 'uDataModule.pas' {MainDM: TDataModule},
Contains the RAD Server (EMS) Provider client components, the in memory table components, and the various FireDAC connecting components. -
uMainForm in 'uMainForm.pas' {MainForm},
Contains the main form of the application with the various TTabControls and inline embedded TFrames. -
uLoginFrame in 'uLoginFrame.pas' {LoginFrame: TFrame},
Contains the UI and code for the Login screen. -
uApptsFrame in 'uApptsFrame.pas' {ApptsFrame: TFrame},
Contains the UI and code for the Appointments screen. -
uHistoryFrame in 'uHistoryFrame.pas' {HistoryFrame: TFrame},
Contains the UI and code for the History screen. -
uPartsFrame in 'uPartsFrame.pas' {PartsFrame: TFrame},
Contains the UI and code for the Parts screen. -
uTechsFrame in 'uTechsFrame.pas' {TechsFrame: TFrame},
Contains the UI and code for the Users screen. -
uProgressFrame in 'uProgressFrame.pas' {ProgressFrame: TFrame},
Contains the activity progress TFrame which is displayed when the app is busy. -
uTenantsDM in 'uTenantsDM.pas' {TenantsDM: TDataModule},
Contains the RAD Server (EMS) Provider connector components for accessing the Branch (Tenants) list. -
uTenantListForm in 'uTenantListForm.pas' {TenantForm},
Contains the UI and code for selecting a Branch/Tenant. -
uQueueFrame in 'uQueueFrame.pas' {QueueFrame: TFrame},
Contains the UI and code for syncing data from the server. -
uGroupsListForm in 'uGroupsListForm.pas' {GroupsForm},
Contains the UI and code for selecting a Group. -
uTechsListForm in 'uTechsListForm.pas' {TechsForm};
Contains the UI and code for selecting a Technician to assign to an appointment.
Permissions
The Field Server Admin app will make an additional call after it logs in to download the list of Groups that the current user account is in. It will check to see that the user is in the Managers Group. If the user is not in the Managers Group it will log you back out. There are additional permissions in the Field Server Server which govern what data is sent down to which users as well. Only users in the Managers Group will receive the full data and be able to make changes to it.
Customize The UI
You can quickly and easily customize most of the look and feel of the app with three easy changes. In TMainForm there is a BackgroundRect, a BackgroundImageRect, and a EmeraldDarkStyleBook control. You can change the background color of the app by changing the BackgroundRect.Fill.Gradient property. You can change the image that is overlayed over the entire app by changing the BackgroundImageRect.Fill.Bitmap.Bitmap property. The background image works by being above all of the other controls, having a low Opacity, having a HitTest of False and a Locked property of True. Finally, you can change most of the rest of the theme by loading different Premium Styles into the EmeraldDarkStyleBook control.
You can customize the header logo of the Login screen on the LoginFrame. There are a few other places where the custom green color is used on some elements in the TListView controls and some the search icons using a TFillRGBEffect.
You will need to update the BackgroundRect and BackgroundImageRect in the GroupsListForm, the TechsListForm, and the TenantForm as well. There is a BackgroundImage control in the LoginFrame if want to customize the background of the Login page. Remember that you will need to load one style for each of the four deployment platforms. You can access the Premium Styles here:
https://www.embarcadero.com/products/rad-studio/fireui/premium-styles
https://cc.embarcadero.com/item/30491