<search-result-seo>
  <link if={IWAI_SITE} rel="stylesheet" type="text/css" href="css/popup.css?v=20190516">
      <div class="result-wrapper">
        <div class="total-number">
          <dl if={!IWAI_SITE} style="display:{total ? 'block' : 'none'}"></dl>
          <dl if={IWAI_SITE} class="size_small" style="display:{total_all ? 'block;margin: 10px 0px;' : 'none'}">
            <dt>検索件数</dt>
            <dd if={!IWAI_SITE} ><b>{ total }</b>件</dd>
            <dd if={IWAI_SITE} ><b>{ total_all }</b>件　</dd><span style="display:{total_all > 1000 ? 'inline; font-size:11px' : 'none'}">検索結果が1000件を超えた為、1000件まで表示</span>
          </dl>
        </div>
        <table class="blue-table">
          <thead if={results.length > 0}>
            <tr>
              <th>
                <div>販売元品番</div> <!-- supplier_sku -->
                <div>製造元品番</div> <!-- manufacturer_sku -->
              </th>
              <th width="40%">品名</th> <!-- name/name_jp -->
              <th if={!IWAI_SITE} >容量/<br/>規格</th> <!-- volume_unit_label/class_name_jp -->
              <th if={IWAI_SITE} style="width:10%">容量/規格</th> <!-- volume_unit_label/class_name_jp -->
              <th>法規情報</th>
              <th>定価</th> <!-- list_price -->
              <th>
                <div>製造元/ブランド</div> <!-- maker_name/brand_name -->
                <div>販売元</div> <!-- sales_origin_maker_name -->
              </th>
              <th>納入価格</th>
              <th if={IWAI_SITE} >納期目安</th>
              <th if={IWAI_SITE} >販売店在庫</th>
            </tr>
          </thead>
          <tbody>
            <tr each={item,index in results }>
              <td>
                <div data-test="supplier_sku_test_cafe"><a href={ '#seo-search/basic_details/' + encodeURIComponent(item.sku)} target="{IWAI_SITE && (url.indexOf('search/simple-po') == -1) ? '_blank' : ''}">{ item.supplier_sku }</a></div>
                <div>{ item.manufacturer_sku }</div>
              </td>
              <td class="name-td">
                <p style="word-break: break-all;" if="{!IWAI_SITE}">{ item.name }</p>
                <p if="{!IWAI_SITE}">{ item.name_jp == item.name ? '' : item.name_jp }</p>
                 <p if="{IWAI_SITE}">{ item.name_jp }</p> 
                <!-- <p>{ item.name_jp == item.name ? '' : item.name_jp }</p> -->
                <ul class="btnList">
                  <li><a href="{ item.url1 }" target="_blank" style="display:{item.url1 ? 'inline' : 'none'}"><i class="fa fa-external-link-square"></i>メーカー製品ページ</a></li>
                  <li if={!IWAI_SITE} ><a href="javascript:void(0)" onclick="{ searchCasCode }" cas_code="{ item.cas_code }" class="cas-code" style="display: {item.cas_code ? 'inline' : 'none'}">【CAS.No { item.cas_code } 検索】</a></li>
                  <li if={IWAI_SITE} ><a href="javascript:void(0)" onclick="{ searchCasCodeIwai }" cas_code="{ item.cas_code }" class="cas-code" style="display: {item.cas_code ? 'inline' : 'none'}">【CAS RN<sup>&reg;</sup> { item.cas_code } 検索】</a></li>
                </ul>
              </td>
              <td>{ item.volume_unit_label } { item.class_name_jp }</td>
              <td class="left">
                <ul if={(arColumn(list_field, 'navigation_id', 'F007').length > 0) && arColumn(list_field, 'navigation_id', 'F007')[0].used_status == 'Y'}>
                  <li>{item.hazadous_name ? ( (list_text_check_2.indexOf(item.hazadous_name) >= 0) ? '' : '危険物(消防法): ' + item.hazadous_name) : '危険物(消防法): 情報なし'}</li>
                  <li>{item.poisonous_material_name ? ((list_text_check_2.indexOf(item.poisonous_material_name) >= 0) ? '' : '毒劇物(毒物及び劇物取締法): ' + item.poisonous_material_name) : '毒劇物(毒物及び劇物取締法): 情報なし'}</li>
                  <li>{item.psychotropic_drug_name ? ((list_text_check_2.indexOf(item.psychotropic_drug_name) >= 0) ? '' : '麻薬・向精神薬(麻薬および向精神薬取締法) ' + item.psychotropic_drug_name) : '麻薬・向精神薬(麻薬および向精神薬取締法) 情報なし'}</li>
                  <li>{item.cartagenal_name ? ((list_text_check_2.indexOf(item.cartagenal_name) >= 0) ? '' : 'カルタヘナ: ' + item.cartagenal_name) : 'カルタヘナ: 情報なし'}</li>
                  <li>{item.prtrl_name ? ((list_text_check_2.indexOf(item.prtrl_name) >= 0) ? '' : 'PRTR法: ' + item.prtrl_name) : 'PRTR法: 情報なし'}</li>
                  <li>{item.safety_and_health_act_name ? ((list_text_check_2.indexOf(item.safety_and_health_act_name) >= 0) ? '' : '労働安全衛生法: ' + item.safety_and_health_act_name) : '労働安全衛生法: 情報なし'}</li>
                  <li>{item.biological_origin_name ? ((list_text_check_2.indexOf(item.biological_origin_name) >= 0) ? '' : '生物由来製品: ' + item.biological_origin_name) : '生物由来製品: 情報なし'}</li>
                  <li>{item.soil_contamination_name ? ((list_text_check_2.indexOf(item.soil_contamination_name) >= 0) ? '' : '土壌汚染対策法: ' + item.soil_contamination_name) : '土壌汚染対策法: 情報なし'}</li>

                  <li if={(   (item.hazadous_name ? ( (list_text_check_2.indexOf(item.hazadous_name) >= 0) ? true : false) : false) && 
                  (item.poisonous_material_name ? ( (list_text_check_2.indexOf(item.poisonous_material_name) >= 0) ? true : false) : false) && 
                  (item.psychotropic_drug_name ? ( (list_text_check_2.indexOf(item.psychotropic_drug_name) >= 0) ? true : false) : false) && 
                  (item.cartagenal_name ? ( (list_text_check_2.indexOf(item.cartagenal_name) >= 0) ? true : false) : false) && 
                  (item.prtrl_name ? ( (list_text_check_2.indexOf(item.prtrl_name) >= 0) ? true : false) : false) && 
                  (item.biological_origin_name ? ( (list_text_check_2.indexOf(item.biological_origin_name) >= 0) ? true : false) : false) && 
                  (item.soil_contamination_name ? ( (list_text_check_2.indexOf(item.soil_contamination_name) >= 0) ? true : false) : false) && 
                  (item.safety_and_health_act_name ? ( (list_text_check_2.indexOf(item.safety_and_health_act_name) >= 0) ? true : false) : false)   )}>非該当</li>
                  <li>____________</li>
                  <li>水質汚濁防止法:{item.water_pollution_control_name ? item.water_pollution_control_name : '情報なし'}</li>
                  <li>大気汚染防止法:{item.air_pollution_control_name ? item.air_pollution_control_name : '情報なし'}</li>
                </ul>
                <ul if={!(arColumn(list_field, 'navigation_id', 'F007').length > 0)}>
                  <li>{(list_text_check_1.indexOf(item.hazadous_name) >= 0) ? '' : (item.hazadous_name ? '危険物: ' + item.hazadous_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.poisonous_material_name) >= 0) ? '' : (item.poisonous_material_name ? '毒劇物: ' + item.poisonous_material_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.poisonous_medicine_name) >= 0) ? '' : (item.poisonous_medicine_name ? '毒劇薬: ' + item.poisonous_medicine_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.medicine_name) >= 0) ? '' : (item.medicine_name ? '医薬品: ' + item.medicine_name : '') }</li>

                  <li>{(list_text_check_1.indexOf(item.animal_medicine_name) >= 0) ? '' : (item.animal_medicine_name ? '動物薬: ' + item.animal_medicine_name : '') }</li>

                  <li>{(list_text_check_1.indexOf(item.specifical_medicine_name) >= 0) ? '' : (item.specifical_medicine_name ? '指定薬物: ' + item.specifical_medicine_name : '') }</li>

                  <li>{(list_text_check_1.indexOf(item.medical_equipmentl_name) >= 0) ? '' : (item.medical_equipmentl_name ? '医療機器: ' + item.medical_equipmentl_name : '') }</li>

                  <li>{(list_text_check_1.indexOf(item.psychotropic_drug_name) >= 0) ? '' : (item.psychotropic_drug_name ? '麻薬・向精神薬: ' + item.psychotropic_drug_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.stimulant_drug_material_name) >= 0) ? '' : (item.stimulant_drug_material_name ? '覚せい剤原料: ' + item.stimulant_drug_material_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.duty_free_alcohol_name) >= 0) ? '' : (item.duty_free_alcohol_name ? '免税アルコール: ' + item.duty_free_alcohol_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.cartagenal_name) >= 0) ? '' : (item.cartagenal_name ? 'カルタヘナ: ' + item.cartagenal_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.prtrl_name) >= 0) ? '' : (item.prtrl_name ? 'PRTR法: ' + item.prtrl_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.cscll_name) >= 0) ? '' : (item.cscll_name ? '化審法: ' + item.cscll_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.international_controlled_substance_name) > 0) ? '' : (item.international_controlled_substance_name ? '国際規制物質: ' + item.international_controlled_substance_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.ozone_protect_name) >= 0) ? '' : (item.ozone_protect_name ? 'オゾン層保護法: ' + item.ozone_protect_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.chemical_weapon_name) >= 0) ? '' : (item.chemical_weapon_name ? '化学兵器禁止法: ' + item.chemical_weapon_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.safety_and_health_act_name) >= 0) ? ''  : (item.safety_and_health_act_name ? '労働安全衛生法: ' + item.safety_and_health_act_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.sds_name) >= 0) ? '' : (item.sds_name ? 'SDS該当区分: ' + item.sds_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.radiation_hazard_prevention_name) >= 0) ? '' : (item.radiation_hazard_prevention_name ? '放射線障害防止法: ' + item.radiation_hazard_prevention_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.water_pollution_control_name) >= 0) ? '' : (item.water_pollution_control_name ? '水質汚濁防止法: ' + item.water_pollution_control_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.air_pollution_control_name) >= 0) ? '' : (item.air_pollution_control_name ? '大気汚染防止法: ' + item.air_pollution_control_name : '')}</li>

                  <li>{(list_text_check_1.indexOf(item.biological_origin_name) >= 0) ? '' : (item.biological_origin_name ? '生物由来製品: ' + item.biological_origin_name : '')}</li>
                  
                  <li>{(list_text_check_1.indexOf(item.soil_contamination_name) >= 0) ? '' : (item.soil_contamination_name ? '土壌汚染対策法: ' + item.soil_contamination_name : '')}</li>

                  <!-- <li>{(!item.hazadous_name && !item.poisonous_material_name && !item.poisonous_medicine_name && !item.medicine_name && !item.animal_medicine_name && !item.specifical_medicine_name && !item.medical_equipmentl_name && !item.psychotropic_drug_name && !item.stimulant_drug_material_name && !item.stimulant_drug_material_name && !item.cartagenal_name && !item.prtrl_name && !item.cscll_name && !item.international_controlled_substance_name && !item.ozone_protect_name && !item.chemical_weapon_name && !item.safety_and_health_act_name && !item.sds_name && !item.radiation_hazard_prevention_name && !item.air_pollution_control_name && !item.water_pollution_control_name) ? 'なし' : ''}</li> -->
                </ul>
                <div if={checkVisibleCommentForRegulations(item)}>
                  ____________
                  <br>
                  <span>{checkVisibleCommentForRegulations(item)}</span>
                </div>
              </td>
              <td class="right" style="white-space:nowrap">
                <div>
                  <div data-test="price_sale_test_cafe" if={campaign_retail_price_end_date(item.campaign_retail_price,item.campaign_start_date,item.campaign_end_date,item.campaign_published_date,item.campaign_close_date).length > 0} >
                  <div>［キャンペーン中］</div>
                  <div style="display: { parseInt(item.campaign_retail_price) >=1 ? 'block' : 'none' }">
                    <div style="border-top:0px;"><strike>{ !isNaN(parseInt(item.list_price)) ? (item.list_price == 0 ? 'お見積り' : parseInt(item.list_price).toLocaleString('en') + '円' ) : '' }</strike></div>
                    <div style="border-top:0px;"><b style="color: red">{ !isNaN(parseInt(item.campaign_retail_price)) && (item.campaign_retail_price != 0) ? ( parseInt(item.campaign_retail_price).toLocaleString('en') + '円' ) : 'お見積り' }</b></div>
                  </div>
                  <div style="border-top:0px; display: { isNaN(parseInt(item.campaign_retail_price)) || parseInt(item.campaign_retail_price) < 1 ? 'block' : 'none' }"><a href={ '#search/basic_details/' + encodeURIComponent(item.sku)} style="color:red;text-decoration: none">商品詳細ページへ</a></div>
                  <div style="border-top:0px;" class="campaign_date_{index}">{ campaign_retail_price_end_date(item.campaign_retail_price,item.campaign_start_date,item.campaign_end_date,item.campaign_published_date,item.campaign_close_date)}</div>
                  </div>
                  <div data-test="price_test_cafe" if={!(campaign_retail_price_end_date(item.campaign_retail_price,item.campaign_start_date,item.campaign_end_date,item.campaign_published_date,item.campaign_close_date).length > 0)}>{ !isNaN(parseInt(item.list_price)) ? (item.list_price == 0 ? 'お見積り' : parseInt(item.list_price).toLocaleString('en') + '円' ) : '' }</div>
                </div>

              </td>
              <td>
                <div data-test="maker_name_test_cafe">{ !item.brand_name ? item.maker_name : (!item.maker_name ? item.brand_name : item.maker_name + '/' + item.brand_name) }</div>
                <div data-test="sales_origin_maker_name_test_cafe">{ item.sales_origin_maker_name }</div>
              </td>
              <td class="right" style="white-space:nowrap">
                <!-- <a class="price_list_open" onclick="{priceListOpen}" index={index}>確認する</a> -->
                <!-- <div class="wow slideInRight" index={index} data-wow-delay=".1s" style="visibility:hidden;width:50px; height: 50px; background: black"></div> -->
              <div data-test="price_sale_test_cafe" if={campaign_retail_price_end_date(item.campaign_retail_price,item.campaign_start_date,item.campaign_end_date,item.campaign_published_date,item.campaign_close_date).length > 0} >
                <div>
                  <div style="display: { parseInt(item.campaign_retail_price) >=1 ? 'block' : 'none' }">

                   <div style="border-top:0px;">{ !isNaN(parseInt(item.min_price)) && (item.min_price != 0) ? ( parseInt(item.min_price).toLocaleString('en') + '円' ) : 'お見積り' }</div>
                 </div>
                 <div style="border-top:0px; display: { isNaN(parseInt(item.campaign_retail_price)) || parseInt(item.campaign_retail_price) < 1 ? 'block' : 'none' }"><a href={ '#search/basic_details/' + encodeURIComponent(item.sku)} style="color:red;text-decoration: none">商品詳細ページへ</a></div>
                </div>
                <!-- <div if={IWAI_SITE} >
                  <div if={item.campaign_url}>
                    <a class="redirect_link_campaign" href="{item.campaign_url ? item.campaign_url : ''}" target="_blank">［キャンペーン中］</a>
                  </div>
                  <div if={!item.campaign_url}>
                    <p class="redirect_link_campaign">［キャンペーン中］</p>
                  </div>
                  <div style="display: { parseInt(item.campaign_retail_price) >=1 ? 'block' : 'none' }">
                    <div style="border-top:0px;"><strike>{ !isNaN(parseInt(item.list_price)) ? (item.list_price == 0 ? 'お見積り' : parseInt(item.list_price).toLocaleString('en') + '円' ) : '' }</strike></div>
                    <div style="border-top:0px;"><b style="color: red">{ !isNaN(parseInt(item.min_price)) ? ((item.list_price == item.min_price) ? 'お見積り' : parseInt(item.min_price).toLocaleString('en') + '円' ) : '' }</b></div>
                  </div>
                  <div style="border-top:0px; display: { isNaN(parseInt(item.campaign_retail_price)) || parseInt(item.campaign_retail_price) < 1 ? 'block' : 'none' }"><a href={ '#search/basic_details/' + encodeURIComponent(item.sku)} style="color:red;text-decoration: none">商品詳細ページへ</a></div>
                  <div style="border-top:0px;" class="campaign_date_{index}">{ campaign_retail_price_end_date(item.campaign_retail_price,item.campaign_start_date,item.campaign_end_date,item.campaign_published_date,item.campaign_close_date)}</div>
                </div> -->
              </div>
              <div data-test="price_sale_test_cafe"  if={!(campaign_retail_price_end_date(item.campaign_retail_price,item.campaign_start_date,item.campaign_end_date,item.campaign_published_date,item.campaign_close_date).length > 0)} >{ !isNaN(parseInt(item.min_price)) && (item.min_price != 0) ? ( parseInt(item.min_price).toLocaleString('en') + '円' ) : 'お見積り' }</div>
              <!-- ES BRP -->
              <!-- <div data-test="price_sale_test_cafe" if={campaign_retail_price_end_date(item.campaign_suggest_delivery_price,item.campaign_start,item.campaign_end).length > 0} >
                <div style="display: { parseInt(item.campaign_suggest_delivery_price) >=1 ? 'block' : 'none' }">［キャンペーン中］</div>
                <div style="border-top:0px; display: { parseInt(item.campaign_suggest_delivery_price) >=1 ? 'block' : 'none' }"><strike>{ !isNaN(parseInt(item.list_price)) ? (item.list_price == 0 ? 'お見積り' : parseInt(item.list_price).toLocaleString('en') + '円' ) : '' }</strike></div>
                <div style="border-top:0px; display: { parseInt(item.campaign_suggest_delivery_price) >=1 ? 'block' : 'none' }"><b style="color: red">{ !isNaN(parseInt(item.min_price)) ? ((item.list_price == item.min_price) ? 'お見積り' : parseInt(item.min_price).toLocaleString('en') + '円' ) : '' }</b></div>
                <div style="border-top:0px; display: { isNaN(parseInt(item.campaign_suggest_delivery_price)) || parseInt(item.campaign_suggest_delivery_price) < 1 ? 'block' : 'none' }">{ !isNaN(parseInt(item.min_price)) ? ((item.list_price == item.min_price) ? 'お見積り' : parseInt(item.min_price).toLocaleString('en') + '円' ) : '' }</div>
                <div style="border-top:0px; display: { parseInt(item.campaign_suggest_delivery_price) >=1 ? 'block' : 'none' }">{ campaign_retail_price_end_date(item.campaign_suggest_delivery_price,item.campaign_start,item.campaign_end)}</div>
              </div>
              <div data-test="price_sale_test_cafe"  if={!(campaign_suggest_delivery_price(item.campaign_suggest_delivery_price,item.campaign_start,item.campaign_end).length > 0)} >{ !isNaN(parseInt(item.min_price)) ? ((item.list_price == item.min_price) ? 'お見積り' : parseInt(item.min_price).toLocaleString('en') + '円' ) : '' }</div> -->

              </td>
              
              <td if={IWAI_SITE} >
                <span if={item.over_sea_text != 'タイムアウト'}><button class="popupform-oversea-open" if={ item.over_sea_text && ( item.souko_zaiko_su === 0 || item.souko_zaiko_su === '0' || item.souko_zaiko_su === '' || item.souko_zaiko_su == null )  }>{ item.over_sea_text } </button></span>

                <span if={ item.over_sea_text && item.over_sea_text != 'タイムアウト' && item.souko_zaiko_su !== 0 && item.souko_zaiko_su !== '0' && item.souko_zaiko_su !== ''}>{item.over_sea_text}</span>
                <span class='timeout-text' if={item.over_sea_text == 'タイムアウト'}>タイムアウト</span>
              </td>
              <td if={IWAI_SITE} >
                <span if={item.souko_zaiko_su_text != 'タイムアウト'}>{item.souko_zaiko_su_text}</span>
                <span class='timeout-text' if={item.souko_zaiko_su_text == 'タイムアウト'}>タイムアウト</span>
              </td>
              <!-- <td if={item.dealer_zaik_suryo_20000057 || item.dealer_zaik_suryo_20000057 === 0 || item.dealer_zaik_suryo_20000057 === '0'  || item.promotional_maker_flag || item.promotional_maker_flag === 0 || item.promotional_maker_flag === '0'}>在庫数：{item.dealer_zaik_suryo_20000057}<br/>販促フラグ：{item.promotional_maker_flag}</td> -->
            </tr>
          </tbody>
        </table>
      </div>

      <div if={IWAI_SITE} class="modal-wrapper">
        <div class="o_modal" id="price-list-modal">
          <div class="o_modal_box">
            <div class="o_modal_head">
              <a id="price-list-close"><i class="fa fa-times"></i></a>
            </div>
            <div class="o_modal_body">
              <div class="o_modal_main">
                <h3 class="modal-title">納入価格一覧</h3>
                <div class="price-list-box">
                  <p>{parseInt(price_list).toLocaleString('en')}</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="modal-wrapper">
        <div class="o_modal" id="popupform-oversea" style="display:none;">
          <div class="o_modal_box">
            <div class="o_modal_head">
              <a id="popupform-oversea-close-link"><i class="fa fa-times"></i></a>
            </div>
            <div class="o_modal_body">
              <div class="o_modal_main">
                <h3 class="modal-title">納期注意事項</h3>
                <p>※納期目安は確実な納期ではありません。</p>
