Committing more work to account plan
This commit is contained in:
@@ -91,7 +91,7 @@ namespace Swarmops.Logic.Swarm
|
||||
return null; // If no valid search string was supplied
|
||||
}
|
||||
|
||||
public static People FromBirtDatePattern (DateTime fromdate, DateTime todate)
|
||||
public static People FromBirthDatePattern (DateTime fromdate, DateTime todate)
|
||||
{
|
||||
return People.FromArray(SwarmDb.GetDatabaseForReading().GetPeopleFromBirthdate(fromdate, todate));
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-ExpensableBudgetsTree.aspx.cs" Inherits="Swarmops.Frontend.Pages.v5.Financial.Json_ExpensableBudgetsTree" %>
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-ExpensableBudgetsTree.aspx.cs" Inherits="Swarmops.Frontend.Automation.Json_ExpensableBudgetsTree" %>
|
||||
@@ -10,7 +10,7 @@ using Swarmops.Logic.Swarm;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
|
||||
namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
namespace Swarmops.Frontend.Automation
|
||||
{
|
||||
public partial class Json_ExpensableBudgetsTree : DataV5Base
|
||||
{
|
||||
|
||||
@@ -55,7 +55,10 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
treeMap[account.ParentIdentity].Add(account);
|
||||
}
|
||||
|
||||
accountsJson = RecurseTreeMap(treeMap, 0);
|
||||
if (treeMap.ContainsKey(0))
|
||||
{
|
||||
accountsJson = RecurseTreeMap(treeMap, 0);
|
||||
}
|
||||
|
||||
accountsJson = "[{\"id\":\"0\",\"text\":\"" +
|
||||
JsonSanitize(Resources.Global.ResourceManager.GetString("Financial_" + accountType.ToString())) +
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-GetPersonAvatar.aspx.cs" Inherits="Swarmops.Frontend.Automation.Json_GetPersonAvatar" %>
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Swarm;
|
||||
|
||||
namespace Swarmops.Frontend.Automation
|
||||
{
|
||||
public partial class Json_GetPersonAvatar : DataV5Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
Response.ContentType = "application/json";
|
||||
|
||||
string personId = Request.QueryString["personId"];
|
||||
string onePerson = string.Empty;
|
||||
|
||||
People matches = People.FromSingle(Person.FromIdentity(Int32.Parse(personId)));
|
||||
|
||||
matches = Authorization.FilterPeopleToMatchAuthority(matches, CurrentUser.GetAuthority());
|
||||
|
||||
if (matches.Count == 1) // still allowed
|
||||
{
|
||||
onePerson = '{' + String.Format("\"id\":\"{0}\",\"name\":\"{1}\",\"avatar16Url\":\"{2}\",\"avatar24Url\":\"{3}\"", matches[0].Identity, JsonSanitize(matches[0].Canonical), matches[0].GetSecureAvatarLink(16), matches[0].GetSecureAvatarLink(24)) + '}';
|
||||
}
|
||||
|
||||
Response.Output.WriteLine(onePerson);
|
||||
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Json-SearchPeoplePattern.aspx.cs" Inherits="Swarmops.Frontend.Automation.Json_SearchPeoplePattern" %>
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Swarm;
|
||||
|
||||
namespace Swarmops.Frontend.Automation
|
||||
{
|
||||
public partial class Json_SearchPeoplePattern : DataV5Base
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
Response.ContentType = "application/json";
|
||||
|
||||
string pattern = Request.QueryString["namePattern"];
|
||||
|
||||
People matches = People.FromNamePattern(pattern);
|
||||
|
||||
matches = Authorization.FilterPeopleToMatchAuthority(matches, CurrentUser.GetAuthority());
|
||||
|
||||
if (matches.Count > 20)
|
||||
{
|
||||
matches.RemoveRange(20, matches.Count - 20);
|
||||
}
|
||||
|
||||
List<string> jsonPeople = new List<string>();
|
||||
|
||||
foreach (Person person in matches)
|
||||
{
|
||||
string onePerson = '{' + String.Format("\"id\":\"{0}\",\"name\":\"{1}\",\"avatar16Url\":\"{2}\"", person.Identity, JsonSanitize(person.Canonical), person.GetSecureAvatarLink(16)) + '}';
|
||||
jsonPeople.Add(onePerson);
|
||||
}
|
||||
|
||||
string result = '[' + String.Join(",", jsonPeople.ToArray()) + ']';
|
||||
|
||||
Response.Output.WriteLine(result);
|
||||
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,28 +4,48 @@
|
||||
$(document).ready(function () {
|
||||
$('#<%=this.ClientID %>_DropPeople').combobox({
|
||||
animate: true,
|
||||
height: 30
|
||||
height: 30,
|
||||
loader: autoCompleteLoader,
|
||||
mode: 'remote',
|
||||
valueField: 'id',
|
||||
textField: 'name',
|
||||
formatter: formatItem,
|
||||
|
||||
onSelect: function (person) {
|
||||
// update avatar when person selected
|
||||
|
||||
$.ajax({
|
||||
url: '/Automation/Json-GetPersonAvatar.aspx',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
personId: person.id
|
||||
},
|
||||
success: function(data){
|
||||
$('span#<%= this.ClientID %>_SpanPeople span input.combo-text').css('background-image', "url('" + data.avatar24Url + "')");
|
||||
|
||||
},
|
||||
error: function(){
|
||||
error.apply(this, arguments);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
<% if (this.Selected != null)
|
||||
{ %>
|
||||
|
||||
$('span#<%= this.ClientID %>_SpanPeople span input.combo-text').css('background', "url('<%= this.Selected.GetSecureAvatarLink(24) %>')");
|
||||
{ %>;
|
||||
$('span#<%= this.ClientID %>_SpanPeople span input.combo-text').css('background-image', "url('<%= this.Selected.GetSecureAvatarLink(24) %>')");
|
||||
$('span#<%= this.ClientID %>_SpanPeople span input.combo-text').text('<%= this.Selected.Canonical %>');
|
||||
|
||||
<% }
|
||||
else if (this.NobodySelected)
|
||||
{ %>
|
||||
|
||||
$('span#<%= this.ClientID %>_SpanPeople span input.combo-text').css('background', "url('/Images/Icons/iconshock-warning-24px.png')");
|
||||
{ %>;
|
||||
$('span#<%= this.ClientID %>_SpanPeople span input.combo-text').css('background-image', "url('/Images/Icons/iconshock-warning-24px.png')");
|
||||
$('span#<%= this.ClientID %>_SpanPeople span input.combo-text').text('<%= Resources.Global.Global_NoOwner %>');
|
||||
|
||||
<% } else { %>
|
||||
|
||||
<% } else { %>;
|
||||
$('span#<%= this.ClientID %>_SpanPeople span input.combo-text').css('background', '');
|
||||
|
||||
<% } %>
|
||||
|
||||
<% } %>;
|
||||
$('#<%=this.ClientID %>_SpanPeople span.combo input.combo-text').keydown(function (e) {
|
||||
switch (e.which) {
|
||||
case 40: // down
|
||||
@@ -37,6 +57,35 @@
|
||||
e.preventDefault(); // prevent the default action (scroll / move caret)
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
var autoCompleteLoader = function(param,success,error){
|
||||
var q = param.q || '';
|
||||
if (q.length <= 3) {
|
||||
return false;
|
||||
}
|
||||
$.ajax({
|
||||
url: '/Automation/Json-SearchPeoplePattern.aspx',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
maxRows: 20,
|
||||
namePattern: q
|
||||
},
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
success(data);
|
||||
},
|
||||
error: function(){
|
||||
error.apply(this, arguments);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
function formatItem(row)
|
||||
{
|
||||
var s = '<span style="padding-left:20px;margin-left:4px;' + "background-image:url('" + row.avatar16Url + "');" + 'background-position:left center;background-repeat:no-repeat">' + row.name + '</span>';
|
||||
return s;
|
||||
}
|
||||
</script>
|
||||
|
||||
<span id="<%=this.ClientID %>_SpanPeople"><select class="easyui-combobox comboperson" url="/Automation/Json-ExpensableBudgetsTree.aspx" name="DropPeople" id="<%=this.ClientID %>_DropPeople" animate="true" style="width:300px"></select></span>
|
||||
<span id="<%=this.ClientID %>_SpanPeople"><select class="easyui-combobox comboperson" url="" name="DropPeople" id="<%=this.ClientID %>_DropPeople" animate="true" style="width:300px"></select></span>
|
||||
@@ -69,6 +69,7 @@
|
||||
}
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
$('body').css('overflow-y', 'hidden');
|
||||
$('#divModalCover').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
@@ -78,8 +79,6 @@
|
||||
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 });
|
||||
@@ -175,7 +174,7 @@
|
||||
<div id="divModalCover" class="modalcover">
|
||||
<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 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; Does not save)</h2>
|
||||
<div class="entryFields"><input type="text" id="TextAccountName" /> <br />
|
||||
<Swarmops5:ComboBudgets ID="DropParents" runat="server" /> <br/>
|
||||
<br/>
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
this.PageIcon = "iconshock-openbook";
|
||||
this.PageTitle = Resources.Pages.Ledgers.AccountPlan_PageTitle;
|
||||
this.InfoBoxLiteral = Resources.Pages.Ledgers.AccountPlan_Info;
|
||||
this.PageAccessRequired = new Access(this.CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Read);
|
||||
this.PageAccessRequired = new Access(this.CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Write);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
|
||||
account.AccountType.ToString())
|
||||
: account.Parent.Name;
|
||||
result.Expensable = account.Expensable;
|
||||
result.Administrative = false;
|
||||
result.Open = account.Administrative;
|
||||
result.Administrative = account.Administrative;
|
||||
result.Open = account.Open;
|
||||
result.AccountOwnerName = account.OwnerPersonId != 0 ? account.Owner.Name : Resources.Global.Global_NoOwner;
|
||||
result.AccountOwnerAvatarUrl = account.OwnerPersonId != 0
|
||||
? account.Owner.GetSecureAvatarLink(24)
|
||||
|
||||
@@ -37,15 +37,7 @@
|
||||
opacity:0.7;
|
||||
filter:alpha(opacity=70);
|
||||
}
|
||||
.combo-panel{
|
||||
background: transparent;
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
|
||||
/* TREE */
|
||||
|
||||
.tree
|
||||
.combo-panel
|
||||
{
|
||||
font-size: 14px;
|
||||
margin: 0px 0px 0px 5px;
|
||||
@@ -54,6 +46,19 @@
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0px 1px 4px 1px #1C397E inset;
|
||||
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
div.combobox-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
/* TREE */
|
||||
|
||||
.tree
|
||||
{
|
||||
}
|
||||
|
||||
.tree-node-hover{
|
||||
|
||||
Reference in New Issue
Block a user