diff --git a/ng8-seed/package-lock.json b/ng8-seed/package-lock.json
index a5407ea..3cc53d1 100644
--- a/ng8-seed/package-lock.json
+++ b/ng8-seed/package-lock.json
@@ -7331,6 +7331,11 @@
"resolved": "https://registry.npmjs.org/ngx-color-picker/-/ngx-color-picker-7.5.0.tgz",
"integrity": "sha512-bTW16A3IitWUNGc3kZtE+N1r3FpmUj7uJTG80eym2nQLvsROkMntalKJDo1SQVQhh9Nh4N9C88UezdMg8fjR5Q=="
},
+ "ngx-cookie-service": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/ngx-cookie-service/-/ngx-cookie-service-2.2.0.tgz",
+ "integrity": "sha512-2kaC1itlEMxiMAPJ320hOpcwU9vhvjbKQCZ1Go6bGhYjJtqG7eYvhNP7mM9IhFz1/afG2tBryJPySWmFUGhRpA=="
+ },
"ngx-perfect-scrollbar": {
"version": "5.0.0-7",
"resolved": "https://registry.npmjs.org/ngx-perfect-scrollbar/-/ngx-perfect-scrollbar-5.0.0-7.tgz",
diff --git a/ng8-seed/package.json b/ng8-seed/package.json
index 7e49867..02fa9e1 100644
--- a/ng8-seed/package.json
+++ b/ng8-seed/package.json
@@ -48,6 +48,7 @@
"ng2-tree": "^2.0.0-alpha.10",
"ng2-validation": "^4.2.0",
"ngx-color-picker": "^7.0.2",
+ "ngx-cookie-service": "^2.2.0",
"ngx-perfect-scrollbar": "5.0.0-7",
"ngx-slick-carousel": "^0.4.6",
"perfect-scrollbar": "^1.4.0",
diff --git a/ng8-seed/src/app/app.component.ts b/ng8-seed/src/app/app.component.ts
index fe42f72..a98fc47 100644
--- a/ng8-seed/src/app/app.component.ts
+++ b/ng8-seed/src/app/app.component.ts
@@ -1,17 +1,25 @@
import { Component } from '@angular/core';
import { TranslateService} from '@ngx-translate/core';
+import { CookieService } from 'ngx-cookie-service';
@Component({
selector: 'app-root',
template: ' '
})
export class AppComponent {
- constructor(translate: TranslateService) {
+ constructor(translate: TranslateService,private cookieService:CookieService) {
translate.addLangs(['en', 'fr']);
translate.setDefaultLang('en');
const browserLang: string = translate.getBrowserLang();
translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');
console.log("app component")
+ var today = new Date();
+ var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
+ var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
+ var dateTime = date+'T'+time;
+ console.log(dateTime)
+ this.cookieService.set('Tn_Schools_user_in',dateTime);
+ // this.cookieService.set('Tn_Schools_user_in',date.toString(),-1,'/','csr')
}
}
diff --git a/ng8-seed/src/app/app.module.ts b/ng8-seed/src/app/app.module.ts
index 3d76172..3ecfc63 100644
--- a/ng8-seed/src/app/app.module.ts
+++ b/ng8-seed/src/app/app.module.ts
@@ -51,6 +51,12 @@ import { AuthGuardService } from './shared/guards/auth-guard.service';
import { MatTableDataSource, MatTableModule } from '@angular/material';
import { SchoolDetailsService } from './shared/school-details.service';
// import { AddEventModule } from './add-event.module';
+import {HashLocationStrategy,LocationStrategy} from '@angular/common';
+import {CookieService} from 'ngx-cookie-service'
+import { LoginComponent } from './components/login/login.component';
+import { RegisterComponent } from './components/register/register.component';
+import { ReqListComponent } from './components/req-list/req-list.component';
+
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http);
@@ -75,7 +81,11 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
ProjectsComponent,
PaymentComponent,
PaymentConfirmationComponent,
- MyAccountComponent
+ MyAccountComponent,
+ LoginComponent,
+ RegisterComponent,
+ ReqListComponent,
+
// ProjectListComponent
],
imports: [
@@ -115,6 +125,8 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
],
providers: [
TranslateService,
+ CookieService,
+ {provide: LocationStrategy, useClass: HashLocationStrategy},
{
provide: PERFECT_SCROLLBAR_CONFIG,
useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG
@@ -122,7 +134,8 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
provide:HTTP_INTERCEPTORS,
useClass: TokenInterceptorService,
multi: true
- },AuthGuardService,SchoolDetailsService,
+ },AuthGuardService,
+ SchoolDetailsService,
],
entryComponents: [],
bootstrap: [AppComponent]
diff --git a/ng8-seed/src/app/app.routing.ts b/ng8-seed/src/app/app.routing.ts
index 2bb3a55..9b7f554 100644
--- a/ng8-seed/src/app/app.routing.ts
+++ b/ng8-seed/src/app/app.routing.ts
@@ -9,6 +9,8 @@ import { PaymentComponent } from './components/payment/payment.component';
import { PaymentConfirmationComponent } from './components/payment-confirmation/payment-confirmation.component';
import { MyAccountComponent } from './components/my-account/my-account.component';
import { AuthGuardService } from './shared/guards/auth-guard.service';
+import { LoginComponent } from './components/login/login.component';
+import { RegisterComponent } from './components/register/register.component';
export const AppRoutes: Routes = [{
path: '',
redirectTo: 'home',
@@ -31,17 +33,29 @@ export const AppRoutes: Routes = [{
component:ProjectsComponent
},
{
+ canActivate:[AuthGuardService],
path : 'payment',
component:PaymentComponent
},
{
+ canActivate:[AuthGuardService],
path : 'paymentconfirmation',
component:PaymentConfirmationComponent
},
{
path : 'my-account',
component:MyAccountComponent
-}
+},
+{
+ path:'login',
+ component:LoginComponent
+},
+
+ {
+ path:'register',
+ component:RegisterComponent
+ }
+
]
},
{
diff --git a/ng8-seed/src/app/components/contribute/contribute.component.html b/ng8-seed/src/app/components/contribute/contribute.component.html
index f30372e..b5c8530 100644
--- a/ng8-seed/src/app/components/contribute/contribute.component.html
+++ b/ng8-seed/src/app/components/contribute/contribute.component.html
@@ -66,7 +66,7 @@
School
- {{row.school_name}} , {{row.block_name}} Block, {{row.district_name}} District.
+ {{row.school_name}} , {{row.block_name}} Block, {{row.district_name}} District.
@@ -78,7 +78,7 @@
Sponsor Qty
-
+
@@ -112,8 +112,8 @@
- I'd like to Contribute in kind
- I'd like to Contribute in Cash
+ I'd like to Contribute in kind
+ I'd like to Contribute in Cash
@@ -147,11 +147,11 @@
- State School Development Fund
+ State School Development Fund
-
+
- Proceed for Payment
+ Proceed for Payment
diff --git a/ng8-seed/src/app/components/contribute/contribute.component.ts b/ng8-seed/src/app/components/contribute/contribute.component.ts
index 33493c2..9f37ba9 100644
--- a/ng8-seed/src/app/components/contribute/contribute.component.ts
+++ b/ng8-seed/src/app/components/contribute/contribute.component.ts
@@ -19,7 +19,7 @@ export class ContributeComponent implements OnInit {
dataLength :number;
@ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
@ViewChild(MatSort, {static: true}) sort: MatSort;
- pageSize = 5;
+ pageSize = 10;
Contribute: FormGroup;
material_category: any = [];
district: any = [];
@@ -28,10 +28,13 @@ export class ContributeComponent implements OnInit {
Total: any = [];
grandTotal: any = [];
finalData: any = [];
-
- constructor(public restApi:ApiService,public fb:FormBuilder,public router:Router) {
+ sponsor_qty:any=[]
+ gen_dev_fund_remarks:string
+ general_devlop_amt:string='';
+ whole_contribute_list: any=[];
+ constructor(public restApi:ApiService,public fb:FormBuilder,public router:Router,private apiService:ApiService) {
// Create 100 users
-
+
}
// ngOnInit() {
@@ -49,7 +52,9 @@ export class ContributeComponent implements OnInit {
}
}
ngOnInit() {
-
+ sessionStorage.removeItem('contribute-selected-list')
+ sessionStorage.removeItem('contribute-params');
+ sessionStorage.removeItem('contribute_final_total')
this.initForm();
this.getSchoolReqList();
this.getSchoolReqList2();
@@ -79,6 +84,18 @@ export class ContributeComponent implements OnInit {
{
this.dataLength = schDet.records.length;
this.dataSource.data = schDet.records;
+ console.log("data",this.dataSource)
+ let store:any
+ store=sessionStorage.getItem('contribute')
+ store=JSON.parse(store)
+ console.log(store)
+ if(store.records){
+ if(store.records.contributions){
+ let indexes = Object.keys(store.records.contributions)
+ console.log(indexes)
+ // this.sponsor_qty[]
+ }
+ }
// console.log(this.material_category);
// this.dataSource.data = schDet.records.map((val, i)=>{
@@ -89,15 +106,38 @@ export class ContributeComponent implements OnInit {
}
})
}
- somethingChanged(e,i,item,mat_id){
+ somethingChanged(e,i,item,mat_id,curr_data){
+ console.log(curr_data.school_req_id)
// console.log(e,i,item);
this.Total[i] = e*item;
- let data = {'qty': e
- ,'amount' : item
- ,'req_id': mat_id}
- this.finalData[i] = data;
+ let data = {
+ 'id':'',
+ 'cont_id':'',
+ 'qty': e,
+ 'amount' : item,
+ 'req_id': curr_data.school_req_id,
+ 'school_id':curr_data.school_id,
+ 'dist_id':curr_data.district_id
+ }
+ curr_data.amount=e*item
+ curr_data.sponsor_qty=e
+ if(this.finalData.length > 0){
+ this.finalData=this.finalData.filter(val=>val.req_id != curr_data.school_req_id)
+ this.whole_contribute_list=this.whole_contribute_list.filter(val=>val.school_req_id != curr_data.school_req_id)
+
+ this.finalData.push(data);
+ this.whole_contribute_list.push(curr_data)
+ }
+ else{
+ this.finalData=[data]
+ this.whole_contribute_list=[curr_data]
+ }
+
// console.log(this.Total);
this.grandTotal = this.Total.reduce((acc, value) => acc + value, 0);
+ this.whole_contribute_list.grandTotal=this.grandTotal
+
+
}
@@ -162,21 +202,89 @@ export class ContributeComponent implements OnInit {
finalSave(flag)
{
- let data = {'records':
- {
- 'id':'',
- 'user_id':'',
- "cont_type":flag,
- "cont_towards":"",
- "amount":this.grandTotal,
- "payment_mode":"",
- "payment_ref":"",
- "contributions":this.finalData
- }};
-
+ if(!this.apiService.isToken()){
+ this.router.navigate(['payment'])
+ return
+ }
+ if(this.grandTotal ==''){
+ alert("Please Fill the amount");
+ return
+ }
+ let data = {'records':
+ {
+ 'id':'',
+ 'user_id':'',
+ "cont_type":flag, //1-funds 2-materials
+ "cont_towards":"", //1-State Fund not needed here
+ "amount":this.grandTotal,
+ "payment_mode":"offline",
+ "payment_ref":"",
+ "contributions":this.finalData,
+ }};
console.log(data);
+ console.log("whole cont",this.whole_contribute_list);
+
+
+ this.apiService.csrContribute(data).subscribe(result=>{
+ if(result['dataStatus']){
+ data.records.id=result['records']
+ // if(flag == 1){
+ sessionStorage.setItem('contribute-selected-list',JSON.stringify(this.whole_contribute_list))
+ sessionStorage.setItem('contribute-params',JSON.stringify(data))
+ sessionStorage.setItem('contribute_final_total',this.grandTotal)
+
+ this.router.navigate(['payment'])
+ // }
+ }
+ else{
+ console.log("something went wrong")
+ }
+ },err=>{
+ console.log("Error")
+ })
+
}
-
+ storeData_session(){
+ sessionStorage.removeItem('contribute-selected-list')
+ if(!this.apiService.isToken()){
+ this.router.navigate(['payment'])
+ return
+ }
+ if(this.general_devlop_amt ==''){
+ alert("Please Fill the amount");
+ return
+ }
+ let data = {'records':
+ {
+ 'id':'',
+ 'user_id':'',
+ "cont_type":1, //1-funds 2-materials
+ "cont_towards":"1", //1-State Fund
+ "amount":this.general_devlop_amt,
+ "payment_mode":"offline",
+ "payment_ref":"",
+ "gen_dev_fund_remarks":this.gen_dev_fund_remarks,
+ "contributions":[]
+ }};
+ console.log(data);
+ sessionStorage.setItem('contribute',JSON.stringify(data))
+ this.apiService.csrContribute(data).subscribe(result=>{
+ if(result['dataStatus']){
+ data.records.id=result['records']
+
+ sessionStorage.setItem('contribute-params',JSON.stringify(data))
+ sessionStorage.setItem('contribute_final_total',this.general_devlop_amt)
+ this.router.navigate(['payment'])
+ }
+ else{
+
+ }
+ })
+
+ }
+ goToProjectDet(curr_array){
+ this.router.navigate(['home','project-detail',{schoolreqid:curr_array.school_id}])
+ }
}
diff --git a/ng8-seed/src/app/components/login/login-component.html b/ng8-seed/src/app/components/login/login-component.html
new file mode 100644
index 0000000..0284477
--- /dev/null
+++ b/ng8-seed/src/app/components/login/login-component.html
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+ close
+
+
Login Form
+
Enter Your Login Details
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ng8-seed/src/app/components/login/login-component.scss b/ng8-seed/src/app/components/login/login-component.scss
new file mode 100644
index 0000000..81373ad
--- /dev/null
+++ b/ng8-seed/src/app/components/login/login-component.scss
@@ -0,0 +1,12 @@
+.close_icon{
+ // float: right;
+ text-align: right;
+ color: gray;
+ margin: 0px;
+ padding: 0px;
+}
+.close_icon:hover {
+ transition: transform 1.5s;
+ // color: blue;
+ cursor: pointer;
+}
\ No newline at end of file
diff --git a/ng8-seed/src/app/components/login/login.component.ts b/ng8-seed/src/app/components/login/login.component.ts
new file mode 100644
index 0000000..e2bbe61
--- /dev/null
+++ b/ng8-seed/src/app/components/login/login.component.ts
@@ -0,0 +1,116 @@
+import { Component, OnInit ,ViewEncapsulation } from '@angular/core';
+import {Router, NavigationEnd} from "@angular/router";
+import { FormControl, FormBuilder } from '@angular/forms';
+import { environment } from 'environments/environment';
+import { ApiService } from 'app/shared/api.service';
+import { Location } from "@angular/common";
+import { MatDialog } from '@angular/material';
+import { RegisterComponent } from '../register/register.component';
+
+@Component({
+ selector: 'ms-login-session',
+ templateUrl:'./login-component.html',
+ styleUrls: ['./login-component.scss'],
+ encapsulation: ViewEncapsulation.None,
+})
+export class LoginComponent {
+
+ email: string;
+ password: string;
+ loginForm: any;
+ previousUrl: string;
+
+ constructor(public restApi:ApiService,public fb:FormBuilder,public router:Router,
+ private location:Location,private matDialog:MatDialog) {
+
+ // console.log(this.router.events);
+
+ }
+
+ ngOnInit() {
+ console.log("d",sessionStorage.getItem('contribute'))
+ // this.getSchoolReqList();
+ this.initForm();
+ // console.log(this.router.events);
+// this.router.events.filter(e => e instanceof NavigationEnd).pairwise().subscribe((e) => {
+
+// console.log('NAVIGATION PREVIOUS => ',e);
+// });
+this.previousUrl = this.restApi.getPreviousUrl();
+
+ }
+
+
+ initForm()
+ {
+ this.loginForm = this.fb.group(
+ {
+ email: new FormControl(''),
+ password: new FormControl(''),
+
+ })
+ }
+
+ csrUserLogin()
+ {
+ // console.log(this.loginForm.value);return false;
+ let url = `${environment.apiUrl}${'csrUserLogin'}`;
+ let data = this.loginForm.value;
+ this.restApi.post(url,data).subscribe(schDet=>
+ {
+ // this.load.loadedDismiss();
+ // console.log(schDet);return false;
+
+ if(schDet.dataStatus==true)
+ {
+ // this.setTokenData(schDet.records);
+
+ this.restApi.setToken(schDet.token);
+ if(this.router.url==this.previousUrl)
+ {
+ // this.router.navigate(['/home']);
+ // this.matDialog.closeAll()
+ this.matDialog.closeAll()
+ }else{
+ // this.router.navigate([this.previousUrl]);
+ // this.location.back();
+ this.matDialog.closeAll()
+ }
+
+ // this.router.navigate(['/home']);
+ // window.localStorage.setItem('token','abcd');
+
+ }else
+ {
+ // this.toast.apptoast(res.message,'danger');
+ window.localStorage.clear();
+
+ alert(schDet.msg);
+ return false;
+ }
+ })
+ }
+
+
+ // setTokenData(records: any) {
+ // throw new Error("Method not implemented.");
+ // }
+ // login() {
+ // this.router.navigate(['/']);
+ // }
+ closeDialog(){
+ this.matDialog.closeAll();
+ }
+ registerDialog(){
+ this.closeDialog()
+ this.matDialog.open(RegisterComponent,{
+ "height":"600px",
+ "width":"550px",
+ panelClass: 'custom-modalbox'
+ })
+ }
+
+}
+
+
+
diff --git a/ng8-seed/src/app/components/payment/payment.component.html b/ng8-seed/src/app/components/payment/payment.component.html
index 45643e8..3ce4ff5 100644
--- a/ng8-seed/src/app/components/payment/payment.component.html
+++ b/ng8-seed/src/app/components/payment/payment.component.html
@@ -23,25 +23,77 @@
-->
+
+
+
+
+ Review
+
+
+
+
+
+
+
+
Choose a Payment Option
-
+
- ₹ 70,000
+ ₹ {{grand_tot_value}}
+
+
+ Online
+ Offline
+
+
+
+
- Government of Tamil Nadu accepts online voluntary contributions using Net Banking or VISA-Debit/Credit Cards in Indian Rupees (INR) from Individuals, Organizations, Trusts,Companies and Institutions etc.
+ Government of Tamil Nadu accepts online voluntary contributions using Net Banking or VISA-Debit/Credit Cards in Indian Rupees (INR) from Individuals, Organizations, Trusts,Companies and Institutions etc.
All contributions towards Tamil Nadu State Parent Teacher Association (TNPTA) are exempt from Income Tax under section 80 (G).
The PAN Number of Tamil Nadu State Tamil Nadu Parent Teacher Association (TNPTA) is AACAT2920R.
+
+
- Proceed for Payment
+ {{payment_mode === 'online' ? 'Proceed for Payment' : 'Confirm'}}
\ No newline at end of file
diff --git a/ng8-seed/src/app/components/payment/payment.component.scss b/ng8-seed/src/app/components/payment/payment.component.scss
index b2b03dc..84e14cc 100644
--- a/ng8-seed/src/app/components/payment/payment.component.scss
+++ b/ng8-seed/src/app/components/payment/payment.component.scss
@@ -177,4 +177,10 @@ $product-bg-color-hover: rgba(103, 58, 183, 0.7);
}
}
}
+ .amount{
+ text-align: center;
+ float: inline-start;
+ align-content: center;
+ color: black;
+ }
}
diff --git a/ng8-seed/src/app/components/payment/payment.component.ts b/ng8-seed/src/app/components/payment/payment.component.ts
index f5c2163..38ef0ee 100644
--- a/ng8-seed/src/app/components/payment/payment.component.ts
+++ b/ng8-seed/src/app/components/payment/payment.component.ts
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
-import { FormBuilder } from '@angular/forms';
+import { FormBuilder, FormGroup } from '@angular/forms';
import { ApiService } from 'app/shared/api.service';
@Component({
@@ -42,13 +42,44 @@ export class PaymentComponent implements OnInit {
value: 'milk-8',
viewValue: 'Milk'
}];
- constructor(public restApi:ApiService,public fb:FormBuilder,public router:Router) {
+ isCardShow:boolean = false
+ grand_tot_value: string;
+ contribute_type: any;
+ contributeKind: FormGroup;
+ contribute_params: any;
+ payment_mode:any='offline';
+ constructor(public restApi:ApiService,public fb:FormBuilder,public router:Router,private apiService:ApiService) {
this.isToken();
}
ngOnInit() {
+
// window.localStorage.clear();
+ let values= sessionStorage.getItem('contribute-selected-list')
+ console.log(values)
+ if(values){
+ this.isCardShow=true
+ }
+ let grand_total=sessionStorage.getItem('contribute_final_total')
+ console.log(grand_total)
+ if(grand_total){
+ this.grand_tot_value=grand_total
+ }
+
+ this.contribute_params=sessionStorage.getItem('contribute-params')
+ this.contribute_params=JSON.parse(this.contribute_params)
+ // console.log("parm",contribute_params[''].records)
+ this.contribute_type= this.contribute_params.records.cont_type
+ console.log("ty",this.contribute_type)
+ if(this.contribute_type == '2'){
+ this.contributeKind=this.fb.group({
+ delivery_point:[''],
+ do_delivery:[''],
+ remarks:['']
+ })
+ }
+ // }
}
isToken(){
// console.log(this.restApi.isToken());
@@ -60,5 +91,24 @@ export class PaymentComponent implements OnInit {
}
}
+ proceed_for_payment(){
+ let params=this.contribute_params
+ if(this.contribute_type == '2'){
+ params.records.mat_delivery_point=this.contributeKind.value.delivery_point
+ params.records.mat_delivery_date=this.contributeKind.value.do_delivery
+ params.records.gen_dev_fund_remarks=this.contributeKind.value.remarks
+ }
+ params.records.payment_mode=this.payment_mode
+ this.apiService.csrContribute(params).subscribe(result=>{
+ if(result['dataStatus']){
+ this.router.navigate(['/'],{replaceUrl:true})
+ }
+ else{
+ console.log("something went wrong")
+ }
+ },err=>{
+ console.log("Error")
+ })
+ }
}
diff --git a/ng8-seed/src/app/components/register/register-component.html b/ng8-seed/src/app/components/register/register-component.html
new file mode 100644
index 0000000..c014909
--- /dev/null
+++ b/ng8-seed/src/app/components/register/register-component.html
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+ close
+
+ Already Registered ? Login Here
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ng8-seed/src/app/components/register/register-component.scss b/ng8-seed/src/app/components/register/register-component.scss
new file mode 100644
index 0000000..c1b6b45
--- /dev/null
+++ b/ng8-seed/src/app/components/register/register-component.scss
@@ -0,0 +1,15 @@
+.register-account {
+ background-color: #fff;
+}
+.close_icon{
+ // float: right;
+ text-align: right;
+ color: gray;
+ margin: 0px;
+ padding: 0px;
+}
+.close_icon:hover {
+ transition: transform 1.5s;
+ // color: blue;
+ cursor: pointer;
+}
\ No newline at end of file
diff --git a/ng8-seed/src/app/components/register/register.component.ts b/ng8-seed/src/app/components/register/register.component.ts
new file mode 100644
index 0000000..c44f253
--- /dev/null
+++ b/ng8-seed/src/app/components/register/register.component.ts
@@ -0,0 +1,70 @@
+import { Component, OnInit,ViewEncapsulation } from '@angular/core';
+import {Router} from "@angular/router";
+import { environment } from '../../../environments/environment';
+import { ApiService } from '../../shared/api.service';
+import { FormBuilder, FormControl } from '@angular/forms';
+import { MatDialog } from '@angular/material';
+
+@Component({
+ selector: 'ms-register-session',
+ templateUrl:'./register-component.html',
+ styleUrls: ['./register-component.scss'],
+ encapsulation: ViewEncapsulation.None,
+})
+export class RegisterComponent {
+
+ name: string;
+ email: string;
+ password: string;
+ passwordConfirm: string;
+ go_reg: any;
+
+ constructor(public restApi:ApiService,public fb:FormBuilder,public router:Router,private matDialog:MatDialog) { }
+
+ ngOnInit() {
+ // this.getSchoolReqList();
+ this.initForm();
+ }
+
+
+ initForm()
+ {
+ this.go_reg = this.fb.group(
+ {
+ id: new FormControl(''),
+ name: new FormControl(''),
+ email: new FormControl(''),
+ mobile: new FormControl(''),
+ password: new FormControl(''),
+ org_info: this.fb.group({
+ orgname: new FormControl(''),
+ org_address: new FormControl(''),
+ org_pan: new FormControl('')
+ }),
+ "created_by":"1",
+ "updated_by":"1"
+
+ })
+ }
+
+ csrUserRegistration()
+ {
+ // console.log(this.go_reg.value);return false;
+ let url = `${environment.apiUrl}${'csrUserRegistration'}`;
+ let data = this.go_reg.value;
+ this.restApi.post(url,data).subscribe(schDet=>
+ {
+ this.router.navigate(['/authentication/login']);
+ })
+ }
+ register() {
+ this.router.navigate(['/']);
+ }
+ closeDialog(){
+ this.matDialog.closeAll();
+ }
+
+}
+
+
+
diff --git a/ng8-seed/src/app/components/req-list/req-list.component.html b/ng8-seed/src/app/components/req-list/req-list.component.html
new file mode 100644
index 0000000..c03afb8
--- /dev/null
+++ b/ng8-seed/src/app/components/req-list/req-list.component.html
@@ -0,0 +1,62 @@
+
+
+
+
+ Requirement
+
+
+
+
+
+ Item Need
+ {{row.material_name}}
+
+
+
+
+ School
+ {{row.school_name}} , {{row.block_name}} Block, {{row.district_name}} District.
+
+
+
+
+ Required Qty
+ {{row.qty}}
+
+
+
+
+ Sponsor Qty
+ {{row.sponsor_qty}}
+
+
+
+
+ Cost Per Unit (in RS)
+ {{row.cost_per_unit === null ? 0 : row.cost_per_unit}}
+
+
+
+
+
+ Amount (in RS)
+ {{row.amount}}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ng8-seed/src/app/components/req-list/req-list.component.scss b/ng8-seed/src/app/components/req-list/req-list.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/ng8-seed/src/app/components/req-list/req-list.component.spec.ts b/ng8-seed/src/app/components/req-list/req-list.component.spec.ts
new file mode 100644
index 0000000..0b341dc
--- /dev/null
+++ b/ng8-seed/src/app/components/req-list/req-list.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ReqListComponent } from './req-list.component';
+
+describe('ReqListComponent', () => {
+ let component: ReqListComponent;
+ let fixture: ComponentFixture
;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ ReqListComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ReqListComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/ng8-seed/src/app/components/req-list/req-list.component.ts b/ng8-seed/src/app/components/req-list/req-list.component.ts
new file mode 100644
index 0000000..2d4984a
--- /dev/null
+++ b/ng8-seed/src/app/components/req-list/req-list.component.ts
@@ -0,0 +1,30 @@
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { MatTableDataSource, MatPaginator, MatSort } from '@angular/material';
+
+@Component({
+ selector: 'app-req-list',
+ templateUrl: './req-list.component.html',
+ styleUrls: ['./req-list.component.scss']
+})
+export class ReqListComponent implements OnInit {
+ dataSource:any = new MatTableDataSource();
+ dataLength :number;
+ @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
+ @ViewChild(MatSort, {static: true}) sort: MatSort;
+ pageSize = 10;
+ displayedColumns: string[] = ['Requirement', 'Item Need', 'School', 'Required Qty', 'Sponsor Qty', 'Cost Per Unit', 'Amount'];
+ constructor() {
+
+ }
+
+ ngOnInit() {
+ let list_req= sessionStorage.getItem('contribute-selected-list')
+ list_req=JSON.parse(list_req)
+ console.log(list_req);
+ if(list_req.length > 0){
+ this.dataLength = list_req.length;
+ this.dataSource.data = list_req;
+ }
+ }
+
+}
diff --git a/ng8-seed/src/app/dashboard/dashboard.routing.ts b/ng8-seed/src/app/dashboard/dashboard.routing.ts
index e03bb18..d5a4e9c 100644
--- a/ng8-seed/src/app/dashboard/dashboard.routing.ts
+++ b/ng8-seed/src/app/dashboard/dashboard.routing.ts
@@ -8,6 +8,7 @@ export const DashboardRoutes: Routes = [{
component: DashboardComponent
},{
path:'project-detail',
+ data:{some_data:'some value'},
component:ProjectDetailComponent
}];
diff --git a/ng8-seed/src/app/session/login/login.component.ts b/ng8-seed/src/app/session/login/login.component.ts
index 2476577..636b873 100644
--- a/ng8-seed/src/app/session/login/login.component.ts
+++ b/ng8-seed/src/app/session/login/login.component.ts
@@ -3,6 +3,8 @@ import {Router, NavigationEnd} from "@angular/router";
import { FormControl, FormBuilder } from '@angular/forms';
import { environment } from 'environments/environment';
import { ApiService } from 'app/shared/api.service';
+import { Location } from "@angular/common";
+import { MatDialog } from '@angular/material';
@Component({
selector: 'ms-login-session',
@@ -17,13 +19,14 @@ export class LoginComponent {
loginForm: any;
previousUrl: string;
- constructor(public restApi:ApiService,public fb:FormBuilder,public router:Router) {
+ constructor(public restApi:ApiService,public fb:FormBuilder,public router:Router,private location:Location,private matDialog:MatDialog) {
// console.log(this.router.events);
}
ngOnInit() {
+ console.log("d",sessionStorage.getItem('contribute'))
// this.getSchoolReqList();
this.initForm();
// console.log(this.router.events);
@@ -63,9 +66,12 @@ this.previousUrl = this.restApi.getPreviousUrl();
this.restApi.setToken(schDet.token);
if(this.router.url==this.previousUrl)
{
- this.router.navigate(['/home']);
+ this.router.navigate(['/home']);
+ // this.matDialog.closeAll()
}else{
- this.router.navigate([this.previousUrl]);
+ // this.router.navigate([this.previousUrl]);
+ // this.location.back();
+ this.matDialog.closeAll()
}
// this.router.navigate(['/home']);
diff --git a/ng8-seed/src/app/shared/api.service.ts b/ng8-seed/src/app/shared/api.service.ts
index 3140eb1..2319a1d 100644
--- a/ng8-seed/src/app/shared/api.service.ts
+++ b/ng8-seed/src/app/shared/api.service.ts
@@ -4,7 +4,7 @@ import { environment } from '../../environments/environment';
import { Observable,from,of, BehaviorSubject } from 'rxjs';
-import { delay } from 'rxjs/internal/operators';
+import { delay, catchError } from 'rxjs/internal/operators';
import 'rxjs/Rx';
import 'rxjs/add/operator/toPromise';
@@ -78,10 +78,11 @@ export class ApiService {
let token = {};
+ if(t){
token['raw'] = t;
token['header'] = JSON.parse(window.atob(t.split('.')[0]));
token['payload'] = JSON.parse(window.atob(t.split('.')[1]));
-
+ }
return (token);
}
@@ -128,9 +129,23 @@ export class ApiService {
isToken()
{
-
+ this.Token()
return this.expToken.value;
}
+ //API FOR CONTRIBUTE PAGE
+ csrContribute(DATA){
+ let token_decode=this.jwtDecode(localStorage.getItem('token'))
+ if(token_decode){
+ DATA.records.user_id=token_decode['payload'].username
+ }
+ console.log("dd",token_decode)
+ return this.http.post(apiUrl+'csrContribute',DATA).pipe
+ ()
+ }
+
+ getIndividualSchoolReqData(req_id){
+ return this.http.get(apiUrl+'getIndividualSchoolReqData/'+req_id)
+ }
}
diff --git a/ng8-seed/src/app/shared/guards/auth-guard.service.ts b/ng8-seed/src/app/shared/guards/auth-guard.service.ts
index 07e7d68..8d60cd1 100644
--- a/ng8-seed/src/app/shared/guards/auth-guard.service.ts
+++ b/ng8-seed/src/app/shared/guards/auth-guard.service.ts
@@ -2,21 +2,38 @@ import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild } from '@angular/router';
import { Router } from '@angular/router';
import { ApiService } from '../api.service';
+import { MatDialog, MatDialogConfig } from '@angular/material';
+import { AuthLayoutComponent } from 'app/layouts/auth/auth-layout.component';
+import { LoginComponent } from '../../components/login/login.component';
@Injectable({
providedIn: 'root'
})
export class AuthGuardService implements CanActivate{
- constructor(public router:Router,public api:ApiService) {
+ constructor(public router:Router,public api:ApiService,private matDialog:MatDialog) {
}
canActivate(): boolean {
-
- return this.api.isToken();
-
-
+ console.log("can activate",this.api.isToken())
+ if(this.api.isToken()){
+ return this.api.isToken();
+
+ }
+ else{
+ const dialogConfig = new MatDialogConfig();
+
+ dialogConfig.disableClose = true;
+ dialogConfig.autoFocus = true;
+ this.matDialog.open(LoginComponent,{
+ height: '450px',
+ width: '400px',
+ panelClass: 'custom-modalbox'
+ })
+ // this.router.navigate(['/authentication'])
+ return false
+ }
}
}
diff --git a/ng8-seed/src/assets/styles/app.scss b/ng8-seed/src/assets/styles/app.scss
index d966db7..9a273c5 100644
--- a/ng8-seed/src/assets/styles/app.scss
+++ b/ng8-seed/src/assets/styles/app.scss
@@ -44,4 +44,9 @@ Author: TrendSetter Themes
@import "scss/core";
@import "scss/material";
@import "scss/utilities/utilities";
+.custom-modalbox {
+ mat-dialog-container {
+ padding: 0;
+ }
+}