diff options
Diffstat (limited to 'views/mods/mod_revocation/ajaxDialogContent.phtml')
| -rw-r--r-- | views/mods/mod_revocation/ajaxDialogContent.phtml | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/views/mods/mod_revocation/ajaxDialogContent.phtml b/views/mods/mod_revocation/ajaxDialogContent.phtml new file mode 100644 index 0000000..e833a00 --- /dev/null +++ b/views/mods/mod_revocation/ajaxDialogContent.phtml @@ -0,0 +1,148 @@ +<?php + + declare(strict_types=1); + + /** + * @author: Daniel Schmitzer + * @date: 10.04.26 + * @time: 09:10 + */ + + namespace wpsgRevocation; + + use \wpsg\M1; + use wpsg_product; + + $arReason = \wpsgRevocation\Revocation::getReasons(); + + // Produkte + $dialog_config = json_decode((wp_kses_stripslashes($_REQUEST['dialog_config']??'[]')), true); + + $contact_email = ""; + + $customer_login_id = intval(\wpsg_ShopController::getShop()->callMod('wpsg_mod_kundenverwaltung', 'isLoggedIn')); + + if ($customer_login_id > 0) { + + $oCustomer = \wpsg_customer::getInstance($customer_login_id); + + $contact_email = $oCustomer->getEmail(); + + } + +?> + +<form id="wpsg_revocation_form" class="wpsg"> + + <div id="msg_target"></div> + + <?php if (sizeof($dialog_config['arOrderProductID']) > 0) { ?> + + <?php foreach ($dialog_config['arOrderProductID'] as $row) { + + $order_id = intval($row['order_id']); + $order_product_id = intval($row['order_product_id']); + $amount = intval($row['amount']); + + $oOrder = \wpsg_order::getInstance($order_id); + $oOrderProduct = \wpsg_order_product::getInstance($order_product_id); + + if (!$oOrder->isLoaded() || !$oOrderProduct->isLoaded()) continue; + + $key = $order_id.'_'.$order_product_id; + + ?> + + <fieldset class="wpsg_revocation_order_product"> + <legend><?php echo $oOrderProduct->getProduct()->getProductName(); ?></legend> + <div> + + <input type="hidden" readonly name="wpsg_revocation_reason[row][<?php echo $key; ?>][order_product_id]" value="<?php echo $oOrderProduct->getId(); ?>" /> + + <div class="form_field"> + <div class="label"><?php echo __('Bestellnummer / Menge', 'wpsgRevocation'); ?></div> + <div class="value"> + <input type="text" readonly name="wpsg_revocation_reason[row][<?php echo $key; ?>][order_nr]" value="<?php echo $oOrder->getNr(); ?>" /> + <input type="number" min="1" max="<?php echo $amount; ?>" name="wpsg_revocation_reason[row][<?php echo $key; ?>][amount]" value="<?php echo $amount; ?>" /> + </div> + </div> + + <div class="form_field"> + <div class="label"><?php echo __('Widerrufsgrund', 'wpsgRevocation'); ?></div> + <div class="value"> + <select name="wpsg_revocation_reason[row][<?php echo $key; ?>][reason]" required> + <option value=""><?php echo __('Bitte einen Grund auswählen', 'wpsgRevocation'); ?></option> + <?php foreach ($arReason as $reason) { ?> + <option value="<?php echo htmlspecialchars($reason['id']); ?>"><?php echo htmlspecialchars($reason['text']); ?></option> + <?php } ?> + </select> + </div> + </div> + + <div class="form_field"> + <div class="label"><?php echo __('Bemerkung', 'wpsgRevocation'); ?></div> + <div class="value"> + <textarea name="wpsg_revocation_reason[row][<?php echo $key; ?>][comment]"></textarea> + </div> + </div> + + </div> + </fieldset> + + <?php } ?> + + <?php } else { + + $key = 0; + + ?> + + <fieldset class="wpsg_revocation_order_product"> + + <div class="form_field"> + <div class="label"><?php echo __('Produkt - Nr.', 'wpsgRevocation'); ?></div> + <div class="value"> + <input type="text" name="wpsg_revocation_reason[row][<?php echo $key; ?>][product_nr]" value="<?php echo ($dialog_config['set_product_anr']??''); ?>" /> + </div> + </div> + + <div class="form_field"> + <div class="label"><?php echo __('Bestellnummer / Menge', 'wpsgRevocation'); ?></div> + <div class="value"> + <input type="text" name="wpsg_revocation_reason[row][<?php echo $key; ?>][order_nr]" value="" /> + <input type="number" name="wpsg_revocation_reason[row][<?php echo $key; ?>][amount]" value="1" /> + </div> + </div> + + <div class="form_field"> + <div class="label"><?php echo __('Widerrufsgrund', 'wpsgRevocation'); ?></div> + <div class="value"> + <select name="wpsg_revocation_reason[row][<?php echo $key; ?>][reason]"> + <?php foreach ($arReason as $reason) { ?> + <option value="<?php echo htmlspecialchars($reason['id']); ?>"><?php echo htmlspecialchars($reason['text']); ?></option> + <?php } ?> + </select> + </div> + </div> + + <div class="form_field"> + <div class="label"><?php echo __('Bemerkung', 'wpsgRevocation'); ?></div> + <div class="value"> + <textarea name="wpsg_revocation_reason[row][<?php echo $key; ?>][comment]"></textarea> + </div> + </div> + + </fieldset> + + <?php } ?> + + <div class="form_field"> + <div class="label"><?php echo __('Kontakt - E-Mail', 'wpsgRevocation'); ?></div> + <div class="value"> + <input type="email" required name="wpsg_revocation_reason[contact]" value="<?php echo $contact_email; ?>" + <?php echo (($contact_email !== '')?'readonly':''); ?> + /> + </div> + </div> + +</form>
\ No newline at end of file |
