diff --git a/Layout/default/Cpeprovisioning/PDF_MAIN.php b/Layout/default/Cpeprovisioning/PDF_MAIN.php new file mode 100644 index 000000000..edad91437 --- /dev/null +++ b/Layout/default/Cpeprovisioning/PDF_MAIN.php @@ -0,0 +1,45 @@ +setReturnValue(['filename' => "xyz." . time() . "pdf"]); +?> + + + + CPE-Etikett + + + + +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/application/Cpeprovisioning/CpeprovisioningController.php b/application/Cpeprovisioning/CpeprovisioningController.php index 682bbb35c..a64f6a42c 100644 --- a/application/Cpeprovisioning/CpeprovisioningController.php +++ b/application/Cpeprovisioning/CpeprovisioningController.php @@ -482,9 +482,9 @@ class CpeprovisioningController extends mfBaseController 'show_snopp_button' => ($attrs['hostnetwork_order']->value ?? 0) == 1 && !str_contains($product->product->name, 'XDSL'), 'snopp_url' => 'https://snopp.breitband-steiermark.at/Termination/index?filter[status][]=connected&filter[address]=' . urlencode($order->owner->street), 'vlans' => [ - 'public' => ['tag' => $cpe->vlan_public ?? $vlanPublicDefault, 'checked' => $product->cpeprovisioning->vlan_public], - 'nat' => ['tag' => $cpe->vlan_nat ?? $vlanNatDefault, 'checked' => $product->cpeprovisioning->vlan_nat], - 'ipv6' => ['tag' => $cpe->vlan_ipv6 ?? $vlanIpv6Default, 'checked' => $product->cpeprovisioning->vlan_ipv6], + 'public' => ['tag' => ($cpe ? $cpe->vlan_public : null) ?? $vlanPublicDefault, 'checked' => ($cpe ? $cpe->vlan_public : null)], + 'nat' => ['tag' => ($cpe ? $cpe->vlan_nat : null) ?? $vlanNatDefault, 'checked' => ($cpe ? $cpe->vlan_nat : null)], + 'ipv6' => ['tag' => ($cpe ? $cpe->vlan_ipv6 : null) ?? $vlanIpv6Default, 'checked' => ($cpe ? $cpe->vlan_ipv6 : null)], ], 'cpe_id' => $cpe->id ?? null, 'cpe_data' => $this->fixCpeData($cpe->data ?? null), @@ -520,6 +520,7 @@ class CpeprovisioningController extends mfBaseController // Pass API URLs and initial data to the frontend "CPE_PROV_API_GET_URL" => $this->getUrl("Cpeprovisioning", "apiGet"), "CPE_PROV_API_SAVE_URL" => $this->getUrl("Cpeprovisioning", "apiSave"), + "CPE_PROV_PRINT_PDF_URL" => $this->getUrl("Cpeprovisioning", "printPDF"), "ORDER_URL" => $this->getUrl("Order"), "NETWORKS" => NetworkModel::getAll(), "ROUTER_OPTIONS" => [ @@ -540,6 +541,13 @@ class CpeprovisioningController extends mfBaseController ['value' => 'Mikrotik RB3011', 'text' => 'Mikrotik RB3011 (Inet, IPTV)'], // CMTS Routers ['value' => 'FritzBox 6490 Cable', 'text' => 'FritzBox 6490 Cable (Inet, Phone, IPTV)'], + ], + "ROUTER_SHIPPING_DATA" => [ + "TP-Link Archer C80" => ["weight" => 1, "length" => 35, "width" => 24, "height" => 8], + "FritzBox 4040" => ["weight" => 1, "length" => 30, "width" => 24, "height" => 7], + "FritzBox 7530" => ["weight" => 1, "length" => 26, "width" => 19, "height" => 7], + "FritzBox 7590" => ["weight" => 1, "length" => 30, "width" => 24, "height" => 7], + "FritzBox 6490 Cable" => ["weight" => 1, "length" => 30, "width" => 26, "height" => 8] ] ] ); @@ -552,5 +560,28 @@ class CpeprovisioningController extends mfBaseController return $data; } + protected function printPDFAction() { + $order_id = $this->request->order_id; + + $order = OrderModel::getOne($order_id); + if (!$order) self::sendError("Order not found", 404); + + $pdf_vars = [ + 'firstline' => $order->owner->getCompanyOrName(), + 'secondline' => $order->owner->street, + 'thirdline' => $order->owner->zip . " " . $order->owner->city, + 'fourthline' => $order->owner->customer_number + ]; + + $pdf = new PdfForm("Cpeprovisioning/PDF_MAIN", $pdf_vars); + $wkhtmltopdfArgs = "--page-height 32.5mm --page-width 57.5mm --margin-top 1mm --margin-bottom 0 --margin-left 0 --margin-right 0 --disable-smart-shrinking --encoding utf-8"; + $filename = $pdf->render($wkhtmltopdfArgs); + + header('Content-Type: application/pdf'); + header('Content-Disposition: inline; filename="' . $filename . '"'); + readfile($filename); + die(); + } + } \ No newline at end of file diff --git a/public/js/pages/Cpeprovisioning/Cpeprovisioning.js b/public/js/pages/Cpeprovisioning/Cpeprovisioning.js index e3b1aff1e..47c17c0dc 100644 --- a/public/js/pages/Cpeprovisioning/Cpeprovisioning.js +++ b/public/js/pages/Cpeprovisioning/Cpeprovisioning.js @@ -51,6 +51,9 @@ Vue.component('Cpeprovisioning', { + + +