add typegen and minor style fixes
This commit is contained in:
@@ -84,22 +84,22 @@ export function AccountMembersTable({
|
||||
});
|
||||
|
||||
const searchString = search.toLowerCase();
|
||||
const filteredMembers = searchString.length > 0
|
||||
? members
|
||||
.filter((member) => {
|
||||
const displayName = (
|
||||
member.name ??
|
||||
member.email.split('@')[0] ??
|
||||
''
|
||||
).toLowerCase();
|
||||
const filteredMembers =
|
||||
searchString.length > 0
|
||||
? members.filter((member) => {
|
||||
const displayName = (
|
||||
member.name ??
|
||||
member.email.split('@')[0] ??
|
||||
''
|
||||
).toLowerCase();
|
||||
|
||||
return (
|
||||
displayName.includes(searchString) ||
|
||||
member.role.toLowerCase().includes(searchString) ||
|
||||
(member.personal_code || '').includes(searchString)
|
||||
);
|
||||
})
|
||||
: members;
|
||||
return (
|
||||
displayName.includes(searchString) ||
|
||||
member.role.toLowerCase().includes(searchString) ||
|
||||
(member.personal_code || '').includes(searchString)
|
||||
);
|
||||
})
|
||||
: members;
|
||||
|
||||
return (
|
||||
<div className={'flex flex-col space-y-2'}>
|
||||
@@ -221,16 +221,6 @@ function useGetColumns(
|
||||
}
|
||||
>
|
||||
<RoleBadge role={role} />
|
||||
|
||||
<If condition={isPrimaryOwner}>
|
||||
<span
|
||||
className={
|
||||
'rounded-md bg-yellow-400 px-2.5 py-1 text-xs font-medium dark:text-black'
|
||||
}
|
||||
>
|
||||
{t('primaryOwnerLabel')}
|
||||
</span>
|
||||
</If>
|
||||
</span>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -6,22 +6,25 @@ import { Trans } from '@kit/ui/trans';
|
||||
type Role = string;
|
||||
|
||||
const roles = {
|
||||
owner: '',
|
||||
owner: 'bg-yellow-400 text-black',
|
||||
member:
|
||||
'bg-blue-50 hover:bg-blue-50 text-blue-500 dark:bg-blue-500/10 dark:hover:bg-blue-500/10',
|
||||
'bg-blue-50 text-blue-500 dark:bg-blue-500/10 dark:hover:bg-blue-500/10',
|
||||
};
|
||||
|
||||
const roleClassNameBuilder = cva('font-medium capitalize shadow-none', {
|
||||
variants: {
|
||||
role: roles,
|
||||
const roleClassNameBuilder = cva(
|
||||
'px-2.5 py-1 font-medium capitalize shadow-none',
|
||||
{
|
||||
variants: {
|
||||
role: roles,
|
||||
},
|
||||
},
|
||||
});
|
||||
);
|
||||
|
||||
export function RoleBadge({ role }: { role: Role }) {
|
||||
// @ts-expect-error: hard to type this since users can add custom roles
|
||||
const className = roleClassNameBuilder({ role });
|
||||
const isCustom = !(role in roles);
|
||||
|
||||
console.log('role', role);
|
||||
return (
|
||||
<Badge className={className} variant={isCustom ? 'outline' : 'default'}>
|
||||
<span data-test={'member-role-badge'}>
|
||||
|
||||
@@ -341,6 +341,7 @@ export type Database = {
|
||||
Row: {
|
||||
account_id: string
|
||||
amount: number
|
||||
benefit_distribution_schedule_id: string | null
|
||||
created_at: string
|
||||
created_by: string | null
|
||||
description: string | null
|
||||
@@ -348,14 +349,15 @@ export type Database = {
|
||||
expires_at: string | null
|
||||
id: string
|
||||
is_active: boolean
|
||||
is_analysis_order: boolean
|
||||
is_analysis_package_order: boolean
|
||||
is_analysis_order: boolean | null
|
||||
is_analysis_package_order: boolean | null
|
||||
reference_id: string | null
|
||||
source_company_id: string | null
|
||||
}
|
||||
Insert: {
|
||||
account_id: string
|
||||
amount: number
|
||||
benefit_distribution_schedule_id?: string | null
|
||||
created_at?: string
|
||||
created_by?: string | null
|
||||
description?: string | null
|
||||
@@ -363,14 +365,15 @@ export type Database = {
|
||||
expires_at?: string | null
|
||||
id?: string
|
||||
is_active?: boolean
|
||||
is_analysis_order?: boolean
|
||||
is_analysis_package_order?: boolean
|
||||
is_analysis_order?: boolean | null
|
||||
is_analysis_package_order?: boolean | null
|
||||
reference_id?: string | null
|
||||
source_company_id?: string | null
|
||||
}
|
||||
Update: {
|
||||
account_id?: string
|
||||
amount?: number
|
||||
benefit_distribution_schedule_id?: string | null
|
||||
created_at?: string
|
||||
created_by?: string | null
|
||||
description?: string | null
|
||||
@@ -378,8 +381,8 @@ export type Database = {
|
||||
expires_at?: string | null
|
||||
id?: string
|
||||
is_active?: boolean
|
||||
is_analysis_order?: boolean
|
||||
is_analysis_package_order?: boolean
|
||||
is_analysis_order?: boolean | null
|
||||
is_analysis_package_order?: boolean | null
|
||||
reference_id?: string | null
|
||||
source_company_id?: string | null
|
||||
}
|
||||
@@ -2214,6 +2217,8 @@ export type Database = {
|
||||
p_account_id: string
|
||||
p_amount: number
|
||||
p_description: string
|
||||
p_is_analysis_order?: boolean
|
||||
p_is_analysis_package_order?: boolean
|
||||
p_reference_id?: string
|
||||
}
|
||||
Returns: boolean
|
||||
@@ -2271,14 +2276,6 @@ export type Database = {
|
||||
updated_by: string | null
|
||||
}
|
||||
}
|
||||
distribute_health_benefits: {
|
||||
Args: {
|
||||
p_benefit_amount: number
|
||||
p_benefit_occurrence?: string
|
||||
p_company_id: string
|
||||
}
|
||||
Returns: undefined
|
||||
}
|
||||
get_account_balance: {
|
||||
Args: { p_account_id: string }
|
||||
Returns: number
|
||||
@@ -2317,14 +2314,12 @@ export type Database = {
|
||||
}[]
|
||||
}
|
||||
get_benefits_usages_for_company_members: {
|
||||
Args: {
|
||||
p_account_id: string
|
||||
}
|
||||
Args: { p_account_id: string }
|
||||
Returns: {
|
||||
personal_account_id: string
|
||||
benefit_amount: number
|
||||
benefit_unused_amount: number
|
||||
}
|
||||
personal_account_id: string
|
||||
}[]
|
||||
}
|
||||
get_config: {
|
||||
Args: Record<PropertyKey, never>
|
||||
@@ -2530,6 +2525,10 @@ export type Database = {
|
||||
p_benefit_occurrence: string
|
||||
p_company_id: string
|
||||
}
|
||||
Returns: string
|
||||
}
|
||||
upsert_health_benefits: {
|
||||
Args: { p_benefit_distribution_schedule_id: string }
|
||||
Returns: undefined
|
||||
}
|
||||
upsert_order: {
|
||||
@@ -2619,6 +2618,7 @@ export type Database = {
|
||||
| "settings.manage"
|
||||
| "members.manage"
|
||||
| "invites.manage"
|
||||
| "benefit.manage"
|
||||
application_role: "user" | "doctor" | "super_admin"
|
||||
billing_provider: "stripe" | "lemon-squeezy" | "paddle" | "montonio"
|
||||
connected_online_order_status:
|
||||
@@ -8540,6 +8540,7 @@ export const Constants = {
|
||||
"settings.manage",
|
||||
"members.manage",
|
||||
"invites.manage",
|
||||
"benefit.manage",
|
||||
],
|
||||
application_role: ["user", "doctor", "super_admin"],
|
||||
billing_provider: ["stripe", "lemon-squeezy", "paddle", "montonio"],
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
},
|
||||
"roles": {
|
||||
"owner": {
|
||||
"label": "Admin"
|
||||
"label": "Haldur"
|
||||
},
|
||||
"member": {
|
||||
"label": "Liige"
|
||||
|
||||
Reference in New Issue
Block a user