Spaces:
Sleeping
Sleeping
Remove binary images for Hugging Face Spaces compatibility1
Browse files
README.md
CHANGED
|
@@ -260,7 +260,6 @@ The `hotels.csv` file serves as the central registry for all hotel databases:
|
|
| 260 |
```csv
|
| 261 |
hotel_database,password
|
| 262 |
tabble_new.db,myhotel
|
| 263 |
-
|
| 264 |
```
|
| 265 |
|
| 266 |
### Creating a New Hotel Database
|
|
@@ -463,14 +462,14 @@ python init_db.py --force-reset
|
|
| 463 |
|
| 464 |
1. **Create Empty Database:**
|
| 465 |
```bash
|
| 466 |
-
|
| 467 |
-
|
| 468 |
|
| 469 |
2. **Add to Registry:**
|
| 470 |
Edit `hotels.csv` and add your database entry:
|
| 471 |
```csv
|
| 472 |
-
|
| 473 |
-
|
| 474 |
|
| 475 |
3. **Configure Hotel Settings:**
|
| 476 |
- Access admin panel: `http://localhost:3000/admin`
|
|
@@ -499,219 +498,440 @@ NODE_ENV=production
|
|
| 499 |
- Ensure proper directory permissions for image uploads
|
| 500 |
- Consider using cloud storage for production deployments
|
| 501 |
|
| 502 |
-
## π€ Hugging Face Spaces Deployment Guide
|
| 503 |
|
| 504 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 505 |
|
| 506 |
-
####
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 507 |
```bash
|
| 508 |
-
#
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
#
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
-
|
| 547 |
-
-
|
| 548 |
-
-
|
| 549 |
-
-
|
| 550 |
-
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
2. β
Build Docker image using your Dockerfile
|
| 559 |
-
3. β
Initialize database with sample data
|
| 560 |
-
4. β
Start the application on port 7860
|
| 561 |
-
5. β
Provide public URL for access
|
| 562 |
-
|
| 563 |
-
### π± Using Your Deployed App
|
| 564 |
-
|
| 565 |
-
#### π Access Points
|
| 566 |
-
|
| 567 |
-
| Interface | URL | Description |
|
| 568 |
-
|-----------|-----|-------------|
|
| 569 |
-
| **Home** | `/` | Main landing page with interface selection |
|
| 570 |
-
| **Customer** | `/customer` | QR code ordering interface |
|
| 571 |
-
| **Chef** | `/chef` | Kitchen order management |
|
| 572 |
-
| **Admin** | `/admin` | Complete restaurant management |
|
| 573 |
-
| **API Docs** | `/docs` | Interactive API documentation |
|
| 574 |
-
| **Health** | `/health` | System health check |
|
| 575 |
-
|
| 576 |
-
#### π Demo Credentials
|
| 577 |
-
|
| 578 |
-
- **Hotel Access Code**: `myhotel`
|
| 579 |
-
- **Demo Database**: `tabble_new.db`
|
| 580 |
-
- **Sample Tables**: 1-20
|
| 581 |
-
- **Phone OTP**: Any 6 digits (demo mode)
|
| 582 |
-
|
| 583 |
-
### π§ Customization for Production
|
| 584 |
-
|
| 585 |
-
#### 1. Hotel Configuration
|
| 586 |
-
|
| 587 |
-
Edit `hotels.csv`:
|
| 588 |
```csv
|
| 589 |
hotel_database,password
|
| 590 |
-
|
| 591 |
-
|
| 592 |
```
|
| 593 |
|
| 594 |
-
|
| 595 |
|
| 596 |
-
|
| 597 |
-
|
| 598 |
-
|
| 599 |
-
|
| 600 |
-
|
| 601 |
-
|
|
|
|
|
|
|
|
|
|
| 602 |
```
|
| 603 |
|
| 604 |
-
|
|
|
|
|
|
|
|
|
|
| 605 |
|
| 606 |
-
|
| 607 |
-
```python
|
| 608 |
-
# Run this script to create your hotel database
|
| 609 |
python create_empty_db.py
|
| 610 |
```
|
| 611 |
|
| 612 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 613 |
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
5. Configure pricing and categories
|
| 619 |
|
| 620 |
-
|
|
|
|
| 621 |
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
- β
Kitchen efficiency reports
|
| 627 |
-
- β
Revenue analytics
|
| 628 |
|
| 629 |
-
####
|
| 630 |
-
- **Health Check**: `your-space-url/health`
|
| 631 |
-
- **API Status**: Monitor via `/docs` endpoint
|
| 632 |
-
- **Database Status**: Check via admin panel
|
| 633 |
|
| 634 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 635 |
|
| 636 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 637 |
|
| 638 |
-
|
| 639 |
-
```bash
|
| 640 |
-
# Check Dockerfile syntax
|
| 641 |
-
# Verify requirements.txt dependencies
|
| 642 |
-
# Ensure all required files are present
|
| 643 |
-
```
|
| 644 |
|
| 645 |
-
|
| 646 |
-
```bash
|
| 647 |
-
# Check hotels.csv format
|
| 648 |
-
# Verify database permissions
|
| 649 |
-
# Run database initialization
|
| 650 |
-
```
|
| 651 |
|
| 652 |
-
|
| 653 |
-
```bash
|
| 654 |
-
# Ensure templates/ directory exists
|
| 655 |
-
# Check template file paths
|
| 656 |
-
# Verify Jinja2 syntax
|
| 657 |
-
```
|
| 658 |
|
| 659 |
-
####
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 660 |
|
| 661 |
-
|
| 662 |
-
- **
|
| 663 |
-
- **
|
| 664 |
-
- **
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 665 |
|
| 666 |
-
|
|
|
|
|
|
|
| 667 |
|
| 668 |
-
|
|
|
|
|
|
|
|
|
|
| 669 |
|
| 670 |
-
|
| 671 |
-
|
| 672 |
-
|
| 673 |
-
4. **Test functionality** after deployment
|
| 674 |
|
| 675 |
-
|
| 676 |
|
| 677 |
-
|
| 678 |
-
|
| 679 |
-
|
| 680 |
-
|
| 681 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 682 |
|
| 683 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 684 |
```bash
|
| 685 |
-
|
| 686 |
-
# Backup custom templates
|
| 687 |
-
# Backup uploaded images
|
| 688 |
```
|
| 689 |
|
| 690 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 691 |
|
| 692 |
-
|
| 693 |
-
-
|
| 694 |
-
-
|
| 695 |
-
- Configure
|
| 696 |
|
| 697 |
-
|
| 698 |
-
-
|
| 699 |
-
-
|
| 700 |
-
- Update color schemes and fonts
|
| 701 |
|
| 702 |
-
|
| 703 |
-
- **Payment Gateways**: Add payment processing
|
| 704 |
-
- **SMS Services**: Integrate real OTP services
|
| 705 |
-
- **Analytics**: Connect to external analytics tools
|
| 706 |
-
- **POS Systems**: API integration capabilities
|
| 707 |
|
| 708 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 709 |
|
| 710 |
-
|
|
|
|
|
|
|
|
|
|
| 711 |
|
| 712 |
-
- **Documentation**: Complete API docs at `/docs`
|
| 713 |
-
- **GitHub Issues**: Report bugs and request features
|
| 714 |
-
- **Community**: Join discussions in GitHub Discussions
|
| 715 |
-
- **Updates**: Follow repository for latest features
|
| 716 |
|
| 717 |
-
**Ready to revolutionize your restaurant management? Deploy on Hugging Face Spaces now!** ππ½οΈ
|
|
|
|
| 260 |
```csv
|
| 261 |
hotel_database,password
|
| 262 |
tabble_new.db,myhotel
|
|
|
|
| 263 |
```
|
| 264 |
|
| 265 |
### Creating a New Hotel Database
|
|
|
|
| 462 |
|
| 463 |
1. **Create Empty Database:**
|
| 464 |
```bash
|
| 465 |
+
python create_empty_db.py
|
| 466 |
+
```
|
| 467 |
|
| 468 |
2. **Add to Registry:**
|
| 469 |
Edit `hotels.csv` and add your database entry:
|
| 470 |
```csv
|
| 471 |
+
yourhotel.db,yourpassword123
|
| 472 |
+
```
|
| 473 |
|
| 474 |
3. **Configure Hotel Settings:**
|
| 475 |
- Access admin panel: `http://localhost:3000/admin`
|
|
|
|
| 498 |
- Ensure proper directory permissions for image uploads
|
| 499 |
- Consider using cloud storage for production deployments
|
| 500 |
|
|
|
|
| 501 |
|
| 502 |
+
A comprehensive restaurant management system built with FastAPI (backend) and React (frontend), featuring QR code-based table ordering, phone OTP authentication, real-time order management, and multi-database support for independent hotel operations.
|
| 503 |
+
|
| 504 |
+
## π Key Features
|
| 505 |
+
|
| 506 |
+
### π½οΈ Customer Interface
|
| 507 |
+
- **Phone OTP Authentication**: Secure Firebase-based authentication
|
| 508 |
+
- **Real-time Cart Management**: Live cart updates with special offers
|
| 509 |
+
- **Today's Specials**: Dynamic special dish recommendations
|
| 510 |
+
- **Payment Processing**: Integrated payment with loyalty discounts
|
| 511 |
+
- **Order History**: Track past orders and preferences
|
| 512 |
+
|
| 513 |
+
### π¨βπ³ Chef Dashboard
|
| 514 |
+
- **Real-time Order Management**: Live order notifications and updates
|
| 515 |
+
- **Kitchen Operations**: Streamlined order acceptance and completion
|
| 516 |
+
- **Order Status Updates**: Instant status changes reflected across all interfaces
|
| 517 |
+
|
| 518 |
+
### π¨ Admin Panel
|
| 519 |
+
- **Complete Restaurant Management**: Full control over restaurant operations
|
| 520 |
+
- **Dish Management**: Add, edit, and manage menu items with images
|
| 521 |
+
- **Offers & Specials**: Create and manage promotional offers
|
| 522 |
+
- **Table Management**: Monitor table occupancy and status
|
| 523 |
+
- **Order Tracking**: Complete order lifecycle management
|
| 524 |
+
- **Loyalty Program**: Configurable visit-based discount system
|
| 525 |
+
- **Selection Offers**: Amount-based discount configuration
|
| 526 |
+
- **Settings**: Hotel information and configuration management
|
| 527 |
+
|
| 528 |
+
### π Analytics Dashboard
|
| 529 |
+
- **Customer Analysis**: Detailed customer behavior insights
|
| 530 |
+
- **Dish Performance**: Menu item popularity and sales metrics
|
| 531 |
+
- **Chef Performance**: Kitchen efficiency tracking
|
| 532 |
+
- **Sales & Revenue**: Comprehensive financial reporting
|
| 533 |
+
|
| 534 |
+
### ποΈ Multi-Database Support
|
| 535 |
+
- **Independent Hotel Operations**: Each hotel operates with its own database
|
| 536 |
+
- **Database Authentication**: Secure database access with password protection
|
| 537 |
+
- **Session-based Management**: Consistent database context across all interfaces
|
| 538 |
+
- **Data Isolation**: Complete separation of hotel data for security and privacy
|
| 539 |
+
|
| 540 |
+
## π Project Structure
|
| 541 |
+
|
| 542 |
+
```
|
| 543 |
+
tabble/
|
| 544 |
+
βββ app/ # Backend FastAPI application
|
| 545 |
+
β βββ database.py # Database configuration and models
|
| 546 |
+
β βββ main.py # FastAPI application entry point
|
| 547 |
+
β βββ middleware/ # Custom middleware (CORS, session handling)
|
| 548 |
+
β βββ models/ # SQLAlchemy database models
|
| 549 |
+
β βββ routers/ # API route definitions
|
| 550 |
+
β β βββ admin.py # Admin panel endpoints
|
| 551 |
+
β β βββ chef.py # Chef dashboard endpoints
|
| 552 |
+
β β βββ customer.py # Customer interface endpoints
|
| 553 |
+
β β βββ analytics.py # Analytics and reporting endpoints
|
| 554 |
+
β βββ services/ # Business logic and external services
|
| 555 |
+
β β βββ firebase_service.py # Firebase authentication
|
| 556 |
+
β β βββ database_service.py # Database operations
|
| 557 |
+
β βββ static/ # Static file serving
|
| 558 |
+
β β βββ images/ # Dish and hotel logo images
|
| 559 |
+
β β βββ dishes/ # Organized by database name
|
| 560 |
+
β βββ utils/ # Utility functions and helpers
|
| 561 |
+
βββ frontend/ # React frontend application
|
| 562 |
+
β βββ src/
|
| 563 |
+
β β βββ components/ # Reusable React components
|
| 564 |
+
β β β βββ Layout.js # Main layout wrapper
|
| 565 |
+
β β β βββ AdminLayout.js # Admin panel layout
|
| 566 |
+
β β β βββ ChefLayout.js # Chef dashboard layout
|
| 567 |
+
β β βββ pages/ # Page components
|
| 568 |
+
β β β βββ admin/ # Admin interface pages
|
| 569 |
+
β β β βββ chef/ # Chef dashboard pages
|
| 570 |
+
β β β βββ customer/ # Customer interface pages
|
| 571 |
+
β β β βββ analysis/ # Analytics dashboard
|
| 572 |
+
β β βββ services/ # API communication services
|
| 573 |
+
β β β βββ api.js # Axios configuration and API calls
|
| 574 |
+
β β βββ App.js # Main React application
|
| 575 |
+
β β βββ index.js # React DOM entry point
|
| 576 |
+
β β βββ global.css # Global styling
|
| 577 |
+
β βββ public/ # Static assets
|
| 578 |
+
β β βββ index.html # HTML template
|
| 579 |
+
β β βββ favicon.ico # Application icon
|
| 580 |
+
β βββ package.json # Node.js dependencies
|
| 581 |
+
β βββ .env.example # Environment variables template
|
| 582 |
+
β βββ .env # Environment configuration
|
| 583 |
+
βββ templates/ # Report generation templates
|
| 584 |
+
β βββ analysis/ # Analytics report templates
|
| 585 |
+
βββ hotels.csv # Database registry and passwords
|
| 586 |
+
βββ init_db.py # Database initialization with sample data
|
| 587 |
+
βββ create_empty_db.py # Empty database creation utility
|
| 588 |
+
βββ requirements.txt # Python dependencies
|
| 589 |
+
βββ run.py # Backend server launcher
|
| 590 |
+
βββ README.md # Project documentation
|
| 591 |
+
```
|
| 592 |
+
|
| 593 |
+
## π Quick Start Guide
|
| 594 |
+
|
| 595 |
+
### Prerequisites
|
| 596 |
|
| 597 |
+
#### For Windows:
|
| 598 |
+
- **Python 3.8+**: Download from [python.org](https://www.python.org/downloads/)
|
| 599 |
+
- **Node.js 16+**: Download from [nodejs.org](https://nodejs.org/downloads/)
|
| 600 |
+
- **Git**: Download from [git-scm.com](https://git-scm.com/downloads)
|
| 601 |
+
|
| 602 |
+
#### For macOS:
|
| 603 |
+
- **Python 3.8+**: Install via Homebrew: `brew install python3`
|
| 604 |
+
- **Node.js 16+**: Install via Homebrew: `brew install node`
|
| 605 |
+
- **Git**: Install via Homebrew: `brew install git`
|
| 606 |
+
|
| 607 |
+
### π§ Installation & Setup
|
| 608 |
+
|
| 609 |
+
#### 1. Clone the Repository
|
| 610 |
+
```bash
|
| 611 |
+
git clone <repository-url>
|
| 612 |
+
cd tabble
|
| 613 |
+
```
|
| 614 |
+
|
| 615 |
+
#### 2. Backend Setup
|
| 616 |
+
|
| 617 |
+
##### Windows:
|
| 618 |
+
```cmd
|
| 619 |
+
# Create virtual environment
|
| 620 |
+
python -m venv venv
|
| 621 |
+
|
| 622 |
+
# Activate virtual environment
|
| 623 |
+
venv\Scripts\activate
|
| 624 |
+
|
| 625 |
+
# Install dependencies
|
| 626 |
+
pip install -r requirements.txt
|
| 627 |
+
```
|
| 628 |
+
|
| 629 |
+
##### macOS/Linux:
|
| 630 |
+
```bash
|
| 631 |
+
# Create virtual environment
|
| 632 |
+
python3 -m venv venv
|
| 633 |
+
|
| 634 |
+
# Activate virtual environment
|
| 635 |
+
source venv/bin/activate
|
| 636 |
+
|
| 637 |
+
# Install dependencies
|
| 638 |
+
pip install -r requirements.txt
|
| 639 |
+
```
|
| 640 |
+
|
| 641 |
+
#### 3. Frontend Setup
|
| 642 |
+
|
| 643 |
+
##### Both Windows and macOS:
|
| 644 |
```bash
|
| 645 |
+
# Navigate to frontend directory
|
| 646 |
+
cd frontend
|
| 647 |
+
|
| 648 |
+
# Copy environment template
|
| 649 |
+
cp .env.example .env
|
| 650 |
+
|
| 651 |
+
# Install Node.js dependencies
|
| 652 |
+
npm install
|
| 653 |
+
```
|
| 654 |
+
|
| 655 |
+
#### 4. Configure Environment Variables
|
| 656 |
+
|
| 657 |
+
##### Backend (.env in root directory):
|
| 658 |
+
```env
|
| 659 |
+
SECRET_KEY=your_secret_key_here
|
| 660 |
+
```
|
| 661 |
+
|
| 662 |
+
##### Frontend (frontend/.env):
|
| 663 |
+
```env
|
| 664 |
+
# Backend API Configuration
|
| 665 |
+
REACT_APP_API_BASE_URL=http://localhost:8000
|
| 666 |
+
|
| 667 |
+
# Development settings
|
| 668 |
+
NODE_ENV=development
|
| 669 |
+
|
| 670 |
+
# Firebase Configuration (optional)
|
| 671 |
+
# REACT_APP_FIREBASE_API_KEY=your_firebase_api_key
|
| 672 |
+
# REACT_APP_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
|
| 673 |
+
# REACT_APP_FIREBASE_PROJECT_ID=your_project_id
|
| 674 |
+
```
|
| 675 |
+
|
| 676 |
+
## ποΈ Database Management
|
| 677 |
+
|
| 678 |
+
### Understanding the Multi-Database System
|
| 679 |
+
|
| 680 |
+
Tabble supports multiple independent hotel databases, allowing each hotel to operate with complete data isolation. Each database contains:
|
| 681 |
+
|
| 682 |
+
- **Dishes**: Menu items with pricing, categories, and images
|
| 683 |
+
- **Orders**: Customer orders and order items
|
| 684 |
+
- **Persons**: Customer information and visit history
|
| 685 |
+
- **Tables**: Table management and occupancy status
|
| 686 |
+
- **Loyalty Program**: Visit-based discount tiers
|
| 687 |
+
- **Selection Offers**: Amount-based promotional offers
|
| 688 |
+
- **Settings**: Hotel-specific configuration
|
| 689 |
+
- **Feedback**: Customer reviews and ratings
|
| 690 |
+
|
| 691 |
+
### Database Registry (hotels.csv)
|
| 692 |
+
|
| 693 |
+
The `hotels.csv` file serves as the central registry for all hotel databases:
|
| 694 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 695 |
```csv
|
| 696 |
hotel_database,password
|
| 697 |
+
tabble_new.db,myhotel
|
| 698 |
+
|
| 699 |
```
|
| 700 |
|
| 701 |
+
### Creating a New Hotel Database
|
| 702 |
|
| 703 |
+
#### Method 1: Using the create_empty_db.py Script
|
| 704 |
+
|
| 705 |
+
##### Windows:
|
| 706 |
+
```cmd
|
| 707 |
+
# Activate virtual environment
|
| 708 |
+
venv\Scripts\activate
|
| 709 |
+
|
| 710 |
+
# Run the database creation script
|
| 711 |
+
python create_empty_db.py
|
| 712 |
```
|
| 713 |
|
| 714 |
+
##### macOS/Linux:
|
| 715 |
+
```bash
|
| 716 |
+
# Activate virtual environment
|
| 717 |
+
source venv/bin/activate
|
| 718 |
|
| 719 |
+
# Run the database creation script
|
|
|
|
|
|
|
| 720 |
python create_empty_db.py
|
| 721 |
```
|
| 722 |
|
| 723 |
+
**Interactive Process:**
|
| 724 |
+
1. The script will prompt you for a database name
|
| 725 |
+
2. Enter the hotel name (without .db extension)
|
| 726 |
+
3. The script creates an empty database with proper schema
|
| 727 |
+
4. Manually add the database entry to `hotels.csv`
|
| 728 |
|
| 729 |
+
**Example:**
|
| 730 |
+
```
|
| 731 |
+
Creating a new empty database with the proper schema
|
| 732 |
+
Enter name for the new database (without .db extension): newhotel
|
|
|
|
| 733 |
|
| 734 |
+
Success! Created empty database 'newhotel.db' with the proper schema
|
| 735 |
+
```
|
| 736 |
|
| 737 |
+
Then add to `hotels.csv`:
|
| 738 |
+
```csv
|
| 739 |
+
newhotel.db,newhotel123
|
| 740 |
+
```
|
|
|
|
|
|
|
| 741 |
|
| 742 |
+
#### Method 2: Initialize with Sample Data
|
|
|
|
|
|
|
|
|
|
| 743 |
|
| 744 |
+
##### Windows:
|
| 745 |
+
```cmd
|
| 746 |
+
# Create database with sample data
|
| 747 |
+
python init_db.py
|
| 748 |
+
```
|
| 749 |
|
| 750 |
+
##### macOS/Linux:
|
| 751 |
+
```bash
|
| 752 |
+
# Create database with sample data
|
| 753 |
+
python init_db.py
|
| 754 |
+
```
|
| 755 |
|
| 756 |
+
**Note:** This creates `tabble_new.db` with sample dishes, users, and configuration.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 757 |
|
| 758 |
+
### Database Schema Details
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 759 |
|
| 760 |
+
The `create_empty_db.py` script creates the following tables:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 761 |
|
| 762 |
+
#### Core Tables:
|
| 763 |
+
- **dishes**: Menu items with pricing, categories, offers, and visibility
|
| 764 |
+
- **persons**: Customer profiles with visit tracking
|
| 765 |
+
- **orders**: Order management with status tracking
|
| 766 |
+
- **order_items**: Individual items within orders
|
| 767 |
+
- **tables**: Table management and occupancy status
|
| 768 |
|
| 769 |
+
#### Configuration Tables:
|
| 770 |
+
- **loyalty_program**: Visit-based discount configuration
|
| 771 |
+
- **selection_offers**: Amount-based promotional offers
|
| 772 |
+
- **settings**: Hotel information and branding
|
| 773 |
+
- **feedback**: Customer reviews and ratings
|
| 774 |
+
|
| 775 |
+
### Running the Application
|
| 776 |
+
|
| 777 |
+
#### Start Backend Server
|
| 778 |
+
|
| 779 |
+
##### Windows:
|
| 780 |
+
```cmd
|
| 781 |
+
# Activate virtual environment
|
| 782 |
+
venv\Scripts\activate
|
| 783 |
|
| 784 |
+
# Start the FastAPI server
|
| 785 |
+
python run.py
|
| 786 |
+
```
|
| 787 |
|
| 788 |
+
##### macOS/Linux:
|
| 789 |
+
```bash
|
| 790 |
+
# Activate virtual environment
|
| 791 |
+
source venv/bin/activate
|
| 792 |
|
| 793 |
+
# Start the FastAPI server
|
| 794 |
+
python run.py
|
| 795 |
+
```
|
|
|
|
| 796 |
|
| 797 |
+
The backend will be available at `http://localhost:8000`
|
| 798 |
|
| 799 |
+
#### Start Frontend Development Server
|
| 800 |
+
|
| 801 |
+
##### Both Windows and macOS:
|
| 802 |
+
```bash
|
| 803 |
+
# Navigate to frontend directory
|
| 804 |
+
cd frontend
|
| 805 |
+
|
| 806 |
+
# Start React development server
|
| 807 |
+
npm start
|
| 808 |
+
```
|
| 809 |
+
|
| 810 |
+
The frontend will be available at `http://localhost:3000`
|
| 811 |
+
|
| 812 |
+
### π API Documentation
|
| 813 |
+
|
| 814 |
+
Once the backend is running, access the interactive API documentation:
|
| 815 |
+
- **Swagger UI**: `http://localhost:8000/docs`
|
| 816 |
+
- **ReDoc**: `http://localhost:8000/redoc`
|
| 817 |
+
|
| 818 |
+
## π― Key Features Implementation
|
| 819 |
+
|
| 820 |
+
### π½οΈ Table Management
|
| 821 |
+
- **QR Code Generation**: Automatic QR code creation for each table
|
| 822 |
+
- **Real-time Status Monitoring**: Live table occupancy tracking
|
| 823 |
+
- **Session-based Occupancy**: Table status changes based on customer interaction
|
| 824 |
+
- **Multi-database Support**: Table management per hotel database
|
| 825 |
+
|
| 826 |
+
### π± Order Processing
|
| 827 |
+
- **Real-time Order Tracking**: Live order status updates across all interfaces
|
| 828 |
+
- **Kitchen Notifications**: Instant order notifications to chef dashboard
|
| 829 |
+
- **Status Synchronization**: Order status changes reflect immediately
|
| 830 |
+
- **Payment Integration**: Secure payment processing with loyalty discounts
|
| 831 |
+
|
| 832 |
+
### π Analytics and Reporting
|
| 833 |
+
- **Custom Report Templates**: Configurable analytics reports
|
| 834 |
+
- **PDF Generation**: Automated report exports
|
| 835 |
+
- **Performance Metrics**: Comprehensive business intelligence
|
| 836 |
+
- **Multi-dimensional Analysis**: Customer, dish, and chef performance tracking
|
| 837 |
+
|
| 838 |
+
### π Authentication & Security
|
| 839 |
+
- **Firebase Phone OTP**: Secure customer authentication
|
| 840 |
+
- **Database Password Protection**: Hotel database access control
|
| 841 |
+
- **Session Management**: Secure session handling across interfaces
|
| 842 |
+
- **Data Isolation**: Complete separation of hotel data
|
| 843 |
+
|
| 844 |
+
## π¨ Troubleshooting
|
| 845 |
+
|
| 846 |
+
### Common Issues
|
| 847 |
+
|
| 848 |
+
#### Backend Issues:
|
| 849 |
+
```bash
|
| 850 |
+
# If you get "Module not found" errors
|
| 851 |
+
pip install -r requirements.txt
|
| 852 |
+
|
| 853 |
+
# If database connection fails
|
| 854 |
+
python create_empty_db.py
|
| 855 |
+
|
| 856 |
+
# If port 8000 is already in use
|
| 857 |
+
# Edit run.py and change the port number
|
| 858 |
+
```
|
| 859 |
+
|
| 860 |
+
#### Frontend Issues:
|
| 861 |
+
```bash
|
| 862 |
+
# If npm install fails
|
| 863 |
+
npm cache clean --force
|
| 864 |
+
npm install
|
| 865 |
|
| 866 |
+
# If environment variables aren't loading
|
| 867 |
+
# Check that .env file exists in frontend directory
|
| 868 |
+
cp .env.example .env
|
| 869 |
+
|
| 870 |
+
# If API calls fail
|
| 871 |
+
# Verify REACT_APP_API_BASE_URL in frontend/.env
|
| 872 |
+
```
|
| 873 |
+
|
| 874 |
+
#### Database Issues:
|
| 875 |
+
```bash
|
| 876 |
+
# If database schema is outdated
|
| 877 |
+
python init_db.py --force-reset
|
| 878 |
+
|
| 879 |
+
# If hotels.csv is missing entries
|
| 880 |
+
# Manually add your database to hotels.csv
|
| 881 |
+
```
|
| 882 |
+
|
| 883 |
+
### Platform-Specific Notes
|
| 884 |
+
|
| 885 |
+
#### Windows:
|
| 886 |
+
- Use `venv\Scripts\activate` to activate virtual environment
|
| 887 |
+
- Use `python` command (not `python3`)
|
| 888 |
+
- Ensure Python is added to PATH during installation
|
| 889 |
+
|
| 890 |
+
#### macOS:
|
| 891 |
+
- Use `source venv/bin/activate` to activate virtual environment
|
| 892 |
+
- Use `python3` command for Python 3.x
|
| 893 |
+
- Install Xcode Command Line Tools if needed: `xcode-select --install`
|
| 894 |
+
|
| 895 |
+
## π Development Workflow
|
| 896 |
+
|
| 897 |
+
### Adding a New Hotel Database
|
| 898 |
+
|
| 899 |
+
1. **Create Empty Database:**
|
| 900 |
```bash
|
| 901 |
+
python create_empty_db.py
|
|
|
|
|
|
|
| 902 |
```
|
| 903 |
|
| 904 |
+
2. **Add to Registry:**
|
| 905 |
+
Edit `hotels.csv` and add your database entry:
|
| 906 |
+
```csv
|
| 907 |
+
yourhotel.db,yourpassword123
|
| 908 |
+
```
|
| 909 |
|
| 910 |
+
3. **Configure Hotel Settings:**
|
| 911 |
+
- Access admin panel: `http://localhost:3000/admin`
|
| 912 |
+
- Navigate to Settings
|
| 913 |
+
- Configure hotel information
|
| 914 |
|
| 915 |
+
4. **Add Menu Items:**
|
| 916 |
+
- Use admin panel to add dishes
|
| 917 |
+
- Upload dish images to `app/static/images/dishes/yourhotel/`
|
|
|
|
| 918 |
|
| 919 |
+
### Deployment Considerations
|
|
|
|
|
|
|
|
|
|
|
|
|
| 920 |
|
| 921 |
+
#### Production Environment Variables:
|
| 922 |
+
```env
|
| 923 |
+
# Backend
|
| 924 |
+
SECRET_KEY=your_production_secret_key
|
| 925 |
+
DATABASE_URL=your_production_database_url
|
| 926 |
+
|
| 927 |
+
# Frontend
|
| 928 |
+
REACT_APP_API_BASE_URL=https://your-domain.com/api
|
| 929 |
+
NODE_ENV=production
|
| 930 |
+
```
|
| 931 |
|
| 932 |
+
#### Image Storage:
|
| 933 |
+
- Images are stored in `app/static/images/dishes/{database_name}/`
|
| 934 |
+
- Ensure proper directory permissions for image uploads
|
| 935 |
+
- Consider using cloud storage for production deployments
|
| 936 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 937 |
|
|
|