# Eholotes.eu Project Setup Guide

This guide will walk you through the process of setting up the "eholotes.eu" project locally using Laravel Sail.
Follow these steps to get your environment up and running.

# Requirements

Before you begin, ensure you have the following tools installed on your local machine:

- [Git](https://git-scm.com/)
- [Composer](https://getcomposer.org/)

The development environment for the "eholotes.eu" project will be seamlessly configured using Laravel Sail, which
includes the following components:

- Laravel 10
- PHP 8.2
- Node.js (v18.16.1)
- npm 9.7.2

You won't need to worry about installing these dependencies individually, as Laravel Sail will handle their setup for
you.

## Getting Started

To install the project, you can follow these steps:

Clone the project repository:

```
git clone https://github.com/vdisain/eholotes.git
```

Navigate to the project directory:

```
cd eholotes
```

Install project dependencies using Composer:

```
composer install
```

Copy the .env.example file to .env, for development and production credentials, you can access them <b>[here](https://docs.google.com/spreadsheets/d/1VzbGkPa4ye0_hoDxdr25jJbWJYRbg-ezJzogq4OJ8HY/edit#gid=0)</b>.


```
cp .env.example .env
```


Run Laravel Sail in the background:

```
./vendor/bin/sail up -d
```

Generate a new application key:

```
./vendor/bin/sail artisan key:generate
```

Create a symbolic link to the storage directory:

```
./vendor/bin/sail artisan storage:link
```

Run migrations and seed the database with default data:

```
./vendor/bin/sail artisan migrate --seed
```

The `--seed` option will run the database seeds, which will populate the database with test data.

To seed test data, run the following command:

```
./vendor/bin/sail artisan db:seed --class=DevDatabaseSeeder
```

The DevDatabaseSeeder seeder class contains the necessary logic to generate test data for products, categories, and
manufacturers, which are commonly used entities in an e-commerce application.

Synchronize Omniva, DPD lockers:

```
./vendor/bin/sail artisan shipping:sync-omniva-lockers
```
```
./vendor/bin/sail artisan shipping:sync-dpd-lockers
```

If you need to import all the translations from your Laravel application's lang directory to the database, you can use
the following command:

```
./vendor/bin/sail artisan translations:import
```

By importing translations into the database, you can easily manage translations using a database management tool:
`127.0.0.1/adm/translations`

# Shop Theme

To work with the shop theme, use the following commands:

Install "__shop__" theme dependencies

```
./vendor/bin/sail npm install --prefix resources/shop
```

Build "__shop__" theme for production

```
./vendor/bin/sail npm run prod --prefix resources/shop
```

# Admin Theme

To work with the admin theme, use the following commands:

Install "__admin__" theme dependencies

```
./vendor/bin/sail npm install --prefix resources/admin
```

Build "__admin__" theme for production

```
./vendor/bin/sail npm run prod --prefix resources/admin
```

## Importing Code Style Settings in PhpStorm

To ensure consistent code formatting across the project, we have provided code style settings for PhpStorm. Follow the
steps below to import these settings:

1. Make sure you have PhpStorm installed on your machine. If you don't have it, you can download and install it from the
   official website: [PHPStorm](https://www.jetbrains.com/phpstorm/)
2. Once PhpStorm is installed, open the project in the IDE.
3. In the project directory, locate the app/CodeStyle directory. This directory contains the code style configuration
   files.
4. Open PhpStorm and go to File -> Settings (or Preferences on macOS) to open the PhpStorm settings.
5. In the left-hand pane of the settings window, expand the Editor section and click on Code Style.
6. In the top-right corner, click on the gear icon and choose Import Scheme -> IntelliJ IDEA code style XML.
7. In the file browser window, navigate to the project's app/CodeStyle directory and select the Default.xml file.
8. Click on OK to import the code style settings.
9. Restart PhpStorm to apply the imported code style settings.

The code style settings will now be applied to your code whenever you format it using PhpStorm's code formatting
features.

## Console Commands

...

## Translations

...

## Admin Panel

To access the admin panel, go to `127.0.0.1/adm/login` on the server. There are two roles available: admin, which has
all permissions, and manager, which has restricted permissions.
Admin: `login:vladimirs@cunami.lv`, `password:telescopes2023!`
