From 10bd7829047923fd9960c478ae5ea87302ef07b3 Mon Sep 17 00:00:00 2001 From: Babak Alizadeh Date: Mon, 2 Jun 2025 16:37:51 +0000 Subject: [PATCH] bug fix and add plugin transactions in admin panel --- .../src/Controller/PluginController.php | 52 ++ .../Controller/Plugins/Hrm/DocsController.php | 31 ++ .../Plugins/PlugGhestaController.php | 2 +- .../pdf/plugins/ghesta/report.html.twig | 6 + webUI/src/i18n/fa_lang.ts | 8 + webUI/src/router/index.ts | 8 + webUI/src/views/acc/plugins/ghesta/list.vue | 12 +- webUI/src/views/acc/plugins/ghesta/mod.vue | 507 ++++++++++-------- webUI/src/views/acc/plugins/hrm/docs/list.vue | 16 +- webUI/src/views/acc/plugins/hrm/docs/mod.vue | 16 + webUI/src/views/acc/smspanel/smspanel.vue | 43 +- .../manager/settings/pluginTransactions.vue | 142 +++++ webUI/src/views/user/profile/profile-main.vue | 31 +- 13 files changed, 582 insertions(+), 292 deletions(-) create mode 100644 hesabixCore/src/Controller/Plugins/Hrm/DocsController.php create mode 100644 webUI/src/views/user/manager/settings/pluginTransactions.vue diff --git a/hesabixCore/src/Controller/PluginController.php b/hesabixCore/src/Controller/PluginController.php index 20bed6d..89c07c4 100644 --- a/hesabixCore/src/Controller/PluginController.php +++ b/hesabixCore/src/Controller/PluginController.php @@ -377,4 +377,56 @@ class PluginController extends AbstractController return $this->json($extractor->operationSuccess()); } + + /** + * دریافت لیست تراکنش‌های افزونه‌ها (برای ادمین) + * + * @OA\Post( + * path="/api/admin/plugins/transactions", + * summary="دریافت لیست تراکنش‌های افزونه‌ها (ادمین)", + * tags={"Admin Plugins"}, + * @OA\Response( + * response=200, + * description="لیست تراکنش‌ها", + * @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Plugin")) + * ) + * ) + */ + #[Route('/api/admin/plugins/transactions', name: 'api_admin_plugins_transactions', methods: ["POST"])] + public function api_admin_plugins_transactions(Access $access, Jdate $jdate, EntityManagerInterface $entityManager): JsonResponse + { + $this->checkAccess($access, 'ROLE_ADMIN'); + + $plugins = $entityManager->getRepository(Plugin::class)->findBy([], ['dateSubmit' => 'DESC']); + $result = []; + + foreach ($plugins as $plugin) { + $pluginData = [ + 'id' => $plugin->getId(), + 'des' => $plugin->getDes(), + 'price' => $plugin->getPrice(), + 'dateSubmit' => $jdate->jdate('Y/n/d', $plugin->getDateSubmit()), + 'dateExpire' => $jdate->jdate('Y/n/d', $plugin->getDateExpire()), + 'status' => $plugin->getStatus(), + 'cardPan' => $plugin->getCardPan(), + 'refID' => $plugin->getRefID() + ]; + + // اضافه کردن نام کسب و کار + $business = $entityManager->getRepository('App\Entity\Business')->find($plugin->getBid()); + if ($business) { + $pluginData['businessName'] = $business->getName(); + } + + // اضافه کردن نام خریدار + $submitter = $plugin->getSubmitter(); + if ($submitter) { + $pluginData['submitterName'] = $submitter->getFullName(); + } + + $result[] = $pluginData; + } + + return $this->json($result); + } } \ No newline at end of file diff --git a/hesabixCore/src/Controller/Plugins/Hrm/DocsController.php b/hesabixCore/src/Controller/Plugins/Hrm/DocsController.php new file mode 100644 index 0000000..9e16992 --- /dev/null +++ b/hesabixCore/src/Controller/Plugins/Hrm/DocsController.php @@ -0,0 +1,31 @@ +entityManager = $entityManager; + } + + +} \ No newline at end of file diff --git a/hesabixCore/src/Controller/Plugins/PlugGhestaController.php b/hesabixCore/src/Controller/Plugins/PlugGhestaController.php index d873db6..1de6e4e 100644 --- a/hesabixCore/src/Controller/Plugins/PlugGhestaController.php +++ b/hesabixCore/src/Controller/Plugins/PlugGhestaController.php @@ -391,7 +391,7 @@ class PlugGhestaController extends AbstractController 'id' => $item->getId(), 'code' => $item->getMainDoc() ? $item->getMainDoc()->getCode() : null, 'firstGhestaDate' => $firstGhestaDate, - 'amount' => $item->getProfitAmount(), // مبلغ کل شامل سود + 'amount' => $item->getMainDoc() ? $item->getMainDoc()->getAmount() : 0, // مبلغ کل فاکتور 'profitAmount' => $item->getProfitAmount(), 'profitPercent' => $item->getProfitPercent(), 'profitType' => $item->getProfitType(), diff --git a/hesabixCore/templates/pdf/plugins/ghesta/report.html.twig b/hesabixCore/templates/pdf/plugins/ghesta/report.html.twig index 65ccc9c..6a00c24 100644 --- a/hesabixCore/templates/pdf/plugins/ghesta/report.html.twig +++ b/hesabixCore/templates/pdf/plugins/ghesta/report.html.twig @@ -116,6 +116,12 @@ +
+

+ مبلغ کل فاکتور: + {{ doc.mainDoc.amount|number_format }} ریال +

+

