Compare commits

..

No commits in common. "master" and "shift-build-2463" have entirely different histories.

22 changed files with 13555 additions and 11175 deletions

10
.env.example Executable file → Normal file
View File

@ -1,11 +1,8 @@
APP_NAME="Your SwissCar GmbH - AutoManager" APP_NAME="Your SwissCar GmbH - AutoManager"
APP_ENV=local APP_ENV=local
APP_KEY=
APP_DEBUG=true APP_DEBUG=true
APP_URL=http://automngr.test APP_URL=http://automngr.test
APP_PORT=80
USER_1_EMAIL=test@salloum.pm
USER_1_PW=abc123
LOG_CHANNEL=stack LOG_CHANNEL=stack
LOG_LEVEL=debug LOG_LEVEL=debug
@ -14,9 +11,8 @@ DB_CONNECTION=mysql
DB_HOST=mysql DB_HOST=mysql
DB_PORT=3306 DB_PORT=3306
DB_DATABASE=automngr DB_DATABASE=automngr
DB_USERNAME="sail" DB_USERNAME=sail
DB_PASSWORD="password" DB_PASSWORD=password
FORWARD_DB_PORT=3306
BROADCAST_DRIVER=log BROADCAST_DRIVER=log
CACHE_DRIVER=file CACHE_DRIVER=file

View File

@ -1,53 +0,0 @@
name: PHP Composer
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build --if-present
- name: Laravel mix
run: mix --production
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md
# - name: Run test suite
# run: composer run-script test

View File

@ -11,16 +11,9 @@ Running on Laravel 8
Prerequisites: Prerequisites:
- [Docker](https://docker.com) installed and running - [Docker](https://docker.com) installed and running
- Docker compose installed
- Composer installed
- PHP installed
Steps: Steps:
1. copy .env.example to .env 1. copy .env.example to .env
2. add user credentials in .env
2. run `composer update --ignore-platform-reqs`
3. run `composer install --ignore-platform-reqs`
1. run `./vendor/bin/sail php artisan key:generate`
2. start app by running `./vendor/bin/sail up` inside the main directory (or configure a bash alias: `alias sail='bash vendor/bin/sail'`) then you can use `sail up` 2. start app by running `./vendor/bin/sail up` inside the main directory (or configure a bash alias: `alias sail='bash vendor/bin/sail'`) then you can use `sail up`
3. Run migrations and seed db: `sail php artisan migrate:fresh --seed` 3. Run migrations and seed db: `sail php artisan migrate:fresh --seed`
4. `sail npm run watch` 4. `sail npm run watch`

View File

@ -24,6 +24,4 @@ final class InsuranceType extends Enum
const FiveStar = '4'; const FiveStar = '4';
const FiveStarPlus = '5'; const FiveStarPlus = '5';
const Ja = '6';
} }

View File

