(function () { 'use strict'; angular .module('app') .controller('SettingsCtrl', SettingsCtrl); SettingsCtrl.$inject = ['$scope', 'smartRequest', 'Notification']; function SettingsCtrl($scope, smartRequest, Notification) { $scope.settings = []; $scope.terminalKey = ''; $scope.menuCode = ''; $scope.listSettings = function () { $scope.settings = []; smartRequest.get('settings/all?global=0', function (data) { $scope.settings = $scope.settings.concat(data.settings); }); smartRequest.get('v1/settings', function (data) { $scope.settings = $scope.settings.concat(data.settings); }); }; $scope.onSettingChange = function (setting) { if (setting.value.length > 0) { smartRequest.post('settings/update', { code: setting.code, value: setting.value }); Notification.success('Настройки обновлены'); } }; $scope.getRealisation = function() { smartRequest.get('sync/realisation?terminal=' + $scope.terminalKey + '&menu=' + $scope.menuCode, function(data) { }); }; $scope.switchDishes = function() { smartRequest.get('sync/replace/dishes', function(data) { console.log(data); }); }; $scope.listSettings(); } })();