code cleanup
parent
bcb383b3b2
commit
34b6c23ab2
|
|
@ -148,6 +148,7 @@ class ContactController extends Controller
|
|||
'lastname' => $contact->lastname,
|
||||
'company' => $contact->company,
|
||||
'title' => $contact->title,
|
||||
'name' => $contact->name,
|
||||
'email' => $contact->email,
|
||||
'notes' => $contact->notes,
|
||||
'phone' => $contact->phone,
|
||||
|
|
|
|||
|
|
@ -17,35 +17,39 @@ use Illuminate\Support\Facades\Redirect;
|
|||
|
||||
class ContractController extends Controller
|
||||
{
|
||||
public function create(Request $request, int $type, Car $car, Contact $contact)
|
||||
public function create(Request $request, string $type, Car $car, Contact $contact)
|
||||
{
|
||||
return Inertia::render('Contracts/Create', [
|
||||
'car' => $this->getCarFields($car),
|
||||
'contact' => $this->getContactFields($contact),
|
||||
'type' => ContractType::coerce($type)->key,
|
||||
'is_sell_contract' => ContractType::coerce($type) == ContractType::SellContract,
|
||||
'type' => $type,
|
||||
'car_first' => (bool)$request->query('carFirst'),
|
||||
'insurance_types' => InsuranceType::asSelectArray(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function createFromCar(Request $request, int $type, Car $car)
|
||||
public function createFromCar(Request $request, string $type, Car $car)
|
||||
{
|
||||
return Inertia::render('Contracts/CreateFromCar', [
|
||||
'car' => $this->getCarFields($car),
|
||||
'type' => ContractType::coerce($type)->key,
|
||||
'is_sell_contract' => ContractType::coerce($type) == ContractType::SellContract,
|
||||
'type' => $type,
|
||||
'contacts' => Contact::all()->map(function ($contact) {
|
||||
return $this->getContactFields($contact);
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public function createFromContact(Request $request, int $type, Contact $contact)
|
||||
public function createFromContact(Request $request, string $type, Contact $contact)
|
||||
{
|
||||
$contractType = ContractType::coerce($type);
|
||||
$cars = $contractType->value == ContractType::SellContract ? Car::unsoldOnly() : Car::soldOnly();
|
||||
|
||||
return Inertia::render('Contracts/CreateFromContact', [
|
||||
'contact' => $this->getContactFields($contact),
|
||||
'type' => $contractType->key,
|
||||
'is_sell_contract' => $contractType == ContractType::SellContract,
|
||||
'type' => $type,
|
||||
'cars' => $cars->get()->map(function ($car) {
|
||||
return $this->getCarFields($car);
|
||||
}),
|
||||
|
|
@ -133,6 +137,8 @@ class ContractController extends Controller
|
|||
'date' => $contract->date,
|
||||
'date_formatted' => $contract->date_formatted,
|
||||
'is_sell_contract' => $contract->isSellContract(),
|
||||
'type' => $contract->type,
|
||||
'type_formatted' => $contract->type_formatted,
|
||||
'price' => $contract->price->getAmount(),
|
||||
'insurance_type' => (string)$contract->insurance_type,
|
||||
'car' => [
|
||||
|
|
@ -140,7 +146,7 @@ class ContractController extends Controller
|
|||
'name' => $contract->car->name,
|
||||
],
|
||||
],
|
||||
'insurance_types' => InsuranceType::asArray(),
|
||||
'insurance_types' => InsuranceType::asSelectArray(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -172,6 +178,7 @@ class ContractController extends Controller
|
|||
'date' => $contract->date_formatted,
|
||||
'price' => $contract->price->format(),
|
||||
'type' => $contract->type,
|
||||
'type_formatted' => $contract->type_formatted,
|
||||
'paid' => $contract->paid->format(),
|
||||
'left_to_pay' => $contract->left_to_pay->format(),
|
||||
'is_sell_contract' => $contract->isSellContract(),
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Enums\ContractType;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
|
@ -26,7 +27,7 @@ class Contact extends Model
|
|||
|
||||
public function getNameAttribute()
|
||||
{
|
||||
return $this->lastname . ' ' . $this->firstname;
|
||||
return implode(' ', array_filter([$this->lastname, $this->firstname]));
|
||||
}
|
||||
|
||||
public function getTitleAttribute()
|
||||
|
|
@ -38,6 +39,15 @@ class Contact extends Model
|
|||
return $this->name;
|
||||
}
|
||||
|
||||
public function getDeletedAtAttribute($deleted_at)
|
||||
{
|
||||
if ($deleted_at) {
|
||||
return Carbon::parse($deleted_at)->format('d.m.Y');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getFullTitleAttribute()
|
||||
{
|
||||
return implode(', ', array_filter([$this->company, $this->name]));
|
||||
|
|
|
|||
|
|
@ -8316,16 +8316,16 @@
|
|||
},
|
||||
{
|
||||
"name": "sebastian/global-state",
|
||||
"version": "5.0.2",
|
||||
"version": "5.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/global-state.git",
|
||||
"reference": "a90ccbddffa067b51f574dea6eb25d5680839455"
|
||||
"reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455",
|
||||
"reference": "a90ccbddffa067b51f574dea6eb25d5680839455",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49",
|
||||
"reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -8368,7 +8368,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/global-state/issues",
|
||||
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2"
|
||||
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -8376,7 +8376,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-26T15:55:19+00:00"
|
||||
"time": "2021-06-11T13:31:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/lines-of-code",
|
||||
|
|
|
|||
|
|
@ -20733,15 +20733,6 @@ __webpack_require__.r(__webpack_exports__);
|
|||
notes: this.contact.notes
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
title: function title() {
|
||||
if (this.data.company) {
|
||||
return this.data.company;
|
||||
}
|
||||
|
||||
return this.data.lastname + ' ' + this.data.firstname;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -20906,15 +20897,6 @@ __webpack_require__.r(__webpack_exports__);
|
|||
return {
|
||||
currentRoute: 'contacts.show'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
title: function title() {
|
||||
if (this.contact.company) {
|
||||
return this.contact.company;
|
||||
}
|
||||
|
||||
return this.contact.lastname + ' ' + this.contact.firstname;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -20937,10 +20919,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* harmony import */ var _Jetstream_ActionMessage__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/Jetstream/ActionMessage */ "./resources/js/Jetstream/ActionMessage.vue");
|
||||
/* harmony import */ var _Jetstream_InputError__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/Jetstream/InputError */ "./resources/js/Jetstream/InputError.vue");
|
||||
/* harmony import */ var _Jetstream_FormSection__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/Jetstream/FormSection */ "./resources/js/Jetstream/FormSection.vue");
|
||||
/* harmony import */ var vue_multiselect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! vue-multiselect */ "./node_modules/vue-multiselect/dist/vue-multiselect.esm.js");
|
||||
/* harmony import */ var vue3_datepicker__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vue3-datepicker */ "./node_modules/vue3-datepicker/dist/vue3-datepicker.esm.js");
|
||||
/* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
|
||||
|
||||
/* harmony import */ var vue3_datepicker__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! vue3-datepicker */ "./node_modules/vue3-datepicker/dist/vue3-datepicker.esm.js");
|
||||
/* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
|
||||
|
||||
|
||||
|
||||
|
|
@ -20957,54 +20937,22 @@ __webpack_require__.r(__webpack_exports__);
|
|||
JetInput: _Jetstream_Input_vue__WEBPACK_IMPORTED_MODULE_2__.default,
|
||||
JetInputError: _Jetstream_InputError__WEBPACK_IMPORTED_MODULE_4__.default,
|
||||
JetActionMessage: _Jetstream_ActionMessage__WEBPACK_IMPORTED_MODULE_3__.default,
|
||||
Multiselect: vue_multiselect__WEBPACK_IMPORTED_MODULE_6__.default,
|
||||
Datepicker: vue3_datepicker__WEBPACK_IMPORTED_MODULE_7__.default
|
||||
Datepicker: vue3_datepicker__WEBPACK_IMPORTED_MODULE_6__.default
|
||||
},
|
||||
props: {
|
||||
data: Object,
|
||||
meta: Object,
|
||||
insurance_types: Object
|
||||
insurance_types: Array
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
form: (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_8__.useForm)(this.meta.form_name, this.data),
|
||||
insuranceSelection: {
|
||||
key: this.data.insurance_type,
|
||||
label: 'asd'
|
||||
}
|
||||
form: (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_7__.useForm)(this.meta.form_name, this.data)
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
insurances: function insurances() {
|
||||
var insurances = [];
|
||||
|
||||
for (var label in this.insurance_types) {
|
||||
insurances.push({
|
||||
key: this.insurance_types[label],
|
||||
label: label
|
||||
});
|
||||
}
|
||||
|
||||
return insurances;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm: function submitForm() {
|
||||
this.form.date = this.form.date.toISOString().split("T")[0];
|
||||
this.form.submit(this.meta.method, this.meta.route);
|
||||
},
|
||||
updateInsuranceSelection: function updateInsuranceSelection(selection) {
|
||||
this.form.insurance_type = selection.key.toString();
|
||||
}
|
||||
},
|
||||
mounted: function mounted() {
|
||||
this.$nextTick(function () {
|
||||
var _this = this;
|
||||
|
||||
this.insuranceSelection = this.insurances.find(function (x) {
|
||||
return x.key === parseInt(_this.data.insurance_type);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -21048,7 +20996,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
car: Object,
|
||||
contact: Object,
|
||||
type: String,
|
||||
car_first: Boolean
|
||||
car_first: Boolean,
|
||||
insurance_types: Array
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
|
|
@ -21063,7 +21012,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
id: null,
|
||||
date: (0,vue__WEBPACK_IMPORTED_MODULE_6__.ref)(new Date()),
|
||||
price: null,
|
||||
type: this.type == "SellContract" ? '0' : '1',
|
||||
type: this.type,
|
||||
insurance_type: '0',
|
||||
car_id: this.car.id,
|
||||
contact_id: this.contact.id,
|
||||
|
|
@ -21389,7 +21338,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
},
|
||||
props: {
|
||||
contract: Object,
|
||||
insurance_types: Object
|
||||
insurance_types: Array
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
|
|
@ -21466,11 +21415,8 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|||
contract: Object
|
||||
},
|
||||
computed: {
|
||||
contractType: function contractType() {
|
||||
return this.contract.type == 0 ? 'Ankaufsvertrag' : 'Verkaufsvertrag';
|
||||
},
|
||||
contactTitle: function contactTitle() {
|
||||
return this.contract.type == 0 ? 'Verkäufer' : 'Käufer';
|
||||
return this.contract.is_sell_contract ? 'Käufer' : 'Verkäufer';
|
||||
}
|
||||
},
|
||||
data: function data() {
|
||||
|
|
@ -22768,7 +22714,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
||||
return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_1, [$props.contact.company ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_2, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contact.company), 1
|
||||
/* TEXT */
|
||||
)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), $props.contact.lastname && $props.contact.firstname ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_3, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contact.lastname + ' ' + $props.contact.firstname), 1
|
||||
)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), $props.contact.name ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_3, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contact.name), 1
|
||||
/* TEXT */
|
||||
)) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), $props.contact.address ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_4, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contact.address), 1
|
||||
/* TEXT */
|
||||
|
|
@ -28650,7 +28596,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
}, null, 8
|
||||
/* PROPS */
|
||||
, ["href"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_bread_crumb, {
|
||||
text: $options.title,
|
||||
text: $props.contact.title,
|
||||
href: _ctx.route('contacts.show', $props.contact.id)
|
||||
}, null, 8
|
||||
/* PROPS */
|
||||
|
|
@ -28875,7 +28821,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
href: _ctx.route('contacts')
|
||||
}, null, 8
|
||||
/* PROPS */
|
||||
, ["href"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" " + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($options.title), 1
|
||||
, ["href"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" " + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contact.title), 1
|
||||
/* TEXT */
|
||||
)])];
|
||||
}),
|
||||
|
|
@ -29015,8 +28961,6 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
||||
var _component_jet_input = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("jet-input");
|
||||
|
||||
var _component_multiselect = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("multiselect");
|
||||
|
||||
var _component_jet_action_message = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("jet-action-message");
|
||||
|
||||
var _component_jet_button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("jet-button");
|
||||
|
|
@ -29075,23 +29019,23 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
, ["message"])]), $data.form.is_sell_contract ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_5, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_label, {
|
||||
"for": "insurance_type",
|
||||
value: "Versicherung"
|
||||
}), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_multiselect, {
|
||||
"class": "mt-1 block w-full",
|
||||
onSelect: $options.updateInsuranceSelection,
|
||||
modelValue: $data.insuranceSelection,
|
||||
}), (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)((0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("select", {
|
||||
"onUpdate:modelValue": _cache[3] || (_cache[3] = function ($event) {
|
||||
return $data.insuranceSelection = $event;
|
||||
return $data.form.insurance_type = $event;
|
||||
}),
|
||||
"deselect-label": "Kann nicht entfernt werden",
|
||||
"track-by": "key",
|
||||
label: "label",
|
||||
placeholder: "Versicherung auswählen",
|
||||
options: $options.insurances,
|
||||
searchable: false,
|
||||
"allow-empty": false
|
||||
}, null, 8
|
||||
/* PROPS */
|
||||
, ["onSelect", "modelValue", "options"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_input_error, {
|
||||
"class": "mt-1 block w-full border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm"
|
||||
}, [((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($props.insurance_types, function (insurance, index) {
|
||||
return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("option", {
|
||||
value: index,
|
||||
selected: $data.form.insurance_type == index
|
||||
}, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(insurance), 9
|
||||
/* TEXT, PROPS */
|
||||
, ["value", "selected"]);
|
||||
}), 256
|
||||
/* UNKEYED_FRAGMENT */
|
||||
))], 512
|
||||
/* NEED_PATCH */
|
||||
), [[vue__WEBPACK_IMPORTED_MODULE_0__.vModelSelect, $data.form.insurance_type]]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_input_error, {
|
||||
message: $data.form.errors.insurance_type,
|
||||
"class": "mt-2"
|
||||
}, null, 8
|
||||
|
|
@ -29291,7 +29235,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
})) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_contract_form, {
|
||||
"class": "mt-5",
|
||||
data: $data.data,
|
||||
meta: $data.meta
|
||||
meta: $data.meta,
|
||||
insurance_types: $props.insurance_types
|
||||
}, {
|
||||
title: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
|
||||
return [_hoisted_3];
|
||||
|
|
@ -29304,7 +29249,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
||||
}, 8
|
||||
/* PROPS */
|
||||
, ["data", "meta"])])];
|
||||
, ["data", "meta", "insurance_types"])])];
|
||||
}),
|
||||
_: 1
|
||||
/* STABLE */
|
||||
|
|
@ -29750,8 +29695,6 @@ var _hoisted_2 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNod
|
|||
|
||||
var _hoisted_3 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)("Vertragsangaben");
|
||||
|
||||
var _hoisted_4 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Vertrag & anpassen. ");
|
||||
|
||||
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
var _component_bread_crumb = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("bread-crumb");
|
||||
|
||||
|
|
@ -29772,7 +29715,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
}, null, 8
|
||||
/* PROPS */
|
||||
, ["text", "href"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_bread_crumb, {
|
||||
text: 'Vertrag vom ' + $props.contract.date_formatted,
|
||||
text: $props.contract.type_formatted + ' vom ' + $props.contract.date_formatted,
|
||||
href: _ctx.route('contracts.show', $props.contract.id)
|
||||
}, null, 8
|
||||
/* PROPS */
|
||||
|
|
@ -29788,7 +29731,9 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
return [_hoisted_3];
|
||||
}),
|
||||
description: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
|
||||
return [_hoisted_4];
|
||||
return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contract.type_formatted) + " & anpassen. ", 1
|
||||
/* TEXT */
|
||||
)];
|
||||
}),
|
||||
_: 1
|
||||
/* STABLE */
|
||||
|
|
@ -29933,12 +29878,12 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
href: _ctx.route('cars.show', $props.contract.car.id)
|
||||
}, null, 8
|
||||
/* PROPS */
|
||||
, ["text", "href"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" " + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($options.contractType) + " vom " + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contract.date), 1
|
||||
, ["text", "href"]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" " + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contract.type_formatted) + " vom " + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contract.date), 1
|
||||
/* TEXT */
|
||||
)];
|
||||
}),
|
||||
info: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
|
||||
return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_2, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($options.contractType) + " vom " + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contract.date), 1
|
||||
return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_2, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contract.type_formatted) + " vom " + (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contract.date), 1
|
||||
/* TEXT */
|
||||
), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_3, [_hoisted_4, (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_5, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.contract.date), 1
|
||||
/* TEXT */
|
||||
|
|
@ -63135,12 +63080,9 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* harmony export */ });
|
||||
/* harmony import */ var _ContractForm_vue_vue_type_template_id_6782cc08__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ContractForm.vue?vue&type=template&id=6782cc08 */ "./resources/js/Pages/Contracts/Components/ContractForm.vue?vue&type=template&id=6782cc08");
|
||||
/* harmony import */ var _ContractForm_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ContractForm.vue?vue&type=script&lang=js */ "./resources/js/Pages/Contracts/Components/ContractForm.vue?vue&type=script&lang=js");
|
||||
/* harmony import */ var vue_multiselect_dist_vue_multiselect_css_vue_type_style_index_0_lang_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! vue-multiselect/dist/vue-multiselect.css?vue&type=style&index=0&lang=css */ "./node_modules/vue-multiselect/dist/vue-multiselect.css?vue&type=style&index=0&lang=css");
|
||||
|
||||
|
||||
|
||||
|
||||
;
|
||||
_ContractForm_vue_vue_type_script_lang_js__WEBPACK_IMPORTED_MODULE_1__.default.render = _ContractForm_vue_vue_type_template_id_6782cc08__WEBPACK_IMPORTED_MODULE_0__.render
|
||||
/* hot reload */
|
||||
if (false) {}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
<div v-if="contact.company" class="font-bold">
|
||||
{{ contact.company }}
|
||||
</div>
|
||||
<div v-if="contact.lastname && contact.firstname">
|
||||
{{ contact.lastname + ' ' + contact.firstname }}
|
||||
<div v-if="contact.name">
|
||||
{{ contact.name }}
|
||||
</div>
|
||||
<div v-if="contact.address">
|
||||
{{ contact.address }}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<template #header>
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
<bread-crumb text="Kontakte" :href="route('contacts')" />
|
||||
<bread-crumb :text="title" :href="route('contacts.show', contact.id)" />
|
||||
<bread-crumb :text="contact.title" :href="route('contacts.show', contact.id)" />
|
||||
bearbeiten
|
||||
</h2>
|
||||
</template>
|
||||
|
|
@ -58,14 +58,5 @@ export default {
|
|||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
title: function () {
|
||||
if (this.data.company) {
|
||||
return this.data.company;
|
||||
}
|
||||
|
||||
return this.data.lastname + ' ' + this.data.firstname;
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<template #header>
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
<bread-crumb text="Kontakte" :href="route('contacts')" />
|
||||
{{ title }}
|
||||
{{ contact.title }}
|
||||
</h2>
|
||||
</template>
|
||||
|
||||
|
|
@ -83,14 +83,5 @@ export default {
|
|||
currentRoute: 'contacts.show',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
title: function () {
|
||||
if (this.contact.company) {
|
||||
return this.contact.company;
|
||||
}
|
||||
|
||||
return this.contact.lastname + ' ' + this.contact.firstname;
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -25,11 +25,12 @@
|
|||
|
||||
<div v-if="form.is_sell_contract" class="col-span-6 sm:col-span-4">
|
||||
<jet-label for="insurance_type" value="Versicherung" />
|
||||
<multiselect class="mt-1 block w-full" @select="updateInsuranceSelection" v-model="insuranceSelection" deselect-label="Kann nicht entfernt werden" track-by="key" label="label" placeholder="Versicherung auswählen" :options="insurances" :searchable="false" :allow-empty="false" />
|
||||
<select v-model="form.insurance_type" class="mt-1 block w-full border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm">
|
||||
<option v-for="(insurance, index) in insurance_types" :value="index" :selected="form.insurance_type == index">{{ insurance }}</option>
|
||||
</select>
|
||||
<jet-input-error :message="form.errors.insurance_type" class="mt-2" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<template #actions>
|
||||
|
|
@ -52,7 +53,6 @@ import JetInput from '@/Jetstream/Input.vue'
|
|||
import JetActionMessage from '@/Jetstream/ActionMessage'
|
||||
import JetInputError from '@/Jetstream/InputError'
|
||||
import JetFormSection from '@/Jetstream/FormSection'
|
||||
import Multiselect from 'vue-multiselect'
|
||||
import Datepicker from 'vue3-datepicker'
|
||||
import { useForm } from '@inertiajs/inertia-vue3'
|
||||
|
||||
|
|
@ -64,43 +64,22 @@ export default {
|
|||
JetInput,
|
||||
JetInputError,
|
||||
JetActionMessage,
|
||||
Multiselect,
|
||||
Datepicker,
|
||||
},
|
||||
props: {
|
||||
data: Object,
|
||||
meta: Object,
|
||||
insurance_types: Object,
|
||||
insurance_types: Array,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: useForm(this.meta.form_name, this.data),
|
||||
insuranceSelection: {key: this.data.insurance_type, label: 'asd'},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
insurances: function() {
|
||||
let insurances = [];
|
||||
for (const label in this.insurance_types) {
|
||||
insurances.push({key: this.insurance_types[label], label: label});
|
||||
}
|
||||
return insurances;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.form.date = this.form.date.toISOString().split("T")[0];
|
||||
this.form.submit(this.meta.method, this.meta.route);
|
||||
},
|
||||
updateInsuranceSelection(selection) {
|
||||
this.form.insurance_type = (selection.key).toString();
|
||||
},
|
||||
},
|
||||
mounted: function () {
|
||||
this.$nextTick(function () {
|
||||
this.insuranceSelection = this.insurances.find(x => x.key === parseInt(this.data.insurance_type));
|
||||
})
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
<contact-card class="col-span-12" :contact="contact" />
|
||||
</template>
|
||||
</jet-form-section>
|
||||
<contract-form class="mt-5" :data="data" :meta="meta">
|
||||
<contract-form class="mt-5" :data="data" :meta="meta" :insurance_types="insurance_types">
|
||||
<template #title>Vertragsinformationen erfassen</template>
|
||||
<template #description>Der Vertrag kann anschliessend gespeichert werden.</template>
|
||||
</contract-form>
|
||||
|
|
@ -76,6 +76,7 @@ export default {
|
|||
contact: Object,
|
||||
type: String,
|
||||
car_first: Boolean,
|
||||
insurance_types: Array,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -90,7 +91,7 @@ export default {
|
|||
id: null,
|
||||
date: ref(new Date()),
|
||||
price: null,
|
||||
type: this.type == "SellContract" ? '0' : '1',
|
||||
type: this.type,
|
||||
insurance_type: '0',
|
||||
car_id: this.car.id,
|
||||
contact_id: this.contact.id,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
<bread-crumb text="Autos" :href="route('cars')" />
|
||||
<bread-crumb :text="contract.car.name" :href="route('cars.show', contract.car.id)" />
|
||||
<bread-crumb :text="'Vertrag vom ' + contract.date_formatted" :href="route('contracts.show', contract.id)" />
|
||||
<bread-crumb :text="contract.type_formatted + ' vom ' + contract.date_formatted" :href="route('contracts.show', contract.id)" />
|
||||
bearbeiten
|
||||
</h2>
|
||||
</template>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<contract-form :data="data" :insurance_types="insurance_types" :meta="meta">
|
||||
<template #title>Vertragsangaben</template>
|
||||
<template #description>
|
||||
Vertrag & anpassen.
|
||||
{{ contract.type_formatted }} & anpassen.
|
||||
</template>
|
||||
</contract-form>
|
||||
</div>
|
||||
|
|
@ -33,7 +33,7 @@ export default {
|
|||
},
|
||||
props: {
|
||||
contract: Object,
|
||||
insurance_types: Object,
|
||||
insurance_types: Array,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
<template #header>
|
||||
<bread-crumb text="Autos" :href="route('cars')" />
|
||||
<bread-crumb :text="contract.car.name" :href="route('cars.show', contract.car.id)" />
|
||||
{{ contractType}} vom {{ contract.date }}
|
||||
{{ contract.type_formatted }} vom {{ contract.date }}
|
||||
</template>
|
||||
<template #info>
|
||||
<div class="p-5 bg-white shadow rounded-md font-medium">
|
||||
<div class="font-bold pb-1 mb-1 text-2xl border-b">
|
||||
{{ contractType}} vom {{ contract.date }}
|
||||
{{ contract.type_formatted }} vom {{ contract.date }}
|
||||
</div>
|
||||
<div class="grid grid-cols-4 gap-2 w-full">
|
||||
<div class="col-span-1 xs:col-span-2">
|
||||
|
|
@ -105,11 +105,8 @@ export default {
|
|||
contract: Object,
|
||||
},
|
||||
computed: {
|
||||
contractType: function() {
|
||||
return this.contract.type == 0 ? 'Ankaufsvertrag' : 'Verkaufsvertrag';
|
||||
},
|
||||
contactTitle: function() {
|
||||
return this.contract.type == 0 ? 'Verkäufer' : 'Käufer';
|
||||
return this.contract.is_sell_contract ? 'Käufer' : 'Verkäufer';
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ Route::middleware(['auth:sanctum', 'verified'])->group(function () {
|
|||
Route::prefix('contracts')->group(function () {
|
||||
Route::post('/', [ContractController::class, 'store'])->name('contracts.store');
|
||||
|
||||
Route::prefix('create/{0|1}/')->group(function () {
|
||||
Route::get('car/{car}/contact/{contact}', [ContractController::class, 'create'])->name('contracts.create');
|
||||
Route::get('car/{car}', [ContractController::class, 'createFromCar'])->name('contracts.create_from_car');
|
||||
Route::get('contact/{contact}', [ContractController::class, 'createFromContact'])->name('contracts.create_from_contact');
|
||||
Route::prefix('create/{type}')->group(function () {
|
||||
Route::get('car/{car}/contact/{contact}', [ContractController::class, 'create'])->where('type', '0|1')->name('contracts.create');
|
||||
Route::get('car/{car}', [ContractController::class, 'createFromCar'])->where('type', '0|1')->name('contracts.create_from_car');
|
||||
Route::get('contact/{contact}', [ContractController::class, 'createFromContact'])->where('type', '0|1')->name('contracts.create_from_contact');
|
||||
});
|
||||
|
||||
Route::prefix('{contract}')->group(function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue