UNPKG

cobuild-angular-stack

Version:

Base stack angular sass jade gulp

43 lines (34 loc) 1.31 kB
(function (module) { 'use strict'; module.controller('AdminTCSController', TCSController); TCSController.$inject = ['$scope', 'Utils', 'UtilData', 'toastr', '$uibModal', 'lodash']; function TCSController($scope, Utils, UtilData, toastr, $uibModal, lodash) { $scope.editorOptions = { height: 100 }; $scope.tcs = {}; $scope.refresh = function () { Utils .listAll() .then(function (response) { var list = response.data; $scope.tcs = lodash.find(list, {name: 'tcs'}); }); }; $scope.addClause = function (length) { $scope.tcs.value.clauses.push({title: 'Clausula ' + (length + 1)}); }; $scope.update = function () { UtilData.prototype$updateAttributes( {id: $scope.tcs.id}, {'value': $scope.tcs.value}, function () { toastr.success('Los datos se han almacenado correctamente'); }, function () { toastr.error('Los datos no han podido ser almacenados correctamente'); }); }; $scope.refresh(); } })(angular.module('uniko.admin.settings'));