<div class="modal-appointment">
  <div class="modal-body">
    <div class="appointment-wrapper">
      <div class="left-content">
        <h1 class="title-product">Indian Challenger Elite</h1>
        <h2 class="title-section">預約賞車</h2>
        <div class="thumb catalog-thumb img_change" style="background-image: url('https://www.indianmotorcycle.com.tw/image/catalog/01_challenger_elite/challenger_elite_0.jpg')"></div>
                  <h3 class="title-sub">相關車型</h3>
        <div class="related">
          <div class="scooter-list">
                          <div class="scooter-item">
              <a href="https://www.indianmotorcycle.com.tw/index.php?route=common/appointment/form&product_id=110" class="appointment-form">
                <div class="thumb catalog-thumb" style="background-image: url('https://www.indianmotorcycle.com.tw/image/catalog/2025Challenger/2025challenger-dark-horse-black-smoke-png.png')"></div>
                <div class="text-center">
                  <h4 class="title-card">Indian Challenger Dark Horse</h4>
                </div>
              </a>
            </div>
                          <div class="scooter-item">
              <a href="https://www.indianmotorcycle.com.tw/index.php?route=common/appointment/form&product_id=202" class="appointment-form">
                <div class="thumb catalog-thumb" style="background-image: url('https://www.indianmotorcycle.com.tw/image/catalog/2025Challenger/wnu4y-2kfo6-001 (自訂).png')"></div>
                <div class="text-center">
                  <h4 class="title-card">Indian Challenger Limited</h4>
                </div>
              </a>
            </div>
                        </div>
        </div>
                </div>
      <div class="right-content">
        <ul class="product-option">
          <li class="option-item">
            <b>車型系列</b>
            <span> 車系</span>
            <input type="hidden" value="" id="category">
          </li>
          <li class="option-item">
            <b>車型名稱</b>
            <span>Indian Challenger Elite</span>
             <input type="hidden" value="Indian Challenger Elite" id="product_name">
          </li>
          <li class="option-item">
            <b>車型售價</b>
            <span id="option-price">請洽印地安經銷據點詢問</span>
            <input type="hidden" value="請洽印地安經銷據點詢問" id="product_sku">
          </li>
          <li class="option-item">
            <b>車型顏色</b>
            <div class="colors">
                                                                              <a href="#" data-id="0" data-img="https://www.indianmotorcycle.com.tw/image/catalog/01_challenger_elite/challenger_elite_0.jpg" data-name="White Crystal with Black Candy, Red Candy, &amp; Gloss Black" data-price="請洽印地安經銷據點詢問"><img src="https://www.indianmotorcycle.com.tw/image/catalog/01_challenger_elite/cdn1_polaris.jpg" width="40"></a>
                                                                        </div>
          </li>
        </ul>
        <h3 class="title-sub">請填入基本資料</h3>
        <form action="#" method="post"> 
          <div class="form-item">
            <input type="text" required placeholder="姓名" class="form-element" id="name">
          </div>
          <div class="form-item">
            <input type="tel" placeholder="手機號碼" class="form-element" id="phone">
          </div>
          <div class="form-item">
            <input type="text" placeholder="居住城市" class="form-element" id="address">
          </div>
          <div class="form-item">
            <input type="text" placeholder="Email" class="form-element" id="email">
          </div>
          <div class="form-item">
            <textarea rows="3" placeholder="備 註" class="form-element" id="remarks"></textarea>
          </div>
          <div class="flexbox-between">
            <label class="agreement">
              <input type="checkbox" name="button_check">
              <span class="req">*</span>我已閱讀並同意相關<a href="https://www.indianmotorcycle.com.tw/information/13" target="_blank">個資條款</a>
              <!-- <a href="#" data-toggle="modal" data-target="#modal-form" class="callback">個資條款</a> -->
            </label>
            <button type="button" class="btn btn-outline" onclick="editsingupForm()">
            送 出</button>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>

<!-- <div id="modal-form" class="modal-form info">
  <p class="modal-form-ttl">個資條款</p>
  <p>Indian Motorcycle 總代理 海德生貿易股份有限公司(以下稱「本公司」)依據個人資料保護法(以下稱「個資法」)第8條第1項規定，項台端告知下列事項，請台端詳閱：</p>
    <ul>
        <li>一、蒐集之特定目的(以下所列者(含代號)，係依法務部於民國101年10月1日新修正公告之「個人資料保護法之特定目的及個人資料類別」所列之特定目的項目)。
            <ol>
                <li>消費者、客戶管理與服務(○九○)</li>
                <li>貿易推廣及管理(一二三)</li>
                <li>民意調查(○二四)</li>
                <li>行銷(○四○)</li>
                <li>非公務機關依法定義務所進行個人資料之蒐集處理及利用(○六三)</li>
                <li>其他經營合於營業登記項目或組織章程所訂之業務(一八一)</li>
            </ol>
        </li>
        <li>二、蒐集之個人資料類別：(例如姓名、聯絡方式等)，詳如(【交車客戶資料卡/顧客資料卡/買賣合約書】內容)。</li>
        <li>三、個人資料來源：由台端本人或由第三人提供之台端之個人資料。</li>
        <li>四、個人資料利用之期間、地區、對象及方法：
            <ol>
                <li>期間：個人資料蒐集之特定目的存續期間為十五年。且本公司得於該特定目的消失後保存十五年。</li>
                <li>地區：本國、本公司及其所屬其他關係企業所在地、未受中央國的事業主管機關限制之國際傳輸個人資料之接收者所在地、與本公司有業務往來之機構(包括但不限於保險機構、行銷公司等)。</li>
                <li>對象：本公司、本公司所屬之其他關係企業、未受中央國的事業主管機關限制之國際傳輸個人資料之接收者、與本公司有業務往來之機構(包括但不限於保險機構、行銷公司等) 。</li>
                <li>方式：以自動化機器或其他非自動化之利用方式。</li>
            </ol>
        </li>
        <li>五、依據個資法第3條規定，台端就本公司保有台端之個人資料得行使下列權利：
            <ol>
                <li>得向本公司查詢、請求閱覽或請其製給副本，而本公司依法得酌收必要成本費用。</li>
                <li>得向本公司請求補充或更正，惟依法台端應惟適當之釋明。</li>
                <li>得向本公司請求停止蒐集、處理或利用及請求刪除，惟依法本公司因執行業務所必須者，得不一台端請求為之。</li>
            </ol>
        </li>
        <li>六、台端不提供個人資料所致權益之影響：
            <ol>
                <li>台端得自由選擇是否提供相關個人資料，惟台端若拒絕提供相關個人資料，本公司將無法進行必要之處理作業，致無法提供台端相關服務。</li>
            </ol>
        </li>
    </ul>
</div> -->

<script>
  $(document).ready(function() {
    // console.log($('body').find('.modal-appointment .colors a').eq(1).click());
    var colorActive = localStorage.getItem('colorActive');
    // console.log(colorActive);

    $(".title-card, .title-product").each(function(){
        var ori = $(this).html()
        $(this).html(ori.replace(/®/g, "<sup>&reg;</sup>"));
    });
    $(".colors a").click(function(e){
        e.preventDefault();
        var img = $(this).data('img');
        $(this).siblings('a').removeClass('active'); 
        $(this).addClass('active');

        $('.img_change').css('background-image','url("' + img + '")');
        if($(this).data('price') != ''){
          $('#option-price').html($(this).data('price'));
        }
    });

    $('body').find('.modal-appointment .colors a').eq(colorActive).click()
  });
  
  function editsingupForm(){
    var formData = {};
    formData.name = $("#name").val().toString();
    formData.phone = $("#phone").val().toString();
    formData.address = $("#address").val().toString();
    formData.remarks = $("#remarks").val().toString();
    formData.email = $("#email").val().toString();
    formData.button_check = $("input[name='button_check']:checked").serialize();
    formData.category = $("#category").val().toString();
    formData.product_name = $("#product_name").val().toString();
    formData.sku = $("#product_sku").val().toString();
    formData.color = $(".modal-appointment .colors a.active").data('name');
    // alert(formData['category']);
    // alert(formData['sku']);
    // alert(formData['color']);
    // alert(formData['button_check']);
    // alert(formData['name']);
    // alert(formData['color']);
    // alert(formData['product_name']);

    // var student = $("input[name='button_check']:checked").serialize();

      $.ajax({
          type: 'POST',
         
          url: 'index.php?route=common/appointment/addMyComboClass',
          dataType: 'json',

          data:formData,
          success: function(json) {

            if (json['error']) {
                alert(json['error']);
            } else {
                alert('預約成功，在接下來的三日內，我們會請鄰近您居住區域的經銷據點主動與您聯繫。');
                window.parent.location.reload();
                parent.layer.closeAll('iframe');
            }
          },   
      });
  };  
</script>