@ -73,10 +73,10 @@ class CarController extends Controller
'known_damage' => $car->known_damage, 'known_damage' => $car->known_damage,
'seller' => $bcontract ? $bcontract->contact->full_title : null, 'seller' => $bcontract ? $bcontract->contact->full_title : null,
'buy_date' => $bcontract ? $bcontract->date_formatted : null, 'buy_date' => $bcontract ? $bcontract->date_formatted : null,
'price' => $bcontract ? $bcontract->price_for_excel : null, 'price' => $bcontract ? $bcontract->price : null,
'buyer' => $scontract ? $scontract->contact->full_title : null, 'buyer' => $scontract ? $scontract->contact->full_title : null,
'sell_date' => $scontract ? $scontract->date_formatted : null, 'sell_date' => $scontract ? $scontract->date_formatted : null,
'sell_price' => $scontract ? $scontract->price_for_excel : null, 'sell_price' => $scontract ? $scontract->price : null,
]; ];
}); });
@ -122,7 +122,7 @@ class CarController extends Controller
'known_damage' => $car->known_damage, 'known_damage' => $car->known_damage,
'seller' => $contract ? $contract->contact->full_title : null, 'seller' => $contract ? $contract->contact->full_title : null,
'buy_date' => $contract ? $contract->date_formatted : null, 'buy_date' => $contract ? $contract->date_formatted : null,
'price' => $contract ? $contract->price_for_excel : null, 'price' => $contract ? $contract->price : null,
]; ];
}); });
@ -172,10 +172,10 @@ class CarController extends Controller
'known_damage' => $car->known_damage, 'known_damage' => $car->known_damage,
'seller' => $bcontract ? $bcontract->contact->full_title : null, 'seller' => $bcontract ? $bcontract->contact->full_title : null,
'buy_date' => $bcontract ? $bcontract->date_formatted : null, 'buy_date' => $bcontract ? $bcontract->date_formatted : null,
'price' => $bcontract ? $bcontract->price_for_excel : null, 'price' => $bcontract ? $bcontract->price : null,
'buyer' => $scontract ? $scontract->contact->full_title : null, 'buyer' => $scontract ? $scontract->contact->full_title : null,
'sell_date' => $scontract ? $scontract->date_formatted : null, 'sell_date' => $scontract ? $scontract->date_formatted : null,
'sell_price' => $scontract ? $scontract->price_for_excel : null, 'sell_price' => $scontract ? $scontract->price : null,
]; ];
}); });

View File

@ -2,7 +2,7 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware; use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class TrustProxies extends Middleware class TrustProxies extends Middleware
@ -19,9 +19,5 @@ class TrustProxies extends Middleware
* *
* @var int * @var int
*/ */
protected $headers = protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_AWS_ELB;
Request::HEADER_X_FORWARDED_FOR | }
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;}

View File

@ -78,7 +78,6 @@ class Contract extends Model
InsuranceType::ThreeStar => '3 Stern', InsuranceType::ThreeStar => '3 Stern',
InsuranceType::FiveStar => '5 Stern', InsuranceType::FiveStar => '5 Stern',
InsuranceType::FiveStarPlus => '5 Stern+', InsuranceType::FiveStarPlus => '5 Stern+',
InsuranceType::Ja => 'Ja',
default => 'Nein', default => 'Nein',
}; };
} }

View File

@ -42,25 +42,19 @@ class Payment extends Model
public function getTypeAttribute($type) public function getTypeAttribute($type)
{ {
switch ($type) { return match ($type) {
case PaymentType::Transaction(): PaymentType::Transaction() => 'Banküberweisung',
return 'Banküberweisung'; PaymentType::Cash() => 'Barzahlung',
case PaymentType::Cash(): default => 'Überweisung via Cembra',
return 'Barzahlung';
default:
return 'Überweisung via Cembra';
}; };
} }
public function getTypeTextAttribute() public function getTypeTextAttribute()
{ {
switch ($this->type) { return match ($this->type) {
case 'Banküberweisung': 'Banküberweisung' => 'via Banküberweisung erhalten',
return 'via Banküberweisung erhalten'; 'Barzahlung' => 'in bar erhalten',
case 'Barzahlung': default => 'via Cembra-Überweisung erhalten',
return 'in bar erhalten';
default:
return 'via Cembra-Überweisung erhalten';
}; };
} }

View File

