/** * Created by wisestone on 2019-02-19. */ 'use strict'; define([ 'app' ], function (app) { app.controller('workflowStatusAddController', ['$scope', '$rootScope', '$log', '$resourceProvider','$uibModalInstance', 'WorkflowStatus', 'parameter', 'SweetAlert', function ($scope, $rootScope, $log, $resourceProvider, $uibModalInstance, WorkflowStatus, parameter, SweetAlert) { $scope.fn = { cancel : cancel, // 팝업창 닫기 formSubmit : formSubmit, // 폼 전송 formCheck : formCheck, // 폼 체크 }; $scope.vm = { form : { projectId : parameter.projectId, name : "", color : "" } }; // 폼 체크 function formCheck(formInvalid) { if (formInvalid) { return true; } return false; } // 폼 전송 function formSubmit() { WorkflowStatus.add($resourceProvider.getContent( $scope.vm.form, $resourceProvider.getPageContent(0, 10))).then(function (result) { if (result.data.message.status == "success") { $scope.fn.cancel(); // 목록 화면 갱신 /*$rootScope.$broadcast("getProjectList", {});*/ } else { SweetAlert.swal("상태 생성 실패", result.data.message.message, "error"); } }); } // 팝업 창 닫기 function cancel() { $uibModalInstance.dismiss('cancel'); } }]); });