تعداد اقساط: diff --git a/webUI/src/i18n/fa_lang.ts b/webUI/src/i18n/fa_lang.ts index 47d7037..1f3dd43 100644 --- a/webUI/src/i18n/fa_lang.ts +++ b/webUI/src/i18n/fa_lang.ts @@ -546,6 +546,14 @@ const fa_lang = { return_sell: "برگشت از فروش", all_types: "همه موارد" }, + field: { + id: "شناسه", + date: "تاریخ", + employee: "کارمند", + amount: "مبلغ", + status: "وضعیت", + actions: "عملیات" + }, }, app: { loading: "در حال بارگذاری...", diff --git a/webUI/src/router/index.ts b/webUI/src/router/index.ts index b48744b..9c3d0b3 100644 --- a/webUI/src/router/index.ts +++ b/webUI/src/router/index.ts @@ -146,6 +146,14 @@ const router = createRouter({ 'login': true } }, + { + path: 'manager/plugins/transactions', + component: () => import('../views/user/manager/settings/pluginTransactions.vue'), + meta: { + 'title': 'تراکنش‌های افزونه‌ها', + 'login': true + } + }, { path: 'manager/update-core', component: () => import('../views/user/manager/settings/update-core.vue'), diff --git a/webUI/src/views/acc/plugins/ghesta/list.vue b/webUI/src/views/acc/plugins/ghesta/list.vue index d052737..fb888f6 100644 --- a/webUI/src/views/acc/plugins/ghesta/list.vue +++ b/webUI/src/views/acc/plugins/ghesta/list.vue @@ -109,11 +109,6 @@ - - - diff --git a/webUI/src/views/acc/smspanel/smspanel.vue b/webUI/src/views/acc/smspanel/smspanel.vue index 3f103df..06ff9b4 100644 --- a/webUI/src/views/acc/smspanel/smspanel.vue +++ b/webUI/src/views/acc/smspanel/smspanel.vue @@ -80,31 +80,6 @@ - - - -

مبلغ دلخواه
- -
- با احتساب مالیات: {{ formatPrice(Number(customAmount) * 1.1) }} تومان -
- - - @@ -187,13 +162,11 @@ export default defineComponent({ color: 'error' }, smsCharge: 100000, - customAmount: '', - isCustomAmount: false, chargeAmounts: [ - { label: '۱۰ هزار تومان', value: 10000 }, { label: '۵۰ هزار تومان', value: 50000 }, { label: '۱۰۰ هزار تومان', value: 100000 }, - { label: '۲۰۰ هزار تومان', value: 200000 } + { label: '۲۰۰ هزار تومان', value: 200000 }, + { label: '۵۰۰ هزار تومان', value: 500000 } ], searchValue: '', loading: true, @@ -231,7 +204,8 @@ export default defineComponent({ }, pay() { this.loading = true; - axios.post('/api/sms/charge', { price: this.smsCharge }) + const amountInRial = this.smsCharge * 10; // تبدیل تومان به ریال + axios.post('/api/sms/charge', { price: amountInRial }) .then((response) => { if (response.data.Success === true) { window.location.href = response.data.targetURL; @@ -261,15 +235,6 @@ export default defineComponent({ formatPrice(price: number): string { return new Intl.NumberFormat('fa-IR').format(price); }, - selectCustomAmount() { - this.isCustomAmount = true; - this.smsCharge = Number(this.customAmount); - }, - handleCustomAmountInput() { - if (this.isCustomAmount) { - this.smsCharge = Number(this.customAmount); - } - }, }, beforeMount() { this.loadData(); diff --git a/webUI/src/views/user/manager/settings/pluginTransactions.vue b/webUI/src/views/user/manager/settings/pluginTransactions.vue new file mode 100644 index 0000000..3ea7393 --- /dev/null +++ b/webUI/src/views/user/manager/settings/pluginTransactions.vue @@ -0,0 +1,142 @@ + + + + + \ No newline at end of file diff --git a/webUI/src/views/user/profile/profile-main.vue b/webUI/src/views/user/profile/profile-main.vue index c74a9b2..276ccdb 100644 --- a/webUI/src/views/user/profile/profile-main.vue +++ b/webUI/src/views/user/profile/profile-main.vue @@ -35,6 +35,13 @@ + + + + + {{ siteName }} : {{ hesabix.version }} @@ -101,13 +108,11 @@ export default defineComponent({ { text: 'کسب‌و‌کارها', url: '/profile/manager/business/list', icon: 'mdi-home-city', visible: true }, { text: 'کاربران', url: '/profile/manager/users/list', icon: 'mdi-account-multiple', visible: true }, { text: 'کاربران آنلاین', url: '/profile/manager/users/onlinelist', icon: 'mdi-account-badge', visible: true }, - { text: 'افزونه‌ها', url: '/profile/manager/plugins/list', icon: 'mdi-toy-brick', visible: true }, { text: 'به روز رسانی هسته', url: '/profile/manager/update-core', icon: 'mdi-undo', visible: true }, { text: 'تغییرات', url: '/profile/manager/changes/list', icon: 'mdi-cellphone-arrow-down', visible: true }, { text: 'تاریخچه سیستم', url: '/profile/manager/logs/list', icon: 'mdi-history', visible: true }, { text: 'کیف پول', url: '/profile/manager/wallet/list', icon: 'mdi-wallet', visible: true }, { text: 'اطلاعیه‌ها', url: '/profile/manager/statments/list', icon: 'mdi-bell', visible: true }, - ], adminSettings: [ { text: 'پیامک', url: '/profile/manager/system/sms/settings', icon: 'mdi-message-alert', visible: true }, @@ -181,4 +186,24 @@ export default defineComponent({ }); - \ No newline at end of file + \ No newline at end of file