# Warehouse Management System (WMS)

A modern, mobile-friendly Warehouse Management System built with React + Laravel, designed for cPanel deployment.

## Features

- 📦 **Inbound & Outbound Management**: Complete control over stock movements
- 📱 **Mobile-First Design**: Optimized for use on smartphones and tablets
- 📷 **Barcode Scanning**: Scan barcodes directly using your device camera
- 🔄 **FIFO Inventory**: First-In-First-Out stock management system
- 🏭 **Multi-Warehouse Support**: Manage multiple warehouses and locations
- 🔍 **Smart Search**: Search items by barcode, name, item code, or batch number
- 📊 **Dashboard & Reports**: Real-time insights and comprehensive reports
- 📋 **Stock Opname**: Easy physical stock verification
- 👥 **Role-Based Access**: Admin, Supervisor, and Staff roles
- 📝 **Audit Trail**: Complete history of all actions

## Tech Stack

### Frontend
- React 18 + TypeScript
- Vite
- Tailwind CSS
- React Router
- React Query
- Lucide Icons
- Recharts

### Backend
- Laravel 11
- PHP 8.2+
- MySQL/MariaDB
- Laravel Sanctum (API Authentication)

## Project Structure

```
gudang_strange/
├── backend/          # Laravel API
│   ├── app/
│   │   ├── Http/Controllers/
│   │   └── Models/
│   ├── database/
│   │   ├── migrations/
│   │   └── seeders/
│   └── routes/
└── frontend/         # React Application
    ├── src/
    │   ├── components/
    │   └── pages/
    └── public/
```

## Local Development

### Prerequisites
- PHP 8.2+
- Composer
- Node.js 18+
- MySQL/MariaDB

### Backend Setup

1. Navigate to the backend folder:
   ```bash
   cd backend
   ```

2. Install dependencies:
   ```bash
   composer install
   ```

3. Copy `.env.example` to `.env` and configure your database:
   ```bash
   cp .env.example .env
   ```

4. Generate application key:
   ```bash
   php artisan key:generate
   ```

5. Run migrations and seeders:
   ```bash
   php artisan migrate --seed
   ```

6. Start the development server:
   ```bash
   php artisan serve
   ```

The backend will be available at `http://localhost:8000`

### Frontend Setup

1. Navigate to the frontend folder:
   ```bash
   cd frontend
   ```

2. Install dependencies:
   ```bash
   npm install
   ```

3. Create a `.env.local` file:
   ```env
   VITE_API_BASE_URL=http://localhost:8000/api
   ```

4. Start the development server:
   ```bash
   npm run dev
   ```

The frontend will be available at `http://localhost:5173`

## Deployment

For detailed deployment instructions for cPanel, see [DEPLOYMENT.md](./DEPLOYMENT.md).

## Usage

### Default Credentials

- **Username**: admin
- **Password**: password

### Key Features

1. **Dashboard**: Overview of warehouse operations, KPIs, and charts
2. **Inbound**: Receive items into the warehouse using barcode scan or manual entry
3. **Outbound**: Dispatch items using FIFO method
4. **Search Item**: Find items and their locations quickly
5. **Stock Opname**: Perform physical stock verification

## API Endpoints

### Authentication
- `POST /api/login` - User login
- `POST /api/logout` - User logout (requires auth)
- `GET /api/user` - Get current user (requires auth)

### Items
- `GET /api/items` - List items
- `POST /api/items` - Create item
- `GET /api/items/{id}` - Show item
- `PUT /api/items/{id}` - Update item
- `DELETE /api/items/{id}` - Delete item

### Inbound
- `GET /api/inbound` - List inbound transactions
- `POST /api/inbound` - Create inbound transaction
- `GET /api/inbound/{id}` - Show inbound transaction

### Outbound
- `GET /api/outbound` - List outbound transactions
- `POST /api/outbound` - Create outbound transaction
- `GET /api/outbound/{id}` - Show outbound transaction

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License.
