Files
mold_cost_online_tool/docs/ADMIN_GUIDE.md
T
Gan, Jimmy 6c0d5a4e63 Initial commit: Clean Mold Cost Calculator application
- Flask-based mold cost calculation application
- PostgreSQL database with SQLAlchemy ORM
- Docker/Podman containerization
- Comprehensive documentation in docs/
- Clean, organized codebase without obsolete files
- Production-ready deployment configuration
- Enhanced pytest configuration with coverage reporting
- Master/Development branch structure
2025-06-24 02:30:09 +08:00

11 KiB
Raw Blame History

Mold Cost Calculator - Admin User Guide

📋 Table of Contents

  1. System Overview
  2. Cost Calculation System
  3. Cost Factors & Pricing
  4. Admin Panel Access
  5. User Management
  6. Quotation Management
  7. System Configuration
  8. Troubleshooting

🎯 System Overview

The Mold Cost Calculator is a web-based application that calculates mold manufacturing costs based on various technical specifications and complexity factors. The system is designed for footwear industry professionals to get accurate cost estimates for different types of molds.

Key Features

  • Multi-factor cost calculation based on mold type, complexity, and texture
  • Country-specific tax rates for accurate regional pricing
  • User management system with role-based access control
  • Comprehensive admin panel for system oversight
  • Real-time cost breakdown with detailed component analysis

💰 Cost Calculation System

Base Calculation Formula

The system uses a multi-layered calculation approach:

Total Cost = (Base Price + Complexity Cost + Texture Cost) × (1 + Tax Rate)

Where:

  • Base Price = DEFAULT_NET_BASE × Mold Type Factor
  • Complexity Cost = Base Price × (Slider Factor + Cavity Factor + High Sidewall Factor)
  • Texture Cost = Base Price × Texture Factor

Default Values

  • DEFAULT_NET_BASE: $12.50 (base unit cost)
  • Tax Rates: Varies by country (see below)

📊 Cost Factors & Pricing

1. Mold Type Factors

The system applies different multipliers based on the specific mold type:

Rubber Molds

Specific Type Factor Description
Flat 1.00 Standard flat outsole
Flat with Top/Heel Tip 1.25 Flat with additional tip features
Top PL 1.05 Top part line mold
Visible PL 1.28 Visible part line mold
Short PL (Heel/Forefoot) 1.18 Short part line for specific areas
Wave PL 1.32 Wave pattern part line

CMEVA Molds

Specific Type Factor Description
2 Plates Mold 1.00 Standard 2-plate configuration
3 Plates Mold 1.35 Complex 3-plate configuration
2 Plates with in-mold channel 1.25 2-plate with channel features
Breathable + in-mold channel 1.45 Breathable with channel features

IMEVA Molds

Specific Type Factor Description
2 Plates Mold 1.00 Standard 2-plate configuration
3 Plates Mold 1.35 Complex 3-plate configuration

Sandal Molds

Specific Type Factor Description
Sandal with Upper Bandage 1.15 Sandal with bandage features
2 Plate without Upper Bandage 1.05 Standard 2-plate sandal

Co-shot Molds

Specific Type Factor Description
Co-shot mold 1.25 Multi-material injection
Foaming mold 1.40 Foam injection process

PU Molds

Specific Type Factor Description
2 Plates Mold 1.00 Standard 2-plate configuration
3 Plates Mold 1.35 Complex 3-plate configuration

2. Complexity Factors

Additional costs based on mold complexity:

Complexity Type Factor Calculation
High Sidewall (>60mm) 0.18 Base Price × 0.18
Slider 0.10 Base Price × (Number of Sliders × 0.10)
Cavity 0.12 Base Price × ((Number of Cavities - 1) × 0.12)

3. Texture Factors

Digital texture processing costs:

Texture Type Factor Description
adidas digital 0.00 No additional cost
customized texture 0.15 15% of base price
laser 0.20 20% of base price

4. Tax Rates by Country

Country Tax Rate Percentage
China 0.06 6%
Vietnam 0.10 10%
Indonesia 0.07 7%

🔐 Admin Panel Access

Accessing the Admin Panel

  1. Login Requirements: Must be logged in with admin privileges
  2. URL: Navigate to /admin/dashboard
  3. Authentication: System checks current_user.is_admin flag

Admin Privileges Required

  • User account must have is_admin = True in the database
  • Admin users can access all system features
  • Regular users are redirected to login with access denied message

👥 User Management

Viewing Users

  • Location: Admin Panel → Users
  • Features:
    • List all registered users
    • Search and filter functionality
    • Pagination (20 users per page)
    • User status indicators

User Information Displayed

  • User ID
  • Username
  • Email address
  • Account status (Active/Inactive)
  • Role (Admin/User)
  • Last login date
  • Account creation date

User Actions

View User Details

  • Click the eye icon (👁️) to view detailed user information
  • Shows user profile and quotation history

Toggle User Status

  • Click the toggle button to activate/deactivate users
  • Inactive users cannot log in
  • Confirmation dialog required

Delete User

  • Restriction: Cannot delete your own account
  • Process: Confirmation required before deletion
  • Impact: Permanently removes user and all associated data

User Statistics

  • Total registered users
  • Active users (logged in within 30 days)
  • User activity trends

