diff options
| author | Daniel Schmitzer <noreply@maennchen1.de> | 2024-11-08 11:56:56 +0000 |
|---|---|---|
| committer | Daniel Schmitzer <noreply@maennchen1.de> | 2024-11-08 11:56:56 +0000 |
| commit | 479bd8b375aa031f2dc0a3750b1dd6c938ccfb6a (patch) | |
| tree | 963d8d977d7d09660cf3acf7b79b34dd6d1a6ac7 | |
| parent | 8846cb960467ba21491cfbaa32e78e4c8d3f1af7 (diff) | |
- eInvoice
git-svn-id: https://[internal]/wordpress/plugins/wpsg4@8453 0d5edaf7-2b12-4e95-93f4-047927463d4b
| -rw-r--r-- | views/mods/mod_rechnungen/html/e_invoice_app.html | 20 | ||||
| -rw-r--r-- | views/mods/mod_rechnungen/js/e_invoice_app.module.js | 25 | ||||
| -rw-r--r-- | views/mods/mod_rechnungen/order_view.phtml | 51 |
3 files changed, 94 insertions, 2 deletions
diff --git a/views/mods/mod_rechnungen/html/e_invoice_app.html b/views/mods/mod_rechnungen/html/e_invoice_app.html new file mode 100644 index 0000000..49ae87f --- /dev/null +++ b/views/mods/mod_rechnungen/html/e_invoice_app.html @@ -0,0 +1,20 @@ +<div class="e_invoice_app" :class="{'open': open === true}" @mouseout="open = false"> + <div class="handler" @click.prevent.stop="open = !open"> + {{trans('E-Rechnungsdaten anhängen')}} + </div> + <div class="layer" @mouseover="open = true" @mouseout="open = false"> + <div class="inner"> + <template v-for="(profile, key) of data.arProfile"> + <a + :class="{ + 'default': data.default_profile === intVal(key) + }" + target="_blank" + :href="profile.url" + > + {{profile.label}} + </a> + </template> + </div> + </div> +</div>
\ No newline at end of file diff --git a/views/mods/mod_rechnungen/js/e_invoice_app.module.js b/views/mods/mod_rechnungen/js/e_invoice_app.module.js new file mode 100644 index 0000000..a34bb75 --- /dev/null +++ b/views/mods/mod_rechnungen/js/e_invoice_app.module.js @@ -0,0 +1,25 @@ +import { createApp } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js'; + +export async function initEInvoiceApp(element, data) { + + const template = await fetch(data.template_url).then(response => response.text()); + + const App = { + data() { + + return { + data: data, + open: false + } + + }, + methods: { + intVal: function(value) { console.log(value); return parseInt(value); }, + trans: function(strDefault) { return strDefault; } + }, + template: template + }; + + createApp(App).mount(element); + +}
\ No newline at end of file diff --git a/views/mods/mod_rechnungen/order_view.phtml b/views/mods/mod_rechnungen/order_view.phtml index ca910a1..3020df2 100644 --- a/views/mods/mod_rechnungen/order_view.phtml +++ b/views/mods/mod_rechnungen/order_view.phtml @@ -3,6 +3,8 @@ /**
* Template für die Rechnungsmodulansicht innerhalb der Bestellansicht
*/
+ use horstoeko\zugferd\ZugferdProfiles;
+ use wpsg\mod_invoice\eInvoice;
?>
@@ -23,13 +25,40 @@ $oInvoice = \wpsg\wpsg_invoice::getInstance($r['id']);
?>
-
+
<div>
<?php echo $oInvoice->getDate(true); ?>
</div>
<div>
<?php echo $oInvoice->getNr(true); ?>
</div>
+ <div>
+ <div id="e_invoice_app_<?php echo $oInvoice->getId(); ?>"></div>
+ <script type="module">
+
+ import { initEInvoiceApp } from '<?php echo wpsg_ShopController::getShop()->getRessourceURL('mods/mod_rechnungen/js/e_invoice_app.module.js'); ?>';
+
+ initEInvoiceApp(document.getElementById('e_invoice_app_<?php echo $oInvoice->getId(); ?>'), {
+ 'invoice_id': <?php echo $oInvoice->getId(); ?>,
+ 'template_url': '<?php echo wpsg_ShopController::getShop()->getRessourceURL('mods/mod_rechnungen/html/e_invoice_app.html'); ?>',
+ 'default_profile': <?php echo intval(wpsg_ShopController::getShop()->get_option('wpsg_mod_rechnungen_einvoice')); ?>,
+ 'arProfile': <?php echo json_encode([
+ 100 + ZugferdProfiles::PROFILE_MINIMUM => ['label' => __('EN16931 Minimum', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_MINIMUM)],
+ 100 + ZugferdProfiles::PROFILE_BASIC => ['label' => __('EN16931 Basic', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_BASIC)],
+ 100 + ZugferdProfiles::PROFILE_BASICWL => ['label' => __('EN16931 Basic WL', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_BASICWL)],
+ 100 + ZugferdProfiles::PROFILE_EN16931 => ['label' => __('EN16931 Comfort', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_EN16931)],
+ 100 + ZugferdProfiles::PROFILE_EXTENDED => ['label' => __('EN16931 Extended', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_EXTENDED)],
+ 100 + ZugferdProfiles::PROFILE_XRECHNUNG => ['label' => __('EN16931 XRechnung 1', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG)],
+ 100 + ZugferdProfiles::PROFILE_XRECHNUNG_2 => ['label' => __('EN16931 XRechnung 2', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_2)],
+ 100 + ZugferdProfiles::PROFILE_XRECHNUNG_2_1 => ['label' => __('EN16931 XRechnung 2.1', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_2_1)],
+ 100 + ZugferdProfiles::PROFILE_XRECHNUNG_2_2 => ['label' => __('EN16931 XRechnung 2.2', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_2_2)],
+ 100 + ZugferdProfiles::PROFILE_XRECHNUNG_2_3 => ['label' => __('EN16931 XRechnung 2.3', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_2_3)],
+ 100 + ZugferdProfiles::PROFILE_XRECHNUNG_3 => ['label' => __('EN16931 XRechnung 3', 'wpsg'), 'url' => eInvoice::buildUrl($oInvoice->getId(), ZugferdProfiles::PROFILE_XRECHNUNG_3)]
+ ]); ?>
+ });
+
+ </script>
+ </div>
<div style="text-align:right; white-space:nowrap;">
<?php /*
@@ -56,6 +85,8 @@ </div>
<?php } ?>
+
+
</div>
@@ -67,6 +98,22 @@ <style>
- #wpsg_mod_rechnungen_order_view .grid { display:grid; width:100%; grid-template-columns:150px 1fr 250px; row-gap:0.25rem; column-gap:1rem; }
+ #wpsg_mod_rechnungen_order_view .grid { display:grid; width:100%; grid-template-columns:150px 1fr 250px 150px; row-gap:0.5rem; column-gap:1rem; align-items:center; }
+ .e_invoice_app { position:relative; user-select:none;
+ & > .handler { border:1px solid black; padding:0.25rem 0.5rem; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; width:100%; cursor:pointer; background-color:white; position:relative;
+ &:after { width:0; height:0; border-top:5px solid transparent; border-bottom:5px solid transparent; border-left:5px solid #2c699e; content:' '; position:absolute; right:5px; top:50%; transform:translateY(-50%); transition:all 0.4s; }
+ }
+ & > .layer { position:absolute; max-height:0; overflow:hidden; width:100%; transition:all 0.4s; z-index:1;
+ & > .inner { border:1px solid black; padding:0.25rem 0.5rem; margin-top:-1px; display:flex; flex-direction:column; gap:0.25rem; background-color:white;
+ & > a:not(:last-child) { border-bottom:1px solid black; }
+ & > a.default { font-weight:bold; }
+ }
+ }
+ &.open {
+ & > .layer { max-height:500px; }
+ & > .handler:after { transform:translateY(-50%) rotate(90deg); }
+ }
+ }
+
</style>
\ No newline at end of file |