@ -2,33 +2,31 @@
"name": "laravel/laravel", "name": "laravel/laravel",
"type": "project", "type": "project",
"description": "The Laravel Framework.", "description": "The Laravel Framework.",
"keywords": [ "keywords": ["framework", "laravel"],
"framework",
"laravel"
],
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^8.1", "php": "^7.3|^8.0",
"barryvdh/laravel-dompdf": "^1.0", "barryvdh/laravel-dompdf": "^0.9.0",
"bensampo/laravel-enum": "^5.1", "bensampo/laravel-enum": "^3.3",
"cknow/laravel-money": "^7.0", "cknow/laravel-money": "^6.1",
"fakerphp/faker": "^1.9.1", "fakerphp/faker": "^1.14",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0", "fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1", "guzzlehttp/guzzle": "^7.0.1",
"inertiajs/inertia-laravel": "^0.5", "inertiajs/inertia-laravel": "^0.3.5",
"laravel/framework": "^9.0", "laravel/framework": "^8.12",
"laravel/jetstream": "^2.3", "laravel/jetstream": "^2.3",
"laravel/sanctum": "^2.6", "laravel/sanctum": "^2.6",
"laravel/tinker": "^2.5", "laravel/tinker": "^2.5",
"maatwebsite/excel": "^3.1", "maatwebsite/excel": "^3.1",
"phpoffice/phpword": "^0.18", "phpoffice/phpword": "^0.18.2",
"tightenco/ziggy": "^1.0" "tightenco/ziggy": "^1.0"
}, },
"require-dev": { "require-dev": {
"spatie/laravel-ignition": "^1.0", "facade/ignition": "^2.5",
"laravel/sail": "^1.0.1", "laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.2", "mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^6.1", "nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3" "phpunit/phpunit": "^9.3.3"
}, },
"autoload": { "autoload": {

3536
composer.lock generated

File diff suppressed because it is too large Load Diff

12
database/seeders/DatabaseSeeder.php Executable file → Normal file
View File

@ -36,20 +36,20 @@ class DatabaseSeeder extends Seeder
User::factory()->create([ User::factory()->create([
'name' => 'Nadim Salloum', 'name' => 'Nadim Salloum',
'email' => env('USER_1_EMAIL', 'test@test.ch'), 'email' => env('USER_1_EMAIL'),
'password' => bcrypt(env('USER_1_PW', 'abc123')), 'password' => bcrypt(env('USER_1_PW')),
]); ]);
User::factory()->create([ User::factory()->create([
'name' => 'Mohamad Salloum', 'name' => 'Mohamad Salloum',
'email' => env('USER_2_EMAIL', 'test2@test.ch'), 'email' => env('USER_2_EMAIL'),
'password' => bcrypt(env('USER_2_PW', 'abc123')), 'password' => bcrypt(env('USER_2_PW')),
]); ]);
User::factory()->create([ User::factory()->create([
'name' => 'Nadim Salloum', 'name' => 'Nadim Salloum',
'email' => env('USER_3_EMAIL', 'test3@test.ch'), 'email' => env('USER_3_EMAIL'),
'password' => bcrypt(env('USER_3_PW', 'abc123')), 'password' => bcrypt(env('USER_3_PW')),
]); ]);
foreach ($this->getBrands() as $brandItem) { foreach ($this->getBrands() as $brandItem) {

View File

@ -3,11 +3,11 @@ version: '3'
services: services:
laravel.test: laravel.test:
build: build:
context: ./vendor/laravel/sail/runtimes/8.1 context: ./vendor/laravel/sail/runtimes/8.0
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
WWWGROUP: '${WWWGROUP}' WWWGROUP: '${WWWGROUP}'
image: sail-8.1/app image: sail-8.0/app
ports: ports:
- '${APP_PORT:-80}:80' - '${APP_PORT:-80}:80'
environment: environment:

9819
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,9 +19,9 @@
"@vue/compiler-sfc": "^3.0.5", "@vue/compiler-sfc": "^3.0.5",
"eslint": "^7.28.0", "eslint": "^7.28.0",
"eslint-plugin-vue": "^7.11.1", "eslint-plugin-vue": "^7.11.1",
"laravel-mix": "^6.0.49", "laravel-mix": "^6.0.6",
"postcss": "^8.1.14", "postcss": "^8.1.14",
"postcss-import": "^14.0.2", "postcss-import": "^12.0.1",
"tailwindcss": "^2.0.1", "tailwindcss": "^2.0.1",
"vue-loader": "^16.1.2" "vue-loader": "^16.1.2"
}, },
@ -32,7 +32,7 @@
"vue": "^3.0.5", "vue": "^3.0.5",
"vue-currency-input": "^2.0.0", "vue-currency-input": "^2.0.0",
"vue-multiselect": "^3.0.0-alpha.2", "vue-multiselect": "^3.0.0-alpha.2",
"vue-unicons": "^3.3.1", "vue-unicons": "^3.2.1",
"vuex": "^4.0.0" "vuex": "^4.0.0"
} }
} }

4465
public/css/app.css vendored Executable file → Normal file

File diff suppressed because it is too large Load Diff

6512
public/js/app.js vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

View File

@ -8,9 +8,6 @@
</template> </template>
<template #info> <template #info>
<small-title title="Auto" class="mb-3" /> <small-title title="Auto" class="mb-3" />
<div v-if="car.deleted_at" class="col-span-12 bg-red-500 p-2 -mb-1 text-white rounded-t-md font-bold">
Auto gelöscht am {{ car.deleted_at }}
</div>
<car-card :car="car" /> <car-card :car="car" />
</template> </template>
<template #actions> <template #actions>

View File

@ -91,14 +91,14 @@ export default {
methods: { methods: {
fetchCity(newVal, oldVal) { fetchCity(newVal, oldVal) {
if (newVal !== oldVal && newVal.length === 4 && this.form.country === 'CH') { if (newVal !== oldVal && newVal.length === 4 && this.form.country === 'CH') {
axios.get(`https://openplzapi.org/ch/Localities?postalCode=${newVal}`) axios.get(`https://swisspost.opendatasoft.com/api/records/1.0/search/?dataset=plz_verzeichnis_v2&q=&facet=ortbez18&refine.postleitzahl=${newVal}`)
.then((response) => { .then((response) => {
let data = response.data; let records = response.data.records;
/*if (records.length > 1) { if (records.length > 1) {
records = records.filter(rec => rec.geometry); records = records.filter(rec => rec.geometry);
}*/ }
if (data[0]) { if (records[0]) {
this.form.city = data[0].name; this.form.city = records[0].fields.ortbez18;
} }
}); });
} }

View File

@ -9,9 +9,6 @@
<template #info> <template #info>
<small-title title="Kontakt" class="mb-3" /> <small-title title="Kontakt" class="mb-3" />
<div v-if="contact.deleted_at" class="col-span-12 bg-red-500 p-2 -mb-1 text-white rounded-t-md font-bold">
Kontakt gelöscht am {{ contact.deleted_at }}
</div>
<contact-card :contact="contact" /> <contact-card :contact="contact" />
</template> </template>

View File

@ -51,7 +51,6 @@ export default {
price: this.contract.price, price: this.contract.price,
notes: this.contract.notes, notes: this.contract.notes,
insurance_type: this.contract.insurance_type, insurance_type: this.contract.insurance_type,
type: this.contract.type,
}, },
}; };
}, },

View File

@ -5,11 +5,7 @@
</template> </template>
<template #info> <template #info>
<small-title title="Vertragsinformationen" class="mb-3" /> <small-title title="Vertragsinformationen" class="mb-3" />
<div v-if="contract.deleted_at" class="col-span-12 bg-red-500 p-2 -mb-1 text-white rounded-t-md font-bold">
Vertrag gelöscht am {{ contract.deleted_at }}
</div>
<div class="grid grid-cols-12 gap-2 p-5 bg-white shadow rounded-md font-medium"> <div class="grid grid-cols-12 gap-2 p-5 bg-white shadow rounded-md font-medium">
<div class="col-span-4"> <div class="col-span-4">
Datum Datum
</div> </div>

View File

@ -187,12 +187,10 @@ MwSt-Nr: CHE-226.272.050
<td>Restbetrag</td> <td>Restbetrag</td>
<td>{{ $contract->left_to_pay }}</td> <td>{{ $contract->left_to_pay }}</td>
</tr> </tr>
@if ($contract->isSellContract())
<tr> <tr>
<td>Bankverbindung IBAN</td> <td>Bankverbindung IBAN</td>
<td>CH69 0900 0000 1549 3981 7</td> <td>CH69 0900 0000 1549 3981 7</td>
</tr> </tr>
@endif
<tr> <tr>
<td>Lieferdatum</td> <td>Lieferdatum</td>
<td>{{ $contract->delivery_date_formatted }}</td> <td>{{ $contract->delivery_date_formatted }}</td>