Add customer multi-level referral profit editor and related settings UI.

Expose enable_customer_level_profit in config and let admins edit per-customer level percents from the customers table/mobile sheets.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-10 16:48:53 +03:30
co-authored by Cursor
parent 4dde172ed7
commit de97d7caa6
12 changed files with 252 additions and 21 deletions
+1 -1
View File
@@ -1707,7 +1707,7 @@ export const bootstrapAdminChat = async (
bootstrapPromise = (async () => {
try {
void postAdminChatEnsureWebhook().catch((error) => {
console.error('admin chat ensure webhook failed:', error)
console.warn('admin chat ensure webhook failed:', error)
})
await fetchAdminRooms()
+15
View File
@@ -49,6 +49,9 @@ export const conditionalOrderEnabledSetting = ref(false)
/** reactive — قلک per-product در اپ مشتری */
export const productFundsEnabledSetting = ref(false)
/** reactive — سود چندسطحی معرف در لیست مشتریان */
export const customerLevelProfitEnabledSetting = ref(false)
/** reactive — منو و UI هشدار قیمت */
export const priceTriggerEnabledSetting = ref(false)
@@ -154,6 +157,10 @@ export function setProductFundsEnabledFromSettings(value: boolean): void {
productFundsEnabledSetting.value = value
}
export function setCustomerLevelProfitEnabledFromSettings(value: boolean): void {
customerLevelProfitEnabledSetting.value = value
}
export function setPriceTriggerEnabledFromSettings(value: boolean): void {
priceTriggerEnabledSetting.value = value
}
@@ -257,6 +264,13 @@ export function applyProductFundsEnabledFromRows(
if (row) setProductFundsEnabledFromSettings(isSwitchOn(row.value))
}
export function applyCustomerLevelProfitEnabledFromRows(
rows: Array<{ key?: string; value?: string | null }>
) {
const row = rows.find((item) => item.key === 'enable_customer_level_profit')
if (row) setCustomerLevelProfitEnabledFromSettings(isSwitchOn(row.value))
}
export function applyPriceTriggerEnabledFromRows(
rows: Array<{ key?: string; value?: string | null }>
) {
@@ -305,6 +319,7 @@ async function bootstrapSettingsFromApi(): Promise<void> {
applyCustomerDirectSmsFromRows(list)
applyConditionalOrderEnabledFromRows(list)
applyProductFundsEnabledFromRows(list)
applyCustomerLevelProfitEnabledFromRows(list)
applyPriceTriggerEnabledFromRows(list)
applyAppNotificationEnabledFromRows(list)
applySupportChatMenuEnabledFromRows(list)