diff --git a/.DS_Store b/.DS_Store index a18f87cf..a3371215 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/src/app/_helper/Requests.model.ts b/src/app/_helper/Requests.model.ts old mode 100644 new mode 100755 diff --git a/src/app/_helper/Users.model.ts b/src/app/_helper/Users.model.ts old mode 100644 new mode 100755 diff --git a/src/app/_helper/constants.ts b/src/app/_helper/constants.ts old mode 100644 new mode 100755 diff --git a/src/app/_helper/names.ts b/src/app/_helper/names.ts old mode 100644 new mode 100755 diff --git a/src/app/auth.guard.spec.ts b/src/app/auth.guard.spec.ts old mode 100644 new mode 100755 diff --git a/src/app/auth.guard.ts b/src/app/auth.guard.ts old mode 100644 new mode 100755 diff --git a/src/app/auth.service.spec.ts b/src/app/auth.service.spec.ts old mode 100644 new mode 100755 diff --git a/src/app/auth.service.ts b/src/app/auth.service.ts old mode 100644 new mode 100755 diff --git a/src/app/http.service.ts b/src/app/http.service.ts old mode 100644 new mode 100755 index 32c21f77..f1ce05e2 --- a/src/app/http.service.ts +++ b/src/app/http.service.ts @@ -23,121 +23,125 @@ export class HttpService { //Donor Apis - getUsers(){ + getUsers() { return this.http.get(environment.NODE_HOST + '/getUsers', this.httpOptions); } - getTransactions(ngoid){ + getTransactions(ngoid) { const payload = ngoid - return this.http.post(environment.NODE_HOST + '/getTransactions',{ NGOId: payload }, this.httpOptions); + return this.http.post(environment.NODE_HOST + '/getTransactions', { NGOId: payload }, this.httpOptions); } - updateTransaction(tId, status,key){ + updateTransaction(tId, status, key) { const payload = tId const statusPayload = status const payloadkey = key - return this.http.post(environment.NODE_HOST + '/updateTransaction',{ tId: payload, status: statusPayload,key:payloadkey}, this.httpOptions); + return this.http.post(environment.NODE_HOST + '/updateTransaction', { tId: payload, status: statusPayload, key: payloadkey }, this.httpOptions); } - getDonorLogin(userdata){ + getDonorLogin(userdata) { const regno = userdata.regno; const password = userdata.password; - return this.http.post(environment.NODE_HOST + '/getDonorLogin',{ regno: Number(regno),pass: Number(password) }, this.httpOptions); + return this.http.post(environment.NODE_HOST + '/getDonorLogin', { regno: Number(regno), pass: Number(password) }, this.httpOptions); } - getUserRequest(ngoId){ + getUserRequest(ngoId) { const payload = JSON.stringify(ngoId) - return this.http.post(environment.NODE_HOST + '/getUserRequest',{ NGOId: payload }, this.httpOptions); + return this.http.post(environment.NODE_HOST + '/getUserRequest', { NGOId: payload }, this.httpOptions); } - getFamilyLatLng(id){ + getFamilyLatLng(id) { const idPayload = id; - return this.http.post(environment.NODE_HOST + '/getFamilyLatLng',{NGOId: idPayload}, this.httpOptions); + return this.http.post(environment.NODE_HOST + '/getFamilyLatLng', { NGOId: idPayload }, this.httpOptions); } - getFamilyLatLngForGovernment(){ + getFamilyLatLngForGovernment() { return this.http.get(environment.NODE_HOST + '/getFamilyLatLngForGovernment', this.httpOptions); } - getNGOLatLng(){ + getNGOLatLng() { return this.http.get(environment.NODE_HOST + '/getNGOLatLng', this.httpOptions); } - getNGOCapacity(name){ + getNGOs() { + return this.http.get(environment.NODE_HOST + '/getNGOs', this.httpOptions); + } + + getNGOCapacity(name) { const payload = name - return this.http.post(environment.NODE_HOST + '/getNGOCapacity',{ NGOId: payload }, this.httpOptions); + return this.http.post(environment.NODE_HOST + '/getNGOCapacity', { NGOId: payload }, this.httpOptions); } - getNGOBeneficiaries(id){ + getNGOBeneficiaries(id) { const payload = id - return this.http.post(environment.NODE_HOST + '/getNGOBeneficiaries',{ NGOId: payload }, this.httpOptions); + return this.http.post(environment.NODE_HOST + '/getNGOBeneficiaries', { NGOId: payload }, this.httpOptions); } - getNGOUnprocessedRequests(){ + getNGOUnprocessedRequests() { return this.http.get(environment.NODE_HOST + '/getNGOUnprocessedRequests', this.httpOptions); - + } - getRequestStatusCountForNGO(regno){ + getRequestStatusCountForNGO(regno) { const payload = regno - return this.http.post(environment.NODE_HOST + '/getRequestStatusCountForNGO',{ regno: payload }, this.httpOptions); - + return this.http.post(environment.NODE_HOST + '/getRequestStatusCountForNGO', { regno: payload }, this.httpOptions); + } - getRequestDateChart(regno){ + getRequestDateChart(regno) { const payload = regno - return this.http.post(environment.NODE_HOST + '/getRequestDateChart',{ NGOId: payload }, this.httpOptions); + return this.http.post(environment.NODE_HOST + '/getRequestDateChart', { NGOId: payload }, this.httpOptions); } - getMonthlyRequest(regno){ + getMonthlyRequest(regno) { const payload = regno - return this.http.post(environment.NODE_HOST + '/getMonthlyRequest',{ NGOId: payload }, this.httpOptions); - + return this.http.post(environment.NODE_HOST + '/getMonthlyRequest', { NGOId: payload }, this.httpOptions); + } - closeConnectionFromDB(){ + closeConnectionFromDB() { return this.http.post(environment.NODE_HOST + '/closeConnection', this.httpOptions); } //Government APIS - getTransactionsForGovernment(){ + getTransactionsForGovernment() { return this.http.get(environment.NODE_HOST + '/getTransactionsForGovernment', this.httpOptions); } - getUserRequestForGovernment(){ + getUserRequestForGovernment() { return this.http.get(environment.NODE_HOST + '/getUserRequestForGovernment', this.httpOptions); } -getNGOCapacityForGovernment(){ - + getNGOCapacityForGovernment() { + return this.http.get(environment.NODE_HOST + '/getNGOCapacityForGovernment', this.httpOptions); } - getNGOBeneficiariesForGovernment(){ - + getNGOBeneficiariesForGovernment() { + return this.http.get(environment.NODE_HOST + '/getNGOBeneficiariesForGovernment', this.httpOptions); } - getNGOUnprocessedRequestsForGovernment(){ - + getNGOUnprocessedRequestsForGovernment() { + return this.http.get(environment.NODE_HOST + '/getNGOUnprocessedRequestsForGovernment', this.httpOptions); - + } - getRequestStatusCountForNGOForGovernment(){ - + getRequestStatusCountForNGOForGovernment() { + return this.http.get(environment.NODE_HOST + '/getRequestStatusCountForGovernment', this.httpOptions); - + } - getRequestDateChartForGovernment(){ - + getRequestDateChartForGovernment() { + return this.http.get(environment.NODE_HOST + '/getRequestDateChartForGovernment', this.httpOptions); } - getProvinceDataForGovernment(){ + getProvinceDataForGovernment() { return this.http.get(environment.NODE_HOST + '/getProvinceDataForGovernment', this.httpOptions); } - getMonthlyRequestForGovernment(){ + getMonthlyRequestForGovernment() { return this.http.get(environment.NODE_HOST + '/getMonthlyRequestForGovernment', this.httpOptions); } } diff --git a/src/app/layouts/admin-layout/admin-layout.module.ts b/src/app/layouts/admin-layout/admin-layout.module.ts index 12492b2b..c38fa2dd 100755 --- a/src/app/layouts/admin-layout/admin-layout.module.ts +++ b/src/app/layouts/admin-layout/admin-layout.module.ts @@ -7,17 +7,17 @@ import { HttpClientModule, HttpClient } from '@angular/common/http' import { ToastrModule } from "ngx-toastr"; import { AdminLayoutRoutes } from './admin-layout.routing'; -import {NgxLoadingModule} from "ngx-loading" +import { NgxLoadingModule } from "ngx-loading" -import { GovernDashboardComponent } from '../../pages/goverdashboard/dashboard.component'; -import { DashboardComponent } from '../../pages/dashboard/dashboard.component'; -import { UserComponent } from '../../pages/user/user.component'; -import { TableComponent } from '../../pages/table/table.component'; -import { ContactComponent } from '../../pages/contact/contact.component'; -import { IconsComponent } from '../../pages/icons/icons.component'; -import { MapsComponent } from '../../pages/maps/maps.component'; -import { NotificationsComponent } from '../../pages/notifications/notifications.component'; -import { UpgradeComponent } from '../../pages/upgrade/upgrade.component'; +import { GovernDashboardComponent } from '../../pages/goverdashboard/dashboard.component'; +import { DashboardComponent } from '../../pages/dashboard/dashboard.component'; +import { UserComponent } from '../../pages/user/user.component'; +import { TableComponent } from '../../pages/table/table.component'; +import { ContactComponent } from '../../pages/contact/contact.component'; +import { InventoryComponent } from '../../pages/inventory/inventory.component'; +import { MapsComponent } from '../../pages/maps/maps.component'; +import { NotificationsComponent } from '../../pages/notifications/notifications.component'; +import { UpgradeComponent } from '../../pages/upgrade/upgrade.component'; import { NgbdSortableHeader } from '../../pages/dashboard/dashboard.component'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; @@ -39,7 +39,7 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; TableComponent, UpgradeComponent, ContactComponent, - IconsComponent, + InventoryComponent, MapsComponent, NotificationsComponent, NgbdSortableHeader @@ -47,4 +47,4 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; providers: [HttpService] }) -export class AdminLayoutModule {} +export class AdminLayoutModule { } diff --git a/src/app/layouts/admin-layout/admin-layout.routing.ts b/src/app/layouts/admin-layout/admin-layout.routing.ts index 6c9aad7f..373ca439 100755 --- a/src/app/layouts/admin-layout/admin-layout.routing.ts +++ b/src/app/layouts/admin-layout/admin-layout.routing.ts @@ -5,21 +5,21 @@ import { DashboardComponent } from '../../pages/dashboard/dashboard.component'; import { UserComponent } from '../../pages/user/user.component'; import { TableComponent } from '../../pages/table/table.component'; import { ContactComponent } from '../../pages/contact/contact.component'; -import { IconsComponent } from '../../pages/icons/icons.component'; +import { InventoryComponent } from '../../pages/inventory/inventory.component'; import { MapsComponent } from '../../pages/maps/maps.component'; import { NotificationsComponent } from '../../pages/notifications/notifications.component'; import { UpgradeComponent } from '../../pages/upgrade/upgrade.component'; export const AdminLayoutRoutes: Routes = [ - { path: 'dashboard', component: DashboardComponent }, - { path: 'government', component: GovernDashboardComponent }, - { path: 'user', component: UserComponent }, - { path: 'table', component: TableComponent }, - { path: 'typography', component: ContactComponent }, - { path: 'icons', component: IconsComponent }, - { path: 'maps', component: MapsComponent }, - { path: 'notifications', component: NotificationsComponent }, - { path: 'upgrade', component: UpgradeComponent } - + { path: 'dashboard', component: DashboardComponent }, + { path: 'government', component: GovernDashboardComponent }, + { path: 'user', component: UserComponent }, + { path: 'table', component: TableComponent }, + { path: 'typography', component: ContactComponent }, + { path: 'inventory', component: InventoryComponent }, + { path: 'maps', component: MapsComponent }, + { path: 'notifications', component: NotificationsComponent }, + { path: 'upgrade', component: UpgradeComponent } + ]; diff --git a/src/app/login/login.component.css b/src/app/login/login.component.css old mode 100644 new mode 100755 diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html old mode 100644 new mode 100755 diff --git a/src/app/login/login.component.spec.ts b/src/app/login/login.component.spec.ts old mode 100644 new mode 100755 diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts old mode 100644 new mode 100755 diff --git a/src/app/login/login.module.ts b/src/app/login/login.module.ts old mode 100644 new mode 100755 diff --git a/src/app/pages/contact/contact.css b/src/app/pages/contact/contact.css old mode 100644 new mode 100755 diff --git a/src/app/pages/donor/donor.component.css b/src/app/pages/donor/donor.component.css old mode 100644 new mode 100755 diff --git a/src/app/pages/donor/donor.component.html b/src/app/pages/donor/donor.component.html old mode 100644 new mode 100755 diff --git a/src/app/pages/donor/donor.component.spec.ts b/src/app/pages/donor/donor.component.spec.ts old mode 100644 new mode 100755 diff --git a/src/app/pages/donor/donor.component.ts b/src/app/pages/donor/donor.component.ts old mode 100644 new mode 100755 diff --git a/src/app/pages/icons/icons.component.html b/src/app/pages/icons/icons.component.html deleted file mode 100755 index 69ceb0c1..00000000 --- a/src/app/pages/icons/icons.component.html +++ /dev/null @@ -1,430 +0,0 @@ - -
-
-

Hello, world!

-

This component is under construction, we will be back soon!

-
-

Sorry for the inconvenience.

-
-
- diff --git a/src/app/pages/icons/icons.component.ts b/src/app/pages/icons/icons.component.ts deleted file mode 100755 index eb6a7fb4..00000000 --- a/src/app/pages/icons/icons.component.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'icons-cmp', - moduleId: module.id, - templateUrl: 'icons.component.html' -}) - -export class IconsComponent{} diff --git a/src/app/pages/inventory/inventory.component.html b/src/app/pages/inventory/inventory.component.html new file mode 100755 index 00000000..ee68efd0 --- /dev/null +++ b/src/app/pages/inventory/inventory.component.html @@ -0,0 +1,44 @@ +
+
+
+
+
Inventory Details
+ +
+
+ + + + + + + + + + + + + + + + + + + +
ID #NameBags
{{ ngo.ID }}{{ ngo.Name }}{{ ngo.Capacity }}
+
+ +
+ +
+ +
+
+
\ No newline at end of file diff --git a/src/app/pages/inventory/inventory.component.ts b/src/app/pages/inventory/inventory.component.ts new file mode 100755 index 00000000..a8da1492 --- /dev/null +++ b/src/app/pages/inventory/inventory.component.ts @@ -0,0 +1,159 @@ +import { + Component, + OnInit, + Directive, + Input, + Output, + EventEmitter, + ViewChildren, + QueryList, +} from "@angular/core"; +import Chart from "chart.js"; +import { HttpService } from "../../http.service"; +import { ngxLoadingAnimationTypes } from "ngx-loading"; +import { Router, ActivatedRoute } from "@angular/router"; +import { Observable, forkJoin } from 'rxjs'; +import { ToastrService } from "ngx-toastr"; +import "chartjs-plugin-labels"; +import * as _ from "lodash"; +import * as moment from "moment"; +declare var $: any; + +export type SortDirection = "asc" | "desc" | ""; +const rotate: { [key: string]: SortDirection } = { + asc: "desc", + desc: "", + "": "asc", +}; +export const compare = (v1, v2) => (v1 < v2 ? -1 : v1 > v2 ? 1 : 0); + +export interface SortEvent { + column: string; + direction: SortDirection; +} + +@Directive({ + selector: "th[sortable]", + host: { + "[class.asc]": 'direction === "asc"', + "[class.desc]": 'direction === "desc"', + "(click)": "rotate()", + }, +}) +export class NgbdSortableHeader { + @Input() sortable: string; + @Input() direction: SortDirection = ""; + @Output() sort = new EventEmitter(); + + rotate() { + this.direction = rotate[this.direction]; + this.sort.emit({ column: this.sortable, direction: this.direction }); + } +} + +@Component({ + selector: "inventory-cmp", + moduleId: module.id, + templateUrl: "inventory.component.html", +}) +export class InventoryComponent implements OnInit { + public loading = false; + public ngxLoadingAnimationTypes = ngxLoadingAnimationTypes; + public toastr: ToastrService; + constructor(private _httpService: HttpService, private router: Router) { } + + @ViewChildren(NgbdSortableHeader) headers: QueryList; + + rationbags = 0; + bagsdistributed = 0; + beneficiaries = 0; + totalunprocessedrequests = 0; + tableloaded = false; + + page = 1; + pageSize = 10; + transactionData = []; + NGOData = []; + requestStatus = []; + requestDateData = []; + requestDateMontlyData = []; + requestProvinceData = []; + requestStatusLabel = []; + statusSelection = [ + { val: "Completed", selected: false }, + { val: "Invalid", selected: false }, + { val: "Underway", selected: false }, + { val: "Requested", selected: false }, + ]; + previousStatus = ""; + newStatus = ""; + + ngOnInit() { + + this.loading = true; + // let capacityNGO = this._httpService.getNGOCapacity(this.NGOId); + // let beneficiaries = this._httpService.getNGOBeneficiaries(this.NGOKEY) + // let unprocessed = this._httpService.getNGOUnprocessedRequests(); + // let statuscount = this._httpService.getRequestStatusCountForNGO(this.NGOId); + // let datechart = this._httpService.getRequestDateChart(this.NGOKEY); + // let monthly = this._httpService.getMonthlyRequest(this.NGOKEY); + // let tabledata = this._httpService.getTransactions(this.NGOId); + + + // forkJoin([capacityNGO, beneficiaries,unprocessed,statuscount,datechart,monthly,tabledata]).subscribe(results => { + // // results[0] is our character + // // results[1] is our character homeworld + // this.rationbags = results[0]["data"][0].Capacity; + // this.beneficiaries = results[1]["data"][0].BENEFICIARIES; + // this.totalunprocessedrequests = results[2]["data"][0].REQUESTBAGS; + // this.requestStatus = results[3]["data"]; + // this.bagsdistributed = _.find(this.requestStatus, {"STATUS": "Completed"})['COUNT']; + // this.requestDateData = results[4]["data"]; + // this.requestDateMontlyData = results[5]["data"]; + // this.userData = results[6]["data"]; + // this.transactionData = this.userData; + // this.tableloaded = true; + // this.chartRendering(); + + // }); + + this.getNGOsFromDB(); + this.utilFunction(); + } + + getNGOsFromDB() { + this._httpService.getNGOs().subscribe((data) => { + if (data["success"] != 1) { + console.log("bad"); + console.log(data["message"]); + } else { + this.NGOData = data["data"]; + this.tableloaded = true; + console.log("good"); + } + }); + } + + utilFunction() { + $('[data-toggle="tooltip"]').tooltip(); + } + + onSort({ column, direction }: SortEvent) { + // resetting other headers + this.headers.forEach((header) => { + if (header.sortable !== column) { + header.direction = ""; + } + }); + + // sorting countries + if (direction === "") { + this.NGOData = this.transactionData; + } else { + this.NGOData = this.transactionData.sort((a, b) => { + const res = compare(a[column], b[column]); + return direction === "asc" ? res : -res; + }); + } + } +} diff --git a/src/app/pages/register/register.component.css b/src/app/pages/register/register.component.css old mode 100644 new mode 100755 diff --git a/src/app/pages/register/register.component.html b/src/app/pages/register/register.component.html old mode 100644 new mode 100755 diff --git a/src/app/pages/register/register.component.spec.ts b/src/app/pages/register/register.component.spec.ts old mode 100644 new mode 100755 diff --git a/src/app/pages/register/register.component.ts b/src/app/pages/register/register.component.ts old mode 100644 new mode 100755 diff --git a/src/app/sidebar/sidebar.component.ts b/src/app/sidebar/sidebar.component.ts index cd6de485..45a487ee 100755 --- a/src/app/sidebar/sidebar.component.ts +++ b/src/app/sidebar/sidebar.component.ts @@ -10,14 +10,14 @@ export interface RouteInfo { } export const ROUTES: RouteInfo[] = [ - { path: '/dashboard', title: 'Dashboard', icon:'nc-bank', class: '' , type:'donor'}, - { path: '/government', title: 'Dashboard', icon:'nc-bank', class: '' , type:'government'}, - { path: '/maps', title: 'Locate Entities', icon:'nc-pin-3', class: '' , type:'government'}, - { path: '/maps', title: 'Locate Users', icon:'nc-pin-3', class: '' , type:'donor'}, - { path: '/icons', title: 'Inventory', icon:'nc-box', class: '' , type:'donor'}, - - { path: '/notifications', title: 'Notifications', icon:'nc-bell-55', class: '', type:'' } - + { path: '/dashboard', title: 'Dashboard', icon: 'nc-bank', class: '', type: 'donor' }, + { path: '/government', title: 'Dashboard', icon: 'nc-bank', class: '', type: 'government' }, + { path: '/maps', title: 'Locate Entities', icon: 'nc-pin-3', class: '', type: 'government' }, + { path: '/maps', title: 'Locate Users', icon: 'nc-pin-3', class: '', type: 'donor' }, + { path: '/inventory', title: 'Inventory', icon: 'nc-box', class: '', type: 'donor' }, + + { path: '/notifications', title: 'Notifications', icon: 'nc-bell-55', class: '', type: '' } + // { path: '/user', title: 'User Profile', icon:'nc-single-02', class: '' }, // { path: '/table', title: 'Table List', icon:'nc-tile-56', class: '', type:'' }, // { path: '/typography', title: 'Contact Us', icon:'nc-email-85', class: '', type: 'government' } diff --git a/src/app/welcome/welcome.component.css b/src/app/welcome/welcome.component.css old mode 100644 new mode 100755 diff --git a/src/app/welcome/welcome.component.html b/src/app/welcome/welcome.component.html old mode 100644 new mode 100755 diff --git a/src/app/welcome/welcome.component.spec.ts b/src/app/welcome/welcome.component.spec.ts old mode 100644 new mode 100755 diff --git a/src/app/welcome/welcome.component.ts b/src/app/welcome/welcome.component.ts old mode 100644 new mode 100755 diff --git a/src/app/welcome/welcome.module.ts b/src/app/welcome/welcome.module.ts old mode 100644 new mode 100755 diff --git a/src/assets/img/bg-image.jpg b/src/assets/img/bg-image.jpg old mode 100644 new mode 100755 diff --git a/src/assets/img/eyebm.svg b/src/assets/img/eyebm.svg old mode 100644 new mode 100755 diff --git a/src/assets/img/ibm-ar21.svg b/src/assets/img/ibm-ar21.svg old mode 100644 new mode 100755 diff --git a/src/assets/img/ibm_blockchain.jpg b/src/assets/img/ibm_blockchain.jpg old mode 100644 new mode 100755 diff --git a/src/assets/img/ibmlogo.png b/src/assets/img/ibmlogo.png old mode 100644 new mode 100755 diff --git a/src/assets/img/login.png b/src/assets/img/login.png old mode 100644 new mode 100755 diff --git a/src/assets/img/logo.png b/src/assets/img/logo.png old mode 100644 new mode 100755 diff --git a/src/assets/img/logo1.png b/src/assets/img/logo1.png old mode 100644 new mode 100755 diff --git a/src/assets/img/logo12.png b/src/assets/img/logo12.png old mode 100644 new mode 100755 diff --git a/src/assets/img/tys.jpeg b/src/assets/img/tys.jpeg old mode 100644 new mode 100755 diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 6f1dd7a4..f2aad7ef 100755 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,4 +1,4 @@ export const environment = { production: true, - NODE_HOST: 'https://mycallsda.au-syd.mybluemix.net' + NODE_HOST: 'http://localhost:8888' }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index eb3e4ed1..2c6d7c3d 100755 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -5,6 +5,6 @@ export const environment = { production: false, - NODE_HOST: 'https://mycallsda.au-syd.mybluemix.net' + NODE_HOST: 'http://localhost:8888' };