add new paymenttype 'cembra'
parent
93877cd90c
commit
6cd67a5280
|
|
@ -18,4 +18,4 @@ Steps:
|
||||||
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`
|
||||||
5. Access the web application at `0.0.0.0`
|
5. Access the web application at `0.0.0.0`
|
||||||
6. The default credentials are `hello@salloum.ch` and `abc123`
|
6. The default credentials can be seen/set in the .env
|
||||||
|
|
@ -12,4 +12,5 @@ final class PaymentType extends Enum
|
||||||
{
|
{
|
||||||
const Transaction = '0';
|
const Transaction = '0';
|
||||||
const Cash = '1';
|
const Cash = '1';
|
||||||
|
const Cembra = '2';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,12 @@ class Contract extends Model
|
||||||
return Money::CHF($this->payments()->transactionOnly()->sum('amount'));
|
return Money::CHF($this->payments()->transactionOnly()->sum('amount'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPaidInCembraAttribute()
|
||||||
|
{
|
||||||
|
|
||||||
|
return Money::CHF($this->payments()->cembraOnly()->sum('amount'));
|
||||||
|
}
|
||||||
|
|
||||||
public function getLeftToPayAttribute()
|
public function getLeftToPayAttribute()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,27 @@ class Payment extends Model
|
||||||
|
|
||||||
public function getTypeAttribute($type)
|
public function getTypeAttribute($type)
|
||||||
{
|
{
|
||||||
return $type == PaymentType::Transaction() ? 'Banküberweisung' : 'Barzahlung';
|
|
||||||
|
switch ($type) {
|
||||||
|
case PaymentType::Transaction():
|
||||||
|
return 'Banküberweisung';
|
||||||
|
case PaymentType::Cash():
|
||||||
|
return 'Barzahlung';
|
||||||
|
default:
|
||||||
|
return 'Überweisung via Cembra';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTypeTextAttribute()
|
public function getTypeTextAttribute()
|
||||||
{
|
{
|
||||||
return $this->type == 'Banküberweisung' ? 'via Banküberweisung erhalten' : 'in bar erhalten';
|
switch ($this->type) {
|
||||||
|
case 'Banküberweisung':
|
||||||
|
return 'via Banküberweisung erhalten';
|
||||||
|
case 'Barzahlung':
|
||||||
|
return 'in bar erhalten';
|
||||||
|
default:
|
||||||
|
return 'via Cembra-Überweisung erhalten';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDeleteLinkAttribute()
|
public function getDeleteLinkAttribute()
|
||||||
|
|
@ -64,4 +79,9 @@ class Payment extends Model
|
||||||
{
|
{
|
||||||
$query->where('type', PaymentType::Transaction());
|
$query->where('type', PaymentType::Transaction());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeCembraOnly($query)
|
||||||
|
{
|
||||||
|
$query->where('type', PaymentType::Cembra());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22324,7 +22324,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
||||||
colour: this.car.colour,
|
colour: this.car.colour,
|
||||||
notes: this.car.notes,
|
notes: this.car.notes,
|
||||||
car_model_id: this.car.car_model.id,
|
car_model_id: this.car.car_model.id,
|
||||||
last_check_date: new Date(this.car.last_check_date).toJSON().slice(0, 10).split('-').reverse().join('.'),
|
last_check_date: this.car.last_check_date ? new Date(this.car.last_check_date).toJSON().slice(0, 10).split('-').reverse().join('.') : '',
|
||||||
kilometers: this.car.kilometers,
|
kilometers: this.car.kilometers,
|
||||||
known_damage: this.car.known_damage
|
known_damage: this.car.known_damage
|
||||||
}, "notes", this.car.notes)
|
}, "notes", this.car.notes)
|
||||||
|
|
@ -25488,8 +25488,9 @@ var _hoisted_5 = {
|
||||||
};
|
};
|
||||||
var _hoisted_6 = ["selected"];
|
var _hoisted_6 = ["selected"];
|
||||||
var _hoisted_7 = ["selected"];
|
var _hoisted_7 = ["selected"];
|
||||||
|
var _hoisted_8 = ["selected"];
|
||||||
|
|
||||||
var _hoisted_8 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Einzahlung speichern ");
|
var _hoisted_9 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)(" Einzahlung speichern ");
|
||||||
|
|
||||||
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||||
var _component_jet_label = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("jet-label");
|
var _component_jet_label = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("jet-label");
|
||||||
|
|
@ -25574,7 +25575,12 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||||
selected: $data.form.type == '1'
|
selected: $data.form.type == '1'
|
||||||
}, "Barzahlung", 8
|
}, "Barzahlung", 8
|
||||||
/* PROPS */
|
/* PROPS */
|
||||||
, _hoisted_7)], 512
|
, _hoisted_7), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("option", {
|
||||||
|
value: "2",
|
||||||
|
selected: $data.form.type == '2'
|
||||||
|
}, "Cembra-Überweisung", 8
|
||||||
|
/* PROPS */
|
||||||
|
, _hoisted_8)], 512
|
||||||
/* NEED_PATCH */
|
/* NEED_PATCH */
|
||||||
), [[vue__WEBPACK_IMPORTED_MODULE_0__.vModelSelect, $data.form.type]]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_input_error, {
|
), [[vue__WEBPACK_IMPORTED_MODULE_0__.vModelSelect, $data.form.type]]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_input_error, {
|
||||||
message: $data.form.errors.type,
|
message: $data.form.errors.type,
|
||||||
|
|
@ -25594,7 +25600,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||||
disabled: $data.form.processing
|
disabled: $data.form.processing
|
||||||
}, {
|
}, {
|
||||||
"default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
|
"default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
|
||||||
return [_hoisted_8];
|
return [_hoisted_9];
|
||||||
}),
|
}),
|
||||||
_: 1
|
_: 1
|
||||||
/* STABLE */
|
/* STABLE */
|
||||||
|
|
@ -31162,7 +31168,8 @@ var _hoisted_8 = {
|
||||||
};
|
};
|
||||||
var _hoisted_9 = ["selected"];
|
var _hoisted_9 = ["selected"];
|
||||||
var _hoisted_10 = ["selected"];
|
var _hoisted_10 = ["selected"];
|
||||||
var _hoisted_11 = {
|
var _hoisted_11 = ["selected"];
|
||||||
|
var _hoisted_12 = {
|
||||||
"class": "col-span-6"
|
"class": "col-span-6"
|
||||||
};
|
};
|
||||||
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||||
|
|
@ -31311,14 +31318,19 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||||
selected: $data.form.payment_type == '1'
|
selected: $data.form.payment_type == '1'
|
||||||
}, "Barzahlung", 8
|
}, "Barzahlung", 8
|
||||||
/* PROPS */
|
/* PROPS */
|
||||||
, _hoisted_10)], 512
|
, _hoisted_10), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("option", {
|
||||||
|
value: "2",
|
||||||
|
selected: $data.form.payment_type == '2'
|
||||||
|
}, "Cembra-Überweisung", 8
|
||||||
|
/* PROPS */
|
||||||
|
, _hoisted_11)], 512
|
||||||
/* NEED_PATCH */
|
/* NEED_PATCH */
|
||||||
), [[vue__WEBPACK_IMPORTED_MODULE_0__.vModelSelect, $data.form.payment_type]]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_input_error, {
|
), [[vue__WEBPACK_IMPORTED_MODULE_0__.vModelSelect, $data.form.payment_type]]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_input_error, {
|
||||||
message: $data.form.errors.type,
|
message: $data.form.errors.type,
|
||||||
"class": "mt-2"
|
"class": "mt-2"
|
||||||
}, null, 8
|
}, null, 8
|
||||||
/* PROPS */
|
/* PROPS */
|
||||||
, ["message"])])) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_11, [(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__.createElementVNode)("div", _hoisted_12, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_jet_label, {
|
||||||
"for": "notes",
|
"for": "notes",
|
||||||
value: "Bemerkungen"
|
value: "Bemerkungen"
|
||||||
}), (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)((0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("textarea", {
|
}), (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)((0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("textarea", {
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
<select v-model="form.type" class="mt-1 block w-full border-gray-300 rounded-md shadow-sm">
|
<select v-model="form.type" class="mt-1 block w-full border-gray-300 rounded-md shadow-sm">
|
||||||
<option value="0" :selected="form.type == '0'">Banküberweisung</option>
|
<option value="0" :selected="form.type == '0'">Banküberweisung</option>
|
||||||
<option value="1" :selected="form.type == '1'">Barzahlung</option>
|
<option value="1" :selected="form.type == '1'">Barzahlung</option>
|
||||||
|
<option value="2" :selected="form.type == '2'">Cembra-Überweisung</option>
|
||||||
</select>
|
</select>
|
||||||
<jet-input-error :message="form.errors.type" class="mt-2" />
|
<jet-input-error :message="form.errors.type" class="mt-2" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ export default {
|
||||||
colour: this.car.colour,
|
colour: this.car.colour,
|
||||||
notes: this.car.notes,
|
notes: this.car.notes,
|
||||||
car_model_id: this.car.car_model.id,
|
car_model_id: this.car.car_model.id,
|
||||||
last_check_date: new Date(this.car.last_check_date).toJSON().slice(0,10).split('-').reverse().join('.'),
|
last_check_date: this.car.last_check_date ? new Date(this.car.last_check_date).toJSON().slice(0,10).split('-').reverse().join('.') : '',
|
||||||
kilometers: this.car.kilometers,
|
kilometers: this.car.kilometers,
|
||||||
known_damage: this.car.known_damage,
|
known_damage: this.car.known_damage,
|
||||||
notes: this.car.notes,
|
notes: this.car.notes,
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@
|
||||||
<select v-model="form.payment_type" class="mt-1 block w-full border-gray-300 rounded-md shadow-sm">
|
<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>
|
<option value="0" :selected="form.payment_type == '0'">Banküberweisung</option>
|
||||||
<option value="1" :selected="form.payment_type == '1'">Barzahlung</option>
|
<option value="1" :selected="form.payment_type == '1'">Barzahlung</option>
|
||||||
|
<option value="2" :selected="form.payment_type == '2'">Cembra-Überweisung</option>
|
||||||
</select>
|
</select>
|
||||||
<jet-input-error :message="form.errors.type" class="mt-2" />
|
<jet-input-error :message="form.errors.type" class="mt-2" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -153,21 +153,35 @@ MwSt-Nr: CHE-226.272.050
|
||||||
<td>{{ $contract->insurance_type_formatted }}</td>
|
<td>{{ $contract->insurance_type_formatted }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td> </td></tr>
|
<tr><td> </td></tr>
|
||||||
|
</table>
|
||||||
|
<table width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Kaufpreis</td>
|
<td width="20%">Kaufpreis</td>
|
||||||
<td><b>{{ $contract->price }}</b></td>
|
<td width="80%"><b>{{ $contract->price }}</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td valign="top">Anzahlung</td>
|
<td valign="top">Anzahlung</td>
|
||||||
@if ($contract->paid_in_cash->getAmount() && $contract->paid_in_transaction->getAmount())
|
<td>
|
||||||
<td>{{ $contract->paid_in_cash }} in bar<br>{{ $contract->paid_in_transaction }} via Überweisung</td>
|
@if ($contract->paid_in_cash->getAmount() || $contract->paid_in_transaction->getAmount() || $contract->paid_in_cembra->getAmount())
|
||||||
@elseif ($contract->paid_in_cash->getAmount())
|
@if ($contract->paid_in_cash->getAmount())
|
||||||
<td>{{ $contract->paid_in_cash }} in bar</td>
|
{{ $contract->paid_in_cash }} in bar
|
||||||
@elseif ($contract->paid_in_transaction->getAmount())
|
@if ($contract->paid_in_transaction->getAmount() || $contract->paid_in_cembra->getAmount())
|
||||||
<td>{{ $contract->paid_in_transaction }} via Überweisung</td>
|
<br>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
@if ($contract->paid_in_transaction->getAmount())
|
||||||
|
{{ $contract->paid_in_transaction }} via Überweisung
|
||||||
|
@if ($contract->paid_in_cembra->getAmount())
|
||||||
|
<br>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
@if ($contract->paid_in_cembra->getAmount())
|
||||||
|
{{ $contract->paid_in_cembra }} via Cembra-Überweisung
|
||||||
|
@endif
|
||||||
@else
|
@else
|
||||||
<td>{{ $contract->paid }}</td>
|
{{ $contract->paid }}
|
||||||
@endif
|
@endif
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Restbetrag</td>
|
<td>Restbetrag</td>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue