Fairoj : user-profile creation and filters modified

This commit is contained in:
venbatechnologies@gmail.com 2019-10-04 10:45:23 +05:30
parent 85c3887f79
commit cde8538473
28 changed files with 1031 additions and 100 deletions

View File

@ -56,6 +56,7 @@ 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';
import { UserProfileComponent } from './components/user-profile/user-profile.component';
export function HttpLoaderFactory(http: HttpClient) {
@ -85,6 +86,7 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
LoginComponent,
RegisterComponent,
ReqListComponent,
UserProfileComponent,
// ProjectListComponent
],

View File

@ -11,6 +11,8 @@ 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';
import { Component } from '@angular/core';
import { UserProfileComponent } from './components/user-profile/user-profile.component';
export const AppRoutes: Routes = [{
path: '',
redirectTo: 'home',
@ -54,6 +56,10 @@ export const AppRoutes: Routes = [{
{
path:'register',
component:RegisterComponent
},
{
path:'user-profile',
component:UserProfileComponent
}
]

View File

@ -8,28 +8,28 @@
<form [formGroup]="Contribute">
<div fxLayout="row" fxLayoutAlign="start center" class="mb-2 pt-1">
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 100%;">
<mat-select placeholder="Select District" formControlName="district_id" >
<mat-select placeholder="Select District" formControlName="district_id" (selectionChange)="changeFilterOption($event.value,'district')">
<mat-option *ngFor="let item of district" [value]="item.district_id" >
{{ item.district_name }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field dividerColor="accent" class="ml-xs mr-xs" style="width: 100%;">
<mat-select placeholder="Select Schools" formControlName="schoold_id" >
<mat-select placeholder="Select Schools" formControlName="schoold_id" (selectionChange)="changeFilterOption($event.value,'school')">
<mat-option *ngFor="let item of school" [value]="item.school_id" >
{{ item.school_name }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field dividerColor="warn" class="ml-xs mr-xs" style="width: 100%;">
<mat-select placeholder="Select Category" formControlName="cad_id" >
<mat-select placeholder="Select Category" formControlName="cad_id" (selectionChange)="changeFilterOption($event.value,'category')">
<mat-option *ngFor="let item of category" [value]="item.cad_id" >
{{ item.cat_name }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field dividerColor="warn" class="ml-xs mr-xs" style="width: 100%;">
<mat-select placeholder="Material Name" formControlName="mat_id" >
<mat-select placeholder="Material Name" formControlName="mat_id" (selectionChange)="changeFilterOption($event.value,'material')">
<mat-option *ngFor="let item of material_category" [value]="item.mat_id" >
{{ item.material_name }}
</mat-option>
@ -50,15 +50,15 @@
<table mat-table [dataSource]="dataSource" matSort>
<!-- Requirement Column -->
<ng-container matColumnDef="Requirement">
<th style="width: 15% !important;" mat-header-cell *matHeaderCellDef mat-sort-header>Requirement</th>
<!-- <ng-container matColumnDef="Requirement">
<th style="width: 15% !important;" mat-header-cell *matHeaderCellDef mat-sort-header></th>
<td style="width: 15% !important;" mat-cell *matCellDef="let row" class="product-thumbnail"><img src="{{row.img_url}}" onerror="this.onerror=null;this.src='assets/images/csr-img/error_img.jpg';" alt="School Img" width="70"></td>
</ng-container>
</ng-container> -->
<!-- Item Need Column -->
<ng-container matColumnDef="Item Need">
<th style="width: 15% !important;" mat-header-cell *matHeaderCellDef mat-sort-header>Item Need</th>
<td style="width: 15% !important;" mat-cell *matCellDef="let row" class="product-thumbnail"> {{row.material_name}} </td>
<th style="width: 15% !important;text-align: right;float: center" mat-header-cell *matHeaderCellDef mat-sort-header>Item Needed</th>
<td style="width: 15% !important;" mat-cell *matCellDef="let row" class="product-thumbnail"><span> {{row.material_name}} </span></td>
</ng-container>
<!-- School Column -->
@ -69,27 +69,36 @@
<!-- Quantity Column -->
<ng-container matColumnDef="Required Qty">
<th style="width: 10% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Required Qty </th>
<td style="width: 10% !important;text-align: center;" mat-cell *matCellDef="let row"> {{row.qty}}</td>
<th style="width: 8% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Required Qty </th>
<td style="width: 8% !important;text-align: center;" mat-cell *matCellDef="let row"> {{row.qty}}</td>
</ng-container>
<ng-container matColumnDef="Received Qty">
<th style="width: 10% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Received Qty </th>
<td style="width: 10% !important;text-align: center;" mat-cell *matCellDef="let row"> {{row.received_qty}}</td>
</ng-container>
<ng-container matColumnDef="balance Qty">
<th style="width: 8% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Balance Qty </th>
<td style="width: 8% !important;text-align: center;" mat-cell *matCellDef="let row"> {{row.qty-row.received_qty <= 0 ? '' : row.qty-row.received_qty }}</td>
</ng-container>
<!-- Sponsor Column -->
<ng-container matColumnDef="Sponsor Qty">
<th style="width: 10% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Sponsor Qty </th>
<th style="width: 10% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Sponsored Qty </th>
<td style="width: 10% !important;" mat-cell *matCellDef="let row;let i = index"> <input step="1" min="1" max="" title="Qty" [(ngModel)]="sponsor_qty[i]" class="text" size="2" type="number" (change)="somethingChanged($event.target.value,i,row.cost_per_unit,row.mat_id,row)" style="width: 100% !important;text-align: center;"> </td>
</ng-container>
<!-- price Column -->
<ng-container matColumnDef="Cost Per Unit">
<th style="width: 15% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Cost Per Unit (in Rs) </th>
<td style="width: 15% !important;" mat-cell *matCellDef="let row;"> {{row.cost_per_unit === null?0:row.cost_per_unit}} </td>
<th align="right" style="width: 20% !important;text-align: right;align-items: center" mat-header-cell *matHeaderCellDef mat-sort-header > Cost Per Unit (in Rs) </th>
<td style="width: 15% !important;text-align: right;;" mat-cell *matCellDef="let row;" > {{row.cost_per_unit === null?0:row.cost_per_unit}} </td>
<!-- <td mat-footer-cell *matFooterCellDef> Total </td> -->
</ng-container>
<!-- Total Column -->
<ng-container matColumnDef="Amount">
<th style="width: 20% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Amount (in Rs) </th>
<td style="width: 20% !important;" mat-cell *matCellDef="let row ;let i=index">{{Total[i]}} </td>
<th style="width: 20% !important;" mat-header-cell *matHeaderCellDef mat-sort-header style="text-align: right;"> Amount <br/>(in Rs) </th>
<td style="width: 20% !important;" mat-cell *matCellDef="let row ;let i=index" style="text-align: right;">{{Total[i]}} </td>
<!-- <td mat-footer-cell *matFooterCellDef> {{somethingChanged()}} </td> -->
</ng-container>
@ -134,22 +143,25 @@
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="40" fxFlex.lg="20" fxFlex.xl="40"> -->
<mat-card class="support_mat sidescroll" fxFlex="27%" fxFlex.xs="100" fxFlex.sm="100px">
<mat-card-header>
<mat-card-title>
<h5 class="text-center"> Contribute to General Development Fund</h5>
</mat-card-title>
</mat-card-header>
<!-- <mat-card-header style="padding: 0;margin: 0;"> -->
<!-- <mat-card-title> -->
<!--</mat-card-title> -->
<!-- </mat-card-header> -->
<mat-card-content>
<p class="quote" style="margin-top:4px;text-align: center">&#8221;Alone we can do so little, together we can do so much <br/>- Hellen Keller&#8221;</p>
<h5 class="text-center"> Contribute to State School Development Fund</h5>
<div fxLayout="column" fxLayoutAlign="start stretch">
<div fxLayout fxLayout="row" fxLayout.xs="column" fxLayoutGap.xs="0">
<!-- <div fxLayout fxLayout="row" fxLayout.xs="column" fxLayoutGap.xs="0"> -->
<div class="text-center" fxFlex="100%" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="40" fxFlex.lg="100" fxFlex.xl="100">
<mat-form-field appearance="outline" style="width: 70%;text-align: center;">
<input matInput type="number" placeholder="Amount" [(ngModel)]="general_devlop_amt">
<input matInput type="tel" placeholder="Amount" [(ngModel)]="general_devlop_amt" maxlength="10" (change)="dev_fund_change($event.target.value)">
</mat-form-field>
<!-- </div> -->
</div>
</div>
<mat-radio-button name="group1" class="pb-1" checked>State School Development Fund</mat-radio-button>
<!-- <mat-radio-button name="group1" class="pb-1" checked>State School Development Fund</mat-radio-button> -->
<!--<mat-radio-button name="group1">District School Development Fund</mat-radio-button>
<mat-form-field style="width: 100%" class="pl-1">
<mat-select placeholder="Select District" >
@ -173,10 +185,11 @@
</mat-option>
</mat-select>
</mat-form-field> -->
<mat-form-field dividerColor="warn" class="ml-xs mr-xs" style="width: 100%;">
<textarea matInput placeholder="Remarks" [(ngModel)]="gen_dev_fund_remarks"></textarea>
<mat-form-field dividerColor="warn" class="ml-xs mr-xs" style="width: 100%;" appearance="outline">
<textarea matInput placeholder="Comments" rows="5" [(ngModel)]="gen_dev_fund_remarks"></textarea>
</mat-form-field>
<button class="mat-green" mat-raised-button style="color:white" (click)="storeData_session()">Proceed to Contribute</button>
<p class="quote">&#8221;We make a living by what we get. But we make a life by what we give <br/>- Winston Churchill&#8221;</p>
</div>
</mat-card-content>
</mat-card>

View File

@ -131,4 +131,11 @@ a {
-moz-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
.quote{
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 16px;
color:gray;
text-align: center;
font-style: italic;
}

View File

@ -15,7 +15,7 @@ import { SchoolDetailsService } from 'app/shared/school-details.service';
})
export class ContributeComponent implements OnInit {
displayedColumns: string[] = ['Requirement', 'Item Need', 'School', 'Required Qty', 'Sponsor Qty', 'Cost Per Unit', 'Amount'];
displayedColumns: string[] = [ 'Item Need', 'School', 'Required Qty','Received Qty','balance Qty', 'Sponsor Qty', 'Cost Per Unit', 'Amount'];
dataSource:any = new MatTableDataSource();
dataLength :number;
@ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
@ -34,6 +34,11 @@ export class ContributeComponent implements OnInit {
gen_dev_fund_remarks:string
general_devlop_amt:string='';
whole_contribute_list: any=[];
all_filtered_list:any=[];
all_category:any=[]
all_school:any=[];
all_material_category:any=[]
all_district:any=[]
constructor(public restApi:ApiService,public fb:FormBuilder,public router:Router,private apiService:ApiService,public schInfo:SchoolDetailsService) {
// Create 100 users
@ -59,17 +64,56 @@ export class ContributeComponent implements OnInit {
sessionStorage.removeItem('contribute_final_total')
this.initForm();
this.getSchoolReqList();
this.getSchoolReqList2();
// this.getSchoolReqList2();
this.schInfo.schReqId.subscribe(res=>
{
this.schRquId = res;
// console.log(res);
console.log("gfff",res);
})
// window.localStorage.clear();
this.filterValue()
}
filterValue(){
this.apiService.getFilterMasters_get().subscribe(res=>{
if(res['dataStatus']){
this.all_filtered_list=res['records']
this.district=this.all_filtered_list.map(val=>({district_name:val.district_name,district_id:val.district_id,school_id:val.school_id}))
// this.district = this.district.filter(function(elem, index, self) {
// console.log("dis",elem,index,self)
// return index === self.indexOf(elem.district_id);
// })
this.district = this.district.filter((thing, index, self) =>
index === self.findIndex((t) => (
t.district_id === thing.district_id && t.district_name === thing.district_name
)))
this.all_district=this.district
this.category=this.all_filtered_list.map(val=>({cat_name:val.cat_name,cad_id:val.cad_id,mat_id:val.mat_id}))
this.category=this.category.filter((thing,index,self)=>
index === self.findIndex((t)=>(
t.cat_name === thing.cat_name
)
))
this.all_category=this.category
this.school=this.all_filtered_list.map(val=>({school_name:val.school_name,school_id:val.school_id,district_id:val.district_id}))
this.school=this.school.filter((thing,index,self)=>
index === self.findIndex((t)=>(
t.school_name === thing.school_name && t.school_id === thing.school_id
)
))
this.all_school=this.school
this.school=[]
this.material_category=this.all_filtered_list.map(val=>({material_name:val.material_name,mat_id:val.mat_id,cad_id:val.cad_id}))
this.material_category=this.material_category.filter((thing,index,self)=>
index === self.findIndex((t)=>(
t.material_name === thing.material_name && t.mat_id === thing.mat_id
)
))
this.all_material_category=this.material_category
}
})
}
initForm()
{
@ -81,6 +125,18 @@ export class ContributeComponent implements OnInit {
mat_id: new FormControl('')
})
}
changeFilterOption(value,option){
console.log(value,option)
if(option == 'district'){
// this.district=[];
this.school=this.all_school.filter(val=>val.district_id == value )
}
else{
if(option == 'category'){
this.material_category=this.all_material_category.filter(val=>val.cad_id == value)
}
}
}
getSchoolReqList()
{
@ -107,13 +163,13 @@ export class ContributeComponent implements OnInit {
store=sessionStorage.getItem('contribute')
store=JSON.parse(store)
console.log(store)
if(store.records){
// 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)=>{
@ -125,14 +181,30 @@ export class ContributeComponent implements OnInit {
})
}
somethingChanged(e,i,item,mat_id,curr_data){
console.log(curr_data.school_req_id)
let bal_qty=curr_data.qty-curr_data.received_qty
if(e > bal_qty){
alert("Given value is greater than Balance Qty")
if(this.finalData.length > 0){
this.finalData=this.finalData.filter(val=>{
return 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)
// console.log(this.finalData);
}
this.sponsor_qty[i]=''
this.Total[i]=''
// console.log(this.finalData)
return
}
// console.log(this.finalData);
// console.log(e,i,item);
this.Total[i] = e*item;
let data = {
'id':'',
'cont_id':'',
'qty': e,
'amount' : item,
'amount' : item*e,
'req_id': curr_data.school_req_id,
'school_id':curr_data.school_id,
'dist_id':curr_data.district_id
@ -158,7 +230,14 @@ export class ContributeComponent implements OnInit {
}
dev_fund_change(value){
if(value != ''){
if(value<=0){
alert('Given value is Invalid');
this.general_devlop_amt=''
}
}
}
getSchoolReqList2()
{
@ -207,6 +286,8 @@ export class ContributeComponent implements OnInit {
reset(){
this.Contribute.reset();
this.school=[]
this.material_category=this.all_material_category
}
ngAfterViewInit() {

View File

@ -6,6 +6,7 @@ import { ApiService } from 'app/shared/api.service';
import { Location } from "@angular/common";
import { MatDialog } from '@angular/material';
import { RegisterComponent } from '../register/register.component';
import { AdminLayoutComponent } from 'app/layouts/admin/admin-layout.component';
@Component({
selector: 'ms-login-session',
@ -71,6 +72,7 @@ this.previousUrl = this.restApi.getPreviousUrl();
// this.router.navigate(['/home']);
// this.matDialog.closeAll()
this.matDialog.closeAll()
// this.adminLayout.ngOnInit();
}else{
// this.router.navigate([this.previousUrl]);
// this.location.back();

View File

@ -48,8 +48,8 @@
<h3><strong><span class="amount"><span class="currency-symbol">&#8377;&nbsp;</span>{{grand_tot_value}}</span></strong></h3><br/>
<mat-radio-group aria-label="Payment Mode" [(ngModel)]="payment_mode">
<mat-radio-button value="online" disabled>Online</mat-radio-button>&nbsp;
<mat-radio-button value="offline">Offline</mat-radio-button>
<mat-radio-button value="1" disabled>Online</mat-radio-button>&nbsp;
<mat-radio-button value="2">Offline</mat-radio-button>
</mat-radio-group>
</mat-card-content>

View File

@ -47,7 +47,7 @@ export class PaymentComponent implements OnInit {
contribute_type: any;
contributeKind: FormGroup;
contribute_params: any;
payment_mode:any='offline';
payment_mode:any="2"; //1-online 2-offline
maxDate=new Date()
constructor(public restApi:ApiService,public fb:FormBuilder,public router:Router,private apiService:ApiService) {
this.isToken();

View File

@ -162,24 +162,26 @@
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="40" fxFlex.lg="1000" fxFlex.xl="40"> -->
<mat-card class="p-2" fxFlex="100%" fxFlex.xs="100" fxFlex.sm="100">
<h4>Requirements</h4>
<mat-tab-group class="mt-2">
<mat-tab class="tab-group">
<ng-template mat-tab-label>Requirement Details</ng-template>
<!--<mat-tab-group class="mt-2">
<mat-tab class="tab-group">-->
<!-- <ng-template mat-tab-label>Requirement Details</ng-template>
<mat-card-content>
<table style="padding:20px;">
<tr>
<!-- <th>Details</th> -->
<th>Material Name</th>
<!-- <th>Estimation</th> -->
<th>Cost Per unit</th>
<th>Qty</th>
<th>Description</th>
</tr>
<tr *ngFor="let item of all_material_list">
<!-- <td>{{item.cat_name}}</td> -->
<td>{{item.material_name}}</td>
<!-- <td>{{schoolInfo.total_cost}}</td> -->
<td>{{item.cost_per_unit}}</td>
<td>{{item.qty}}</td>
<td>{{item.desc}}</td>
</tr>
</table>
<div fxLayout fxLayout="row" fxLayout.xs="column" fxLayoutGap.xs="0">
@ -188,8 +190,89 @@
</div>
</div>
</mat-card-content>
</mat-tab>
</mat-card-content> -->
<div class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource" matSort>
<!-- Requirement Column -->
<!-- <ng-container matColumnDef="Requirement">
<th style="width: 15% !important;" mat-header-cell *matHeaderCellDef mat-sort-header></th>
<td style="width: 15% !important;" mat-cell *matCellDef="let row" class="product-thumbnail"><img src="{{row.img_url}}" onerror="this.onerror=null;this.src='assets/images/csr-img/error_img.jpg';" alt="School Img" width="70"></td>
</ng-container> -->
<!-- Item Need Column -->
<ng-container matColumnDef="Item Need">
<th style="width: 20% !important;" mat-header-cell *matHeaderCellDef mat-sort-header>Item Needed</th>
<td style="width: 20% !important;" mat-cell *matCellDef="let row" class="product-thumbnail">{{row.material_name}} </td>
</ng-container>
<!-- School Column -->
<!-- <ng-container matColumnDef="School">
<th style="width: 25% !important;text-align: center !important;" mat-header-cell *matHeaderCellDef mat-sort-header>School</th>
<td style="width: 25% !important;" mat-cell *matCellDef="let row"> <a (click)="goToProjectDet(row)">{{row.school_name}}</a>, {{row.block_name}} Block, {{row.district_name}} District.</td>
</ng-container> -->
<ng-container matColumnDef="School">
<th style="width: 25% !important;text-align: center !important;" mat-header-cell *matHeaderCellDef mat-sort-header>Description</th>
<td style="width: 25% !important;" mat-cell *matCellDef="let row"> {{row.desc}}</td>
</ng-container>
<!-- Quantity Column -->
<ng-container matColumnDef="Required Qty">
<th style="width: 10% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Required Qty </th>
<td style="width: 10% !important;text-align: center;" mat-cell *matCellDef="let row"> {{row.qty}}</td>
</ng-container>
<ng-container matColumnDef="Received Qty">
<th style="width: 10% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Received Qty </th>
<td style="width: 10% !important;text-align: center;" mat-cell *matCellDef="let row"> {{row.received_qty}}</td>
</ng-container>
<ng-container matColumnDef="balance Qty">
<th style="width: 8% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Balance Qty </th>
<td style="width: 8% !important;text-align: center;" mat-cell *matCellDef="let row"> {{row.qty-row.received_qty <= 0 ? '' : row.qty-row.received_qty }}</td>
</ng-container>
<!-- Sponsor Column -->
<ng-container matColumnDef="Sponsor Qty">
<th style="width: 10% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Sponsored Qty </th>
<td style="width: 10% !important;" mat-cell *matCellDef="let row;let i = index"> <input step="1" min="1" max="" title="Qty" [(ngModel)]="sponsor_qty[i]" class="text" size="2" type="number" (change)="somethingChanged($event.target.value,i,row.cost_per_unit,row.mat_id,row)" style="width: 100% !important;text-align: center;"> </td>
</ng-container>
<!-- price Column -->
<ng-container matColumnDef="Cost Per Unit">
<th style="width: 10% !important;text-align: right;" mat-header-cell *matHeaderCellDef mat-sort-header > Cost Per Unit <br/> (in Rs) </th>
<td style="width: 10% !important;" mat-cell *matCellDef="let row;" style="text-align: right;"> {{row.cost_per_unit === null?0:row.cost_per_unit}} </td>
<!-- <td mat-footer-cell *matFooterCellDef> Total </td> -->
</ng-container>
<!-- Total Column -->
<ng-container matColumnDef="Amount">
<th style="width: 20% !important;" mat-header-cell *matHeaderCellDef mat-sort-header style="text-align: right;"> Amount (in Rs) </th>
<td style="width: 20% !important;" mat-cell *matCellDef="let row ;let i=index" style="text-align: right;">{{Total[i]}} </td>
<!-- <td mat-footer-cell *matFooterCellDef> {{somethingChanged()}} </td> -->
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<!-- <tr mat-footer-row *matFooterRowDef="tableColumns"></tr> -->
</table>
<div class="clearfix order-total" style="padding-bottom: 0px !important;">
<div class="calculated-shipping" style="text-align: -webkit-right !important;">
<table class="table-responsive" cellspacing="0" style="width: 50% !important;">
<tr class="order-total" style="text-align: right;">
<td style="font-weight: bold;">Total</td>
<td> <strong><span class="amount"><span class="currency-symbol">&#8377;</span>{{grandTotal}}</span></strong></td>
</tr>
</table>
</div>
</div>
<!-- <mat-paginator [pageSize]="pageSize" [pageSizeOptions]="[5, 10, 25, 50, 100]" showFirstLastButtons></mat-paginator> -->
<div class="pt-1 pr-1" style="text-align: right;font-weight: bold;">
<button mat-raised-button color="primary" (click)="finalSave(2)" class="mr-1 mb-1"><span style="font-weight: bold;font-size: 16px">I'd like to Contribute in kind</span></button>
<button (click)="finalSave(1)" color="secondary" mat-raised-button style="font-style:bold;background-color:rgb(69, 189, 189);color:white" ><span style="font-weight: bold;background-color:rgb(69, 189, 189);color:white;font-size: 16px">I'd like to Contribute in Cash</span></button>
</div>
</div>
<!-- </mat-tab>-->
<!-- <mat-tab>
<ng-template mat-tab-label>Updates</ng-template>
<mat-card-content>
@ -281,7 +364,7 @@
</div>
</mat-card-content>
</mat-tab> -->
</mat-tab-group>
<!--</mat-tab-group>-->
</mat-card>
<!-- <mat-card class="support_mat" fxFlex="25%" fxFlex.xs="100" fxFlex.sm="100px">

View File

@ -99,9 +99,9 @@ td, th {
font-size: 16px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
// tr:nth-child(even) {
// background-color: #dddddd;
// }
.img-thumbnail {
border: 1px solid #ddd;
border-radius: 4px;
@ -161,6 +161,101 @@ td, th {
tab-group{
width: 100%;
}
table {
width: 100%;
}
.mat-form-field {
font-size: 14px;
width: 100%;
}
td, th {
width: 25%;
// text-align: center;
}
table.shop-table {
// border-collapse: separate;
border-spacing: 0;
border-width: 1px 0 0 1px;
// table-layout: fixed;
width: 100%;
padding: 1rem;
}
table {
width: 100%;
}
.m-t-0 {
margin-top: 0;
}
.table-responsive {
text-align: left;
}
.calculated-shipping {
width: 50%;
float: right;
padding: 1rem;
}
.update-btn {
float: right;
}
.order-checkout {
margin-top: 1rem;
}
table.shop-table th {
text-align: left;
}
table td,
table th {
border: none;
border-bottom: 1px solid #e9e9e9;
padding: 12px;
vertical-align: middle;
}
.order-total {
padding-bottom: 2rem;
}
.product-name {
font-size: 1rem;
font-weight: bold;
}
// .product-remove {
// width: 7%;
// .remove {
// font-size: 2rem;
// }
// }
.quantity.buttons_added{
input{
width: 50px;
}
}
@media(max-width:768px) {
.main-detail-product {
padding: 0.3rem !important;
}
}
@media(max-width:580px){
.product-thumbnail {
display: none;
}
.calculated-shipping{
width: 100%;
}
}

View File

@ -4,6 +4,7 @@ import { ApiService } from 'app/shared/api.service';
import { FormBuilder } from '@angular/forms';
import { Router, ActivatedRoute } from '@angular/router';
import { SchoolDetailsService } from 'app/shared/school-details.service';
import { MatTableDataSource } from '@angular/material';
@Component({
selector: 'app-project-detail',
@ -17,6 +18,17 @@ export class ProjectDetailComponent implements OnInit {
schoolInfo: any ;
all_material_list: any;
displayedColumns: string[] = [ 'Item Need', 'School', 'Required Qty','Received Qty','balance Qty', 'Sponsor Qty', 'Cost Per Unit', 'Amount'];
dataSource:any = new MatTableDataSource();
dataLength:any;
pageSize = 10;
sponsor_qty:any=[]
finalData: any = [];
Total: any=[];
whole_contribute_list: any;
grandTotal: any=[];
general_devlop_amt: string;
gen_dev_fund_remarks: any;
// types_of_funds=['State Fund','District Fund','School common Fund','For this Project']
constructor(public restApi:ApiService,public fb:FormBuilder,public router:Router,public schInfo:SchoolDetailsService,private activatedRoute:ActivatedRoute) { }
@ -26,6 +38,7 @@ export class ProjectDetailComponent implements OnInit {
// console.log(this.activatedRoute.snapshot.paramMap(''))
console.log("State",data)
this.schInfo.SchoolDetails.subscribe(schDetl=>this.schoolInfo = schDetl);
console.log("sch",this.schoolInfo)
this.imageSources = this.schoolInfo.images;
console.log("param",data)
if( data != '' && data != null){
@ -33,9 +46,106 @@ export class ProjectDetailComponent implements OnInit {
this.getSchoolReqList(data)
}
else{
this.getSchoolReqList();
this.getSchoolReqList(this.schoolInfo.school_id);
}
}
somethingChanged(e,i,item,mat_id,curr_data){
let bal_qty=curr_data.qty-curr_data.received_qty
if(e > bal_qty){
alert("Given value is greater than Balance Qty")
if(this.finalData.length > 0){
this.finalData=this.finalData.filter(val=>{
return 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)
// console.log(this.finalData);
}
this.sponsor_qty[i]=''
this.Total[i]=''
// console.log(this.finalData)
return
}
console.log(curr_data.school_req_id)
// console.log(e,i,item);
this.Total[i] = e*item;
let data = {
'id':'',
'cont_id':'',
'qty': e,
'amount' : item*e,
'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
console.log("final",this.finalData)
}
finalSave(flag)
{
if(!this.restApi.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":"",
"payment_ref":"",
"contributions":this.finalData,
}};
console.log(data);
console.log("whole cont",this.whole_contribute_list);
this.restApi.csrContribute(data).subscribe(result=>{
if(result['dataStatus']){
data.records.id=result['records']
data.records.contributions=[]
// 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'],{replaceUrl:true})
// }
}
else{
console.log("something went wrong")
}
},err=>{
console.log("Error")
})
}
getIndividualSchoolReqData(id){
@ -59,6 +169,8 @@ getIndividualSchoolReqData(id){
if (schDet.dataStatus == true) {
// console.log(schDet);
this.dataSource=schDet.records
this.dataLength=schDet.records.length
this.all_material_list=schDet.records
let projectList = schDet.records.filter(sch=>sch.school_id==this.schoolInfo.school_id)[0];

View File

@ -18,12 +18,26 @@
<mat-form-field style="width: 100%">
<input matInput placeholder="E Mail" type="email" name="email" formControlName="email" required>
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Confirm E Mail" type="email" name="confirm_email" formControlName="confirm_email" required (change)="checkValidators($event.target.value,'email')">
</mat-form-field>
<div style="color:red;font-size: 14px;float: right" *ngIf="email_pattern_error"> Email & Confirm Email does not match.</div>
<mat-form-field style="width: 100%">
<input matInput placeholder="Phone Number" type="number" name="mobile" formControlName="mobile" required>
</mat-form-field>
<!-- <mat-form-field style="width: 100%">
<input matInput [matDatepicker]="picker" [max]="maxDate" placeholder="Date of Birth" formControlName="user_dob">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field> -->
<mat-form-field style="width: 100%">
<input matInput placeholder="Password" type="password" name="password" formControlName="password" required>
<input matInput placeholder="Password" type="password" name="password" formControlName="password" required >
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Confirm Password" type="password" name="confirm_password" formControlName="confirm_password" required (change)="checkValidators($event.target.value,'pass')">
</mat-form-field>
<div style="color:red;font-size: 14px;float: right" *ngIf="pass_pattern_error"> Password & Confirm Password does not match.</div>
<!-- <div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 25%;">
<input matInput placeholder="Phone OTP" type="number" name="pOTP" formControlName="pOTP" required>
@ -58,21 +72,24 @@
</div>
<div *ngIf="slide2">
<mat-form-field style="width: 100%">
<input matInput placeholder="PAN of the Organisation" type="number" name="org_pan" formControlName="org_pan" required>
<input matInput placeholder="PAN of the Organisation" type="text" name="org_pan" max="10" maxlength="10" formControlName="org_pan" required>
</mat-form-field>
</div>
</div>
<mat-label>Conscent profile share to public</mat-label>
<mat-radio-group placeholder="Conscent profile share to public" formControlName="profile_share">
</div>
<mat-checkbox formControlName="profile_share">I hereby give my consent to share details of my contribution in public domain</mat-checkbox><br/><br/>
<mat-checkbox formControlName="notify_pref" text-wrap></mat-checkbox>&nbsp;
<span tex-wrap>I hereby give my consent to receive periodic updates through email and other modes</span>
<!-- <mat-label>Conscent profile share to public</mat-label>
<mat-radio-group placeholder="Consent profile share to public" formControlName="profile_share">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <mat-radio-button value="yes" >Yes</mat-radio-button>&nbsp;
<mat-radio-button value="no">No</mat-radio-button>
</mat-radio-group><br/><br/>
<mat-label>Conscent Receive updates via Email</mat-label>
<mat-radio-group aria-label="Conscent Receive updates via Email" formControlName="notify_pref">
<mat-radio-group aria-label="Consent Receive updates via Email" formControlName="notify_pref">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <mat-radio-button value="yes" >Yes</mat-radio-button>&nbsp;
<mat-radio-button value="no">No</mat-radio-button>
</mat-radio-group><br/>
<button class="mat-red" mat-raised-button (click)="csrUserRegistration()">Register</button>
</mat-radio-group><br/> --><br/><br/>
<button class="mat-red" mat-raised-button (click)="csrUserRegistration()">Register</button>
<!-- <div>
<p>Sign Up Using</p> <a href="#" class="shared-icon mr-1 mat-blue"><i class="fa fa-facebook fa-lg mr-1"></i> Facebook</a><a href="#" class="shared-icon mat-red"><i class="fa fa-google fa-lg mr-1"></i>Google</a>

View File

@ -2,7 +2,7 @@ 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 { FormBuilder, FormControl, Validators, FormGroup } from '@angular/forms';
import { MatDialog, DialogRole, MatDialogRef, MatDialogConfig } from '@angular/material';
import { LoginComponent } from '../login/login.component';
@ -18,10 +18,13 @@ export class RegisterComponent {
email: string;
password: string;
passwordConfirm: string;
go_reg: any;
go_reg:FormGroup
slide1: boolean;
slide2: boolean;
allowedChars = new Set('0123456789'.split('').map(c => c.charCodeAt(0)));
pass_pattern_error: boolean;
email_pattern_error: boolean;
maxDate=new Date()
constructor(public restApi:ApiService,public fb:FormBuilder,public router:Router,private matDialog:MatDialog,private dialog_ref:MatDialogRef<RegisterComponent>) { }
ngOnInit() {
@ -36,16 +39,19 @@ export class RegisterComponent {
{
id: new FormControl(''),
name: new FormControl(''),
email: new FormControl(''),
email: new FormControl('',Validators.email),
confirm_email:new FormControl('',Validators.email),
mobile: new FormControl(''),
// user_dob:new FormControl(''),
password: new FormControl(''),
confirm_password:new FormControl(''),
org_info: this.fb.group({
orgname: new FormControl(''),
org_address: new FormControl(''),
org_pan: new FormControl(''),
}),
profile_share:new FormControl(''),
notify_pref:new FormControl(''),
profile_share:new FormControl(false),
notify_pref:new FormControl(false),
"created_by":"1",
"updated_by":"1"
@ -60,11 +66,45 @@ export class RegisterComponent {
this.slide1=false
}
}
setValidatorConfirmPass(value){
console.log(value)
// this.go_reg.Validators(Validators.pattern)
// console.log(this.go_reg.controls)
// this.go_reg.controls['confirm_password'].setValidators(Validators.compose([ Validators.pattern=value]))
// console.log(this.go_reg.controls)
}
checkValidators(value,option){
if(option == 'pass'){
if(value == this.go_reg.value.password){
this.pass_pattern_error=false
}
else{
this.pass_pattern_error=true
}
}
if(option == 'email'){
if(value == this.go_reg.value.email){
this.email_pattern_error=false
}
else{
this.email_pattern_error=true
}
}
}
check(event: KeyboardEvent) {
// console.log("e",event)
// 31 and below are control keys, don't block them.
if (event.keyCode > 31 && !this.allowedChars.has(event.keyCode)) {
event.preventDefault();
}
}
change_fun2(value){
console.log(value)
if(value.checked == true){
this.slide2=true
// this.go_reg.controls['org_pan'].setV
}
else{
this.slide2=false
@ -86,11 +126,18 @@ export class RegisterComponent {
}
csrUserRegistration()
{
// this.go_reg.removeControl('confirm_password')
// this.go_reg.removeControl('cofirm_email')
// console.log(this.go_reg.value);return false;
let url = `${environment.apiUrl}${'csrUserRegistration'}`;
console.log("dd",url)
let data = this.go_reg.value;
delete data.confirm_email
delete data.confirm_password
this.restApi.post(url,data).subscribe(schDet=>
{
{
console.log("result",schDet)
// this.router.navigate(['/authentication/login']);
this.loginScreen()
})

View File

@ -1,16 +1,16 @@
<table mat-table [dataSource]="dataSource" matSort>
<!-- Requirement Column -->
<ng-container matColumnDef="Requirement">
<th style="width: 15% !important;" mat-header-cell *matHeaderCellDef mat-sort-header>Requirement</th>
<td style="width: 15% !important;" mat-cell *matCellDef="let row" class="product-thumbnail"><img src="{{row.img_url}}" onerror="this.onerror=null;this.src='https://upload.wikimedia.org/wikipedia/commons/thumb/1/15/No_image_available_600_x_450.svg/600px-No_image_available_600_x_450.svg.png';" alt="School Img" width="70"></td>
</ng-container>
<!-- <ng-container matColumnDef="Item Need">
<th style="width: 15% !important;text-align: right;float: center" mat-header-cell *matHeaderCellDef mat-sort-header>Item Needed</th>
<td style="width: 15% !important;" mat-cell *matCellDef="let row" class="product-thumbnail"><img src="{{row.img_url}}" onerror="this.onerror=null;this.src='assets/images/csr-img/error_img.jpg';" alt="School Img" width="70"><br/><span> {{row.material_name}} </span></td>
</ng-container> -->
<!-- Item Need Column -->
<ng-container matColumnDef="Item Need">
<th style="width: 15% !important;" mat-header-cell *matHeaderCellDef mat-sort-header>Item Need</th>
<td style="width: 15% !important;" mat-cell *matCellDef="let row" class="product-thumbnail"> {{row.material_name}} </td>
</ng-container>
<th style="width: 20% !important;text-align: right;float: center" mat-header-cell *matHeaderCellDef mat-sort-header>Item Needed</th>
<td style="width: 20% !important;" mat-cell *matCellDef="let row" class="product-thumbnail"><span> {{row.material_name}} </span></td>
</ng-container>
<!-- School Column -->
<ng-container matColumnDef="School">
@ -24,23 +24,32 @@
<td style="width: 10% !important;" mat-cell *matCellDef="let row"> {{row.qty}}</td>
</ng-container>
<ng-container matColumnDef="Received Qty">
<th style="width: 10% !important;;text-align: center;" mat-header-cell *matHeaderCellDef mat-sort-header> Received Qty </th>
<td style="width: 10% !important;text-align: center;" mat-cell *matCellDef="let row"> {{row.received_qty}}</td>
</ng-container>
<ng-container matColumnDef="balance Qty">
<th style="width: 8% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Balance Qty </th>
<td style="width: 8% !important;text-align: center;" mat-cell *matCellDef="let row"> {{row.qty-row.received_qty <= 0 ? '' : row.qty-row.received_qty }}</td>
</ng-container>
<!-- Sponsor Column -->
<ng-container matColumnDef="Sponsor Qty">
<th style="width: 10% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Sponsor Qty </th>
<td style="width: 10% !important;" mat-cell *matCellDef="let row;let i = index"> {{row.sponsor_qty}} </td>
<th style="width: 10% !important;text-align: center" mat-header-cell *matHeaderCellDef mat-sort-header> Sponsor Qty </th>
<td style="width: 10% !important;text-align: center" mat-cell *matCellDef="let row;let i = index"> {{row.sponsor_qty}} </td>
</ng-container>
<!-- price Column -->
<ng-container matColumnDef="Cost Per Unit">
<th style="width: 15% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Cost Per Unit (in RS) </th>
<td style="width: 15% !important;" mat-cell *matCellDef="let row;"> {{row.cost_per_unit === null ? 0 : row.cost_per_unit}} </td>
<th style="width: 10%!important;text-align: right" mat-header-cell *matHeaderCellDef mat-sort-header> Cost Per Unit<br/> (in Rs) </th>
<td style="width: 10% ;text-align: center" mat-cell *matCellDef="let row;" > {{row.cost_per_unit === null ? 0 : row.cost_per_unit}} </td>
<!-- <td mat-footer-cell *matFooterCellDef> Total </td> -->
</ng-container>
<!-- Total Column -->
<ng-container matColumnDef="Amount">
<th style="width: 20% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Amount (in RS) </th>
<td style="width: 20% !important;" mat-cell *matCellDef="let row ;let i=index">{{row.amount}} </td>
<th style="width: 20% !important;" mat-header-cell *matHeaderCellDef mat-sort-header> Amount (in Rs) </th>
<td style="width: 20% !important;" mat-cell *matCellDef="let row ;let i=index" style="text-align: right">{{row.amount}} </td>
<!-- <td mat-footer-cell *matFooterCellDef> {{somethingChanged()}} </td> -->
</ng-container>

View File

@ -12,7 +12,7 @@ export class ReqListComponent implements OnInit {
@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'];
displayedColumns: string[] = [ 'Item Need', 'School', 'Required Qty', 'Received Qty', 'balance Qty','Sponsor Qty', 'Cost Per Unit', 'Amount'];
constructor() {
}

View File

@ -0,0 +1,215 @@
<!--
<div fxLayout="row wrap" fxLayoutAlign="center center">
<mat-card class="p-2" fxFlex="80%" fxFlex.xs="100" fxFlex.sm="100">
<mat-tab-group class="mt-2">
<mat-tab class="tab-group">
<ng-template mat-tab-label>Profile</ng-template>
<mat-card-content >
<form [formGroup]="profile_form">
<mat-form-field>
<input matInput type="text" formControlName="name" placeholder="Name" autocomplete="off">
</mat-form-field>
<mat-form-field>
<input matInput type="email" formControlName="email" placeholder="Email" autocomplete="off">
</mat-form-field>
<mat-form-field>
<input matInput type="number" formControlName="mobile" placeholder="Mobile No." autocomplete="off">
</mat-form-field>
</form>
</mat-card-content>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label>Contributions</ng-template>
</mat-tab>
</mat-tab-group>
</mat-card>
</div> -->
<!-- <div class=""> -->
<!-- <div class=""> -->
<div fxLayoutAlign="center start" >
<mat-tab-group class="mt-2">
<mat-tab class="tab-group">
<div fxLayout="column " fxFlex.xl="40" fxFlex.lg="100" fxFlex.md="50" fxFlex.sm="80" fxFlex.xs="90">
<ng-template mat-tab-label style="color: white">My Profile</ng-template>
<mat-card class="login-session">
<!-- <p class="mb-0" style="text-align: right;">Already Registered ? <a (click)="login_screen()" class="mat-text-primary">Login Here</a></p> -->
<!-- <div> -->
<h2 class="base-border">My Profile</h2>
<!-- <p>We would need some of your information to facilitate your contributions and keep you updated on the progress of the projects or new projects</p> -->
<form [formGroup]="profile_form">
<div fxLayout="column" fxLayoutAlign="start stretch">
<mat-form-field style="width: 80%;justify-content:center;align-content: center;">
<input matInput placeholder="Name" type="text" name="name" formControlName="name" required>
</mat-form-field>
<mat-form-field style="width: 80%">
<input matInput placeholder="E Mail" type="email" name="email" formControlName="email" required>
</mat-form-field>
<mat-form-field style="width: 80%">
<input matInput placeholder="Phone Number" type="number" name="mobile" formControlName="mobile" required>
</mat-form-field>
<!-- <mat-form-field style="width: 100%">
<input matInput placeholder="Password" type="password" name="password" formControlName="password" required>
</mat-form-field> -->
<!-- <div fxLayout="row" fxLayoutAlign="start center" class="mb-2">
<mat-form-field dividerColor="primary" class="ml-xs mr-xs" style="width: 25%;">
<input matInput placeholder="Phone OTP" type="number" name="pOTP" formControlName="pOTP" required>
</mat-form-field>
<mat-form-field dividerColor="accent" class="ml-xs mr-xs" style="width: 25%;">
<input matInput placeholder="Email OTP" type="emailOTP" name="emailOTP" formControlName="emailOTP" required>
</mat-form-field>
<button class="mat-green" mat-raised-button>Verify</button>
</div> -->
</div>
<!-- <hr>
<div class="mt-1 mb-1">
<label class="mr-1">Registering as on Organisation ?</label>
<mat-slide-toggle name="slideToggle" required (change)="change_fun($event)">
</mat-slide-toggle>
{{slidetoggle}}
</div>
<div fxLayout="column" fxLayoutAlign="start stretch" formGroupName="org_info">
<div *ngIf="slide1">
<mat-form-field style="width: 100%">
<input matInput placeholder="Organisation Name" type="text" name="orgname" formControlName="orgname" required>
</mat-form-field>
<mat-form-field style="width: 100%;">
<textarea matInput placeholder="Register Address" name="org_address" formControlName="org_address" required></textarea>
</mat-form-field>
</div>
<div class="mt-1 mb-1">
<label class="mr-1">Do you want to avail 80G Exemption</label>
<mat-slide-toggle name="slideToggle" (change)="change_fun2($event)" required>
</mat-slide-toggle>
</div>
<div *ngIf="slide2">
<mat-form-field style="width: 100%">
<input matInput placeholder="PAN of the Organisation" type="tel" name="org_pan" maxlength="10" formControlName="org_pan" required>
</mat-form-field>
</div>
</div> -->
<mat-checkbox formControlName="profile_share"></mat-checkbox>&nbsp;<span>I hereby give my consent to share my profile with public</span><br/><br/>
<mat-checkbox formControlName="notify_pref" text-wrap></mat-checkbox>&nbsp;
<span tex-wrap>I hereby give my consent to receive updates on various requirements and progress, through email or other modes</span>
<!-- <mat-label>I hereby give my consent to share my profile with public</mat-label>
<mat-radio-group placeholder="Consent profile share to public" formControlName="profile_share">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <mat-radio-button value="yes" >Yes</mat-radio-button>&nbsp;
<mat-radio-button value="no">No</mat-radio-button>
</mat-radio-group><br/><br/>
<mat-label>I hereby give my consent to receive updates on various requirements and progress, through email or other modes</mat-label>
<mat-radio-group aria-label="Consent Receive updates via Email" formControlName="notify_pref">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<mat-radio-button value="yes" >Yes</mat-radio-button>&nbsp;
<mat-radio-button value="no">No</mat-radio-button>
</mat-radio-group><br/><br/> -->
<br/><br/>
<!-- <button class="mat-red" mat-raised-button (click)="csrUserRegistration()">Register</button> -->
<!-- <div>
<p>Sign Up Using</p> <a href="#" class="shared-icon mr-1 mat-blue"><i class="fa fa-facebook fa-lg mr-1"></i> Facebook</a><a href="#" class="shared-icon mat-red"><i class="fa fa-google fa-lg mr-1"></i>Google</a>
</div> -->
</form>
<!-- </div> -->
</mat-card>
</div>
</mat-tab>
<!-- <mat-tab class="tab-group">
<ng-template mat-tab-label>Contributions</ng-template>
<mat-card class="login-session">
<h2 class="base-border">Contributions</h2>
<mat-card-content fxLayoutAlign="center center">
<div fxLayout="row wrap" fxFlex.xl="40" fxFlex.lg="100" fxFlex.md="50" fxFlex.sm="80" fxFlex.xs="60" fxLayoutAlign="center center" fxLayoutGap="20px">
<mat-card class="card_contribution" *ngFor="let data of contribution_data" fxFlex.lg="100" fxFlex.xs="100">
<mat-card-content>
<div fxFlex="30">
<h6>{{data.cont_type == '1' ? 'Fund' : 'Material'}} <span>{{data.payment_mode == '1' ? 'Online' : data.payment_mode == '2' ? 'Offline' : 'Offline'}}</span></h6>
</div>
<div fxFlex="30">
<p>Total Amount : {{data.amount}} <span style="float: right" *ngIf="data.cont_towards == '1' || data.cont_type == '2'">{{data.gen_dev_fund_remarks}}</span></p>
</div>
</mat-card-content>
</mat-card>
</div>
</mat-card-content>
</mat-card> -->
<!-- </mat-tab> -->
<mat-tab class="tab-group">
<div fxLayout="column" fxFlex.xl="100" fxFlex.lg="100" fxFlex.md="50" fxFlex.sm="80" fxFlex.xs="90" fxLayoutAlign="center center">
<mat-card class="login-session" style="width: 80%">
<ng-template mat-tab-label>Contributions</ng-template>
<h2 class="base-border">Contributions</h2>
<table mat-table
[dataSource]="dataSource" multiTemplateDataRows
class="mat-elevation-z8">
<ng-container matColumnDef="Date">
<mat-header-cell class="cell" *matHeaderCellDef> Date and Time </mat-header-cell>
<mat-cell class="cell" *matCellDef="let details;" style="justify-content:flex-start">
<div mat-line>{{details.contribute_date}}</div>
<!-- <small mat-line>{{details.pd_type_name}}</small> -->
</mat-cell>
</ng-container>
<ng-container matColumnDef="contribute_type">
<mat-header-cell class="cell" *matHeaderCellDef> Contribution Type </mat-header-cell>
<mat-cell class="cell" *matCellDef="let details;" style="justify-content:flex-start">
<div mat-line style="font-weight: bold">{{details.cont_towards == '1' ? 'State School Development Fund' : details.cont_type == '1' ? 'Fund' : 'Materials'}}</div>
<!-- <small mat-line>{{details.pd_type_name}}</small> -->
</mat-cell>
</ng-container>
<ng-container matColumnDef="payment_mode">
<mat-header-cell class="cell" *matHeaderCellDef style="justify-content:flex-end"> Payment Mode </mat-header-cell>
<mat-cell class="cell" *matCellDef="let data;" style="justify-content:flex-end">
<div mat-line>{{data.payment_mode == '1' ? 'Online' : data.payment_mode == '2' ? 'Offline' : 'Offline'}}</div>
<!-- <small mat-line>{{details.pd_type_name}}</small> -->
</mat-cell>
</ng-container>
<ng-container matColumnDef="payment_ref">
<mat-header-cell class="cell" *matHeaderCellDef style="justify-content:flex-end"> Payment Status </mat-header-cell>
<mat-cell class="cell" *matCellDef="let data;" style="justify-content:flex-end">
<div mat-line>{{data.txnstatus}}</div>
<!-- <small mat-line>{{details.pd_type_name}}</small> -->
</mat-cell>
</ng-container>
<ng-container matColumnDef="tot_amount">
<mat-header-cell class="cell" *matHeaderCellDef style="justify-content:flex-end"> Total Amount </mat-header-cell>
<mat-cell class="cell" *matCellDef="let details;" style="justify-content:flex-end">
<div mat-line style="font-weight: bold">{{details.amount}}</div>
<!-- <small mat-line>{{details.pd_type_name}}</small> -->
</mat-cell>
</ng-container>
<div matColumnDef="expandedDetail" class="detail_row">
<ng-container >
<div *matCellDef="let detail">
<div *ngFor="let det of detail.child_data;let i=index" class="child_card">
<p style="margin-left:20px;"> {{det.material_name}} ({{det.qty}}) at {{det.school_name}} , {{det.district_name}} District, <span> Valuing Rs. {{det.amount}}</span></p>
<!-- <p>{{det.amount}}</p> -->
</div>
</div>
</ng-container>
</div>
<mat-header-row style="align-items: normal !important;" *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;"
matRipple
class="element-row"
[class.expanded]="expandedElement == row"
(click)="expandedElement = row">
</mat-row>
<mat-row *matRowDef="let row; columns: ['expandedDetail']"
[@detailExpand]="row == expandedElement ? 'expanded' : 'collapsed'"
style="overflow: hidden;background-color:rgb(236, 236, 236);">
</mat-row>
</table>
</mat-card>
</div>
</mat-tab>
</mat-tab-group>
</div>
<!-- </div>
</div> -->

View File

@ -0,0 +1,83 @@
.tab-group{
color:white;
background-color: white
}
/* active tab */
// ::ng-deep .mat-tab-list .mat-tab-labels .mat-tab-label-active {
// color:white;
// // background-color:;
// // background-color:white
// }
// ::ng-deep .mat-tab-list .mat-tab-labels .mat-tab-label-inactive {
// color:white;
// // background-color:;
// // background-color:white
// }
// .mat-tab-label{
// color:white;
// }
/* ink bar */
::ng-deep .mat-ink-bar {
background-color: var(--primary-color,rgb(9, 184, 184)) !important;
}
.card_contribution{
// border: 2px solid gray;
// color: bisque;
box-shadow: 10px solid gray;
}
// .cell{
// display:inline !important;
// }
// .cellhide{
// display: none !important;
// }
// .cell {
// padding: 20px 20px 20px 20;
// }
// .mat-table {
// overflow: auto;
// max-height: 500px;
// width: 100%;
// }
// .tab-group{
// width: 100%;
// }
table {
width: 100%;
table-layout: fixed;
}
th, td {
overflow: hidden;
width: 200px;
text-overflow: ellipsis;
white-space: nowrap;
}
.element-row {
position: relative;
}
.element-row:not(.expanded) {
cursor: pointer;
}
.element-row:not(.expanded):hover {
background: #f5f5f5;
}
.element-row.expanded {
border-bottom-color: transparent;
}
.child_card{
color:black;
font-size: 16px;
// background-color: bisque;
padding-left: 55px;
margin: 15px;
}
.detail_row{
background-color: blue;
}

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UserProfileComponent } from './user-profile.component';
describe('UserProfileComponent', () => {
let component: UserProfileComponent;
let fixture: ComponentFixture<UserProfileComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UserProfileComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(UserProfileComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,59 @@
import { Component, OnInit } from '@angular/core';
import { ApiService } from 'app/shared/api.service';
import { FormGroup, FormBuilder } from '@angular/forms';
import {animate, state, style, transition, trigger} from '@angular/animations';
import { MatTableDataSource } from '@angular/material';
@Component({
selector: 'app-user-profile',
templateUrl: './user-profile.component.html',
styleUrls: ['./user-profile.component.scss'],
animations: [
trigger('detailExpand', [
state('collapsed', style({height: '0px', minHeight: '0', display: 'none'})),
state('expanded', style({height: '*'})),
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
]),
],
})
export class UserProfileComponent implements OnInit {
profile_form:FormGroup;
user_data:any;
contribution_data:any=[];
displayedColumns=['Date','contribute_type','payment_mode','payment_ref','tot_amount']
public dataSource = new MatTableDataSource();
isExpansionDetailRow = (i: number, row: Object) => row.hasOwnProperty('detailRow');
expandedElement: any
constructor(private apiService:ApiService,private _fb:FormBuilder) { }
ngOnInit() {
this.getProfile()
this.profile_form=this._fb.group({
name:['',{disabled:true}],
email:['',{disabled:true}],
mobile:['',{disabled:true}],
profile_share:['',{disabled:true}],
notify_pref:['',{disable:true}]
})
}
getProfile(){
this.apiService.getMyProfile().subscribe(res=>{
if(res['dataStatus']){
this.user_data=res['records'].user_data[0];
this.profile_form.patchValue(this.user_data)
this.contribution_data=res['records'].contribution_data
this.contribution_data.forEach(element=>{
element.detailRow=true;
})
console.log("con",this.contribution_data,this.isExpansionDetailRow);
this.dataSource=this.contribution_data;
}
})
}
changeFun(value,index){
console.log(value);
}
}

View File

@ -97,7 +97,7 @@
<nav>
<ul class="main-h-list" style="font-size: 16px;">
<li *ngFor="let menuitem of horizontalMenuItems.getAll()">
<a [routerLink]="['/'+menuitem.state]" *ngIf="menuitem.type === 'link'">
<a *ngIf="menuitem.type === 'link'" (click)="navRedirection(menuitem)">
<!--<mat-icon>{{ menuitem.icon }}</mat-icon>-->
<span><strong>{{ menuitem.name == 'Login' ? user_name == '' ? menuitem.name : user_name : menuitem.name | translate }}</strong></span>
</a>
@ -116,6 +116,9 @@
</li>
</ul>
</li>
<li style="cursor: pointer">
<span *ngIf="user_name != ''" (click)="signOut()"><strong>Log Out</strong></span>
</li>
</ul>
</nav>
</div>

View File

@ -10,6 +10,8 @@ import PerfectScrollbar from 'perfect-scrollbar';
import { PerfectScrollbarConfigInterface,
PerfectScrollbarComponent, PerfectScrollbarDirective } from 'ngx-perfect-scrollbar';
import { ApiService } from 'app/shared/api.service';
import { MatDialogConfig, DialogRole, MatDialogRef, MatDialog } from '@angular/material';
import { LoginComponent } from 'app/components/login/login.component';
@Component({
selector: 'app-layout-admin',
@ -39,7 +41,9 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
@ViewChild('sidemenu', { static: true }) sidemenu;
public config: PerfectScrollbarConfigInterface = {};
user_name:any='';
constructor(private router: Router, public menuItems: MenuItems, public horizontalMenuItems : HorizontalMenuItems, public translate: TranslateService,private apiService:ApiService ) {
constructor(private router: Router, public menuItems: MenuItems, public horizontalMenuItems : HorizontalMenuItems, public translate: TranslateService,private apiService:ApiService
,private matDialog:MatDialog ) {
apiService.getLoggedInName.subscribe(name => this.changeName(name));
const browserLang: string = translate.getBrowserLang();
translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');
}
@ -71,6 +75,10 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
}
});
}
changeName(value){
console.log("admin",value)
this.user_name=value
}
@HostListener('click', ['$event'])
onClick(e: any) {
@ -221,4 +229,40 @@ export class AdminLayoutComponent implements OnInit, OnDestroy {
}, 16);
}
// }
signOut(){
this.apiService.signOut()
this.router.navigateByUrl('/')
}
// [routerLink]="['/'+menuitem.state]"
navRedirection(menuitem){
console.log(menuitem,this.user_name)
if(menuitem.state == 'authentication'){
if(this.user_name != ''){
// return
this.router.navigateByUrl('/user-profile')
}
else{
// this.router.navigateByUrl('/'+menuitem.state)
this.loginScreen()
}
}
else{
this.router.navigateByUrl('/'+menuitem.state)
}
}
loginScreen(){
// this.dialog_ref.close();
const dialogConfig = new MatDialogConfig();
dialogConfig.disableClose = true;
dialogConfig.autoFocus = true;
this.matDialog.open(LoginComponent,{
height: '450px',
width: '400px',
panelClass: 'custom-modalbox',
})
}
}

View File

@ -55,21 +55,24 @@
</div>
<div *ngIf="slide2">
<mat-form-field style="width: 100%">
<input matInput placeholder="PAN of the Organisation" type="number" name="org_pan" formControlName="org_pan" required>
<input matInput placeholder="PAN of the Organisation" type="tel" name="org_pan" maxlength="10" formControlName="org_pan" required>
</mat-form-field>
</div>
</div>
<mat-label>Conscent profile share to public</mat-label>
<mat-radio-group placeholder="Conscent profile share to public" formControlName="profile_share">
<mat-checkbox formControlName="profile_share">I hereby give my consent to share my profile with public</mat-checkbox><br/><br/>
<mat-checkbox formControlName="notify_pref" text-wrap></mat-checkbox>&nbsp;
<span tex-wrap>I hereby give my consent to receive updates on various requirements and progress, through email or other modes</span>
<!-- <mat-label>I hereby give my consent to share my profile with public</mat-label>
<mat-radio-group placeholder="Consent profile share to public" formControlName="profile_share">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <mat-radio-button value="yes" >Yes</mat-radio-button>&nbsp;
<mat-radio-button value="no">No</mat-radio-button>
</mat-radio-group><br/><br/>
<mat-label>Conscent Receive updates via Email</mat-label>
<mat-radio-group aria-label="Conscent Receive updates via Email" formControlName="notify_pref">
<mat-label>I hereby give my consent to receive updates on various requirements and progress, through email or other modes</mat-label>
<mat-radio-group aria-label="Consent Receive updates via Email" formControlName="notify_pref">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<mat-radio-button value="yes" >Yes</mat-radio-button>&nbsp;
<mat-radio-button value="no">No</mat-radio-button>
</mat-radio-group><br/><br/>
</mat-radio-group><br/><br/> -->
<br/><br/>
<button class="mat-red" mat-raised-button (click)="csrUserRegistration()">Register</button>
<!-- <div>

View File

@ -1,3 +1,7 @@
.register-account {
background-color: #fff;
}
mat-checkbox{
overflow: hidden;
text-overflow: ellipsis
}

View File

@ -8,7 +8,8 @@ import {
MatButtonModule,
MatProgressBarModule,
MatToolbarModule,
MatSlideToggleModule} from '@angular/material';
MatSlideToggleModule,
MatCheckboxModule} from '@angular/material';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatIconModule} from '@angular/material';
import { FlexLayoutModule } from '@angular/flex-layout';
@ -34,7 +35,8 @@ import { SessionRoutes } from './session.routing';
MatSlideToggleModule,
MatProgressBarModule,
MatToolbarModule,
FlexLayoutModule
FlexLayoutModule,
MatCheckboxModule
],
declarations: [
LoginComponent,

View File

@ -1,4 +1,4 @@
import { Injectable } from '@angular/core';
import { Injectable, Output, EventEmitter } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { environment } from '../../environments/environment';
@ -22,9 +22,10 @@ export class ApiService {
expToken = new BehaviorSubject(false);
private previousUrl: string;
private currentUrl: string;
@Output() getLoggedInName: EventEmitter<any> = new EventEmitter();
constructor(public http:HttpClient,private router: Router) {
this.Token();
this.getPreviewUrl();
}
@ -106,9 +107,12 @@ export class ApiService {
setToken(token)
{
// console.log(token);
window.localStorage.setItem('token',token);
let token_value=this.jwtDecode(localStorage.getItem('token'))
this.getLoggedInName.emit(token_value['payload'].username)
}
Token()
@ -132,6 +136,10 @@ export class ApiService {
this.Token()
return this.expToken.value;
}
signOut(){
this.getLoggedInName.emit('')
localStorage.removeItem('token')
}
//API FOR CONTRIBUTE PAGE
csrContribute(DATA){
let token_decode=this.jwtDecode(localStorage.getItem('token'))
@ -146,6 +154,15 @@ export class ApiService {
getIndividualSchoolReqData(req_id){
return this.http.get(apiUrl+'getIndividualSchoolReqData/'+req_id)
}
getFilterMasters_get(){
return this.http.get(apiUrl+'getFilterMasters').pipe(catchError(err=>this.handleError(err)))
}
getMyProfile(){
let token_decode=this.jwtDecode(localStorage.getItem('token'))
return this.http.get(apiUrl+'getMyProfile/'+token_decode['payload'].userid).pipe(
catchError(err=>this.handleError(err))
)
}
}

View File

@ -5,6 +5,7 @@ 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';
import { RegisterComponent } from 'app/components/register/register.component';
@Injectable({
providedIn: 'root'
})
@ -27,9 +28,9 @@ export class AuthGuardService implements CanActivate{
dialogConfig.disableClose = true;
dialogConfig.autoFocus = true;
this.matDialog.open(LoginComponent,{
height: '450px',
width: '400px',
this.matDialog.open(RegisterComponent,{
"height":"600px",
"width":"550px",
panelClass: 'custom-modalbox'
})
// this.router.navigate(['/authentication'])

View File

@ -6,5 +6,5 @@
export const environment = {
production: false,
apiUrl:'https://lms.venbainfotech.com/csr/api/',
//apiUrl:'https://contribute.tnschools.gov.in/csrb/api/'
// apiUrl:'https://contribute.tnschools.gov.in/csrb/api/'
};

View File

@ -6,6 +6,7 @@ import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
window.console.log = function(){};
}
platformBrowserDynamic().bootstrapModule(AppModule);