summaryrefslogtreecommitdiff
path: root/views/mods/mod_coverletter/order_view.phtml
diff options
context:
space:
mode:
authordaniel <noreply@maennchen1.de>2026-09-29 12:05:22 +0200
committerdaniel <noreply@maennchen1.de>2026-09-29 12:05:22 +0200
commitee163b01c6bdf3da7c2a8f3ee1be25b02cb760b4 (patch)
treeabc0e19180dbf7736f6e14b098f284eb44d39e0a /views/mods/mod_coverletter/order_view.phtml
parent63401c7480f519141bd9b5ccdd8b8ec553d7516d (diff)
- Anfrage Modul aufgeräumt
Diffstat (limited to 'views/mods/mod_coverletter/order_view.phtml')
-rw-r--r--views/mods/mod_coverletter/order_view.phtml104
1 files changed, 58 insertions, 46 deletions
diff --git a/views/mods/mod_coverletter/order_view.phtml b/views/mods/mod_coverletter/order_view.phtml
index 5bfe585..b2771d6 100644
--- a/views/mods/mod_coverletter/order_view.phtml
+++ b/views/mods/mod_coverletter/order_view.phtml
@@ -1,92 +1,104 @@
<?php
-
+
/**
* Template für die Integration des Anschreiben Moduls in die Bestellverwaltung
*/
+ if (!defined('ABSPATH')) exit;
+
+ $order_id = (int)($this->view['data']['id']??0);
+ $arCoverLetter = (array)($this->view['mod_coverletter']['arCoverLetter']??[]);
+
+ $arShopLocations = $this->getShopLocations();
+ $arShopLocationLabels = [];
+
+ foreach ($arShopLocations as $l_id => $l) {
+
+ $arShopLocationLabels[$l_id] = $l['label'];
+ }
+
?>
-
-<?php echo wpsg_drawForm_AdminboxStart(__('Anschreiben', 'wpsg'));?>
- <?php if (sizeof($this->view['mod_coverletter']['arCoverLetter']) == 0 ) { ?>
-
- <p><?php echo __('Bisher kein Anschreiben für diese Bestellung geschrieben.', 'wpsg'); ?></p>
-
+<?php echo wpsg_drawForm_AdminboxStart(__('Anschreiben', 'wpsg')); ?>
+
+ <?php if (sizeof($arCoverLetter) === 0) { ?>
+
+ <p><?php echo esc_html__('Bisher kein Anschreiben für diese Bestellung geschrieben.', 'wpsg'); ?></p>
+
<?php } else { ?>
- <?php foreach ($this->view['mod_coverletter']['arCoverLetter'] as $a) { ?>
-
+ <?php foreach ($arCoverLetter as $a) { ?>
+
<div class="wpsg_flex wpsg_flex_justify_content_space_between">
<span>
- <?php echo wpsg_translate(__('#2#: Anschreiben ##1#', 'wpsg'), $a['id'], wpsg_formatTimestamp(strtotime($a['cdate']))); ?>: <?php echo ((strlen($a['text']) > 50)?substr($a['text'],0,50).' ...':$a['text']); ?>
+ <?php echo wpsg_hspc(wpsg_translate(__('#2#: Anschreiben ##1#', 'wpsg'), $a['id'], wpsg_formatTimestamp(strtotime($a['cdate'])))); ?>: <?php echo wpsg_hspc(((strlen($a['text']) > 50)?substr($a['text'], 0, 50).' ...':$a['text'])); ?>
</span>
- <a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&mod=wpsg_mod_coverletter&noheader=1&action=ajax&order_id=<?php echo $a['order_id']; ?>&cl_id=<?php echo $a['id']; ?>&wpsg_mod_coverletter_get" target="_new">
- <?php echo __('Ansehen', 'wpsg'); ?>
+ <a href="<?php echo esc_url(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&mod=wpsg_mod_coverletter&noheader=1&action=ajax&order_id='.intval($a['order_id']).'&cl_id='.intval($a['id']).'&wpsg_mod_coverletter_get'); ?>" target="_new">
+ <?php echo esc_html__('Ansehen', 'wpsg'); ?>
</a>
</div>
-
+
<?php } ?>
-
+
<?php } ?>
-
+
<br />
-
+
<div class="wpsg_clear"></div>
-
+
<hr />
-
- <div class="inside">
+
+ <div class="inside">
<div>
-
- <form target="_blank" method="post" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&mod=wpsg_mod_coverletter&edit_id=<?php echo $this->view['data']['id']; ?>&action=ajax&noheader=1" id="wpsg_mod_coverletter_form">
- <?php $arShopLocations = $this->getShopLocations(); ?>
- <?php $arShopLocationLabels = []; foreach ($arShopLocations as $l_id => $l) $arShopLocationLabels[$l_id] = $l['label']; ?>
-
+ <form target="_blank" method="post" action="<?php echo esc_url(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&mod=wpsg_mod_coverletter&edit_id='.$order_id.'&action=ajax&noheader=1'); ?>" id="wpsg_mod_coverletter_form">
+
+ <?php wp_nonce_field('wpsg-coverletter-order_ajax-write-'.$order_id); ?>
+
<?php if (sizeof($arShopLocations) > 1) { ?>
-
+
<?php echo wpsg_drawForm_Select('target', __('Shop Adresse', 'wpsg'), $arShopLocationLabels, '1'); ?>
-
+
<?php } else { ?>
-
+
<input type="hidden" name="target" value="1" />
-
+
<?php } ?>
- <?php echo wpsg_drawForm_Textarea('text', __('Text', 'wpsg'),$this->replaceUniversalPlatzhalter($this->get_option('wpsg_mod_coverletter_text'), $this->view['data']['id']), ['noLabel' => true, 'fullLabel' => __('Text für das Anschreiben', 'wpsg'), 'style' => 'height:200px']); ?>
-
+ <?php echo wpsg_drawForm_Textarea('text', __('Text', 'wpsg'), $this->replaceUniversalPlatzhalter($this->get_option('wpsg_mod_coverletter_text'), $order_id), ['noLabel' => true, 'fullLabel' => __('Text für das Anschreiben', 'wpsg'), 'style' => 'height:200px']); ?>
+
<br />
-
- <input type="submit" name="wpsg_mod_coverletter_write" value="<?php echo __("Speichern & Drucken", "wpsg"); ?>" style="float:left;" class="button button-primary" />
- <input type="submit" name="wpsg_mod_coverletter_preview" onclick="wpsg_form_refresh = false;" value="<?php echo __('Vorschau', 'wpsg'); ?>" style="float:left; margin-left:15px;" class="button" />
-
+
+ <input type="submit" name="wpsg_mod_coverletter_write" value="<?php echo esc_attr__('Speichern & Drucken', 'wpsg'); ?>" style="float:left;" class="button button-primary" />
+ <input type="submit" name="wpsg_mod_coverletter_preview" onclick="wpsg_form_refresh = false;" value="<?php echo esc_attr__('Vorschau', 'wpsg'); ?>" style="float:left; margin-left:15px;" class="button" />
+
<div class="wpsg_clear"></div>
-
+
</form>
-
+
</div>
</div>
<?php echo wpsg_drawForm_AdminboxEnd(); ?>
<script>
-
+
var wpsg_form_refresh = true;
-
+
jQuery('#wpsg_mod_coverletter_form').on('submit', function() {
-
+
if (wpsg_form_refresh) {
-
+
setTimeout(function() {
-
+
location.reload();
-
+
}, 1000);
-
+
}
wpsg_form_refresh = true;
-
- } );
-
+
+ });
+
</script>