238 lines
5.9 KiB
Markdown
Executable File
238 lines
5.9 KiB
Markdown
Executable File
# CKB - Bengkel Management System
|
|
|
|
Sistem manajemen bengkel yang dibangun dengan Laravel 8 dan menggunakan JavaScript inline untuk performa optimal.
|
|
|
|
## 🚀 Overview
|
|
|
|
Aplikasi ini menggunakan pendekatan JavaScript inline untuk menghindari kebutuhan build process di production server. Semua vendor assets sudah disalin ke folder `public` dan siap untuk deployment.
|
|
|
|
## 📦 Prerequisites
|
|
|
|
- PHP 8.1+
|
|
- Composer
|
|
- MySQL/MariaDB
|
|
- Redis (optional)
|
|
- Docker (optional)
|
|
|
|
## 🛠️ Installation
|
|
|
|
### Local Development
|
|
|
|
1. **Clone repository**
|
|
|
|
```bash
|
|
git clone <repository-url>
|
|
cd ckb
|
|
```
|
|
|
|
2. **Install PHP dependencies**
|
|
|
|
```bash
|
|
composer install
|
|
```
|
|
|
|
3. **Copy environment file**
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
php artisan key:generate
|
|
```
|
|
|
|
4. **Configure database**
|
|
|
|
```bash
|
|
# Edit .env file with your database credentials
|
|
php artisan migrate
|
|
php artisan db:seed
|
|
```
|
|
|
|
5. **Start development server**
|
|
```bash
|
|
php artisan serve
|
|
```
|
|
|
|
### Docker Development
|
|
|
|
```bash
|
|
# Build development image
|
|
docker build -f Dockerfile.dev -t ckb-dev .
|
|
|
|
# Run container
|
|
docker run -p 8080:80 ckb-dev
|
|
```
|
|
|
|
### Docker Production
|
|
|
|
```bash
|
|
# Build production image
|
|
docker build -f Dockerfile -t ckb-prod .
|
|
|
|
# Run container
|
|
docker run -p 8080:80 ckb-prod
|
|
```
|
|
|
|
## 🐳 Docker Optimization
|
|
|
|
### ⚡ Optimizations Made
|
|
|
|
1. **Removed Node.js Dependencies**
|
|
|
|
- ❌ `nodejs` dan `npm` tidak lagi diinstall di container
|
|
- ✅ Mengurangi ukuran image sekitar 200-300MB
|
|
- ✅ Build time lebih cepat
|
|
|
|
2. **No JavaScript Compilation**
|
|
|
|
- ❌ Tidak ada `npm install` atau `npm run production`
|
|
- ✅ Vendor assets sudah ada di `public/js/vendor/` dan `public/css/vendor/`
|
|
- ✅ Library diakses langsung dari file yang sudah di-minify
|
|
|
|
3. **Optimized .dockerignore**
|
|
|
|
- ❌ Exclude `node_modules/`, `package.json`, `webpack.mix.js`
|
|
- ✅ Keep vendor assets di `public/` folder
|
|
- ✅ Mengurangi build context size
|
|
|
|
4. **Better Layer Caching**
|
|
- ✅ Copy `composer.json` terlebih dahulu
|
|
- ✅ Install PHP dependencies sebelum copy source code
|
|
- ✅ Cache layer untuk composer dependencies
|
|
|
|
### 📊 Performance Improvements
|
|
|
|
| Metric | Before | After | Improvement |
|
|
| ------------ | ------------- | -------- | ----------- |
|
|
| Image Size | ~800MB | ~500MB | -37.5% |
|
|
| Build Time | ~5-8 min | ~2-3 min | -60% |
|
|
| Dependencies | Node.js + PHP | PHP only | -50% |
|
|
|
|
## 📁 Project Structure
|
|
|
|
```
|
|
ckb/
|
|
├── app/
|
|
│ ├── Http/
|
|
│ │ ├── Controllers/
|
|
│ │ └── Requests/
|
|
│ ├── Models/
|
|
│ └── Services/
|
|
├── resources/
|
|
│ ├── views/
|
|
│ │ ├── layouts/
|
|
│ │ │ ├── frontapp.blade.php
|
|
│ │ │ └── backapp.blade.php
|
|
│ │ └── transaction/
|
|
│ └── sass/
|
|
├── public/
|
|
│ ├── js/
|
|
│ │ ├── vendor/
|
|
│ │ │ ├── jquery.dataTables.min.js
|
|
│ │ │ ├── dataTables.bootstrap4.min.js
|
|
│ │ │ ├── sweetalert2.min.js
|
|
│ │ │ ├── chart.umd.js
|
|
│ │ │ └── ...
|
|
│ │ └── bootstrap-datepicker.min.js
|
|
│ └── css/
|
|
│ ├── vendor/
|
|
│ │ ├── dataTables.bootstrap4.min.css
|
|
│ │ ├── sweetalert2.min.css
|
|
│ │ └── ...
|
|
│ └── bootstrap-datepicker.min.css
|
|
└── docker/
|
|
├── Dockerfile
|
|
├── Dockerfile.dev
|
|
└── nginx.conf
|
|
```
|
|
|
|
## 🎯 Key Features
|
|
|
|
### Frontend (Mobile App)
|
|
|
|
- **Camera Integration** - Foto precheck dan postcheck dengan kontrol penuh
|
|
- **File Upload** - Support hingga 20MB
|
|
- **Responsive Design** - Optimized untuk mobile devices
|
|
- **Real-time Updates** - WebSocket integration
|
|
|
|
### Backend (Admin Panel)
|
|
|
|
- **Transaction Management** - Manajemen transaksi bengkel
|
|
- **KPI Tracking** - Sistem KPI dengan perhitungan otomatis
|
|
- **DataTables** - Tabel data dengan fitur advanced
|
|
- **Chart.js** - Visualisasi data dan laporan
|
|
- **SweetAlert2** - Notifikasi yang user-friendly
|
|
|
|
### Warehouse Management
|
|
|
|
- **Stock Audit** - Audit stok dengan filter advanced
|
|
- **Mutations** - Mutasi antar dealer
|
|
- **Opnames** - Penghitungan stok
|
|
- **Product Management** - Manajemen produk dan kategori
|
|
|
|
## 🔧 Technology Stack
|
|
|
|
### Backend
|
|
|
|
- **Laravel 8** - PHP Framework
|
|
- **MySQL/MariaDB** - Database
|
|
- **Redis** - Cache & Session
|
|
- **PHP 8.1** - Runtime
|
|
|
|
### Frontend
|
|
|
|
- **Bootstrap 4** - CSS Framework
|
|
- **jQuery** - JavaScript Library
|
|
- **DataTables** - Table Enhancement
|
|
- **Chart.js** - Chart Library
|
|
- **SweetAlert2** - Alert Library
|
|
- **Bootstrap Datepicker** - Date Picker
|
|
|
|
### DevOps
|
|
|
|
- **Docker** - Containerization
|
|
- **Nginx** - Web Server
|
|
- **Supervisor** - Process Management
|
|
|
|
## 🚨 Important Notes
|
|
|
|
1. **Vendor assets sudah ada di folder `public/`** dan akan di-push ke git
|
|
2. **Tidak perlu npm install di production server**
|
|
3. **Semua JavaScript sudah inline** di Blade templates
|
|
4. **CSS masih perlu dikompilasi** jika ada perubahan di `resources/sass/`
|
|
|
|
## 🔧 Troubleshooting
|
|
|
|
### Docker Build Issues
|
|
|
|
```bash
|
|
# Gunakan Docker BuildKit untuk build lebih cepat
|
|
export DOCKER_BUILDKIT=1
|
|
docker build -f Dockerfile -t ckb-prod .
|
|
```
|
|
|
|
### Vendor Assets Missing
|
|
|
|
Pastikan folder `public/js/vendor/` dan `public/css/vendor/` sudah ada dan berisi file-file yang diperlukan.
|
|
|
|
### Database Issues
|
|
|
|
```bash
|
|
# Clear cache
|
|
php artisan cache:clear
|
|
php artisan config:clear
|
|
|
|
# Recreate database
|
|
php artisan migrate:fresh --seed
|
|
```
|
|
|
|
## 📝 License
|
|
|
|
This project is licensed under the MIT License.
|
|
|
|
## 🤝 Contributing
|
|
|
|
1. Fork the repository
|
|
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
5. Open a Pull Request
|