PageSourceSearch

https://www.xop.es/assets/front/factories/pagos_fac.self-b4fb6cb0a…ecc50725b8148bd1d469c1d3a02c62731.js?body=1

js xop.es collected 2026-10-03 18:44:10 UTC 11,011 bytes, 308 lines download raw bytes

1//Borrar
2
3angular.module('fd.descuentoResource',[])
4    .factory('Descuento',['railsResourceFactory', function (railsResourceFactory) {
5        return railsResourceFactory({
6            url:'/descuento/{{codigo}}',
7            name:'descuento',
8            idAttribute: '_id.$oid'
9        });
10    }])
11    .factory('Empresa',['railsResourceFactory', function (railsResourceFactory) {
12        return railsResourceFactory({
13            url:'/empresa',
14            name:'empresa',
15            idAttribute: '_id.$oid'
16        });
17    }])
18    .factory('Asociacion',['railsResourceFactory', function (railsResourceFactory) {
19        return railsResourceFactory({
20            url:'/asociacion',
21            name:'asociacion',
22            idAttribute: '_id.$oid'
23        });
24    }])
25    .controller('descuentoCtrl',['Empresa','Auth','Descuento','$scope','$rootScope','$http','$timeout','$filter','$translate','Asociacion','$mdToast',
26    					function( Empresa , Auth , Descuento , $scope , $rootScope , $http , $timeout , $filter , $translate , Asociacion , $mdToast){
27        $scope.pagoconfirmado=false;
28        $scope.descuentoaplicado=false;
29        $scope.tipo_recurrencia='anual';
30        $scope.empresa={};
31        
32          $scope.toastPosition = {
33		    bottom: true,
34		    top: false,
35		    left: true,
36		    right: true
37		  };
38		$scope.getToastPosition = function() {
39			return Object.keys($scope.toastPosition)
40			.filter(function(pos) { return $scope.toastPosition[pos]; })
41			.join(' ');
42		};
43        
44        $scope.initcreacion=function (data) {
45			$scope.pagodata={};
46			$scope.pagodata.precioSiva=$filter('currency')(data.precioSiva);
47			$scope.pagodata.precioTotal=$filter('currency')(data.precioTotal);
48			$scope.pagodata.iva=data.iva;
49        }
50        
51      //  $http.post('/showinfopago')
52      //  	.success(function(data){
53      //  		$scope.pagodata={};
54      //  		$scope.pagodata=_.clone(data);
55      //  		$scope.pagodata.asociaciongratis=false;
56      //  		if($scope.pagodata.precioSiva!=undefined)
57      //  			$scope.pagodata.precioSiva=$filter('currency')($scope.pagodata.precioSiva);
58      //  		if($scope.pagodata.precioTotal!=undefined)
59      //  			$scope.pagodata.precioTotal=$filter('currency')($scope.pagodata.precioTotal);
60      //  	})
61      //  	.error(function(error){
62  				// $('#fd-Railserror').append(error);
63        	// });
64        	
65        	
66        $scope.comprobarDesc=function(){
67	      	if($scope.empresa.descuento!=undefined){
68		      	if($scope.empresa.descuento.length>4 && $scope.empresa.descuento.length<15){
69		      		var inputCod=$scope.empresa.descuento;
70		      		$scope.tipo_recurrencia='anual';
71		      		$timeout(function(){
72			      		Descuento.get({codigo: inputCod}).then(
73			      			function(data){
74			      				$scope.pagodata={};
75			      				$scope.pagodata=_.clone(data);
76	      						if($scope.pagodata.precioSiva!=undefined)
77				        	 		$scope.pagodata.precioSiva=$filter('currency')($scope.pagodata.precioSiva);
78				        	 	if($scope.pagodata.preciodesc!=undefined)
79				        	 		$scope.pagodata.preciodesc=$filter('currency')($scope.pagodata.preciodesc);
80				        	 	if($scope.pagodata.precioTotal!=undefined)
81				        	 		$scope.pagodata.precioTotal=$filter('currency')($scope.pagodata.precioTotal);
82				        	 	if($scope.pagodata.descfijo!=undefined)
83				        	 		$scope.pagodata.descfijo='- ' + $filter('currency')($scope.pagodata.descfijo);
84				        		if($scope.pagodata.descpor!=undefined)
85				        	 		$scope.pagodata.descpor='- ' + $scope.pagodata.descpor + ' %';
86			      				
87			      			},
88			      			function(error){
89			      				$('#fd-Railserror').append(error.data);
90			      			}
91			      		);
92		      		},500)
93		      	}
94	      	}
95        };
96        
97        $scope.changeperPago=function(){
98		  	if($scope.tipo_recurrencia=='anual'){
99		  		 $http.post('/descuentoperpagoanual')
100		        	.success(function(data){
101		        		$scope.pagodata={};
102		        		$scope.pagodata=_.clone(data);
103		        		if($scope.pagodata.precioSiva!=undefined)
104		        			$scope.pagodata.precioSiva=$filter('currency')($scope.pagodata.precioSiva);
105		        		if($scope.pagodata.precioTotal!=undefined)
106		        			$scope.pagodata.precioTotal=$filter('currency')($scope.pagodata.precioTotal);
107		        	})
108		        	.error(function(error){
109		        		$('#fd-Railserror').append(error);
110		        	});
111		  	}
112		  	else{
113		  		 $http.post('/descuentoperpagomes')
114		        	.success(function(data){
115		        		$scope.pagodata={};
116		        		$scope.pagodata=_.clone(data);
117		        		if($scope.pagodata.precioSiva!=undefined)
118		        			$scope.pagodata.precioSiva=$filter('currency')($scope.pagodata.precioSiva);
119		        		if($scope.pagodata.precioTotal!=undefined)
120		        			$scope.pagodata.precioTotal=$filter('currency')($scope.pagodata.precioTotal);
121		        	})
122		        	.error(function(error){
123		        		$('#fd-Railserror').append(error);
124		        	});
125		  	}
126        };
127        $scope.pagoTrans=function(){
128        	$scope.tipopago=2;
129        	$scope.pagoconfirmado=!$scope.pagoconfirmado;
130        	$http.post('/infotransf')
131	    		.success(function(data){
132	    			$scope.pagodata.banco=data.banco
133	    			$scope.pagodata.bancoiban=data.bancoiban
134	    			$scope.pagodata.bancotitular=data.bancotitular
135	    			$scope.pagodata.concepto=data.concepto
136	    		})
137	        	.error(function(error){
138	        		$('#fd-Railserror').append(error);
139	        	});
140    		
141        }
142        
143        $scope.pagoTarjeta=function(){
144			$scope.tipopago=1;	
145        }
146        
147        $scope.crearCuentaEmp=function(){
148        	//console.log($scope.datamapa)
149        	//console.log($scope.datamapaf)
150			var tipo_recurrencia=_.clone($scope.tipo_recurrencia);
151			var market_id=_.clone($rootScope.marketplace._id.$oid);
152			var tipodepago=_.clone($scope.tipopago);
153			// var direccion=_.clone($scope.map);
154			var num_comercial=_.clone($scope.num_comercial);
155			var user_new=_.clone($scope.usuario);
156			var emp_new=_.clone($scope.nueva_empresa);
157			var dir_c=_.clone($scope.datamapa);
158			var dir_f=_.clone($scope.datamapaf);
159			var codigo_des=_.clone($scope.empresa.descuento)
160			
161			emp_new.num_comercial=num_comercial;
162			emp_new.tipopago=tipodepago;
163			emp_new.tipo_recurrencia=tipo_recurrencia;
164			emp_new.marketplace_id=market_id;
165			emp_new.codigo_des=codigo_des
166			_.extend(emp_new,dir_c);
167			_.extend(emp_new,dir_f);
168			var renamed_emp_new = {};
169			var re_map = {
170				administrative_area_level_1 : "area1",
171				administrative_area_level_2 : "area2",
172				administrative_area_level_3 : "area3",
173				administrative_area_level_4 : "area4",
174				f_administrative_area_level_1 : "f_area1",
175				f_administrative_area_level_2 : "f_area2",
176				f_administrative_area_level_3 : "f_area3",
177				f_administrative_area_level_4 : "f_area4"
178			};
179				
180			_.each(emp_new, function(value, key) {
181				key = re_map[key] || key;
182				renamed_emp_new[key] = value;
183			});
184			console.log(renamed_emp_new)
185			$timeout(function(){
186				
187				$http.post('/registro/empresa',{empresa: renamed_emp_new})
188				.success(function(data_emp) {
189					$mdToast.show(
190		                 $mdToast.simple()
191		    				.content($translate.instant('empresa_register_confirm'))
192		                    .position($scope.getToastPosition())
193		    
194		    			);
195						user_new['empresa_id']=data_emp.empresa.empresa._id.$oid;
196						user_new['marketplace_id']=market_id;
197						user_new['rol']=['emp-superadmin'];
198						Auth.register(user_new).then(
199							function(data) {
200								$mdToast.show(
201			                     $mdToast.simple()
202			        				.content($translate.instant('user_register_confirm'))
203			                        .position($scope.getToastPosition())
204			        
205			        			);
206								if(data_emp.form){
207									$('#fd-Railserror').append(data_emp.form.formtpv);
208									$('#'+data_emp.form.formtpvid).submit();
209								}
210								$scope.nueva_empresa={};
211								$scope.usuario={};
212							}, function(error) {
213								$mdToast.show(
214			                     $mdToast.simple()
215			        				.content($translate.instant('user_register_error'))
216			                        .position($scope.getToastPosition())
217			        
218			        			);
219								$('#fd-Railserror').append(error.data);
220								$scope.usuario={};
221							});
222				})
223				.error(function(error){
224			        myWindow = window.open("", "MsgWindow", "width=800, height=500")
225        			myWindow.document.write(error)
226					// $('#fd-Railserror').append(error.data);
227				});
228			},1000)
229		};
230        $scope.crearCuentaAsoc=function(){
231			market_id=_.clone($rootScope.marketplace._id.$oid);
232			direccion=_.clone($scope.map);
233			
234			user_new=_.clone($scope.usuario);
235			emp_new=_.clone($scope.nueva_empresa);
236			dir_c=_.clone($scope.datamapa);
237			dir_f=_.clone($scope.datamapaf);
238			
239			emp_new.marketplace_id=market_id;
240			_.extend(emp_new,dir_c);
241			_.extend(emp_new,dir_f);
242			var renamed_emp_new = {};
243			var re_map = {
244				administrative_area_level_1 : "area1",
245				administrative_area_level_2 : "area2",
246				administrative_area_level_3 : "area3",
247				administrative_area_level_4 : "area4",
248				f_administrative_area_level_1 : "f_area1",
249				f_administrative_area_level_2 : "f_area2",
250				f_administrative_area_level_3 : "f_area3",
251				f_administrative_area_level_4 : "f_area4"
252			};
253				
254			_.each(emp_new, function(value, key) {
255				key = re_map[key] || key;
256				renamed_emp_new[key] = value;
257			});
258			$timeout(function(){
259				new Asociacion(renamed_emp_new).create().then(
260					function(data){
261						$mdToast.show(
262	                     $mdToast.simple()
263	        				.content($translate.instant('asociacion_register_confirm'))
264	                        .position($scope.getToastPosition())
265	        
266	        			);
267						user_new['asociacion_id']=data._id.$oid;
268						user_new['marketplace_id']=market_id;
269						user_new['rol']=['aso-superadmin'];
270						Auth.register(user_new).then(
271							function(data) {
272								$mdToast.show(
273			                     $mdToast.simple()
274			        				.content($translate.instant('user_register_confirm'))
275			                        .position($scope.getToastPosition())
276			        
277			        			);
278                    			window.location.assign('/')
279								$scope.nueva_empresa={};
280								$scope.usuario={};
281							}, function(error) {
282								$mdToast.show(
283			                     $mdToast.simple()
284			        				.content($translate.instant('user_register_error'))
285			                        .position($scope.getToastPosition())
286			        
287			        			);
288								$('#fd-Railserror').append(error.data);
289								$scope.usuario={};
290							});
291					},
292					function(error){
293						$('#fd-Railserror').append(error.data);
294					});
295			},1000)
296		};
297
298    }])
299    .controller('direccionCtrl',['$scope','$http','$filter','$timeout',function($scope,$http,$filter,$timeout){
300        $scope.direccionrepetida=true;
301	        $scope.chkdirchange=function(){
302	        	$('.pac-container').remove();
303	        };
304    }]);
305    
306    
307    
308    

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.