2018-05-18 18:11:09 +03:00
|
|
|
{{template "header"}}
|
2018-05-17 18:35:53 +03:00
|
|
|
<div class="container">
|
|
|
|
<div class="row" style="margin-top: 5%">
|
|
|
|
<form class="col s8 offset-s2" method="POST" id="save-crm" action="/create/">
|
|
|
|
<p id="msg"></p>
|
|
|
|
<div class="row">
|
|
|
|
<div class="input-field col s12">
|
|
|
|
<input placeholder="API Url" id="api_url" name="api_url" type="text" class="validate">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="input-field col s12">
|
|
|
|
<input placeholder="API Key" id="api_key" name="api_key" type="text" class="validate">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="input-field col s6 offset-s5">
|
2018-05-18 18:11:09 +03:00
|
|
|
<button class="btn waves-effect waves-light red lighten-1" type="submit" name="action">
|
|
|
|
{{.Locale.ButConnect}}
|
2018-05-17 18:35:53 +03:00
|
|
|
<i class="material-icons right">sync</i>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
$('#save-crm').on("submit", function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
send($(this).attr('action'), $(this).serialize())
|
|
|
|
});
|
|
|
|
|
|
|
|
function send(url, data) {
|
|
|
|
$.ajax({
|
|
|
|
url: url,
|
|
|
|
data: data,
|
|
|
|
success: function(res){
|
|
|
|
console.log(res);
|
|
|
|
},
|
|
|
|
error: function (res){
|
|
|
|
if (res.status < 400) {
|
|
|
|
if (res.responseText) {
|
|
|
|
document.location.replace(
|
|
|
|
location.protocol.concat("//").concat(window.location.host) + res.responseText
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} else {
|
2018-05-18 18:11:09 +03:00
|
|
|
$('#msg').text(res.responseText);
|
2018-05-17 18:35:53 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</html>
|
|
|
|
|