Create and Manage Forms (Information Collection)
Updated
by Kate Santo
At Padoq, there is a useful tool called forms. Forms are great to keep track of things that are important to users and admins. And they are great to collect information from users.
Forms are a part of the Super Admin area in a Padoq app. So the user will have access to this area only if they are an admin to a group.
Forms are made up of templates, items (also called inventory) and menus. Find out how each of these components interact to generate forms.
See for yourself
- You can download the iOS or Android app on your phone to follow this journey along. And you can also log in or sign up to the web app here
- On the web version of the app, head to Manage and then Super Admin at the top. Select a group you're an admin for. This will take you to the Super Admin space, where you'll see tabs called Templates, Items and Settings
- You can also follow along by checking out the images or code snippets in this guide
- And you will find the relevant endpoints linked and explained in this guide, but the full API is documented in Swagger UI
Prerequisites
- For forms to display in the UI, the padoq needs its
official
parameter setting totrue
. This can only be done by an admin at Padoq (i.e. padoqs are not official by default)
Journey explained
There are three steps to setting up a form: creating templates, creating items and creating a menu for the form. Check out what happens in each step. At the end of the journey, you'll find a diagram of the process so you can have a visual overview of all the steps involved.
Templates
- Open template tab
- The getPostTemplates endpoint is called with one compulsory parameter:
padoqName
. This retrieves any templates that already exist in the specified group
- The getPostTemplates endpoint is called with one compulsory parameter:
- Enable in app
- This is needed for forms to be displayed. For the user, it looks like a toggle, and all it does is call the updatePadoq endpoint and update the
qrCodesEnabled
property totrue
- This is needed for forms to be displayed. For the user, it looks like a toggle, and all it does is call the updatePadoq endpoint and update the
- Create template
- 2 endpoints are called at this point:
- createPostTemplateReference creates the reference that will be used later in the process to link items to templates
- createPostTemplate takes all the information the user entered, plus the reference from the previous endpoint, and creates a template. The response might look something like this:
{
"title": "de Finibus Bonorum et Malorum",
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"public": false,
"canLike": true,
"canDislike": true,
"canComment": true,
"recipients": [
"john"
],
"links": [
{
"uri": "string",
"title": "string",
"displayText": "string",
"imageUri": "string",
"mediaType": "image/jpeg"
}
],
"structuredContent": {},
"mentions": [
"sparklemanager",
"patterknit"
],
"tags": [
"tag1",
"tag2"
],
"references": [
{
"memberTemplateId": "1f9cb547-ae0e-4471-8654-b04a63f8a9b8",
"guestTemplateId": "8e08506a-6d7c-4a50-a89b-05c6b18e6a46",
"inventoryId": "603d4269-f011-4e3d-99b5-66efa162198c",
"matchPrefix": "string",
"matchPattern": "string"
}
]}
- 2 endpoints are called at this point:
Items
- Create category
- When creating an item, it has to be linked to a category. If the category already exists, no endpoints are called. But if the category is new, the createInventoryCategory endpoint is called. It takes two parameters:
name
is the name of the padoq where the category needs to be createdcategory
is the string name of the category, as typed by the user in the UI
- When creating an item, it has to be linked to a category. If the category already exists, no endpoints are called. But if the category is new, the createInventoryCategory endpoint is called. It takes two parameters:
- Create item
- When the user fills in the rest of the fields in the UI, an item is finally created by calling the createInventory endpoint. An item might look like this:
{
"code": "ITM000-0001",
"category": "Bins",
"description": "Lorem ipsum dolor sit amet, consectetur",
"numberAvailable": 0,
"from": "now",
"to": "2021-01-22T16:24:14.886Z",
"amount": 0,
"currencyCode": "GBP",
"location": {
"name": "Europe/Manchester",
"coordinates": [
53.466667,
-2.233333 ]
},
"contactName": "Juliet Smith",
"contactEmail": "juliet.smith@example.com",
"attributes": {},
"slaId": "string"}- Here's how a few saved items might look like in the UI
Form menus
- Get categories
- Each item has a category assigned to it, and each menu item is linked to a category. So the first endpoint called is getInventoryCategories to make them available for the user to pick one
- Upload menu icon
- There are two types of menu: problems menu and signups menu. The only difference between them is that one of them requires an icon. So if the user is creating a problem menu item, the uploadPadoqMenuIcon endpoint is called
- Here's how the fields look like:
- There are two types of menu: problems menu and signups menu. The only difference between them is that one of them requires an icon. So if the user is creating a problem menu item, the uploadPadoqMenuIcon endpoint is called
- Create menu item
- When the user has entered the relevant details and clicks 'Save', the createPadoqMenuItem endpoint is called. A menu item might look like this:
{
"order": 1,
"description": "A description of this menu item. ",
"referenceUri": "https://meida.padoq.com/template/66570917-c4d5-430d-ad2b-99bdd1eaf795",
"icon": {
"type": "image/tif",
"size": 197020,
"crc": -1035224824 },
"minPrivilege": 1,
"specialFunction": false,
"requiredRoles": [
"member" ],
"category": "Bathroom Appliances"}
- Updating a menu item
- Once a menu item is created, the user might need to edit it. For this, the updatePadoqMenuItem endpoint is called. It takes two compulsory parameters:
name
(name of the padoq where the menu was created) andID
(of the specific menu item that the user is editing) - Then, the structure of the menu item gets updated to the edited body in the request
- Once a menu item is created, the user might need to edit it. For this, the updatePadoqMenuItem endpoint is called. It takes two compulsory parameters:
- Deleting a menu item
- The user might want to delete a menu item altogether. In the UI, this option is an X icon on the right hand side of each menu item line. The endpoint called to perform this action is deletePadoqMenuItem, which takes the same 2 compulsory parameters:
name
andID
- With that information, the body of the menu item is simply removed from the padoq
- The user might want to delete a menu item altogether. In the UI, this option is an X icon on the right hand side of each menu item line. The endpoint called to perform this action is deletePadoqMenuItem, which takes the same 2 compulsory parameters: