app/Plugin/RemisePayment42/Resource/assets/js/admin/sub_order_index_extset.js line 1

Open in your IDE?
  1. <script>
  2.     $(function(){
  3.         var statusIdx = 0;
  4.         // thead
  5.         $('#search_result').find('thead > tr').each(function(index, element){
  6.             $(element).find('th').each(function(subIndex, subElement){
  7.                 if ($(subElement).text() == "{{ 'admin.order.order_status'|trans }}") {
  8.                     statusIdx = subIndex;
  9.                     $(subElement).after('<th class="border-top-0 pt-2 pb-2 text-center"><input type="checkbox" id="remise_payment_extset4_toggle_check_all" name="filter" value="open">&nbsp;ルミーズカード決済状況</th>');
  10.                 }
  11.             });
  12.         });
  13.         // tbody
  14.         $('#search_result').find('tbody > tr').each(function(index, element){
  15.             var str = $(element).find('a.action-edit').first().html();
  16.             if(str)
  17.             {
  18.                 var idx = str.indexOf("<br");
  19.                 var isMatch = false;
  20.                 $(element).find('td').each(function(subIndex, subElement){
  21.                     if (statusIdx == subIndex) {
  22.                         {% for ExtsetOrderResultCard in ExtsetOrderResultCards %}
  23.                             if (str.substr(0, idx) == "{{ orderNos[ExtsetOrderResultCard.getId] }}") {
  24.                                 isMatch = true;
  25.                                 {% if ExtsetOrderResultCard.getJob == "CAPTURE" %}
  26.                                     {% if ExtsetOrderResultCard.getState == 'remise_payment4.common.label.card.state.result.ac.failed'|trans %}
  27.                                         $(subElement).after('<td class="align-middle text-center">'+"{{ 'remise_payment4.common.text.card.state.result.ac.failed'|trans }}"+'</td>');
  28.                                     {% else %}
  29.                                         $(subElement).after('<td class="align-middle text-center">'+"{{ 'remise_payment4.admin_order_edit.label.card.job.capture'|trans }}"+'</td>');
  30.                                     {% endif %}
  31.                                 {% elseif ExtsetOrderResultCard.getJob == "AUTH" %}
  32.                                     {% if ExtsetOrderResultCard.getState == 'remise_payment4.common.label.card.state.result'|trans
  33.                                         or ExtsetOrderResultCardsOrderState[ExtsetOrderResultCard.getId] == constant('Eccube\\Entity\\Master\\OrderStatus::CANCEL')
  34.                                         or ExtsetOrderResultCardsOrderState[ExtsetOrderResultCard.getId] == constant('Eccube\\Entity\\Master\\OrderStatus::RETURNED')
  35.                                         or ExtsetOrderResultCardsOrderState[ExtsetOrderResultCard.getId] == constant('Eccube\\Entity\\Master\\OrderStatus::PENDING')
  36.                                         or ExtsetOrderResultCardsOrderState[ExtsetOrderResultCard.getId] == constant('Eccube\\Entity\\Master\\OrderStatus::PROCESSING')
  37.                                         %}
  38.                                         $(subElement).after('<td class="align-middle text-center">'+"{{ 'remise_payment4.admin_order_edit.label.card.job.auth'|trans }}"+'</td>');
  39.                                     {% else %}
  40.                                         $(subElement).after('<td class="align-middle text-center">'
  41.                                                 +"{{ 'remise_payment4.admin_order_edit.label.card.job.auth'|trans }}"
  42.                                                 +'<br><input type="checkbox" id="remise_payment_extset4_check_{{ ExtsetOrderResultCard.getId }}" name="remise_payment_extset4_check[]" value="{{ ExtsetOrderResultCard.getId }}">'
  43.                                                 +'売上を行う</td>');
  44.                                     {% endif %}
  45.                                 {% elseif ExtsetOrderResultCard.getJob == "SALES" %}
  46.                                     $(subElement).after('<td class="align-middle text-center">'+"{{ 'remise_payment4.admin_order_edit.label.card.job.sales'|trans }}"+'</td>');
  47.                                 {% elseif ExtsetOrderResultCard.getJob == "VOID" %}
  48.                                     $(subElement).after('<td class="align-middle text-center">'+"{{ 'remise_payment4.admin_order_edit.label.card.job.void'|trans }}"+'</td>');
  49.                                 {% elseif ExtsetOrderResultCard.getJob == "RETURN" %}
  50.                                     $(subElement).after('<td class="align-middle text-center">'+"{{ 'remise_payment4.admin_order_edit.label.card.job.return'|trans }}"+'</td>');
  51.                                 {% else %}
  52.                                     $(subElement).after('<td class="align-middle text-center">'+"{{ 'remise_payment4.admin_order_edit.label.card.job.other'|trans }}"+'</td>');
  53.                                 {% endif %}
  54.                             }
  55.                         {% endfor %}
  56.                         if (!isMatch)
  57.                         {
  58.                             $(subElement).after('<td class="align-middle text-center">'+"{{ 'remise_payment4.admin_order_edit.label.card.job.other'|trans }}"+'</td>');
  59.                         }
  60.                     }
  61.                 });
  62.             }
  63.         });
  64.         // ルミーズカード決済状況チェックボックス
  65.         $('#remise_payment_extset4_toggle_check_all').on('change', function() {
  66.             var checked = $(this).prop('checked');
  67.             if (checked) {
  68.                 $('input[id^="remise_payment_extset4_check_"]').prop('checked', true);
  69.             } else {
  70.                 $('input[id^="remise_payment_extset4_check_"]').prop('checked', false);
  71.             }
  72.             if(remisePaymentExtset4CheckCount())
  73.             {
  74.                 $("#remise_payment_extset4_button_area").css("visibility","visible");
  75.             }else{
  76.                 $("#remise_payment_extset4_button_area").css("visibility","hidden");
  77.             }
  78.         });
  79.         $('input[id^="remise_payment_extset4_check_"]').on('change', function() {
  80.             $('#remise_payment_extset4_toggle_check_all').prop('checked', false);
  81.             if(remisePaymentExtset4CheckCount())
  82.             {
  83.                 $("#remise_payment_extset4_button_area").css("visibility","visible");
  84.             }else{
  85.                 $("#remise_payment_extset4_button_area").css("visibility","hidden");
  86.             }
  87.         });
  88.         // 一括売上処理
  89.         $('#remise_payment_extset4_select_sales').on('click', function() {
  90.             var chkCount = 0;
  91.             var orderIds = '';
  92.             $('input[id^="remise_payment_extset4_check_"]').each(function() {
  93.                 if ($(this).prop("checked") == true) {
  94.                     chkCount++;
  95.                     if (orderIds.length != 0) orderIds += ",";
  96.                     orderIds += $(this).val();
  97.                 }
  98.             });
  99.             if (chkCount == 0) {
  100.                 alert("{{ 'remise_payment4.extset.admin_order_index.text.remise_payment_extset4_select_sales.nocheck'|trans }}");
  101.                 return false;
  102.             }
  103.             var msg = "{{ 'remise_payment4.extset.admin_order_index.text.remise_payment_extset4_select_sales.confirm_msg1'|trans }}" + chkCount + "{{ 'remise_payment4.extset.admin_order_index.text.remise_payment_extset4_select_sales.confirm_msg2'|trans }}";
  104.             if (!confirm(msg)) return false;
  105.             remise_waitscreen();
  106.             $('#remise_option_extset_order_ids').val(orderIds);
  107.             $('#search_form').attr('action', "{{url('remise_payment_extset4_sub_order_sales')}}");
  108.             $('#search_form').submit();
  109.         });
  110.     });
  111.     function remisePaymentExtset4CheckCount()
  112.     {
  113.         var chkCount = 0;
  114.         var orderIds = '';
  115.         $('input[id^="remise_payment_extset4_check_"]').each(function() {
  116.             if ($(this).prop("checked") == true) {
  117.                 chkCount++;
  118.                 if (orderIds.length != 0) orderIds += ",";
  119.                 orderIds += $(this).val();
  120.             }
  121.         });
  122.         if (chkCount == 0) {
  123.             return false;
  124.         }
  125.         else
  126.         {
  127.             return true;
  128.         }
  129.     }
  130. </script>