small fixes

shift-build-2464
Nadim Salloum 2021-06-24 18:42:09 +03:00
parent 179e63a88f
commit 9c747b2aee
9 changed files with 21 additions and 17 deletions

View File

@ -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'],

View File

@ -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'],

View File

@ -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()

View File

@ -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();

View File

@ -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')

13
public/js/app.js vendored
View File

@ -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

View File

@ -35,13 +35,13 @@
<jet-input-error :message="form.errors.price" class="mt-2" />
</div>
<div class="col-span-6">
<div v-if="!meta.is_edit" class="col-span-6">
<jet-label for="amount" value="Anzahlung" />
<currency-input v-model="form.amount" :options="currencyOptions" id="price" class="w-full mt-1 block border-gray-300 rounded-md shadow-sm" ref="amount"/>
<jet-input-error :message="form.errors.amount" class="mt-2" />
</div>
<div class="col-span-6">
<div v-if="!meta.is_edit" class="col-span-6">
<jet-label for="payment_type" value="Einzahlungsart" />
<select v-model="form.payment_type" class="mt-1 block w-full border-gray-300 rounded-md shadow-sm">
<option value="0" :selected="form.payment_type == '0'">Banküberweisung</option>
@ -64,7 +64,7 @@
{{ meta.on_success }}
</jet-action-message>
<jet-button :class="{ 'opacity-25': form.processing }" :disabled="form.processing || !data.contact_id || !data.car_id">
<jet-button :class="{ 'opacity-25': form.processing }" :disabled="form.processing || ((!data.contact_id || !data.car_id) && !meta.is_edit)">
{{ meta.button_text }}
</jet-button>
</template>

View File

@ -43,6 +43,7 @@ export default {
method: 'put',
button_text: 'Änderungen speichern',
on_success: 'Änderungen gespeichert',
is_edit: true,
},
data: {
date: new Date(this.contract.date).toJSON().slice(0,10).split('-').reverse().join('.'),