changes done on subscription module with saas
This commit is contained in:
@@ -6,11 +6,20 @@ export type Access = {
|
||||
};
|
||||
|
||||
export type Role = {
|
||||
id: string;
|
||||
role_name: string;
|
||||
id?: string | null;
|
||||
role_name?: string | null;
|
||||
accesses: string[];
|
||||
};
|
||||
|
||||
export type SubscriptionDetails = {
|
||||
plan_id?: string | null;
|
||||
plan_name?: string | null;
|
||||
start_date?: string | null;
|
||||
end_date?: string | null;
|
||||
status?: string | null;
|
||||
is_active?: boolean | null;
|
||||
};
|
||||
|
||||
export type AuthUser = {
|
||||
id: string;
|
||||
email: string;
|
||||
@@ -21,6 +30,7 @@ export type AuthUser = {
|
||||
tenant_id?: string | null;
|
||||
tenant_name?: string | null;
|
||||
tenant_logo_url?: string | null;
|
||||
subscription_details?: SubscriptionDetails | null;
|
||||
preferred_language?: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
|
||||
@@ -4,6 +4,7 @@ export type SubscriptionPlan = {
|
||||
description?: string | null;
|
||||
price?: number | null;
|
||||
duration_days?: number | null;
|
||||
max_users_allowed?: number | null;
|
||||
is_public: boolean;
|
||||
status: string;
|
||||
created_at: string;
|
||||
@@ -20,6 +21,7 @@ export type SubscriptionPlanCreateRequest = {
|
||||
description?: string;
|
||||
price?: number;
|
||||
duration_days?: number;
|
||||
max_users_allowed?: number;
|
||||
is_public?: boolean;
|
||||
status?: string;
|
||||
access_ids?: string[];
|
||||
@@ -31,6 +33,7 @@ export type SubscriptionPlanUpdateRequest = {
|
||||
description?: string;
|
||||
price?: number;
|
||||
duration_days?: number;
|
||||
max_users_allowed?: number;
|
||||
is_public?: boolean;
|
||||
status?: string;
|
||||
access_ids?: string[];
|
||||
|
||||
@@ -20,6 +20,7 @@ const AddSubscriptions = () => {
|
||||
description: "",
|
||||
price: undefined,
|
||||
duration_days: undefined,
|
||||
max_users_allowed: undefined,
|
||||
is_public: true,
|
||||
status: "active",
|
||||
access_ids: [],
|
||||
@@ -98,6 +99,7 @@ const AddSubscriptions = () => {
|
||||
description: formData.description?.trim() || undefined,
|
||||
price: formData.price ? Number(formData.price) : undefined,
|
||||
duration_days: formData.duration_days ? Number(formData.duration_days) : undefined,
|
||||
max_users_allowed: formData.max_users_allowed ?? undefined,
|
||||
is_public: formData.is_public,
|
||||
status: formData.status,
|
||||
access_ids: accessIds,
|
||||
@@ -174,6 +176,19 @@ const AddSubscriptions = () => {
|
||||
}))
|
||||
}
|
||||
/>
|
||||
<CustomInput
|
||||
label="Max Allowed Users"
|
||||
name="max_users_allowed"
|
||||
type="number"
|
||||
placeholder="Unlimited"
|
||||
value={formData.max_users_allowed ?? ""}
|
||||
onChange={(e) =>
|
||||
setFormData((prev) => ({
|
||||
...prev,
|
||||
max_users_allowed: e.target.value ? Number(e.target.value) : undefined,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<CustomInput
|
||||
|
||||
@@ -49,6 +49,7 @@ interface EditFormState {
|
||||
description: string;
|
||||
price: number | undefined;
|
||||
duration_days: number | undefined;
|
||||
max_users_allowed: number | undefined;
|
||||
is_public: boolean;
|
||||
status: string;
|
||||
}
|
||||
@@ -101,6 +102,7 @@ const AllSubscriptions = () => {
|
||||
description: "",
|
||||
price: undefined,
|
||||
duration_days: undefined,
|
||||
max_users_allowed: undefined,
|
||||
is_public: true,
|
||||
status: "active",
|
||||
});
|
||||
@@ -263,6 +265,7 @@ const AllSubscriptions = () => {
|
||||
description: plan.description ?? "",
|
||||
price: plan.price ?? undefined,
|
||||
duration_days: plan.duration_days ?? undefined,
|
||||
max_users_allowed: plan.max_users_allowed ?? undefined,
|
||||
is_public: plan.is_public,
|
||||
status: plan.status,
|
||||
});
|
||||
@@ -326,6 +329,7 @@ const AllSubscriptions = () => {
|
||||
description: editForm.description.trim() || undefined,
|
||||
price: editForm.price ? Number(editForm.price) : undefined,
|
||||
duration_days: editForm.duration_days ? Number(editForm.duration_days) : undefined,
|
||||
max_users_allowed: editForm.max_users_allowed ?? undefined,
|
||||
is_public: editForm.is_public,
|
||||
status: editForm.status,
|
||||
access_ids: accessIds,
|
||||
@@ -407,6 +411,16 @@ const AllSubscriptions = () => {
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "max_users_allowed",
|
||||
header: "User Limit",
|
||||
searchable: false,
|
||||
render: (row) => (
|
||||
<span className="text-sm font-medium text-[var(--text-primary)]">
|
||||
{row.max_users_allowed == null ? "Unlimited" : row.max_users_allowed}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "status",
|
||||
visibilityLabel: "Status",
|
||||
@@ -606,6 +620,14 @@ const AllSubscriptions = () => {
|
||||
{selectedPlan.duration_days ? `${selectedPlan.duration_days} days` : "-"}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs uppercase tracking-wide text-[var(--text-secondary)]">
|
||||
User Limit
|
||||
</p>
|
||||
<p className="text-sm font-medium text-[var(--text-primary)]">
|
||||
{selectedPlan.max_users_allowed == null ? "Unlimited" : selectedPlan.max_users_allowed}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs uppercase tracking-wide text-[var(--text-secondary)]">
|
||||
Status
|
||||
@@ -725,11 +747,11 @@ const AllSubscriptions = () => {
|
||||
}))
|
||||
}
|
||||
/>
|
||||
<CustomInput
|
||||
label="Duration (Days)"
|
||||
name="duration_days"
|
||||
type="number"
|
||||
placeholder="30"
|
||||
<CustomInput
|
||||
label="Duration (Days)"
|
||||
name="duration_days"
|
||||
type="number"
|
||||
placeholder="30"
|
||||
value={editForm.duration_days ?? ""}
|
||||
onChange={(e) =>
|
||||
setEditForm((prev) => ({
|
||||
@@ -738,6 +760,19 @@ const AllSubscriptions = () => {
|
||||
}))
|
||||
}
|
||||
/>
|
||||
<CustomInput
|
||||
label="Max Allowed Users"
|
||||
name="max_users_allowed"
|
||||
type="number"
|
||||
placeholder="Unlimited"
|
||||
value={editForm.max_users_allowed ?? ""}
|
||||
onChange={(e) =>
|
||||
setEditForm((prev) => ({
|
||||
...prev,
|
||||
max_users_allowed: e.target.value ? Number(e.target.value) : undefined,
|
||||
}))
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<CustomInput
|
||||
|
||||
Reference in New Issue
Block a user