{"version":3,"sources":["./src/modules/auth/components/index.ts","./src/modules/auth/containers/login/login.component.ts","./src/modules/auth/containers/login/login.component.scss","./src/modules/auth/auth-routing.module.ts","./src/modules/auth/auth.module.ts","./src/modules/auth/guards/auth.guard.ts","./src/modules/auth/containers/index.ts","./src/modules/auth/containers/login/login.component.html","./src/modules/auth/guards/index.ts"],"names":[],"mappings":";;;;;;;;;;AAAA;AAAA;AAAO,MAAM,UAAU,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;ACAiE;AACrC;AACW;AACU;AACd;IASnD,cAAc,SAAd,cAAc;IAOvB,YAAY,EAAe,EAAW,KAAqB,EAAU,iBAAoC,EAC7F,MAAc,EAAU,qBAA4C,EAAU,cAA8B;QADlF,UAAK,GAAL,KAAK,CAAgB;QAAU,sBAAiB,GAAjB,iBAAiB,CAAmB;QAC7F,WAAM,GAAN,MAAM,CAAQ;QAAU,0BAAqB,GAArB,qBAAqB,CAAuB;QAAU,mBAAc,GAAd,cAAc,CAAgB;QAJxH,iBAAY,GAAQ,EAAE,CAAC;QACvB,aAAQ,GAAW,EAAE,CAAC;QAKlB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,KAAK,CAAC;YACxB,IAAI,EAAE,CAAC,EAAE,CAAC;YACV,QAAQ,EAAE,CAAC,EAAE,EAAE,yDAAU,CAAC,QAAQ,CAAC;YACnC,QAAQ,EAAE,CAAC,EAAE,EAAE,yDAAU,CAAC,QAAQ,CAAC;SACpC,CAAC,CAAC;QACH,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;QACvC,YAAY,CAAC,OAAO,CAAC,UAAU,EAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC;IAC7E,CAAC;IAED,QAAQ;QACL,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,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AAC,4DAAY,CAAC;KAC1B,CAAC;GACW,iBAAiB,CAAG;AAAH;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnC9B,oCAAoC;AACK;AACM;AACA;AACmB;AAElE,aAAa;AAC+C;AACa;AAEzE,gBAAgB;AAC+B;AAE/C,gBAAgB;AAC+B;AAE/C,YAAY;AAC2B;AAEvC,cAAc;AAC6B;IAe9B,UAAU,SAAV,UAAU;CAAG;AAAb,UAAU;IAbtB,8DAAQ,CAAC;QACN,OAAO,EAAE;YACL,4DAAY;YACZ,4DAAY;YACZ,kEAAmB;YACnB,0DAAW;YACX,yEAAe;YACf,sFAAgB;SACnB;QACD,SAAS,EAAE,CAAC,GAAG,mDAAqB,EAAE,GAAG,8CAAiB,CAAC;QAC3D,YAAY,EAAE,CAAC,GAAG,sDAAyB,EAAE,GAAG,sDAAyB,CAAC;QAC1E,OAAO,EAAE,CAAC,GAAG,sDAAyB,EAAE,GAAG,sDAAyB,CAAC;KACxE,CAAC;GACW,UAAU,CAAG;AAAH;;;;;;;;;;;;;;;;;;;ACnCoB;AAEL;IAGzB,SAAS,SAAT,SAAS;IAClB,WAAW;QACP,OAAO,+CAAE,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;CACJ;AAJY,SAAS;IADrB,gEAAU,EAAE;GACA,SAAS,CAIrB;AAJqB;;;;;;;;;;;;;ACLtB;AAAA;AAAA;AAAA;AAAA;AAAyD;AAElD,MAAM,UAAU,GAAG,CAAC,qEAAc,CAAC,CAAC;AAEH;;;;;;;;;;;;;ACJxC;AAAe,+pCAAgmC,KAAK,GAAG,KAAK,0rBAA0rB,wCAAwC,cAAc,yJAAyJ,qPAAqP,E;;;;;;;;;;;;ACA1vE;AAAA;AAAA;AAAA;AAAA;AAAyC;AAElC,MAAM,MAAM,GAAG,CAAC,qDAAS,CAAC,CAAC;AAEL","file":"modules-auth-auth-routing-module-es2015.js","sourcesContent":["export const components = [];\n","import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';\r\nimport { Router, ActivatedRoute } from '@angular/router';\r\nimport { FormBuilder, FormGroup, Validators } from '@angular/forms';\r\nimport { AuthenticationService } from '../../services/authentication.service';\r\nimport { RestapiService } from '../../services/restapi.service';\r\nimport { AppCommonService } from '@common/services/app-common.service';\r\n\r\n@Component({\r\n selector: 'sb-login',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n templateUrl: './login.component.html',\r\n styleUrls: ['login.component.scss'],\r\n})\r\nexport class LoginComponent implements OnInit {\r\n loginForm: FormGroup;\r\n returnUrl: string;\r\n user:any;\r\n errorMessage:string=\"\";\r\n farmList: string[]=[];\r\n \r\n constructor(fb: FormBuilder, private route: ActivatedRoute, private changeDetectorRef: ChangeDetectorRef,\r\n private router: Router, private authenticationService: AuthenticationService, private restapiService: RestapiService)\r\n {\r\n this.loginForm = fb.group({\r\n farm: [''],\r\n username: ['', Validators.required],\r\n password: ['', Validators.required],\r\n });\r\n localStorage.removeItem('currentUser');\r\n localStorage.setItem(\"language\",\"en\");\r\n this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/home';\r\n }\r\n \r\n ngOnInit(): void {\r\n this.loginForm.reset();\r\n this.authenticationService.logout(); \r\n this.getFarmList(); \r\n }\r\n \r\n authenticateUSer()\r\n {\r\n var _username = this.loginForm.value.username;\r\n var _password = this.loginForm.value.password;\r\n var _farm = this.loginForm.value.farm;\r\n this.errorMessage =\"\";\r\n\r\n if(!_farm || _farm == \"\")\r\n {\r\n this.errorMessage =\"Please select farm\"\r\n return;\r\n }\r\n if (this.loginForm.invalid || _username == \"\" || _password == \"\") {\r\n this.errorMessage =\"Invalid username or password\"\r\n return;\r\n }\r\n if (_username== \"\" || _password == \"\") {\r\n this.errorMessage =\"Invalid username or password\"\r\n return;\r\n }\r\n \r\n document.getElementById(\"semiTransparenDiv\")!.style.display = \"block\";\r\n this.restapiService.post(`authenticateuser`, { username: _username, password: _password, farm: _farm })\r\n .subscribe(data => {\r\n if (data) {\r\n this.user = data;\r\n this.authenticationService.currentUserSubject.next(this.user);\r\n localStorage.setItem(\"currentUser\",JSON.stringify(this.user));\r\n try{\r\n this.activityTracking();\r\n }\r\n catch(ex){\r\n \r\n }\r\n this.router.navigate([this.returnUrl]);\r\n }\r\n document.getElementById(\"semiTransparenDiv\")!.style.display = \"none\";\r\n return true;\r\n },\r\n err=>{\r\n this.errorMessage = err.error\r\n document.getElementById(\"semiTransparenDiv\")!.style.display = \"none\";\r\n this.changeDetectorRef.detectChanges();\r\n }\r\n );\r\n \r\n }\r\n\r\n getFarmList()\r\n {\r\n \r\n document.getElementById(\"semiTransparenDiv\")!.style.display = \"block\";\r\n this.loginForm.value.farm = '';\r\n this.restapiService.fetchData(\"getFarmList\")\r\n .subscribe(list=>\r\n {\r\n this.farmList = list;\r\n document.getElementById(\"semiTransparenDiv\")!.style.display = \"none\";\r\n this.changeDetectorRef.detectChanges();\r\n },\r\n err=>{\r\n document.getElementById(\"semiTransparenDiv\")!.style.display = \"none\";\r\n });\r\n }\r\n\r\n activityTracking()\r\n {\r\n let requestBody = { \r\n Farm: this.user.farm, \r\n EmployeeId: this.user.employeeID, \r\n CreatedBy: this.user.employeeID\r\n }\r\n this.restapiService.activityLog(requestBody,\"User logged in.\", this.user.employeeID)\r\n .subscribe((data:any)=>\r\n {\r\n },\r\n err=>{\r\n });\r\n }\r\n \r\n}\r\n","export default \"\\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJsb2dpbi5jb21wb25lbnQuc2NzcyJ9 */\";","/* tslint:disable: ordered-imports*/\nimport { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\nimport { SBRouteData } from '@modules/navigation/models';\n\n/* Module */\nimport { AuthModule } from './auth.module';\n\n/* Containers */\nimport * as authContainers from './containers';\n\n/* Guards */\nimport * as authGuards from './guards';\n\n/* Routes */\nexport const ROUTES: Routes = [\n {\n path: '',\n pathMatch: 'full',\n redirectTo: '/login',\n },\n {\n path: 'login',\n canActivate: [],\n component: authContainers.LoginComponent,\n data: {\n title: 'Mastronardi',\n } as SBRouteData,\n }\n];\n\n@NgModule({\n imports: [AuthModule, RouterModule.forChild(ROUTES)],\n exports: [RouterModule],\n})\nexport class AuthRoutingModule {}\n","/* tslint:disable: ordered-imports*/\nimport { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { RouterModule } from '@angular/router';\nimport { ReactiveFormsModule, FormsModule } from '@angular/forms';\n\n/* Modules */\nimport { AppCommonModule } from '@common/app-common.module';\nimport { NavigationModule } from '@modules/navigation/navigation.module';\n\n/* Components */\nimport * as authComponents from './components';\n\n/* Containers */\nimport * as authContainers from './containers';\n\n/* Guards */\nimport * as authGuards from './guards';\n\n/* Services */\nimport * as authServices from './services';\n\n@NgModule({\n imports: [\n CommonModule,\n RouterModule,\n ReactiveFormsModule,\n FormsModule,\n AppCommonModule,\n NavigationModule,\n ],\n providers: [...authServices.services, ...authGuards.guards],\n declarations: [...authContainers.containers, ...authComponents.components],\n exports: [...authContainers.containers, ...authComponents.components],\n})\nexport class AuthModule {}\n","import { Injectable } from '@angular/core';\nimport { CanActivate } from '@angular/router';\nimport { Observable, of } from 'rxjs';\n\n@Injectable()\nexport class AuthGuard implements CanActivate {\n canActivate(): Observable<boolean> {\n return of(true);\n }\n}\n","import { LoginComponent } from './login/login.component';\r\n\r\nexport const containers = [LoginComponent];\r\n\r\nexport * from './login/login.component';\r\n","export default \"<sb-layout-auth\\r\\n ><div class=\\\"container\\\">\\r\\n <div class=\\\"row justify-content-center\\\">\\r\\n <div class=\\\"col-lg-5\\\">\\r\\n <div class=\\\"card shadow-lg border-0 rounded-lg mt-5\\\">\\r\\n <div class=\\\"card-header\\\"><h3 class=\\\"text-center font-weight-light my-4\\\">Login</h3></div>\\r\\n <div class=\\\"card-body\\\">\\r\\n <div id=\\\"semiTransparenDiv\\\"></div>\\r\\n <form [formGroup]=\\\"loginForm\\\" (ngSubmit)=\\\"authenticateUSer()\\\">\\r\\n <div class=\\\"form-group\\\"><label class=\\\"small mb-1\\\" for=\\\"farm\\\">Farm</label>\\r\\n <!-- <input class=\\\"form-control py-4\\\" id=\\\"username\\\" formControlName=\\\"username\\\" type=\\\"text\\\" placeholder=\\\"Enter username\\\" /> -->\\r\\n <select class=\\\"form-control\\\" id=\\\"farm\\\" formControlName=\\\"farm\\\">\\r\\n <option [ngValue]=\\\"null\\\" disabled hidden>Choose Farm</option>\\r\\n <option *ngFor=\\\"let frm of farmList\\\" value={{frm}}>{{frm}}</option>\\r\\n </select>\\r\\n </div>\\r\\n <div class=\\\"form-group\\\"><label class=\\\"small mb-1\\\" for=\\\"username\\\">Username</label><input class=\\\"form-control\\\" id=\\\"username\\\" formControlName=\\\"username\\\" type=\\\"text\\\" placeholder=\\\"Enter username\\\" /></div>\\r\\n <div class=\\\"form-group\\\"><label class=\\\"small mb-1\\\" for=\\\"password\\\">Password</label><input class=\\\"form-control\\\" id=\\\"password\\\" formControlName=\\\"password\\\" type=\\\"password\\\" placeholder=\\\"Enter password\\\" /></div>\\r\\n <div class=\\\"form-group\\\" *ngIf=\\\"errorMessage\\\" style=\\\"text-align: center;\\\"><label class=\\\"text-danger small\\\">{{errorMessage}}</label></div>\\r\\n <div class=\\\"form-group d-flex align-items-center justify-content-between mt-2 mb-0\\\" style=\\\"float: right;\\\"><button type=\\\"submit\\\" class=\\\"btn btn-primary\\\" >Login</button></div>\\r\\n </form>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div>\\r\\n </div></sb-layout-auth\\r\\n>\\r\\n\";","import { AuthGuard } from './auth.guard';\n\nexport const guards = [AuthGuard];\n\nexport * from './auth.guard';\n"],"sourceRoot":"webpack:///"}