diff --git a/src/api/automations.ts b/src/api/automations.ts index 771f0d2..773c719 100644 --- a/src/api/automations.ts +++ b/src/api/automations.ts @@ -22,3 +22,15 @@ export const toggleAutomationActive = async (id: number) => export const deleteAutomation = async (id: number) => await useAxios.delete(`/admin/automations/${id}`) + +export const runAutomationNow = async (id: number, force = true) => + await useAxios.post<{ + message?: string + audience?: number + sent?: number + failed?: number + skipped?: number + }>(`/admin/automations/${id}/run-now`, { force }) + +export const getAutomationSendsTable = async (id: number, params: TableInput) => + await useAxios.post>>(`/admin/automations/${id}/sends/table`, params) diff --git a/src/api/configuration.ts b/src/api/configuration.ts index 5e07b0a..7627aa5 100644 --- a/src/api/configuration.ts +++ b/src/api/configuration.ts @@ -24,6 +24,6 @@ export const refreshSuperAdminSettings = async () => ok?: boolean message?: string count?: number - enable_automation?: string | null + items?: Record source?: string }>(`/admin/settings/refresh-superadmin`) diff --git a/src/pages/menuPages/automations/components/table.vue b/src/pages/menuPages/automations/components/table.vue index 681b811..719f2d7 100644 --- a/src/pages/menuPages/automations/components/table.vue +++ b/src/pages/menuPages/automations/components/table.vue @@ -50,6 +50,24 @@ diff --git a/src/pages/menuPages/configuration/index.vue b/src/pages/menuPages/configuration/index.vue index 1ccdee1..62eaf89 100644 --- a/src/pages/menuPages/configuration/index.vue +++ b/src/pages/menuPages/configuration/index.vue @@ -26,27 +26,26 @@ - - - افزودن تنظیم - - - همگام‌سازی از سوپرادمین - - - بروزرسانی - +
+ + افزودن تنظیم + + + همگام‌سازی از سوپرادمین + + + بروزرسانی + +
@@ -210,7 +209,7 @@ import SettingValueField from './SettingValueField.vue' import SettingCard from './SettingCard.vue' import { refreshAppModeMenu } from '@/router' import { useUserStore } from '@/store/userStore' -import { applyBannerEnabledFromRows, applyTrackingSystemsEnabledFromRows, applyConditionalOrderEnabledFromRows, applyAutomationEnabledFromRows, applyProductFundsEnabledFromRows, applyPriceTriggerEnabledFromRows, applyAppNotificationEnabledFromRows, applyPriceProviderFromRows, applyPriceChannelAccessFromRows, applySupportChatMenuEnabledFromRows, applyGroupSmsFromRows, applyCustomerSpecialPricingFromRows, setBannerEnabledFromSettings, setConditionalOrderEnabledFromSettings, setAutomationEnabledFromSettings, setProductFundsEnabledFromSettings, setPriceTriggerEnabledFromSettings, setAppNotificationEnabledFromSettings, setPriceProviderFromSettings, setPriceChannelAccessFromSettings, setStoreModeFromSettings, setTrackingSystemsEnabledFromSettings, setGroupSmsEnabledFromSettings, setCustomerSpecialPricingEnabledFromSettings } from '@/utils/config' +import { applyBannerEnabledFromRows, applyTrackingSystemsEnabledFromRows, applyConditionalOrderEnabledFromRows, applyAutomationEnabledFromRows, applyProductFundsEnabledFromRows, applyPriceTriggerEnabledFromRows, applyAppNotificationEnabledFromRows, applyPriceProviderFromRows, applyPriceChannelAccessFromRows, applySupportChatMenuEnabledFromRows, applyGroupSmsFromRows, applyCustomerSpecialPricingFromRows, applyCustomerDirectSmsFromRows, applyCustomerLevelProfitEnabledFromRows, setBannerEnabledFromSettings, setConditionalOrderEnabledFromSettings, setAutomationEnabledFromSettings, setProductFundsEnabledFromSettings, setPriceTriggerEnabledFromSettings, setAppNotificationEnabledFromSettings, setPriceProviderFromSettings, setPriceChannelAccessFromSettings, setStoreModeFromSettings, setTrackingSystemsEnabledFromSettings, setGroupSmsEnabledFromSettings, setCustomerSpecialPricingEnabledFromSettings } from '@/utils/config' import { EDITABLE_SETTING_GROUPS, SYSTEM_SETTING_GROUPS, @@ -493,14 +492,9 @@ async function refreshFromSuperAdmin() { refreshingSuperAdmin.value = true try { const res = await refreshSuperAdminSettings() - const auto = res?.enable_automation - message.success( - auto != null && auto !== '' - ? `همگام شد (${res?.count ?? 0} کلید) — اتوماسیون: ${isSwitchOn(auto) ? 'روشن' : 'خاموش'}` - : (res?.message || `همگام شد (${res?.count ?? 0} کلید)`) - ) await initConfig() refreshMenuAfterStoreChange() + message.success(res?.message || `همگام شد (${res?.count ?? 0} کلید دسترسی از سوپرادمین)`) } catch (e: any) { console.error(e) const msg = e?.response?.data?.message || e?.message || 'همگام‌سازی از سوپرادمین ناموفق بود' @@ -523,6 +517,8 @@ async function initConfig() { applyConditionalOrderEnabledFromRows(baseData.value) applyAutomationEnabledFromRows(baseData.value) applyProductFundsEnabledFromRows(baseData.value) + applyCustomerLevelProfitEnabledFromRows(baseData.value) + applyCustomerDirectSmsFromRows(baseData.value) applyPriceTriggerEnabledFromRows(baseData.value) applyAppNotificationEnabledFromRows(baseData.value) applyPriceProviderFromRows(baseData.value) @@ -815,7 +811,11 @@ async function ok() { align-items: flex-end; } - &__action { + &__actions { + display: flex; + flex-wrap: wrap; + gap: 8px; + align-items: center; margin-inline-start: auto; } }