<style type="text/css">
.copy-tips{position:fixed;z-index:999;bottom:50%;left:50%;margin:0 0 -20px -80px;background-color:rgba(0, 0, 0, 0.2);filter:progid:DXImageTransform.Microsoft.Gradient(startColorstr=#30000000, endColorstr=#30000000);padding:6px;}
.copy-tips-wrap{padding:10px 20px;text-align:center;border:1px solid #F4D9A6;background-color:#FFFDEE;font-size:14px;}
</style>
<script type="text/javascript" src="/js/jquery.zclip.min.js"></script>
<div class="container" style="max-width:500px;padding:15px;">
  <div class="row">

    <div class="col-xs-24">
      <h1></h1>
      <legend>Paypal支付链接生成</legend>
    </div>

    <div class="col-xs-24" style="padding-top:30px;padding-bottom:20px;">
      <form method="post" action="<?php echo site_url('apps/paypal/payment');?>">
        <div class="form-group">
          <label for="inputEmail">类型</label>
            <select name="paytype" class="form-control">
              <option>paypal(通过支付中心)</option>
            </select>
        </div>
        <div class="form-group">
          <label for="inputEmail">币种</label>
            <select name="currency" class="form-control">
              <option value="EUR">欧元</option>
              <option value="GBP">英镑</option>
              <option value="USD" selected>美元</option>
              <option value="AUD">澳元</option>
              <option value="CAD">加元</option>
              <option value="CNY">人民币</option>
            </select>
        </div>
        <div class="form-group">
          <label for="inputEmail">语种</label>
            <select name="lan" class="form-control">
              <option value="en_us" selected>英语</option>
              <option value="de_de">德语</option>
              <option value="fr_fr">法语</option>
              <option value="es_es">西语</option>
              <option value="ja_jp">日语</option>
              <option value="ru_ru">俄语</option>
              <option value="it_it">意大利语</option>
            </select>
        </div>
        <div class="form-group">
          <label>金额</label>
            <input class="form-control" type="text" id="price" name="price" placeholder="金额" autocomplete="off">
        </div>
        <div class="form-group">
          <label>订单号</label>
            <input class="form-control" type="text" name="orderid" placeholder="订单号" autocomplete="off">
        </div>
        <div class="form-group">
          <label>描述</label>
            <textarea rows="3" class="form-control" name="description">
 Tracking Code:
 Travel Advisor:
 Content:</textarea>
        </div>
        <div class="form-group">
            <button type="submit" class="btn btn-danger">生成支付链接</button>
        </div>
      </form>
    </div>
    <?php if(isset($payurl)){ ?>
    <div class="col-xs-24" style="padding-top:30px;padding-bottom:30px;border-top:1px solid #ddd;">
      <div class="col-xs-24 nopadding hidden-xs" id="payhtml"><?php echo $payurl; ?></div>
      <div class="col-xs-24 nopadding hidden-xs" style="height:200px;">
        <h5>获取支付链接的两种方式:</h4>
          <ul style="padding-left:15px;">
            <li style="padding-bottom:8px;">请拖动鼠标选中上方的支付图片(在图片下方鼠标左键三击试试)，然后按下键盘上的Ctrl+C键对图片链接复制,接着在你需要插入支付链接的地方按Ctrl+V键进行粘贴即可。<br>[温馨提示：不能直接用鼠标右键功能进行复制]</li>
            <li>你也可以点击<a href="#none" class="copy">复制</a>，直接把支付链接发送给客人<br>[注意，这种方式得到的链接是没有paypal图标的。]</li>
          </ul>
      </div>
    </div>

    <!-- Modal -->
    <div class="modal fade in visible-xs" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
      <div class="modal-dialog" role="document" style="height: 100%;margin:0;">
        <div class="modal-content" style="height: 100%;">
          <div class="modal-header">
            <h4 class="modal-title text-center clearfix" id="myModalLabel">
              <span class="col-xs-8 pull-left nopadding text-left"><a href="javascript:$('#myModal').remove();"><返回</a></span>
              <span class="col-xs-8">支付链接</span>
            </h4>
          </div>
          <div class="modal-body" style="">
            <p style="word-break: break-all;">
              <a href="<?php echo $paylink; ?>">
              <?php echo $paylink; ?>
              </a>
            </p>
          </div>
        </div>
      </div>
    </div>

    <?php } ?>

  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){
  if ($("#payhtml>a").length>0) {
      var $copysuc = $("<div class='copy-tips'><div class='copy-tips-wrap'>☺ 支付链接成功生成</div></div>");
      $("body").find(".copy-tips").remove().end().append($copysuc);
      $(".copy-tips").fadeOut(3000);
  };

    $(".copy").zclip({
      path: "/js/ZeroClipboard.swf",
      copy: function(){
      return $("#payhtml>a").attr('href');
    },
    beforeCopy:function(){/* 按住鼠标时的操作 */
      $(this).css("color","orange");
    },
    afterCopy:function(){/* 复制成功后的操作 */
      var $copysuc = $("<div class='copy-tips'><div class='copy-tips-wrap'>☺ 复制成功</div></div>");
      $("body").find(".copy-tips").remove().end().append($copysuc);
      $(".copy-tips").fadeOut(3000);
    }
  });
});
</script>