diff --git a/app/Http/Controllers/Admin/TahesabController.php b/app/Http/Controllers/Admin/TahesabController.php index a21226d..e9856ef 100644 --- a/app/Http/Controllers/Admin/TahesabController.php +++ b/app/Http/Controllers/Admin/TahesabController.php @@ -502,7 +502,7 @@ class TahesabController extends Controller 'amount' => $mapper->isCountDoc($product) ? $count : $vazn, 'order_id' => $data['order']['id'] ?? null, 'date' => $data['pay_at'] ?? Carbon::now(), - 'type' => $mapper->metalLabel($product), + 'type' => $mapper->syncTypeLabel($product), 'created_at' => Carbon::now(), 'data' => json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT), ]); @@ -891,7 +891,7 @@ class TahesabController extends Controller 'desc' => $sharh, 'amount' => $mapper->isCountDoc($product) ? $count : $vazn, 'date' => Carbon::now(), - 'type' => $mapper->metalLabel($product), + 'type' => $mapper->syncTypeLabel($product), 'created_at' => Carbon::now(), 'withdraw_id' => $data['withdraw_id'] ?? null, 'data' => json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT), diff --git a/app/Services/AccountingProductDocMapper.php b/app/Services/AccountingProductDocMapper.php index 8ce5e51..41d114d 100644 --- a/app/Services/AccountingProductDocMapper.php +++ b/app/Services/AccountingProductDocMapper.php @@ -195,11 +195,12 @@ class AccountingProductDocMapper } /** - * برچسب ستون type جدول sync زرین: تعدادی → سکه/شمش/کارساخته؛ وزنی → طلا/نقره. + * برچسب ستون type جدول sync (ته‌حساب / زرین): + * تعدادی → سکه / شمش / کارساخته؛ وزنی → طلا / نقره. * * @param Product|array|null $product */ - public function zarinSyncTypeLabel($product): string + public function syncTypeLabel($product): string { if ($this->isCountDoc($product)) { return $this->kindLabel($this->resolveKind($product)); @@ -208,6 +209,12 @@ class AccountingProductDocMapper return $this->metalLabel($product); } + /** @deprecated از syncTypeLabel استفاده کنید */ + public function zarinSyncTypeLabel($product): string + { + return $this->syncTypeLabel($product); + } + /** * Resolve Product model from storeTrade/walletGold payload. */ diff --git a/database/migrations/2026_07_29_000001_add_product_card_display_switches.php b/database/migrations/2026_07_29_000001_add_product_card_display_switches.php new file mode 100644 index 0000000..f0ce493 --- /dev/null +++ b/database/migrations/2026_07_29_000001_add_product_card_display_switches.php @@ -0,0 +1,72 @@ + 'show_product_trade_status', + 'value' => 'false', + 'title_fa' => 'نمایش خرید/فروش باز روی کارت محصول', + 'description' => 'روشن: روی کارت محصول برچسب خرید باز/بسته و فروش باز/بسته نمایش داده می‌شود. خاموش: مخفی است.', + ], + [ + 'key' => 'show_product_card_meta', + 'value' => 'true', + 'title_fa' => 'نمایش دسته و تحویل و مقدار روی کارت محصول', + 'description' => 'روشن: روی کارت محصول دسته‌بندی، وضعیت تحویل فیزیکی و مقدار/وزن نمایش داده می‌شود. خاموش: مخفی است.', + ], + ]; + + foreach ($rows as $row) { + if (DB::table('settings')->where('key', $row['key'])->exists()) { + DB::table('settings')->where('key', $row['key'])->update([ + 'title_fa' => $row['title_fa'], + 'description' => $row['description'], + 'type' => 'switch', + 'can_edit' => 1, + 'is_active' => 1, + 'updated_at' => now(), + ]); + continue; + } + + DB::table('settings')->insert([ + 'key' => $row['key'], + 'value' => $row['value'], + 'title_fa' => $row['title_fa'], + 'type' => 'switch', + 'can_edit' => 1, + 'is_active' => 1, + 'description' => $row['description'], + 'created_at' => now(), + 'updated_at' => now(), + ]); + } + } + + public function down(): void + { + if (! Schema::hasTable('settings')) { + return; + } + + DB::table('settings')->whereIn('key', [ + 'show_product_trade_status', + 'show_product_card_meta', + ])->delete(); + } +}; diff --git a/database/sql/deploy_settings_const.sql b/database/sql/deploy_settings_const.sql index 960fbe7..f0da813 100644 --- a/database/sql/deploy_settings_const.sql +++ b/database/sql/deploy_settings_const.sql @@ -227,6 +227,18 @@ SELECT 'show_product_details', 'true', 'نمایش جزئیات اطلاعات 'switch' WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'show_product_details' LIMIT 1); +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`) +SELECT 'show_product_trade_status', 'false', 'نمایش خرید/فروش باز روی کارت محصول', 1, 1, + 'روشن: روی کارت محصول برچسب خرید باز/بسته و فروش باز/بسته نمایش داده می‌شود. خاموش: مخفی است.', + 'switch' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'show_product_trade_status' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`) +SELECT 'show_product_card_meta', 'true', 'نمایش دسته و تحویل و مقدار روی کارت محصول', 1, 1, + 'روشن: روی کارت محصول دسته‌بندی، وضعیت تحویل فیزیکی و مقدار/وزن نمایش داده می‌شود. خاموش: مخفی است.', + 'switch' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'show_product_card_meta' LIMIT 1); + INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) SELECT 'main_product_price', 'false', 'قیمت از محصول (legacy)', 1, 1, 'از price_provider استفاده کنید' WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'main_product_price' LIMIT 1); @@ -959,6 +971,7 @@ UPDATE `settings` SET `type` = 'switch' WHERE `key` IN ( 'chart_use_local_data', 'jibit_enabled', 'jibit_verification', 'register_jibit_verify', 'open_register', 'auto_active_customer', 'close_price', 'show_last_price', 'show_gold_ounce_price', 'show_home_price_when_closed', 'show_product_details', + 'show_product_trade_status', 'show_product_card_meta', 'fee_deduct_from_gold', 'require_zero_main_gold_before_other_buy', 'profit_gold_api_enabled', 'payping_round_toman', 'payping_strict_failed_withdraw', @@ -1304,6 +1317,8 @@ UPDATE `settings` SET `description` = 'روشن: اگر API قیمت در دست UPDATE `settings` SET `description` = 'روشن: اگر آدرس API تابلو (zaarbox_api_url) تنظیم شده باشد، قیمت انس طلا در اپ مشتری نمایش داده می‌شود. خاموش: نمایش داده نمی‌شود.' WHERE `key` = 'show_gold_ounce_price'; UPDATE `settings` SET `description` = 'روشن: وقتی فروشگاه خارج از ساعت کاری است، قیمت صفحه اصلی اپ همچنان نمایش داده می‌شود و پیام «فروشگاه بسته است» نشان داده نمی‌شود. خرید/فروش همچنان بسته می‌ماند. خاموش: مثل قبل، خارج از ساعت پیام بسته بودن و قیمت صفر نشان داده می‌شود.' WHERE `key` = 'show_home_price_when_closed'; UPDATE `settings` SET `description` = 'روشن: بعد از انتخاب محصول در صفحه خرید/فروش، متن توضیح محصول نمایش داده می‌شود. خاموش: توضیح نشان داده نمی‌شود.' WHERE `key` = 'show_product_details'; +UPDATE `settings` SET `description` = 'روشن: روی کارت محصول برچسب خرید باز/بسته و فروش باز/بسته نمایش داده می‌شود. خاموش: مخفی است.' WHERE `key` = 'show_product_trade_status'; +UPDATE `settings` SET `description` = 'روشن: روی کارت محصول دسته‌بندی، وضعیت تحویل فیزیکی و مقدار/وزن نمایش داده می‌شود. خاموش: مخفی است.' WHERE `key` = 'show_product_card_meta'; UPDATE `settings` SET `description` = 'روشن: خارج از بازه «ساعت شروع» تا «ساعت پایان» معامله و نمایش قیمت بسته می‌شود. خاموش: محدودیت ساعتی سراسری اعمال نمی‌شود.' WHERE `key` = 'close_price'; UPDATE `settings` SET `description` = 'ساعت شروع فعالیت روزانه. فقط وقتی «بستن خودکار خارج از ساعت کاری» روشن باشد اعمال می‌شود (مثلاً ۰۹:۰۰).' WHERE `key` = 'startDay'; UPDATE `settings` SET `description` = 'ساعت پایان فعالیت روزانه. فقط وقتی «بستن خودکار خارج از ساعت کاری» روشن باشد اعمال می‌شود (مثلاً ۲۲:۰۰).' WHERE `key` = 'endDay'; @@ -1607,6 +1622,8 @@ UPDATE `settings` SET `title_fa` = 'نمایش آخرین قیمت ذخیره‌ UPDATE `settings` SET `title_fa` = 'نمایش قیمت انس طلا' WHERE `key` = 'show_gold_ounce_price'; UPDATE `settings` SET `title_fa` = 'نمایش قیمت صفحه اصلی خارج از ساعت کاری' WHERE `key` = 'show_home_price_when_closed'; UPDATE `settings` SET `title_fa` = 'نمایش جزئیات اطلاعات محصول' WHERE `key` = 'show_product_details'; +UPDATE `settings` SET `title_fa` = 'نمایش خرید/فروش باز روی کارت محصول' WHERE `key` = 'show_product_trade_status'; +UPDATE `settings` SET `title_fa` = 'نمایش دسته و تحویل و مقدار روی کارت محصول' WHERE `key` = 'show_product_card_meta'; UPDATE `settings` SET `title_fa` = 'مسیر SSE قیمت' WHERE `key` = 'sse_path'; UPDATE `settings` SET `title_fa` = 'ساعت شروع' WHERE `key` = 'startDay'; UPDATE `settings` SET `title_fa` = 'وضعیت فروشگاه' WHERE `key` = 'store_status'; @@ -1707,7 +1724,8 @@ UPDATE `settings` SET `can_edit` = 1 WHERE `key` IN ( 'open_register', 'referral_id', 'referral_limit', 'referral_gift_on_first_order', 'register_jibit_verify', 'register_referral_bonus_message', 'register_referral_sms_to_referrer', - 'sell_fee', 'show_last_price', 'show_home_price_when_closed', 'show_gold_ounce_price', 'show_product_details', 'startDay', + 'sell_fee', 'show_last_price', 'show_home_price_when_closed', 'show_gold_ounce_price', 'show_product_details', + 'show_product_trade_status', 'show_product_card_meta', 'startDay', 'support_messenger', 'support_messenger_id', 'support_messenger_text', 'deposit_support_message_text', 'deposit_account_holder', 'deposit_card_number', 'deposit_sheba', 'text_about', 'text_rule', diff --git a/database/sql/deploy_settings_const_preserve_value_sync_can_edit.sql b/database/sql/deploy_settings_const_preserve_value_sync_can_edit.sql index c159bae..4b14b57 100644 --- a/database/sql/deploy_settings_const_preserve_value_sync_can_edit.sql +++ b/database/sql/deploy_settings_const_preserve_value_sync_can_edit.sql @@ -177,6 +177,18 @@ SELECT 'show_product_details', 'true', 'نمایش جزئیات اطلاعات 'switch' WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'show_product_details' LIMIT 1); +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`) +SELECT 'show_product_trade_status', 'false', 'نمایش خرید/فروش باز روی کارت محصول', 1, 1, + 'روشن: روی کارت محصول برچسب خرید باز/بسته و فروش باز/بسته نمایش داده می‌شود. خاموش: مخفی است.', + 'switch' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'show_product_trade_status' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`) +SELECT 'show_product_card_meta', 'true', 'نمایش دسته و تحویل و مقدار روی کارت محصول', 1, 1, + 'روشن: روی کارت محصول دسته‌بندی، وضعیت تحویل فیزیکی و مقدار/وزن نمایش داده می‌شود. خاموش: مخفی است.', + 'switch' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'show_product_card_meta' LIMIT 1); + INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) SELECT 'main_product_price', 'false', 'قیمت از محصول (legacy)', 1, 1, 'از price_provider استفاده کنید' WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'main_product_price' LIMIT 1); @@ -826,6 +838,7 @@ UPDATE `settings` SET `type` = 'switch' WHERE `key` IN ( 'chart_use_local_data', 'jibit_enabled', 'jibit_verification', 'register_jibit_verify', 'open_register', 'auto_active_customer', 'close_price', 'show_last_price', 'show_home_price_when_closed', 'show_product_details', + 'show_product_trade_status', 'show_product_card_meta', 'fee_deduct_from_gold', 'send_to_tahesab', 'profit_gold_api_enabled', 'payping_round_toman', 'payping_strict_failed_withdraw', 'has_page_earn_money', 'has_page_price_trigger', 'has_page_notification', 'charge_notif', 'group_sms', 'sms_panel', 'customer_direct_sms', @@ -1187,6 +1200,12 @@ UPDATE `settings` SET `description` = 'کلید یا UUID ردیف قیمت در UPDATE `settings` SET `description` = 'روشن: اگر API قیمت در دسترس نباشد، آخرین قیمت ذخیره‌شده در دیتابیس به کاربر نشان داده می‌شود. خاموش: در قطعی API ممکن است قیمت صفر نمایش داده شود.' WHERE `key` = 'show_last_price'; UPDATE `settings` SET `description` = 'روشن: وقتی فروشگاه خارج از ساعت کاری است، قیمت صفحه اصلی اپ همچنان نمایش داده می‌شود و پیام «فروشگاه بسته است» نشان داده نمی‌شود. خرید/فروش همچنان بسته می‌ماند. خاموش: مثل قبل، خارج از ساعت پیام بسته بودن و قیمت صفر نشان داده می‌شود.' WHERE `key` = 'show_home_price_when_closed'; UPDATE `settings` SET `description` = 'روشن: بعد از انتخاب محصول در صفحه خرید/فروش، متن توضیح محصول نمایش داده می‌شود. خاموش: توضیح نشان داده نمی‌شود.' WHERE `key` = 'show_product_details'; +UPDATE `settings` SET `description` = 'روشن: روی کارت محصول برچسب خرید باز/بسته و فروش باز/بسته نمایش داده می‌شود. خاموش: مخفی است.' WHERE `key` = 'show_product_trade_status'; +UPDATE `settings` SET `title_fa` = 'نمایش خرید/فروش باز روی کارت محصول' WHERE `key` = 'show_product_trade_status'; +UPDATE `settings` SET `type` = 'switch' WHERE `key` = 'show_product_trade_status'; +UPDATE `settings` SET `description` = 'روشن: روی کارت محصول دسته‌بندی، وضعیت تحویل فیزیکی و مقدار/وزن نمایش داده می‌شود. خاموش: مخفی است.' WHERE `key` = 'show_product_card_meta'; +UPDATE `settings` SET `title_fa` = 'نمایش دسته و تحویل و مقدار روی کارت محصول' WHERE `key` = 'show_product_card_meta'; +UPDATE `settings` SET `type` = 'switch' WHERE `key` = 'show_product_card_meta'; UPDATE `settings` SET `description` = 'روشن: خارج از بازه «ساعت شروع» تا «ساعت پایان» معامله و نمایش قیمت بسته می‌شود. خاموش: محدودیت ساعتی سراسری اعمال نمی‌شود.' WHERE `key` = 'close_price'; UPDATE `settings` SET `description` = 'ساعت شروع فعالیت روزانه. فقط وقتی «بستن خودکار خارج از ساعت کاری» روشن باشد اعمال می‌شود (مثلاً ۰۹:۰۰).' WHERE `key` = 'startDay'; UPDATE `settings` SET `description` = 'ساعت پایان فعالیت روزانه. فقط وقتی «بستن خودکار خارج از ساعت کاری» روشن باشد اعمال می‌شود (مثلاً ۲۲:۰۰).' WHERE `key` = 'endDay'; @@ -1408,7 +1427,8 @@ UPDATE `settings` SET `can_edit` = 1 WHERE `key` IN ( 'open_register', 'referral_id', 'referral_limit', 'referral_gift_on_first_order', 'register_jibit_verify', 'register_referral_bonus_message', 'register_referral_sms_to_referrer', - 'sell_fee', 'show_last_price', 'show_home_price_when_closed', 'show_product_details', 'startDay', + 'sell_fee', 'show_last_price', 'show_home_price_when_closed', 'show_product_details', + 'show_product_trade_status', 'show_product_card_meta', 'startDay', 'support_messenger', 'support_messenger_id', 'support_messenger_text', 'deposit_support_message_text', 'deposit_account_holder', 'deposit_card_number', 'deposit_sheba', 'text_about', 'text_rule',