Maintenance Records

Maintenance Records detail service performed on a particular refrigerator. Individually they are a brief record of service performed, and taken together they compose the service history of a refrigerator.

Lists of Maintenance Records

Maintenance Log

Function

A List of Maintenance Records is similar to a Lists of Refrigerators. It is launched by pressing the View All Maintenance Records button on the Refrigerator Menu.

The list portion contains each maintenance record in the log for a particular refrigerator, with the date serviced highlighted. Clicking that list item will open the Maintenance Record Menu.

Records can be searched by refrigerator ID. This page is paginated by default to 10 records per page. This can be adjusted to 20, 50, 100, or 1000 by selecting the option from the drop menu. To navigate between pages of maintenance records, use the Next and Prev buttons.

Tapping the Edit button will launch the Survey form for this maintenance record. Each field will be prepopulated with the values shown in the menu, so that only the values that are incorrect need to be filled in.

Implementation

The maintenance records list uses the files tables/maintenance_logs/html/maintenance_logs_list.html and tables/maintenance_logs/js/meaintenance_logs_list.js similarly to the refrigerators list.

The key differences are the listQuery and searchParams variables that define the values that will populate the same user interface. This file's versions of listQuery finds all maintenance logs that match the refrigerator ID and this versions of searchParams searches for matching refrigerator IDs.

That logic that implements that user interface is discussed in The list_view_logic.js library.

Files

  • tables/maintenance_logs/html/maintenance_logs_list.html

  • tables/maintenance_logs/js/maintenance_logs_list.js

  • config/assets/js/list_view_logic.js

Forms

None

Database Tables

  • Maintenance Logs

  • Refrigerators

Maintenance Record Menu

Maintenance Record

Function

The Maintenance Record Menu is a Detail View that lists the full account of the service, including the Reason Not Working, the Date Serviced, Spare Parts, and other details.

It also includes an Edit Log button, which launches the Survey form for this maintenance record. Each field will be prepopulated with the values shown in the menu, so that only the values that are incorrect need to be filled in.

Implementation

The Detail View for a maintenance record is defined by tables/maintenance_logs/html/maintenance_logs_detail.html. This file lists each user interface element (including all the data values of the maintenance record as well as the buttons). These elements contain their labels, and the values are filled in by tables/maintenance_records/js/maintenance_records_detail.js.

After localizing its text, this JavaScript retrieves the maintenance log data with the standard odkData.getViewData(...) call. It also makes an odkData.query(...) call to the Refrigerators table. The resulting data sets are combined to fill in the display fields on the detail view.

The Edit Log and Delete Log buttons are dynamically hidden or shown depending on the privileges of the authenticated user.

If the Edit Log button is pressed, the Maintenance Logs form is launched with odkTables.editRowWithSurvey(...). The forms .xlsx file is located at tables/maintenance_logs/forms/maintenance_logs/maintenance_logs.xlsx. This form is discussed in the refrigerator menu implementation section under the Add Maintenance Record bullet.

If the Delete Log button is pressed, odkData.deleteRow(...) is called to remove the record from the database.

Files

  • tables/maintenance_logs/html/maintenance_logs_detail.html

  • tables/maintenance_logs/js/maintenance_logs_detail.js

  • assets/js/util.js

  • tables/maintenance_logs/forms/maintenance_logs/maintenance_logs.xlsx

Forms

  • Maintenance Logs with form ID maintenance_logs

Database Tables

  • Maintenance Logs

  • Refrigerators