destinatariCtrl.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. app.controller('destinatariCtrl',
  2. function ($scope,$http,$cookies,$window, $location,$timeout, $mdDialog, $q, $routeParams, $mdBottomSheet,
  3. $mdMedia, locals, utilsSvc, Destinatari, ContiDestinatario) {
  4. var vm=this;
  5. $scope.idOrdinante = locals.ordinante.idordinante;
  6. $scope.ordinanti = locals.ordinanti;
  7. $scope.ordinante = locals.ordinante;
  8. $scope.maxItems = 0;
  9. $scope.itemsPerPage = 100;
  10. $scope.selectedIndex=-1;
  11. $scope.maxContiItems = 0;
  12. $scope.records=[];
  13. $scope.recordsConti=[];
  14. $scope.selected=[];
  15. $scope.filter={
  16. orderField:null,
  17. orderContiField: null
  18. };
  19. $scope.setSelected=function(idx) {
  20. $scope.selectedIndex = idx;
  21. }
  22. $scope.destinatarioColumnWidths=[
  23. 230, //0
  24. 130
  25. ];
  26. $scope.contiColumnWidths=[
  27. 90, //0
  28. 90,
  29. 120,
  30. 80,
  31. 250,
  32. 100,
  33. 250
  34. ];
  35. $scope.getListHeight = function() {
  36. containerHeight = ($window.innerHeight - $('#container').position().top - $('#view').position().top);
  37. return {'height': containerHeight + 'px'};
  38. };
  39. $scope.getGridItemHeight = function() {
  40. return utilsSvc.getGridWithButtonHeight();
  41. }
  42. $window.addEventListener('resize', onResize);
  43. function onResize() {
  44. $scope.$digest();
  45. }
  46. $scope.$on('$destroy', function() {
  47. $window.removeEventListener('resize', onResize);
  48. });
  49. $scope.getDestinatarioColumnWidth = // }
  50. // this.lastStartIdx = index;
  51. function(idx) {
  52. return {
  53. 'width': $scope.destinatarioColumnWidths[idx] + 'px',
  54. 'min-width':$scope.destinatarioColumnWidths[idx] + 'px',
  55. 'margin-left':'8px',
  56. 'margin-right':'8px'
  57. };
  58. }
  59. $scope.getMaxDestinatarioListWidth = function() {
  60. var res=0;
  61. for (var i=0;i<$scope.destinatarioColumnWidths.length;i++)
  62. res += $scope.destinatarioColumnWidths[i]+6+8+10;
  63. $('#container').css('width',($('#header').width()+10)+'px');
  64. return {'width': res+ 'px!important;'}
  65. }
  66. $scope.getContiColumnWidth = // }
  67. // this.lastStartIdx = index;
  68. function(idx) {
  69. return {
  70. 'width': $scope.contiColumnWidths[idx] + 'px',
  71. 'min-width':$scope.contiColumnWidths[idx] + 'px',
  72. 'margin-left':'8px',
  73. 'margin-right':'8px'
  74. };
  75. }
  76. $scope.getMaxContiListWidth = function() {
  77. var res=0;
  78. for (var i=0;i<$scope.contiColumnWidths.length;i++)
  79. res += $scope.contiColumnWidths[i]+6+8+10;
  80. $('#container').css('width',($('#header').width()+10)+'px');
  81. return {'width': res+ 'px!important;'}
  82. }
  83. $scope.stampaDestinatari = function() {
  84. utilsSvc.showForever('Generazione in corso...');
  85. Destinatari.Print({idOrdinante: $scope.idOrdinante}).$promise.then(function(data){
  86. utilsSvc.downloadFile('application/pdf',data.response,'Destinatari.pdf');
  87. utilsSvc.cancelMessage();
  88. }).catch(function(err){
  89. if (err.status==404) {
  90. utilsSvc.cancelMessage();
  91. utilsSvc.showMessage('Nessun destinatario estratto');
  92. }
  93. });
  94. }
  95. $scope.setDestinatarioOrderField = function(field) {
  96. if ($scope.filter.orderField!=field)
  97. $scope.filter.orderField = field;
  98. else
  99. $scope.filter.orderField = "-" +field;
  100. $scope.getDestinatari();
  101. }
  102. $scope.setContiOrderField = function(field) {
  103. if ($scope.filter.orderContiField!=field)
  104. $scope.filter.orderContiField = field;
  105. else
  106. $scope.filter.orderContiField = "-" +field;
  107. $scope.getContiDestinatario();
  108. }
  109. $scope.setSelectedDestinatariIndex=function(data, $index, $event) {
  110. $scope.selectedIndex = $index;
  111. $scope.getContiDestinatario();
  112. }
  113. $scope.infiniteItems = {
  114. numLoaded_: 0,
  115. toLoad_: 0,
  116. loading_:false,
  117. lastStartIdx:-1,
  118. listPromise:null,
  119. canceler: $q.defer(),
  120. // Required.
  121. getItemAtIndex: function(index) {
  122. if ($scope.maxItems==0 || index>$scope.maxItems)
  123. return null;
  124. if (!$scope.infiniteItems.loading_)
  125. if (index > $scope.records.length) {
  126. this.fetchMoreItems_(index);
  127. return null;
  128. }
  129. return $scope.records [index];
  130. },
  131. // Required.
  132. // For infinite scroll behavior, we always return a slightly
  133. // higher
  134. // number than the previously loaded items.
  135. getLength: function() {
  136. return $scope.maxItems;
  137. },
  138. fetchMoreItems_: function(index) {
  139. if (this.toLoad_ < index) {
  140. this.toLoad_ += $scope.itemsPerPage;
  141. utilsSvc.showWaitMessage('Ricerca in corso...');
  142. $scope.infiniteItems.loading_ = true;
  143. this.listPromise = Destinatari.List({idOrdinante: $scope.idOrdinante, start: $scope.records.length,size:Math.max($scope.records.length+index,$scope.itemsPerPage),filter:$scope.filter.filterText,orderBy:$scope.filter.orderField}).$promise;
  144. var mod=this;
  145. this.listPromise.then(
  146. function(data){
  147. $scope.infiniteItems.loading_ = false;
  148. $scope.infiniteItems.toLoad_=0;
  149. utilsSvc.cancelWaitMessage();
  150. $scope.records = $scope.records.concat(data);
  151. mod.numLoaded_ = $scope.records.length;
  152. mod.lastStartIdx = $scope.records.length;
  153. $scope.selected.length=$scope.records.length;
  154. if ($scope.selectedIndex==-1 && $scope.records.length>0) {
  155. $scope.selectedIndex=0;
  156. $scope.setSelectedDestinatariIndex($scope.records , 0, null);
  157. }
  158. },
  159. function(error) {
  160. $scope.infiniteItems.loading_ = false;
  161. $scope.infiniteItems.toLoad_=0;
  162. utilsSvc.handleHttpError(error);
  163. }
  164. )
  165. }
  166. }
  167. }
  168. $scope.contiInfiniteItems = {
  169. numLoaded_: 0,
  170. toLoad_: 0,
  171. loading_:false,
  172. lastStartIdx:-1,
  173. listPromise:null,
  174. canceler: $q.defer(),
  175. // Required.
  176. getItemAtIndex: function(index) {
  177. if ($scope.maxContiItems==0 || index>$scope.maxContiItems)
  178. return null;
  179. if (!$scope.contiInfiniteItems.loading_)
  180. if (index > $scope.recordsConti.length) {
  181. this.fetchMoreItems_(index);
  182. return null;
  183. }
  184. return $scope.recordsConti [index];
  185. },
  186. // Required.
  187. // For infinite scroll behavior, we always return a slightly
  188. // higher
  189. // number than the previously loaded items.
  190. getLength: function() {
  191. return $scope.maxContiItems;
  192. },
  193. fetchMoreItems_: function(index) {
  194. if (this.toLoad_ < index) {
  195. this.toLoad_ += $scope.itemsPerPage;
  196. utilsSvc.showWaitMessage('Ricerca in corso...');
  197. $scope.contiInfiniteItems.loading_ = true;
  198. this.listPromise = ContiDestinatario.List({idDestinatario: $scope.records[$scope.selectedIndex].iddestinatario, start: $scope.recordsConti.length,size:Math.max($scope.recordsConti.length+index,$scope.itemsPerPage),orderBy:$scope.filter.orderContiField}).$promise;
  199. var mod=this;
  200. this.listPromise.then(
  201. function(data){
  202. $scope.contiInfiniteItems.loading_ = false;
  203. $scope.contiInfiniteItems.toLoad_=0;
  204. utilsSvc.cancelWaitMessage();
  205. $scope.recordsConti = $scope.recordsConti.concat(data);
  206. mod.numLoaded_ = $scope.recordsConti.length;
  207. mod.lastStartIdx = $scope.recordsConti.length;
  208. },
  209. function(error) {
  210. $scope.contiInfiniteItems.loading_ = false;
  211. $scope.contiInfiniteItems.toLoad_=0;
  212. utilsSvc.handleHttpError(error);
  213. }
  214. )
  215. }
  216. }
  217. }
  218. $scope.getDestinatari = function(){
  219. Destinatari.Count({idOrdinante: $scope.idOrdinante, filter:$scope.filter.filterText}).$promise.then(
  220. function(data){
  221. $scope.records=[];
  222. $scope.maxItems = data.value;
  223. $scope.infiniteItems.numLoaded_ = 0;
  224. $scope.infiniteItems.toLoad_ = 0;
  225. }
  226. );
  227. }
  228. $scope.getContiDestinatario = function(){
  229. ContiDestinatario.Count({idDestinatario: $scope.records[$scope.selectedIndex].iddestinatario}).$promise.then(
  230. function(data){
  231. $scope.recordsConti=[];
  232. $scope.maxContiItems = data.value;
  233. $scope.contiInfiniteItems.numLoaded_ = 0;
  234. $scope.contiInfiniteItems.toLoad_ = 0;
  235. }
  236. );
  237. }
  238. $scope.nuovoDestinatario = function(event){
  239. Destinatari.New().$promise.then(function(data){
  240. data.idordinante = $scope.idOrdinante;
  241. $scope.records.push(data);
  242. $scope.editDestinatario($scope.records.length-1, event);
  243. });
  244. }
  245. $scope.editDestinatario = function(ndx, event){
  246. $scope.selectedIndex = ndx;
  247. $mdDialog.show({
  248. templateUrl: 'templates/destinatario.html',
  249. controller: 'destinatarioCtrl',
  250. targetEvent: event,
  251. locals: $scope.records[ndx],
  252. multiple: true
  253. }).then(function(data){
  254. Destinatari.save(data).$promise.then(
  255. function(res) {
  256. utilsSvc.showMessage('Salvataggio modifiche effettuato');
  257. $scope.getDestinatari();
  258. }, function(err) {
  259. utilsSvc.handleHttpError(err);
  260. $scope.getDestinatari();
  261. }
  262. );
  263. },
  264. function(){
  265. $scope.getDestinatari();
  266. });
  267. }
  268. $scope.eliminaDestinatario = function(ndx, event){
  269. utilsSvc.showConfirm("Conferma","Confermi l'eliminazione dell'elemento?")
  270. .then(function(res){
  271. Destinatari.Delete({idDestinatario: $scope.records[ndx].iddestinatario})
  272. .$promise.then(function(res){
  273. utilsSvc.showMessage("Eliminazione effettuata");
  274. $scope.getDestinatari();
  275. },
  276. function(err){
  277. utilsSvc.handleHttpError(err);
  278. $scope.getDestinatari();
  279. })
  280. })
  281. }
  282. $scope.nuovoConto= function(event) {
  283. if ($scope.selectedIndex==-1) {
  284. utilsSvc.showMessage("Selezionare prima un destinatario");
  285. return;
  286. }
  287. ContiDestinatario.New().$promise.then(function(data){
  288. data.idordinante=$scope.idOrdinante;
  289. data.iddestinatario=$scope.records[$scope.selectedIndex].iddestinatario;
  290. $scope.recordsConti.push(data);
  291. $scope.editConto($scope.recordsConti.length-1, event);
  292. })
  293. }
  294. $scope.editConto = function(ndx, event){
  295. $mdDialog.show({
  296. templateUrl: 'templates/conto.html',
  297. controller: 'contoCtrl',
  298. targetEvent: event,
  299. locals: {conto: $scope.recordsConti[ndx], conti: $scope.recordsConti},
  300. multiple: true
  301. }).then(function(res){
  302. ContiDestinatario.Save(res).$promise.then(function(resCode,p){
  303. if (resCode.value=="4")
  304. utilsSvc.show("L'elemento è stato modificato da un altro utente");
  305. else if (resCode.value=="5")
  306. utilsSvc.show("L'elemento è stato eliminato da un altro utente");
  307. else if (resCode.value!="0")
  308. utilsSvc.show(resCode.value);
  309. $scope.getContiDestinatario();
  310. },
  311. function(err){
  312. utilsSvc.handleHttpError(err);
  313. $scope.getContiDestinatario();
  314. });
  315. },
  316. function(){
  317. }
  318. )
  319. }
  320. $scope.eliminaConto = function(ndx, event){
  321. utilsSvc.showConfirm("Conferma","Confermi l'eliminazione dell'elemento?")
  322. .then(function(res){
  323. ContiDestinatario.Delete({idConto: $scope.recordsConti[ndx].id})
  324. .$promise.then(function(res){
  325. utilsSvc.showMessage("Eliminazione effettuata");
  326. $scope.getContiDestinatario();
  327. },
  328. function(err){
  329. utilsSvc.handleHttpError(err);
  330. $scope.getContiDestinatario();
  331. })
  332. });
  333. }
  334. $scope.getSelectedDestinatari = function(){
  335. var res = new Array();
  336. for(var i=0;i<$scope.selected.length;i++)
  337. if ($scope.selected[i])
  338. res.push($scope.records[i].iddestinatario);
  339. return res;
  340. }
  341. $scope.cambioSocieta=function() {
  342. if ($scope.getSelectedDestinatari().length==0) {
  343. utilsSvc.showMessage('Selezionare i destinatari interessati al cambio della società.')
  344. } else {
  345. utilsSvc.showConfirm('Conferma',"Questa funzione agisce sulle anagrafiche destinatari selezionate e permette di spostarle o duplicarle verso un altra società a seconda dell'opzione relativa.<br/>"+
  346. "Le anagrafiche duplicate saranno completamente indipendenti rispetto all' anagrafica di partenza.")
  347. .then(function(res){
  348. $mdDialog.show({
  349. templateUrl: 'templates/cambioOrdinante.html',
  350. controller: 'cambioOrdinanteCtrl',
  351. targetEvent: event,
  352. locals: {ordinanti: $scope.ordinanti, ordinanteOriginale: $scope.ordinante.ordinante},
  353. multiple: true
  354. }).then(function(data){
  355. utilsSvc.showConfirm('Conferma',"Confermi il cambio della società ordinante?")
  356. .then(function() {
  357. var opzioni = {destinatari: $scope.getSelectedDestinatari(), ordinanteDestinazione: data.ordinanteDestinazione, tipoCambio: data.tipoCambio};
  358. Destinatari.CambioOrdinanti(opzioni)
  359. .$promise.then(function(res){
  360. utilsSvc.showMessage('Operazione completata');
  361. $scope.getDestinatari();
  362. },
  363. function(err){
  364. utilsSvc.handleHttpError(err);
  365. })
  366. });
  367. });
  368. });
  369. }
  370. }
  371. $scope.cancelDialog = function(){
  372. $mdDialog.cancel();
  373. }
  374. $scope.init = function() {
  375. $scope.getDestinatari();
  376. }
  377. $scope.init();
  378. }
  379. )
  380. .controller('comandiDestinatariCtrl', function($scope, $mdBottomSheet, idx) {
  381. $scope.title = 'Comandi';
  382. $scope.items = [
  383. { id:0, name: "Anagrafica destinatari", icon: 'fa-users',visible: true },
  384. { id:1, name: "Anagrafica deleghe SEDA", icon: 'fa-refresh', visible: true }
  385. ];
  386. $scope.listItemClick = function($index, $event) {
  387. var clickedItem = $scope.items[$index];
  388. var result = {cmdIndex: $index, recordIdx: idx, event:$event}
  389. $mdBottomSheet.hide(result);
  390. };
  391. $scope.dismissBottomSheet = function() {
  392. $mdBottomSheet.cancel();
  393. }
  394. })
  395. .controller('destinatarioCtrl',function($scope,$mdDialog,utilsSvc,locals){
  396. $scope.destinatario = angular.copy(locals);
  397. $scope.controllaCF=function() {
  398. if ($scope.destinatario.codiceFiscale==null || $scope.destinatario.codiceFiscale.length==0)
  399. return true;
  400. if ($scope.destinatario.codiceFiscale.length==16){
  401. if (!utilsSvc.controllaCF($scope.destinatario.codiceFiscale)){
  402. utilsSvc.showMessage('Codice fiscale non valido');
  403. return;
  404. }
  405. }
  406. if ($scope.destinatario.codiceFiscale!=null && $scope.destinatario.codiceFiscale.length==11) {
  407. if (!utilsSvc.controllaPIVA($scope.destinatario.codiceFiscale)){
  408. utilsSvc.showMessage('Partita IVA non valida');
  409. return;
  410. }
  411. }
  412. if (!($scope.destinatario.codiceFiscale.length==16 || $scope.destinatario.codiceFiscale.length==11))
  413. utilsSvc.showMessage('Partita IVA o codice fiscale non validi');
  414. }
  415. $scope.controlloIban=function(){
  416. if ($scope.destinatario.coordinateIbanordinante==null || $scope.destinatario.coordinateIbanordinante.trim()=='')
  417. return true;
  418. if (!utilsSvc.controlloIban($scope.destinatario.coordinateIbanordinante.replace(/\s/g, ''))) {
  419. utilsSvc.showMessage('Codice IBAN errato');
  420. return false;
  421. }
  422. return true;
  423. }
  424. $scope.confirmDialog = function() {
  425. if ($scope.destinatario.destinatario==null || $scope.destinatario.destinatario.trim()=='') {
  426. utilsSvc.showMessage('Inserire la denominazione');
  427. return;
  428. }
  429. if ($scope.destinatario.codiceFiscale==null || $scope.destinatario.codiceFiscale.trim()=='') {
  430. utilsSvc.showMessage('Inserire il codice fiscale / partita IVA');
  431. return;
  432. }
  433. if (!$scope.controlloIban())
  434. return;
  435. $mdDialog.hide($scope.destinatario);
  436. }
  437. $scope.cancelDialog = function() {
  438. $mdDialog.cancel();
  439. }
  440. })
  441. .controller('contoCtrl',function($scope,$mdDialog,Banche, utilsSvc,locals){
  442. $scope.conto = angular.copy(locals.conto);
  443. $scope.conti = locals.conti;
  444. $scope.piazzatura = function(ev) {
  445. $mdDialog.show({
  446. targetEvent: ev,
  447. templateUrl: 'templates/ricercaFiliali.html',
  448. controller: 'ricercaFilialiCtrl',
  449. locals: {abi: $scope.conto.abi, cab:$scope.conto.cab, istituto:$scope.conto.denominazioneBanca},
  450. multiple: true
  451. }).then(function(filiale){
  452. $scope.conto.abi = filiale.abi;
  453. $scope.conto.cab = filiale.cab;
  454. },function() {
  455. })
  456. }
  457. $scope.confirmDialog = function() {
  458. if ($scope.checkDati())
  459. $mdDialog.hide($scope.conto);
  460. }
  461. $scope.cancelDialog = function() {
  462. $mdDialog.cancel();
  463. }
  464. $scope.checkDefaultPresente= function(){
  465. if ($scope.conto.contoDefault) {
  466. var defaultPresente=false;
  467. for (var i=0;i<$scope.conti.length;i++) {
  468. if ($scope.conti[i].conto!=$scope.conto)
  469. if ($scope.conti[i].contoDefault) {
  470. $scope.conto.contoDefault = false;
  471. utilsSvc.showMessage('Il conto predefinito è già presente.');
  472. return;
  473. }
  474. }
  475. }
  476. }
  477. $scope.toUpper=function() {
  478. $scope.conto.conto = $scope.conto.conto.toUpperCase();
  479. }
  480. $scope.toUpperCase=function(event) {
  481. event.key = event.key.toUpperCase();
  482. }
  483. $scope.checkDigit=function(event, len){
  484. if (event.key=="Backspace" || event.key=="ArrowLeft" || event.key=="ArrowRight" || event.key=="Tab")
  485. return;
  486. if ("0123456789".indexOf(event.key)==-1 || event.target.value.length>=len)
  487. event.preventDefault();
  488. }
  489. $scope.controlloIban=function(){
  490. if ($scope.conto.coordinateIban==null || $scope.conto.coordinateIban.trim()=='')
  491. return true;
  492. if (!utilsSvc.controlloIban($scope.conto.coordinateIban.replace(/\s/g, ''))) {
  493. utilsSvc.showMessage('Codice IBAN errato');
  494. return
  495. } else {
  496. var iban=utilsSvc.allTrim($scope.conto.coordinateIban.toUpperCase());
  497. if (iban.substring(0,2)=='IT' || iban.substring(0,2)=='SM') {
  498. if (!utilsSvc.controlloCin(iban.substring(4,4+1),iban.substring(5,5+5),iban.substring(10,10+5),iban.substring(15,15+12))) {
  499. utilsSvc.showMessage('Codice CIN errato');
  500. return false;
  501. }
  502. if ($scope.conto.abi!=null && $scope.conto.abi!='' && $scope.conto.coordinateIban.replace(/\s/g, '').substring(5,5+5)!=$scope.conto.abi){
  503. utilsSvc.showMessage('Il Codice ABI non è congruente con il codice IBAN');
  504. return false;
  505. }
  506. var iban=$scope.conto.coordinateIban.replace(/\s/g, '');
  507. $scope.conto.abi = iban.substring(5,5+5);
  508. $scope.conto.cab = iban.substring(10,10+5);
  509. $scope.conto.conto = iban.substring(15,15+12);
  510. $scope.conto.cin = iban.substring(4,5);
  511. if ($scope.conto.abi!=null && $scope.conto.abi!='')
  512. Banche.GetByAbi({abi:$scope.conto.abi.trim()})
  513. .$promise.then(function(data){
  514. if (data.descri)
  515. $scope.conto.descrizioneBanca = data.descri.substring(0,40);
  516. });
  517. }
  518. }
  519. return true;
  520. }
  521. $scope.checkDati = function() {
  522. if ($scope.conto.abi==null)
  523. $scope.conto.abi ="";
  524. if ($scope.conto.cab==null)
  525. $scope.conto.cab ="";
  526. $scope.conto.abi = $scope.conto.abi.padZero(5);
  527. $scope.conto.cab = $scope.conto.cab.padZero(5);
  528. if($scope.conto.conto!=null)
  529. $scope.conto.conto=$scope.conto.conto.toUpperCase();
  530. if ($scope.conto.coordinateIban!='' && $scope.conto.coordinateIban!=null){
  531. if ($scope.conto.coordinateIban.replace(/\s/g, '').substring(5,5+5)!=$scope.conto.abi){
  532. utilsSvc.showMessage('Il Codice ABI non è congruente con il codice IBAN');
  533. return false;
  534. }
  535. }
  536. if (!$scope.controlloIban())
  537. return false;
  538. return true;
  539. }
  540. })
  541. .controller('cambioOrdinanteCtrl',function($scope, $mdDialog, utilsSvc, locals){
  542. $scope.ordinanti = locals.ordinanti;
  543. $scope.ordinanteOriginale = locals.ordinanteOriginale;
  544. $scope.res = {
  545. ordinanteDestinazione:0,
  546. tipoCambio:0
  547. };
  548. $scope.confirmDialog = function() {
  549. if ($scope.res.ordinanteDestinazione==0)
  550. utilsSvc.showMessage('Selezionare la società di destinazione');
  551. else
  552. $mdDialog.hide($scope.res);
  553. }
  554. $scope.cancelDialog = function() {
  555. $mdDialog.cancel();
  556. }
  557. })
  558. ;