Save requisition for Offline

Description

A user needs to be able to update a requisition while they are disconnected from the internet.

To support this, a user can select a single requisition to save offline — modify the requisition freely — and then sync the requisition back to the OpenLMIS Requisitions Service once they are online again.

A requisition page will now have an offline check box, which will download all data associated with the requisition to the browser's local storage. Requisitions will be automatically downloaded when a user views a requisition page.

When a user makes a change to the requisition (ie entering data into a number input) the change will be saved into local storage.

Any changes to the requisition (data entry) will be immediately saved to the requisition data in local storage. When the user 'syncs' the requisition, the requisition will be sent to the OpenLMIS server — the requisiton will be automatically synced at a regular interval. If there are no changes from the user when the requisition needs to be synced then no actual http request will be made.

If there are no new changes to the requisition, and the requisition page is opened by the user, then the offline cache will be updated. If there are local changes to the requisition and the requisition page is opened by the user — the offline cache will not be updated — meaning that if the user syncs their local version it will overwrite the server version. This is not ideal behavior, but detecting and dealing with conflicts will be done in OLMIS-880

Wireframe of page components

Acceptance Criteria
The workflow for a user will be:

  • Open any requisition page

  • The requisition will be automatically stored and saved offline in the browser's local storage when the user first views the requisition

  • There is a checkbox that is automatically checked that says the requisition is available offline box that states the requisition is available offline and a button to remove the requisition

  • When a user makes any change to the data within a requisition, that data is saved in local storage automatically (and a small notification is shown to the user). There is no save button on the requisition page

  • There is a save button that when pressed will save the requisition to the user's local storage (so if they refresh the page after saving they should be shown the changes — even if they were not stored online)

  • There is a "Sync" button that when pressed the requisition is saved to the requisition service

  • When the browser is offline, the sync button is disabled

  • When a user unchecks the 'available offline' checkbox, click the remove local requisition, the user is shown a confirmation modal that says "You are about to remove your local version of this requisition. This requisition will no longer be available offline." (Ok/Cancel)

  • The available offline checkbox won't be checked when the requisition isn't stored in local storage There will be a 'store offline' button if the requisition isn't available offline

  • A requisition that is stored offline will recieve an update made in another browser, if the offline browser hasn't made any edits to the requisition AND the browser with the 'offline requisition' is online

  • Data that is entered into a requisition that is offline will be visible on another browser only once the sync button has be pressed and the second browser has been refreshed

  • A requisition always 'syncs' its data before Submitting/Authorizing/Approving the requisition

  • Requisitions are automatically synced when online, and the automatic sync interval can be set as a config variable in config.json

NOTE: Changes to acceptance criteria

  • Added save button into specification because it is technically easier for now & removed auto-save feature – Will address is follow up ticket

Attachments

1
  • 08 Dec 2016, 09:54 PM
100% Done

QAlity Plus - Test Management

Checklists

Activity

Paweł Gesek 
December 21, 2016 at 2:13 PM

I've testing this today and it seems to work fine. There are some issues I found, but they are more related to the display part of requisitions, so I left the comments there. If the issues are deeper, we can also address them in that ticket. I think we should be fine closing this.

For a general offline issue I found, I created OLMIS-1520.

Paweł Gesek 
December 21, 2016 at 11:35 AM

1) when I sync, the products change order on the grid
2) I was offline and couldn't get the save locally button to get enabled. I assume it's because I didn't reload the page.

Nick Reid 
December 21, 2016 at 1:26 AM

ps & - the acceptance criteria were changed to remove the auto-saving behavior

Nick Reid 
December 8, 2016 at 9:55 PM

— let me know if this matches your understanding

Done
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Time tracking

1w 3d logged

Components

Sprint

Fix versions

Priority

Time Assistant

Created November 9, 2016 at 7:45 PM
Updated December 21, 2016 at 6:03 PM
Resolved December 21, 2016 at 2:14 PM