Changed the toasts to Growl notifications which floats.

This commit is contained in:
Tanshu 2013-05-17 23:56:48 +05:30
parent ec45880dea
commit 867935306d
5 changed files with 278 additions and 200 deletions

View File

@ -1,6 +1,6 @@
CACHE MANIFEST
# version 2013-05-16.1
# version 2013-05-17.1
CACHE:
/partial/404.html
@ -82,6 +82,7 @@ CACHE:
/script/employee-functions.js
/script/employee.js
/script/group.js
/script/growl-service.js
/script/issue.js
/script/journal.js
/script/ledger.js

View File

@ -3,17 +3,17 @@
var overlord_directive = angular.module('overlord.directive', []);
overlord_directive.directive('ngAutocomplete', ['$q', '$parse', 'DeepLabel', function ($q, $parse, DeepLabel) {
return {
restrict:'A',
link:function (scope, element, attrs, ngModel) {
restrict: 'A',
link: function (scope, element, attrs, ngModel) {
var labels = [],
mapped = {},
deepLabel = DeepLabel;
element.typeahead({
source:function (query, process) {
source: function (query, process) {
var Entity = angular.injector(['overlord.service']).get(attrs.resource);
Entity.autocomplete({term:query, count:20}, function (result) {
Entity.autocomplete({term: query, count: 20}, function (result) {
labels = [];
mapped = {};
$.each(result, function (i, item) {
@ -24,12 +24,12 @@ overlord_directive.directive('ngAutocomplete', ['$q', '$parse', 'DeepLabel', fun
process(labels)
});
},
minLength:1,
items:20,
matcher:function (item) {
return true;
minLength: 1,
items: 20,
matcher: function (item) {
return true;
},
updater:function (item) {
updater: function (item) {
var model = $parse(attrs.model);
var modelSetter = model.assign;
modelSetter(scope, mapped[item]);
@ -43,16 +43,16 @@ overlord_directive.directive('ngAutocomplete', ['$q', '$parse', 'DeepLabel', fun
overlord_directive.directive('datepicker', ['$parse', function ($parse) {
return {
restrict:'E',
replace:true,
transclude:true,
template:'<input type="text" />',
link:function (scope, element, attrs) {
restrict: 'E',
replace: true,
transclude: true,
template: '<input type="text" />',
link: function (scope, element, attrs) {
element.datepicker({
dateFormat:'dd-M-yy',
showOtherMonths:true,
selectOtherMonths:true,
onSelect:function (dateText, inst) {
dateFormat: 'dd-M-yy',
showOtherMonths: true,
selectOtherMonths: true,
onSelect: function (dateText, inst) {
var model = $parse(attrs.model);
var modelSetter = model.assign;
modelSetter(scope, dateText);
@ -65,8 +65,8 @@ overlord_directive.directive('datepicker', ['$parse', function ($parse) {
overlord_directive.directive('fadey', function () {
return {
restrict:'A',
link:function (scope, element, attrs) {
restrict: 'A',
link: function (scope, element, attrs) {
var duration = 500;
element = jQuery(element);
element.hide();
@ -86,8 +86,8 @@ overlord_directive.directive('fadey', function () {
overlord_directive.directive('ngConfirm', ['modal', '$parse', function (modal, $parse) {
return {
restrict:'A',
link:function postLink(scope, element, attrs) {
restrict: 'A',
link: function postLink(scope, element, attrs) {
// Could have custom or boostrap modal options here
var options = {};
if (typeof attrs.url !== 'undefined') {
@ -102,8 +102,8 @@ overlord_directive.directive('ngConfirm', ['modal', '$parse', function (modal, $
});
} else {
element.bind("click", function () {
var actionButton = {text:attrs["actionButtonText"], click:attrs["actionFunction"], class:attrs['class']};
var cancelButton = {text:attrs["cancelButtonText"], click:attrs["cancelFunction"]};
var actionButton = {text: attrs["actionButtonText"], click: attrs["actionFunction"], class: attrs['class']};
var cancelButton = {text: attrs["cancelButtonText"], click: attrs["cancelFunction"]};
modal.confirm(attrs["title"], attrs["actionText"], actionButton, cancelButton, scope, options);
});
}
@ -118,10 +118,10 @@ overlord_directive.directive('ngConfirm', ['modal', '$parse', function (modal, $
* an ng-switch element in the dom, e.g. between ul and li.
*/
var ngIfDirective = {
transclude:'element',
priority:1000,
terminal:true,
compile:function (element, attr, linker) {
transclude: 'element',
priority: 1000,
terminal: true,
compile: function (element, attr, transclude) {
return function (scope, iterStartElement, attr) {
iterStartElement[0].doNotMove = true;
var expression = attr.ngmIf;
@ -135,7 +135,7 @@ overlord_directive.directive('ngConfirm', ['modal', '$parse', function (modal, $
lastScope && lastScope.$destroy();
if (newValue) {
lastScope = scope.$new();
linker(lastScope, function (clone) {
transclude(lastScope, function (clone) {
lastElement = clone;
iterStartElement.after(clone);
});
@ -155,14 +155,14 @@ overlord_directive.directive('ngConfirm', ['modal', '$parse', function (modal, $
overlord_directive.directive('journal-edit', function () {
return {
restrict:'A',
replace:true,
transclude:true,
templateUrl:'/partial/journal-modal.html',
link:function (scope, element, attrs) {
restrict: 'A',
replace: true,
transclude: true,
templateUrl: '/partial/journal-modal.html',
link: function (scope, element, attrs) {
element.bind("click", function () {
var actionButton = {text:attrs["actionButtonText"], click:attrs["actionFunction"], class:attrs['class']};
var cancelButton = {text:attrs["cancelButtonText"], click:attrs["cancelFunction"]};
var actionButton = {text: attrs["actionButtonText"], click: attrs["actionFunction"], class: attrs['class']};
var cancelButton = {text: attrs["cancelButtonText"], click: attrs["cancelFunction"]};
modal.confirm(attrs["title"], attrs["actionText"], actionButton, cancelButton, scope, options);
});
}
@ -171,8 +171,8 @@ overlord_directive.directive('journal-edit', function () {
overlord_directive.directive('ngEditRepeat', ['modal', '$parse', function (modal, $parse) {
return {
restrict:'E',
template:'' +
restrict: 'E',
template: '' +
'<div class="btn-group">' +
' <a class="btn btn-danger" ng-click="removeJournal(journal)"><i class="icon-trash icon-white"></i> Delete</a>' +
' <a class="btn btn-danger dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>' +
@ -181,7 +181,7 @@ overlord_directive.directive('ngEditRepeat', ['modal', '$parse', function (modal
' </ul>' +
'</div>',
link:function postLink(scope, element, attrs) {
link: function postLink(scope, element, attrs) {
// Could have custom or boostrap modal options here
var options = {};
if (typeof attrs.url !== 'undefined') {
@ -196,8 +196,8 @@ overlord_directive.directive('ngEditRepeat', ['modal', '$parse', function (modal
});
} else {
element.bind("click", function () {
var actionButton = {text:attrs["actionButtonText"], click:attrs["actionFunction"], class:attrs['class']};
var cancelButton = {text:attrs["cancelButtonText"], click:attrs["cancelFunction"]};
var actionButton = {text: attrs["actionButtonText"], click: attrs["actionFunction"], class: attrs['class']};
var cancelButton = {text: attrs["cancelButtonText"], click: attrs["cancelFunction"]};
modal.confirm(attrs["title"], attrs["actionText"], actionButton, cancelButton, scope, options);
});
}
@ -205,3 +205,15 @@ overlord_directive.directive('ngEditRepeat', ['modal', '$parse', function (modal
};
}]);
overlord_directive.directive('ngGrowl', ['growl', '$parse', function (growl, $parse) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var options = {
dismiss_function: attrs["toClose"]
};
growl.show(element, scope, options);
}
};
}]);

View File

@ -0,0 +1,64 @@
'use strict';
overlord_service.factory('growl', ['$http', '$compile', '$timeout', function ($http, $compile, $timeout) {
var growl = {};
growl.default_options = {
offset: {
from: "top",
amount: 20
},
align: "right",
width: 250,
duration:500,
delay: 4000,
stackup_spacing: 10
};
growl.show = function (element, scope, options) {
var options = jQuery.extend({}, growl.default_options, options);
if (options.top_offset) {
options.offset = {
from: "top",
amount: options.top_offset
};
}
var offsetAmount = options.offset.amount;
jQuery(".bootstrap-growl").each(function (index) {
var offset = parseInt($(this).css(options.offset.from)) + $(this).outerHeight() + options.stackup_spacing;
if (isNaN(offset)) {
offset = 0;
}
return offsetAmount = Math.max(offsetAmount, offset);
});
element.css("position", "fixed");
element.css("margin", 0);
element.css("z-index", "9999");
element.css("display", "none");
element.css(options.offset.from, offsetAmount + "px");
if (options.width !== "auto") {
element.css("width", options.width + "px");
}
switch (options.align) {
case "center":
element.css("left", "50%");
element.css("margin-left", "-" + (element.outerWidth() / 2) + "px");
break;
case "left":
element.css("left", "20px");
break;
default:
element.css("right", "20px");
}
element.fadeIn(options.duration);
if (options.delay > 0) {
$timeout(function () {
element.fadeOut(options.duration, function() {
scope.$eval(options.dismiss_function);
});
}, options.delay);
}
return element;
};
return growl;
}])
;

View File

@ -2,137 +2,137 @@
var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filter', 'overlord.service', 'ngCookies'])
.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
$routeProvider.
when('/', {templateUrl:'/partial/home.html'}).
when('/login', {templateUrl:'/partial/login.html', controller:LoginCtrl}).
when('/logout', {templateUrl:'/partial/home.html', controller:LogoutCtrl}).
$routeProvider.
when('/', {templateUrl: '/partial/home.html'}).
when('/login', {templateUrl: '/partial/login.html', controller: LoginCtrl}).
when('/logout', {templateUrl: '/partial/home.html', controller: LogoutCtrl}).
when('/Journal', {templateUrl:'/partial/journal.html', controller:JournalCtrl, resolve:JournalCtrl.resolve}).
when('/Journal/:id', {templateUrl:'/partial/journal.html', controller:JournalCtrl, resolve:JournalCtrl.resolve}).
when('/Journal', {templateUrl: '/partial/journal.html', controller: JournalCtrl, resolve: JournalCtrl.resolve}).
when('/Journal/:id', {templateUrl: '/partial/journal.html', controller: JournalCtrl, resolve: JournalCtrl.resolve}).
when('/Payment', {templateUrl:'/partial/payment.html', controller:PaymentCtrl, resolve:PaymentCtrl.resolve}).
when('/Payment/:id', {templateUrl:'/partial/payment.html', controller:PaymentCtrl, resolve:PaymentCtrl.resolve}).
when('/Payment', {templateUrl: '/partial/payment.html', controller: PaymentCtrl, resolve: PaymentCtrl.resolve}).
when('/Payment/:id', {templateUrl: '/partial/payment.html', controller: PaymentCtrl, resolve: PaymentCtrl.resolve}).
when('/Receipt', {templateUrl:'/partial/receipt.html', controller:ReceiptCtrl, resolve:ReceiptCtrl.resolve}).
when('/Receipt/:id', {templateUrl:'/partial/receipt.html', controller:ReceiptCtrl, resolve:ReceiptCtrl.resolve}).
when('/Receipt', {templateUrl: '/partial/receipt.html', controller: ReceiptCtrl, resolve: ReceiptCtrl.resolve}).
when('/Receipt/:id', {templateUrl: '/partial/receipt.html', controller: ReceiptCtrl, resolve: ReceiptCtrl.resolve}).
when('/Purchase', {templateUrl:'/partial/purchase.html', controller:PurchaseCtrl, resolve:PurchaseCtrl.resolve}).
when('/Purchase/:id', {templateUrl:'/partial/purchase.html', controller:PurchaseCtrl, resolve:PurchaseCtrl.resolve}).
when('/Purchase', {templateUrl: '/partial/purchase.html', controller: PurchaseCtrl, resolve: PurchaseCtrl.resolve}).
when('/Purchase/:id', {templateUrl: '/partial/purchase.html', controller: PurchaseCtrl, resolve: PurchaseCtrl.resolve}).
when('/Return', {templateUrl:'/partial/purchase-return.html', controller:PurchaseReturnCtrl, resolve:PurchaseReturnCtrl.resolve}).
when('/Return/:id', {templateUrl:'/partial/purchase-return.html', controller:PurchaseReturnCtrl, resolve:PurchaseReturnCtrl.resolve}).
when('/Return', {templateUrl: '/partial/purchase-return.html', controller: PurchaseReturnCtrl, resolve: PurchaseReturnCtrl.resolve}).
when('/Return/:id', {templateUrl: '/partial/purchase-return.html', controller: PurchaseReturnCtrl, resolve: PurchaseReturnCtrl.resolve}).
when('/Issue', {templateUrl:'/partial/issue.html', controller:IssueCtrl, resolve:IssueCtrl.resolve}).
when('/Issue/:id', {templateUrl:'/partial/issue.html', controller:IssueCtrl, resolve:IssueCtrl.resolve}).
when('/Issue', {templateUrl: '/partial/issue.html', controller: IssueCtrl, resolve: IssueCtrl.resolve}).
when('/Issue/:id', {templateUrl: '/partial/issue.html', controller: IssueCtrl, resolve: IssueCtrl.resolve}).
when('/SalaryDeduction', {templateUrl:'/partial/salary-deduction.html', controller:SalaryDeductionCtrl, resolve:SalaryDeductionCtrl.resolve}).
when('/SalaryDeduction/:id', {templateUrl:'/partial/salary-deduction.html', controller:SalaryDeductionCtrl, resolve:SalaryDeductionCtrl.resolve}).
when('/SalaryDeduction', {templateUrl: '/partial/salary-deduction.html', controller: SalaryDeductionCtrl, resolve: SalaryDeductionCtrl.resolve}).
when('/SalaryDeduction/:id', {templateUrl: '/partial/salary-deduction.html', controller: SalaryDeductionCtrl, resolve: SalaryDeductionCtrl.resolve}).
when('/Ledger', {templateUrl:'/partial/ledger.html', controller:LedgerCtrl, resolve:LedgerCtrl.resolve}).
when('/Ledger/:id', {templateUrl:'/partial/ledger.html', controller:LedgerCtrl, resolve:LedgerCtrl.resolve}).
when('/Ledger', {templateUrl: '/partial/ledger.html', controller: LedgerCtrl, resolve: LedgerCtrl.resolve}).
when('/Ledger/:id', {templateUrl: '/partial/ledger.html', controller: LedgerCtrl, resolve: LedgerCtrl.resolve}).
when('/ProductLedger', {templateUrl:'/partial/product-ledger.html', controller:ProductLedgerCtrl, resolve:ProductLedgerCtrl.resolve}).
when('/ProductLedger/:id', {templateUrl:'/partial/product-ledger.html', controller:ProductLedgerCtrl, resolve:ProductLedgerCtrl.resolve}).
when('/ProductLedger', {templateUrl: '/partial/product-ledger.html', controller: ProductLedgerCtrl, resolve: ProductLedgerCtrl.resolve}).
when('/ProductLedger/:id', {templateUrl: '/partial/product-ledger.html', controller: ProductLedgerCtrl, resolve: ProductLedgerCtrl.resolve}).
when('/CashFlow', {templateUrl:'/partial/cash-flow.html', controller:CashFlowCtrl, resolve:CashFlowCtrl.resolve}).
when('/CashFlow/:id', {templateUrl:'/partial/cash-flow.html', controller:CashFlowCtrl, resolve:CashFlowCtrl.resolve}).
when('/CashFlow', {templateUrl: '/partial/cash-flow.html', controller: CashFlowCtrl, resolve: CashFlowCtrl.resolve}).
when('/CashFlow/:id', {templateUrl: '/partial/cash-flow.html', controller: CashFlowCtrl, resolve: CashFlowCtrl.resolve}).
when('/RawMaterialCost', {templateUrl:'/partial/raw-material-cost.html', controller:RawMaterialCostCtrl, resolve:RawMaterialCostCtrl.resolve}).
when('/RawMaterialCost/:id', {templateUrl:'/partial/raw-material-cost-detail.html', controller:RawMaterialCostCtrl, resolve:RawMaterialCostCtrl.resolve}).
when('/RawMaterialCost', {templateUrl: '/partial/raw-material-cost.html', controller: RawMaterialCostCtrl, resolve: RawMaterialCostCtrl.resolve}).
when('/RawMaterialCost/:id', {templateUrl: '/partial/raw-material-cost-detail.html', controller: RawMaterialCostCtrl, resolve: RawMaterialCostCtrl.resolve}).
when('/Attendance', {templateUrl:'/partial/attendance.html', controller:AttendanceCtrl, resolve:AttendanceCtrl.resolve}).
when('/Attendance/:date', {templateUrl:'/partial/attendance.html', controller:AttendanceCtrl, resolve:AttendanceCtrl.resolve}).
when('/Attendance', {templateUrl: '/partial/attendance.html', controller: AttendanceCtrl, resolve: AttendanceCtrl.resolve}).
when('/Attendance/:date', {templateUrl: '/partial/attendance.html', controller: AttendanceCtrl, resolve: AttendanceCtrl.resolve}).
when('/EmployeeAttendance', {templateUrl:'/partial/employee-attendance.html', controller:EmployeeAttendanceCtrl, resolve:EmployeeAttendanceCtrl.resolve}).
when('/EmployeeAttendance/:id', {templateUrl:'/partial/employee-attendance.html', controller:EmployeeAttendanceCtrl, resolve:EmployeeAttendanceCtrl.resolve}).
when('/EmployeeAttendance', {templateUrl: '/partial/employee-attendance.html', controller: EmployeeAttendanceCtrl, resolve: EmployeeAttendanceCtrl.resolve}).
when('/EmployeeAttendance/:id', {templateUrl: '/partial/employee-attendance.html', controller: EmployeeAttendanceCtrl, resolve: EmployeeAttendanceCtrl.resolve}).
when('/Daybook', {templateUrl:'/partial/daybook.html', controller:DaybookCtrl, resolve:DaybookCtrl.resolve}).
when('/Unposted', {templateUrl:'/partial/unposted.html', controller:UnpostedCtrl, resolve:UnpostedCtrl.resolve}).
when('/ProfitLoss', {templateUrl:'/partial/profit-loss.html', controller:ProfitLossCtrl, resolve:ProfitLossCtrl.resolve}).
when('/PurchaseEntries', {templateUrl:'/partial/purchase-entries.html', controller:PurchaseEntriesCtrl, resolve:PurchaseEntriesCtrl.resolve}).
when('/EmployeeFunctions', {templateUrl:'/partial/employee-functions.html', controller:EmployeeFunctionsCtrl}).
when('/Daybook', {templateUrl: '/partial/daybook.html', controller: DaybookCtrl, resolve: DaybookCtrl.resolve}).
when('/Unposted', {templateUrl: '/partial/unposted.html', controller: UnpostedCtrl, resolve: UnpostedCtrl.resolve}).
when('/ProfitLoss', {templateUrl: '/partial/profit-loss.html', controller: ProfitLossCtrl, resolve: ProfitLossCtrl.resolve}).
when('/PurchaseEntries', {templateUrl: '/partial/purchase-entries.html', controller: PurchaseEntriesCtrl, resolve: PurchaseEntriesCtrl.resolve}).
when('/EmployeeFunctions', {templateUrl: '/partial/employee-functions.html', controller: EmployeeFunctionsCtrl}).
when('/TrialBalance', {templateUrl:'/partial/trial-balance.html', controller:TrialBalanceCtrl, resolve:TrialBalanceCtrl.resolve}).
when('/TrialBalance/:date', {templateUrl:'/partial/trial-balance.html', controller:TrialBalanceCtrl, resolve:TrialBalanceCtrl.resolve}).
when('/TrialBalance', {templateUrl: '/partial/trial-balance.html', controller: TrialBalanceCtrl, resolve: TrialBalanceCtrl.resolve}).
when('/TrialBalance/:date', {templateUrl: '/partial/trial-balance.html', controller: TrialBalanceCtrl, resolve: TrialBalanceCtrl.resolve}).
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('/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, resolve:AccountListCtrl.resolve}).
when('/Account', {templateUrl:'/partial/account-detail.html', controller:AccountCtrl, resolve:AccountCtrl.resolve}).
when('/Account/:id', {templateUrl:'/partial/account-detail.html', controller:AccountCtrl, resolve:AccountCtrl.resolve}).
when('/Accounts', {templateUrl: '/partial/account-list.html', controller: AccountListCtrl, resolve: AccountListCtrl.resolve}).
when('/Account', {templateUrl: '/partial/account-detail.html', controller: AccountCtrl, resolve: AccountCtrl.resolve}).
when('/Account/:id', {templateUrl: '/partial/account-detail.html', controller: AccountCtrl, resolve: AccountCtrl.resolve}).
when('/Employees', {templateUrl:'/partial/employee-list.html', controller:EmployeeListCtrl, resolve:EmployeeListCtrl.resolve}).
when('/Employee', {templateUrl:'/partial/employee-detail.html', controller:EmployeeCtrl, resolve:EmployeeCtrl.resolve}).
when('/Employee/:id', {templateUrl:'/partial/employee-detail.html', controller:EmployeeCtrl, resolve:EmployeeCtrl.resolve}).
when('/Employees', {templateUrl: '/partial/employee-list.html', controller: EmployeeListCtrl, resolve: EmployeeListCtrl.resolve}).
when('/Employee', {templateUrl: '/partial/employee-detail.html', controller: EmployeeCtrl, resolve: EmployeeCtrl.resolve}).
when('/Employee/:id', {templateUrl: '/partial/employee-detail.html', controller: EmployeeCtrl, resolve: EmployeeCtrl.resolve}).
when('/CostCenters', {templateUrl:'/partial/cost-center-list.html', controller:CostCenterListCtrl, resolve:CostCenterListCtrl.resolve}).
when('/CostCenter', {templateUrl:'/partial/cost-center-detail.html', controller:CostCenterCtrl, resolve:CostCenterCtrl.resolve}).
when('/CostCenter/:id', {templateUrl:'/partial/cost-center-detail.html', controller:CostCenterCtrl, resolve:CostCenterCtrl.resolve}).
when('/CostCenters', {templateUrl: '/partial/cost-center-list.html', controller: CostCenterListCtrl, resolve: CostCenterListCtrl.resolve}).
when('/CostCenter', {templateUrl: '/partial/cost-center-detail.html', controller: CostCenterCtrl, resolve: CostCenterCtrl.resolve}).
when('/CostCenter/:id', {templateUrl: '/partial/cost-center-detail.html', controller: CostCenterCtrl, resolve: CostCenterCtrl.resolve}).
when('/Products', {templateUrl:'/partial/product-list.html', controller:ProductListCtrl, resolve:ProductListCtrl.resolve}).
when('/Product', {templateUrl:'/partial/product-detail.html', controller:ProductCtrl, resolve:ProductCtrl.resolve}).
when('/Product/:id', {templateUrl:'/partial/product-detail.html', controller:ProductCtrl, resolve:ProductCtrl.resolve}).
when('/Products', {templateUrl: '/partial/product-list.html', controller: ProductListCtrl, resolve: ProductListCtrl.resolve}).
when('/Product', {templateUrl: '/partial/product-detail.html', controller: ProductCtrl, resolve: ProductCtrl.resolve}).
when('/Product/:id', {templateUrl: '/partial/product-detail.html', controller: ProductCtrl, resolve: ProductCtrl.resolve}).
when('/ProductGroups', {templateUrl:'/partial/product-group-list.html', controller:ProductGroupListCtrl, resolve:ProductGroupListCtrl.resolve}).
when('/ProductGroup', {templateUrl:'/partial/product-group-detail.html', controller:ProductGroupCtrl, resolve:ProductGroupCtrl.resolve}).
when('/ProductGroup/:id', {templateUrl:'/partial/product-group-detail.html', controller:ProductGroupCtrl, resolve:ProductGroupCtrl.resolve}).
when('/ProductGroups', {templateUrl: '/partial/product-group-list.html', controller: ProductGroupListCtrl, resolve: ProductGroupListCtrl.resolve}).
when('/ProductGroup', {templateUrl: '/partial/product-group-detail.html', controller: ProductGroupCtrl, resolve: ProductGroupCtrl.resolve}).
when('/ProductGroup/:id', {templateUrl: '/partial/product-group-detail.html', controller: ProductGroupCtrl, resolve: ProductGroupCtrl.resolve}).
when('/Users', {templateUrl:'/partial/user-list.html', controller:UserListCtrl, resolve:UserListCtrl.resolve}).
when('/User', {templateUrl:'/partial/user-detail.html', controller:UserCtrl, resolve:UserCtrl.resolve}).
when('/User/:id', {templateUrl:'/partial/user-detail.html', controller:UserCtrl, resolve:UserCtrl.resolve}).
when('/Users', {templateUrl: '/partial/user-list.html', controller: UserListCtrl, resolve: UserListCtrl.resolve}).
when('/User', {templateUrl: '/partial/user-detail.html', controller: UserCtrl, resolve: UserCtrl.resolve}).
when('/User/:id', {templateUrl: '/partial/user-detail.html', controller: UserCtrl, resolve: UserCtrl.resolve}).
when('/Groups', {templateUrl:'/partial/group-list.html', controller:GroupListCtrl, resolve:GroupListCtrl.resolve}).
when('/Group', {templateUrl:'/partial/group-detail.html', controller:GroupCtrl, resolve:GroupCtrl.resolve}).
when('/Group/:id', {templateUrl:'/partial/group-detail.html', controller:GroupCtrl, resolve:GroupCtrl.resolve}).
when('/Groups', {templateUrl: '/partial/group-list.html', controller: GroupListCtrl, resolve: GroupListCtrl.resolve}).
when('/Group', {templateUrl: '/partial/group-detail.html', controller: GroupCtrl, resolve: GroupCtrl.resolve}).
when('/Group/:id', {templateUrl: '/partial/group-detail.html', controller: GroupCtrl, resolve: GroupCtrl.resolve}).
when('/Clients', {templateUrl:'/partial/client-list.html', controller:ClientCtrl, resolve:ClientCtrl.resolve}).
when('/Clients', {templateUrl: '/partial/client-list.html', controller: ClientCtrl, resolve: ClientCtrl.resolve}).
otherwise({templateUrl:'/partial/404.html'});
$locationProvider.html5Mode(true).hashPrefix('!');
}])
otherwise({templateUrl: '/partial/404.html'});
$locationProvider.html5Mode(true).hashPrefix('!');
}])
.config(['$httpProvider', function ($httpProvider) {
$httpProvider.responseInterceptors.push('spinnerInterceptor');
var spinnerFunction = function (data, headersGetter) {
var scope = angular.injector(['ng']).get('$rootScope'),
headers = headersGetter(),
isResourceRequest = headers['Content-Type'] === "application/json";
$httpProvider.responseInterceptors.push('spinnerInterceptor');
var spinnerFunction = function (data, headersGetter) {
var scope = angular.injector(['ng']).get('$rootScope'),
headers = headersGetter(),
isResourceRequest = headers['Content-Type'] === "application/json";
if (isResourceRequest && scope) {
scope.$broadcast('spinnerStart', 'http');
}
return data;
};
$httpProvider.defaults.transformRequest.push(spinnerFunction);
}])
if (isResourceRequest && scope) {
scope.$broadcast('spinnerStart', 'http');
}
return data;
};
$httpProvider.defaults.transformRequest.push(spinnerFunction);
}])
.factory('spinnerInterceptor', ['$q', '$rootScope', function ($q, $rootScope) {
return function (promise) {
return promise.then(function (response) {
var headers = response.headers(),
isResourceResponse = headers['content-type'] === "application/json; charset=utf-8";
if (isResourceResponse) {
$rootScope.$broadcast('spinnerStop', 'http');
}
return response;
return function (promise) {
return promise.then(function (response) {
var headers = response.headers(),
isResourceResponse = headers['content-type'] === "application/json; charset=utf-8";
if (isResourceResponse) {
$rootScope.$broadcast('spinnerStop', 'http');
}
return response;
}, function (response) {
var headers = response.headers(),
isResourceResponse = headers['content-type'] === "application/json; charset=utf-8";
if (isResourceResponse) {
$rootScope.$broadcast('spinnerStop', 'http');
}
var status = response.status;
if (status == 401 && !isResourceResponse) {
$rootScope.$broadcast('event:loginRequired');
}
// otherwise
return $q.reject(response);
});
};
}]);
}, function (response) {
var headers = response.headers(),
isResourceResponse = headers['content-type'] === "application/json; charset=utf-8";
if (isResourceResponse) {
$rootScope.$broadcast('spinnerStop', 'http');
}
var status = response.status;
if (status == 401 && !isResourceResponse) {
$rootScope.$broadcast('event:loginRequired');
}
// otherwise
return $q.reject(response);
});
};
}]);
overlord.controller('BaseCtrl', ['$rootScope', '$scope', 'Auth', '$location', '$routeParams', function ($rootScope, $scope, Auth, $location, $routeParams) {
$rootScope.spinner = {http:0, route:false};
$rootScope.spinner = {http: 0, route: false};
$rootScope.$on('event:loginRequired', function () {
if ($rootScope.auth.isAuthenticated) {
$location.path('/');
@ -141,7 +141,7 @@ overlord.controller('BaseCtrl', ['$rootScope', '$scope', 'Auth', '$location', '$
if (typeof came_from === 'undefined' && $location.path() !== '/login') {
came_from = $location.path();
}
$location.path('/login').search({came_from:came_from});
$location.path('/login').search({came_from: came_from});
}
});
@ -168,10 +168,7 @@ overlord.controller('BaseCtrl', ['$rootScope', '$scope', 'Auth', '$location', '$
$scope.clearToast = function (item) {
var idx = $scope.toasts.indexOf(item);
if (idx !== -1) {
//injected into repeater scope by fadey directive
this.destroy(function () {
$scope.toasts.splice(idx, 1);
});
$scope.toasts.splice(idx, 1);
}
};

View File

@ -19,51 +19,52 @@
<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"/>
<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>
<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>
<script src="/js/angular-1.0.2.js"> </script>
<script src="/js/angular-resource-1.0.2.js"> </script>
<script src="/js/angular-cookies-1.0.2.js"> </script>
<script src="/js/angular-1.0.2.js"></script>
<script src="/js/angular-resource-1.0.2.js"></script>
<script src="/js/angular-cookies-1.0.2.js"></script>
<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/modal-service.js"> </script>
<script src="/script/login.js"> </script>
<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/modal-service.js"></script>
<script src="/script/growl-service.js"></script>
<script src="/script/login.js"></script>
<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/purchase-return.js"> </script>
<script src="/script/issue.js"> </script>
<script src="/script/salary-deduction.js"> </script>
<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/purchase-return.js"></script>
<script src="/script/issue.js"></script>
<script src="/script/salary-deduction.js"></script>
<script src="/script/employee-attendance.js"> </script>
<script src="/script/employee-functions.js"> </script>
<script src="/script/attendance.js"> </script>
<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>
<script src="/script/employee-attendance.js"></script>
<script src="/script/employee-functions.js"></script>
<script src="/script/attendance.js"></script>
<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>
<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/client.js"> </script>
<script src="/script/cost-center.js"> </script>
<script src="/script/product.js"> </script>
<script src="/script/product-group.js"> </script>
<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/client.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="/favicon.ico">
@ -90,7 +91,8 @@
<li class="active"><a href="/"><i class="icon-home"></i> Home</a></li>
</ul>
<ul class="nav">
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Voucher Entry <b class="caret"></b></a>
<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>
@ -102,7 +104,8 @@
</li>
</ul>
<ul class="nav">
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Reports <b class="caret"></b></a>
<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>
@ -125,7 +128,8 @@
</li>
</ul>
<ul class="nav">
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Entries <b class="caret"></b></a>
<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>
@ -133,7 +137,8 @@
</li>
</ul>
<ul class="nav">
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Employees <b class="caret"></b></a>
<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>
@ -147,7 +152,8 @@
</li>
</ul>
<ul class="nav">
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Masters <b class="caret"></b></a>
<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>
@ -157,7 +163,9 @@
</li>
</ul>
<ul class="nav pull-right">
<li class="dropdown" ng-show="auth.isAuthenticated"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user"></i> {{auth.Name}} <b class="caret"></b></a>
<li class="dropdown" ng-show="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 {{auth.Name}}</a></li>
<li><a href="/User/{{auth.Name}}">Change Password</a></li>
@ -179,13 +187,9 @@
</div>
<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>
<button class="close" ng-click="clearToast(toast)">×</button>
<strong>{{toast.Type}}!</strong> {{toast.Message}}
</div>
</div>
<div class="bootstrap-growl alert alert-{{toast.Type | lowercase}}" ng-repeat="toast in toasts" ng-growl
to-close="clearToast(toast)">
<strong>{{toast.Type}}!</strong> {{toast.Message}}
</div>
<div id="spinner" class="row span4 offset4">