sodexo-deposits-template
The sodexo-deposits-template component displays a list of all deposits for a specific user badge..
Properties
| Property | HTML Attribute | Type | Default | Description |
|---|---|---|---|---|
badgeId | badge-id | string | - | Badge identifier to display deposits for |
Events
| Event | Type | Description |
|---|---|---|
sodexoDepositsTemplateLineClicked | CustomEvent<DepositSelected> | Emitted when a deposit line is clicked. Returns badgeId and depositId. Recommended action: Navigate to deposit detail page |
Event Details
DepositSelected
interface DepositSelected {
badgeId: string;
depositId: string;
}
Usage
- HTML
<!DOCTYPE html>
<html>
<sodexo-deposits-template badge-id="badge-123"></sodexo-deposits-template>
<script>
const element = document.querySelector('sodexo-deposits-template');
// Handle deposit line click
element.addEventListener('sodexoDepositsTemplateLineClicked', (event) => {
const { badgeId, depositId } = event.detail;
console.log('Deposit clicked:', { badgeId, depositId });
// Redirect to deposit detail
window.location.href = `/deposits/${badgeId}/${depositId}`;
});
</script>
</html>
Property Naming Convention
Naming Syntax
When using properties:
- In HTML: Use kebab-case (e.g.,
api-key,badge-id) - In JavaScript: Use camelCase (e.g.,
apiKey,badgeId) - Events: Can only be handled in JavaScript, not in HTML attributes
Navigation Flow
This diagram shows the recommended navigation flow for the deposits template:
Recommended Actions
On sodexoDepositsTemplateLineClicked: Navigate to deposit detail page
const { badgeId, depositId } = event.detail;
navigate(`badges/${badgeId}/deposits/${depositId}`);