diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php
index 5e04c6c..f7eb015 100644
--- a/app/Http/Controllers/ContactController.php
+++ b/app/Http/Controllers/ContactController.php
@@ -256,7 +256,7 @@ class ContactController extends Controller
'firstname' => ['max:75'],
'lastname' => ['max:75'],
'email' => ['nullable', 'max:75', 'email'],
- 'phone' => ['required', 'max:75'],
+ 'phone' => ['nullable', 'max:75'],
'address' => ['nullable', 'max:150'],
'zip' => ['nullable', 'max:6'],
'city' => ['nullable', 'max:75'],
diff --git a/app/Http/Controllers/ContractController.php b/app/Http/Controllers/ContractController.php
index 1a2727d..4b2b19e 100644
--- a/app/Http/Controllers/ContractController.php
+++ b/app/Http/Controllers/ContractController.php
@@ -171,7 +171,7 @@ class ContractController extends Controller
'contract_id' => $contract->id,
]);
- if ($request->get('amount') && $request->get('type')) {
+ if ($request->get('amount') !== null && $request->get('type') !== null) {
Payment::create(
$request->validate([
'date' => ['required', 'date'],
diff --git a/app/Http/Controllers/DocumentController.php b/app/Http/Controllers/DocumentController.php
index 0af60d8..dbdddd2 100644
--- a/app/Http/Controllers/DocumentController.php
+++ b/app/Http/Controllers/DocumentController.php
@@ -16,7 +16,7 @@ class DocumentController extends Controller
header('Content-Disposition: filename="' . $document->name . '"');
return response()->file($document->path);
}
-
+
abort(404);
}
diff --git a/app/Models/Payment.php b/app/Models/Payment.php
index 72fba6c..e334e73 100644
--- a/app/Models/Payment.php
+++ b/app/Models/Payment.php
@@ -42,12 +42,12 @@ class Payment extends Model
public function getTypeAttribute($type)
{
- return $type == PaymentType::Transaction() ? 'Überweisung' : 'Barzahlung';
+ return $type == PaymentType::Transaction() ? 'Banküberweisung' : 'Barzahlung';
}
public function getTypeTextAttribute()
{
- return $this->type == PaymentType::Transaction() ? 'Als Überweisung erhalten' : 'in bar erhalten';
+ return $this->type == PaymentType::Transaction() ? 'Als Banküberweisung erhalten' : 'in bar erhalten';
}
public function getDeleteLinkAttribute()
diff --git a/database/migrations/2021_05_10_135156_create_contacts_table.php b/database/migrations/2021_05_10_135156_create_contacts_table.php
index 5c624b2..cc6c8fd 100644
--- a/database/migrations/2021_05_10_135156_create_contacts_table.php
+++ b/database/migrations/2021_05_10_135156_create_contacts_table.php
@@ -17,7 +17,7 @@ class CreateContactsTable extends Migration
$table->id();
$table->string('firstname', 75)->nullable();
$table->string('lastname', 75)->nullable();
- $table->string('phone', 75);
+ $table->string('phone', 75)->nullable();
$table->string('address', 150)->nullable();
$table->string('zip', 6)->nullable();
$table->string('city', 75)->nullable();
diff --git a/database/migrations/2021_05_10_135957_create_cars_table.php b/database/migrations/2021_05_10_135957_create_cars_table.php
index c8d1fc0..dde9009 100644
--- a/database/migrations/2021_05_10_135957_create_cars_table.php
+++ b/database/migrations/2021_05_10_135957_create_cars_table.php
@@ -20,9 +20,9 @@ class CreateCarsTable extends Migration
$table->string('colour')->nullable();
$table->text('notes')->nullable();
$table->text('known_damage')->nullable();
- $table->date('initial_date');
- $table->date('last_check_date');
- $table->integer('kilometers');
+ $table->date('initial_date')->nullable();
+ $table->date('last_check_date')->nullable();
+ $table->integer('kilometers')->nullable();
$table->foreignId('car_model_id')
->onUpdate('cascade')
->onDelete('cascade')
diff --git a/public/js/app.js b/public/js/app.js
index 673db93..2928e44 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -21482,7 +21482,8 @@ __webpack_require__.r(__webpack_exports__);
route: this.route('contracts.update', this.contract.id),
method: 'put',
button_text: 'Änderungen speichern',
- on_success: 'Änderungen gespeichert'
+ on_success: 'Änderungen gespeichert',
+ is_edit: true
},
data: {
date: new Date(this.contract.date).toJSON().slice(0, 10).split('-').reverse().join('.'),
@@ -29407,9 +29408,11 @@ var _hoisted_5 = {
"class": "col-span-6"
};
var _hoisted_6 = {
+ key: 1,
"class": "col-span-6"
};
var _hoisted_7 = {
+ key: 2,
"class": "col-span-6"
};
var _hoisted_8 = {
@@ -29524,7 +29527,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
"class": "mt-2"
}, null, 8
/* PROPS */
- , ["message"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_6, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_label, {
+ , ["message"])]), !$props.meta.is_edit ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_6, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_label, {
"for": "amount",
value: "Anzahlung"
}), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_currency_input, {
@@ -29543,7 +29546,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
"class": "mt-2"
}, null, 8
/* PROPS */
- , ["message"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_7, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_label, {
+ , ["message"])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), !$props.meta.is_edit ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("div", _hoisted_7, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_label, {
"for": "payment_type",
value: "Einzahlungsart"
}), (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)((0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("select", {
@@ -29568,7 +29571,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
"class": "mt-2"
}, null, 8
/* PROPS */
- , ["message"])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_8, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_label, {
+ , ["message"])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_8, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_label, {
"for": "notes",
value: "Bemerkungen"
}), (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)((0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("textarea", {
@@ -29605,7 +29608,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
"class": {
'opacity-25': $data.form.processing
},
- disabled: $data.form.processing || !$props.data.contact_id || !$props.data.car_id
+ disabled: $data.form.processing || (!$props.data.contact_id || !$props.data.car_id) && !$props.meta.is_edit
}, {
"default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)($props.meta.button_text), 1
diff --git a/resources/js/Pages/Contracts/Components/ContractForm.vue b/resources/js/Pages/Contracts/Components/ContractForm.vue
index 62744c1..d4021a7 100644
--- a/resources/js/Pages/Contracts/Components/ContractForm.vue
+++ b/resources/js/Pages/Contracts/Components/ContractForm.vue
@@ -35,13 +35,13 @@