From a09dfe1d1f98fe5462edf9a361eb01dcf32e9e72 Mon Sep 17 00:00:00 2001 From: phyusin Date: Thu, 27 Dec 2018 17:00:18 +0630 Subject: [PATCH] check member search --- app/views/crm/customers/_new_form.html.erb | 31 ++++++++++++-------- app/views/crm/customers/index.html.erb | 2 ++ app/views/origami/customers/index.html.erb | 34 ++++++++++++++-------- 3 files changed, 43 insertions(+), 24 deletions(-) diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb index 5603256c..3ca71c39 100644 --- a/app/views/crm/customers/_new_form.html.erb +++ b/app/views/crm/customers/_new_form.html.erb @@ -274,23 +274,30 @@ // get CardNo from Java function setCardNo(cardNo){ + check_member = localStorage.getItem("member_card"); if(cardNo.length == 16){ - if($.inArray(cardNo, paypar_account_no) !== -1){ + if(check_member == "true"){ $("#paypar_account_no").val(cardNo); $("#search").val(cardNo); $("#type").val("card"); }else{ - swal({ - title: 'Oops', - text: 'CardNo already registered, Please try another card!', - type: 'error', - html: true, - closeOnConfirm: false, - closeOnCancel: false, - allowOutsideClick: false - }, function () { - window.location.reload(); - }); + if($.inArray(cardNo, paypar_account_no) !== -1){ + swal({ + title: 'Oops', + text: 'CardNo already registered, Please try another card!', + type: 'error', + html: true, + closeOnConfirm: false, + closeOnCancel: false, + allowOutsideClick: false + }, function () { + window.location.reload(); + }); + }else{ + $("#paypar_account_no").val(cardNo); + $("#search").val(cardNo); + $("#type").val("card"); + } } } } diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 275ae672..b949291b 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -120,6 +120,7 @@