Admin & Seller Power Guide
Every admin panel tab, every component, every backend endpoint — analyzed from the real source code. This is not a conceptual overview; it's an engineering map.
1. Admin Dashboard — All 19 Tabs Explained
Source: src/app/admin/page.js — The sidebarItems array (lines
279–416) defines every tab. The renderContent() switch (lines 418–519) wires each tab to
its component.
Dashboard Overview
Displays real-time system statistics. Receives props:
pendingUsers, sellers, categories, cities,
productsCount, pendingRequestsCount,
sponsoredPendingCount, recentProducts. Has onNavigate
callback for tab switching. Refetches on every tab visit via
useEffect([activeTab]).
ADMIN_PENDING_USERS, ADMIN_SELLERS, PRODUCTS?count=1,
PRODUCTS?limit=6, CATEGORIES_PRODUCT, CITIES,
ADMIN_SPONSORED_REQUESTS
Pending Approvals
Shows sellers awaiting account approval from the
temp_user_account table. Provides Approve / Reject actions that call
approveUser(userId) and rejectUser(userId, reason) in admin/page.js,
which POST to ADMIN_APPROVE_USER and ADMIN_REJECT_USER respectively.
temp_user_account → user_accounts + fires welcome SMTP email.
Manage Sellers
The most complex admin component. Manages all seller accounts.
Features: view seller details, edit subscription, change payment status, view products, send
payment reminder email. Receives sellers array from parent, plus onRemind and
onChanged callbacks. Contains ApprovalModal and EditModal
sub-components.
Manage Products
Admin product listing with full CRUD. Fetches all products via
PRODUCTS endpoint. Supports filtering, editing, activation/deactivation, and
deletion. Calls PRODUCTS with GET/POST/DELETE/PATCH methods.
Manage Reviews
Moderates all product reviews. Can approve, reject, or delete
reviews. Fetches from ADMIN_REVIEWS endpoint (api/admin/reviews.php).
Displays reviewer info, product name, rating, and comment text.
Categories Manager
Full CRUD for product categories. Supports bilingual names
(EN/ES). Categories are hierarchical with parent-child support via parent_id
foreign key. Endpoint: CATEGORIES_PRODUCT.
Cities Manager
Manages available cities/locations on the platform. Sellers and
products are associated with cities. Bilingual support. Endpoint: CITIES.
Category Limits
Controls how many products each seller can list per category.
Configurable per seller. Endpoint: ADMIN_SELLER_CATEGORY_LIMITS.
Send Notifications
Sends email campaigns to selected sellers. Supports individual
and bulk emails. Uses ADMIN_SEND_NOTIFICATIONS and ADMIN_SEND_EMAIL
endpoints. Can compose rich-text emails with payment reminders.
Email Logs
Full audit log of all emails sent through the platform. Shows:
sender, recipient, subject, date, status. Fetches from ADMIN_EMAIL_LOGS endpoint.
Supports search and filtering.
Seller Emails Inbox
Views messages sent from sellers to admin via the Contact Admin
panel. Messages arrive in the seller_emails table. Admin can read and respond.
Endpoint: SELLER_EMAILS.
Category Removal Requests
When a seller wants to remove a product category from their
profile, it requires admin approval. This panel lists those pending requests with approve/deny
actions. On action, calls onActionCompleted() which refetches admin data.
Requests Manager
Handles seller requests for new categories and cities. Sellers
submit requests from their dashboard; admin approves or rejects here. Endpoint:
REQUESTS (api/requests/index.php).
Manage Admin Account
Admin profile settings. Update name, email, and password.
Receives user prop from parent. Saves changes via the seller/profile endpoint.
Payment Settings
Configure global payment terms: bank account details, Yape/Plin
numbers, monthly fee amount. These settings are used in payment reminder emails. Endpoint:
ADMIN_PAYMENT_SETTINGS (api/admin/payment_settings.php).
Upcoming Payments
Tracks subscription due dates for all sellers. Shows overdue,
due-this-week, and upcoming payments. Can send individual or bulk payment reminders. Integrates
with ReceiptsPanel for cross-navigation. Receives initialSearch and
autoFocus props for deep linking from Receipts tab.
Uploaded Receipts
View payment receipts uploaded by sellers. When admin clicks a
seller's receipt, it cross-navigates to the Upcoming Payments tab for that seller via the
onNavigate callback. Endpoint: ADMIN_PAYMENT_RECEIPTS.
Sponsored Products
Sellers can request their products to be featured/sponsored.
This panel shows pending and active sponsored requests. Admin can approve, set dates, or reject.
Endpoint: ADMIN_SPONSORED_REQUESTS.
Content Pages (CMS)
Full CMS for website pages (About, Terms, Info). Uses TinyMCE
rich-text editor for content. Supports bilingual content (EN/ES). Pages are stored in the
database and rendered dynamically in /information/ routes. Endpoint:
ADMIN_PAGES.
2. Email System Architecture
The email system is complex with multiple layers: SMTP configuration, template engine, and a logging system. All routed through Hostinger SMTP.
Email Engine Hierarchy
Email Configuration
api/config/email.php — Do NOT expose this file publicly.
Contains SMTP credentials.
Use email.example.php as a
template to create your own email.php. The file defines constants like:
// api/config/email.php structure
define('SMTP_HOST', 'smtp.hostinger.com');
define('SMTP_PORT', 587);
define('SMTP_USERNAME', 'admin@lastiendas.pe');
define('SMTP_PASSWORD', '...');
define('FROM_EMAIL', 'admin@lastiendas.pe');
define('FROM_NAME', 'Las Tiendas');
Payment Reminder Endpoints
POST admin/send_manual_reminder.php
— Send to one seller
POST admin/send_bulk_reminders.php
— Send to all due within 7
days
GET cron/send_payment_reminders.php
— Automated CRON job
3. Seller Dashboard — All 10 Tabs
Source: src/app/seller/page.js — 493 lines. Same architecture as admin. Uses
localStorage auth guard and fetches data on mount.
Seller Tab Registry
Seller Access Control
When a seller's account is deactivated
(non-payment), the dashboard shows a warning banner and passes
disabledActions={true} to sensitive components:
// seller/page.js (line 459+)
{user?.user_type === 'seller' &&
Number(user?.is_active) === 0 && (
Your account is deactivated...
)}
is_active === 0 in the DB, all product/category/shop
actions are blocked at UI level AND the backend checks subscription status during login.
Seller Data Load on Mount
// fetchSellerData() loads in parallel:
// ✓ Products (by seller_id)
// ✓ All categories
// ✓ Seller's own categories (auth required)
// ✓ All cities
// ✓ Price types
// ✓ Seller profile (seller_number, subscription_end)
// ✓ Subscription details
4. Complete Backend API Reference
Every endpoint in the PHP API with its HTTP methods, location, and purpose.
Authentication Layer
api/auth/login.phpAccepts
{username, password}. Queries user_accounts. Returns
{token, user} on success.
api/auth/register.phpCreates record in
temp_user_account. Does NOT auto-create seller account; requires admin
approval.
Products Endpoint
api/products/index.phpParams: id,
slug, seller_id, limit, count=1. Returns
product list or single product.
api/products/index.phpCreates a new product for a seller. Requires product data payload.
api/products/index.phpFull product update.
api/products/index.phpPartial update — used for toggling
is_active status.
api/products/index.phpDelete product by id query
param.
Admin Endpoints (Protected)
admin/pending_users.phpReturns all records from
temp_user_account with status = 'pending'
admin/approve_user.phpBody: {id}. Moves from
temp → real accounts tables. Sends welcome email.
admin/reject_user.phpBody: {id, reason}. Sends
rejection email. Removes from temp table.
admin/sellers.phpReturns all sellers with subscription info, categories, payment status. Complex JOIN query.
admin/payments_overview.phpCategorized sellers: overdue, due this week, upcoming. Used by Upcoming Payments tab.
admin/send_bulk_reminders.phpSends payment reminder emails to all
sellers due within 7 days. Logs results to email_logs table.
admin/pages.phpFull CMS CRUD. Multi-method controller. Handles website page content in EN & ES.
admin/sponsored_requests.php (14.6KB)
Most complex admin endpoint. Handles sponsored product request lifecycle.
5. File Upload System
Product Image Upload
api/upload/product_image.php
/uploads/ directory on server. Returns image URL string for storage in DB.
Used in AddProductForm.js when seller uploads a
product image. The returned path is stored as the product's image field.
Payment Receipt Upload
api/upload/receipt.php
UPLOAD_PAYMENT_RECEIPT.Used in SubscriptionPanel.js. Admin sees all
uploaded receipts in ReceiptsPanel.js. Cross-links to UpcomingPayments
tab via onNavigate.
6. Shared/Global Components
These components are used across multiple pages, not specific to admin or seller:
AUTH_LOGIN and
AUTH_REGISTER. Saves token to localStorage on success.
REVIEWS endpoint.layout.js. Shows success/error messages across the app.