frontend-platform

Documents OrangeHRM's Vue plugins for i18n, ACL, toaster, navigation, and date formatting.

Updated Jul 23, 2026
One-click install
npx skills add https://github.com/snow-gift111/orangehrm-ai-sdlc-capstone --skill frontend-platform-snow-gift111
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontend-platform
Source: https://github.com/snow-gift111/orangehrm-ai-sdlc-capstone/tree/main/.agents/skills/frontend-platform
Command: npx skills add https://github.com/snow-gift111/orangehrm-ai-sdlc-capstone --skill frontend-platform-snow-gift111

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? OrangeHRM's Vue frontend relies on cross-cutting plugins ($t, $can, $toast, navigate, useDateFormat) whose conventions are easy to misuse — silent translation failures, permission strings that must match backend data groups exactly, and auto-fired toasts that duplicate manual ones. This Skill provides the authoritative reference for using these plugins correctly. ## Core Features & Use Cases - i18n with $t: Translate strings using module-grouped keys, ICU MessageFormat parameters, the usei18n composable in setup(), and the translate() factory for non-component code. - ACL with $can: Gate buttons and UI elements by data-group permissions (read/create/update/delete) that map to backend ohrm_data_group rows, with AND semantics across multiple groups. - Toaster, navigation, and dates: Use semantic toast shortcuts (saveSuccess, cannotDelete, unexpectedError), navigate() for full-page transitions without vue-router, and useDateFormat for user-specific date display. - Use Case: When adding a new 'Save Widget' button to a Vue page, use this Skill to add the lang string via a migration, gate the button with $can.create('apiv2_x_widgets'), fire toast.saveSuccess() after the API call, and navigate() back to the list page. ## Quick Start Ask the AI to show how to translate a string, gate a button with $can, and show a success toast on an OrangeHRM Vue page.

Frequently Asked Questions about frontend-platform

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I translate strings in an OrangeHRM Vue component?

Use $t('module.key') in templates, with keys grouped by module like general.save or pim.employee_information. In setup(), use the usei18n composable since $t is not available there; for non-component modules, use the translate() factory from the i18n plugin.

How do I hide a button based on user permissions in Vue?

Use v-if="$can.create('data_group_name')" where the string matches a DataGroup.name seeded in permission/api.yaml or permission/screens.yaml. This only hides UI; the backend must still enforce the permission via ApiAuthorizationSubscriber.

Why does $t return the translation key instead of the translated text?

The key is missing from the loaded lang strings, and $t returns the key as-is without error or warning. Add the string to the appropriate lang-string/<module>.yaml migration file and run the migration to fix it.

Does OrangeHRM's Vue frontend use vue-router for navigation?

No, OrangeHRM does not use vue-router. Every page transition is a full reload via the navigate() helper, which sets window.location.href after building the URL with urlFor().

Why does $can always return false for my component?

$can reads permissions injected by the <oxd-layout> component via Vue's provide/inject. If your component mounts outside the layout, or the data-group string has a typo or case mismatch with ohrm_data_group.name, it silently returns false.

How do I format dates according to the user's preference in OrangeHRM?

Use the useDateFormat composable to get jsDateFormat, then pass it to formatDate() from the datefns helper. The API always returns yyyy-MM-dd; never hardcode a display format since users have different configured formats.