From 8d11485530008caa249c4e1c2bdbc2f27dc0631b Mon Sep 17 00:00:00 2001 From: Gloomy Date: Tue, 19 Aug 2025 00:34:56 +0000 Subject: [PATCH] fix some bugs --- .../src/Controller/ApprovalController.php | 12 + .../src/Controller/BusinessController.php | 10 + hesabixCore/src/Controller/SellController.php | 18 +- .../src/Controller/StoreroomController.php | 13 +- hesabixCore/src/Service/Explore.php | 3 + webUI/src/i18n/fa_lang.ts | 1 + webUI/src/router/index.ts | 12 + .../acc/plugins/import-workflow/intro.vue | 195 +++++++++++++ .../acc/plugins/warranty/WarrantyPlugin.vue | 261 +++++------------- .../src/views/acc/plugins/warranty/intro.vue | 224 +++++++++++++++ webUI/src/views/acc/sell/list.vue | 186 +++++++------ webUI/src/views/acc/settings/bussiness.vue | 74 ++++- webUI/src/views/acc/storeroom/io/view.vue | 8 + 13 files changed, 733 insertions(+), 284 deletions(-) create mode 100644 webUI/src/views/acc/plugins/import-workflow/intro.vue create mode 100644 webUI/src/views/acc/plugins/warranty/intro.vue diff --git a/hesabixCore/src/Controller/ApprovalController.php b/hesabixCore/src/Controller/ApprovalController.php index e4f9b85..e6d24f5 100644 --- a/hesabixCore/src/Controller/ApprovalController.php +++ b/hesabixCore/src/Controller/ApprovalController.php @@ -134,6 +134,18 @@ class ApprovalController extends AbstractController $document->setIsApproved(true); $document->setApprovedBy($user); + $payments = []; + foreach ($document->getRelatedDocs() as $relatedDoc) { + if ($relatedDoc->getType() === 'sell_receive') { + $payments[] = $relatedDoc; + } + } + foreach ($payments as $payment) { + $payment->setIsPreview(false); + $payment->setIsApproved(true); + $payment->setApprovedBy($user); + } + $entityManager->persist($document); $entityManager->flush(); diff --git a/hesabixCore/src/Controller/BusinessController.php b/hesabixCore/src/Controller/BusinessController.php index 15b8754..9ba97b8 100644 --- a/hesabixCore/src/Controller/BusinessController.php +++ b/hesabixCore/src/Controller/BusinessController.php @@ -263,6 +263,16 @@ class BusinessController extends AbstractController $business->setFinancialApprover($params['financialApprover']); } + if (array_key_exists('requireWarrantyOnDelivery', $params)) { + $business->setRequireWarrantyOnDelivery($params['requireWarrantyOnDelivery']); + } + if (array_key_exists('activationGraceDays', $params)) { + $business->setActivationGraceDays($params['activationGraceDays']); + } + if (array_key_exists('matchWarrantyToSerial', $params)) { + $business->setMatchWarrantyToSerial($params['matchWarrantyToSerial']); + } + //get Money type if (!array_key_exists('arzmain', $params) && $isNew) { return $this->json(['result' => 2]); diff --git a/hesabixCore/src/Controller/SellController.php b/hesabixCore/src/Controller/SellController.php index 40dc27f..6e7b374 100644 --- a/hesabixCore/src/Controller/SellController.php +++ b/hesabixCore/src/Controller/SellController.php @@ -2,6 +2,7 @@ namespace App\Controller; +use App\Entity\Business; use App\Service\AccountingPermissionService; use App\Service\Jdate; use App\Service\Log; @@ -73,7 +74,7 @@ class SellController extends AbstractController { $acc = $access->hasRole('sell'); if (!$acc) throw $this->createAccessDeniedException(); - $doc = $entityManager->getRepository(\App\Entity\HesabdariDoc::class)->findOneBy([ + $doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([ 'bid' => $acc['bid'], 'code' => $code, 'money' => $acc['money'] @@ -90,7 +91,7 @@ class SellController extends AbstractController { $acc = $access->hasRole('sell'); if (!$acc) throw $this->createAccessDeniedException(); - $paymentDoc = $entityManager->getRepository(\App\Entity\HesabdariDoc::class)->findOneBy([ + $paymentDoc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([ 'bid' => $acc['bid'], 'code' => $code, 'money' => $acc['money'], @@ -333,7 +334,7 @@ class SellController extends AbstractController $entityManager->persist($hesabdariRow); // Two-step approval: اگر کسب‌وکار تأیید دو مرحله‌ای را الزامی کرده باشد - $business = $entityManager->getRepository(\App\Entity\Business::class)->find($acc['bid']); + $business = $entityManager->getRepository(Business::class)->find($acc['bid']); $businessRequire = $business && method_exists($business, 'isRequireTwoStepApproval') ? (bool)$business->isRequireTwoStepApproval() : false; if ($businessRequire) { $doc->setIsPreview(true); @@ -847,10 +848,13 @@ class SellController extends AbstractController $accountStatus['label'] = 'بدهکار'; $accountStatus['value'] = $bd - $bs; } - // فقط در صورت تایید نهایی مجاز به چاپ هستیم - if ($doc->getStatus() !== 'approved') { + + $business = $entityManager->getRepository(Business::class)->find($acc['bid']); + $twoApproval = $business && method_exists($business, 'isRequireTwoStepApproval') ? (bool)$business->isRequireTwoStepApproval() : false; + if ($twoApproval && $doc->isApproved() !== true && $doc->isPreview() == true) { return $this->json(['result' => -10, 'message' => 'فاکتور هنوز تایید نشده است'], 403); } + if ($params['pdf'] == true || $params['printers'] == true) { $note = ''; if ($printSettings) { @@ -1261,7 +1265,7 @@ class SellController extends AbstractController $entityManager->persist($hesabdariRow); // Two-step approval: اگر کسب‌وکار تأیید دو مرحله‌ای را الزامی کرده باشد - $business = $entityManager->getRepository(\App\Entity\Business::class)->find($acc['bid']); + $business = $entityManager->getRepository(Business::class)->find($acc['bid']); $businessRequire = $business && method_exists($business, 'isRequireTwoStepApproval') ? (bool)$business->isRequireTwoStepApproval() : false; if ($businessRequire) { $doc->setIsPreview(true); @@ -1299,6 +1303,8 @@ class SellController extends AbstractController $paymentDoc->setDate($params['invoiceDate']); $paymentDoc->setDes($payment['description'] ?? 'دریافت وجه فاکتور فروش شماره ' . $doc->getCode()); $paymentDoc->setAmount($payment['amount']); + $paymentDoc->setIsPreview(true); + $paymentDoc->setIsApproved(false); // ایجاد ارتباط با فاکتور اصلی $doc->addRelatedDoc($paymentDoc); diff --git a/hesabixCore/src/Controller/StoreroomController.php b/hesabixCore/src/Controller/StoreroomController.php index 9d68632..b980248 100644 --- a/hesabixCore/src/Controller/StoreroomController.php +++ b/hesabixCore/src/Controller/StoreroomController.php @@ -238,6 +238,9 @@ class StoreroomController extends AbstractController ]); $sellsForExport = []; foreach ($sells as $sell) { + if ($sell->isPreview()) { + continue; + } $temp = $provider->Entity2Array($sell, 0); $person = $this->getPerson($sell); if ($person) { @@ -263,6 +266,9 @@ class StoreroomController extends AbstractController ]); $rfsellsForExport = []; foreach ($rfsells as $sell) { + if ($sell->isPreview()) { + continue; + } $temp = $provider->Entity2Array($sell, 0); $person = $this->getPerson($sell); if ($person) { @@ -288,6 +294,9 @@ class StoreroomController extends AbstractController ]); $rfbuysForExport = []; foreach ($rfbuys as $buy) { + if ($buy->isPreview()) { + continue; + } $temp = $provider->Entity2Array($buy, 0); $person = $this->getPerson($buy); if ($person) { @@ -910,12 +919,12 @@ class StoreroomController extends AbstractController $business = $entityManager->getRepository(\App\Entity\Business::class)->find($acc['bid']); $businessRequire = $business && method_exists($business, 'isRequireTwoStepApproval') ? (bool)$business->isRequireTwoStepApproval() : false; - if ($businessRequire) { - // بررسی وضعیت تأیید از طریق StoreroomTicket + if ($businessRequire && $doc->isApproved() !== true && $doc->isPreview() == true) { if ($doc->isPreview()) { return $this->json(['result' => -10, 'message' => 'حواله هنوز تایید نشده است'], 403); } } + $pdfPid = 0; $pdfPid = $provider->createPrint( $acc['bid'], diff --git a/hesabixCore/src/Service/Explore.php b/hesabixCore/src/Service/Explore.php index d1b014a..672d2a5 100644 --- a/hesabixCore/src/Service/Explore.php +++ b/hesabixCore/src/Service/Explore.php @@ -584,6 +584,9 @@ class Explore 'financialApprover' => $item->getFinancialApprover(), 'updateSellPrice' => $item->isCommodityUpdateSellPriceAuto(), 'updateBuyPrice' => $item->isCommodityUpdateBuyPriceAuto(), + 'requireWarrantyOnDelivery' => $item->getRequireWarrantyOnDelivery(), + 'activationGraceDays' => $item->getActivationGraceDays(), + 'matchWarrantyToSerial' => $item->getMatchWarrantyToSerial(), ]; if (!$item->getProfitCalctype()) { $res['profitCalcType'] = 'lis'; diff --git a/webUI/src/i18n/fa_lang.ts b/webUI/src/i18n/fa_lang.ts index 7049c8b..776e27c 100755 --- a/webUI/src/i18n/fa_lang.ts +++ b/webUI/src/i18n/fa_lang.ts @@ -507,6 +507,7 @@ const fa_lang = { basic_info: "اطلاعات پایه", year_label: "سال مالی جاری", global_settings: "تنظیمات سراسری", + warranty_settings: "تنظیمات گارانتی", gate_pay: "درگاه پرداخت", a4l: "کاغذ A4 افقی", a4p: "کاغذ A4 عمودی", diff --git a/webUI/src/router/index.ts b/webUI/src/router/index.ts index 4d256bc..c5b07aa 100755 --- a/webUI/src/router/index.ts +++ b/webUI/src/router/index.ts @@ -892,6 +892,12 @@ const router = createRouter({ 'login': true } }, + { + path: 'plugins/warranty/intro', + name: 'plugin_warranty_intro', + component: () => + import('../views/acc/plugins/warranty/intro.vue'), + }, { path: 'notifications/list', name: 'notification_list', @@ -1080,6 +1086,12 @@ const router = createRouter({ 'login': true, } }, + { + path: 'plugins/import-workflow/intro', + name: 'import_workflow_intro', + component: () => + import('../views/acc/plugins/import-workflow/intro.vue'), + } ], }, { diff --git a/webUI/src/views/acc/plugins/import-workflow/intro.vue b/webUI/src/views/acc/plugins/import-workflow/intro.vue new file mode 100644 index 0000000..4196921 --- /dev/null +++ b/webUI/src/views/acc/plugins/import-workflow/intro.vue @@ -0,0 +1,195 @@ + + + + + + + diff --git a/webUI/src/views/acc/plugins/warranty/WarrantyPlugin.vue b/webUI/src/views/acc/plugins/warranty/WarrantyPlugin.vue index a89b16b..38b15fe 100644 --- a/webUI/src/views/acc/plugins/warranty/WarrantyPlugin.vue +++ b/webUI/src/views/acc/plugins/warranty/WarrantyPlugin.vue @@ -127,141 +127,58 @@ - + - + @@ -338,26 +250,13 @@ - + - + - + @@ -387,55 +286,10 @@ - - - - mdi-cog - تنظیمات گارانتی - - - mdi-close - - - - - - - - - - انصراف - ذخیره - - - + - +
{{ snackbarColor === 'success' ? 'mdi-check-circle' : 'mdi-alert-circle' }} @@ -800,8 +654,8 @@ const filterByStatus = async (status: 'available' | 'allocated' | 'verified' | ' filters.value.search = '' filters.value.commodity_id = null selectedItems.value = [] - await Promise.all([loadSerials(), - // loadStats() + await Promise.all([loadSerials(), + // loadStats() ]) const statusText = getStatusText(status) if (filters.value.status === status) { @@ -880,27 +734,34 @@ onMounted(async () => { .warranty-plugin { padding: 20px; } + .v-data-table { direction: rtl; } + :deep(.v-data-table-header th) { background-color: #f5f5f5 !important; font-weight: bold !important; color: #333 !important; } + :deep(.v-data-table__wrapper table td) { padding: 12px 16px !important; border-bottom: 1px solid #e0e0e0 !important; } + :deep(.v-data-table__wrapper table tr:hover) { background-color: #f8f9fa !important; } + :deep(.v-chip) { font-weight: 500; } + .custom-header { background-color: #f5f5f5 !important; } + .stats-card { position: relative; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); @@ -916,18 +777,22 @@ onMounted(async () => { gap: 16px; user-select: none; } + .stats-card:focus { outline: 2px solid rgba(255, 255, 255, 0.5); outline-offset: 2px; } + .stats-card.active-filter { transform: translateY(-4px) scale(1.02); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2); border: 2px solid rgba(255, 255, 255, 0.8); } + .stats-card.active-filter::before { - background: linear-gradient(45deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 100%); + background: linear-gradient(45deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%); } + .stats-card::before { content: ''; position: absolute; @@ -935,14 +800,16 @@ onMounted(async () => { left: 0; right: 0; bottom: 0; - background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%); + background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%); border-radius: 16px; z-index: 1; } + .stats-card:hover { transform: translateY(-8px) scale(1.01); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1); } + .stats-icon { position: relative; z-index: 2; @@ -951,11 +818,13 @@ onMounted(async () => { padding: 12px; backdrop-filter: blur(10px); } + .stats-content { position: relative; z-index: 2; flex: 1; } + .stats-number { font-size: 2.5rem; font-weight: 700; @@ -963,24 +832,30 @@ onMounted(async () => { margin-bottom: 4px; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); } + .stats-label { font-size: 0.9rem; font-weight: 500; opacity: 0.9; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); } + .total-card { background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%); } + .active-card { background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%); } + .expired-card { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); } + .inactive-card { background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%); } + @media (max-width: 768px) { .stats-card { flex-direction: column; diff --git a/webUI/src/views/acc/plugins/warranty/intro.vue b/webUI/src/views/acc/plugins/warranty/intro.vue new file mode 100644 index 0000000..4f1a97d --- /dev/null +++ b/webUI/src/views/acc/plugins/warranty/intro.vue @@ -0,0 +1,224 @@ + + + + + + + + diff --git a/webUI/src/views/acc/sell/list.vue b/webUI/src/views/acc/sell/list.vue index 99717eb..43f026e 100755 --- a/webUI/src/views/acc/sell/list.vue +++ b/webUI/src/views/acc/sell/list.vue @@ -4,7 +4,8 @@ @@ -21,14 +22,8 @@ @@ -46,7 +41,8 @@ {{ $t('dialog.change_labels') }} - + @@ -72,7 +68,8 @@ فاکتورهای در انتظار تایید
- + - + - + @@ -151,17 +139,20 @@ - + - + - + @@ -240,7 +231,8 @@