Commit fa2d3497 authored by Valentin Skripnikov's avatar Valentin Skripnikov

Merge branch 'a.habibulina-dev' into 'a.habibulina'

+save and bubbles v1

See merge request !37
parents fa5b129b 2aaa9b5a
......@@ -9,6 +9,7 @@
border-style: none solid solid;
border-width: 1px;
top: 150px;
z-index: 1;
}
.header{
......@@ -56,3 +57,80 @@
border-color: #49b785;
color: #ffffff;
}
.saveBtn{
margin-top: 15px;
width: 100px;
position: relative;
height: 35px;
border-radius: 5px;
background-color: #49b785;
border-color: #49b785;
color: #ffffff;
}
.container{
position: absolute;
top: -160px;
left: 520px;
z-index: 10000;
}
#main-circle{
width: 90px;
height: 90px;
border-radius: 50%;
background: transparent;
position: relative;
top: 50px;
z-index: 10000;
}
.circle1{
width: 20px;
height: 20px;
border-radius: 50%;
background: #49b785;
position: absolute;
display: block;
z-index: 10000;
}
.circle2{
width: 15px;
height: 15px;
border-radius: 50%;
background: #49b785;
position: absolute;
z-index: 10000;
}
.circle3{
width: 25px;
height: 25px;
border-radius: 50%;
background: #49b785;
position: absolute;
z-index: 1000;
}
#rectangle{
width: 300px;
height: 50px;
position: absolute;
top: 30px;
left: 530px;
z-index: 10;
background: #F0FFFF;
border-style: solid solid solid solid;
border-radius: 10px;
border-width: 4px;
border-color: #B0C4DE;
}
#msg{
font-family: "Сomic Sans MS";
font-size: 16px;
position: relative;
top: 34%;
}
......@@ -19,5 +19,22 @@
<div id ="form_player_div" ></div>
</div>
<div id ="authForm"></div>
<button class ="saveBtn">Сохранить</button>
<!--WaitFunc-->
<div class="container" align="center">
<div class="col-xs-12" align="center">
<div id="main-circle" align="center">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
</div>
</div>
</div>
<!--MsgRect-->
<div class="MsgRect">
<div id="rectangle">
<div class="msg" id="msg" align="center"></>
</div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -3,30 +3,14 @@
AS.OPTIONS.locale = "ru";
AS.OPTIONS.coreUrl = "http://intern-dev.arta.kz/Synergy/";
var portal = {
player : null,
clearPlayer : function() {
if(portal.player) {
portal.player.destroy();
}
},
createPlayer : function(dataId){
portal.clearPlayer();
portal.player = AS.FORMS.createPlayer();
portal.player.view.setEditable(_.isUndefined(dataId));
portal.player.showFormData("097a00e2-430c-436d-92e5-c2ea8edc5b30", 1, dataId);
portal.player.view.appendTo($('#form_player_div'));
}
};
function CreateAuthForm(){
$(".saveBtn").hide();
var forma = document.createElement("form");
forma.className = "login-form";
forma.setAttribute('id',"login-form");
forma.setAttribute('id',"login-form");
forma.setAttribute('align',"center");
var authHeader = document.createTextNode('Введите логин и пароль');
......@@ -74,18 +58,128 @@ function CreateAuthForm(){
authFunc();
};
function ShowMessage(message){
if(message.length > 30){
$(".msg").css({'top': '20%'})
} else $(".msg").css({'top': '34%'})
$(".MsgRect").show();
document.getElementById("msg").innerHTML = message;
setTimeout(function(){
$(".MsgRect").hide();
}, 3000);
};
var portal = {
player : null,
clearPlayer : function() {
if(portal.player) {
portal.player.destroy();
}
},
createPlayer : function(){
portal.clearPlayer();
portal.player = AS.FORMS.createPlayer();
AS.FORMS.ApiUtils.simpleAsyncGet('rest/api/registry/create_doc?registryCode=registry_timesheets', function(result){
if(result.errorCode != "0") {
AS.SERVICES.hideWaitWindow();
ShowMessage("Ошибка во время создания документа..");
return;
} else {
AS.SERVICES.hideWaitWindow();
ShowMessage("Документ успешно создан!");
portal.player.view.setEditable(true);
portal.player.showFormData(result.documentID, 0, result.dataUUID);
portal.player.view.appendTo($('#form_player_div'));
}}, 'json');
},
saveData : function(){
var errors = portal.player.model.getErrors();
if(errors.length > 0) {
AS.SERVICES.hideWaitWindow();
ShowMessage("Введите все обязательные поля");
return;
}
var data = portal.player.model.asfDataId;
portal.player.saveFormData(function(data){
if(_.isUndefined(data)){
AS.SERVICES.hideWaitWindow();
ShowMessage("Во время сохранения данных возникла ошибка");
} else {
AS.SERVICES.hideWaitWindow();
ShowMessage("Данные сохранены");
}
});
}
};
//переменные для WaitCircles();
var currentTime = Date.now(),
r = 40,
left = '',
Top = '',
alpha = 2 * 3.14;
function WaitCircles(num){
var count = num;
var t;
let startTime = setInterval(function(count){
switch(num){
case '1':
t = Date.now() - currentTime;
left = 150 + r*Math.cos(alpha*t);
Top = 350 + r*Math.sin(-alpha*t);
$('.circle1').css({'left': left, 'top': Top});
break;
case '2':
t = Date.now() - currentTime + 500;
left = 150 + r*Math.cos(alpha*t);
Top = 350 + r*Math.sin(-alpha*t);
$('.circle2').css({'left': left, 'top': Top});
break;
case '3':
t = Date.now() - currentTime + 1200;
left = 150 + r*Math.cos(alpha*t);
Top = 350 + r*Math.sin(-alpha*t);
$('.circle3').css({'left': left, 'top': Top});
break;
case 'stop':
clearInterval(startTime);
break;
}
}, 1);
};
AS.SERVICES.showWaitWindow = function(){
WaitCircles('1');
WaitCircles('2');
WaitCircles('3');
$(".container").show();
};
AS.SERVICES.hideWaitWindow = function(){
WaitCircles('stop');
$(".container").hide();
};
var authFunc = function(){
jQuery(".submit").on( "click", function(event){
AS.SERVICES.showWaitWindow();
AS.OPTIONS.login = $("input#login").val();
AS.OPTIONS.password = $("input#password").val();
portal.createPlayer();
$(".form_player_container").show();
$(".login-form").remove();
portal.createPlayer();
$(".form_player_container").show();
$(".login-form").remove();
$(".saveBtn").show();
});
};
AS.SERVICES.unAuthorized = function()
{
$(".container").hide();
$(".login-form").remove();
CreateAuthForm();
};
......@@ -93,4 +187,13 @@ AS.SERVICES.unAuthorized = function()
$(document).ready(function(){
CreateAuthForm();
$(".error").hide();
});
\ No newline at end of file
$(".saveBtn").hide();
$(".container").hide();
$(".MsgRect").hide();
$(".saveBtn").on("click", function(event){
AS.SERVICES.showWaitWindow();
portal.saveData();
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment