# Azan Shinwari Restaurant Menu SQL Files

This directory contains SQL files to import the complete menu for Azan Shinwari Restaurant.

## Files

### Azan Shinwari Restaurant Menu (warehouse_id = 1)
1. **01_menu_categories.sql** - Inserts all menu categories for warehouse_id = 1
2. **02_menu_items.sql** - Inserts all menu items with their prices for warehouse_id = 1

### Mess Menu (warehouse_id = 2)
3. **03_mess_menu_categories.sql** - Inserts all Mess menu categories for warehouse_id = 2
4. **04_mess_menu_items.sql** - Inserts all Mess menu items with their prices for warehouse_id = 2

## How to Use

### Option 1: Using MySQL Command Line

```bash
# Connect to your database
mysql -u your_username -p your_database_name

# Run the SQL files in order for Azan Shinwari (warehouse_id = 1)
source database/seeds/azan_shinwari_menu/01_menu_categories.sql
source database/seeds/azan_shinwari_menu/02_menu_items.sql

# Run the SQL files in order for Mess Menu (warehouse_id = 2)
source database/seeds/azan_shinwari_menu/03_mess_menu_categories.sql
source database/seeds/azan_shinwari_menu/04_mess_menu_items.sql
```

### Option 2: Using Laravel Artisan

```bash
# Import categories
php artisan db:seed --class=DatabaseSeeder
# Or import directly using DB facade in a seeder

# Or use raw SQL execution
php artisan tinker
>>> DB::unprepared(file_get_contents('database/seeds/azan_shinwari_menu/01_menu_categories.sql'));
>>> DB::unprepared(file_get_contents('database/seeds/azan_shinwari_menu/02_menu_items.sql'));
>>> DB::unprepared(file_get_contents('database/seeds/azan_shinwari_menu/03_mess_menu_categories.sql'));
>>> DB::unprepared(file_get_contents('database/seeds/azan_shinwari_menu/04_mess_menu_items.sql'));
```

### Option 3: Using phpMyAdmin or Database Tool

1. Open phpMyAdmin or your preferred database management tool
2. Select your database
3. Go to the SQL tab
4. **For Azan Shinwari Menu (warehouse_id = 1):**
   - Copy and paste the contents of `01_menu_categories.sql` and execute
   - Copy and paste the contents of `02_menu_items.sql` and execute
5. **For Mess Menu (warehouse_id = 2):**
   - Copy and paste the contents of `03_mess_menu_categories.sql` and execute
   - Copy and paste the contents of `04_mess_menu_items.sql` and execute

## Important Notes

- **warehouse_id = 1**: All categories and items in files 01 and 02 are set with `warehouse_id = 1` (Azan Shinwari Restaurant)
- **warehouse_id = 2**: All categories and items in files 03 and 04 are set with `warehouse_id = 2` (Mess Menu)
- **Price Variants**: Items with multiple prices (Small/Medium/Large, Half/Full) are created as separate menu item entries
  - Example: "BBQ Pizza - Small", "BBQ Pizza - Medium", "BBQ Pizza - Large"
- **Quantity-based Items**: Items with quantity specifications are included in the name
  - Example: "Chicken Malai Boti (10 pcs)"
- **All items are set as available**: `is_available = 1` for all menu items
- **All categories are active**: `status = 1` for all categories

## Menu Categories

### Azan Shinwari Restaurant (warehouse_id = 1)
1. DRINK Bar (5 items)
2. TEA Bar (9 items)
3. ICE CREAM Shakes (8 items)
4. ICE CREAM Scoops (5 items)
5. MOCKTAIL (9 items)
6. FRAPPE (11 items)
7. TANDOOR (8 items)
8. SALAD Bar (6 items)
9. BAR B.Q (17 items)
10. STARTER (8 items)
11. HANDI Special (17 items with Half/Full variants)
12. SHINWARI (19 items with Half/Full variants)
13. TAKA TAK (10 items with Half/Full variants)
14. PIZZA (30 items - 10 pizza types × 3 sizes each)
15. SANDWICH (5 items)
16. BURGER (7 items)

**Total: Approximately 185+ menu items across 16 categories**

### Mess Menu (warehouse_id = 2)
1. Mess-1 Lunch (7 items @ Rs. 200 each)
2. Mess-1 Dinner (7 items @ Rs. 200 each)
3. Mess-2 Lunch (7 items @ Rs. 200 each)
4. Mess-2 Dinner (7 items @ Rs. 200 each)
5. Paratha & Sides (7 items)
6. Chai (4 items)
7. Specialty Drinks (2 items)
8. KARAHI (18 items - 9 karahi types × 2 portions each)
9. HANDI Special (6 items)
10. TAWA DISH (14 items - some with Full/Half variants)
11. BAR B.Q (12 items)
12. DESI FOOD (14 items)
13. Beverages (5 items)

**Total: Approximately 120+ menu items across 13 categories**

## Verification

After importing, verify the data:

```sql
-- Check categories for warehouse_id = 1 (Azan Shinwari)
SELECT COUNT(*) FROM restaurant_menu_categories WHERE warehouse_id = 1;
-- Should return 16

-- Check menu items for warehouse_id = 1
SELECT COUNT(*) FROM pos_menu_items WHERE warehouse_id = 1;
-- Should return approximately 185+

-- Check categories for warehouse_id = 2 (Mess Menu)
SELECT COUNT(*) FROM restaurant_menu_categories WHERE warehouse_id = 2;
-- Should return 13

-- Check menu items for warehouse_id = 2
SELECT COUNT(*) FROM pos_menu_items WHERE warehouse_id = 2;
-- Should return approximately 120+

-- Check items by category for warehouse_id = 1
SELECT 
    rmc.name AS category_name,
    COUNT(pmi.id) AS item_count
FROM restaurant_menu_categories rmc
LEFT JOIN pos_menu_items pmi ON pmi.restaurant_category_id = rmc.id
WHERE rmc.warehouse_id = 1
GROUP BY rmc.id, rmc.name
ORDER BY rmc.sort_order;

-- Check items by category for warehouse_id = 2
SELECT 
    rmc.name AS category_name,
    COUNT(pmi.id) AS item_count
FROM restaurant_menu_categories rmc
LEFT JOIN pos_menu_items pmi ON pmi.restaurant_category_id = rmc.id
WHERE rmc.warehouse_id = 2
GROUP BY rmc.id, rmc.name
ORDER BY rmc.sort_order;
```

## Troubleshooting

If you encounter errors:

1. **Foreign key constraint errors**: Make sure `warehouse_id = 1` and `warehouse_id = 2` exist in the `warehouses` table
2. **Duplicate entry errors**: The categories or items may already exist. You can:
   - Delete existing data first: 
     ```sql
     DELETE FROM pos_menu_items WHERE warehouse_id = 1; 
     DELETE FROM restaurant_menu_categories WHERE warehouse_id = 1;
     DELETE FROM pos_menu_items WHERE warehouse_id = 2; 
     DELETE FROM restaurant_menu_categories WHERE warehouse_id = 2;
     ```
   - Or modify the SQL to use `INSERT IGNORE` or `ON DUPLICATE KEY UPDATE`
3. **Category ID errors**: Make sure to run category SQL files before menu items SQL files:
   - Run `01_menu_categories.sql` before `02_menu_items.sql`
   - Run `03_mess_menu_categories.sql` before `04_mess_menu_items.sql`

