Change double quotes into single quotes.
This commit is contained in:
parent
ebaf33845a
commit
27fad84f66
@ -19,25 +19,36 @@
|
|||||||
|
|
||||||
accountantApp
|
accountantApp
|
||||||
|
|
||||||
.factory("Account", ["$resource", function($resource) {
|
.factory('Account', ['$resource', function($resource) {
|
||||||
var Account = $resource(
|
var Account = $resource(
|
||||||
"/api/account/:id", {
|
'/api/account/:id', {
|
||||||
id: "@id"
|
id: '@id'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
Account.prototype.getSolds = function() {
|
Account.prototype.getSolds = function() {
|
||||||
var Solds = $resource("/api/account/:id/solds", {id: this.id});
|
var Solds = $resource('/api/account/:id/solds', {id: this.id});
|
||||||
|
|
||||||
this.solds = Solds.get();
|
this.solds = Solds.get();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Account.prototype.getBalance = function(begin, end) {
|
||||||
|
var Balance = $resource(
|
||||||
|
'/api/account/:id/balance', {
|
||||||
|
id: this.id,
|
||||||
|
begin: begin.format('YYYY-MM-DD'),
|
||||||
|
end: end.format('YYYY-MM-DD')
|
||||||
|
});
|
||||||
|
|
||||||
|
this.balance = Balance.get();
|
||||||
|
};
|
||||||
|
|
||||||
return Account;
|
return Account;
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.controller(
|
.controller(
|
||||||
"AccountController", [
|
'AccountController', [
|
||||||
"$scope", "Account", "Notification",
|
'$scope', 'Account', 'Notification',
|
||||||
function($scope, Account, Notification) {
|
function($scope, Account, Notification) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -50,9 +61,9 @@ accountantApp
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(account.current <account.authorized_overdraft) {
|
if(account.current <account.authorized_overdraft) {
|
||||||
return "danger";
|
return 'danger';
|
||||||
} else if(account.current < 0) {
|
} else if(account.current < 0) {
|
||||||
return "warning";
|
return 'warning';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -65,9 +76,9 @@ accountantApp
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(value < account.authorized_overdraft) {
|
if(value < account.authorized_overdraft) {
|
||||||
return "text-danger";
|
return 'text-danger';
|
||||||
} else if(value < 0) {
|
} else if(value < 0) {
|
||||||
return "text-warning";
|
return 'text-warning';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -123,7 +134,7 @@ accountantApp
|
|||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
Notification.success("Account #" + data.id + " saved.");
|
Notification.success('Account #' + data.id + ' saved.');
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
@ -136,11 +147,11 @@ accountantApp
|
|||||||
var id = account.id;
|
var id = account.id;
|
||||||
|
|
||||||
bootbox.confirm(
|
bootbox.confirm(
|
||||||
"Voulez-vous supprimer le compte \"" + account.name + "\" ?",
|
'Voulez-vous supprimer le compte \\\'' + account.name + '\\\' ?',
|
||||||
function(result) {
|
function(result) {
|
||||||
if(result) {
|
if(result) {
|
||||||
account.$delete().then(function() {
|
account.$delete().then(function() {
|
||||||
Notification.success("Account #" + id + " deleted.");
|
Notification.success('Account #' + id + ' deleted.');
|
||||||
|
|
||||||
// Remove account from array.
|
// Remove account from array.
|
||||||
$scope.accounts.splice($index, 1);
|
$scope.accounts.splice($index, 1);
|
||||||
|
@ -19,36 +19,36 @@
|
|||||||
|
|
||||||
accountantApp
|
accountantApp
|
||||||
|
|
||||||
.factory("Operation", [ "$resource", function($resource) {
|
.factory('Operation', [ '$resource', function($resource) {
|
||||||
return $resource(
|
return $resource(
|
||||||
"/api/operation/:id", {
|
'/api/operation/:id', {
|
||||||
id: "@id"
|
id: '@id'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.factory("OHLC", [ "$resource", "$routeParams",
|
.factory('OHLC', [ '$resource', '$routeParams',
|
||||||
function($resource, $routeParams) {
|
function($resource, $routeParams) {
|
||||||
return $resource(
|
return $resource(
|
||||||
"/api/account/:account_id/ohlc", {
|
'/api/account/:account_id/ohlc', {
|
||||||
account_id: $routeParams.accountId
|
account_id: $routeParams.accountId
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.factory("Category", [ "$resource", "$routeParams",
|
.factory('Category', [ '$resource', '$routeParams',
|
||||||
function($resource, $routeParams) {
|
function($resource, $routeParams) {
|
||||||
return $resource(
|
return $resource(
|
||||||
"/api/account/:account_id/category", {
|
'/api/account/:account_id/category', {
|
||||||
account_id: $routeParams.accountId
|
account_id: $routeParams.accountId
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.factory("Balance", [ "$resource", "$routeParams",
|
.factory('Balance', [ '$resource', '$routeParams',
|
||||||
function($resource, $routeParams) {
|
function($resource, $routeParams) {
|
||||||
return $resource(
|
return $resource(
|
||||||
"/api/account/:account_id/balance", {
|
'/api/account/:account_id/balance', {
|
||||||
account_id: $routeParams.accountId
|
account_id: $routeParams.accountId
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -58,8 +58,8 @@ accountantApp
|
|||||||
* Controller for category chart.
|
* Controller for category chart.
|
||||||
*/
|
*/
|
||||||
.controller(
|
.controller(
|
||||||
"CategoryChartController", [
|
'CategoryChartController', [
|
||||||
"$rootScope", "$scope", "$http", "Category", "Balance",
|
'$rootScope', '$scope', '$http', 'Category', 'Balance',
|
||||||
function($rootScope, $scope, $http, Category, Balance) {
|
function($rootScope, $scope, $http, Category, Balance) {
|
||||||
|
|
||||||
var colors = Highcharts.getOptions().colors;
|
var colors = Highcharts.getOptions().colors;
|
||||||
@ -90,14 +90,14 @@ accountantApp
|
|||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
title: {
|
title: {
|
||||||
text: "Categories"
|
text: 'Categories'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
text: "Répartition dépenses/recettes"
|
text: 'Répartition dépenses/recettes'
|
||||||
},
|
},
|
||||||
series: [{
|
series: [{
|
||||||
name: "Value",
|
name: 'Value',
|
||||||
data: [],
|
data: [],
|
||||||
innerSize: '33%',
|
innerSize: '33%',
|
||||||
size: '60%',
|
size: '60%',
|
||||||
@ -108,7 +108,7 @@ accountantApp
|
|||||||
distance: -40
|
distance: -40
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: "Value",
|
name: 'Value',
|
||||||
data: [],
|
data: [],
|
||||||
innerSize: '66%',
|
innerSize: '66%',
|
||||||
size: '60%',
|
size: '60%',
|
||||||
@ -165,20 +165,20 @@ accountantApp
|
|||||||
*/
|
*/
|
||||||
$scope.getBalance = function(begin, end) {
|
$scope.getBalance = function(begin, end) {
|
||||||
Balance.get({
|
Balance.get({
|
||||||
begin: begin.format("YYYY-MM-DD"),
|
begin: begin.format('YYYY-MM-DD'),
|
||||||
end: end.format("YYYY-MM-DD")
|
end: end.format('YYYY-MM-DD')
|
||||||
}, function(balance) {
|
}, function(balance) {
|
||||||
// Update pie chart subtitle with Balance.
|
// Update pie chart subtitle with Balance.
|
||||||
$scope.config.subtitle = {
|
$scope.config.subtitle = {
|
||||||
text: "Balance: " + balance.balance
|
text: 'Balance: ' + balance.balance
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.config.series[0].data = [{
|
$scope.config.series[0].data = [{
|
||||||
name: "Revenues",
|
name: 'Revenues',
|
||||||
y: balance.revenues,
|
y: balance.revenues,
|
||||||
color: $scope.revenueColor
|
color: $scope.revenueColor
|
||||||
}, {
|
}, {
|
||||||
name: "Expenses",
|
name: 'Expenses',
|
||||||
y: -balance.expenses,
|
y: -balance.expenses,
|
||||||
color: $scope.expenseColor,
|
color: $scope.expenseColor,
|
||||||
}];
|
}];
|
||||||
@ -186,7 +186,7 @@ accountantApp
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Reload categories and account status on range selection.
|
// Reload categories and account status on range selection.
|
||||||
$rootScope.$on("rangeSelectedEvent", function(e, args) {
|
$rootScope.$on('rangeSelectedEvent', function(e, args) {
|
||||||
$scope.load(args.begin, args.end);
|
$scope.load(args.begin, args.end);
|
||||||
$scope.getBalance(args.begin, args.end);
|
$scope.getBalance(args.begin, args.end);
|
||||||
});
|
});
|
||||||
@ -196,8 +196,8 @@ accountantApp
|
|||||||
* Controller for the sold chart.
|
* Controller for the sold chart.
|
||||||
*/
|
*/
|
||||||
.controller(
|
.controller(
|
||||||
"SoldChartController", [
|
'SoldChartController', [
|
||||||
"$rootScope", "$scope", "$http", "OHLC",
|
'$rootScope', '$scope', '$http', 'OHLC',
|
||||||
function($rootScope, $scope, $http, OHLC) {
|
function($rootScope, $scope, $http, OHLC) {
|
||||||
// Configure chart for operations.
|
// Configure chart for operations.
|
||||||
$scope.config = {
|
$scope.config = {
|
||||||
@ -209,22 +209,22 @@ accountantApp
|
|||||||
buttons: [{
|
buttons: [{
|
||||||
type: 'month',
|
type: 'month',
|
||||||
count: 1,
|
count: 1,
|
||||||
text: "1m"
|
text: '1m'
|
||||||
}, {
|
}, {
|
||||||
type: "month",
|
type: 'month',
|
||||||
count: 3,
|
count: 3,
|
||||||
text: "3m"
|
text: '3m'
|
||||||
}, {
|
}, {
|
||||||
type: "month",
|
type: 'month',
|
||||||
count: 6,
|
count: 6,
|
||||||
text: "6m"
|
text: '6m'
|
||||||
}, {
|
}, {
|
||||||
type: "year",
|
type: 'year',
|
||||||
count: 1,
|
count: 1,
|
||||||
text: "1y"
|
text: '1y'
|
||||||
}, {
|
}, {
|
||||||
type: "all",
|
type: 'all',
|
||||||
text: "All"
|
text: 'All'
|
||||||
}],
|
}],
|
||||||
selected: 0,
|
selected: 0,
|
||||||
},
|
},
|
||||||
@ -242,8 +242,8 @@ accountantApp
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
series: [{
|
series: [{
|
||||||
type: "ohlc",
|
type: 'ohlc',
|
||||||
name: "Sold",
|
name: 'Sold',
|
||||||
data: [],
|
data: [],
|
||||||
dataGrouping : {
|
dataGrouping : {
|
||||||
units : [[
|
units : [[
|
||||||
@ -256,18 +256,18 @@ accountantApp
|
|||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
title: {
|
title: {
|
||||||
text: "Sold evolution"
|
text: 'Sold evolution'
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: "datetime",
|
type: 'datetime',
|
||||||
dateTimeLabelFormats: {
|
dateTimeLabelFormats: {
|
||||||
month: "%e. %b",
|
month: '%e. %b',
|
||||||
year: "%Y"
|
year: '%Y'
|
||||||
},
|
},
|
||||||
minRange: 3600 * 1000 * 24 * 14, // 2 weeks
|
minRange: 3600 * 1000 * 24 * 14, // 2 weeks
|
||||||
events: {
|
events: {
|
||||||
afterSetExtremes: function(e) {
|
afterSetExtremes: function(e) {
|
||||||
$scope.$emit("rangeSelectedEvent", {
|
$scope.$emit('rangeSelectedEvent', {
|
||||||
begin: moment.utc(e.min), end: moment.utc(e.max)
|
begin: moment.utc(e.min), end: moment.utc(e.max)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -277,11 +277,11 @@ accountantApp
|
|||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
plotLines: [{
|
plotLines: [{
|
||||||
color: "orange",
|
color: 'orange',
|
||||||
width: 2,
|
width: 2,
|
||||||
value: 0.0
|
value: 0.0
|
||||||
}, {
|
}, {
|
||||||
color: "red",
|
color: 'red',
|
||||||
width: 2,
|
width: 2,
|
||||||
value: 0.0
|
value: 0.0
|
||||||
}]
|
}]
|
||||||
@ -302,7 +302,7 @@ accountantApp
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$emit("rangeSelectedEvent", {
|
$scope.$emit('rangeSelectedEvent', {
|
||||||
begin: $scope.config.xAxis.currentMin,
|
begin: $scope.config.xAxis.currentMin,
|
||||||
end: $scope.config.xAxis.currentMax
|
end: $scope.config.xAxis.currentMax
|
||||||
});
|
});
|
||||||
@ -312,17 +312,17 @@ accountantApp
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Reload solds when an operation is saved.
|
// Reload solds when an operation is saved.
|
||||||
$rootScope.$on("operationSavedEvent", function(e, operation) {
|
$rootScope.$on('operationSavedEvent', function(e, operation) {
|
||||||
$scope.loadSolds();
|
$scope.loadSolds();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Reload solds when an operation is deleted.
|
// Reload solds when an operation is deleted.
|
||||||
$rootScope.$on("operationDeletedEvent", function(e, operation) {
|
$rootScope.$on('operationDeletedEvent', function(e, operation) {
|
||||||
$scope.loadSolds();
|
$scope.loadSolds();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update authorized overdraft on account loading.
|
// Update authorized overdraft on account loading.
|
||||||
$rootScope.$on("accountLoadedEvent", function(e, account) {
|
$rootScope.$on('accountLoadedEvent', function(e, account) {
|
||||||
$scope.config.yAxis.plotLines[1].value = account.authorized_overdraft;
|
$scope.config.yAxis.plotLines[1].value = account.authorized_overdraft;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -334,8 +334,8 @@ accountantApp
|
|||||||
* Controller for the operations.
|
* Controller for the operations.
|
||||||
*/
|
*/
|
||||||
.controller(
|
.controller(
|
||||||
"OperationController", [
|
'OperationController', [
|
||||||
"$scope", "$rootScope", "$routeParams", "Notification", "Account", "Operation",
|
'$scope', '$rootScope', '$routeParams', 'Notification', 'Account', 'Operation',
|
||||||
function($scope, $rootScope, $routeParams, Notification, Account, Operation) {
|
function($scope, $rootScope, $routeParams, Notification, Account, Operation) {
|
||||||
// List of operations.
|
// List of operations.
|
||||||
$scope.operations = [];
|
$scope.operations = [];
|
||||||
@ -411,9 +411,9 @@ accountantApp
|
|||||||
operation.confirmed = true;
|
operation.confirmed = true;
|
||||||
|
|
||||||
return operation.$save().then(function(data) {
|
return operation.$save().then(function(data) {
|
||||||
Notification.success("Operation #" + data.id + " saved.");
|
Notification.success('Operation #' + data.id + ' saved.');
|
||||||
|
|
||||||
$scope.$emit("operationSavedEvent", data);
|
$scope.$emit('operationSavedEvent', data);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -424,16 +424,16 @@ accountantApp
|
|||||||
var id = operation.id;
|
var id = operation.id;
|
||||||
|
|
||||||
bootbox.confirm(
|
bootbox.confirm(
|
||||||
"Voulez-vous supprimer l'opération \"" + operation.label + "\" ?",
|
'Voulez-vous supprimer l\'opération \\\'' + operation.label + '\\\' ?',
|
||||||
function(result) {
|
function(result) {
|
||||||
if(result) {
|
if(result) {
|
||||||
operation.$delete().then(function() {
|
operation.$delete().then(function() {
|
||||||
Notification.success("Operation #" + id + " deleted.");
|
Notification.success('Operation #' + id + ' deleted.');
|
||||||
|
|
||||||
// Remove operation from array.
|
// Remove operation from array.
|
||||||
$scope.operation.splice($index, 1);
|
$scope.operation.splice($index, 1);
|
||||||
|
|
||||||
$scope.$emit("operationDeletedEvent", operation);
|
$scope.$emit('operationDeletedEvent', operation);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -447,7 +447,7 @@ accountantApp
|
|||||||
/*
|
/*
|
||||||
* Reload operations on rangeSelectedEvent.
|
* Reload operations on rangeSelectedEvent.
|
||||||
*/
|
*/
|
||||||
$rootScope.$on("rangeSelectedEvent", function(e, args) {
|
$rootScope.$on('rangeSelectedEvent', function(e, args) {
|
||||||
$scope.load(args.begin, args.end);
|
$scope.load(args.begin, args.end);
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
|
@ -18,17 +18,17 @@
|
|||||||
|
|
||||||
accountantApp
|
accountantApp
|
||||||
|
|
||||||
.factory("ScheduledOperation", ["$resource", function($resource) {
|
.factory('ScheduledOperation', ['$resource', function($resource) {
|
||||||
return $resource(
|
return $resource(
|
||||||
"/api/scheduled_operation/:id", {
|
'/api/scheduled_operation/:id', {
|
||||||
id: "@id"
|
id: '@id'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.controller(
|
.controller(
|
||||||
"SchedulerController", [
|
'SchedulerController', [
|
||||||
"$scope", "$rootScope", "$routeParams", "Notification", "ScheduledOperation",
|
'$scope', '$rootScope', '$routeParams', 'Notification', 'ScheduledOperation',
|
||||||
function($scope, $rootScope, $routeParams, Notification, ScheduledOperation) {
|
function($scope, $rootScope, $routeParams, Notification, ScheduledOperation) {
|
||||||
// Operation store.
|
// Operation store.
|
||||||
$scope.operations = [];
|
$scope.operations = [];
|
||||||
@ -68,7 +68,7 @@ accountantApp
|
|||||||
}
|
}
|
||||||
|
|
||||||
return operation.$save().then(function(data) {
|
return operation.$save().then(function(data) {
|
||||||
Notification.success("Operation #" + data.id + " saved.");
|
Notification.success('Operation #' + data.id + ' saved.');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -90,11 +90,11 @@ accountantApp
|
|||||||
var id = operation.id;
|
var id = operation.id;
|
||||||
|
|
||||||
bootbox.confirm(
|
bootbox.confirm(
|
||||||
"Voulez-vous supprimer l'operation planifiée \"" + operation.label + "\" ?",
|
'Voulez-vous supprimer l\'operation planifiée \\\'' + operation.label + '\\\' ?',
|
||||||
function(result) {
|
function(result) {
|
||||||
if(result) {
|
if(result) {
|
||||||
operation.$delete().then(function() {
|
operation.$delete().then(function() {
|
||||||
Notification.success("Operation #" + id + " deleted.");
|
Notification.success('Operation #' + id + ' deleted.');
|
||||||
|
|
||||||
// Remove account from array.
|
// Remove account from array.
|
||||||
$scope.operations.splice($index, 1);
|
$scope.operations.splice($index, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user