2022-08-19 19:59:13 +02:00
|
|
|
/* eslint-disable
|
|
|
|
no-return-assign,
|
|
|
|
no-undef,
|
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2022-08-28 23:31:43 +02:00
|
|
|
Application.Controllers.controller('CartController', ['$scope', 'CSRF', 'growl',
|
|
|
|
function ($scope, CSRF, growl) {
|
2022-08-19 19:59:13 +02:00
|
|
|
/* PRIVATE SCOPE */
|
|
|
|
|
|
|
|
/* PUBLIC SCOPE */
|
|
|
|
|
2022-08-28 23:31:43 +02:00
|
|
|
/**
|
|
|
|
* Open the modal dialog allowing the user to log into the system
|
|
|
|
*/
|
|
|
|
$scope.userLogin = function () {
|
|
|
|
setTimeout(() => {
|
|
|
|
if (!$scope.isAuthenticated()) {
|
|
|
|
$scope.login();
|
|
|
|
$scope.$apply();
|
|
|
|
}
|
|
|
|
}, 50);
|
|
|
|
};
|
|
|
|
|
2022-08-19 19:59:13 +02:00
|
|
|
/**
|
|
|
|
* Callback triggered in case of error
|
|
|
|
*/
|
|
|
|
$scope.onError = (message) => {
|
|
|
|
growl.error(message);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback triggered in case of success
|
|
|
|
*/
|
|
|
|
$scope.onSuccess = (message) => {
|
|
|
|
growl.success(message);
|
|
|
|
};
|
|
|
|
|
|
|
|
/* PRIVATE SCOPE */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Kind of constructor: these actions will be realized first when the controller is loaded
|
|
|
|
*/
|
|
|
|
const initialize = function () {
|
|
|
|
// set the authenticity tokens in the forms
|
|
|
|
CSRF.setMetaTags();
|
|
|
|
};
|
|
|
|
|
|
|
|
// init the controller (call at the end !)
|
|
|
|
return initialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
]);
|