diff --git a/application/controllers/Giftcards.php b/application/controllers/Giftcards.php
index 53d633a5d..7a0c607f6 100644
--- a/application/controllers/Giftcards.php
+++ b/application/controllers/Giftcards.php
@@ -44,6 +44,14 @@ class Giftcards extends Secure_Controller
/*
Gives search suggestions based on what is being searched for
*/
+
+ public function suggest()
+ {
+ $suggestions = $this->xss_clean($this->Giftcard->get_search_suggestions($this->input->get('term'), TRUE));
+
+ echo json_encode($suggestions);
+ }
+
public function suggest_search()
{
$suggestions = $this->xss_clean($this->Giftcard->get_search_suggestions($this->input->post('term')));
diff --git a/application/views/sales/register.php b/application/views/sales/register.php
index 1ad60a337..4a3592b10 100644
--- a/application/views/sales/register.php
+++ b/application/views/sales/register.php
@@ -434,7 +434,8 @@ if (isset($success))
| lang->line('sales_amount_tendered'); ?> |
- 'amount_tendered', 'id'=>'amount_tendered', 'class'=>'form-control input-sm', 'value'=>to_currency_no_money($amount_due), 'size'=>'5', 'tabindex'=>++$tabindex)); ?>
+ 'amount_tendered', 'id'=>'amount_tendered', 'class'=>'form-control input-sm non-giftcard-input', 'value'=>to_currency_no_money($amount_due), 'size'=>'5', 'tabindex'=>++$tabindex)); ?>
+ 'amount_tendered', 'id'=>'amount_tendered', 'class'=>'form-control input-sm giftcard-input', 'disabled' => true, 'value'=>to_currency_no_money($amount_due), 'size'=>'5', 'tabindex'=>++$tabindex)); ?>
|
@@ -619,7 +620,16 @@ $(document).ready(function()
$("#select_customer_form").submit();
}
});
-
+ $(".giftcard-input").autocomplete(
+ {
+ source: '',
+ minChars: 0,
+ delay: 10,
+ select: function (a, ui) {
+ $(this).val(ui.item.value);
+ $("#add_payment_form").submit();
+ }
+ });
$('#item, #customer').click(clear_fields).dblclick(function(event)
{
$(this).autocomplete("search");
@@ -773,6 +783,9 @@ function check_payment_type()
$("#sale_amount_due").html("");
$("#amount_tendered_label").html("lang->line('sales_giftcard_number'); ?>");
$("#amount_tendered:enabled").val('').focus();
+ $(".giftcard-input").attr('disabled',false);
+ $(".non-giftcard-input").attr('disabled',true);
+ $(".giftcard-input:enabled").val('').focus();
}
else if ($("#payment_types").val() == "lang->line('sales_cash'); ?>" && cash_rounding)
{
@@ -780,6 +793,8 @@ function check_payment_type()
$("#sale_amount_due").html("");
$("#amount_tendered_label").html("lang->line('sales_amount_tendered'); ?>");
$("#amount_tendered:enabled").val('');
+ $(".giftcard-input").attr('disabled',true);
+ $(".non-giftcard-input").attr('disabled',false);
}
else
{
@@ -787,6 +802,8 @@ function check_payment_type()
$("#sale_amount_due").html("");
$("#amount_tendered_label").html("lang->line('sales_amount_tendered'); ?>");
$("#amount_tendered:enabled").val('');
+ $(".giftcard-input").attr('disabled',true);
+ $(".non-giftcard-input").attr('disabled',false);
}
}
diff --git a/public/css/style.css b/public/css/style.css
index e69de29bb..4b32ca04f 100644
--- a/public/css/style.css
+++ b/public/css/style.css
@@ -0,0 +1,3 @@
+input#amount_tendered:disabled {
+ display:none;
+}
\ No newline at end of file
diff --git a/public/dist/style.css b/public/dist/style.css
index e69de29bb..4b32ca04f 100644
--- a/public/dist/style.css
+++ b/public/dist/style.css
@@ -0,0 +1,3 @@
+input#amount_tendered:disabled {
+ display:none;
+}
\ No newline at end of file