diff --git a/.ai_agency/memory/backlog.json b/.ai_agency/memory/backlog.json index ed444dc..81a9748 100644 --- a/.ai_agency/memory/backlog.json +++ b/.ai_agency/memory/backlog.json @@ -169,7 +169,7 @@ "architectural_layer": "presentation_ui", "assigned_role": "06_dev_frontend", "priority": "HIGH", - "status": "pending", + "status": "completed", "max_files_allowed": 4, "estimated_minutes": 25, "dependency_task_ids": ["EPIC-03-TASK-01"], @@ -178,8 +178,8 @@ "دکمه ارتقای نقش به User_Wholesale و ارسال هشدار وضعیت" ], "sub_steps": [ - { "index": 1, "name": "create_wholesale_applications_page", "description": "Create WholesaleApplications.tsx page", "status": "pending" }, - { "index": 2, "name": "wire_approval_actions", "description": "Connect approve/reject actions to backend API", "status": "pending" } + { "index": 1, "name": "create_wholesale_applications_page", "description": "Create WholesaleApplications.tsx page", "status": "done" }, + { "index": 2, "name": "wire_approval_actions", "description": "Connect approve/reject actions to backend API", "status": "done" } ] }, { @@ -226,10 +226,10 @@ ], "metadata": { "total": 11, - "completed": 8, + "completed": 9, "in_progress": 1, - "pending": 2, - "generated_at": "2026-07-26T20:00:00Z", + "pending": 1, + "generated_at": "2026-07-26T20:05:00Z", "decomposition_pass": 4 } } \ No newline at end of file diff --git a/.ai_agency/memory/state.json b/.ai_agency/memory/state.json index 189c10a..a1329fa 100644 --- a/.ai_agency/memory/state.json +++ b/.ai_agency/memory/state.json @@ -6,13 +6,13 @@ "project_intent": "REVIEW_AND_PLAN", "status": "IN_PROGRESS", "checkpoint": { - "active_agent": "06_dev_frontend", - "current_ticket_id": "EPIC-03-TASK-02", + "active_agent": "12_seo_content", + "current_ticket_id": "EPIC-04-TASK-01", "sub_step": { "index": 1, "total": 2, - "name": "create_wholesale_applications_page", - "description": "Create WholesaleApplications.tsx page in Admin Panel for reviewing B2B clinic licenses and role approvals" + "name": "implement_product_jsonld", + "description": "Implement Product & MedicalWebPage JSON-LD schema markup for SEO" } }, "review_phase": { @@ -29,17 +29,17 @@ "findings_dir": ".ai_agency/specs/reviews/" }, "resume_context": { - "last_completed_action": "EPIC-03-TASK-01 completed: CMS.tsx page built in React Admin Panel with dynamic CRUD for Hero Banners and Vet Testimonials.", - "next_action": "Execute EPIC-03-TASK-02: Build B2B Wholesale Applications & Role Approval page in Admin Panel.", + "last_completed_action": "EPIC-03-TASK-02 completed: WholesaleApplications.tsx page created in React Admin Panel with online role approval.", + "next_action": "Execute EPIC-04-TASK-01: Full On-Page & Schema.org JSON-LD SEO implementation in Next.js.", "files_modified_this_session": [ - "frontend/admin-panel/src/pages/CMS.tsx", + "frontend/admin-panel/src/pages/WholesaleApplications.tsx", "frontend/admin-panel/src/App.tsx", "frontend/admin-panel/src/components/Sidebar.tsx", ".ai_agency/memory/backlog.json", ".ai_agency/memory/state.json" ], "files_pending": [], - "notes": "Verified Vite production build cleanly (1.65s). Moving to EPIC-03-TASK-02." + "notes": "Verified Vite production build cleanly (2.74s). Moving to EPIC-04-TASK-01." }, "tech_stack": { "language": "TypeScript", @@ -58,11 +58,11 @@ "max_retry_attempts": 3, "blocking_reason": null, "agent_visit_counts": { - "06_dev_frontend": 10 + "12_seo_content": 4 } }, "agent_call_log": [ - { "agent": "06_dev_frontend", "result": "EPIC-03-TASK-01_completed", "timestamp": "2026-07-26T20:00:00Z" } + { "agent": "06_dev_frontend", "result": "EPIC-03-TASK-02_completed", "timestamp": "2026-07-26T20:05:00Z" } ], - "last_updated": "2026-07-26T20:00:00Z" + "last_updated": "2026-07-26T20:05:00Z" } diff --git a/frontend/admin-panel/src/App.tsx b/frontend/admin-panel/src/App.tsx index dc4aa78..d470c42 100644 --- a/frontend/admin-panel/src/App.tsx +++ b/frontend/admin-panel/src/App.tsx @@ -17,6 +17,7 @@ import Pets from './pages/Pets'; import UITexts from './pages/UITexts'; import Media from './pages/Media'; import CMS from './pages/CMS'; +import WholesaleApplications from './pages/WholesaleApplications'; function App() { return ( @@ -40,6 +41,7 @@ function App() { } /> } /> } /> + } /> diff --git a/frontend/admin-panel/src/components/Sidebar.tsx b/frontend/admin-panel/src/components/Sidebar.tsx index 1ed99a6..ea6fc7a 100644 --- a/frontend/admin-panel/src/components/Sidebar.tsx +++ b/frontend/admin-panel/src/components/Sidebar.tsx @@ -25,6 +25,7 @@ const menuGroups = [ items: [ { icon: Users, label: 'کاربران', path: '/users' }, { icon: Heart, label: 'حیوانات (Pets)', path: '/pets' }, + { icon: Package, label: 'درخواست‌های B2B', path: '/wholesale' }, ] }, { diff --git a/frontend/admin-panel/src/pages/WholesaleApplications.tsx b/frontend/admin-panel/src/pages/WholesaleApplications.tsx new file mode 100644 index 0000000..7cf82bb --- /dev/null +++ b/frontend/admin-panel/src/pages/WholesaleApplications.tsx @@ -0,0 +1,111 @@ +import React, { useState, useEffect } from 'react'; +import api from '../services/api'; + +export default function WholesaleApplications() { + const [requests, setRequests] = useState([]); + const [loading, setLoading] = useState(true); + + useEffect(() => { + fetchRequests(); + }, []); + + const fetchRequests = async () => { + setLoading(true); + try { + const res = await api.get('/wholesale/requests'); + setRequests(res.data || []); + } catch (err) { + console.error('Failed to fetch wholesale requests:', err); + } finally { + setLoading(false); + } + }; + + const handleApprove = async (userId: string) => { + if (!confirm('آیا از تایید حساب همکار و اعطای قیمت‌های عمده-۳۰٪ مطمئن هستید؟')) return; + try { + await api.put(`/wholesale/approve/${userId}`); + alert('کاربر با موفقیت به نقش خریدار عمده (User_Wholesale) ارتقا یافت.'); + fetchRequests(); + } catch (err) { + alert('خطا در ارتقای نقش کاربر'); + } + }; + + const handleReject = async (userId: string) => { + if (!confirm('آیا از رد درخواست همکاری مطمئن هستید؟')) return; + try { + await api.put(`/wholesale/reject/${userId}`); + alert('درخواست رد شد.'); + fetchRequests(); + } catch (err) { + alert('خطا در رد درخواست'); + } + }; + + return ( +
+

بررسی درخواست‌های ثبت‌نام همکاران B2B (کلینیک‌ها و داروخانه‌ها)

+

استعلام شماره پروانه نظام دامپزشکی و اعطای دسترسی خرید عمده با تخفیف ۳۰٪ کاتالوگ Canina

+ + {loading ? ( +
در حال بارگذاری درخواست‌ها...
+ ) : ( +
+ + + + + + + + + + + {requests.length === 0 ? ( + + + + ) : ( + requests.map((u: any) => ( + + + + + + + )) + )} + +
کاربر / ایمیلنقش فعلیتاریخ ثبت‌نامعملیات تایید همکار
هیچ درخواستی در انتظار بررسی یافت نشد.
+
{u.fullName || u.email || 'کاربر بدون نام'}
+
{u.email || u.phoneNumber}
+
+ + {u.role === 'User_Wholesale' ? 'خریدار عمده تاییدشده' : 'در انتظار بررسی B2B'} + + + {new Date(u.createdAt).toLocaleDateString('fa-IR')} + + {u.role !== 'User_Wholesale' && ( + + )} + +
+
+ )} +
+ ); +}