PageSourceSearch

https://genieonhire.com/assets/custom/js/AddOrganizerController.js

js genieonhire.com collected 2026-10-02 01:31:09 UTC 4,157 bytes, 161 lines download raw bytes

1var app = angular.module('goh');
2app.controller('AddOrganizerController',function($scope,$http,$timeout, Buckets, $upload){
3
4$scope.organizer={
5	customertype:'',
6	name:'',
7	companyName:'',
8	email:'',
9	contactNo:'',
10	gstTreatment:'',
11	gstNo:'',
12	placeOfsupply:'',
13	taxPreference:'',
14	currency:'INR-Rupees',
15	createForAdmin:false, 	
16};
17$scope.orgErr={
18	typeError:false,
19	nameError:false,
20	contactError:false,
21	gstError:false,
22	gstnoError:false,
23	placeError:false,
24	taxError:false,
25	companyNameError:false,
26	emailError: false // ✅ added new field for email error	
27};
28
29$scope.getStatelist = function(){
30	var url = base_url + 'webapi/getStatelist';
31	$http.get(url).success(function(resp){
32		if(resp.success) {
33			$scope.stateList = resp.data.stateList;
34		}
35	});
36}
37
38$scope.display=false;
39	 // Fetch data
40  $scope.fetchUsers = function(){
41       var searchText_len = $scope.organizer.placeOfsupply.trim().length;
42	   if(searchText_len > 0){		 
43			  $scope.display=true;
44		}else{
45			 $scope.display=false;
46			 
47		}
48    }
49
50   // Set value to search box
51   $scope.setValue = function(id,$event){
52	  $scope.display=false;
53		angular.forEach($scope.stateList, function(value, key) {
54			if(value.id==id){
55				$scope.organizer.state_id=value.id;
56				$scope.organizer.placeOfsupply = value.state;
57			}
58	   });
59      //$scope.searchResult = {};
60      $event.stopPropagation();
61   }
62
63   $scope.searchboxClicked = function($event){
64      $event.stopPropagation();
65   }
66
67   $scope.containerClicked = function(){
68      $scope.searchResult = {};
69   }
70	
71var a=false;
72$scope.disabled=false;
73$scope.submitDetails=function(){
74	if($scope.organizer.customertype==''){
75		$scope.orgErr.typeError=true;
76	}
77	if($scope.organizer.name==''){
78		$scope.orgErr.nameError=true;
79	}
80	if($scope.organizer.contactNo=='' || $scope.organizer.contactNo==null){
81		$scope.orgErr.contactError=true;
82	}
83	
84	if($scope.organizer.companyName==''){
85		$scope.orgErr.companyNameError=true;
86	}
87
88	// ✅ Additional validations when "Create for Admin" checkbox is checked
89	if ($scope.organizer.createForAdmin) {
90		if ($scope.organizer.name == '' || $scope.organizer.name == null) {
91			$scope.orgErr.nameError = true;
92		}
93		if ($scope.organizer.contactNo == '' || $scope.organizer.contactNo == null) {
94			$scope.orgErr.contactError = true;
95		}
96		if ($scope.organizer.email == '' || $scope.organizer.email == null) {
97			$scope.orgErr.emailError = true;
98		}
99	}
100	
101	
102	if($scope.organizer.gstTreatment==''){
103		$scope.orgErr.gstError=true;
104	}else if($scope.organizer.gstTreatment=='registered_business-regular'){
105		if($scope.organizer.gstNo==''){
106			$scope.orgErr.gstnoError=true;	
107		}else if($scope.organizer.placeOfsupply==''){
108			$scope.orgErr.placeError=true;	
109		}else if($scope.organizer.taxPreference==''){
110			$scope.orgErr.taxError=true;	
111		}else{
112			a=true;
113		}
114	}else if($scope.organizer.customertype!='' && $scope.organizer.name!='' && $scope.organizer.contactNo!=''){
115		a=true;
116	}
117	
118	// ✅ Override: if "createForAdmin" is checked, enforce the admin-required validations
119	if ($scope.organizer.createForAdmin) {
120		if (
121			$scope.organizer.name != '' &&
122			$scope.organizer.contactNo != '' &&
123			$scope.organizer.email != ''
124		) {
125			a = true;
126		} else {
127			a = false; // prevent submission if any of these fields are empty
128		}
129	}
130	
131	
132	if(a==true){
133		$scope.disabled=true;
134		var url = base_url + 'wishmaker/submitOrganizer';
135		$scope.processing=true;
136		$http.post(url, $scope.organizer).success(function(response){
137			$scope.processing=false;
138			if(response.success){
139				alert('Organizer created successfully');
140				redirect('wishmaker/makeWish');		
141			}else{
142				$scope.disabled=false;
143				//alert("something went wrong Please try again");
144				if(response.error && response.error.msg){
145					alert(response.error.msg);
146				} else {
147					alert("Something went wrong. Please try again");
148				}
149			}
150		});
151	}else{
152		alert("please fill required form fields");
153	}
154	
155}
156$scope.cancel=function(){
157	redirect('wishmaker/makeWish');
158}
159
160$scope.getStatelist();
161});

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.