| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package VikBooking |
| 4 |
* @subpackage com_vikbooking |
| 5 |
* @author Alessio Gaggii - e4j - Extensionsforjoomla.com |
| 6 |
* @copyright Copyright (C) 2018 e4j - Extensionsforjoomla.com. All rights reserved. |
| 7 |
* @license GNU General Public License version 2 or later; see LICENSE |
| 8 |
* @link https://vikwp.com |
| 9 |
*/ |
| 10 |
|
| 11 |
defined('ABSPATH') or die('No script kiddies please!'); |
| 12 |
|
| 13 |
$currencysymb = VikBooking::getCurrencySymb(); |
| 14 |
$nowdf = VikBooking::getDateFormat(true); |
| 15 |
if ($nowdf == "%d/%m/%Y") { |
| 16 |
$df = 'd/m/Y'; |
| 17 |
} elseif ($nowdf == "%m/%d/%Y") { |
| 18 |
$df = 'm/d/Y'; |
| 19 |
} else { |
| 20 |
$df = 'Y/m/d'; |
| 21 |
} |
| 22 |
$datesep = VikBooking::getDateSeparator(true); |
| 23 |
$tmpl = VikRequest::getString('tmpl', '', 'request'); |
| 24 |
$success = VikRequest::getInt('success', 0, 'request'); |
| 25 |
|
| 26 |
?> |
| 27 |
|
| 28 |
<form action="index.php?option=com_vikbooking" method="post" name="adminForm" id="adminForm"> |
| 29 |
<div class="vbo-admin-container"> |
| 30 |
<div class="vbo-config-maintab-left"> |
| 31 |
<fieldset class="adminform"> |
| 32 |
<div class="vbo-params-wrap"> |
| 33 |
<legend class="adminlegend"><?php echo JText::translate('VBO_REFUND'); ?></legend> |
| 34 |
<div class="vbo-params-container"> |
| 35 |
<div class="vbo-param-container"> |
| 36 |
<div class="vbo-param-label"><?php echo JText::translate('VBLIBPAYNAME'); ?></div> |
| 37 |
<div class="vbo-param-setting"> |
| 38 |
<strong><?php echo $this->payment['name']; ?></strong> |
| 39 |
</div> |
| 40 |
</div> |
| 41 |
<div class="vbo-param-container"> |
| 42 |
<div class="vbo-param-label"><?php echo JText::translate('VBO_REFUND_AMOUNT'); ?></div> |
| 43 |
<div class="vbo-param-setting"> |
| 44 |
<?php |
| 45 |
$max_refund = $this->row['totpaid'] > 0 ? $this->row['totpaid'] : $this->row['total']; |
| 46 |
?> |
| 47 |
<span><?php echo $currencysymb; ?></span> |
| 48 |
<input type="number" id="vbo-refund-amount" name="amount" class="vbo-input-number-large" value="<?php echo $max_refund; ?>" step="any" min="0" max="<?php echo $this->row['total']; ?>" /> |
| 49 |
</div> |
| 50 |
</div> |
| 51 |
<div class="vbo-param-container"> |
| 52 |
<div class="vbo-param-label"><?php echo JText::translate('VBO_REFUND_REASON'); ?></div> |
| 53 |
<div class="vbo-param-setting"> |
| 54 |
<textarea name="refund_reason" rows="4" cols="60"></textarea> |
| 55 |
</div> |
| 56 |
</div> |
| 57 |
<div class="vbo-param-container"> |
| 58 |
<div class="vbo-param-label"> </div> |
| 59 |
<div class="vbo-param-setting"> |
| 60 |
<button type="submit" class="btn btn-large btn-danger" onclick="return vboValidateDoRefund();"><?php VikBookingIcons::e('credit-card'); ?> <?php echo JText::translate('VBO_REFUND'); ?></button> |
| 61 |
</div> |
| 62 |
</div> |
| 63 |
<?php |
| 64 |
// display any previous refund |
| 65 |
foreach ($this->refunds as $prev_refund_event) { |
| 66 |
?> |
| 67 |
<div class="vbo-param-container vbo-param-container-log"> |
| 68 |
<div class="vbo-param-label"> |
| 69 |
<?php |
| 70 |
/** |
| 71 |
* @wponly Format the datetime string |
| 72 |
*/ |
| 73 |
echo JHtml::fetch('date', $prev_refund_event['dt']); |
| 74 |
?> |
| 75 |
</div> |
| 76 |
<div class="vbo-param-setting"> |
| 77 |
<div class="vbo-refund-log"><?php echo nl2br($prev_refund_event['descr']); ?></div> |
| 78 |
</div> |
| 79 |
</div> |
| 80 |
<?php |
| 81 |
} |
| 82 |
?> |
| 83 |
</div> |
| 84 |
</div> |
| 85 |
</fieldset> |
| 86 |
</div> |
| 87 |
</div> |
| 88 |
<input type="hidden" name="bid" value="<?php echo $this->row['id']; ?>"> |
| 89 |
<input type="hidden" name="task" value="do_refundtn" /> |
| 90 |
<input type="hidden" name="option" value="com_vikbooking" /> |
| 91 |
<?php |
| 92 |
if ($tmpl == 'component') { |
| 93 |
?> |
| 94 |
<input type="hidden" name="tmpl" value="component" /> |
| 95 |
<?php |
| 96 |
} |
| 97 |
?> |
| 98 |
</form> |
| 99 |
|
| 100 |
<script type="text/javascript"> |
| 101 |
function vboValidateDoRefund() { |
| 102 |
var amount = document.getElementById('vbo-refund-amount').value; |
| 103 |
if (!amount.length || isNaN(amount) || amount <= 0) { |
| 104 |
alert("<?php echo addslashes(JText::translate('VBO_PLEASE_FILL_FIELDS')); ?>"); |
| 105 |
return false; |
| 106 |
} |
| 107 |
return confirm("<?php echo addslashes(JText::translate('VBO_DOREFUND_CONFIRM')); ?>"); |
| 108 |
} |
| 109 |
<?php |
| 110 |
if ($success > 0) { |
| 111 |
?> |
| 112 |
setTimeout(function() { |
| 113 |
if (window.parent['vbo_refund_performed'] != undefined) { |
| 114 |
window.parent['vbo_refund_performed'] = true; |
| 115 |
} |
| 116 |
}, 500); |
| 117 |
<?php |
| 118 |
} |
| 119 |
?> |
| 120 |
</script> |
| 121 |
|