offer.ejs 3.9 KB
<!DOCTYPE html>
<html>
  <head>
    <title> 企飞</title>
    <meta http-equiv="X-UA-Compatible" content="IE=10"> 
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,minimal-ui">
    <link rel="stylesheet" type="text/css" href="/css/core.css" /> 
  	<style>
		.container{ 
      margin: 50px auto;
      width:90%;
			border:1px solid #eee;
			border-radius:6px;
		}
		.container>div{
			margin:0px;
		}
		.row>div{
			padding:0px;
		}
		#content{ 
			font-size: 14px;
			color:#999;
			padding: 20px 30px 20px 30px;
			border-bottom: 1px solid #eee;
		}
		#content span{
			color:#333;
		}
		#buttonGroup{
			padding:30px 0px;
      text-align: center;
		}
		#buttonGroup a{
			width:80%;
			height:50px;
	    line-height: 35px;
      font-size: 20px;
		}
  	</style> 
    <script type="text/javascript" src="/js/zepto.min.js"></script> 
  </head>
  <body> 
  	<div class="container" style="padding:0px;">
  		<div class="row" id="content">
  			<div class="col-xs-12 col-sm-12 col-md-2 col-lg-2"><img src=""></div>
  			<div class="col-xs-12 col-sm-12 col-md-10 col-lg-10">
  				<div class="row">
  					<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="line-height:25px;"> 
              <%- content %>
  					</div>
  				</div>
  			</div>
  		</div>
  		<div class="row" id="buttonGroup"> 
        <% if (status!='rejected'&& status!='accepted') { %>  
  			<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
  				<a id="rejectBtn" class="btn btn-danger">拒绝Offer</a>
  			</div>
  			<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
  				<a id="acceptBtn" class="btn btn-success">接受Offer</a>
  			</div> 
        <% } %> 
        <% if (status=='rejected') { %>  
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
          <a style="width:60%" type="button" disabled="disabled" class="btn btn-danger">
  					已拒绝Offer
  				</a>
  			</div>  
        <% } %> 
        <% if (status=='accepted') { %>   
  			<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
  				<a style="width:60%" type="button" disabled="disabled" class="btn btn-success">
  					已接受Offer
  				</a>
  			</div> 
        <% } %> 
  		</div>
  	</div>
     <script>  
        (function($){  
            var rejectedUrl='<%= reject_url %>';
            var acceptUrl='<%= accept_url %>';
            var offerId='<%= offerId %>';
            var tenantId='<%= tenantId %>'
            function sendRejectOffer(){
              $.ajax({
                 type: "POST",
                 url: "/hr/sendRejectOffer",
                 contentType: 'application/json',
                 data: JSON.stringify({"url":rejectedUrl}),
                 success: function(msg){
                   console.log(msg);
                   if(msg&&msg.action=='ok'){
                      document.location.href='/offer/'+offerId+'?tenant_id='+tenantId;
                   }
                 }
              });
            }
            function sendAcceptOffer(){
              $.ajax({
                  type: "POST",
                  url: "/hr/acceptOffer",
                  contentType: 'application/json',
                  data: JSON.stringify({"url":acceptUrl}),
                  success: function(msg){
                    console.log(msg);
                    if(msg&&msg.action=='ok'){
                      document.location.href='/offer/'+offerId+'?tenant_id='+tenantId;
                    }
                  }
              });
            }
            $('#rejectBtn').bind("touchstart",function(event){ 
              sendRejectOffer();
            });  
            $('#acceptBtn').bind("touchstart",function(event){ 
              sendAcceptOffer();
            });  
            $('#rejectBtn').bind("click",function(){
                sendRejectOffer();  
            });
            $('#acceptBtn').bind("click",function(){ 
                sendAcceptOffer(); 
            });
          })(Zepto);   
      </script>
  </body>
</html>