add dompdf
parent
d5c36b1998
commit
91d1cdd15a
|
|
@ -8,6 +8,7 @@ use App\Models\Brand;
|
|||
use App\Models\Contact;
|
||||
use App\Models\Contract;
|
||||
use App\Enums\ContractType;
|
||||
use Barryvdh\DomPDF\Facade as PDF;
|
||||
use App\Enums\InsuranceType;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
|
|
@ -226,7 +227,16 @@ class ContractController extends Controller
|
|||
|
||||
public function print(Contract $contract)
|
||||
{
|
||||
return view('contract', ['contract' => $contract]);
|
||||
$contxt = stream_context_create([
|
||||
'ssl' => [
|
||||
'verify_peer' => FALSE,
|
||||
'verify_peer_name' => FALSE,
|
||||
'allow_self_signed'=> TRUE
|
||||
]
|
||||
]);
|
||||
$pdf = PDF::setOptions(['isHtml5ParserEnabled' => true, 'isRemoteEnabled' => true])->loadView('contract', compact('contract'));//->setPaper('a4', 'portrait');
|
||||
$pdf->getDomPDF()->setHttpContext($contxt);
|
||||
return $pdf->stream($contract->date . '_' . $contract->type_formatted . '.pdf');
|
||||
}
|
||||
|
||||
public function destroy(Contract $contract)
|
||||
|
|
|
|||
|
|
@ -70,6 +70,11 @@ class Contract extends Model
|
|||
return $this->type === (string)ContractType::SellContract;
|
||||
}
|
||||
|
||||
public function getTypeFormattedAttribute()
|
||||
{
|
||||
return $this->isSellContract() ? 'Kaufsvertrag' : 'Ankaufsvertrag';
|
||||
}
|
||||
|
||||
public function documents()
|
||||
{
|
||||
return $this->morphMany(Document::class, 'documentable');
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.3|^8.0",
|
||||
"barryvdh/laravel-dompdf": "^0.9.0",
|
||||
"bensampo/laravel-enum": "^3.3",
|
||||
"cknow/laravel-money": "^6.1",
|
||||
"fideloper/proxy": "^4.4",
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -176,6 +176,7 @@ return [
|
|||
App\Providers\RouteServiceProvider::class,
|
||||
App\Providers\FortifyServiceProvider::class,
|
||||
App\Providers\JetstreamServiceProvider::class,
|
||||
Barryvdh\DomPDF\ServiceProvider::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
@ -228,6 +229,7 @@ return [
|
|||
'URL' => Illuminate\Support\Facades\URL::class,
|
||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
'PDF' => Barryvdh\DomPDF\Facade::class,
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
|
|
@ -16876,15 +16876,22 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _StandardButton_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./StandardButton.vue */ "./resources/js/Components/Buttons/StandardButton.vue");
|
||||
|
||||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
||||
components: {
|
||||
StandardButton: _StandardButton_vue__WEBPACK_IMPORTED_MODULE_0__.default
|
||||
},
|
||||
props: {
|
||||
"class": String,
|
||||
href: String
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
colour: 'indigo'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
allClasses: function allClasses() {
|
||||
var classes = "justify-center inline-flex items-center px-4 py-2 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest focus:outline-none focus:ring disabled:opacity-25 transition";
|
||||
classes += " bg-".concat(this.colour, "-800 hover:bg-").concat(this.colour, "-700 active:bg-").concat(this.colour, "-900 focus:border-").concat(this.colour, "-900 focus:ring-").concat(this.colour, "-300");
|
||||
return classes + " " + this["class"];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -19732,7 +19739,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 == "SellContract" ? '0' : '1',
|
||||
insurance_type: '0',
|
||||
car_id: this.car.id,
|
||||
contact_id: this.contact.id
|
||||
|
|
@ -21112,28 +21119,19 @@ var _hoisted_1 = /*#__PURE__*/(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNod
|
|||
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
var _component_unicon = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("unicon");
|
||||
|
||||
var _component_standard_button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("standard-button");
|
||||
|
||||
return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_standard_button, {
|
||||
return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("a", {
|
||||
href: $props.href,
|
||||
"class": this["class"],
|
||||
colour: "gray"
|
||||
}, {
|
||||
"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_1];
|
||||
}),
|
||||
_: 1
|
||||
/* STABLE */
|
||||
|
||||
}, 8
|
||||
/* PROPS */
|
||||
, ["href", "class"]);
|
||||
target: "_blank",
|
||||
"class": $options.allClasses
|
||||
}, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_unicon, {
|
||||
fill: "white",
|
||||
"class": "mr-1",
|
||||
height: "22",
|
||||
width: "22",
|
||||
name: "file-download"
|
||||
}), _hoisted_1], 10
|
||||
/* CLASS, PROPS */
|
||||
, ["href"]);
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
|
|
|||
|
|
@ -1,18 +1,27 @@
|
|||
<template>
|
||||
<standard-button :href="href" :class="this.class" colour="gray">
|
||||
<a :href="href" target="_blank" :class="allClasses">
|
||||
<unicon fill="white" class="mr-1" height="22" width="22" name="file-download"></unicon>
|
||||
drucken
|
||||
</standard-button>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import StandardButton from './StandardButton.vue';
|
||||
|
||||
export default {
|
||||
components: { StandardButton },
|
||||
props: {
|
||||
class: String,
|
||||
href: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
colour: 'indigo',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
allClasses: function () {
|
||||
let classes = "justify-center inline-flex items-center px-4 py-2 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest focus:outline-none focus:ring disabled:opacity-25 transition"
|
||||
classes += ` bg-${this.colour}-800 hover:bg-${this.colour}-700 active:bg-${this.colour}-900 focus:border-${this.colour}-900 focus:ring-${this.colour}-300`;
|
||||
return classes + " " + this.class;
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -90,7 +90,7 @@ export default {
|
|||
id: null,
|
||||
date: ref(new Date()),
|
||||
price: null,
|
||||
type: this.type == "SellContract" ? 0 : 1,
|
||||
type: this.type == "SellContract" ? '0' : '1',
|
||||
insurance_type: '0',
|
||||
car_id: this.car.id,
|
||||
contact_id: this.contact.id,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue