Advertisement
vitareinforce

createOrEditModal.js

Nov 22nd, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function () {
  2.     appModule.controller('common.views.stockIn.createOrEditModal', [
  3.         '$scope', '$uibModalInstance', 'abp.services.app.deliveryOrder', 'abp.services.app.legalEntity', 'abp.services.app.branch', 'abp.services.app.inventory', 'stockInId',
  4.         function ($scope, $uibModalInstance, deliveryOrderService, legalEntityService, branchService, inventoryService, stockInId) {
  5.             var vm = this;
  6.  
  7.             vm.saving = false;
  8.             vm.stockIn = null;
  9.             vm.legalEntity = [];
  10.             vm.branch = [];
  11.             vm.inventory = [];
  12.  
  13.             vm.save = function () {
  14.                 vm.saving = true;
  15.                 deliveryOrderService.createOrUpdateDeliveryOrder({
  16.                     stockIn: vm.stockIn
  17.                 }).then(function () {
  18.                     abp.notify.info(app.localize('SavedSuccessfully'));
  19.                     $uibModalInstance.close();
  20.                 }).finally(function () {
  21.                     vm.saving = false;
  22.                 });
  23.             };
  24.  
  25.             vm.cancel = function () {
  26.                 $uibModalInstance.dismiss();
  27.             };
  28.  
  29.             function init() {
  30.                 deliveryOrderService.getDeliveryOrderForEdit({
  31.                     id: stockInId
  32.                 }).then(function (result) {
  33.                     vm.stockIn = result.data.stockIn;
  34.                 });
  35.  
  36.                 legalEntityService.getLegalEntities().then(function (result) {
  37.                     vm.legalEntity = result.data.items;
  38.                 });
  39.  
  40.                 branchService.getBranches().then(function (result) {
  41.                     vm.branch = result.data.items;
  42.                 });
  43.  
  44.                 inventoryService.getInventories().then(function (result) {
  45.                     vm.inventory = result.data.items;
  46.                 });
  47.             }
  48.  
  49.             init();
  50.         }
  51.     ]);
  52. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement