Auth worked into Angular services.
Removed the templates of the nav bar and integrated into the base page Removed helper module Fixed auth model for wrong username. Updated to anuglar 1.0.2 Closing stock with resolve. Login with controller
This commit is contained in:
1 parent
27c97cbf88
commit
71c30ca04c
39 files changed
+426
-1732
No files matched your search
@@ -120,6 +120,8 @@ def main(global_config, **settings):
|
||||
config.add_route('profit_loss', '/ProfitLoss')
|
||||
config.add_route('purchase_entries', '/PurchaseEntries')
|
||||
|
||||
config.add_route('auth', '/Auth')
|
||||
|
||||
config.add_route('services_session_current_date', '/Services/CurrentDate')
|
||||
config.add_route('services_session_period_start', '/Services/PeriodStart')
|
||||
config.add_route('services_session_period_finish', '/Services/PeriodFinish')
|
||||
@@ -137,7 +139,6 @@ def main(global_config, **settings):
|
||||
config.add_route('services_product_add_inventory', '/Services/AddInventory')
|
||||
config.add_route('services_batch_list', '/Services/Batches')
|
||||
|
||||
config.add_route('user_permissions', '/Permissions')
|
||||
config.add_route('account_type_list', '/AccountTypes')
|
||||
|
||||
config.add_route('voucher', '/Voucher/{id}')
|
||||
|
||||
@@ -11,7 +11,6 @@ class RootFactory(object):
|
||||
(Allow, Authenticated, 'post')]
|
||||
for permission in Role.list():
|
||||
acl.append((Allow, permission.name, permission.name))
|
||||
print(acl)
|
||||
return acl
|
||||
def __init__(self, request):
|
||||
pass
|
||||
@@ -1,283 +0,0 @@
|
||||
import string
|
||||
|
||||
from brewman.views.nav_bar import login_menu, report_menu, voucher_menu, entry_menu, employee_menu, master_menu
|
||||
|
||||
class Form(object):
|
||||
"""Make absolute URL from the relative one.
|
||||
"""
|
||||
def __init__(self, action, method = "post"):
|
||||
self.text = "<form id=\"" + action + "_form\" method=\"" + method + "\" action=\"" + action + "\">"
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class FormToUrl(object):
|
||||
"""Make absolute URL from the relative one.
|
||||
"""
|
||||
def __init__(self, request, action, method = "post"):
|
||||
self.text = "<form id=\"" + action + "_form\" method=\"" + method + "\" action=\"" + request.route_url(action) + "\">"
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class CsrfToken(object):
|
||||
def __init__(self, session):
|
||||
self.text = "<input id=\"_csrf\" name=\"_csrf\" type=\"hidden\" value=\"" + session.get_csrf_token() + "\" />"
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class EndForm(object):
|
||||
"""Make absolute URL from the relative one.
|
||||
"""
|
||||
def __init__(self):
|
||||
self.text = "</form>"
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class CssLink(object):
|
||||
"""Make absolute URL from the relative one.
|
||||
"""
|
||||
def __init__(self, request, file, media = "screen"):
|
||||
self.text = "<link rel=\"stylesheet\" type=\"text/css\" media=\"" + media + "\" href=\"" + request.static_url("brewman:static/css/" + file) + "\" />"
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class JsLink(object):
|
||||
"""Make absolute URL from the relative one.
|
||||
"""
|
||||
def __init__(self, request, file):
|
||||
if file.startswith("http"):
|
||||
self.text = "<script src=\"" + file + "\"></script>"
|
||||
else:
|
||||
self.text = "<script src=\"" + request.static_url("brewman:static/js/" + file) + "\"></script>"
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class ScriptLink(object):
|
||||
"""Make absolute URL from the relative one.
|
||||
"""
|
||||
def __init__(self, request, file):
|
||||
if file.startswith("http"):
|
||||
self.text = "<script src=\"" + file + "\"></script>"
|
||||
else:
|
||||
self.text = "<script src=\"" + request.static_url("brewman:static/scripts/" + file) + "\"></script>"
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class Span(object):
|
||||
def __init__(self, text, css_class = ""):
|
||||
if len(css_class) > 0:
|
||||
css_class = "class=\"{0}\"".format(css_class)
|
||||
self.text = "<span {0}>{1}</span>".format(css_class, text)
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class Label(object):
|
||||
def __init__(self, text, label_for, css_class = ""):
|
||||
if len(css_class) > 0:
|
||||
css_class = "class=\"{0}\"".format(css_class)
|
||||
self.text = "<label for=\"{0}\" {1}>{2}</label>".format(label_for, css_class, text)
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class TextInput(object):
|
||||
def __init__(self, name, id = None, value="", css_class = "", required = "", disabled = "", placeholder = "", autocomplete = ""):
|
||||
if id is None:
|
||||
id = name
|
||||
if len(css_class) > 0:
|
||||
css_class = " class=\"{0}\"".format(css_class)
|
||||
|
||||
disabled = disabled.lower()
|
||||
if disabled == 'disabled' or disabled == 'true' or disabled == 1 or disabled == 'yes':
|
||||
disabled = ' disabled=\"disabled\"'
|
||||
else:
|
||||
disabled = ''
|
||||
|
||||
if len(placeholder) > 0:
|
||||
placeholder = ' placeholder=\"{0}\"'.format(placeholder)
|
||||
|
||||
autocomplete = autocomplete.lower()
|
||||
if len(autocomplete) > 0 and (autocomplete == 'off' or autocomplete == 'disabled' or autocomplete == 0 or autocomplete == 'false'):
|
||||
autocomplete = ' autocomplete=\"off\"'
|
||||
else:
|
||||
autocomplete = ''
|
||||
|
||||
required = required.lower()
|
||||
if len(required) > 0 and (required == 'required' or required == 'true' or requred == 1 or required == 'yes'):
|
||||
required = ' required'
|
||||
else:
|
||||
required = ''
|
||||
if value == "":
|
||||
value = " "
|
||||
else:
|
||||
value = " value=\"{0}\"".format(value)
|
||||
self.text = "<input type=\"text\" name=\"{0}\" id=\"{1}\"{2}{3}{4}{5}{6}{7} />".format(name, id, css_class, required, value, disabled, placeholder, autocomplete)
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class CheckBoxInput(object):
|
||||
def __init__(self, name, id = None, value = False, css_class = ""):
|
||||
if id is None:
|
||||
id = name
|
||||
if len(css_class) > 0:
|
||||
css_class = " class=\"{0}\"".format(css_class)
|
||||
if value:
|
||||
value = " checked=\"checked\""
|
||||
else:
|
||||
value = " "
|
||||
self.text = "<input type=\"checkbox\" name=\"{0}\" id=\"{1}\"{2}{3} value=\"True\" />".format(name, id, css_class, value)
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class Password(object):
|
||||
def __init__(self, name, id = None, css_class = "", required = "", placeholder = ""):
|
||||
if id is None:
|
||||
id = name
|
||||
if len(css_class) > 0:
|
||||
css_class = " class=\"{0}\"".format(css_class)
|
||||
required = required.lower()
|
||||
if len(required) > 0 and (required == 'required' or required == 'true' or requred == 1 or required == 'yes'):
|
||||
required = ' required'
|
||||
else:
|
||||
required = ''
|
||||
if len(placeholder) > 0:
|
||||
placeholder = ' placeholder=\"{0}\"'.format(placeholder)
|
||||
|
||||
self.text = "<input type=\"password\" name=\"{0}\" id=\"{1}\"{2}{3}{4} />".format(name, id, css_class, required, placeholder)
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class SubmitButton(object):
|
||||
def __init__(self, id, text, css_class = ""):
|
||||
if len(css_class) > 0:
|
||||
css_class = " class=\"{0}\"".format(css_class)
|
||||
self.text = "<input type=\"submit\" id=\"{0}\" value=\"{1}\"{2} />".format(id, text, css_class)
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class SelectInput(object):
|
||||
def __init__(self, name, id = None, list = None, displayField = "", valueField = "", defaultValue = "", css_class = ""):
|
||||
if id is None:
|
||||
id = name
|
||||
if len(css_class) > 0:
|
||||
css_class = " class=\"{0}\"".format(css_class)
|
||||
options = ''
|
||||
if not list is None:
|
||||
for item in list:
|
||||
if type(item) == dict:
|
||||
display = item[displayField]
|
||||
value = item[valueField]
|
||||
else:
|
||||
display = getattr(item, displayField)
|
||||
value = getattr(item, valueField)
|
||||
selected = ''
|
||||
if value == defaultValue:
|
||||
selected = ' selected'
|
||||
options += "<option value=\"{0}\"{1}>{2}</option>".format(str(value), selected, display)
|
||||
|
||||
self.text = "<select name=\"{0}\" id=\"{1}\"{2}>{3}</select>".format(name, id, css_class, options)
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class HiddenInput(object):
|
||||
def __init__(self, id, value=""):
|
||||
if not value == "":
|
||||
value = " value=\"{0}\"".format(value)
|
||||
self.text = "<input id=\"{0}\" name=\"{0}\" type=\"hidden\"{1} />".format(id, value)
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
__unicode__ = __str__
|
||||
|
||||
def __html__(self):
|
||||
return self.text
|
||||
|
||||
class Literal(object):
|
||||
def __init__(self, s):
|
||||
self.s = s
|
||||
|
||||
def __html__(self):
|
||||
return self.s
|
||||
@@ -77,7 +77,7 @@ class User(Base):
|
||||
|
||||
@classmethod
|
||||
def get_by_name(cls, name):
|
||||
return DBSession.query(cls).filter(cls.name == name).one()
|
||||
return DBSession.query(cls).filter(cls.name == name).first()
|
||||
|
||||
@classmethod
|
||||
def get_by_id(cls, id):
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import uuid
|
||||
from pyramid.security import Allow, ALL_PERMISSIONS
|
||||
from brewman.models.auth import User
|
||||
|
||||
class VoucherFactory(object):
|
||||
@@ -25,7 +24,6 @@ def groupfinder(user_id, request):
|
||||
perms.append(perm.name)
|
||||
perms = f7(perms)
|
||||
request.session['perms'] = perms
|
||||
print(perms)
|
||||
return perms
|
||||
|
||||
|
||||
|
||||
+139
-65
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @license AngularJS v1.0.1
|
||||
* @license AngularJS v1.0.2
|
||||
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
||||
* License: MIT
|
||||
*/
|
||||
@@ -1178,7 +1178,7 @@ function setupModuleLoader(window) {
|
||||
* @param {Function} directiveFactory Factory function for creating new instance of
|
||||
* directives.
|
||||
* @description
|
||||
* See {@link ng.$compileProvider.directive $compileProvider.directive()}.
|
||||
* See {@link ng.$compileProvider#directive $compileProvider.directive()}.
|
||||
*/
|
||||
directive: invokeLater('$compileProvider', 'directive'),
|
||||
|
||||
@@ -1247,11 +1247,11 @@ function setupModuleLoader(window) {
|
||||
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
|
||||
*/
|
||||
var version = {
|
||||
full: '1.0.1', // all of these placeholder strings will be replaced by rake's
|
||||
full: '1.0.2', // all of these placeholder strings will be replaced by rake's
|
||||
major: 1, // compile task
|
||||
minor: 0,
|
||||
dot: 1,
|
||||
codeName: 'thorium-shielding'
|
||||
dot: 2,
|
||||
codeName: 'debilitating-awesomeness'
|
||||
};
|
||||
|
||||
|
||||
@@ -1529,7 +1529,7 @@ function JQLite(element) {
|
||||
var div = document.createElement('div');
|
||||
// Read about the NoScope elements here:
|
||||
// http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx
|
||||
div.innerHTML = '<div> </div>' + element; // IE insanity to make NoScope elements work!
|
||||
div.innerHTML = '<div> </div>' + element; // IE insanity to make NoScope elements work!
|
||||
div.removeChild(div.firstChild); // remove the superfluous div
|
||||
JQLiteAddNodes(this, div.childNodes);
|
||||
this.remove(); // detach the elements from the temporary DOM div.
|
||||
@@ -3441,7 +3441,7 @@ var NON_ASSIGNABLE_MODEL_EXPRESSION = 'Non-assignable model expression: ';
|
||||
* can then be used to link {@link ng.$rootScope.Scope scope} and the template together.
|
||||
*
|
||||
* The compilation is a process of walking the DOM tree and trying to match DOM elements to
|
||||
* {@link ng.$compileProvider.directive directives}. For each match it
|
||||
* {@link ng.$compileProvider#directive directives}. For each match it
|
||||
* executes corresponding template function and collects the
|
||||
* instance functions into a single template function which is then returned.
|
||||
*
|
||||
@@ -3559,20 +3559,6 @@ var NON_ASSIGNABLE_MODEL_EXPRESSION = 'Non-assignable model expression: ';
|
||||
*
|
||||
* @description
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name ng.$compileProvider#directive
|
||||
* @methodOf ng.$compileProvider
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* Register a new directive with compiler
|
||||
*
|
||||
* @param {string} name name of the directive.
|
||||
* @param {function} directiveFactory An injectable directive factory function.
|
||||
* @returns {ng.$compileProvider} Self for chaining.
|
||||
*/
|
||||
$CompileProvider.$inject = ['$provide'];
|
||||
function $CompileProvider($provide) {
|
||||
var hasDirectives = {},
|
||||
@@ -3584,17 +3570,18 @@ function $CompileProvider($provide) {
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name ng.$compileProvider.directive
|
||||
* @name ng.$compileProvider#directive
|
||||
* @methodOf ng.$compileProvider
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* Register directives with the compiler.
|
||||
* Register a new directives with the compiler.
|
||||
*
|
||||
* @param {string} name Name of the directive in camel-case. (ie <code>ngBind</code> which will match as
|
||||
* <code>ng-bind</code>).
|
||||
* @param {function} directiveFactory An injectable directive factroy function. See {@link guide/directive} for more
|
||||
* info.
|
||||
* @returns {ng.$compileProvider} Self for chaining.
|
||||
*/
|
||||
this.directive = function registerDirective(name, directiveFactory) {
|
||||
if (isString(name)) {
|
||||
@@ -3720,6 +3707,15 @@ function $CompileProvider($provide) {
|
||||
}
|
||||
};
|
||||
|
||||
var startSymbol = $interpolate.startSymbol(),
|
||||
endSymbol = $interpolate.endSymbol(),
|
||||
denormalizeTemplate = (startSymbol == '{{' || endSymbol == '}}')
|
||||
? identity
|
||||
: function denormalizeTemplate(template) {
|
||||
return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
|
||||
};
|
||||
|
||||
|
||||
return compile;
|
||||
|
||||
//================================
|
||||
@@ -3733,7 +3729,7 @@ function $CompileProvider($provide) {
|
||||
// not be able to attach scope data to them, so we will wrap them in <span>
|
||||
forEach($compileNode, function(node, index){
|
||||
if (node.nodeType == 3 /* text node */) {
|
||||
$compileNode[index] = jqLite(node).wrap('<span>').parent()[0];
|
||||
$compileNode[index] = jqLite(node).wrap('<span></span>').parent()[0];
|
||||
}
|
||||
});
|
||||
var compositeLinkFn = compileNodes($compileNode, transcludeFn, $compileNode, maxPriority);
|
||||
@@ -3999,14 +3995,17 @@ function $CompileProvider($provide) {
|
||||
}
|
||||
}
|
||||
|
||||
if (directiveValue = directive.template) {
|
||||
if ((directiveValue = directive.template)) {
|
||||
assertNoDuplicate('template', templateDirective, directive, $compileNode);
|
||||
templateDirective = directive;
|
||||
|
||||
$template = jqLite('<div>' + trim(directiveValue) + '</div>').contents();
|
||||
compileNode = $template[0];
|
||||
directiveValue = denormalizeTemplate(directiveValue);
|
||||
|
||||
if (directive.replace) {
|
||||
$template = jqLite('<div>' +
|
||||
trim(directiveValue) +
|
||||
'</div>').contents();
|
||||
compileNode = $template[0];
|
||||
|
||||
if ($template.length != 1 || compileNode.nodeType !== 1) {
|
||||
throw new Error(MULTI_ROOT_TEMPLATE_ERROR + directiveValue);
|
||||
}
|
||||
@@ -4319,6 +4318,8 @@ function $CompileProvider($provide) {
|
||||
success(function(content) {
|
||||
var compileNode, tempTemplateAttrs, $template;
|
||||
|
||||
content = denormalizeTemplate(content);
|
||||
|
||||
if (replace) {
|
||||
$template = jqLite('<div>' + trim(content) + '</div>').contents();
|
||||
compileNode = $template[0];
|
||||
@@ -4663,13 +4664,13 @@ function $ExceptionHandlerProvider() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @ngdoc object
|
||||
* @name ng.$interpolateProvider
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
*
|
||||
* Used for configuring the interpolation markup. Deafults to `{{` and `}}`.
|
||||
* Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
|
||||
*/
|
||||
function $InterpolateProvider() {
|
||||
var startSymbol = '{{';
|
||||
@@ -4682,7 +4683,8 @@ function $InterpolateProvider() {
|
||||
* @description
|
||||
* Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
|
||||
*
|
||||
* @prop {string=} value new value to set the starting symbol to.
|
||||
* @param {string=} value new value to set the starting symbol to.
|
||||
* @returns {string|self} Returns the symbol when used as getter and self if used as setter.
|
||||
*/
|
||||
this.startSymbol = function(value){
|
||||
if (value) {
|
||||
@@ -4700,14 +4702,15 @@ function $InterpolateProvider() {
|
||||
* @description
|
||||
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
|
||||
*
|
||||
* @prop {string=} value new value to set the ending symbol to.
|
||||
* @param {string=} value new value to set the ending symbol to.
|
||||
* @returns {string|self} Returns the symbol when used as getter and self if used as setter.
|
||||
*/
|
||||
this.endSymbol = function(value){
|
||||
if (value) {
|
||||
endSymbol = value;
|
||||
return this;
|
||||
} else {
|
||||
return startSymbol;
|
||||
return endSymbol;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4749,7 +4752,7 @@ function $InterpolateProvider() {
|
||||
* against.
|
||||
*
|
||||
*/
|
||||
return function(text, mustHaveExpression) {
|
||||
function $interpolate(text, mustHaveExpression) {
|
||||
var startIndex,
|
||||
endIndex,
|
||||
index = 0,
|
||||
@@ -4801,7 +4804,43 @@ function $InterpolateProvider() {
|
||||
fn.parts = parts;
|
||||
return fn;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name ng.$interpolate#startSymbol
|
||||
* @methodOf ng.$interpolate
|
||||
* @description
|
||||
* Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
|
||||
*
|
||||
* Use {@link ng.$interpolateProvider#startSymbol $interpolateProvider#startSymbol} to change
|
||||
* the symbol.
|
||||
*
|
||||
* @returns {string} start symbol.
|
||||
*/
|
||||
$interpolate.startSymbol = function() {
|
||||
return startSymbol;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name ng.$interpolate#endSymbol
|
||||
* @methodOf ng.$interpolate
|
||||
* @description
|
||||
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
|
||||
*
|
||||
* Use {@link ng.$interpolateProvider#endSymbol $interpolateProvider#endSymbol} to change
|
||||
* the symbol.
|
||||
*
|
||||
* @returns {string} start symbol.
|
||||
*/
|
||||
$interpolate.endSymbol = function() {
|
||||
return endSymbol;
|
||||
}
|
||||
|
||||
return $interpolate;
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -5433,14 +5472,14 @@ function $LocationProvider(){
|
||||
* The main purpose of this service is to simplify debugging and troubleshooting.
|
||||
*
|
||||
* @example
|
||||
<doc:example>
|
||||
<doc:source>
|
||||
<script>
|
||||
function LogCtrl($log) {
|
||||
this.$log = $log;
|
||||
this.message = 'Hello World!';
|
||||
<example>
|
||||
<file name="script.js">
|
||||
function LogCtrl($scope, $log) {
|
||||
$scope.$log = $log;
|
||||
$scope.message = 'Hello World!';
|
||||
}
|
||||
</script>
|
||||
</file>
|
||||
<file name="index.html">
|
||||
<div ng-controller="LogCtrl">
|
||||
<p>Reload this page with open console, enter text and hit the log button...</p>
|
||||
Message:
|
||||
@@ -5450,10 +5489,8 @@ function $LocationProvider(){
|
||||
<button ng-click="$log.info(message)">info</button>
|
||||
<button ng-click="$log.error(message)">error</button>
|
||||
</div>
|
||||
</doc:source>
|
||||
<doc:scenario>
|
||||
</doc:scenario>
|
||||
</doc:example>
|
||||
</file>
|
||||
</example>
|
||||
*/
|
||||
|
||||
function $LogProvider(){
|
||||
@@ -6810,8 +6847,9 @@ function $RouteProvider(){
|
||||
*
|
||||
* Object properties:
|
||||
*
|
||||
* - `controller` – `{function()=}` – Controller fn that should be associated with newly
|
||||
* created scope.
|
||||
* - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly
|
||||
* created scope or the name of a {@link angular.Module#controller registered controller}
|
||||
* if passed as a string.
|
||||
* - `template` – `{string=}` – html template as a string that should be used by
|
||||
* {@link ng.directive:ngView ngView} or
|
||||
* {@link ng.directive:ngInclude ngInclude} directives.
|
||||
@@ -6821,7 +6859,7 @@ function $RouteProvider(){
|
||||
* - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
|
||||
* be injected into the controller. If any of these dependencies are promises, they will be
|
||||
* resolved and converted to a value before the controller is instantiated and the
|
||||
* `$aftreRouteChange` event is fired. The map object is:
|
||||
* `$afterRouteChange` event is fired. The map object is:
|
||||
*
|
||||
* - `key` – `{string}`: a name of a dependency to be injected into the controller.
|
||||
* - `factory` - `{string|function}`: If `string` then it is an alias for a service.
|
||||
@@ -7587,9 +7625,9 @@ function $RootScopeProvider(){
|
||||
*
|
||||
* Usually you don't call `$digest()` directly in
|
||||
* {@link ng.directive:ngController controllers} or in
|
||||
* {@link ng.$compileProvider.directive directives}.
|
||||
* {@link ng.$compileProvider#directive directives}.
|
||||
* Instead a call to {@link ng.$rootScope.Scope#$apply $apply()} (typically from within a
|
||||
* {@link ng.$compileProvider.directive directives}) will force a `$digest()`.
|
||||
* {@link ng.$compileProvider#directive directives}) will force a `$digest()`.
|
||||
*
|
||||
* If you want to be notified whenever `$digest()` is called,
|
||||
* you can register a `watchExpression` function with {@link ng.$rootScope.Scope#$watch $watch()}
|
||||
@@ -7875,8 +7913,8 @@ function $RootScopeProvider(){
|
||||
* @param {function(event)} listener Function to call when the event is emitted.
|
||||
* @returns {function()} Returns a deregistration function for this listener.
|
||||
*
|
||||
* The event listener function format is: `function(event)`. The `event` object passed into the
|
||||
* listener has the following attributes
|
||||
* The event listener function format is: `function(event, args...)`. The `event` object
|
||||
* passed into the listener has the following attributes:
|
||||
*
|
||||
* - `targetScope` - {Scope}: the scope on which the event was `$emit`-ed or `$broadcast`-ed.
|
||||
* - `currentScope` - {Scope}: the current scope which is handling the event.
|
||||
@@ -10105,7 +10143,12 @@ function ngDirective(directive) {
|
||||
return valueFn(directive);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* @ngdoc directive
|
||||
* @name ng.directive:a
|
||||
* @restrict E
|
||||
*
|
||||
* @description
|
||||
* Modifies the default behavior of html A tag, so that the default action is prevented when href
|
||||
* attribute is empty.
|
||||
*
|
||||
@@ -10673,7 +10716,9 @@ function FormController(element, attrs) {
|
||||
</doc:scenario>
|
||||
</doc:example>
|
||||
*/
|
||||
var formDirectiveDir = {
|
||||
var formDirectiveFactory = function(isNgForm) {
|
||||
return ['$timeout', function($timeout) {
|
||||
var formDirective = {
|
||||
name: 'form',
|
||||
restrict: 'E',
|
||||
controller: FormController,
|
||||
@@ -10681,8 +10726,26 @@ var formDirectiveDir = {
|
||||
return {
|
||||
pre: function(scope, formElement, attr, controller) {
|
||||
if (!attr.action) {
|
||||
formElement.bind('submit', function(event) {
|
||||
event.preventDefault();
|
||||
// we can't use jq events because if a form is destroyed during submission the default
|
||||
// action is not prevented. see #1238
|
||||
//
|
||||
// IE 9 is not affected because it doesn't fire a submit event and try to do a full
|
||||
// page reload if the form was destroyed by submission of the form via a click handler
|
||||
// on a button in the form. Looks like an IE9 specific bug.
|
||||
var preventDefaultListener = function(event) {
|
||||
event.preventDefault
|
||||
? event.preventDefault()
|
||||
: event.returnValue = false; // IE
|
||||
};
|
||||
|
||||
addEventListenerFn(formElement[0], 'submit', preventDefaultListener);
|
||||
|
||||
// unregister the preventDefault listener so that we don't not leak memory but in a
|
||||
// way that will achieve the prevention of the default action.
|
||||
formElement.bind('$destroy', function() {
|
||||
$timeout(function() {
|
||||
removeEventListenerFn(formElement[0], 'submit', preventDefaultListener);
|
||||
}, 0, false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10704,10 +10767,14 @@ var formDirectiveDir = {
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
return isNgForm ? extend(copy(formDirective), {restrict: 'EAC'}) : formDirective;
|
||||
}];
|
||||
};
|
||||
|
||||
var formDirective = valueFn(formDirectiveDir);
|
||||
var ngFormDirective = valueFn(extend(copy(formDirectiveDir), {restrict: 'EAC'}));
|
||||
var formDirective = formDirectiveFactory();
|
||||
var ngFormDirective = formDirectiveFactory(true);
|
||||
|
||||
var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
|
||||
var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
|
||||
@@ -11928,7 +11995,7 @@ var ngListDirective = function() {
|
||||
|
||||
ctrl.$parsers.push(parse);
|
||||
ctrl.$formatters.push(function(value) {
|
||||
if (isArray(value) && !equals(parse(ctrl.$viewValue), value)) {
|
||||
if (isArray(value)) {
|
||||
return value.join(', ');
|
||||
}
|
||||
|
||||
@@ -13045,11 +13112,14 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp
|
||||
whenExp = element.attr(attr.$attr.when), // this is because we have {{}} in attrs
|
||||
offset = attr.offset || 0,
|
||||
whens = scope.$eval(whenExp),
|
||||
whensExpFns = {};
|
||||
whensExpFns = {},
|
||||
startSymbol = $interpolate.startSymbol(),
|
||||
endSymbol = $interpolate.endSymbol();
|
||||
|
||||
forEach(whens, function(expression, key) {
|
||||
whensExpFns[key] =
|
||||
$interpolate(expression.replace(BRACE, '{{' + numberExp + '-' + offset + '}}'));
|
||||
$interpolate(expression.replace(BRACE, startSymbol + numberExp + '-' +
|
||||
offset + endSymbol));
|
||||
});
|
||||
|
||||
scope.$watch(function() {
|
||||
@@ -14273,7 +14343,6 @@ var optionDirective = ['$interpolate', function($interpolate) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
priority: 100,
|
||||
require: '^select',
|
||||
compile: function(element, attr) {
|
||||
if (isUndefined(attr.value)) {
|
||||
var interpolateFn = $interpolate(element.text(), true);
|
||||
@@ -14282,8 +14351,13 @@ var optionDirective = ['$interpolate', function($interpolate) {
|
||||
}
|
||||
}
|
||||
|
||||
return function (scope, element, attr, selectCtrl) {
|
||||
if (selectCtrl.databound) {
|
||||
return function (scope, element, attr) {
|
||||
var selectCtrlName = '$selectController',
|
||||
parent = element.parent(),
|
||||
selectCtrl = parent.data(selectCtrlName) ||
|
||||
parent.parent().data(selectCtrlName); // in case we are in optgroup
|
||||
|
||||
if (selectCtrl && selectCtrl.databound) {
|
||||
// For some reason Opera defaults to true and if not overridden this messes up the repeater.
|
||||
// We don't want the view to drive the initialization of the model anyway.
|
||||
element.prop('selected', false);
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @license AngularJS v1.0.1
|
||||
* @license AngularJS v1.0.2
|
||||
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
||||
* License: MIT
|
||||
*/
|
||||
@@ -0,0 +1,7 @@
|
||||
<section class="page-content">
|
||||
<header class="header-404">
|
||||
<h2>404</h2>
|
||||
|
||||
<h3 class="ribbon-404">It looks like that page you were looking has been lost, sorry.</h3>
|
||||
</header>
|
||||
</section>
|
||||
@@ -4,7 +4,7 @@
|
||||
<label for="txtDate" class="control-label">Date</label>
|
||||
|
||||
<div class="controls">
|
||||
<datepicker id="txtDate" model="info" prop="FinishDate" ng-model="info.Date"></datepicker>
|
||||
<datepicker id="txtDate" model="info" prop="Date" ng-model="info.Date"></datepicker>
|
||||
<button ng-click="show()">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<div class="row">
|
||||
<h2>Login</h2>
|
||||
|
||||
<form action="/login" method="post" autocomplete="off" class="form-horizontal">
|
||||
<!--${h.HiddenInput('came_from', value=came_from)}-->
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="username">Username</label>
|
||||
|
||||
<div class="controls">
|
||||
<input type="text" name="username" id="username" required placeholder="Username"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="password">Password</label>
|
||||
|
||||
<div class="controls">
|
||||
<input type="password" name="password" id="password" required placeholder="Password"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="forgot"></label>
|
||||
|
||||
<div class="controls">
|
||||
<span id="forgot">Forgot <a href="#">Username</a> / <a href="#">Password</a></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="submit" id="log_in" class="btn btn-primary">Login</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
+7
-5
@@ -39,11 +39,6 @@ overlord_service.factory('ProductLedger', ['$resource', function ($resource) {
|
||||
return $resource('/ProductLedger/:id');
|
||||
}]);
|
||||
|
||||
// TODO: Replace hardcoded url with route_url
|
||||
overlord_service.factory('Permission', ['$resource', function ($resource) {
|
||||
return $resource('/Permissions');
|
||||
}]);
|
||||
|
||||
// TODO: Replace hardcoded url with route_url
|
||||
overlord_service.factory('CostCenter', ['$resource', function ($resource) {
|
||||
return $resource('/CostCenter/:id',
|
||||
@@ -143,3 +138,10 @@ overlord_service.factory('LedgerService', ['$resource', function ($resource) {
|
||||
return $resource('/Services/Accounts/:type');
|
||||
}]);
|
||||
|
||||
// TODO: Replace hardcoded url with route_url
|
||||
overlord_service.factory('Auth', ['$resource', function ($resource) {
|
||||
return $resource('/Auth', {}, {
|
||||
login:{method:'GET', params:{list:true}, isArray:true}
|
||||
});
|
||||
}]);
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
function AutoComplete(matchFieldName, lookupURL) {
|
||||
$(matchFieldName).autocomplete({
|
||||
source:function (request, response) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:lookupURL,
|
||||
contentType:"application/json; charset=utf-8",
|
||||
dataType:"json",
|
||||
async:true,
|
||||
data:JSON.stringify({prefixText:request.term, count:20}),
|
||||
success:function (data) {
|
||||
response(data);
|
||||
},
|
||||
error:function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
showError(textStatus.responseText);
|
||||
}
|
||||
});
|
||||
},
|
||||
minLength:1,
|
||||
autoFocus:true
|
||||
});
|
||||
}
|
||||
@@ -1,17 +1,37 @@
|
||||
|
||||
function ClosingStockCtrl($scope, $routeParams, $location, ClosingStock) {
|
||||
if (typeof $routeParams.date === 'undefined') {
|
||||
$scope.info = ClosingStock.get({});
|
||||
} else {
|
||||
$scope.info = ClosingStock.get({date:$routeParams.date});
|
||||
|
||||
}
|
||||
function ClosingStockCtrl($scope, $routeParams, $location, info) {
|
||||
$scope.info = info;
|
||||
$scope.show = function () {
|
||||
$scope.info = ClosingStock.get({id:$scope.info.Date}, function (u, putResponseHeaders) {
|
||||
$location.path('/ClosingStock/' + u.Date);
|
||||
}, function (data, status) {
|
||||
$scope.toasts.push({Type:'Error', Message:data.data});
|
||||
});
|
||||
$location.path('/ClosingStock/' + $scope.info.Date);
|
||||
};
|
||||
$('#txtDate').focus();
|
||||
}
|
||||
ClosingStockCtrl.resolve = {
|
||||
info:function ($q, $route, ClosingStock) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var date = $route.current.params.date;
|
||||
|
||||
var successCb = function(result){
|
||||
deferred.resolve(result);
|
||||
};
|
||||
|
||||
if (typeof date === 'undefined') {
|
||||
return ClosingStock.get({}, successCb);
|
||||
} else {
|
||||
return ClosingStock.get({date:date}, successCb);
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
||||
//LedgerCtrl.resolve = {
|
||||
// ledger_data:function ($route, Ledger) {
|
||||
// var params = $route.current.params;
|
||||
// if (typeof params.id === 'undefined') {
|
||||
// return Ledger.get({});
|
||||
// } else {
|
||||
// return Ledger.get({id:params.id, StartDate:params.StartDate, FinishDate:params.FinishDate});
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,205 +0,0 @@
|
||||
/*
|
||||
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
||||
*
|
||||
* Uses the built in easing capabilities added In jQuery 1.1
|
||||
* to offer multiple easing options
|
||||
*
|
||||
* TERMS OF USE - jQuery Easing
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2008 George McGinley Smith
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
// t: current time, b: begInnIng value, c: change In value, d: duration
|
||||
jQuery.easing['jswing'] = jQuery.easing['swing'];
|
||||
|
||||
jQuery.extend( jQuery.easing,
|
||||
{
|
||||
def: 'easeOutQuad',
|
||||
swing: function (x, t, b, c, d) {
|
||||
//alert(jQuery.easing.default);
|
||||
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
|
||||
},
|
||||
easeInQuad: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t + b;
|
||||
},
|
||||
easeOutQuad: function (x, t, b, c, d) {
|
||||
return -c *(t/=d)*(t-2) + b;
|
||||
},
|
||||
easeInOutQuad: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t + b;
|
||||
return -c/2 * ((--t)*(t-2) - 1) + b;
|
||||
},
|
||||
easeInCubic: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t + b;
|
||||
},
|
||||
easeOutCubic: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t + 1) + b;
|
||||
},
|
||||
easeInOutCubic: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t + 2) + b;
|
||||
},
|
||||
easeInQuart: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t + b;
|
||||
},
|
||||
easeOutQuart: function (x, t, b, c, d) {
|
||||
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
||||
},
|
||||
easeInOutQuart: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
||||
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
||||
},
|
||||
easeInQuint: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t*t + b;
|
||||
},
|
||||
easeOutQuint: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
||||
},
|
||||
easeInOutQuint: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
||||
},
|
||||
easeInSine: function (x, t, b, c, d) {
|
||||
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
||||
},
|
||||
easeOutSine: function (x, t, b, c, d) {
|
||||
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
||||
},
|
||||
easeInOutSine: function (x, t, b, c, d) {
|
||||
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
||||
},
|
||||
easeInExpo: function (x, t, b, c, d) {
|
||||
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
||||
},
|
||||
easeOutExpo: function (x, t, b, c, d) {
|
||||
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
||||
},
|
||||
easeInOutExpo: function (x, t, b, c, d) {
|
||||
if (t==0) return b;
|
||||
if (t==d) return b+c;
|
||||
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
||||
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
||||
},
|
||||
easeInCirc: function (x, t, b, c, d) {
|
||||
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
||||
},
|
||||
easeOutCirc: function (x, t, b, c, d) {
|
||||
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
||||
},
|
||||
easeInOutCirc: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
||||
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
||||
},
|
||||
easeInElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
},
|
||||
easeOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
||||
},
|
||||
easeInOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
||||
},
|
||||
easeInBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*(t/=d)*t*((s+1)*t - s) + b;
|
||||
},
|
||||
easeOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
||||
},
|
||||
easeInOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
||||
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
||||
},
|
||||
easeInBounce: function (x, t, b, c, d) {
|
||||
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
||||
},
|
||||
easeOutBounce: function (x, t, b, c, d) {
|
||||
if ((t/=d) < (1/2.70)) {
|
||||
return c*(7.5625*t*t) + b;
|
||||
} else if (t < (2/2.70)) {
|
||||
return c*(7.5625*(t-=(1.5/2.70))*t + .70) + b;
|
||||
} else if (t < (2.5/2.70)) {
|
||||
return c*(7.5625*(t-=(2.25/2.70))*t + .9370) + b;
|
||||
} else {
|
||||
return c*(7.5625*(t-=(2.625/2.70))*t + .984370) + b;
|
||||
}
|
||||
},
|
||||
easeInOutBounce: function (x, t, b, c, d) {
|
||||
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
||||
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
*
|
||||
* TERMS OF USE - EASING EQUATIONS
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2001 Robert Penner
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
@@ -0,0 +1,13 @@
|
||||
function LoginCtrl($scope, $http, $location) {
|
||||
$scope.submit = function () {
|
||||
$http.
|
||||
post('/login', {'username':$scope.name, 'password':$scope.password}).
|
||||
success(function () {
|
||||
$location.path('/')
|
||||
}).
|
||||
error(function (errorMessage) {
|
||||
$scope.toasts.push({Type:'Error', Message:errorMessage});
|
||||
});
|
||||
}
|
||||
$('#username').focus();
|
||||
}
|
||||
@@ -4,6 +4,7 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte
|
||||
.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
|
||||
$routeProvider.
|
||||
when('/', {templateUrl:'/partial/home.html'}).
|
||||
when('/login', {templateUrl:'/partial/login.html', controller:LoginCtrl}).
|
||||
|
||||
when('/Journal', {templateUrl:'/partial/journal.html', controller:JournalCtrl}).
|
||||
when('/Journal/:id', {templateUrl:'/partial/journal.html', controller:JournalCtrl}).
|
||||
@@ -43,8 +44,8 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte
|
||||
when('/TrialBalance', {templateUrl:'/partial/trial-balance.html', controller:TrialBalanceCtrl}).
|
||||
when('/TrialBalance/:date', {templateUrl:'/partial/trial-balance.html', controller:TrialBalanceCtrl}).
|
||||
|
||||
when('/ClosingStock', {templateUrl:'/partial/closing-stock.html', controller:ClosingStockCtrl}).
|
||||
when('/ClosingStock/:date', {templateUrl:'/partial/closing-stock.html', controller:ClosingStockCtrl}).
|
||||
when('/ClosingStock', {templateUrl:'/partial/closing-stock.html', controller:ClosingStockCtrl, resolve:ClosingStockCtrl.resolve}).
|
||||
when('/ClosingStock/:date', {templateUrl:'/partial/closing-stock.html', controller:ClosingStockCtrl, resolve:ClosingStockCtrl.resolve}).
|
||||
|
||||
when('/Accounts', {templateUrl:'/partial/account-list.html', controller:AccountListCtrl}).
|
||||
when('/Account', {templateUrl:'/partial/account-detail.html', controller:AccountCtrl}).
|
||||
@@ -72,9 +73,10 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte
|
||||
|
||||
when('/Groups', {templateUrl:'/partial/group-list.html', controller:GroupListCtrl}).
|
||||
when('/Group', {templateUrl:'/partial/group-detail.html', controller:GroupCtrl}).
|
||||
when('/Group/:id', {templateUrl:'/partial/group-detail.html', controller:GroupCtrl});
|
||||
// .otherwise({redirectTo: '/phones'});
|
||||
$locationProvider.html5Mode(true);
|
||||
when('/Group/:id', {templateUrl:'/partial/group-detail.html', controller:GroupCtrl}).
|
||||
|
||||
otherwise({templateUrl:'/partial/404.html'});
|
||||
$locationProvider.html5Mode(true).hashPrefix('!');
|
||||
}])
|
||||
.config(function ($httpProvider) {
|
||||
$httpProvider.responseInterceptors.push('spinnerInterceptor');
|
||||
@@ -95,11 +97,13 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte
|
||||
return $q.reject(response);
|
||||
});
|
||||
};
|
||||
})
|
||||
;
|
||||
});
|
||||
|
||||
function BaseCtrl($scope, Permission) {
|
||||
$scope.perms = Permission.get();
|
||||
function BaseCtrl($rootScope, $scope, Auth) {
|
||||
$scope.auth = Auth.get(function (u, putResponseHeaders) {
|
||||
console.log('got perms');
|
||||
$scope.perms = u.perms;
|
||||
});
|
||||
|
||||
$scope.toasts = [];
|
||||
$scope.clearToast = function (item) {
|
||||
@@ -111,4 +115,15 @@ function BaseCtrl($scope, Permission) {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$rootScope.$on("$routeChangeStart", function (event, next, current) {
|
||||
$scope.toasts.push("Loading...");
|
||||
});
|
||||
$rootScope.$on("$routeChangeSuccess", function (event, current, previous) {
|
||||
$scope.toasts.push("Successfully changed routes :)");
|
||||
});
|
||||
$rootScope.$on("$routeChangeError", function (event, current, previous, rejection) {
|
||||
$scope.toasts.push("ROUTE CHANGE ERROR: " + rejection);
|
||||
});
|
||||
}
|
||||
@@ -1,319 +0,0 @@
|
||||
jQuery.noConflict();
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
/* Tweet widgets -------------------------------------------------------- */
|
||||
$(".widget-tweets .widget-content").tweet({
|
||||
username: "envato",
|
||||
count: 3
|
||||
});
|
||||
|
||||
if($(".widget-last-tweet").length){
|
||||
$(".widget-last-tweet .widget-content").tweet({
|
||||
username: "envato",
|
||||
count: 1
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* Forms validation ----------------------------------------------------- */
|
||||
//Validate form and send data to defined url file
|
||||
$("#contact-form, #contact-form-widget").each(function () {
|
||||
var url = $(this).attr('action'); /* Define server side script witch sends mail */
|
||||
var formItem = $(this);
|
||||
|
||||
formItem.validate({
|
||||
submitHandler: function() {
|
||||
var datastring = formItem.serialize();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: datastring,
|
||||
success: function(data){
|
||||
formItem.slideUp();
|
||||
formItem.next('.form-sent').fadeIn().html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* Widget contact form */
|
||||
$('#contact-form-widget p').each(function() {
|
||||
labelText = $.trim($(this).find('label').text().replace('(Required *)', ''));
|
||||
myInput = $(this).find('input:not(:submit), textarea');
|
||||
|
||||
// Hide label
|
||||
$(this).find('label').remove();
|
||||
|
||||
$(myInput).val(labelText);
|
||||
|
||||
// Remove placeholders
|
||||
myInput.bind('focusin', {label: labelText}, function(event) {
|
||||
if($(this).val() == event.data.label) {
|
||||
$(this).val('');
|
||||
}
|
||||
});
|
||||
|
||||
// Add placeholders
|
||||
myInput.bind('focusout', {label: labelText}, function(event) {
|
||||
if($(this).val() == '') {
|
||||
$(this).val(event.data.label);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* Comment form validation */
|
||||
$('#comment-reply').validate();
|
||||
|
||||
|
||||
/* Remove no-js class from html attribute if JavaScript is enabled */
|
||||
$('html').removeClass('no-js');
|
||||
|
||||
|
||||
/* HTML5 Video player --------------------------------------------------- */
|
||||
VideoJS.setupAllWhenReady();
|
||||
|
||||
|
||||
/* Top navigation ------------------------------------------------------- */
|
||||
$("#header-navigation ul ul").css({display: "none"});
|
||||
$("#header-navigation a").removeAttr('title');
|
||||
|
||||
$("#header-navigation li:last").addClass('last');
|
||||
$("#header-navigation li li ul").parent().children('a').addClass('with-subnav');
|
||||
|
||||
// Background shift (background image offset -60px) + (link margin 21px)
|
||||
$("#header-navigation > ul > li").each(function() {
|
||||
shift = -60 + 21 + ($(this).children('a').width() / 2);
|
||||
$(this).children('ul').css({backgroundPosition: shift + 'px -430px'});
|
||||
});
|
||||
|
||||
// Top level color animation
|
||||
$("#header-navigation li").hover(function(){
|
||||
// Get color from page link element
|
||||
linkColor = $('.navigation-wrapper').css('backgroundColor');
|
||||
$(this).children('a').stop(true, true).animate({color: linkColor});
|
||||
}, function() {
|
||||
$(this).children('a').stop(true, true).animate({color: '#fff'});
|
||||
});
|
||||
|
||||
// Dropdown li a background
|
||||
$("#header-navigation ul ul a").hover(function(){
|
||||
// Get color from navigation ul element
|
||||
ddColor = $('#header-navigation').css('backgroundColor');
|
||||
$(this).stop().animate({backgroundColor: "#222"}, 'normal');
|
||||
}, function() {
|
||||
$(this).stop().animate({backgroundColor: "#333"}, 'normal');
|
||||
});
|
||||
|
||||
// Dropdown animation
|
||||
$("#header-navigation li").hover(function(){
|
||||
$(this).children('ul:first').css({visibility: "visible"}).stop(true, true).slideDown(400);
|
||||
},function(){
|
||||
$(this).children('ul:first').stop(true, true).delay(100).fadeOut('fast');
|
||||
});
|
||||
|
||||
|
||||
/* Nivo slider ---------------------------------------------------------- */
|
||||
if($('.slider-nivo .slider-content, .gallery-inner').length) {
|
||||
$('.slider-nivo .slider-content, .gallery-inner').nivoSlider({
|
||||
directionNav:true,
|
||||
pauseTime: 5000
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* Accordion slider ----------------------------------------------------- */
|
||||
if($('.slider-kwicks').length) {
|
||||
$('.slider-kwicks .slider-content').kwicks({
|
||||
isVertical: false,
|
||||
sticky: false,
|
||||
defaultKwick: 0,
|
||||
spacing: 0,
|
||||
max: 800,
|
||||
duration: 1750,
|
||||
easing: 'easeOutBack',
|
||||
descrAnim: 700,
|
||||
descrOpacity: 0.8
|
||||
});
|
||||
|
||||
|
||||
$(".slider-kwicks li .slide_caption").fadeTo(500, 0.4);
|
||||
|
||||
$(".slider-kwicks li").hover(function(){
|
||||
$(this).find('.slide_caption').fadeTo(500, 1);
|
||||
},
|
||||
function () {
|
||||
$(this).find('.slide_caption').fadeTo(500, 0.4);
|
||||
});
|
||||
}
|
||||
|
||||
/* Carousel slider ------------------------------------------------------ */
|
||||
if($('.slider-carousel').length) {
|
||||
$('.slider-carousel .slider-content').jcarousel({
|
||||
auto: 5,
|
||||
animation: 'slow',
|
||||
easing: 'jswing'
|
||||
});
|
||||
}
|
||||
|
||||
/* Static header */
|
||||
if($('.slider-wrapper').length) {
|
||||
var getHeight = $('.slider-wrapper').height() + 140;
|
||||
$('.navigation-wrapper').height(getHeight);
|
||||
}
|
||||
|
||||
if($('.slider-static').length) {
|
||||
var getHeight = $('.slider-static').height() + 80;
|
||||
$('.navigation-wrapper').height(getHeight);
|
||||
}
|
||||
|
||||
|
||||
/* Prettyphoto ---------------------------------------------------------- */
|
||||
if($("a[rel^='prettyPhoto']").length) {
|
||||
$("a[rel^='prettyPhoto']").prettyPhoto({overlay_gallery: false});
|
||||
|
||||
$("a[rel^='prettyPhoto']").each(function(){
|
||||
// Get image sizes
|
||||
if($(this).find('.portfolio-image-inner, .gallery-image-inner').length) {
|
||||
width = $(this).find('.portfolio-image-inner, .gallery-image-inner').width();
|
||||
height = $(this).find('.portfolio-image-inner, .gallery-image-inner').height();
|
||||
} else {
|
||||
width = $(this).find('img').width();
|
||||
height = $(this).find('img').height();
|
||||
}
|
||||
|
||||
// Add "prettyPhoto" class and add a hidden span
|
||||
$(this).addClass('prettyPhoto').append('<span class="zoom-frame" />');
|
||||
$(this).find('.zoom-frame').width(width).height(height);
|
||||
|
||||
// Show "frame" on hover
|
||||
$(this).hover(function() {
|
||||
$(this).find('.zoom-frame').stop(true, true).fadeIn();
|
||||
}, function() {
|
||||
$(this).find('.zoom-frame').stop(true, true).fadeOut();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* Search top ----------------------------------------------------------- */
|
||||
if($.browser.webkit) {
|
||||
$('#title-search #seachField').css({height: '30px'});
|
||||
}
|
||||
|
||||
$('#title-search #seachField')
|
||||
.animate({width: '50px'})
|
||||
.blur(function(){
|
||||
if($('#title-search #seachField').val() == '') {
|
||||
$(this).animate({width: '50px'});
|
||||
}
|
||||
});
|
||||
|
||||
$('#title-search').hover(function(){
|
||||
$('#title-search #seachField').stop(true, true).animate({width: '180px'});
|
||||
}, function() {
|
||||
if(($('#title-search #seachField').val() == '') && !($('#title-search #seachField').is(":focus"))) {
|
||||
$('#title-search #seachField').stop(true, true).animate({width: '50px'}, 'slow');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* Images preloader ----------------------------------------------------- */
|
||||
if($.browser.msie != true) {
|
||||
$("img").hide();
|
||||
$("img").fadeIn("normal");
|
||||
}
|
||||
|
||||
/* Widgets hover hint --------------------------------------------------- */
|
||||
$('.widget-hint').css({display: 'none'});
|
||||
$('.widget-hint').parent().css({position: "relative"}).hover(function() {
|
||||
$(this).find('.widget-hint').stop(true, true).fadeIn();
|
||||
}, function() {
|
||||
$(this).find('.widget-hint').stop(true, true).fadeOut();
|
||||
});
|
||||
|
||||
|
||||
/* Rounded corners for member's avatar - opera and firefox < v.4 fix ---- */
|
||||
if($.browser.opera || parseInt($.browser.mozilla) < 2){
|
||||
$('.team-member-img').each(function() {
|
||||
background = $(this).children('img').attr('src');
|
||||
$(this).children('img').remove();
|
||||
|
||||
$('<div style="width: 130px; height: 130px; margin: 5px; border-radius: 70px; -moz-border-radius: 70px; overflow: hidden; background: url(' + background + ')" />').appendTo(this);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/* Tipsy ---------------------------------------------------------------- */
|
||||
$('.social a, .social-dark a, .pager-first a, .pager-last a, .postlist-footer a').tipsy({fade: true, gravity: 'n'});
|
||||
|
||||
|
||||
/* Tabs ----------------------------------------------------------------- */
|
||||
if($(".tabs-block").length) {
|
||||
$('.tabs-block').each(function() {
|
||||
// Hide all tabs content
|
||||
$(this).find(".tabs-content").hide();
|
||||
|
||||
// Activate first tab
|
||||
$(this).find(".tabs-controller li:first").addClass("active").show();
|
||||
$(this).find(".tabs-content:first").show();
|
||||
|
||||
// Click tab and make magic
|
||||
$(this).find(".tabs-controller li").click(function() {
|
||||
// Add "active" class to the current tab and remove it from others
|
||||
$(this).addClass("active").siblings().removeClass("active");
|
||||
$(".tabs-content").hide();
|
||||
|
||||
// Get an ID of selected tab and show it
|
||||
var activeTab = $(this).find("a").attr("href");
|
||||
$(activeTab).fadeIn();
|
||||
|
||||
// Disable link click
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* Toggles -------------------------------------------------------------- */
|
||||
if($('.toggle-block').length) {
|
||||
$('.toggle-block').each(function() {
|
||||
// Hide all toggles content
|
||||
$(this).find(".toggle-content").hide();
|
||||
|
||||
// Click on toggle trigger and show the content
|
||||
$(this).find(".toggle-trigger").click(function() {
|
||||
$(this).toggleClass("active").next().stop(true, true).slideToggle('normal');
|
||||
|
||||
// Disable link click
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* Accordions ----------------------------------------------------------- */
|
||||
if($('.toggle-block').length) {
|
||||
$('.accordion-block').each(function() {
|
||||
// Hide all accordions content
|
||||
$(this).find('.accordion-content').hide();
|
||||
|
||||
// Click on accordion item trigger and show the content
|
||||
$(this).find('.accordion-trigger').click(function() {
|
||||
// On click we close all slides and removes "on" class
|
||||
$('.accordion-trigger').removeClass('active');
|
||||
$('.accordion-content').slideUp('normal');
|
||||
|
||||
// Open next to this trigger slider
|
||||
if($(this).next().is(':hidden') == true) {
|
||||
$(this).addClass('active');
|
||||
$(this).next().slideDown('normal');
|
||||
}
|
||||
|
||||
// Disable link click
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1,142 +0,0 @@
|
||||
function CurrentDate(matchFieldName, url) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
contentType:"application/json; charset=utf-8",
|
||||
url:url,
|
||||
async:false,
|
||||
data:{},
|
||||
dataType:"json",
|
||||
success:function (response) {
|
||||
$(matchFieldName).val(response);
|
||||
},
|
||||
error:function (jqXHR, textStatus) {
|
||||
$("#ctl00_statusDiv").removeClass().addClass("error");
|
||||
var msg = $.parseJSON(jqXHR.responseText).Message;
|
||||
$("#ctl00_statusDiv").html(msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function StartDate(matchFieldName, url) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
contentType:"application/json; charset=utf-8",
|
||||
url:url,
|
||||
async:false,
|
||||
data:{},
|
||||
dataType:"json",
|
||||
success:function (response) {
|
||||
$(matchFieldName).val(response);
|
||||
},
|
||||
error:function (jqXHR, textStatus) {
|
||||
$("#ctl00_statusDiv").removeClass().addClass("error");
|
||||
var msg = $.parseJSON(jqXHR.responseText).Message;
|
||||
$("#ctl00_statusDiv").html(msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function FinishDate(matchFieldName, url) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
contentType:"application/json; charset=utf-8",
|
||||
url:url,
|
||||
async:false,
|
||||
data:{},
|
||||
dataType:"json",
|
||||
success:function (response) {
|
||||
$(matchFieldName).val(response);
|
||||
},
|
||||
error:function (jqXHR, textStatus) {
|
||||
$("#ctl00_statusDiv").removeClass().addClass("error");
|
||||
var msg = $.parseJSON(jqXHR.responseText).Message;
|
||||
$("#ctl00_statusDiv").html(msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function IsUserInRoles(roles, callback) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
contentType:"application/json; charset=utf-8",
|
||||
url:roles_url,
|
||||
data:JSON.stringify({ roles:roles }),
|
||||
dataType:"json",
|
||||
success:callback,
|
||||
error:function (jqXHR, textStatus) {
|
||||
var msg = jqXHR.responseText;
|
||||
$("#toast").html(msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
function getParameterByName(name) {
|
||||
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
|
||||
var regexS = "[\\?&]" + name + "=([^&#]*)";
|
||||
var regex = new RegExp(regexS);
|
||||
var results = regex.exec(window.location.href);
|
||||
if (results == null)
|
||||
return "";
|
||||
else
|
||||
return decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||
}
|
||||
|
||||
function getUrlFilename() {
|
||||
var url = window.location.href;
|
||||
matches = url.match(/([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})/)
|
||||
if (matches == null)
|
||||
return null
|
||||
else
|
||||
return matches[1]
|
||||
}
|
||||
|
||||
function getUrlDate() {
|
||||
var url = window.location.href;
|
||||
matches = url.match(/([0-9]{2}-[a-zA-Z]{3}-[0-9]{4})/)
|
||||
if (matches == null)
|
||||
return null
|
||||
else
|
||||
return matches[1]
|
||||
}
|
||||
|
||||
Number.prototype.toAccounts = function () {
|
||||
var n = this, c = 2, d = '.', t = ',', sign = (n < 0) ? ' Cr' : ' Dr', i = parseInt(n = Math.abs(n).toFixed(c)) + '';
|
||||
|
||||
var out = (c ? d + Math.abs(n - i).toFixed(c).slice(2) : '') + sign;
|
||||
|
||||
var pos = -1;
|
||||
for (x = i.length; x >= 0; x--, pos++) {
|
||||
if (pos == 3 || ((pos % 2) == 1 && pos > 3)) {
|
||||
out = t + out;
|
||||
}
|
||||
out = i.charAt(x) + out;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function SimpleDate(dateString) {
|
||||
var date = new Date(parseInt(dateString.slice(6, -2)));
|
||||
return date.format("dd-MMM-yyyy");
|
||||
}
|
||||
|
||||
|
||||
function Login(url, csrf, username, password) {
|
||||
var csrf = $("#_csrf").val();
|
||||
var username = $("#username").val();
|
||||
var password = $("#password").val();
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
contentType:"application/json; charset=utf-8",
|
||||
url:url,
|
||||
dataType:"json",
|
||||
async:true,
|
||||
data:JSON.stringify({name:username, password:password}),
|
||||
success:function (response) {
|
||||
alert(response.myid);
|
||||
console.log("Parsed:!", response.myid);
|
||||
},
|
||||
error:function (jqXHR, textStatus) {
|
||||
alert(textStatus);
|
||||
console.log(jqXHR.statusText);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var source = new EventSource('/sse');
|
||||
source.onmessage = function(e) {
|
||||
document.body.innerHTML += e.data + '<br>';
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,253 +0,0 @@
|
||||
var Voucher = Backbone.Model.extend({
|
||||
initialize:function () {
|
||||
|
||||
if (!this.get('Journals')) {
|
||||
this.set({Journals:new Journals()});
|
||||
} else {
|
||||
this.Journals = new Journals(this.get('Journals'))
|
||||
}
|
||||
},
|
||||
// url:save_voucher_url
|
||||
url:function () {
|
||||
return document.URL;
|
||||
}
|
||||
});
|
||||
|
||||
var VoucherView = Backbone.View.extend({
|
||||
events:{
|
||||
'change #txtDate':'change_date',
|
||||
'change #txtNarration':'change_narration'
|
||||
},
|
||||
|
||||
initialize:function () {
|
||||
this.model.on('change:Code', this.codeChanged, this);
|
||||
this.model.on('change:Date', this.dateChanged, this);
|
||||
this.model.on('change:Narration', this.narrationChanged, this);
|
||||
this.model.on('change:VoucherID', this.idChanged, this);
|
||||
this.idChanged();
|
||||
},
|
||||
change_date:function (ev) {
|
||||
this.model.set({Date:$('#txtDate').val()}, {silent:true})
|
||||
},
|
||||
change_narration:function (ev) {
|
||||
this.model.set({Narration:$('#txtNarration').val()}, {silent:true})
|
||||
},
|
||||
codeChanged:function (ev) {
|
||||
$('#txtCode').val(this.model.get('Code'));
|
||||
},
|
||||
narrationChanged:function (ev) {
|
||||
$('#txtNarration').val(this.model.get('Narration'));
|
||||
},
|
||||
dateChanged:function (ev) {
|
||||
$('#txtDate').val(this.model.get('Date'));
|
||||
},
|
||||
idChanged:function (ev) {
|
||||
var isNew = (typeof this.model.get('VoucherID')) != 'undefined' ? false : true;
|
||||
if (isNew) {
|
||||
$("#btnSave").show();
|
||||
$("#btnUpdate").hide();
|
||||
$("#btnDelete").hide();
|
||||
$("#btnPost").hide();
|
||||
}
|
||||
else {
|
||||
$("#btnSave").hide();
|
||||
$("#btnUpdate").show();
|
||||
$("#btnDelete").show();
|
||||
$("#btnPost").show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var VoucherOps = Backbone.View.extend({
|
||||
events:{
|
||||
'click #btnSave':'save',
|
||||
'click #btnUpdate':'save',
|
||||
'click #btnDelete':'delete',
|
||||
'click #btnPost':'post'
|
||||
},
|
||||
save:function (ev) {
|
||||
ev.preventDefault();
|
||||
this.model.save({}, {
|
||||
wait:true,
|
||||
success:function (model, response) {
|
||||
var newModel = model.toJSON();
|
||||
var message = "Voucher with Code " + newModel.Code + " Created / Updated";
|
||||
$("#status").append('<div id="status" class="alert alert-success"><button class="close" data-dismiss="alert">×</button> <strong>Success!</strong> ' + message + '</div>');
|
||||
},
|
||||
error:showError});
|
||||
},
|
||||
delete:function (ev) {
|
||||
ev.preventDefault();
|
||||
Delete($.proxy(function () {
|
||||
this.model.clear();
|
||||
this.model.trigger("destroy");
|
||||
}, this));
|
||||
},
|
||||
post:function (ev) {
|
||||
ev.preventDefault();
|
||||
Post($.proxy(function () {
|
||||
this.model.set('Posted', true);
|
||||
}, this));
|
||||
}
|
||||
});
|
||||
|
||||
function Post(callback) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
contentType:"application/json; charset=utf-8",
|
||||
url:post_url,
|
||||
data:{},
|
||||
dataType:"json",
|
||||
success:function (response) {
|
||||
callback();
|
||||
},
|
||||
error: showError
|
||||
});
|
||||
}
|
||||
|
||||
function Delete(callback) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
contentType:"application/json; charset=utf-8",
|
||||
url:delete_url,
|
||||
data:{},
|
||||
dataType:"json",
|
||||
success:function (response) {
|
||||
callback();
|
||||
},
|
||||
error:showError
|
||||
});
|
||||
}
|
||||
|
||||
function backboneRoles(roles) {
|
||||
IsUserInRoles(roles, function (response) {
|
||||
var permissions = new Perms();
|
||||
$.each(response, function (index, row) {
|
||||
if (row.Role == 'EditPosted') {
|
||||
permissions.set('EditPosted', row.Allowed)
|
||||
} else if (row.Role == 'PostTransactions') {
|
||||
permissions.set('PostTransactions', row.Allowed)
|
||||
} else if (row.Role.substr(-7) === ' Delete') {
|
||||
permissions.set('Delete', row.Allowed)
|
||||
} else if (row.Role.substr(-7) === ' Create') {
|
||||
permissions.set('Create', row.Allowed)
|
||||
} else if (row.Role.substr(-7) === ' Update') {
|
||||
permissions.set('Update', row.Allowed)
|
||||
} else {
|
||||
permissions.set(row.Role, row.Allowed)
|
||||
}
|
||||
})
|
||||
window.perms.set(permissions.toJSON());
|
||||
});
|
||||
}
|
||||
|
||||
var Perms = Backbone.Model.extend({
|
||||
defaults:{
|
||||
"EditPosted":false,
|
||||
"PostTransactions":false,
|
||||
"Delete":false,
|
||||
"Create":false,
|
||||
"Update":false
|
||||
}
|
||||
});
|
||||
|
||||
var RolesView = Backbone.View.extend({
|
||||
initialize:function () {
|
||||
this.perms = this.options.perms;
|
||||
this.voucher = this.options.voucher;
|
||||
this.perms.on('change', this.rolesUpdated, this);
|
||||
this.voucher.on('change:VoucherID', this.rolesUpdated, this);
|
||||
this.voucher.on('change:Posted', this.rolesUpdated, this);
|
||||
},
|
||||
|
||||
rolesUpdated:function (ev) {
|
||||
function buttonShow(button, value) {
|
||||
if (value) {
|
||||
button.removeAttr('disabled');
|
||||
}
|
||||
else {
|
||||
button.attr('disabled', 'disabled');
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
var isNew = (typeof this.voucher.get('VoucherID')) != 'undefined' ? false : true;
|
||||
var posted = (typeof this.voucher.get('Posted')) == 'undefined' ? false : this.voucher.get('Posted');
|
||||
|
||||
$("#btnPost").attr("value", posted ? 'Posted' : 'Post');
|
||||
|
||||
|
||||
if (isNew || posted || !this.perms.get('PostTransactions')) {
|
||||
var postButton = false;
|
||||
} else {
|
||||
var postButton = true;
|
||||
}
|
||||
buttonShow($("#btnPost"), postButton);
|
||||
|
||||
if (!isNew || !this.perms.get('Create')) {
|
||||
var saveButton = false;
|
||||
} else {
|
||||
var saveButton = true;
|
||||
}
|
||||
buttonShow($("#btnSave"), saveButton);
|
||||
|
||||
if (isNew || !this.perms.get('Update')) {
|
||||
var updateButton = false;
|
||||
} else if (posted && !this.perms.get('EditPosted')) {
|
||||
var updateButton = false;
|
||||
} else {
|
||||
var updateButton = true;
|
||||
}
|
||||
buttonShow($("#btnUpdate"), updateButton);
|
||||
|
||||
if (isNew || !this.perms.get('Delete')) {
|
||||
var deleteButton = false;
|
||||
} else if (posted && !this.perms.get('EditPosted')) {
|
||||
var deleteButton = false;
|
||||
} else {
|
||||
var deleteButton = true;
|
||||
}
|
||||
buttonShow($("#btnDelete"), deleteButton);
|
||||
}
|
||||
});
|
||||
|
||||
function showError(jqXHR, response) {
|
||||
$("#status").append('<div id="status" class="alert alert-error"><button class="close" data-dismiss="alert">×</button> <strong>Error!</strong> ' + response.responseText + '</div>');
|
||||
}
|
||||
|
||||
function showSimpleError(error) {
|
||||
$("#status").append('<div id="status" class="alert alert-error"><button class="close" data-dismiss="alert">×</button> <strong>Error!</strong> ' + error + '</div>');
|
||||
}
|
||||
|
||||
var ShowAmountBox = Backbone.View.extend({
|
||||
events:{
|
||||
'dblclick td.Editable':'show',
|
||||
'dblclick input.Editable':'hide'
|
||||
},
|
||||
show:function (ev) {
|
||||
ev.preventDefault();
|
||||
var cid = $(ev.target).closest("tr").attr("id");
|
||||
var model = this.collection.getByCid(cid);
|
||||
var $input = $('<input type="text" data-column="' + $(ev.target).data("column") + '" class="Editable" autocomplete="off" />');
|
||||
$input.attr("placeholder", model.get($(ev.target).data("column")));
|
||||
$(ev.target).html($input);
|
||||
$(ev.target).toggleClass('Editable');
|
||||
},
|
||||
hide:function (ev) {
|
||||
ev.preventDefault();
|
||||
var cid = $(ev.target).closest("tr").attr("id");
|
||||
var model = this.collection.getByCid(cid);
|
||||
var originalValue = model.get($(ev.target).data("column"));
|
||||
var newValue = $(ev.target).val();
|
||||
if (newValue != "" && newValue != originalValue) {
|
||||
var column = $(ev.target).data("column");
|
||||
var ob = {};
|
||||
ob[column] = newValue;
|
||||
model.set(ob);
|
||||
} else {
|
||||
$(ev.target).closest("td").toggleClass('Editable');
|
||||
$(ev.target).replaceWith(originalValue);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
from pyramid.events import BeforeRender, subscriber, NewRequest
|
||||
from brewman import helpers
|
||||
|
||||
from pyramid.renderers import get_renderer
|
||||
|
||||
@subscriber(BeforeRender)
|
||||
def add_renderer_globals(event):
|
||||
event['h'] = helpers
|
||||
|
||||
|
||||
#@subscriber(BeforeRender)
|
||||
#def add_base_template(event):
|
||||
# base = get_renderer('brewman:templates/base.mako').implementation()
|
||||
# event.update({'base': base})
|
||||
|
||||
from pyramid.events import subscriber, NewRequest
|
||||
|
||||
@subscriber(NewRequest)
|
||||
def csrf_validation(event):
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
<%inherit file="base.mako"/>
|
||||
<%block name="content">
|
||||
<section class="page-content">
|
||||
<header class="header-404">
|
||||
<h2>404</h2>
|
||||
<h3 class="ribbon-404">It looks like that page you were looking has been lost, sorry.</h3>
|
||||
</header>
|
||||
</section>
|
||||
<!-- /Page content -->
|
||||
</%block>
|
||||
@@ -8,56 +8,54 @@
|
||||
<meta name="author" content="">
|
||||
|
||||
<!-- Le styles -->
|
||||
${h.CssLink(request, 'style.css')}
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/css/style.css"/>
|
||||
<style type="text/css">
|
||||
body {
|
||||
padding-top: 60px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
</style>
|
||||
${h.CssLink(request, 'bootstrap-responsive.css')}
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/css/bootstrap-responsive.css"/>
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/css/jquery-ui-1.8.16.custom.css"/>
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/css/spinner.css"/>
|
||||
|
||||
${h.CssLink(request, 'jquery-ui-1.8.16.custom.css')}
|
||||
<script src="/js/jquery-1.7.1.min.js"> </script>
|
||||
<script src="/js/jquery-ui-1.8.17.custom.min.js"> </script>
|
||||
<script src="/js/bootstrap.js"> </script>
|
||||
|
||||
${h.CssLink(request, 'spinner.css')}
|
||||
<script src="/js/angular-1.0.2.js"> </script>
|
||||
<script src="/js/angular-resource-1.0.2.js"> </script>
|
||||
|
||||
${h.JsLink(request, 'jquery-1.7.1.min.js')}
|
||||
${h.JsLink(request, 'jquery-ui-1.8.17.custom.min.js')}
|
||||
${h.JsLink(request, 'bootstrap.js')}
|
||||
<script src="/script/overlord.js"> </script>
|
||||
<script src="/script/angular_directive.js"> </script>
|
||||
<script src="/script/angular_filter.js"> </script>
|
||||
<script src="/script/angular_service.js"> </script>
|
||||
<script src="/script/login.js"> </script>
|
||||
|
||||
${h.JsLink(request, 'angular-1.0.1.js')}
|
||||
${h.JsLink(request, 'angular-resource-1.0.1.js')}
|
||||
<script src="/script/journal.js"> </script>
|
||||
<script src="/script/payment.js"> </script>
|
||||
<script src="/script/receipt.js"> </script>
|
||||
<script src="/script/purchase.js"> </script>
|
||||
<script src="/script/issue.js"> </script>
|
||||
|
||||
${h.ScriptLink(request, 'overlord.js')}
|
||||
${h.ScriptLink(request, 'angular_directive.js')}
|
||||
${h.ScriptLink(request, 'angular_filter.js')}
|
||||
${h.ScriptLink(request, 'angular_service.js')}
|
||||
${h.ScriptLink(request, 'session.js')}
|
||||
<script src="/script/ledger.js"> </script>
|
||||
<script src="/script/product-ledger.js"> </script>
|
||||
<script src="/script/trial-balance.js"> </script>
|
||||
<script src="/script/closing-stock.js"> </script>
|
||||
<script src="/script/profit-loss.js"> </script>
|
||||
<script src="/script/purchase-entries.js"> </script>
|
||||
<script src="/script/cash-flow.js"> </script>
|
||||
<script src="/script/raw-material-cost.js"> </script>
|
||||
<script src="/script/daybook.js"> </script>
|
||||
<script src="/script/unposted.js"> </script>
|
||||
|
||||
${h.ScriptLink(request, 'journal.js')}
|
||||
${h.ScriptLink(request, 'payment.js')}
|
||||
${h.ScriptLink(request, 'receipt.js')}
|
||||
${h.ScriptLink(request, 'purchase.js')}
|
||||
${h.ScriptLink(request, 'issue.js')}
|
||||
|
||||
${h.ScriptLink(request, 'ledger.js')}
|
||||
${h.ScriptLink(request, 'product-ledger.js')}
|
||||
${h.ScriptLink(request, 'trial-balance.js')}
|
||||
${h.ScriptLink(request, 'closing-stock.js')}
|
||||
${h.ScriptLink(request, 'profit-loss.js')}
|
||||
${h.ScriptLink(request, 'purchase-entries.js')}
|
||||
${h.ScriptLink(request, 'cash-flow.js')}
|
||||
${h.ScriptLink(request, 'raw-material-cost.js')}
|
||||
${h.ScriptLink(request, 'daybook.js')}
|
||||
${h.ScriptLink(request, 'unposted.js')}
|
||||
|
||||
${h.ScriptLink(request, 'account.js')}
|
||||
${h.ScriptLink(request, 'employee.js')}
|
||||
${h.ScriptLink(request, 'user.js')}
|
||||
${h.ScriptLink(request, 'group.js')}
|
||||
${h.ScriptLink(request, 'cost-center.js')}
|
||||
${h.ScriptLink(request, 'product.js')}
|
||||
${h.ScriptLink(request, 'product-group.js')}
|
||||
<script src="/script/account.js"> </script>
|
||||
<script src="/script/employee.js"> </script>
|
||||
<script src="/script/user.js"> </script>
|
||||
<script src="/script/group.js"> </script>
|
||||
<script src="/script/cost-center.js"> </script>
|
||||
<script src="/script/product.js"> </script>
|
||||
<script src="/script/product-group.js"> </script>
|
||||
|
||||
<!-- Le fav and touch icons -->
|
||||
<link rel="shortcut icon" href="${request.static_url('brewman:static/img/favicon.ico')}">
|
||||
@@ -73,7 +71,7 @@
|
||||
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-fixed-top">
|
||||
<div class="navbar navbar-fixed-top" ng-controller="BaseCtrl">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
@@ -87,19 +85,101 @@
|
||||
<ul class="nav">
|
||||
<li class="active"><a href="${request.route_url('home')}"><i class="icon-home"></i> Home</a></li>
|
||||
</ul>
|
||||
${h.voucher_menu(request) | n }
|
||||
${h.report_menu(request) | n }
|
||||
${h.entry_menu(request) | n }
|
||||
${h.employee_menu(request) | n }
|
||||
${h.master_menu(request) | n }
|
||||
${h.login_menu(request) | n }
|
||||
<ul class="nav">
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Voucher Entry <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/Journal">Journal</a></li>
|
||||
<li><a href="/Purchase">Purchase</a></li>
|
||||
<li><a href="/PurchaseReturn">Purchase Return</a></li>
|
||||
<li><a href="/Payment">Payment</a></li>
|
||||
<li><a href="/Receipt">Receipt</a></li>
|
||||
<li><a href="/Issue">Issue</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav">
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Reports <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/Ledger">Display Ledger</a></li>
|
||||
<li><a href="/ProductLedger">Product Ledger</a></li>
|
||||
<li><a href="/CashFlow">Cash Flow</a></li>
|
||||
<li><a href="/Daybook">Day Book</a></li>
|
||||
<li><a href="">Purchases</a>
|
||||
<ul>
|
||||
<li><a href="/RawMaterialCost">Raw Material Cost</a></li>
|
||||
<li><a href="/PurchaseEntries">Purchase Entries</a></li>
|
||||
<li><a href="/ClosingStock">Closing Stock</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="">Final Reports</a>
|
||||
<ul>
|
||||
<li><a href="/TrialBalance">Trail Balance</a></li>
|
||||
<li><a href="/ProfitLoss">Profit and Loss</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav">
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Entries <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/Unposted">UnPosted Entries</a></li>
|
||||
<li><a href="/AccountsTesting/Reports/Entries.aspx">Latest Entries</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav">
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Employees <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/Employees">Employees</a></li>
|
||||
<li><a href="/Attendance">Attendance</a></li>
|
||||
<li><a href="/Employee/Attendance">Employee Attendance</a></li>
|
||||
<li><a href="/AccountsTesting/Employees/AttendanceRecord.aspx">Attendance Record</a></li>
|
||||
<li><a href="/AccountsTesting/Employees/SalarySheet.aspx">Salary Sheet</a></li>
|
||||
<li><a href="/AccountsTesting/Employees/CreditSalary.aspx">Credit Salary</a></li>
|
||||
<li><a href="/AccountsTesting/Employees/CreditEsiPf.aspx">Credit Esi Pf</a></li>
|
||||
<li><a href="/AccountsTesting/Employees/ImportFingerprint.aspx">Finger Print</a></li>
|
||||
<li><a href="/AccountsTesting/Employees/PaymentSheet.aspx">Employee Payment Sheet</a></li>
|
||||
<li><a href="/features/elements.html">Display Salary Sheet</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav">
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Masters <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/Accounts">Accounts</a></li>
|
||||
<li><a href="/CostCenters">Cost Centers</a></li>
|
||||
<li><a href="/Products">Products</a></li>
|
||||
<li><a href="/ProductGroups">Product Groups</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav pull-right">
|
||||
<li class="dropdown" ng-hide="!auth.isAuthenticated"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user"></i> {{auth.Name}} <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/logout">Logout {{user.name}}</a></li>
|
||||
<li><a href="/AccountsTesting/Security/ChangePassword.aspx">Change Password</a></li>
|
||||
<li><a href="/Users">Users</a></li>
|
||||
<li><a href="/Groups">Groups</a></li>
|
||||
<li><a href="/AccountsTesting/Maintenance/Split.aspx">Split Data</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown" ng-hide="auth.isAuthenticated"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user"></i> User <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/login">Log in</a></li>
|
||||
<li><a href="/Users">Users</a></li>
|
||||
<li><a href="/Groups">Groups</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container" ng-controller="BaseCtrl">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div id="status" class="span4 offset4">
|
||||
<div ng-repeat="toast in toasts" class="alert alert-{{toast.Type | lowercase}}" fadey>
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
<%inherit file="../base.mako"/>
|
||||
<%block name="content">
|
||||
<div class="row">
|
||||
<h2>Login</h2>
|
||||
<form action="${request.route_url('login')}" method="post" autocomplete="off" class="form-horizontal">
|
||||
${h.CsrfToken(request.session)}
|
||||
${h.HiddenInput('came_from', value=came_from)}
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="username">Username</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="username" id="username" required placeholder="Username" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="password">Password</label>
|
||||
<div class="controls">
|
||||
<input type="password" name="password" id="password" required placeholder="Password" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="forgot"></label>
|
||||
<div class="controls">
|
||||
<span id="forgot">Forgot <a href="#">Username</a> / <a href="#">Password</a></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="submit" id="log_in" class="btn btn-primary">Login</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</%block>
|
||||
@@ -1,103 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" ng-app="overlord">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>${title}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<!-- Le styles -->
|
||||
${h.CssLink(request, 'style.css')}
|
||||
<style type="text/css">
|
||||
body {
|
||||
padding-top: 60px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
</style>
|
||||
${h.CssLink(request, 'bootstrap-responsive.css')}
|
||||
|
||||
${h.CssLink(request, 'jquery-ui-1.8.16.custom.css')}
|
||||
|
||||
${h.JsLink(request, 'jquery-1.7.1.min.js')}
|
||||
${h.JsLink(request, 'jquery-ui-1.8.17.custom.min.js')}
|
||||
${h.JsLink(request, 'bootstrap.js')}
|
||||
${h.JsLink(request, 'angular-1.0.1.js')}
|
||||
${h.JsLink(request, 'angular-resource-1.0.1.js')}
|
||||
|
||||
<script type="text/javascript">
|
||||
roles_url = '${request.route_url('is_user_in_roles')}';
|
||||
role_url = '${request.route_url('is_user_in_role', id = '')}';
|
||||
</script>
|
||||
|
||||
${h.ScriptLink(request, 'autocomplete.js')}
|
||||
${h.ScriptLink(request, 'session.js')}
|
||||
|
||||
<%block name="header" />
|
||||
|
||||
<!-- Le fav and touch icons -->
|
||||
<link rel="shortcut icon" href="${request.static_url('brewman:static/img/favicon.ico')}">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="144x144"
|
||||
href="${request.static_url('brewman:static/img/apple-touch-icon-144-precomposed.png')}">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="114x114"
|
||||
href="${request.static_url('brewman:static/img/apple-touch-icon-114-precomposed.png')}">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="72x72"
|
||||
href="${request.static_url('brewman:static/img/apple-touch-icon-72-precomposed.png')}">
|
||||
<link rel="apple-touch-icon-precomposed"
|
||||
href="${request.static_url('brewman:static/img/apple-touch-icon-57-precomposed.png')}">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
<a class="brand" href="#">Hops n Grains</a>
|
||||
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li class="active"><a href="${request.route_url('home')}"><i class="icon-home"></i> Home</a></li>
|
||||
</ul>
|
||||
${h.voucher_menu(request) | n }
|
||||
${h.report_menu(request) | n }
|
||||
${h.entry_menu(request) | n }
|
||||
${h.employee_menu(request) | n }
|
||||
${h.master_menu(request) | n }
|
||||
${h.login_menu(request) | n }
|
||||
</div>
|
||||
<!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container" ng-controller="BaseCtrl">
|
||||
<div class="row">
|
||||
<div id="status" class="span4 offset4">
|
||||
<div ng-repeat="toast in toasts" class="alert alert-{{toast.Type | lowercase}}" fadey>
|
||||
<button class="close" ng-click="clearToast(toast)">×</button>
|
||||
<strong>{{toast.Type}}!</strong> {{toast.Message}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%block name="content"/>
|
||||
${self.body()}
|
||||
<hr>
|
||||
|
||||
<footer>
|
||||
<p>© Company 2012</p>
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
<!-- /container -->
|
||||
|
||||
<!-- Le javascript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,16 +0,0 @@
|
||||
<ul class="nav">
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Employees <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="${request.route_url('employee_list')}">Employees</a></li>
|
||||
<li><a href="${request.route_url('attendance')}">Attendance</a></li>
|
||||
<li><a href="${request.route_url('employee_attendance')}">Employee Attendance</a></li>
|
||||
<li><a href="/AccountsTesting/Employees/AttendanceRecord.aspx">Attendance Record</a></li>
|
||||
<li><a href="/AccountsTesting/Employees/SalarySheet.aspx">Salary Sheet</a></li>
|
||||
<li><a href="/AccountsTesting/Employees/CreditSalary.aspx">Credit Salary</a></li>
|
||||
<li><a href="/AccountsTesting/Employees/CreditEsiPf.aspx">Credit Esi Pf</a></li>
|
||||
<li><a href="/AccountsTesting/Employees/ImportFingerprint.aspx">Finger Print</a></li>
|
||||
<li><a href="/AccountsTesting/Employees/PaymentSheet.aspx">Employee Payment Sheet</a></li>
|
||||
<li><a href="${request.static_url('brewman:static/features/elements.html')}">Display Salary Sheet</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1,8 +0,0 @@
|
||||
<ul class="nav">
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Entries <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="${request.route_url('unposted')}">UnPosted Entries</a></li>
|
||||
<li><a href="/AccountsTesting/Reports/Entries.aspx">Latest Entries</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1,20 +0,0 @@
|
||||
<ul class="nav pull-right">
|
||||
<li tal:condition="user" class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user"></i> ${user.name} <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="${request.route_url('logout')}">Logout ${user.name}</a></li>
|
||||
<li><a href="/AccountsTesting/Security/ChangePassword.aspx">Change Password</a></li>
|
||||
<li><a href="${request.route_url('user_list')}">Users</a></li>
|
||||
<li><a href="${request.route_url('group_list')}">Groups</a></li>
|
||||
<li><a href="/AccountsTesting/Maintenance/Split.aspx">Split Data</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
<li tal:condition="not user" class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user"></i> User <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="${request.route_url('login')}">Log in</a></li>
|
||||
<li><a href="${request.route_url('user_list')}">Users</a></li>
|
||||
<li><a href="${request.route_url('group_list')}">Groups</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1,10 +0,0 @@
|
||||
<ul class="nav">
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Masters <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="${request.route_url('account_list')}">Accounts</a></li>
|
||||
<li><a href="${request.route_url('cost_center_list')}">Cost Centers</a></li>
|
||||
<li><a href="${request.route_url('product_list')}">Products</a></li>
|
||||
<li><a href="${request.route_url('product_group_list')}">Product Groups</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1,26 +0,0 @@
|
||||
<ul class="nav">
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Reports <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="${request.route_url('ledger')}">Display Ledger</a></li>
|
||||
<li><a href="${request.route_url('product_ledger')}">Product Ledger</a></li>
|
||||
<li><a href="${request.route_url('cash_flow')}">Cash Flow</a></li>
|
||||
<li><a href="${request.route_url('daybook')}">Day Book</a></li>
|
||||
<li><a href="">Purchases</a>
|
||||
<ul>
|
||||
<li><a href="${request.route_url('raw_material_cost')}">Raw Material Cost</a></li>
|
||||
<li><a href="${request.route_url('purchase_entries')}">Purchase Entries</a></li>
|
||||
## <li><a href="/AccountsTesting/Reports/Purchases/Purchases.aspx">Purchases</a></li>
|
||||
## <li><a href="/AccountsTesting/Reports/Purchases/PurchaseLedger.aspx">Purchase Ledger</a></li>
|
||||
<li><a href="${request.route_url('closing_stock')}">Closing Stock</a></li>
|
||||
## <li><a href="/AccountsTesting/Reports/Inventory/Main.aspx">Inventory Report</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="">Final Reports</a>
|
||||
<ul>
|
||||
<li><a href="${request.route_url('trial_balance')}">Trail Balance</a></li>
|
||||
<li><a href="${request.route_url('profit_loss')}">Profit and Loss</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1,14 +0,0 @@
|
||||
<ul class="nav">
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Voucher Entry <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="${request.route_url('journal')}">Journal</a></li>
|
||||
<li><a href="${request.route_url('purchase')}">Purchase</a></li>
|
||||
<li><a href="${request.route_url('purchase_return')}">Purchase Return</a></li>
|
||||
<li><a href="${request.route_url('payment')}">Payment</a></li>
|
||||
<li><a href="${request.route_url('receipt')}">Receipt</a></li>
|
||||
<li><a href="${request.route_url('issue')}">Issue</a></li>
|
||||
## <li><a href="/AccountsTesting/Transaction/VerificationNew.aspx">Verification</a></li>
|
||||
## <li><a href="/AccountsTesting/Transaction/InputSale.aspx">Input Sale</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -4,11 +4,12 @@ import uuid
|
||||
from pyramid.view import view_config
|
||||
|
||||
@view_config(route_name='home', renderer='brewman:templates/angular_base.mako')
|
||||
@view_config(request_method='GET', route_name='login', renderer='brewman:templates/angular_base.mako',
|
||||
xhr=False)
|
||||
def home(request):
|
||||
return {}
|
||||
|
||||
|
||||
|
||||
class DecimalAsFloatHack(float):
|
||||
def __init__(self, d):
|
||||
self.d = d
|
||||
|
||||
@@ -6,7 +6,6 @@ from pyramid.security import authenticated_userid
|
||||
from pyramid.view import view_config
|
||||
from sqlalchemy.sql.expression import or_
|
||||
import transaction
|
||||
from brewman.helpers import Literal
|
||||
|
||||
from brewman.models import DBSession
|
||||
from brewman.models.master import CostCenter, Employee, AttendanceType
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import uuid
|
||||
from pyramid.decorator import reify
|
||||
|
||||
from brewman.models.auth import User
|
||||
|
||||
from pyramid.renderers import render
|
||||
from pyramid.security import authenticated_userid
|
||||
|
||||
def report_menu(request):
|
||||
return render('brewman:templates/nav_bar/report.mako', {'request': request})
|
||||
|
||||
def voucher_menu(request):
|
||||
return render('brewman:templates/nav_bar/voucher.mako', {'request': request})
|
||||
|
||||
def entry_menu(request):
|
||||
return render('brewman:templates/nav_bar/entry.pt', {'request': request})
|
||||
|
||||
def employee_menu(request):
|
||||
return render('brewman:templates/nav_bar/employee.pt', {'request': request})
|
||||
|
||||
def master_menu(request):
|
||||
return render('brewman:templates/nav_bar/master.mako', {'request': request})
|
||||
|
||||
def login_menu(request):
|
||||
user_id = authenticated_userid(request)
|
||||
if user_id == None:
|
||||
user = None
|
||||
else:
|
||||
user = User.get_by_id(uuid.UUID(user_id))
|
||||
return render('brewman:templates/nav_bar/login.pt', {'request': request, 'user': user})
|
||||
@@ -1,70 +1,18 @@
|
||||
import os
|
||||
|
||||
from pyramid.httpexceptions import HTTPNotFound, HTTPFound, HTTPForbidden
|
||||
from pyramid.response import Response, FileResponse
|
||||
from pyramid.security import remember, forget
|
||||
from pyramid.httpexceptions import HTTPFound
|
||||
from pyramid.response import FileResponse
|
||||
from pyramid.security import forget
|
||||
from pyramid.view import view_config
|
||||
|
||||
from brewman.models.auth import User
|
||||
|
||||
|
||||
@view_config(context=HTTPNotFound, renderer='brewman:templates/404.mako')
|
||||
def not_found(request):
|
||||
return {'title': '404',
|
||||
'pageclass': "page-404 skin-9",
|
||||
'pagecontentclass': "page-content",
|
||||
'top_block': "",
|
||||
'page_header': ''}
|
||||
|
||||
|
||||
@view_config(context=HTTPForbidden, renderer='brewman:templates/auth/login.mako')
|
||||
@view_config(route_name='login', renderer='brewman:templates/auth/login.mako')
|
||||
def login_submit(request):
|
||||
login_url = request.route_url('login')
|
||||
referrer = request.url
|
||||
if referrer == login_url:
|
||||
referrer = request.route_url('home') # never use the login form itself as came_from
|
||||
came_from = referrer
|
||||
if request.method == 'POST':
|
||||
if request.POST['came_from'] != '':
|
||||
came_from = request.POST['came_from']
|
||||
|
||||
username = request.POST['username']
|
||||
password = request.POST['password']
|
||||
|
||||
found, user = User.auth(username, password)
|
||||
if found:
|
||||
headers = remember(request, str(user.id))
|
||||
return HTTPFound(location=came_from, headers=headers)
|
||||
return {'title': 'Login',
|
||||
'pageclass': "page-gallery skin-7",
|
||||
'pagecontentclass': "page-content",
|
||||
'page_header': '',
|
||||
'came_from': came_from}
|
||||
|
||||
|
||||
@view_config(route_name='logout')
|
||||
def logout(request):
|
||||
request.session.invalidate()
|
||||
request.session.flash('Logged out successfully.')
|
||||
headers = forget(request)
|
||||
return HTTPFound(location=request.route_url('home'), headers=headers)
|
||||
|
||||
|
||||
@view_config(request_method='POST', route_name='login', renderer='json', xhr=True)
|
||||
def login_ajax(request):
|
||||
username = request.json_body['name']
|
||||
password = request.json_body['password']
|
||||
|
||||
found, user = User.auth(username, password)
|
||||
if found:
|
||||
headers = remember(request, str(user.id))
|
||||
request.session.flash('Logged in successfully.')
|
||||
return HTTPFound(location=request.route_url('home'), headers=headers)
|
||||
else:
|
||||
return Response('name ' + username + ' Login Failure ' + password)
|
||||
|
||||
|
||||
@view_config(route_name='favicon')
|
||||
def favicon(request):
|
||||
here = os.path.dirname(__file__)
|
||||
|
||||
@@ -19,11 +19,13 @@ def get_html(request):
|
||||
|
||||
@view_config(request_method='GET', route_name='closing_stock', renderer='json', xhr=True)
|
||||
def report_blank(request):
|
||||
print('getting closing stock')
|
||||
return {'Date': services_session_period_finish(request), 'Body': []}
|
||||
|
||||
|
||||
@view_config(request_method='GET', route_name='closing_stock_date', renderer='json', xhr=True)
|
||||
def report_data(request):
|
||||
print('getting closing stock date')
|
||||
date = request.matchdict.get('date', None)
|
||||
return {'Date': date, 'Body': build_report(date)}
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
from datetime import date, timedelta
|
||||
import json
|
||||
from pyramid.security import authenticated_userid
|
||||
import uuid
|
||||
from pyramid.httpexceptions import HTTPFound
|
||||
from pyramid.response import Response
|
||||
from pyramid.security import authenticated_userid, remember
|
||||
|
||||
from pyramid.view import view_config
|
||||
from brewman.models.auth import Role
|
||||
from brewman.models.auth import Role, User
|
||||
from brewman.views.transactions import session_current_date
|
||||
|
||||
@view_config(route_name='services_session_current_date', renderer='json', xhr=True)
|
||||
@@ -47,14 +50,39 @@ def is_user_in_roles(request):
|
||||
return roles
|
||||
|
||||
|
||||
@view_config(route_name='user_permissions', renderer='json', xhr=True)
|
||||
@view_config(route_name='auth', renderer='json', xhr=True)
|
||||
def user_permission(request):
|
||||
user_id = authenticated_userid(request)
|
||||
session_perms = request.session['perms'] if user_id else []
|
||||
if user_id is None:
|
||||
auth = {'isAuthenticated': False, 'perms': {}}
|
||||
else:
|
||||
user = User.get_by_id(uuid.UUID(user_id))
|
||||
auth = {'isAuthenticated': True, 'Name': user.name}
|
||||
session_perms = request.session['perms']
|
||||
perms = {}
|
||||
for item in Role.list():
|
||||
perms[item.name] = True if item.name in session_perms else False
|
||||
return perms
|
||||
auth['perms'] = perms
|
||||
return auth
|
||||
|
||||
|
||||
@view_config(request_method='POST', route_name='login', renderer='json')
|
||||
def login(request):
|
||||
username = request.POST['username']
|
||||
password = request.POST['password']
|
||||
login_url = request.route_url('login')
|
||||
referrer = request.url
|
||||
if referrer == login_url:
|
||||
referrer = request.route_url('home') # never use the login form itself as came_from
|
||||
came_from = referrer
|
||||
found, user = User.auth(username, password)
|
||||
if found:
|
||||
headers = remember(request, str(user.id))
|
||||
return HTTPFound(location=came_from, headers=headers)
|
||||
else:
|
||||
response = Response("Login failed")
|
||||
response.status_int = 500
|
||||
return response
|
||||
|
||||
|
||||
def get_first_day(dt, d_years=0, d_months=0):
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from datetime import date
|
||||
from pyramid.view import view_config
|
||||
from brewman.helpers import Literal
|
||||
|
||||
|
||||
@view_config(request_method='GET', route_name='journal_id', renderer='brewman:templates/angular_base.mako',
|
||||
|
||||
@@ -8,7 +8,6 @@ from pyramid.response import Response
|
||||
from pyramid.security import authenticated_userid
|
||||
from pyramid.view import view_config
|
||||
|
||||
from brewman.helpers import Literal
|
||||
|
||||
from brewman.models import DBSession
|
||||
from brewman.models.auth import User
|
||||
|
||||
Reference in new issue
Block a user