　               <p>詳細な納期はお問い合わせ願います。</p>
                <br />
                <p>※国内外ともに在庫無しの場合は納期目安表示の対象外となります。</p>
                <!-- <p style="text-align: right;"><button id="popupform-oversea-close-button">閉じる</button></p> -->
              </div>
            </div>
          </div>
        </div>
      </div>
      <script>
          this.IWAI_SITE = IWAI_SITE;
          var user_info = JSON.parse(localStorage.getItem('EcUserInfo'));
          this.results = opts.results;
          this.total = opts.total;
          if (IWAI_SITE) {
            this.total_all = opts.total_all;
          }
          this.price_list = [];
          var thisTag = this;
          var y = $(location).attr('hash').slice(1);
          this.url = y.substring(0, y.indexOf( "?" ));
          var tag = opts.tag;
          this.list_field = user_info.list_navigation.F;
          this.list_text_check_1 = ['非消防法危険物 又は未チェック', '非該当', '対象外', '情報なし', '未確認', '未設定', ''];
          this.list_text_check_2 = ['非消防法危険物 又は未チェック', '非該当', '対象外'];
          this.on("mount", function(){
            if (!IWAI_SITE) {
              this.max_date_updated = '';
            } else {
              thisTag.getManufacturerOwl(thisTag.results);
            }
            $.each(thisTag.results, function(i, e){
              var campaign_date = $(".campaign_date_"+i).html() ? $(".campaign_date_"+i).html().split("|") : '';
              var campaign_start_date = campaign_date[0] ? campaign_date[0] + '～<br>' : '';
              var campaign_end_date = campaign_date[1] ? campaign_date[1] + 'まで' : '';
              $(".campaign_date_" + i).html(campaign_start_date + "" + campaign_end_date);
            })
          });
          $(function(){
            $('.price_list_open').on('click',function(){
              $('#price-list-modal').fadeIn();
            });

            $('#price-list-close').on('click',function(){
              $('#price-list-modal').fadeOut();
            });
            $(".redirect_link_campaign").click(function(e) {
              if(!$(e.target).attr('href')){
                e.preventDefault();
              }
            });
          });
          this.checkVisibleCommentForRegulations = function(e){
              var supplier_comp_code = e.supplier_comp_code;
              // var supplier_comp_code = '20000057';
              var comment_for_regulations = e.comment_for_regulations; 
              // var comment_for_regulations = '未発注品'; 
              if( supplier_comp_code == '20000057' && comment_for_regulations){
                  if(comment_for_regulations == '未発注品'){
                      return 'ご依頼をいただいた上で改めて法規制の確認をさせていただきますため、取り扱いができない場合がございますのでご留意ください。';
                  } else {
                      return comment_for_regulations;
                  }
              } else {
                return '';
              }
          }
          this.priceListOpen = function (e){
            // console.log(e);
            var accessTokenCognito = localStorage.getItem('accessTokenCognito');
            var url = URL_API + '/api/get_products_dealer_customers_list';
            var query = [];
            var dealer_co_cd = e.item.item.supplier_comp_code;
            var supp_co_cd = e.item.item.supplier_comp_code;
            var maker_name = e.item.item.maker_name;
            var item_sku = e.item.item.sku;
            var list_price = e.item.item.list_price;
            query.push('token=' + accessTokenCognito);
            query.push('dealer_co_cd=' + dealer_co_cd);
            query.push('list_price=' + list_price);
            query.push('item_sku=' + item_sku);
            query.push('maker_name=' + maker_name);
            query.push('supp_co_cd=' + supp_co_cd);
            url += '?' + query.join('&');
            $.ajax({
                url: url,
                type: 'GET',
                success: function (data) {
                    if(data.status == 100){
                        riot.mount('app','maintain',{ messege:data.messege });
                        return false;
                    }          
                    thisTag.price_list = data.dealer_customer_list;
                    thisTag.update(thisTag.price_list);
                    $('#price-list-modal').fadeIn();
                },
                error: function (xhr, stt, error) {
                    alert('error');
                }
            });
          }
          this.searchCasCode = function (e) {
              var cas_code = e.target.getAttribute('cas_code') ? e.target.getAttribute('cas_code') : '9736a52d-0cf5-4aa5-81c8-82dc85f0c81c'; // fix when cas_code null
              if (tag == 'search/simple') {
                  ec10_cas_code = cas_code;
                  ec10_keyword = '';
                  riot.mount('search');
              }
              if (tag == 'search/simple-po') {
                  ec10_cas_code = cas_code;
                  // ec10_keyword = '';
                  riot.mount('search-po');
              }
              if  (tag == 'search/basic') {
                  ec11_cas_code = cas_code;
                  ec11_sales_origin_maker_name = '';
                  ec11_maker_name = '';
                  ec11_name_name_jp = '';
                  ec11_supplier_manufacturer_sku = '';
                  riot.mount('search-1');
              }
          }
          this.searchCasCodeIwai = function (e) {
            var cas_code = e.target.getAttribute('cas_code') ? e.target.getAttribute('cas_code') : '9736a52d-0cf5-4aa5-81c8-82dc85f0c81c'; // fix when cas_code null
            if (tag == 'search/simple-po') {
                ec10_cas_code = cas_code;
                ec10_keyword = '';
                riot.mount('search-po-iwai');
            }
        }
          this.popupFormOverSea = function (){
            $('.popupform-oversea-open').on('click',function(e){
              $('#popupform-oversea').fadeIn();
            });
            $('#popupform-oversea-close-link').on('click',function(e){
              $('#popupform-oversea').fadeOut();
            });
            $('#popupform-oversea-close-button').on('click',function(e){
              $('#popupform-oversea').fadeOut();
            });
          }
          this.checkOverSea = function (souko_zaiko_su, over_sea){
              var text = 'タイムアウト';
              if(!souko_zaiko_su || souko_zaiko_su === '0' || souko_zaiko_su === 0){
                  if(over_sea !== 0 && over_sea !== '0'){
                      text = "１０～１４営業日";
                  } else {
                      text = '２～５営業日';
                  }
              } else {
                  if(over_sea === 0 || over_sea === '0'){
                      text = "１～３営業日";
                  } else {
                      text = '１～３営業日';
                  }
              }
              return text;
          } 
          this.arrParamToGetManufacturerOwl = function (arr) {
              var param = [];
              $.each(arr, function(i, e) {
                  var item = {};
                  if(e.list_dealer_cd){
                      item.list_dealer_cd = e.list_dealer_cd;
                  }
                  if(e.supplier_comp_code){
                      item.supplier_comp_code = e.supplier_comp_code;
                  }
                  if(e.sku){
                      item.sku = e.sku;
                  }
                  if(e.maker_name){
                      item.maker_name = e.maker_name;
                  }
                  if(e.maker_code){
                      item.maker_code = e.maker_code;
                  }

                  param.push(item);
                  
              });
              return param;
          }
          this.checkManufacturerToGetOversea = function(arr, param){
              var result = '';
              // console.log("==============Arr==================");
              // console.log(arr);
              $.each(arr, function(i, e){
                  if(param.supplier_comp_code){
                      // console.log("========================Param====================");
                      // console.log(param);
                      
                      if(param.maker_name){
                          // console.log("=======================Item 1=========================");
                          var item = "_" + param.maker_name + "_" + param.supplier_comp_code;
                          if(i == item){
                              // console.log(i + "===yes===_" + param.maker_name + "_" + param.supplier_comp_code);
                              result = e;
                          }
                          // console.log(1);
                      } else {
                          // console.log("=======================Item 2=========================");
                          var item = "__" + param.supplier_comp_code;
                          if(i == item){
                              // console.log(i + "===yes===" + "__" + param.supplier_comp_code);
                              result = e;
                          }
                          // console.log(2);
                      }
                     
                  }
              });
              return result;
          }
          this.checkOwlToGetSoukoZaikoSu = function(list_owl, param){
              var result = {};
              var list_result = [];
              var max_souko = 0;
              $.each(list_owl, function(i, e){
                var souko_list = [];
                $.each(param.list_dealer_cd, function(index_dealer_cd, dealer_cd){
                  var item = param.sku + "_" + dealer_cd;
                  // console.log(dealer_cd);
                  // console.log(item);
                  if(i == item){
                    list_result.push({
                      souko_zaiko_su: e.souko_zaiko_su,
                      souko_zaiko_su_updated: e.updated
                    });
                    souko_list.push(e.souko_zaiko_su);
                  }
                });
                // console.log(souko_list);
                if(souko_list){
                  max_souko = Math.max(souko_list);
                  // console.log(max_souko);
                  $.each(list_result, function(index_souko, value_souko){
                    // console.log(value_souko.souko_zaiko_su);
                    if(max_souko == value_souko.souko_zaiko_su){
                      result = value_souko;
                    }
                  });
                }
                // console.log(result);
                  
              });
              return result;
          }
          this.getManufacturerOwl = function (product_list) {
              if(!Array.isArray(product_list) || !product_list.length){
                  return false;
              } 
          
              var arr_list_param = thisTag.arrParamToGetManufacturerOwl(product_list);
              var param = [];
              var accessTokenCognito = localStorage.getItem('accessTokenCognito');
              param.push('token=' + accessTokenCognito);
              var url = URL_API + '/api/get_list_manufacture_owl';
              url += '?' + param.join('&');
              $.ajax({  
                  url: url,
                  type: 'POST',
                  timeout: 30000,
                  // async:false,
                  data: {
                      param: arr_list_param
                  },
                  beforeSend: function() {
                      // $('#img-loader').hide();
                      // $(".loading_F017").show();
                  },
                  afterSend: function() {
                      // $(".loading_F017").hide();
                  },
                  success: function (data) {
                      if(data.status == 100){
                          riot.mount('app','maintain',{ messege:data.messege });
                          return false;
                      }
                      if(data.status == 'not_authorize'){
                          var url = "#";
                          $(location).attr("href", url );
                          return false;
                      }
                      if(data.message == 'success'){
                          var list_manufacturer = data.list_manufacturer;
                          var list_owl = data.list_owl;
                          var list_owl_updated = [];
                          $.each(product_list, function(i, e){
                              let param = {
                                  list_dealer_cd: e.list_dealer_cd,
                                  supplier_comp_code: e.supplier_comp_code,
                                  maker_name: e.maker_name,
                                  maker_code: e.maker_code,
                                  sku: e.sku,
                              };

                              let manufacturer_result = thisTag.checkManufacturerToGetOversea(list_manufacturer,param); // over_sea

                              product_list[i].oversea = manufacturer_result ? manufacturer_result : "タイムアウト";

                              let owl_result = thisTag.checkOwlToGetSoukoZaikoSu(list_owl,param);
                              product_list[i].souko_zaiko_su = owl_result > 0 ? owl_result.souko_zaiko_su : '';
                              product_list[i].souko_zaiko_su_text = owl_result.souko_zaiko_su ? (owl_result.souko_zaiko_su > 2 ? '3以上' : owl_result.souko_zaiko_su) : '取寄品';
                              product_list[i].souko_zaiko_su_updated = owl_result.updated;

                              let over_sea_text = thisTag.checkOverSea(owl_result.souko_zaiko_su, manufacturer_result);
                              product_list[i].over_sea_text = over_sea_text;
                              if(owl_result.souko_zaiko_su_updated){
                                list_owl_updated.push(new Date(owl_result.souko_zaiko_su_updated));
                              }
                          });
                          // thisTag.countSoukoZaikoUpdatedNewest(list_owl_updated);
                          thisTag.results = product_list;
                          
                          thisTag.update(thisTag.results);
                          thisTag.popupFormOverSea();
                      } 
                      // $(".loading_F017").hide();
                      // if(data.message == 'error'){
                      //   thisTag.checkOverSea = 'タイムアウト';
                      //   thisTag.update(thisTag.checkOverSea);
                      // }
                  },
                  error: function (xhr, stt, err) {
                      // $(".loading_F017").hide();
                      $.each(thisTag.results, function(i, e){
                        thisTag.results[i].over_sea_text = 'タイムアウト';
                        thisTag.results[i].souko_zaiko_su_text = 'タイムアウト';
                        thisTag.results[i].souko_zaiko_su_updated = '';
                      })
                      thisTag.update(thisTag.results);
                  }
              });
          }
          this.countSoukoZaikoUpdatedNewest = function(list_date){
              var max_date_updated = moment(new Date(Math.max.apply(null,list_date)), 'YYYY-MM-DD').format('YYYY-MM-DD');
              thisTag.max_date_updated = max_date_updated;
              thisTag.update(thisTag.max_date_updated);
          }
          function campaign_retail_price(price,start,end){
            // console.log(price);
            // console.log(start);
            // console.log(end);
              var start_date = start.getTime();
              var end_date = end.getTime();
              var now = new Date();
              var now_date = now.getTime();

              if(start_date >= now_date || now_date <= end_date){
                  return price;
              } 
              return '';
          }
      </script>
</search-result-seo>
