1
0
Fork 0
tera/Source/HTML/history.html

217 lines
6.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>History account</title>
<link rel="shortcut icon" href="../HTML/PIC/viewer.png" type="image/png">
<link rel="stylesheet" type="text/css" href="../HTML/CSS/buttons.css">
<link rel="stylesheet" type="text/css" href="../HTML/CSS/style.css">
<link rel="stylesheet" type="text/css" href="../HTML/CSS/wallet.css">
<script>
window.RUN_CLIENT=1;
window.RUN_SERVER=0;
if(typeof global === 'object')
{
global.RUN_CLIENT=1;
global.RUN_SERVER=0;
}
</script>
<script type="text/javascript" src="../HTML/JS/coinlib.js"></script>
<script type="text/javascript" src="../HTML/JS/client.js"></script>
<script>
var AccountID;
var CountViewRows=20;
window.onload=function()
{
if(localStorage["MainServer"] && !localStorage["BIGWALLET"])
{
MainServer=JSON.parse(localStorage["MainServer"]);
}
document.body.className="univers "+localStorage["idSelStyle"];
var i=document.URL.indexOf("#");
if(i>0)
{
AccountID=ParseNum(document.URL.substr(i+1));
document.getElementById("idViewAccountID").value=AccountID;
ViewHistory(1);
}
window.onkeydown = function (e)
{
if(e.keyCode===27)
{
window.close();
}
};
}
var CurPage=0;
var ArrPos=[];
function ViewHistory(bReset,NextPos)
{
var Params={AccountID:AccountID,Count:CountViewRows,GetDescription:1}
if(bReset)
{
CurPage=0;
ArrPos=[];
AccountID=ParseNum(document.getElementById("idViewAccountID").value);
}
else
{
Params.NextPos=NextPos;
}
//console.log(CurPage);
//console.log(JSON.stringify(Params));
document.title="Account: "+AccountID;
GetData("GetHistoryTransactions", Params, function (Data)
{
if(!Data || !Data.result)
return;
$("idName").innerText=Data.Name;
$("idBalanceSum").innerText="Balance: "+STRING_FROM_COIN(Data.Value)+" "+CurrencyName(Data.Currency);
MaxBlockNum=Data.MaxBlockNum;
window.FIRST_TIME_BLOCK=Data.FIRST_TIME_BLOCK;
var Item;
var arr=Data.History;
for(var i=0;i<arr.length;i++)
{
Item=arr[i];
Item.Num=Item.Pos;
Item.Currency=Data.Currency;
Item.Value={SumCOIN:Item.SumCOIN,SumCENT:Item.SumCENT};
}
if(Item)
{
ArrPos[CurPage]={First:arr[0].Pos,NextPos:Item.NextPos};
}
//console.log(JSON.stringify(ArrPos));
SetGridData(Data.History,"grid_history","idTotalSumH",1);
});
}
function ViewBegin()
{
CurPage=0;
var Item=ArrPos[CurPage];
if(Item)
{
ViewHistory(0,Item.First);
}
}
function ViewPrev()
{
if(CurPage<=0)
return;
CurPage--;
var Item=ArrPos[CurPage];
if(Item)
{
ViewHistory(0,Item.First);
}
}
function ViewNext()
{
var Item=ArrPos[CurPage];
if(Item && Item.NextPos)
{
CurPage++;
ViewHistory(0,Item.NextPos);
}
}
function SaveValues()
{
}
var MaxBlockNum=0;
function ConfirmationFromBlock(BlockNum)
{
var Length=MaxBlockNum-8-BlockNum;
if(Length>0)
{
if(Length<=100)
return Length;
else
{
return ">"+Math.floor(Length/100)*100;
}
}
else
return "";
}
function GetCorrID(Item,Direct)
{
var Str;
if(Item.Direct===Direct)
Str=RetHistoryAccount({Num:Item.CorrID});
else
Str=AccountID;
return Str;
}
function GetStr(Str)
{
if(Str===undefined)
return "";
return Str;
}
</script>
</head>
<body>
<DIV align='center'>
<DIV id="idTransactionBlock" style="display: block">
<BR>
<DIV class="header_tr" >History of account: <INPUT type="number" id="idViewAccountID" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewHistory(1)"> </DIV>
<DIV id="idName"></DIV>
<B><DIV id="idBalanceSum"></DIV></B>
<!--<BR>-->
<INPUT type="button" onclick="ViewBegin()" class="btdoitm bt" value="|<-">
<INPUT type="button" onclick="ViewPrev()" class="btdoit bt" value="<< Prev">
<INPUT type="button" onclick="ViewNext()" class="btdoit bt" value="Next >>">
<!--<h5>Last Tx on top</h5>-->
<table id="grid_history" class="grid">
<tr>
<th id="(RetDirect(Item.Direct))" class="direct">Direct</th>
<th id="(GetCorrID(Item,'+'))" class="num">From</th>
<th id="(GetCorrID(Item,'-'))" class="num">To</th>
<th id="(escapeHtml(DateFromBlock(Item.BlockNum,1)))" class="date">Date</th>
<th id="SUM_TO_STRING(Item)" class="sum smallbold">Amount</th>
<th id="CurrencyName(Item.Currency)" class="cur">Cur</th>
<th id="GetStr(Item.Description)" class="desc">Description</th>
<th id="ConfirmationFromBlock(Item.BlockNum)" class="num">Confirm</th>
<th id="(RetOpenBlock(Item.BlockNum,1))" class="num">Block</th>
<th id="Item.TrNum" class="num">Tx</th>
</tr>
</table>
<B><DIV id="idTotalSumH"></DIV></B>
<INPUT type="button" onclick="ViewPrev()" class="btdoit bt" value="<< Prev">
<INPUT type="button" onclick="ViewNext()" class="btdoit bt" value="Next >>">
</DIV>
</DIV>
<DIV id="idStableScroll">
@terafoundation
<!--progr76@gmail.com-->
</DIV>
</body>
</html>