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