📋 Quotation Management

Viewing Quotations

  • Location: Admin Panel → Quotations
  • Features:
    • List all system quotations
    • Advanced filtering options
    • Pagination (20 quotations per page)
    • Cost breakdown display

Filter Options

  • Country: Filter by mold shop country
  • Mold Type: Filter by main mold type
  • Date Range: Filter by creation date
  • Clear Filters: Reset all filters

Quotation Information Displayed

  • Quotation ID
  • User who created it
  • Model name
  • Country
  • Mold type
  • Base price
  • Total cost
  • Creation date

Quotation Actions

View Quotation Details

  • Click the eye icon to view complete quotation details
  • Shows all form data and cost breakdown
  • Displays approval information

Delete Quotation

  • Process: Confirmation required
  • Impact: Permanently removes quotation from system
  • Audit: Admin action logged

Quotation Statistics

  • Total quotations in system
  • Quotations by country
  • Recent quotation activity
  • Cost analysis trends

⚙️ System Configuration

Cost Factor Management

Updating Cost Factors

Cost factors are defined in app/constants.py:

COST_FACTORS = {
    'mold': {
        'Flat': 1.0,
        'Flat with Top/Heel Tip': 1.25,
        # ... other factors
    },
    'complexity': {
        'high_sidewall': 0.18,
        'slider': 0.1,
        'cavity': 0.12
    },
    'texture': {
        'adidas_digital': 0.0,
        'customized texture': 0.15,
        'laser': 0.2
    }
}

Updating Tax Rates

Tax rates are also in app/constants.py:

TAX_RATES = {
    'China': 0.06,
    'Vietnam': 0.10,
    'Indonesia': 0.07
}

Updating Default Base Price

Change DEFAULT_NET_BASE in app/constants.py:

DEFAULT_NET_BASE = 12.5  # Change this value

Database Management

Creating Admin Users

Use the CLI command to create admin users:

# Set environment variables
export ADMIN_USERNAME="admin"
export ADMIN_EMAIL="admin@company.com"
export ADMIN_PASSWORD="secure_password"
export ADMIN_COMPANY="Company Name"

# Run the command
flask init-db

Database Migrations

The system uses Alembic for database migrations:

# Create a new migration
flask db migrate -m "Description of changes"

# Apply migrations
flask db upgrade

Environment Configuration

Required Environment Variables

  • SECRET_KEY: Application secret key
  • DATABASE_URL: Database connection string
  • ADMIN_EMAIL: Admin user email
  • ADMIN_PASSWORD: Admin user password

Optional Environment Variables

  • FLASK_ENV: Environment (development/production)
  • LOG_LEVEL: Logging level
  • MAIL_SERVER: Email server configuration

🔧 Troubleshooting

Common Issues

Cost Calculation Errors

Problem: Incorrect cost calculations Solution:

  1. Check cost factors in app/constants.py
  2. Verify mold type mappings
  3. Ensure all factors are properly defined

User Access Issues

Problem: Users cannot access admin panel Solution:

  1. Verify user has is_admin = True in database
  2. Check user account is active
  3. Clear browser cache and cookies

Database Connection Issues

Problem: Database connection failures Solution:

  1. Check database server status
  2. Verify connection string in environment
  3. Check database permissions
  4. Review application logs

Form Validation Errors

Problem: Form submissions failing validation Solution:

  1. Check form field mappings
  2. Verify validation rules
  3. Review server logs for specific errors
  4. Ensure all required fields are properly configured

Log Analysis

Application Logs

  • Location: /app/logs/ directory
  • Format: Timestamp, log level, message
  • Key Logs: Error messages, validation failures, calculation results

Database Logs

  • Location: Database server logs
  • Key Information: Connection issues, query performance, errors

Performance Monitoring

System Metrics

  • User activity levels
  • Quotation creation rates
  • Calculation response times
  • Database query performance

Optimization Tips

  • Monitor database query performance
  • Review cache hit rates
  • Check for slow calculations
  • Monitor memory usage

📞 Support & Maintenance

Regular Maintenance Tasks

  1. Database Backups: Regular automated backups
  2. Log Rotation: Manage log file sizes
  3. Security Updates: Keep dependencies updated
  4. Performance Monitoring: Monitor system performance
  5. User Management: Review and clean up inactive users

Emergency Procedures

  1. System Downtime: Check server status and logs
  2. Data Corruption: Restore from latest backup
  3. Security Breach: Review access logs and user activity
  4. Performance Issues: Scale resources or optimize queries

Contact Information

  • Technical Support: [Your IT Support Email]
  • System Administrator: [Admin Contact]
  • Emergency Contact: [Emergency Phone Number]

📈 System Analytics

Key Performance Indicators (KPIs)

  • User Adoption: Number of active users
  • Usage Patterns: Peak usage times
  • Calculation Accuracy: Error rates in calculations
  • System Performance: Response times and uptime

Reporting Capabilities

  • User activity reports
  • Quotation volume analysis
  • Cost factor impact analysis
  • Geographic usage patterns

Data Export

  • Quotation data export (CSV/Excel)
  • User activity reports
  • Cost analysis reports
  • System performance metrics

This admin guide should be updated whenever system changes are made to cost factors, user management features, or administrative functions.