diff --git a/app/Enums/ContractType.php b/app/Enums/ContractType.php new file mode 100644 index 0000000..8d3784a --- /dev/null +++ b/app/Enums/ContractType.php @@ -0,0 +1,18 @@ +renderCarsList($request, Car::unsoldCars(), 'Cars/Unsold'); + return $this->renderCarsList($request, Car::unsoldOnly(), 'Cars/Unsold'); } public function sold(Request $request) { - return $this->renderCarsList($request, Car::soldCars(), 'Cars/Sold'); + return $this->renderCarsList($request, Car::soldOnly(), 'Cars/Sold'); } private function renderCarsList(Request $request, $cars, string $renderPage) { @@ -45,10 +46,8 @@ class CarController extends Controller 'id' => $car->id, 'stammnummer' => $car->stammnummer, 'vin' => $car->vin, - 'buy_price' => $car->latestSellerContract() ? $car->latestSellerContract()->price : '', - // 'buy_price' => $car->buy_price->format(), - // 'seller' => $car->seller->only('name'), - // 'buyer' => $car->buyer->only('name'), + 'buy_contract' => $this->getContractFields($car->latestBuyContract), + 'sell_contract' => $this->getContractFields($car->latestSellContract), 'car_model' => $car->carModel->only('name'), 'name' => $car->name, 'initial_date' => $car->initial_date, @@ -58,6 +57,35 @@ class CarController extends Controller ]); } + private function getContractFields(?Contract $contract) { + if (!$contract) { + return null; + } + $contact = $contract->contact; + return [ + 'id' => $contract->id, + 'date' => $contract->date, + 'price' => $contract->price, + 'type' => $contract->type, + 'insurance_type' => InsuranceType::fromValue((int)$contract->insurance_type)->key, + 'contact' => [ + 'id' => $contact->id, + 'name' => $contact->name, + 'firstname' => $contact->firstname, + 'lastname' => $contact->lastname, + 'phone' => $contact->phone, + 'address' => $contact->address, + 'zip' => $contact->zip, + 'city' => $contact->city, + 'country' => $contact->country, + 'company' => $contact->company, + 'email' => $contact->email, + 'link' => route('contacts.edit', $contact), + ], + 'link' => route('contracts.show', $contract), + ]; + } + private function getWithCustomSort($cars, string $sortBy, string $direction) { switch($sortBy) { @@ -80,17 +108,6 @@ class CarController extends Controller return 'name'; } - private function getDirection(Request $request) - { - if ($request->has('direction')) { - if (in_array($request->get('direction'), ['asc', 'desc'])) { - return $request->get('direction'); - } - } - - return 'asc'; - } - /** * Show the form for creating a new resource. * @@ -165,30 +182,13 @@ class CarController extends Controller 'notes' => $car->notes, 'deleted_at' => $car->deleted_at, 'buy_contracts' => $car->buyContracts() - ->with('contact') ->orderBy('date', 'desc') - ->paginate(10) - ->through(fn ($contract) => [ - 'id' => $contract->id, - 'date' => $contract->date, - 'price' => $contract->price, - 'contact' => $contract->contact, - 'type' => 'Ankaufsvertrag', - 'link' => route('contacts.edit', $contract->contact->id), - ]), + ->paginate(50) + ->through(fn ($contract) => $this->getContractFields($contract)), 'sell_contracts' => $car->sellContracts() - ->with('contact') ->orderBy('date', 'desc') - ->paginate(10) - ->through(fn ($contract) => [ - 'id' => $contract->id, - 'date' => $contract->date, - 'price' => $contract->price, - 'contact' => $contract->contact, - 'type' => 'Verkaufsvertrag', - 'link' => route('contacts.edit', $contract->contact->id), - 'insurance_type' => InsuranceType::fromValue((int)$contract->insurance_type)->key, - ]), + ->paginate(50) + ->through(fn ($contract) => $this->getContractFields($contract)), ], ]); } diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index 26e03af..790bf76 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -85,17 +85,6 @@ class ContactController extends Controller return 'name'; } - private function getDirection(Request $request) - { - if ($request->has('direction')) { - if (in_array($request->get('direction'), ['asc', 'desc'])) { - return $request->get('direction'); - } - } - - return 'asc'; - } - /** * Show the form for creating a new resource. * diff --git a/app/Http/Controllers/ContractController.php b/app/Http/Controllers/ContractController.php index 92132a7..a506685 100644 --- a/app/Http/Controllers/ContractController.php +++ b/app/Http/Controllers/ContractController.php @@ -2,6 +2,8 @@ namespace App\Http\Controllers; +use Inertia\Inertia; +use App\Models\Contract; use Illuminate\Http\Request; class ContractController extends Controller @@ -14,7 +16,6 @@ class ContractController extends Controller public function index(Request $request) { return []; - // return $this->renderContactsList($request, Contact::query(), 'Contacts/Index'); } /** @@ -36,4 +37,14 @@ class ContractController extends Controller { return []; } + + public function show(Contract $contract) + { + return []; + } + + public function print(Contract $contract) + { + return []; + } } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index a0a2a8a..612b11e 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,12 +2,24 @@ namespace App\Http\Controllers; -use Illuminate\Foundation\Auth\Access\AuthorizesRequests; +use Illuminate\Http\Request; use Illuminate\Foundation\Bus\DispatchesJobs; -use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; +use Illuminate\Foundation\Validation\ValidatesRequests; +use Illuminate\Foundation\Auth\Access\AuthorizesRequests; class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; + + protected function getDirection(Request $request) + { + if ($request->has('direction')) { + if (in_array($request->get('direction'), ['asc', 'desc'])) { + return $request->get('direction'); + } + } + + return 'asc'; + } } diff --git a/app/Models/BuyContract.php b/app/Models/BuyContract.php deleted file mode 100644 index 54a7ae4..0000000 --- a/app/Models/BuyContract.php +++ /dev/null @@ -1,41 +0,0 @@ -format('d.m.Y'); - } - - public function getPriceAttribute($price) - { - return Money::CHF($price)->format(); - } - - public function contact() - { - return $this->belongsTo(Contact::class); - } - - public function car() - { - return $this->belongsTo(Car::class); - } -} diff --git a/app/Models/Car.php b/app/Models/Car.php index 12499c3..a328584 100644 --- a/app/Models/Car.php +++ b/app/Models/Car.php @@ -2,6 +2,7 @@ namespace App\Models; +use App\Enums\ContractType; use Carbon\Carbon; use Cknow\Money\Money; use Illuminate\Database\Eloquent\Model; @@ -55,50 +56,35 @@ class Car extends Model { return $this->belongsTo(CarModel::class); } - - public function latestSellerContract() + + public function getLatestBuyContractAttribute() { return $this->buyContracts()->latest('date')->first(); } - public function latestBuyerContracts() + public function getLatestSellContractAttribute() { return $this->sellContracts()->latest('date')->first(); } public function isUnsold() { - return $this->sellers()->count() > $this->buyers()->count(); + return $this->buyContracts()->count() > $this->sellContracts()->count(); } public function isSold() { - return $this->sellers()->count() == $this->buyers()->count(); + return $this->buyContracts()->count() == $this->sellContracts()->count(); } - public function sellers() + public function documents() { - return $this->hasManyThrough(BuyContract::class, Contact::class); + return $this->morphMany(Document::class, 'documentable'); } - public function buyers() + public function contracts() { - return $this->hasManyThrough(SellContract::class, Contact::class); - } - - public function buyContracts() - { - return $this->hasMany(BuyContract::class); - } - - public function sellContracts() - { - return $this->hasMany(SellContract::class); - } - - public function carPayment() - { - return $this->hasManyThrough(CarPayment::class, SellContract::class); + return $this->hasMany(Contract::class); } // public function scopeSoldThisYear($query) @@ -111,14 +97,36 @@ class Car extends Model $query->orderBy('initial_date'); } - public function scopeSoldCars($query) + public function buyContracts() { - $query->withCount(['buyContracts', 'sellContracts'])->having('buy_contracts_count', '=', 'sell_contracts_count'); + return $this->hasMany(Contract::class)->buyContracts(); } - public function scopeUnsoldCars($query) + public function sellContracts() { - $query->withCount(['buyContracts', 'sellContracts'])->having('buy_contracts_count', '>', 'sell_contracts_count'); + return $this->hasMany(Contract::class)->sellContracts(); + } + + public function scopeWithContractCount($query) + { + return $query->withCount([ + 'contracts AS buy_contracts_count' => function ($query) { + $query->where('type', (string)ContractType::BuyContract); + }, + 'contracts AS sell_contracts_count' => function ($query) { + $query->where('type', (string)ContractType::SellContract); + }, + ]); + } + + public function scopeUnsoldOnly($query) + { + return $query->withContractCount()->havingRaw('buy_contracts_count > sell_contracts_count'); + } + + public function scopeSoldOnly($query) + { + return $query->withContractCount()->having('sell_contracts_count', '>', 0)->havingRaw('buy_contracts_count <= sell_contracts_count'); } public function scopeFilter($query, array $filters) diff --git a/app/Models/Contact.php b/app/Models/Contact.php index 2c98e28..81a005d 100644 --- a/app/Models/Contact.php +++ b/app/Models/Contact.php @@ -2,9 +2,10 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; +use App\Enums\ContractType; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Contact extends Model { @@ -47,24 +48,19 @@ class Contact extends Model $query->orderBy('lastname', $direction)->orderBy('firstname', $direction); } - public function sellContracts() + public function contracts() { - return $this->hasMany(SellContract::class); + return $this->hasMany(Contract::class); } public function buyContracts() { - return $this->hasMany(BuyContract::class); + return $this->contracts()->buyContracts(); } - public function boughtCars() + public function sellContracts() { - return $this->hasManyThrough(Car::class, SellContract::class); - } - - public function soldCars() - { - return $this->hasManyThrough(Car::class, BuyContract::class); + return $this->contracts()->sellContracts(); } public function scopeFilter($query, array $filters) diff --git a/app/Models/Contract.php b/app/Models/Contract.php new file mode 100644 index 0000000..c8b0841 --- /dev/null +++ b/app/Models/Contract.php @@ -0,0 +1,74 @@ +format('d.m.Y'); + } + + public function getPriceAttribute($price) + { + return Money::CHF($price)->format(); + } + + public function documents() + { + return $this->morphMany(Document::class, 'documentable'); + } + + public function contact() + { + return $this->belongsTo(Contact::class); + } + + public function car() + { + return $this->belongsTo(Car::class); + } + + public function scopeThisYear($query) + { + $query->where('date', '>', date('Y')); + } + + public function scopeSoldThisYear($query) + { + $query->buyContracts()->thisYear(); + } + + public function scopeBoughtThisYear($query) + { + $query->sellContracts()->thisYear(); + } + + public function scopeBuyContracts($query) + { + $query->where('type', (string)ContractType::BuyContract); + } + + public function scopeSellContracts($query) + { + $query->where('type', (string)ContractType::SellContract); + } +} diff --git a/app/Models/Document.php b/app/Models/Document.php index 5e627e2..88f5e09 100644 --- a/app/Models/Document.php +++ b/app/Models/Document.php @@ -15,8 +15,8 @@ class Document extends Model 'car_id', ]; - public function car() + public function documentable() { - return $this->belongsTo(Car::class); + return $this->morphTo(); } } diff --git a/config/app.php b/config/app.php index b50506f..76a1b20 100644 --- a/config/app.php +++ b/config/app.php @@ -176,7 +176,6 @@ return [ App\Providers\RouteServiceProvider::class, App\Providers\FortifyServiceProvider::class, App\Providers\JetstreamServiceProvider::class, - ], /* @@ -229,7 +228,6 @@ return [ 'URL' => Illuminate\Support\Facades\URL::class, 'Validator' => Illuminate\Support\Facades\Validator::class, 'View' => Illuminate\Support\Facades\View::class, - ], ]; diff --git a/database/factories/BuyContractFactory.php b/database/factories/BuyContractFactory.php deleted file mode 100644 index 41a15ab..0000000 --- a/database/factories/BuyContractFactory.php +++ /dev/null @@ -1,33 +0,0 @@ - $this->faker->date(), - 'price' => $this->faker->numberBetween(150000, 3500000), - 'contact_id' => $this->faker->numberBetween(1, Contact::count()), - 'car_id' => $this->faker->unique()->numberBetween(1, Car::count()), - ]; - } -} diff --git a/database/factories/CarPaymentFactory.php b/database/factories/CarPaymentFactory.php index 82313ff..7ef838d 100644 --- a/database/factories/CarPaymentFactory.php +++ b/database/factories/CarPaymentFactory.php @@ -5,7 +5,7 @@ namespace Database\Factories; use App\Models\CarPayment; use Illuminate\Database\Eloquent\Factories\Factory; use App\Enums\PaymentType; -use App\Models\SellContract; +use App\Models\Contract; class CarPaymentFactory extends Factory { @@ -27,7 +27,7 @@ class CarPaymentFactory extends Factory 'amount' => $this->faker->numberBetween(1000, 10000), 'date' => $this->faker->date(), 'type' => (string)PaymentType::getRandomValue(), - 'sell_contract_id' => $this->faker->numberBetween(1, SellContract::count()), + 'contract_id' => $this->faker->numberBetween(1, Contract::count()), ]; } } diff --git a/database/factories/SellContractFactory.php b/database/factories/ContractFactory.php similarity index 79% rename from database/factories/SellContractFactory.php rename to database/factories/ContractFactory.php index d1bffff..4214ddc 100644 --- a/database/factories/SellContractFactory.php +++ b/database/factories/ContractFactory.php @@ -2,20 +2,21 @@ namespace Database\Factories; -use App\Models\SellContract; +use App\Models\Contract; use App\Models\Car; use App\Models\Contact; use Illuminate\Database\Eloquent\Factories\Factory; use App\Enums\InsuranceType; +use App\Enums\ContractType; -class SellContractFactory extends Factory +class ContractFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ - protected $model = SellContract::class; + protected $model = Contract::class; /** * Define the model's default state. @@ -30,6 +31,7 @@ class SellContractFactory extends Factory 'contact_id' => $this->faker->numberBetween(1, Contact::count()), 'car_id' => $this->faker->numberBetween(1, Car::count()), 'insurance_type' => (string)InsuranceType::getRandomValue(), + 'type' => (string)ContractType::getRandomValue(), ]; } } diff --git a/database/factories/DocumentFactory.php b/database/factories/DocumentFactory.php index 810f368..99e7546 100644 --- a/database/factories/DocumentFactory.php +++ b/database/factories/DocumentFactory.php @@ -3,7 +3,7 @@ namespace Database\Factories; use App\Models\Document; -use App\Models\Car; +use App\Models\Contract; use Illuminate\Database\Eloquent\Factories\Factory; use App\Enums\DocumentType; @@ -26,8 +26,9 @@ class DocumentFactory extends Factory { return [ 'name' => $this->faker->name(), - 'car_id' => $this->faker->numberBetween(1, Car::count()), - 'document_type' => (string)DocumentType::getRandomValue(), + 'documentable_id' => $this->faker->numberBetween(1, Contract::count()), + 'documentable_type' => 'App\Models\Contract', + 'type' => (string)DocumentType::getRandomValue(), ]; } } diff --git a/database/migrations/2021_05_10_144041_create_sell_contracts_table.php b/database/migrations/2021_05_10_144041_create_contracts_table.php similarity index 77% rename from database/migrations/2021_05_10_144041_create_sell_contracts_table.php rename to database/migrations/2021_05_10_144041_create_contracts_table.php index 25c9db4..4af8312 100644 --- a/database/migrations/2021_05_10_144041_create_sell_contracts_table.php +++ b/database/migrations/2021_05_10_144041_create_contracts_table.php @@ -4,8 +4,9 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; use App\Enums\InsuranceType; +use App\Enums\ContractType; -class CreateSellContractsTable extends Migration +class CreateContractsTable extends Migration { /** * Run the migrations. @@ -14,7 +15,7 @@ class CreateSellContractsTable extends Migration */ public function up() { - Schema::create('sell_contracts', function (Blueprint $table) { + Schema::create('contracts', function (Blueprint $table) { $table->id(); $table->date('date'); $table->integer('price'); @@ -27,7 +28,9 @@ class CreateSellContractsTable extends Migration ->onDelete('cascade') ->constrained('cars'); $table->enum('insurance_type', InsuranceType::getValues()) - ->default(InsuranceType::QBase); + ->default(InsuranceType::None); + $table->enum('type', ContractType::getValues()) + ->default(ContractType::SellContract); $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2021_05_10_144114_create_documents_table.php b/database/migrations/2021_05_10_144114_create_documents_table.php index 694dd29..f09205b 100644 --- a/database/migrations/2021_05_10_144114_create_documents_table.php +++ b/database/migrations/2021_05_10_144114_create_documents_table.php @@ -17,12 +17,10 @@ class CreateDocumentsTable extends Migration Schema::create('documents', function (Blueprint $table) { $table->id(); $table->string('name'); - $table->enum('document_type', DocumentType::getValues()) + $table->enum('type', DocumentType::getValues()) ->default(DocumentType::Other); - $table->foreignId('car_id') - ->onUpdate('cascade') - ->onDelete('cascade') - ->constrained('cars'); + $table->integer('documentable_id'); + $table->string('documentable_type'); $table->timestamps(); }); } diff --git a/database/migrations/2021_05_10_144704_create_car_payments_table.php b/database/migrations/2021_05_10_144704_create_car_payments_table.php index 62fc409..14f49e4 100644 --- a/database/migrations/2021_05_10_144704_create_car_payments_table.php +++ b/database/migrations/2021_05_10_144704_create_car_payments_table.php @@ -20,10 +20,10 @@ class CreateCarPaymentsTable extends Migration $table->date('date'); $table->enum('type', PaymentType::getValues()) ->default(PaymentType::Transaction); - $table->foreignId('sell_contract_id') + $table->foreignId('contract_id') ->onUpdate('cascade') ->onDelete('cascade') - ->constrained('sell_contracts'); + ->constrained('contracts'); $table->timestamps(); }); } diff --git a/database/migrations/2021_05_14_071143_create_buy_contracts_table.php b/database/migrations/2021_05_14_071143_create_buy_contracts_table.php deleted file mode 100644 index 6e23a8d..0000000 --- a/database/migrations/2021_05_14_071143_create_buy_contracts_table.php +++ /dev/null @@ -1,42 +0,0 @@ -id(); - $table->date('date'); - $table->integer('price'); - $table->foreignId('contact_id') - ->onUpdate('cascade') - ->onDelete('cascade') - ->constrained('contacts'); - $table->foreignId('car_id') - ->onUpdate('cascade') - ->onDelete('cascade') - ->constrained('cars'); - $table->timestamps(); - $table->softDeletes(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('buy_contracts'); - } -} diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 3e0f6f1..06df2ac 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -9,8 +9,7 @@ use App\Models\Car; use App\Models\CarModel; use App\Models\Brand; use App\Models\CarPayment; -use App\Models\BuyContract; -use App\Models\SellContract; +use App\Models\Contract; use App\Models\Contact; use App\Models\Document; use Illuminate\Support\Facades\DB; @@ -27,8 +26,7 @@ class DatabaseSeeder extends Seeder DB::statement('SET FOREIGN_KEY_CHECKS=0;'); User::truncate(); CarPayment::truncate(); - BuyContract::truncate(); - SellContract::truncate(); + Contract::truncate(); Document::truncate(); Car::truncate(); Contact::truncate(); @@ -65,12 +63,8 @@ class DatabaseSeeder extends Seeder ->count($nOfCars) ->create(); - $buyContracts = BuyContract::factory() - ->count($nOfCars) - ->create(); - - $sellContracts = SellContract::factory() - ->count(40) + $contracts = Contract::factory() + ->count($nOfCars * 2) ->create(); $carPayments = CarPayment::factory() diff --git a/public/js/app.js b/public/js/app.js index 3c01a5c..5c073b5 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -16912,6 +16912,11 @@ __webpack_require__.r(__webpack_exports__); } }, methods: { + resolve: function resolve(path, obj) { + return path.split('.').reduce(function (prev, curr) { + return prev ? prev[curr] : null; + }, obj || self); + }, sortTable: function sortTable(col) { event.preventDefault(); @@ -18565,8 +18570,20 @@ __webpack_require__.r(__webpack_exports__); value: 'Stammummer', sortable: true }, { - key: 'buy_price', - value: 'Kaufpreis', + key: 'buy_contract.date', + value: 'Einkaufsdatum', + sortable: true + }, { + key: 'buy_contract.price', + value: 'Einkaufspreis', + sortable: true + }, { + key: 'sell_contract.date', + value: 'Verkaufssdatum', + sortable: true + }, { + key: 'sell_contract.price', + value: 'Verkaufspreis', sortable: true }, { key: 'initial_date', @@ -18687,8 +18704,20 @@ __webpack_require__.r(__webpack_exports__); value: 'Stammummer', sortable: true }, { - key: 'buy_price', - value: 'Kaufpreis', + key: 'buy_contract.date', + value: 'Einkaufsdatum', + sortable: true + }, { + key: 'buy_contract.price', + value: 'Einkaufspreis', + sortable: true + }, { + key: 'sell_contract.date', + value: 'Verkaufssdatum', + sortable: true + }, { + key: 'sell_contract.price', + value: 'Verkaufspreis', sortable: true }, { key: 'initial_date', @@ -18741,8 +18770,20 @@ __webpack_require__.r(__webpack_exports__); value: 'Stammummer', sortable: true }, { - key: 'buy_price', - value: 'Kaufpreis', + key: 'buy_contract.date', + value: 'Einkaufsdatum', + sortable: true + }, { + key: 'buy_contract.price', + value: 'Einkaufspreis', + sortable: true + }, { + key: 'sell_contract.date', + value: 'Verkaufssdatum', + sortable: true + }, { + key: 'sell_contract.price', + value: 'Verkaufspreis', sortable: true }, { key: 'initial_date', @@ -20287,38 +20328,35 @@ var _hoisted_7 = { key: 2 }; var _hoisted_8 = { + key: 3, + "class": "pt-3 mt-3 border-t" +}; + +var _hoisted_9 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Zum Vertrag "); + +var _hoisted_10 = { key: 1, "class": "col-span-4 xs:col-span-12" }; -var _hoisted_9 = { +var _hoisted_11 = { "class": "col-span-2 xs:col-span-12 py-9" }; -var _hoisted_10 = { +var _hoisted_12 = { "class": "w-full flex flex-col" }; -var _hoisted_11 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" ausdrucken "); - -var _hoisted_12 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", { - "class": "py-12" -}, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", { - "class": "max-w-7xl sm:px-6 lg:px-8" -}, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(" ")]), /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", { - "class": "max-w-7xl pt-6 sm:px-6 lg:px-8" -}, [/*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(" ")])], -1 -/* HOISTED */ -); +var _hoisted_13 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" drucken "); function render(_ctx, _cache, $props, $setup, $data, $options) { var _component_contact_card = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("contact-card"); - var _component_car_card = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("car-card"); - var _component_unicon = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("unicon"); var _component_inertia_link = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("inertia-link"); - return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_1, [$props.contract.contact ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("h3", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.meta.contact), 1 + var _component_car_card = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("car-card"); + + return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_1, [$props.contract.contact ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("h3", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.meta.contact), 1 /* TEXT */ ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_contact_card, { contact: $props.contract.contact @@ -20326,39 +20364,47 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { /* PROPS */ , ["contact"])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_3, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("h3", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.meta.title), 1 /* TEXT */ - ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_4, [$props.contract.date ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_5, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(' vom ' + $props.contract.date), 1 + ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_4, [$props.contract.date ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_5, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contract.date), 1 /* TEXT */ - )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), $props.contract.price ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_6, " Preis: " + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contract.price), 1 + )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), $props.contract.price ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_6, " Betrag: " + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contract.price), 1 /* TEXT */ )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), $props.contract.insurance_type ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_7, " Versicherungstyp: " + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contract.insurance_type), 1 /* TEXT */ - )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])]), $props.contract.car ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_8, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("h3", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.meta.car), 1 - /* TEXT */ - ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_car_card, { - car: $props.contract.car - }, null, 8 - /* PROPS */ - , ["car"])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_9, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_10, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_inertia_link, { - href: _ctx.route('contracts.print', $props.contract.id), - "class": "mb-5 inline-flex items-center px-4 py-2 bg-gray-800 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-gray-700 active:bg-gray-900 focus:outline-none focus:border-gray-900 focus:ring focus:ring-gray-300 disabled:opacity-25 transition" + )) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), $props.contract.link ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_8, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_inertia_link, { + href: $props.contract.link, + "class": "pt-1 pb-1 flex items-center" }, { "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () { return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_unicon, { - fill: "white", "class": "mr-1", height: "22", width: "22", - name: "file-download" - }), _hoisted_11]; + name: "arrow-right" + }), _hoisted_9]; }), _: 1 /* STABLE */ }, 8 /* PROPS */ - , ["href"])])])]), _hoisted_12], 64 - /* STABLE_FRAGMENT */ - ); + , ["href"])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)])]), $props.contract.car ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_10, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("h3", null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.meta.car), 1 + /* TEXT */ + ), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_car_card, { + car: $props.contract.car + }, null, 8 + /* PROPS */ + , ["car"])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_11, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_12, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("a", { + href: _ctx.route('contracts.print', $props.contract.id), + "class": "mb-5 inline-flex items-center px-4 py-2 bg-gray-800 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-gray-700 active:bg-gray-900 focus:outline-none focus:border-gray-900 focus:ring focus:ring-gray-300 disabled:opacity-25 transition" + }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_unicon, { + fill: "white", + "class": "mr-1", + height: "22", + width: "22", + name: "file-download" + }), _hoisted_13], 8 + /* PROPS */ + , ["href"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)(" \n \n ausdrucken\n ")])])]); } /***/ }), @@ -21028,7 +21074,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { href: row.link }, { "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () { - return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(row[col.key]), 1 + return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($options.resolve(col.key, row)), 1 /* TEXT */ )]; }), @@ -21037,7 +21083,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { }, 1032 /* PROPS, DYNAMIC_SLOTS */ - , ["href"])) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("span", _hoisted_11, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(row[col.key]), 1 + , ["href"])) : ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("span", _hoisted_11, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($options.resolve(col.key, row)), 1 /* TEXT */ ))]); }), 128 diff --git a/resources/js/Components/ContractCard.vue b/resources/js/Components/ContractCard.vue index e47b960..532124c 100644 --- a/resources/js/Components/ContractCard.vue +++ b/resources/js/Components/ContractCard.vue @@ -8,14 +8,20 @@

{{ meta.title }}

- {{' vom ' + contract.date }} + {{ contract.date }}
- Preis: {{ contract.price }} + Betrag: {{ contract.price }}
Versicherungstyp: {{ contract.insurance_type }}
+
+ + + Zum Vertrag + +
@@ -24,21 +30,17 @@
-
-
- -
-
- -
-