[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[5934] trunk
- Subject: SF.net SVN: ledger-smb:[5934] trunk
- From: ..hidden..
- Date: Sat, 3 Aug 2013 16:11:37 +0000
Revision: 5934
http://sourceforge.net/p/ledger-smb/code/5934
Author: freelock
Date: 2013-08-03 16:11:36 +0000 (Sat, 03 Aug 2013)
Log Message:
-----------
Add dojo support for account selectors and date text box on GL -> Journal entry screen
Modified Paths:
--------------
trunk/LedgerSMB/Scripts/journal.pm
trunk/UI/journal/journal_entry.html
Added Paths:
-----------
trunk/UI/accounts/AccountSelector.js
trunk/UI/accounts/AccountStore.js
trunk/UI/accounts/init.js
Modified: trunk/LedgerSMB/Scripts/journal.pm
===================================================================
--- trunk/LedgerSMB/Scripts/journal.pm 2013-08-03 16:11:27 UTC (rev 5933)
+++ trunk/LedgerSMB/Scripts/journal.pm 2013-08-03 16:11:36 UTC (rev 5934)
@@ -22,6 +22,8 @@
use LedgerSMB::Business_Unit;
use LedgerSMB::Report::GL;
use LedgerSMB::Report::COA;
+use LedgerSMB::REST_Format::json;
+use CGI::Simple;
use strict;
=pod
@@ -59,6 +61,23 @@
$template->render($request);
}
+=item chart_json
+
+Returns a json array of all accounts
+
+=cut
+
+sub chart_json {
+ my ($request) = @_;
+ my $funcname = 'chart_list_all';
+ my @results = $request->call_procedure( procname => $funcname, order_by => 'accno' );
+
+ my $json = LedgerSMB::REST_Format::json->to_output(..hidden..);
+ my $cgi = CGI::Simple->new();
+ print $cgi->header('application/json', '200 Success');
+ $cgi->put($json);
+}
+
=item chart_of_accounts
Returns and displays the chart of accounts
Added: trunk/UI/accounts/AccountSelector.js
===================================================================
--- trunk/UI/accounts/AccountSelector.js (rev 0)
+++ trunk/UI/accounts/AccountSelector.js 2013-08-03 16:11:36 UTC (rev 5934)
@@ -0,0 +1,21 @@
+define([
+ 'dijit/form/FilteringSelect',
+ 'dojo/_base/declare',
+ 'lsmb/accounts/AccountStore'
+ ], function(
+ Select,
+ declare,
+ store
+ ){
+ var mySelect = new declare('lsmb/accounts/AccountSelector',[Select],{
+ store: store,
+ queryExpr: "*${0}*",
+ style: 'width: 300px',
+ query: {'charttype': 'A'},
+ highlightMatch: 'all',
+ searchAttr: 'text',
+ autoComplete: false
+
+ });
+ return mySelect;
+ });
Added: trunk/UI/accounts/AccountStore.js
===================================================================
--- trunk/UI/accounts/AccountStore.js (rev 0)
+++ trunk/UI/accounts/AccountStore.js 2013-08-03 16:11:36 UTC (rev 5934)
@@ -0,0 +1,28 @@
+define([
+ 'dojo/store/Memory',
+ 'dojo/store/Observable',
+ 'dojo/request',
+ 'dojo/_base/array'
+ ], function(
+ Memory,
+ Observable,
+ request,
+ array
+ ){
+ var store = new Observable(new Memory({
+ idProperty: 'text'
+ }));
+
+ request.get('journal.pl?action=chart_json',{
+ handleAs: 'json'
+ }).then(
+ function (results) {
+ array.forEach(results, function(item){
+ item.text = item.accno + '--' + item.description;
+ store.put(item);
+ });
+ },
+ console.log
+ );
+ return store;
+});
Added: trunk/UI/accounts/init.js
===================================================================
--- trunk/UI/accounts/init.js (rev 0)
+++ trunk/UI/accounts/init.js 2013-08-03 16:11:36 UTC (rev 5934)
@@ -0,0 +1,9 @@
+define(['dojo/parser','lsmb/accounts/AccountSelector','dijit/form/DateTextBox'],
+ function(parser){
+ return {
+ init: function() {
+ parser.parse();
+ }
+ }
+ }
+);
Modified: trunk/UI/journal/journal_entry.html
===================================================================
--- trunk/UI/journal/journal_entry.html 2013-08-03 16:11:27 UTC (rev 5933)
+++ trunk/UI/journal/journal_entry.html 2013-08-03 16:11:36 UTC (rev 5934)
@@ -1,12 +1,15 @@
<?lsmb INCLUDE 'ui-header.html'
- include_script = [
- "UI/ajax/scriptaculous/lib/prototype.js",
- "UI/ajax/scriptaculous/src/scriptaculous.js?load=builder,effects,dragdrop,controls",
- "UI/ajax/helpers.js"]
+ include_dojo = [
+ 'lsmb/accounts/init'
+ ]
+ include_stylesheet = [
+ 'UI/lib/dojo/dijit/themes/claro/claro.css',
+ 'UI/lib/dojo/dojo/resources/dojo.css'
+ ]
stylesheet=form.stylesheet ?>
<?lsmb PROCESS elements.html ?>
-<body>
+<body class="claro">
<?lsmb INCLUDE OPEN_STATUS_DIV
id=form.id approved = form.approved action=form.action ?>
@@ -38,6 +41,7 @@
name = "transdate"
value = form.transdate
type = "text"
+ dojo_type = 'dijit/form/DateTextBox'
size = "11"
class = 'date'
id = "tra_1"
@@ -143,12 +147,15 @@
<?lsmb INDEX=displayrow.index ?>
<td>
<?lsmb IF displayrow.accnoset == 0 ?>
- <?lsmb PROCESS ajaxselect element_data = {
+ <?lsmb PROCESS input element_data = {
name = "accno_$INDEX"
+ type = "text"
initial_value = ${"accno_$INDEX"}
+ value = ${"accno_$INDEX"}
text_attr = 'accno'
value_attr = 'id'
- ajax_target = 'journal.pl'
+ class = 'AccountBox'
+ dojo_type = 'lsmb/accounts/AccountSelector'
} ?>
<?lsmb ELSE ?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.