1
0
mirror of synced 2024-11-26 05:36:02 +03:00
mg-transport-telegram/templates/home.html
Alex Lushpai acb2a62da5
Initial release (#1)
Routes
Migrations
Settings form
Activation/deactivation through retailCRM/MG Transport API
2018-05-17 18:35:53 +03:00

66 lines
2.7 KiB
HTML

<html>
<head>
<meta title="Telegram transport">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-alpha.4/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-alpha.4/js/materialize.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
</head>
<body>
<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">
<button class="btn waves-effect waves-light red lighten-1" type="submit" name="action">Connect
<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 {
$('#msg').append(res.responseText);
}
}
});
}
</script>
</html>