More good work on editing account plan
This commit is contained in:
@@ -371,4 +371,12 @@
|
||||
<value>English (US)</value>
|
||||
<comment>Replace with THIS language, EXPRESSED IN this language. Examples: "Español", "Français", "Svenska", etc.</comment>
|
||||
</data>
|
||||
<data name="Global_No" xml:space="preserve">
|
||||
<value>No</value>
|
||||
<comment>For yes/no options</comment>
|
||||
</data>
|
||||
<data name="Global_Yes" xml:space="preserve">
|
||||
<value>Yes</value>
|
||||
<comment>For yes/no options</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,8 +1,10 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="AccountPlan.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Ledgers.AccountPlan" %>
|
||||
<%@ Register TagPrefix="Swarmops5" TagName="ExternalScripts" Src="~/Controls/v5/UI/ExternalScripts.ascx" %>
|
||||
<%@ Register TagPrefix="Swarmops5" TagName="ComboBudgets" Src="~/Controls/v5/Financial/ComboBudgets.ascx" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
|
||||
<Swarmops5:ExternalScripts ID="ExternalScripts1" Package="easyui" Control="tree" runat="server" />
|
||||
<script src="/Scripts/jquery.switchButton.js" language="javascript" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -34,7 +36,49 @@
|
||||
});
|
||||
|
||||
$(".IconEdit").click(function() {
|
||||
var accountId = $(this).attr("accountId");
|
||||
var accountType = accountId.substring(0,1); // A, D, I, C
|
||||
accountId = accountId.substring(1);
|
||||
|
||||
if (accountType == 'A') {
|
||||
$('#DivEditAssetLabels').show();
|
||||
$('#DivEditAssetControls').show();
|
||||
$('#DivEditProfitLossLabels').hide();
|
||||
$('#DivEditProfitLossControls').hide();
|
||||
} else if (accountType == 'D') {
|
||||
$('#DivEditAssetLabels').hide();
|
||||
$('#DivEditAssetControls').hide();
|
||||
$('#DivEditProfitLossLabels').hide();
|
||||
$('#DivEditProfitLossControls').hide();
|
||||
} else { // P&L account
|
||||
$('#DivEditAssetLabels').hide();
|
||||
$('#DivEditAssetControls').hide();
|
||||
$('#DivEditProfitLossLabels').show();
|
||||
$('#DivEditProfitLossControls').show();
|
||||
}
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
$('#divModalCover').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "AccountPlan.aspx/GetAccountData",
|
||||
data: "{'accountId': '" + escape(accountId) + "'}",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function (msg) {
|
||||
console.log(msg.d);
|
||||
|
||||
$('#CheckAccountActive').switchButton( {checked: msg.d.Open });
|
||||
$('#CheckAccountExpensable').switchButton( {checked: msg.d.Expensable });
|
||||
$('#CheckAccountAdministrative').switchButton( {checked: msg.d.Administrative });
|
||||
$('#TextAccountName').val(msg.d.AccountName);
|
||||
$('#TextAccountBudget').val(msg.d.Budget);
|
||||
|
||||
// TODO: Owner, parent account, automation
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
@@ -46,6 +90,15 @@
|
||||
$('#divModalCover').fadeOut();
|
||||
});
|
||||
|
||||
$('.EditCheck').switchButton(
|
||||
{
|
||||
height:16,
|
||||
width:30,
|
||||
button_width:16,
|
||||
on_label: "<% =Resources.Global.Global_Yes.ToUpperInvariant() %>",
|
||||
off_label: "<% =Resources.Global.Global_No.ToUpperInvariant() %>"
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function modalShow() {
|
||||
@@ -63,7 +116,14 @@
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
.checkboxSpacer {
|
||||
float: left;width: 100px;height: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/Style/v5-easyui-elements.css">
|
||||
<link rel="stylesheet" type="text/css" href="/Style/jquery.switchButton.css">
|
||||
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
|
||||
@@ -91,6 +151,32 @@
|
||||
<div class="box modal">
|
||||
<div class="content">
|
||||
<div style="float:right;margin-top: 2px;margin-right: -5px"><img id="IconCloseEdit" src="/Images/Icons/iconshock-cross-16px.png" /></div><h2>Editing account (Under Construction/Test)</h2>
|
||||
<div class="entryFields"><input type="text" id="TextAccountName" /> <br />
|
||||
<Swarmops5:ComboBudgets ID="DropBudgets" runat="server" /> <br/>
|
||||
<br/>
|
||||
<div id="DivEditProfitLossControls"><Swarmops5:ComboBudgets ID="DropOwner" runat="server" /> <br/>
|
||||
<input type="text" id="TextAccountBudget" style="text-align: right"/> <br/>
|
||||
<br/>
|
||||
<div class="checkboxSpacer"></div><input type="checkbox" class="EditCheck" id="CheckAccountActive"/>
|
||||
<div class="checkboxSpacer"></div><input type="checkbox" class="EditCheck" id="CheckAccountExpensable"/>
|
||||
<div class="checkboxSpacer"></div><input type="checkbox" class="EditCheck" id="CheckAccountAdministrative"/>
|
||||
<br/></div>
|
||||
<div id="DivEditAssetControls"><asp:DropDownList runat="server" ID="DropAccountUploadFormats"/> <br/>
|
||||
<input type="text" id="TextAutomationPaymentTag" readonly="readonly"/> <br/></div>
|
||||
</div>
|
||||
<div class="entryLabels">Account name<br/>
|
||||
Parent account or group<br/>
|
||||
<div id="DivEditProfitLossLabels"><h2>Daily operations</h2>
|
||||
Owner<br/>
|
||||
Budget (balance is SEK foo)<br/>
|
||||
<h2>Switches</h2>
|
||||
Active<br/>
|
||||
Expensable<br/>
|
||||
Administrative<br/></div>
|
||||
<div id="DivEditAssetLabels"><h2>Automation</h2>
|
||||
File upload profile<br/>
|
||||
<span id="SpanUploadParameterName">Upload parameter, if any</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Security;
|
||||
|
||||
namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
@@ -23,6 +25,48 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
this.InfoBoxLiteral = Resources.Pages.Ledgers.AccountPlan_Info;
|
||||
this.PageAccessRequired = new Access(this.CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Read);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public static JsonAccountData GetAccountData(int accountId)
|
||||
{
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
|
||||
FinancialAccount account = FinancialAccount.FromIdentity(accountId);
|
||||
|
||||
if (account.OrganizationId != authData.CurrentOrganization.Identity)
|
||||
{
|
||||
throw new UnauthorizedAccessException("A million nopes");
|
||||
}
|
||||
|
||||
JsonAccountData result = new JsonAccountData();
|
||||
|
||||
result.AccountName = account.Name;
|
||||
result.ParentAccountId = account.ParentIdentity;
|
||||
result.Expensable = account.Expensable;
|
||||
result.Administrative = false;
|
||||
result.Open = account.Open;
|
||||
result.AccountOwnerName = account.OwnerPersonId != 0 ? account.Owner.Name : Resources.Global.Global_NoOwner;
|
||||
result.AccountOwnerAvatarUrl = account.OwnerPersonId != 0
|
||||
? account.Owner.GetSecureAvatarLink(16)
|
||||
: "/Images/Icons/iconshock-warning-16x12px.png";
|
||||
result.Budget = (account.GetTree().GetBudgetSumCents(DateTime.Today.Year)/100L).ToString("N0");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public struct JsonAccountData
|
||||
{
|
||||
public string AccountName;
|
||||
public int ParentAccountId;
|
||||
public string ClosedYear;
|
||||
public bool Administrative;
|
||||
public bool Expensable;
|
||||
public bool Open;
|
||||
public string AccountOwnerName;
|
||||
public string Budget;
|
||||
public string AccountOwnerAvatarUrl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
grandChildren = ",\"state\":\"closed\",\"children\":[" + grandChildren + "]";
|
||||
}
|
||||
|
||||
string editString = "<img class=\\\"IconEdit\\\" src=\\\"/Images/Icons/iconshock-wrench-16px.png\\\" />";
|
||||
string editString = String.Format("<img class=\\\"IconEdit\\\" accountId=\\\"{0}{1}\\\" src=\\\"/Images/Icons/iconshock-wrench-16px.png\\\" />", accountType.ToString().Substring(0,1), account.Identity);
|
||||
|
||||
|
||||
childStrings.Add('{' + String.Format("\"id\":\"{0}\",\"accountName\":\"{1}\",\"owner\":\"{2}\",\"balance\":\"{3}\",\"budget\":\"{4}\",\"action\":\"{5}\"",
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Swarmops.Frontend.Pages.Security
|
||||
Localize();
|
||||
}
|
||||
|
||||
this.PageAccessRequired = new Access(AccessAspect.Bookkeeping, AccessType.Write); // bogus, but will prevent bad ppl from entering until real security done
|
||||
// this.PageAccessRequired = new Access(AccessAspect.Bookkeeping, AccessType.Write); // bogus, but will prevent bad ppl from entering until real security done
|
||||
|
||||
this.PageTitle = Resources.Pages.Security.ChangeOrganizations_PageTitle;
|
||||
this.PageIcon = "iconshock-organizations";
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
.switch-button-label {
|
||||
float: left;
|
||||
|
||||
font-size: 10pt;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.switch-button-label.off {
|
||||
color: #adadad;
|
||||
color: #9fbcff;
|
||||
}
|
||||
|
||||
.switch-button-label.on {
|
||||
@@ -17,14 +18,17 @@
|
||||
float: left;
|
||||
position: relative;
|
||||
|
||||
background: #ccc;
|
||||
border: 1px solid #aaa;
|
||||
background: #c6d7ff;
|
||||
background: linear-gradient(to right, #4F4, #4F4, #FAA, #FAA);
|
||||
border: 1px solid #a3bfff;
|
||||
box-shadow: #2d50a1 0px 1px 4px 0px inset;
|
||||
|
||||
margin: 1px 10px;
|
||||
margin: 1px 10px;
|
||||
margin-top: 12px;
|
||||
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -36,9 +40,10 @@
|
||||
top : -1px;
|
||||
|
||||
background: #FAFAFA;
|
||||
border: 1px solid #aaa;
|
||||
border: 1px solid #a3bfff;
|
||||
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
-webkit-border-radius: 45x;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
box-shadow: #c6d7ff 0px 0px 4px 0px inset;
|
||||
}
|
||||
|
||||
@@ -351,13 +351,15 @@ img
|
||||
.modal
|
||||
{
|
||||
position: absolute;
|
||||
top: 60px;
|
||||
height: 75%;
|
||||
width: 980px;
|
||||
height: 80%;
|
||||
width: 950px;
|
||||
box-shadow: black 0px 0px 30px 2px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 0 auto;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto auto;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user