# 📦 Guide: How to Copy & Run this Project on Another Computer

This project (**Rental Stock - Smart Warehouse Management System**) is fully configured to be copied and run on any Windows computer.

---

## ⚡ Quick Start (1-Click Automated Setup)

If the new computer has **XAMPP** installed:

1. **Copy the folder**:
   - Copy the entire `Management-warehouse` folder to the new computer (for example to `C:\xampp\htdocs\Management-warehouse` or any folder on Desktop / D: drive).

2. **Start MySQL in XAMPP**:
   - Open **XAMPP Control Panel** and click **Start** next to **MySQL** (and Apache if needed).

3. **Run 1-Click Setup**:
   - Double-click **`SETUP_PROJECT.bat`** in the project folder.
   - It will automatically:
     - Create `.env` from `.env.example`
     - Generate `APP_KEY`
     - Link storage (`php artisan storage:link`)
     - Import the full database and sample data from `database/rental_stock.sql`
     - Clear and optimize application cache

4. **Start the System**:
   - Double-click **`START_PROJECT.bat`**.
   - Your web browser will automatically open to **`http://localhost:8000`**!

---

## 🔑 Default Login Accounts

| Role | Email | Password | Permissions |
| :--- | :--- | :--- | :--- |
| **Administrator** | `admin@rental.com` | `password` | Full system access, settings, user management |
| **Manager** | `manager@rental.com` | `password` | Approvals, inventory management, reports |
| **Staff** | `staff@rental.com` | `password` | Barcode/QR scanning, stock verification, audits |

---

## 🛠 Manual Setup Instructions (If doing step-by-step)

If you prefer doing each step manually in CMD or PowerShell:

### 1. Database Import
- Open your browser to [http://localhost/phpmyadmin](http://localhost/phpmyadmin).
- Click **Import** in the top menu.
- Choose file: `database/rental_stock.sql` and click **Import**.
*(The database `rental_stock` with all 19 tables will be created automatically).*

### 2. Configure Environment (`.env`)
- If `.env` is missing, copy `.env.example` to `.env`:
  ```cmd
  copy .env.example .env
  ```
- Generate an application key:
  ```cmd
  php artisan key:generate
  ```

### 3. Create Storage Link & Clear Cache
  ```cmd
  php artisan storage:link
  php artisan config:clear
  php artisan route:clear
  php artisan view:clear
  ```

### 4. Run Laravel Server
  ```cmd
  php artisan serve
  ```
- Visit `http://127.0.0.1:8000` in your web browser.

---

## 🖨 QR Code & Barcode Features

- **Composer Package**: `simplesoftwareio/simple-qrcode` is installed in `composer.json` and `vendor/`.
- **Backend Route**: `GET /qr-code/generate?text=...&size=96` (generates native crisp SVG QR codes on the fly).
- **Client-Side Library**: `public/js/qrcode.min.js` is bundled locally in the project, so QR codes generate **100% offline** with zero internet connection required.
- **Fail-Safe Fallback**: If browser JavaScript is ever disabled or restricted, the frontend automatically falls back to fetching the QR code from the Composer backend endpoint.
- **Printing & Exporting**:
  - Modal provides **Barcode PNG**, **QR PNG**, and **Print Label** sticker layouts.
  - Prep sheet prints bulk QR codes for warehouse racks, zones, master crates, and equipment serials.

---

## 📁 Portable Composer & Dependencies

- `composer.phar` and `composer.bat` are bundled directly inside the project root.
- If you need to run Composer commands on a PC where Composer is not globally installed, you can simply run:
  ```cmd
  .\composer.bat install
  ```
  or
  ```cmd
  php composer.phar [command]
  ```
