Skip to main content

Popup

A key input in FIYGE is a popup, this is how we related and associate modules to each other. There are two types of popups.

  1. Singular allows you to select a record from a predefined model to relate to a record.
  2. Multiple allows you to select which model to select from and then to select a record from that model list.

To find which popup to use, you can call these functions

const isSingularPopupOption = () => {
const popupOptions = element?.children?.filter((c) => {
return c.method === "popupoption" || c.template === "popupoption";
});
return popupOptions?.length === 1;
};

const isMulitplePopupOption = () => {
const popupOptions = element?.children?.filter((c) => {
return c.method === "popupoption" || c.template === "popupoption";
});
return popupOptions?.length && popupOptions?.length > 1;
};

To get the list of options that you can select from, you can get the href from the popupOption child. This href contains a url which you can call with params to get the list of available options.

https://v2.crm.immigrate.fiyge.com/crm/config_people_types/index.json?current_listview=64873bff-d748-4db7-afa7-44ddac69033c&current_category=System View&ajax=1&q={"fields":["{{MODEL}}.{{DISPLAY_FIELD}}","{{MODEL}}.{{PRIMARY_KEY}}"],"where":{},"limit":15,"fetch":1,"autocomplete":1}

Search Params

  • current_category: System View
  • ajax: 1
  • q: query
const query = {
fields: ["{{MODEL}}.{{DISPLAY_FIELD}}", "{{MODEL}}.{{PRIMARY_KEY}}"],
where: {
"{{MODEL}}.{{DISPLAY_FIELD}} LIKE": `%${searchValue}%`,
},
limit: FETCH_LIMIT,
fetch: 1,
autocomplete: 1,
controller: controller
}

This will fetch the options that a user can select from.