<p align="center">
  <img width="320" src="https://cp5.sgp1.cdn.digitaloceanspaces.com/zoro/laravue-cdn/laravue-logo-line.png">
</p>
<p align="center">
  <a href="https://laravel.com">
    <img src="https://img.shields.io/badge/laravel-7.3-brightgreen.svg" alt="vue">
  </a>
  <a href="https://github.com/vuejs/vue">
    <img src="https://img.shields.io/badge/vue-2.6.10-brightgreen.svg" alt="vue">
  </a>
  <a href="https://github.com/ElemeFE/element">
    <img src="https://img.shields.io/badge/element--ui-2.13.0-brightgreen.svg" alt="element-ui">
  </a>
  <a href="https://github.com/tranducliem/blob/master/LICENSE">
    <img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="license">
  </a>
</p>

# Laravue
[Laravue](https://laravue.dev) (pronounced /ˈlarəvjuː/) is a beautiful dashboard combination of [Laravel](https://laravel.com/), [Vue.js](https://github.com/vuejs/vue) and the UI Toolkit [Element](https://github.com/ElemeFE/element). The work is inspired by  [vue-element-admin](http://panjiachen.github.io/vue-element-admin) with our love on top of that. With the powerful Laravel framework as the backend, Vue.js as the high performance on the frontend,  Laravue appears to be a full-stack solution for an enterprise application level.

Documentation: [https://doc.laravue.dev](https://doc.laravue.dev)

## Screenshot
<p align="center">
  <img width="900" src="https://cdn.laravue.dev/screenshot.png">
</p>

## Getting started

### Prerequisites

 * Laravue is positioned as an enterprise management solution, and it is highly recommended to use it to start from scratch.
 * For existing Laravel project, you should check [Laravue Core](https://github.com/tranducliem-core) for integration.
 * Your machine needs to be ready for the latest [Laravel](https://laravel.com/docs/6.x#installation) and [Node.js](https://nodejs.org).


### Installing
#### Manual

```bash
# Clone the project and run composer
composer create-project tuandm/laravue
cd laravue

# Migration and DB seeder (after changing your DB settings in .env)
php artisan migrate --seed

# Install dependency with NPM
npm install

# develop
npm run dev # or npm run watch

# Build on production
npm run production
```

#### Docker
```sh
docker-compose up -d
```
Build static files within Laravel container with npm
```sh
# Get laravel docker container ID from containers list
docker ps

docker exec -it <container ID> npm run dev # or npm run watch
# Where <container ID> is the "laravel" container name, ex: src_laravel_1
```
Open http://localhost:8000 (laravel container port declared in `docker-compose.yml`) to access Laravue

## Running the tests
* Tests system is under development

## Deployment and/or CI/CD
This project uses [Envoy](https://laravel.com/docs/5.8/envoy) for deployment, and [GitLab CI/CD](https://about.gitlab.com/product/continuous-integration/). Please check `Envoy.blade.php` and `.gitlab-ci.yml` for more detail.

## Built with
* [Laravel](https://laravel.com/) - The PHP Framework For Web Artisans
* [Laravel Sanctum](https://github.com/laravel/sanctum/) - Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs.
* [spatie/laravel-permission](https://github.com/spatie/laravel-permission) - Associate users with permissions and roles.
* [VueJS](https://vuejs.org/) - The Progressive JavaScript Framework
* [Element](https://element.eleme.io/) - A  Vue 2.0 based component library for developers, designers and product managers
* [Vue Admin Template](https://github.com/PanJiaChen/vue-admin-template) - A minimal vue admin template with Element UI

## Contributing

Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.

## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, please look at the [release tags](https://github.com/tranducliem/tags) on this repository.

## Authors

* **Tuan Duong** - *Initial work* - [tuandm](https://github.com/tuandm).
* **Tony Tin Nguyen** - *Frontend and Designer* - [nguyenquangtin](https://github.com/nguyenquangtin).

See also the list of [contributors](https://github.com/tranducliem/contributors) who participated in this project.

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE) file for details.

## Related projects

* [Laravue-core](https://github.com/tranducliem-core) - Laravel package which provides core functionalities of Laravue.

## Acknowledgements

* [vue-element-admin](https://panjiachen.github.io/vue-element-admin/#/) A magical vue admin which insprited Laravue project.
* [tui.editor](https://github.com/nhnent/tui.editor) - Markdown WYSIWYG Editor.
* [Echarts](http://echarts.apache.org/) - A powerful, interactive charting and visualization library for browser.

## Donate
If you find this project useful, you can [buy me a coffee](https://www.buymeacoffee.com/tuandm)

---

# Moro - Kirei Rental Platform

## Cấu hình Server Production

### Cron Job (Laravel Scheduler)

Hệ thống sử dụng Laravel Scheduler để chạy các tác vụ tự động. **Bắt buộc** phải cài đặt cron job trên server production.

#### Cài đặt Cron Job

```bash
# Mở crontab editor
crontab -e

# Thêm dòng sau:
* * * * * cd /var/www/html/moro && php artisan schedule:run >> /dev/null 2>&1
```

Hoặc tạo file `/etc/cron.d/moro-scheduler`:
```bash
* * * * * www-data cd /var/www/html/moro && php artisan schedule:run >> /dev/null 2>&1
```

#### Các tác vụ được lên lịch

| Command | Tần suất | Mô tả |
|---------|----------|-------|
| `orders:cancel-expired-provisional --sync` | Mỗi giờ | Tự động hủy đơn hàng tạm thời (provisional) khi quá hạn 3 ngày mà user chưa xác minh danh tính |

#### Kiểm tra hoạt động

```bash
# Xem log của cron job
tail -f /var/www/html/moro/storage/logs/cancel-expired-orders.log

# Chạy thủ công để test
php artisan orders:cancel-expired-provisional --sync
```

### Queue Worker

Nếu sử dụng queue cho background jobs (face swap, email, etc.):

```bash
# Chạy queue worker
php artisan queue:work --queue=high,default

# Hoặc sử dụng Supervisor (khuyến nghị cho production)
# Tạo file /etc/supervisor/conf.d/moro-worker.conf
```

### Identity Verification System

Hệ thống xác minh danh tính có các thông số cấu hình:

| Constant | Giá trị | Mô tả |
|----------|---------|-------|
| `PROVISIONAL_EXPIRATION_DAYS` | 3 | Số ngày hết hạn đơn hàng tạm thời |
| `RESUBMISSION_EXPIRATION_DAYS` | 2 | Số ngày để nộp lại sau khi bị reject |
| `MAX_REJECTION_COUNT` | 2 | Số lần reject tối đa trước khi auto-cancel |

**Logic xử lý:**
1. User đặt hàng → Tạo đơn provisional với `provisional_expires_at = now + 3 ngày`
2. Nếu sau 3 ngày chưa submit identity → Auto-cancel đơn hàng
3. Nếu bị reject lần 1 → Gia hạn thêm 2 ngày để resubmit
4. Nếu bị reject lần 2 → Auto-cancel đơn hàng ngay lập tức
