Commit 03942d7d authored by Alina Habibulina's avatar Alina Habibulina

+save and bubbles v1

parent 55b90248
......@@ -9,6 +9,7 @@
border-style: none solid solid;
border-width: 1px;
top: 150px;
z-index: 1;
}
.header{
......@@ -56,3 +57,60 @@
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: 10000;
}
......@@ -19,5 +19,16 @@
<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>
</body>
</html>
\ No newline at end of file
......@@ -3,30 +3,15 @@
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 +59,117 @@ function CreateAuthForm(){
authFunc();
};
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();
alert("Ошибка во время создания документа..");
return;
} else {
AS.SERVICES.hideWaitWindow();
alert("Документ успешно создан!");
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();
alert("Введите все обязательные поля");
return;
}
var data = portal.player.model.asfDataId;
portal.player.saveFormData(function(data){
if(_.isUndefined(data)){
AS.SERVICES.hideWaitWindow();
alert("Во время сохранения данных возникла ошибка");
} else {
AS.SERVICES.hideWaitWindow();
alert("Данные сохранены");
}
});
}
};
//переменные для 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 +177,12 @@ AS.SERVICES.unAuthorized = function()
$(document).ready(function(){
CreateAuthForm();
$(".error").hide();
});
\ No newline at end of file
$(".saveBtn").hide();
$(".container").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