├── .gitignore ├── angular.json ├── firebase.json ├── package-lock.json ├── package.json ├── readme.md ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.css │ ├── app.component.html │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── services │ │ ├── auth.guard.service.ts │ │ ├── backend.service.ts │ │ └── datamodel.ts │ ├── shared │ │ ├── aboutus.component.css │ │ ├── aboutus.component.html │ │ ├── aboutus.component.ts │ │ ├── dropzone │ │ │ ├── dropzone.directive.ts │ │ │ ├── filesize.pipe.ts │ │ │ ├── fileupload.component.css │ │ │ ├── fileupload.component.html │ │ │ └── fileupload.component.ts │ │ ├── footer.component.css │ │ ├── footer.component.html │ │ ├── footer.component.ts │ │ ├── header.component.css │ │ ├── header.component.html │ │ ├── header.component.ts │ │ ├── helpdesk.component.css │ │ ├── helpdesk.component.html │ │ ├── helpdesk.component.ts │ │ ├── router.aimations.ts │ │ ├── router.animations.ts │ │ ├── simpleheader.component.css │ │ ├── simpleheader.component.html │ │ └── simpleheader.component.ts │ └── ui │ │ ├── addressbook │ │ ├── address.component.css │ │ ├── address.component.html │ │ └── address.component.ts │ │ ├── auth │ │ ├── admin.component.css │ │ ├── admin.component.html │ │ ├── admin.component.ts │ │ ├── login.component.css │ │ ├── login.component.html │ │ ├── login.component.ts │ │ ├── settings.component.css │ │ ├── settings.component.html │ │ ├── settings.component.ts │ │ ├── signup.component.css │ │ ├── signup.component.html │ │ └── signup.component.ts │ │ ├── callregister │ │ ├── calls.component.css │ │ ├── calls.component.html │ │ └── calls.component.ts │ │ ├── helpdesk │ │ ├── appointments.component.css │ │ ├── appointments.component.html │ │ ├── appointments.component.ts │ │ ├── tickets.component.css │ │ ├── tickets.component.html │ │ ├── tickets.component.ts │ │ ├── workorders.component.css │ │ ├── workorders.component.html │ │ └── workorders.component.ts │ │ ├── market │ │ ├── campaign.component.css │ │ ├── campaign.component.html │ │ ├── campaign.component.ts │ │ ├── lead.component.css │ │ ├── lead.component.html │ │ ├── lead.component.ts │ │ ├── opportunity.component.css │ │ ├── opportunity.component.html │ │ └── opportunity.component.ts │ │ └── orders │ │ ├── orders.component.css │ │ ├── orders.component.html │ │ └── orders.component.ts ├── assets │ ├── .gitkeep │ ├── css │ │ └── styles.css │ ├── icons │ │ ├── account_circle.svg │ │ ├── add.svg │ │ ├── backspace.svg │ │ ├── bars.svg │ │ ├── book.svg │ │ ├── business.svg │ │ ├── cached.svg │ │ ├── clear.svg │ │ ├── cloud.svg │ │ ├── code.svg │ │ ├── create.svg │ │ ├── dashboard-black.svg │ │ ├── delete.svg │ │ ├── drop_down.svg │ │ ├── edit.svg │ │ ├── email.svg │ │ ├── equalizer.svg │ │ ├── event.svg │ │ ├── favicon.ico │ │ ├── fb.svg │ │ ├── github.svg │ │ ├── group.svg │ │ ├── help.svg │ │ ├── home.svg │ │ ├── language.svg │ │ ├── linkedin.svg │ │ ├── menu.svg │ │ ├── more_vert.svg │ │ ├── new.svg │ │ ├── person.svg │ │ ├── phone.svg │ │ ├── place.svg │ │ ├── radio_off.svg │ │ ├── radio_on.svg │ │ ├── salary.svg │ │ ├── search.svg │ │ ├── security.svg │ │ ├── star.svg │ │ ├── track_changes.svg │ │ ├── twitter_1.svg │ │ ├── twitter_2.svg │ │ └── vpn.svg │ └── images │ │ ├── ERP.png │ │ ├── barcode.png │ │ ├── person.gif │ │ ├── sound.gif │ │ └── wifi-search.gif ├── custom-theme.scss ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.css └── test.ts ├── tsconfig.app.json ├── tsconfig.json └── tslint.json /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | /environments 13 | 14 | # profiling files 15 | chrome-profiler-events*.json 16 | speed-measure-plugin*.json 17 | 18 | # IDEs and editors 19 | /.idea 20 | .project 21 | .classpath 22 | .c9/ 23 | *.launch 24 | .settings/ 25 | *.sublime-workspace 26 | 27 | # IDE - VSCode 28 | .vscode/* 29 | !.vscode/settings.json 30 | !.vscode/tasks.json 31 | !.vscode/launch.json 32 | !.vscode/extensions.json 33 | .history/* 34 | 35 | # misc 36 | /.sass-cache 37 | /connect.lock 38 | /coverage 39 | /libpeerconnection.log 40 | npm-debug.log 41 | yarn-error.log 42 | testem.log 43 | /typings 44 | 45 | # System Files 46 | .DS_Store 47 | Thumbs.db 48 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "testapp": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "app", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:browser", 15 | "options": { 16 | "outputPath": "dist/testapp", 17 | "index": "src/index.html", 18 | "main": "src/main.ts", 19 | "polyfills": "src/polyfills.ts", 20 | "tsConfig": "tsconfig.app.json", 21 | "aot": true, 22 | "assets": [ 23 | "src/favicon.ico", 24 | "src/assets" 25 | ], 26 | "styles": [ 27 | "src/assets/css/styles.css" 28 | ], 29 | "scripts": [] 30 | }, 31 | "configurations": { 32 | "production": { 33 | "fileReplacements": [ 34 | { 35 | "replace": "src/environments/environment.ts", 36 | "with": "src/environments/environment.prod.ts" 37 | } 38 | ], 39 | "optimization": true, 40 | "outputHashing": "all", 41 | "sourceMap": false, 42 | "extractCss": true, 43 | "namedChunks": false, 44 | "extractLicenses": true, 45 | "vendorChunk": false, 46 | "buildOptimizer": true, 47 | "budgets": [ 48 | { 49 | "type": "initial", 50 | "maximumWarning": "2mb", 51 | "maximumError": "5mb" 52 | }, 53 | { 54 | "type": "anyComponentStyle", 55 | "maximumWarning": "6kb", 56 | "maximumError": "10kb" 57 | } 58 | ] 59 | } 60 | } 61 | }, 62 | "serve": { 63 | "builder": "@angular-devkit/build-angular:dev-server", 64 | "options": { 65 | "browserTarget": "testapp:build" 66 | }, 67 | "configurations": { 68 | "production": { 69 | "browserTarget": "testapp:build:production" 70 | } 71 | } 72 | }, 73 | "extract-i18n": { 74 | "builder": "@angular-devkit/build-angular:extract-i18n", 75 | "options": { 76 | "browserTarget": "testapp:build" 77 | } 78 | }, 79 | "test": { 80 | "builder": "@angular-devkit/build-angular:karma", 81 | "options": { 82 | "main": "src/test.ts", 83 | "polyfills": "src/polyfills.ts", 84 | "tsConfig": "tsconfig.spec.json", 85 | "karmaConfig": "karma.conf.js", 86 | "assets": [ 87 | "src/favicon.ico", 88 | "src/assets" 89 | ], 90 | "styles": [ 91 | "src/styles.css" 92 | ], 93 | "scripts": [] 94 | } 95 | }, 96 | "lint": { 97 | "builder": "@angular-devkit/build-angular:tslint", 98 | "options": { 99 | "tsConfig": [ 100 | "tsconfig.app.json", 101 | "tsconfig.spec.json", 102 | "e2e/tsconfig.json" 103 | ], 104 | "exclude": [ 105 | "**/node_modules/**" 106 | ] 107 | } 108 | }, 109 | "e2e": { 110 | "builder": "@angular-devkit/build-angular:protractor", 111 | "options": { 112 | "protractorConfig": "e2e/protractor.conf.js", 113 | "devServerTarget": "testapp:serve" 114 | }, 115 | "configurations": { 116 | "production": { 117 | "devServerTarget": "testapp:serve:production" 118 | } 119 | } 120 | } 121 | } 122 | }}, 123 | "defaultProject": "testapp" 124 | } 125 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosting": [ 3 | { 4 | "target": "testapp", 5 | "public": "dist/testapp", 6 | "ignore": [ 7 | "firebase.json", 8 | "**/.*", 9 | "**/node_modules/**" 10 | ], 11 | "rewrites": [ 12 | { 13 | "source": "**", 14 | "destination": "/index.html" 15 | } 16 | ] 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "testapp", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "~11.0.1", 15 | "@angular/cdk": "^11.0.1", 16 | "@angular/common": "~11.0.1", 17 | "@angular/compiler": "~11.0.1", 18 | "@angular/core": "~11.0.1", 19 | "@angular/fire": "^6.1.2", 20 | "@angular/forms": "~11.0.1", 21 | "@angular/material": "^11.0.1", 22 | "@angular/platform-browser": "~11.0.1", 23 | "@angular/platform-browser-dynamic": "~11.0.1", 24 | "@angular/router": "~11.0.1", 25 | "firebase": "^8.0.0", 26 | "rxjs": "~6.6.0", 27 | "rxjs-compat": "6.5.2", 28 | "tslib": "^2.0.0", 29 | "zone.js": "~0.10.2" 30 | }, 31 | "devDependencies": { 32 | "@angular-devkit/architect": ">= 0.900 < 0.1200", 33 | "@angular-devkit/build-angular": "~0.1100.2", 34 | "@angular/cli": "~11.0.2", 35 | "@angular/compiler-cli": "~11.0.1", 36 | "@types/jasmine": "~3.6.0", 37 | "@types/node": "^12.11.1", 38 | "codelyzer": "^6.0.0", 39 | "firebase-tools": "^8.0.0", 40 | "fuzzy": "^0.1.3", 41 | "inquirer": "^6.2.2", 42 | "inquirer-autocomplete-prompt": "^1.0.1", 43 | "jasmine-core": "~3.6.0", 44 | "jasmine-spec-reporter": "~5.0.0", 45 | "karma": "~5.1.0", 46 | "karma-chrome-launcher": "~3.1.0", 47 | "karma-coverage": "~2.0.3", 48 | "karma-jasmine": "~4.0.0", 49 | "karma-jasmine-html-reporter": "^1.5.0", 50 | "open": "^7.0.3", 51 | "protractor": "~7.0.0", 52 | "ts-node": "~8.3.0", 53 | "tslint": "~6.1.0", 54 | "typescript": "~4.0.2" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ```diff 2 | - If you like this project, please consider giving it a star (*) and follow me at GitHub & YouTube. 3 | ``` 4 | [](https://youtube.com/AmitShukla_AI) 5 | [](https://github.com/AmitXShukla) 6 | [](https://medium.com/@Amit_Shukla) 7 | [](https://twitter.com/ashuklax) 8 | 9 | # ERP-Apps 10 | # Objective 11 | Build ERP apps for Small, Medium and Large Organizations
12 | Re-Write / Build new CRM GUI App for existing ERP
13 | Convert Old Software to new App/UI (Desktop & Mobile) without changing database
14 | Migrate existing ERP to new platform
15 | Make an App for existing Oracle, PeopleSoft, SAP, or Siebel CRM or old custom software based ERP
16 | 17 | Community Version - All apps are Free download with complete source code for iOS, Android and web.
18 | Click here for Video Tutorials ! 19 |
20 | ``` ts 21 | Installation Instructions 22 | Step 1: Install your favorite Code editor 23 | Anroid Studio, IntelliJ community edition, Visual Studio Code 24 | 25 | Step 2: download node js 26 | make sure, your windows, linux or mac environment path is setup to the directory where your node.exe file is 27 | for example 28 | 29 | Path = c:\amit.la\Program\node 30 | now run following commands in terminal window 31 | $ node -v 32 | $ npm -v 33 | make sure both the these commands return a valid node and npm version. 34 | now install angular cli 35 | $ npm install -g @angular/cli 36 | // after installation 37 | $ ng version 38 | make sure ng version returns a valid Angular cli version. 39 | 40 | Step 3: download this GitHub repository - Fork/Download Zip 41 | extract all files to your c drive and browse to the directory where you can see package.json 42 | $ npm install --save 43 | make sure installation finished without any error 44 | $ ng serve --open 45 | at this point, your app will serve on localhost:4200 but it show some errors because your firebase in not setup yet 46 | 47 | Step 4: Setup Firebase project 48 | go to -> console.firebase.com 49 | set up a new project 50 | inside your project, click on authentication and enable 51 | email/password, Google and Facebook authentication methods 52 | now setup Firebase rules 53 | please copy paste these rules as-is and make sure, there are no errors anywhere. 54 | ``` 55 | 56 | rules_version = '2'; 57 | service cloud.firestore { 58 | match /databases/{database}/documents { 59 | match /{document=**} { 60 | allow read, write: if false; 61 | } 62 | 63 | match /USER_ROLES/{document} { 64 | allow read: if isSignedIn(); 65 | } 66 | match /USER_SETTINGS/{document} { 67 | allow read: if (isSignedIn() && isDocOwner()) || isAdmin(); 68 | allow create: if isSignedIn() && onlyContentChanged(); 69 | allow update: if (isSignedIn() && isDocOwner() && onlyContentChanged()) || isAdmin(); 70 | allow delete: if isAdmin(); 71 | } 72 | match /USER_ADDRESSBOOK/{document=**} { 73 | allow read: if (isSignedIn() && isEmployee()) || isAdmin(); 74 | allow create: if isSignedIn(); 75 | allow update: if (isSignedIn() && isDocOwner()) || isAdmin(); 76 | allow delete: if isAdmin(); 77 | } 78 | match /USER_CAMPAIGN/{document=**} { 79 | allow read: if (isSignedIn() && isEmployee()) || isAdmin(); 80 | allow create: if isSignedIn(); 81 | allow update: if (isSignedIn() && isDocOwner()) || isAdmin(); 82 | allow delete: if isAdmin(); 83 | } 84 | match /USER_LEADS/{document=**} { 85 | allow read: if (isSignedIn() && isEmployee()) || isAdmin(); 86 | allow create: if isSignedIn(); 87 | allow update: if (isSignedIn() && isDocOwner()) || isAdmin(); 88 | allow delete: if isAdmin(); 89 | } 90 | match /USER_OPPURTUNITY/{document=**} { 91 | allow read: if (isSignedIn() && isEmployee()) || isAdmin(); 92 | allow create: if isSignedIn(); 93 | allow update: if (isSignedIn() && isDocOwner()) || isAdmin(); 94 | allow delete: if isAdmin(); 95 | } 96 | match /USER_APPOINTMENTS/{document=**} { 97 | allow read: if (isSignedIn() && isEmployee()) || isAdmin(); 98 | allow create: if isSignedIn(); 99 | allow update: if (isSignedIn() && isDocOwner()) || isAdmin(); 100 | allow delete: if isAdmin(); 101 | } 102 | match /USER_CALLS/{document=**} { 103 | allow read: if (isSignedIn() && isEmployee()) || isAdmin(); 104 | allow create: if isSignedIn(); 105 | allow update: if (isSignedIn() && isDocOwner()) || isAdmin(); 106 | allow delete: if isAdmin(); 107 | } 108 | match /USER_TICKETS/{document=**} { 109 | allow read: if (isSignedIn() && isEmployee()) || isAdmin(); 110 | allow create: if isSignedIn(); 111 | allow update: if (isSignedIn() && isDocOwner()) || isAdmin(); 112 | allow delete: if isAdmin(); 113 | } 114 | match /USER_WORKORDERS/{document=**} { 115 | allow read: if (isSignedIn() && isEmployee()) || isAdmin(); 116 | allow create: if isSignedIn(); 117 | allow update: if (isSignedIn() && isDocOwner()) || isAdmin(); 118 | allow delete: if isAdmin(); 119 | } 120 | match /USER_ORDERS/{document=**} { 121 | allow read: if (isSignedIn() && isEmployee()) || isAdmin(); 122 | allow create: if isSignedIn(); 123 | allow update: if (isSignedIn() && isDocOwner()) || isAdmin(); 124 | allow delete: if isAdmin(); 125 | } 126 | // helper functions 127 | function isSignedIn() { 128 | return request.auth.uid != null; 129 | } 130 | function onlyContentChanged() { 131 | return request.resource.data.role == "" || request.resource.data.role == resource.data.role; 132 | // make sure user is not signing in with any role or changin his role during update 133 | } 134 | function isDocOwner() { 135 | return request.auth.uid == resource.data.author; 136 | } 137 | function isDocCreater() { 138 | return request.auth.uid == request.resource.data.author; 139 | } 140 | function isAdmin() { 141 | return get(/databases/$(database)/documents/USER_SETTINGS/$(request.auth.uid)).data.role == "admin"; 142 | } 143 | function isEmployee() { 144 | return get(/databases/$(database)/documents/USER_SETTINGS/$(request.auth.uid)).data.role == "employee"; 145 | } 146 | } 147 | } 148 | 149 | ```ts 150 | Step 5: Create new data collection 151 | as shown in this screen and make sure all documents/fields look exactly the same. 152 | ``` 153 | 154 | YouTube video Part -1 @ 13:08 155 | 156 | 157 | ```ts 158 | USER_ROLES is a collection 159 | admin is a document inside it 160 | admin, addressbook etc each has a “map” inside 161 | Which has four fields each 162 | visible Boolean true 163 | read Boolean true 164 | write Boolean true 165 | delete Boolean true 166 | 167 | Step 6: find Firebase Project settings 168 | copy and replace Firebase settings in your app->environments/environment.ts and environment.prod.ts 169 | 170 | 171 | Step 7: Browse App 172 | to check if your app is up and running now if not, please open browser console and look for errors 173 | 174 | if firebase is not setup properly or settings are not copies correctly, you will see error like invalid API Key. 175 | 176 | For any other error please open a new issue and include a screen shot of your terminal and browser console window. 177 | ``` 178 | ## Pro Version Enquiries info@elishconsulting.com - ERP 179 | 180 | Other Apps -> CRM Cloud
181 | Marketting
182 | Helpdesk
183 | BPO/Call Register
184 | Customer Order Fullfillment

185 | Supply Chain
186 | Buy To Pay
187 | Customer Order Fullfillment
188 | Sales
189 | Live Inventory

190 | Finance
191 | Book Keeping
192 | Accounts Payable
193 | Accounts Receivable
194 | Expense Management
195 | Assets management
196 | 197 | HCM Employee Management App
198 | Supply Chain App
199 | Inventory Management App
200 | Book Keeping App
201 | Buy to Pay B2P App
202 | Accounts Payables App
203 | Accounts Receivables App
204 | Vendor Management App
205 | Help Desk App
206 | Call Center App
207 | Order Fullfillment App
208 | Product Catalogue
209 | Order Fullfillment App
210 | Expense Management
211 | Assets management
212 | Warehouse Management App
213 | 214 | Requisition -> Generate Req and auto PO
215 | PO -> Request Inventory
216 | Receipt -> Receive Inventory
217 | Payables -> Setup Vendor
218 | -> Voucher for Vendor
219 | -> Pay Vendor
220 | Receivables-> Setup Customer
221 | -> Invoice for Customer
222 | -> Receive
223 | Sales Register
224 | # Reports 225 | Inventory Cycle Count
226 | Inventory Snapshot
227 | report - On Hand Inventory
228 | Payables -> Setup Vendor
229 | -> Voucher for Vendor
230 | -> Pay Vendor
231 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { AboutusComponent } from './shared/aboutus.component'; 4 | import { LoginComponent } from './ui/auth/login.component'; 5 | import { SignupComponent } from './ui/auth/signup.component'; 6 | import { AdminComponent } from './ui/auth/admin.component'; 7 | import { SettingsComponent } from './ui/auth/settings.component'; 8 | import { AddressComponent } from './ui/addressbook/address.component'; 9 | 10 | // CRM Cloud 11 | import { CampaignComponent } from './ui/market/campaign.component'; 12 | import { LeadComponent } from './ui/market/lead.component'; 13 | import { OpportunityComponent } from './ui/market/opportunity.component'; 14 | import { AppointmentsComponent } from './ui/helpdesk/appointments.component'; 15 | import { TicketsComponent } from './ui/helpdesk/tickets.component'; 16 | import { WorkordersComponent } from './ui/helpdesk/workorders.component'; 17 | import { OrdersComponent } from './ui/orders/orders.component'; 18 | import { CallsComponent } from './ui/callregister/calls.component'; 19 | 20 | // firebase auth guard] 21 | import { AngularFireAuthGuard, hasCustomClaim, redirectUnauthorizedTo, redirectLoggedInTo } from '@angular/fire/auth-guard'; 22 | import { canActivate } from '@angular/fire/auth-guard'; 23 | import { pipe } from 'rxjs'; 24 | import { map } from 'rxjs/operators'; 25 | 26 | const redirectUnauthorizedToLogin = () => redirectUnauthorizedTo(['login']); 27 | const redirectLoggedInToItems = () => redirectLoggedInTo(['aboutus']); 28 | const redirectLoggedInToSettings = () => redirectLoggedInTo(['settings']); 29 | const hasRole = () => map(user => user ? ['settings'] : ['login']); 30 | 31 | const routes: Routes = [ 32 | { path: '', redirectTo: '/login', pathMatch: 'full' }, 33 | { path: 'aboutus', component: AboutusComponent, ...canActivate(redirectUnauthorizedToLogin) }, 34 | { path: 'addressbook', component: AddressComponent, ...canActivate(redirectUnauthorizedToLogin) }, 35 | { path: 'login', component: LoginComponent, ...canActivate(redirectLoggedInToSettings) }, 36 | { path: 'signup', component: SignupComponent, ...canActivate(redirectLoggedInToSettings) }, 37 | { path: 'settings', component: SettingsComponent, ...canActivate(redirectUnauthorizedToLogin) }, 38 | { path: 'admin', component: AdminComponent, ...canActivate(redirectUnauthorizedToLogin) }, 39 | { path: 'campaign', component: CampaignComponent, ...canActivate(redirectUnauthorizedToLogin) }, 40 | { path: 'lead', component: LeadComponent, ...canActivate(redirectUnauthorizedToLogin) }, 41 | { path: 'opportunity', component: OpportunityComponent, ...canActivate(redirectUnauthorizedToLogin) }, 42 | { path: 'appointment', component: AppointmentsComponent, ...canActivate(redirectUnauthorizedToLogin) }, 43 | { path: 'ticket', component: TicketsComponent, ...canActivate(redirectUnauthorizedToLogin) }, 44 | { path: 'workorder', component: WorkordersComponent, ...canActivate(redirectUnauthorizedToLogin) }, 45 | { path: 'order', component: OrdersComponent, ...canActivate(redirectUnauthorizedToLogin) }, 46 | { path: 'call', component: CallsComponent, ...canActivate(redirectUnauthorizedToLogin) }, 47 | { path: '**', redirectTo: '/login', pathMatch: 'full' } 48 | ]; 49 | 50 | @NgModule({ 51 | imports: [RouterModule.forRoot(routes)], 52 | exports: [RouterModule] 53 | }) 54 | export class AppRoutingModule { } 55 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/app.component.css -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(async(() => { 7 | TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | })); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'NEW-CRM-APP'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('NEW-CRM-APP'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement; 33 | expect(compiled.querySelector('.content span').textContent).toContain('NEW-CRM-APP app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'NEW-CRM-APP'; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; 4 | 5 | import { AppRoutingModule } from './app-routing.module'; 6 | import { AppComponent } from './app.component'; 7 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 8 | 9 | import { AboutusComponent } from './shared/aboutus.component'; 10 | import { FooterComponent } from './shared/footer.component'; 11 | import { SimpleheaderComponent } from './shared/simpleheader.component'; 12 | import { LoginComponent } from './ui/auth/login.component'; 13 | import { SignupComponent } from './ui/auth/signup.component'; 14 | import { AdminComponent } from './ui/auth/admin.component'; 15 | import { AddressComponent } from './ui/addressbook/address.component'; 16 | 17 | // CRM Cloud 18 | import { CampaignComponent } from './ui/market/campaign.component'; 19 | import { LeadComponent } from './ui/market/lead.component'; 20 | import { OpportunityComponent } from './ui/market/opportunity.component'; 21 | import { AppointmentsComponent } from './ui/helpdesk/appointments.component'; 22 | import { TicketsComponent } from './ui/helpdesk/tickets.component'; 23 | import { WorkordersComponent } from './ui/helpdesk/workorders.component'; 24 | import { OrdersComponent } from './ui/orders/orders.component'; 25 | import { CallsComponent } from './ui/callregister/calls.component'; 26 | 27 | // material imports 28 | import { HttpClientModule } from '@angular/common/http'; 29 | // angular material imports 30 | import { MatButtonModule } from '@angular/material/button'; 31 | import { MatCheckboxModule } from '@angular/material/checkbox'; 32 | import { MatFormFieldModule } from '@angular/material/form-field'; 33 | import { MatTabsModule } from '@angular/material/tabs'; 34 | import { MatProgressBarModule } from '@angular/material/progress-bar'; 35 | import { MatMenuModule } from '@angular/material/menu'; 36 | import { MatIconModule } from '@angular/material/icon'; 37 | import { MatIconRegistry } from '@angular/material/icon'; 38 | import { MatInputModule } from '@angular/material/input'; 39 | import { MatSelectModule } from '@angular/material/select'; 40 | import { MatToolbarModule } from '@angular/material/toolbar'; 41 | import { MatCardModule } from '@angular/material/card'; 42 | import { MatChipsModule } from '@angular/material/chips'; 43 | import { MatListModule } from '@angular/material/list'; 44 | import { MatTooltipModule } from '@angular/material/tooltip'; 45 | import { MatSnackBarModule } from '@angular/material/snack-bar'; 46 | import { MatBottomSheetModule, MAT_BOTTOM_SHEET_DEFAULT_OPTIONS } from '@angular/material/bottom-sheet'; 47 | import { MatButtonToggleModule } from '@angular/material/button-toggle'; 48 | import { MatRippleModule } from '@angular/material/core'; 49 | import { MatDialogModule } from '@angular/material/dialog'; 50 | import { MatStepperModule } from '@angular/material/stepper'; 51 | import { MatExpansionModule } from '@angular/material/expansion'; 52 | import { MatTableModule } from '@angular/material/table'; 53 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 54 | import { DomSanitizer } from '@angular/platform-browser'; 55 | import { MatAutocompleteModule } from '@angular/material/autocomplete'; 56 | import { MatPaginatorModule } from '@angular/material/paginator'; 57 | import { MatSlideToggleModule } from '@angular/material/slide-toggle'; 58 | import { MatSidenavModule } from '@angular/material/sidenav'; 59 | import { MatDatepickerModule } from '@angular/material/datepicker'; 60 | // Angular fire imports 61 | import { AngularFireModule } from '@angular/fire'; 62 | import { AngularFireAnalyticsModule } from '@angular/fire/analytics'; 63 | import { AngularFirestoreModule } from '@angular/fire/firestore'; 64 | import { environment } from '../environments/environment'; 65 | import { SettingsComponent } from './ui/auth/settings.component'; 66 | import { HeaderComponent } from './shared/header.component'; 67 | // file upload 68 | import { FileUploadComponent } from './shared/dropzone/fileupload.component'; 69 | import { DropZoneDirective } from './shared/dropzone/dropzone.directive'; 70 | import { FileSizePipe } from './shared/dropzone/filesize.pipe'; 71 | 72 | @NgModule({ 73 | declarations: [ 74 | AppComponent, 75 | AboutusComponent, 76 | FooterComponent, 77 | SimpleheaderComponent, 78 | LoginComponent, 79 | SignupComponent, 80 | AdminComponent, 81 | SettingsComponent, 82 | HeaderComponent, 83 | AddressComponent, 84 | FileUploadComponent, 85 | DropZoneDirective, 86 | FileSizePipe, 87 | CampaignComponent, 88 | LeadComponent, 89 | OpportunityComponent, 90 | AppointmentsComponent, 91 | TicketsComponent, 92 | WorkordersComponent, 93 | OrdersComponent, 94 | CallsComponent 95 | ], 96 | imports: [ 97 | BrowserModule, 98 | ReactiveFormsModule, 99 | FormsModule, 100 | AppRoutingModule, 101 | BrowserAnimationsModule, 102 | MatIconModule, 103 | HttpClientModule, 104 | MatToolbarModule, 105 | MatButtonModule, 106 | MatMenuModule, 107 | MatButtonModule, 108 | MatCheckboxModule, 109 | MatFormFieldModule, 110 | MatTabsModule, 111 | MatMenuModule, 112 | MatIconModule, 113 | MatInputModule, 114 | MatSelectModule, 115 | MatToolbarModule, 116 | MatCardModule, 117 | MatChipsModule, 118 | MatListModule, 119 | MatTooltipModule, 120 | MatProgressBarModule, 121 | MatSnackBarModule, 122 | MatBottomSheetModule, 123 | MatButtonToggleModule, 124 | MatRippleModule, 125 | MatDialogModule, 126 | MatStepperModule, 127 | MatExpansionModule, 128 | MatTableModule, 129 | MatAutocompleteModule, 130 | MatPaginatorModule, 131 | MatSlideToggleModule, 132 | MatSidenavModule, 133 | MatDatepickerModule, 134 | AngularFireModule.initializeApp(environment.firebase), 135 | AngularFireAnalyticsModule, 136 | AngularFirestoreModule 137 | ], 138 | providers: [], 139 | bootstrap: [AppComponent] 140 | }) 141 | export class AppModule { 142 | constructor(iconRegistry: MatIconRegistry, sanitizer: DomSanitizer) { 143 | 144 | iconRegistry.addSvgIcon( 145 | 'facebook', 146 | sanitizer.bypassSecurityTrustResourceUrl('assets/icons/fb.svg') 147 | ), 148 | iconRegistry.addSvgIcon( 149 | 'linkedin', 150 | sanitizer.bypassSecurityTrustResourceUrl('assets/icons/linkedin.svg') 151 | ), 152 | iconRegistry.addSvgIcon( 153 | 'github', 154 | sanitizer.bypassSecurityTrustResourceUrl('assets/icons/github.svg')), 155 | iconRegistry.addSvgIcon( 156 | 'twitter', 157 | sanitizer.bypassSecurityTrustResourceUrl('assets/icons/twitter_1.svg')); 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /src/app/services/auth.guard.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@angular/core"; 2 | import { CanActivate, Router } from '@angular/router'; 3 | import { BackendService } from './backend.service'; 4 | import { AngularFireAuth } from '@angular/fire/auth'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | 10 | export class AuthGuardService implements CanActivate { 11 | userRole$; 12 | 13 | constructor (public auth: AngularFireAuth, private _backendService: BackendService, private _router: Router) { } 14 | async canActivate(): Promise { 15 | this.userRole$ = await this.auth.user.subscribe(res => { 16 | console.log(res.uid) 17 | if (res) { 18 | return this._backendService.getDoc("USERS", res.uid); 19 | } 20 | }); 21 | console.log(this.userRole$) 22 | // console.log(authenticatedUser); 23 | return true; 24 | // const authenticated = !!authenticatedUser; 25 | // if (!authenticated) { 26 | // this._router.navigate(['/login']); 27 | // } 28 | // return authenticated; 29 | } 30 | } -------------------------------------------------------------------------------- /src/app/services/backend.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { environment } from '../../environments/environment'; 3 | import { AngularFireAuth } from '@angular/fire/auth'; 4 | // import { auth } from 'firebase/app'; 5 | import auth from 'firebase'; 6 | import { AngularFirestore, AngularFirestoreDocument } from '@angular/fire/firestore'; 7 | import { AngularFireStorage } from '@angular/fire/storage'; 8 | // import { firestore } from 'firebase/app'; 9 | import firestore from 'firebase'; 10 | import { Subject } from 'rxjs'; 11 | 12 | @Injectable({ 13 | providedIn: 'root' 14 | }) 15 | export class BackendService { 16 | configData; 17 | private userRoleSource = new Subject(); 18 | userRole$ = this.userRoleSource.asObservable(); 19 | 20 | constructor(public afAuth: AngularFireAuth, private _afs: AngularFirestore, 21 | private _storage: AngularFireStorage) { 22 | } 23 | 24 | getConfig(configType) { 25 | configType == "social" ? this.configData = environment.social : ""; 26 | configType == "helptext" ? this.configData = environment.helptext : ""; 27 | return this.configData; 28 | } 29 | 30 | loginEmail(formData){ 31 | return this.afAuth.signInWithEmailAndPassword(formData.data.email, formData.data.password); 32 | } 33 | 34 | loginSocialAuth(formType) { 35 | return formType=='FB' ? this.afAuth.signInWithRedirect(new auth.auth.FacebookAuthProvider()) : this.afAuth.signInWithRedirect(new auth.auth.GoogleAuthProvider()); 36 | } 37 | 38 | createUser(formData) { 39 | return this.afAuth.createUserWithEmailAndPassword(formData.data.email, formData.data.password); 40 | } 41 | 42 | getCollUrls(coll) { 43 | let _coll = "USER_SETTINGS"; 44 | if (coll == "USERS") { _coll = "USER_SETTINGS"; } 45 | if (coll == "ROLES") { _coll = "USER_ROLES"; } 46 | if (coll == "ADDRESSBOOK") { _coll = "USER_ADDRESSBOOK"; } 47 | if (coll == "CAMPAIGN") { _coll = "USER_CAMPAIGN"; } 48 | if (coll == "LEADS") { _coll = "USER_LEADS"; } 49 | if (coll == "OPPURTUNITY") { _coll = "USER_OPPURTUNITY"; } 50 | if (coll == "APPOINTMENTS") { _coll = "USER_APPOINTMENTS"; } 51 | if (coll == "CALLS") { _coll = "USER_CALLS"; } 52 | if (coll == "TICKETS") { _coll = "USER_TICKETS"; } 53 | if (coll == "WORKORDERS") { _coll = "USER_WORKORDERS"; } 54 | if (coll == "ORDERS") { _coll = "USER_ORDERS"; } 55 | return _coll; 56 | } 57 | 58 | get timestamp() { 59 | const d = new Date(); 60 | return d; 61 | // return firebase.firestore.FieldValue.serverTimestamp(); 62 | } 63 | 64 | setUserDoc(coll,docId, data) { 65 | const timestamp = this.timestamp 66 | var docRef = this._afs.collection(this.getCollUrls(coll)).doc(docId); 67 | return docRef.set({ 68 | ...data, 69 | author: docId, 70 | updatedAt: timestamp, 71 | createdAt: timestamp 72 | }).then((res) => { return true; }); 73 | } 74 | 75 | updateDoc(coll,docId, data) { 76 | const timestamp = this.timestamp 77 | var docRef = this._afs.collection(this.getCollUrls(coll)).doc(docId); 78 | return docRef.update({ 79 | ...data, 80 | updatedAt: timestamp, 81 | }).then((res) => { return true; }); 82 | } 83 | 84 | getDoc(coll: string, docId: string) { 85 | return this._afs.collection(this.getCollUrls(coll)).doc(docId).valueChanges(); 86 | } 87 | deleteDoc(coll: string, docId: string) { 88 | const timestamp = this.timestamp 89 | var docRef = this._afs.collection(this.getCollUrls(coll)).doc(docId); 90 | return docRef.delete().then((res) => { return true }); 91 | } 92 | getDocs(coll: string, formData?) { 93 | if (formData) { 94 | if (formData.name) { 95 | return this._afs.collection(this.getCollUrls(coll), ref => ref.where('name', '>=', formData.name)).valueChanges(); 96 | } 97 | if (formData.phone) { 98 | return this._afs.collection(this.getCollUrls(coll), ref => ref.where('phone', '>=', formData.phone)).valueChanges(); 99 | } 100 | } else { // no search critera - fetch all docs 101 | return this._afs.collection(this.getCollUrls(coll)).valueChanges(); 102 | } 103 | } 104 | 105 | setDoc(coll: string, data: any, authorID: any) { 106 | let docId; 107 | const id = this._afs.createId(); 108 | const item = { id, name }; 109 | if (docId) { item.id = docId; } 110 | const timestamp = this.timestamp 111 | var docRef = this._afs.collection(this.getCollUrls(coll)).doc(item.id); 112 | return docRef.set({ 113 | ...data, 114 | _id: id, 115 | author: authorID, 116 | updatedAt: timestamp, 117 | createdAt: timestamp 118 | }).then((res) => { return id; }); 119 | } 120 | 121 | updateFileUpload(coll: string, docId: string, filePath: string) { 122 | const timestamp = this.timestamp; 123 | const docRef = this._afs.collection(this.getCollUrls(coll)).doc(docId); 124 | return docRef.update({ 125 | files: firestore.firestore.FieldValue.arrayUnion(filePath), 126 | updatedAt: timestamp, 127 | // username: this.afAuth.auth.currentUser.displayName, 128 | // useremail: this.afAuth.auth.currentUser.email, 129 | // author: this.afAuth.auth.currentUser.uid 130 | }); 131 | } 132 | getFileDownloadUrl(url) { 133 | const ref = this._storage.ref(url); 134 | return ref.getDownloadURL(); 135 | } 136 | setRole(role) { 137 | this.userRoleSource.next(role); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /src/app/services/datamodel.ts: -------------------------------------------------------------------------------- 1 | export class DBInBoundData { 2 | error: boolean; 3 | statusCode: number; // 0 initial, 1 saved, 2 others 4 | statusMessage: string; // error or success message from server 5 | rowCount: number; // number of rows returned 6 | data: any; // actual data 7 | } 8 | 9 | export class DBOutBoundData { 10 | rowCount : number; 11 | recordType: string; 12 | data: any; 13 | } -------------------------------------------------------------------------------- /src/app/shared/aboutus.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/shared/aboutus.component.css -------------------------------------------------------------------------------- /src/app/shared/aboutus.component.html: -------------------------------------------------------------------------------- 1 |

aboutus works!

2 | -------------------------------------------------------------------------------- /src/app/shared/aboutus.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-aboutus', 5 | templateUrl: './aboutus.component.html', 6 | styleUrls: ['./aboutus.component.css'] 7 | }) 8 | export class AboutusComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/shared/dropzone/dropzone.directive.ts: -------------------------------------------------------------------------------- 1 | import { Directive, HostListener, Output, EventEmitter } from '@angular/core'; 2 | 3 | @Directive({ 4 | selector: '[appDropZone]' 5 | }) 6 | 7 | export class DropZoneDirective { 8 | @Output() dropped = new EventEmitter(); 9 | @Output() hovered = new EventEmitter(); 10 | 11 | constructor() { } 12 | 13 | @HostListener('drop', ['event']) 14 | onDrop($event) { 15 | $event.preventDefault(); 16 | this.dropped.emit($event.dataTransfer.files); 17 | this.hovered.emit(false); 18 | } 19 | 20 | @HostListener('dragOver', ['event']) 21 | ondragover($event) { 22 | $event.preventDefault(); 23 | this.hovered.emit(true); 24 | } 25 | @HostListener('dragleave', ['$event']) 26 | onDragLeave($event) { 27 | $event.preventDefault(); 28 | this.hovered.emit(false); 29 | } 30 | } -------------------------------------------------------------------------------- /src/app/shared/dropzone/filesize.pipe.ts: -------------------------------------------------------------------------------- 1 | // FileSize pipe is used to show raw bytes in familiar file suize units like KB, MB, GB etc.. 2 | import { Pipe, PipeTransform } from '@angular/core'; 3 | const FILE_SIZE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; 4 | const FILE_SIZE_UNITS_LONG = ['Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes', 'Pettabytes', 'Exabytes', 'Zettabytes', 'Yottabytes']; 5 | @Pipe({ 6 | name: 'fileSize' 7 | }) 8 | export class FileSizePipe implements PipeTransform { 9 | transform(sizeInBytes: number, longForm?: boolean): string { 10 | const units = longForm ? FILE_SIZE_UNITS_LONG : FILE_SIZE_UNITS; 11 | let power = Math.round(Math.log(sizeInBytes) / Math.log(1024)); 12 | power = Math.min(power, units.length - 1); 13 | const size = sizeInBytes / Math.pow(1024, power); // size in new units 14 | const formattedSize = Math.round(size * 100) / 100; // keep up to 2 decimals 15 | const unit = units[power]; 16 | return size ? `${formattedSize} ${unit}` : '0'; 17 | // don't use ' , use ` instead for run time calculated variables 18 | } 19 | } -------------------------------------------------------------------------------- /src/app/shared/dropzone/fileupload.component.css: -------------------------------------------------------------------------------- 1 | .dropzone { 2 | display: flex; 3 | align-items: center; 4 | justify-content: center; 5 | flex-direction: column; 6 | height: 300px; 7 | border: 2px dashed #f16624; 8 | border-radius: 5px; 9 | background: white; 10 | margin: 10px 0; 11 | /* &.hovering { 12 | border: 2px solid #f16624; 13 | color: #dadada !important; 14 | } */ 15 | } 16 | progress::-webkit-progress-value { 17 | transition: width 0.1s ease; 18 | } -------------------------------------------------------------------------------- /src/app/shared/dropzone/fileupload.component.html: -------------------------------------------------------------------------------- 1 | Error occured. {{ errorMessage }} 2 |
3 | 6 | 7 | {{ pct | number }}% 8 |
9 | Document is saved. 10 |
11 |
17 |

File Upload

18 |
19 | 27 |
28 |
29 |
30 | {{ snap.bytesTransferred | fileSize }} of {{ snap.totalBytes | fileSize }} 31 |
32 |

Results!

33 |
34 |
35 | 36 | 37 | 38 |
-------------------------------------------------------------------------------- /src/app/shared/dropzone/fileupload.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | import { AngularFireStorage, AngularFireUploadTask } from '@angular/fire/storage'; 3 | import { Observable } from 'rxjs'; 4 | import { finalize } from 'rxjs/operators'; 5 | import { BackendService } from '../../services/backend.service'; 6 | 7 | @Component({ 8 | selector: 'app-fileupload', 9 | templateUrl: './fileupload.component.html', 10 | styleUrls: ['./fileupload.component.css'] 11 | }) 12 | export class FileUploadComponent { 13 | @Input() fileUrl: string; 14 | @Input() docId: string; 15 | task: AngularFireUploadTask; 16 | percentage: Observable; 17 | snapshot: Observable; 18 | downloadURL: Observable; 19 | isHovering: boolean; 20 | error: boolean = false; 21 | errorMessage: string = ""; 22 | 23 | constructor(private _storage: AngularFireStorage, private _backendService: BackendService) { } 24 | 25 | toggleHover(event: boolean) { 26 | this.isHovering = event; 27 | } 28 | 29 | startUpload(event) { 30 | const file = event.target.files[0]; 31 | const filePath = this.fileUrl + '/' + event.target.files[0].name + '_' + new Date().getTime(); 32 | const fileRef = this._storage.ref(filePath); 33 | // const task = this._storage.upload(filePath, file); 34 | const task = fileRef.put(file); 35 | // observe percentage changes 36 | this.percentage = task.percentageChanges(); 37 | // get notified when the download URL is available 38 | task.snapshotChanges().pipe( 39 | finalize(() => this.downloadURL = fileRef.getDownloadURL()) 40 | ) 41 | .subscribe((res) => { 42 | if (res.bytesTransferred == res.totalBytes) { 43 | // this._backendService.updateFileUpload(this.fileUrl, this.docId, res.ref["location"].path); 44 | this._backendService.updateFileUpload(this.fileUrl, this.docId, res.ref["fullPath"]); 45 | } 46 | }); 47 | } 48 | 49 | isActive(snapshot) { 50 | return snapshot.state === 'running' && snapshot.bytesTransferred < snapshot.totalBytes; 51 | } 52 | } -------------------------------------------------------------------------------- /src/app/shared/footer.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/shared/footer.component.css -------------------------------------------------------------------------------- /src/app/shared/footer.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | {{ configData.copyright }} 17 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/app/shared/footer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { BackendService } from '../services/backend.service'; 3 | 4 | @Component({ 5 | selector: 'app-footer', 6 | templateUrl: './footer.component.html', 7 | styleUrls: ['./footer.component.css'] 8 | }) 9 | export class FooterComponent implements OnInit { 10 | configData; 11 | 12 | constructor(private _backendService: BackendService) { } 13 | 14 | ngOnInit(): void { 15 | this.configData = this._backendService.getConfig("social"); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/app/shared/header.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/shared/header.component.css -------------------------------------------------------------------------------- /src/app/shared/header.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 |
8 | 11 |
12 |
13 | 16 |
17 |
18 | 21 |
22 |
23 | 26 |
27 |
28 | 29 | 32 |
33 |
34 | {{ imageUrl }} 35 | {{ pageTitle }} 36 | 39 | 40 | 43 | 44 |
45 |
46 | 47 | {{ helpType == "login" ? configData.login : ""}} 48 | {{ helpType == "register" ? configData.register : ""}} 49 | {{ helpType == "checkin" ? configData.checkin : ""}} 50 | {{ helpType == "checkout" ? configData.checkout : ""}} 51 | {{ helpType == "aboutus" ? configData.aboutus : ""}} 52 | {{ helpType == "employee" ? configData.employee : ""}} 53 | 54 | 55 |
56 | 57 | 60 |
61 |
62 | 63 | 66 |
67 |
68 | 69 | 72 |
73 |
74 | 75 |
76 | 77 | 80 |
81 |
82 | 83 | 86 |
87 |
88 | 89 | 92 |
93 |
94 | 95 | 98 |
99 |
100 | 101 | 104 |
105 |
-------------------------------------------------------------------------------- /src/app/shared/header.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | import { BackendService } from '../services/backend.service'; 3 | import { AngularFireAuth } from '@angular/fire/auth'; 4 | 5 | @Component({ 6 | selector: 'app-header', 7 | templateUrl: './header.component.html', 8 | styleUrls: ['./header.component.css'] 9 | }) 10 | export class HeaderComponent implements OnInit { 11 | @Input() imageUrl: string; 12 | @Input() pageTitle: string; 13 | @Input() helpType: string; 14 | configData; 15 | authState: any = null; 16 | data$; 17 | 18 | constructor(public afAuth: AngularFireAuth, private _backendService: BackendService) { } 19 | 20 | ngOnInit(): void { 21 | this.configData = this._backendService.getConfig("helptext"); 22 | this.afAuth.authState.subscribe(authState => { 23 | this.authState = authState; 24 | this.getUserDoc(); 25 | }) 26 | } 27 | getUserDoc() { 28 | return this._backendService.getDoc("USERS", this.authState.uid).subscribe( 29 | (res) => { 30 | if (res) { 31 | this.data$ = this._backendService.getDoc("ROLES", res["role"]); 32 | this._backendService.setRole(this.data$); 33 | } 34 | }, 35 | error => {}, 36 | () => console.log("") 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/app/shared/helpdesk.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/shared/helpdesk.component.css -------------------------------------------------------------------------------- /src/app/shared/helpdesk.component.html: -------------------------------------------------------------------------------- 1 |

helpdesk works!

2 | -------------------------------------------------------------------------------- /src/app/shared/helpdesk.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-helpdesk', 5 | templateUrl: './helpdesk.component.html', 6 | styleUrls: ['./helpdesk.component.css'] 7 | }) 8 | export class HelpdeskComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/shared/router.aimations.ts: -------------------------------------------------------------------------------- 1 | import {trigger, state, animate, style, transition} from '@angular/animations'; 2 | 3 | export function moveIn() { 4 | return trigger('moveIn', [ 5 | state('void', style({position: 'fixed', width: '100%'}) ), 6 | state('*', style({position: 'fixed', width: '100%'}) ), 7 | transition(':enter', [ 8 | style({opacity:'0', transform: 'translateX(100px)'}), 9 | animate('.6s ease-in-out', style({opacity:'1', transform: 'translateX(0)'})) 10 | ]), 11 | transition(':leave', [ 12 | style({opacity:'1', transform: 'translateX(0)'}), 13 | animate('.3s ease-in-out', style({opacity:'0', transform: 'translateX(-200px)'})) 14 | ]) 15 | ]); 16 | } 17 | 18 | export function fallIn() { 19 | return trigger('fallIn', [ 20 | transition(':enter', [ 21 | style({opacity:'0', transform: 'translateY(40px)'}), 22 | animate('.4s .2s ease-in-out', style({opacity:'1', transform: 'translateY(0)'})) 23 | ]), 24 | transition(':leave', [ 25 | style({opacity:'1', transform: 'translateX(0)'}), 26 | animate('.3s ease-in-out', style({opacity:'0', transform: 'translateX(-200px)'})) 27 | ]) 28 | ]); 29 | } 30 | 31 | export function moveInLeft() { 32 | return trigger('moveInLeft', [ 33 | transition(':enter', [ 34 | style({opacity:'0', transform: 'translateX(-100px)'}), 35 | animate('.6s .2s ease-in-out', style({opacity:'1', transform: 'translateX(0)'})) 36 | ]) 37 | ]); 38 | } -------------------------------------------------------------------------------- /src/app/shared/router.animations.ts: -------------------------------------------------------------------------------- 1 | import { trigger, state, animate, style, transition } from '@angular/animations'; 2 | 3 | export function fallIn() { 4 | return trigger('fallIn',[ 5 | transition(':enter', [ 6 | style({opacity:'0', transform: 'translateY(40px)'}), 7 | animate('.4s .2s ease-in-out', style({opacity:'1', transform: 'translateY(0)'})) 8 | ]), 9 | transition(':leave', [ 10 | style({opacity:'1', transform: 'translateX(0)'}), 11 | animate('.3s ease-in-out', style({opacity:'0', transform: 'translateX(-200px)'})) 12 | ]) 13 | ]); 14 | } 15 | 16 | 17 | export function moveIn() { 18 | return trigger('moveIn', [ 19 | state('void', style({position: 'fixed', width: '100%'}) ), 20 | state('*', style({position: 'fixed', width: '100%'}) ), 21 | transition(':enter', [ 22 | style({opacity:'0', transform: 'translateX(100px)'}), 23 | animate('.6s ease-in-out', style({opacity:'1', transform: 'translateX(0)'})) 24 | ]), 25 | transition(':leave', [ 26 | style({opacity:'1', transform: 'translateX(0)'}), 27 | animate('.3s ease-in-out', style({opacity:'0', transform: 'translateX(-200px)'})) 28 | ]) 29 | ]); 30 | } 31 | 32 | export function moveInLeft() { 33 | return trigger('moveInLeft', [ 34 | transition(':enter', [ 35 | style({opacity:'0', transform: 'translateX(-100px)'}), 36 | animate('.6s .2s ease-in-out', style({opacity:'1', transform: 'translateX(0)'})) 37 | ]) 38 | ]); 39 | } -------------------------------------------------------------------------------- /src/app/shared/simpleheader.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/shared/simpleheader.component.css -------------------------------------------------------------------------------- /src/app/shared/simpleheader.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | {{ imageUrl }} 7 | {{ pageTitle }} 8 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | {{ helpType == "login" ? configData.login : ""}} 20 | {{ helpType == "register" ? configData.register : ""}} 21 | {{ helpType == "checkin" ? configData.checkin : ""}} 22 | {{ helpType == "checkout" ? configData.checkout : ""}} 23 | {{ helpType == "aboutus" ? configData.aboutus : ""}} 24 | {{ helpType == "employee" ? configData.employee : ""}} 25 | {{ helpType == "config" ? configData.config : ""}} 26 | 27 | -------------------------------------------------------------------------------- /src/app/shared/simpleheader.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | import { BackendService } from '../services/backend.service'; 3 | 4 | @Component({ 5 | selector: 'app-simpleheader', 6 | templateUrl: './simpleheader.component.html', 7 | styleUrls: ['./simpleheader.component.css'] 8 | }) 9 | export class SimpleheaderComponent implements OnInit { 10 | @Input() imageUrl: string; 11 | @Input() pageTitle: string; 12 | @Input() helpType: string; 13 | configData; 14 | 15 | constructor(private _backendService: BackendService) { } 16 | 17 | ngOnInit(): void { 18 | this.configData = this._backendService.getConfig("helptext"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/app/ui/addressbook/address.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/ui/addressbook/address.component.css -------------------------------------------------------------------------------- /src/app/ui/addressbook/address.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; 2 | import { moveIn, fallIn } from '../../shared/router.animations'; 3 | import { Observable } from 'rxjs'; 4 | import { DataSource } from '@angular/cdk/collections'; 5 | import { MatTableModule, MatTableDataSource } from '@angular/material/table'; 6 | import { MatPaginator } from '@angular/material/paginator'; 7 | import { MatSort } from '@angular/material/sort'; 8 | import { AngularFireAuth } from '@angular/fire/auth'; 9 | 10 | import { BackendService } from '../../services/backend.service'; 11 | import { FormBuilder, FormGroup, FormArray, FormControl, Validators } from '@angular/forms'; 12 | 13 | @Component({ 14 | selector: 'app-address', 15 | templateUrl: './address.component.html', 16 | styleUrls: ['./address.component.css'], 17 | animations: [moveIn(), fallIn()], 18 | host: { '[@moveIn]': '' } 19 | }) 20 | export class AddressComponent implements OnInit, OnDestroy { 21 | panelOpenState = false; 22 | contacts = ['Personal', 'Customer', 'Manufacturer', 'Vendor', 'Other', 'Campaign', 'Lead', 'Oppurtunity']; 23 | addTypes = ['Home', 'Office', 'Primary', 'Mailing']; 24 | emailTypes = ['Home', 'Office', 'Primary', 'Personal']; 25 | phoneTypes = ['Home', 'Office', 'Primary', 'Personal']; 26 | members: any[]; 27 | dataSource: MatTableDataSource; 28 | myDocData; 29 | data$; 30 | toggleField: string; 31 | state: string = ''; 32 | savedChanges = false; 33 | error: boolean = false; 34 | errorMessage: String = ""; 35 | dataLoading: boolean = false; 36 | private querySubscription; 37 | authState: any = null; 38 | 39 | total_amount = 0; 40 | addDataForm: FormGroup; 41 | editDataForm: FormGroup; 42 | 43 | @ViewChild(MatPaginator) paginator: MatPaginator; 44 | @ViewChild(MatSort) sort: MatSort; 45 | displayedColumns = ['contacttype', 'name', 'phone', '_id']; 46 | // file upload 47 | docId: string; 48 | fileName: string; 49 | showFileUpload: boolean = false; 50 | showDocument: boolean = false; 51 | docUrl: Observable; 52 | userRole$; 53 | 54 | constructor(public afAuth: AngularFireAuth, private _backendService: BackendService, private _fb: FormBuilder) { 55 | this._backendService.userRole$.subscribe(res => this.userRole$ = res); 56 | } 57 | 58 | ngOnInit() { 59 | this.toggleField = "searchMode"; 60 | this.error = false; 61 | this.errorMessage = ""; 62 | this.dataSource = new MatTableDataSource(this.members); 63 | this.addDataForm = this._fb.group({ 64 | name: ['', [Validators.minLength(2), Validators.required]], 65 | phone: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 66 | contacttype: ['', [Validators.required]], 67 | addresses: this._fb.array([]), 68 | emails: this._fb.array([]), 69 | phones: this._fb.array([]) 70 | }); 71 | this.editDataForm = this._fb.group({ 72 | _id: ['', Validators.required], 73 | name: ['', [Validators.minLength(2), Validators.required]], 74 | phone: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 75 | contacttype: ['', [Validators.required]], 76 | addresses: this._fb.array([]), 77 | emails: this._fb.array([]), 78 | phones: this._fb.array([]) 79 | }); 80 | this.afAuth.authState.subscribe(authState => { 81 | this.authState = authState; 82 | }) 83 | } 84 | 85 | ADDRESSLINES(formName) { 86 | return this[formName].get('addresses') as FormArray; 87 | } 88 | 89 | addAddress(formName) { 90 | this.ADDRESSLINES(formName).push(this._fb.group({ 91 | addtype: [''], 92 | address: [''] 93 | })); 94 | } 95 | deleteAddress(index, formName) { 96 | this.ADDRESSLINES(formName).removeAt(index); 97 | } 98 | 99 | EMAILLINES(formName) { 100 | return this[formName].get('emails') as FormArray; 101 | } 102 | 103 | addEmail(formName) { 104 | this.EMAILLINES(formName).push(this._fb.group({ 105 | emailtype: [''], 106 | email: ['', [Validators.email]] 107 | })); 108 | } 109 | deleteEmail(index, formName) { 110 | this.EMAILLINES(formName).removeAt(index); 111 | } 112 | 113 | PHONELINES(formName) { 114 | return this[formName].get('phones') as FormArray; 115 | } 116 | addPhone(formName) { 117 | this.PHONELINES(formName).push(this._fb.group({ 118 | phonetype: [''], 119 | phone: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]] 120 | })); 121 | } 122 | deletePhone(index, formName) { 123 | this.PHONELINES(formName).removeAt(index); 124 | } 125 | 126 | toggle(filter?) { 127 | if (!filter) { filter = "searchMode" } 128 | else { filter = filter; } 129 | this.toggleField = filter; 130 | this.dataLoading = false; 131 | } 132 | 133 | getData(formData?) { 134 | this.dataLoading = true; 135 | this.querySubscription = this._backendService.getDocs('ADDRESSBOOK', formData).subscribe((res) => { 136 | if (res.length > 0) { 137 | this.dataSource = new MatTableDataSource(res); 138 | this.dataSource.paginator = this.paginator; 139 | this.dataSource.sort = this.sort; 140 | } 141 | }, 142 | (error) => { 143 | this.error = true; 144 | this.errorMessage = error.message; 145 | this.dataLoading = false; 146 | }, 147 | () => { 148 | this.dataLoading = false; 149 | }); 150 | } 151 | 152 | setData(formData) { 153 | this.dataLoading = true; 154 | return this._backendService.setDoc('ADDRESSBOOK', formData, this.authState.uid).then(res => { 155 | if (res) { 156 | this.savedChanges = true; 157 | this.error = false; 158 | this.errorMessage = ""; 159 | this.dataLoading = false; 160 | } 161 | } 162 | ).catch(err => { 163 | if (err) { 164 | this.error = true; 165 | this.errorMessage = err.message; 166 | this.dataLoading = false; 167 | } 168 | } 169 | ); 170 | } 171 | 172 | updateData(formData) { 173 | this.dataLoading = true; 174 | this.querySubscription = this._backendService.updateDoc('ADDRESSBOOK', formData._id, formData).then(res => { 175 | if (res) { 176 | this.savedChanges = true; 177 | this.error = false; 178 | this.errorMessage = ""; 179 | this.dataLoading = false; 180 | } 181 | } 182 | ).catch(err => { 183 | if (err) { 184 | this.error = true; 185 | this.errorMessage = err.message; 186 | this.dataLoading = false; 187 | } 188 | }); 189 | } 190 | 191 | getDoc(docId) { 192 | this.docId = docId; // this is required to pass at file upload directive 193 | this.dataLoading = true; 194 | this.data$ = this._backendService.getDoc('ADDRESSBOOK', docId).subscribe(res => { 195 | if (res) { 196 | this.data$ = res; 197 | this.editDataForm = this._fb.group({ 198 | _id: ['', Validators.required], 199 | name: ['', [Validators.minLength(2), Validators.required]], 200 | phone: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 201 | contacttype: ['', [Validators.required]], 202 | addresses: this._fb.array([]), 203 | emails: this._fb.array([]), 204 | phones: this._fb.array([]) 205 | }); 206 | this.editDataForm.patchValue(this.data$); 207 | for (let i = 0; i < this.data$["addresses"].length; i++) { 208 | this.ADDRESSLINES('editDataForm').push(this._fb.group(this.data$["addresses"][i])); 209 | } 210 | for (let i = 0; i < this.data$["emails"].length; i++) { 211 | this.EMAILLINES('editDataForm').push(this._fb.group(this.data$["emails"][i])); 212 | } 213 | for (let i = 0; i < this.data$["phones"].length; i++) { 214 | this.PHONELINES('editDataForm').push(this._fb.group(this.data$["phones"][i])); 215 | } 216 | this.toggle('editMode'); 217 | this.dataLoading = false; 218 | } 219 | }, 220 | (error) => { 221 | this.error = true; 222 | this.errorMessage = error.message; 223 | this.dataLoading = false; 224 | }, 225 | () => { 226 | this.dataLoading = false; 227 | }); 228 | } 229 | 230 | deleteDoc(docId) { 231 | if (confirm("Are you sure want to delete this record ?")) { 232 | this.dataLoading = true; 233 | this._backendService.deleteDoc('ADDRESSBOOK', docId).then(res => { 234 | if (res) { 235 | this.error = false; 236 | this.errorMessage = ""; 237 | this.dataLoading = false; 238 | } 239 | } 240 | ).catch(err => { 241 | if (err) { 242 | this.error = true; 243 | this.errorMessage = err.message; 244 | this.dataLoading = false; 245 | } 246 | } 247 | ); 248 | } 249 | } 250 | getDocUrl(docUrl) { 251 | this.fileName = docUrl; 252 | this.docUrl = this._backendService.getFileDownloadUrl(docUrl); 253 | } 254 | //mat table paginator and filter functions 255 | ngAfterViewInit() { 256 | this.dataSource.paginator = this.paginator; 257 | this.dataSource.sort = this.sort; 258 | } 259 | 260 | applyFilter(filterValue: string) { 261 | filterValue = filterValue.trim(); // Remove whitespace 262 | filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches 263 | this.dataSource.filter = filterValue; 264 | } 265 | ngOnDestroy() { 266 | // this is not needed when observable is used, in this case, we are registering user on subscription 267 | if (this.querySubscription) { 268 | this.querySubscription.unsubscribe(); 269 | } 270 | } 271 | } -------------------------------------------------------------------------------- /src/app/ui/auth/admin.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/ui/auth/admin.component.css -------------------------------------------------------------------------------- /src/app/ui/auth/admin.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
6 | 7 |
8 | 9 | 11 | 12 | 13 | 14 | cached 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 |
25 |
26 |
27 |
28 | 29 | 30 | 31 | 32 | 33 |
34 | 35 | 36 | Data is saved. 37 | 38 | clear 39 | 40 |
41 | 42 | Error: {{ errorMessage }} 43 | 44 | 46 | 47 | 48 | search 49 | 50 | 51 | 52 | cached 53 | 54 | 55 | 56 | 58 | eg First Last Name 59 | 60 |
61 | 62 | 64 | eg info@elishconsulting.com 65 | 66 |
67 | 68 | 70 | eg 0123456789 71 | 72 |
73 | 74 | Role 75 | 76 | 77 | {{ a }} 78 | 79 | 80 | 81 | 86 |
87 |
88 |
89 | 90 | 91 | 92 | 93 | 94 | 95 | 98 | 99 | 100 | search 101 | 102 | 103 |
104 | 105 | 106 | 107 |
108 |
109 | 110 | 111 | Name 112 | {{row.name}} 113 | 114 | 115 | eMail 116 | {{row.email}} 117 | 118 | 119 | phone 120 | {{row.phone}} 121 | 122 | 123 | role 124 | {{row.role}} 125 | 126 | 127 | 128 | action 129 | 130 | 131 | 134 | 135 | 136 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 148 |
149 |
150 | -------------------------------------------------------------------------------- /src/app/ui/auth/admin.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; 2 | import { moveIn, fallIn } from '../../shared/router.aimations'; 3 | import { Observable } from 'rxjs'; 4 | import { DataSource } from '@angular/cdk/collections'; 5 | import { MatTableModule, MatTableDataSource } from '@angular/material/table'; 6 | import { MatPaginator } from '@angular/material/paginator'; 7 | import { MatSort } from '@angular/material/sort'; 8 | import { BackendService } from '../../services/backend.service'; 9 | 10 | @Component({ 11 | selector: 'app-admin', 12 | templateUrl: './admin.component.html', 13 | styleUrls: ['./admin.component.css'], 14 | animations: [moveIn(), fallIn()], 15 | host: { '[@moveIn]': '' } 16 | }) 17 | export class AdminComponent implements OnInit, OnDestroy { 18 | 19 | members: any[]; 20 | dataSource: MatTableDataSource; 21 | data$; 22 | toggleField: string; 23 | state: string = ''; 24 | savedChanges = false; 25 | error: boolean = false; 26 | errorMessage: String = ""; 27 | dataLoading: boolean = false; 28 | private querySubscription; 29 | roleTypes = ['employee', 'admin']; 30 | 31 | @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator; 32 | @ViewChild(MatSort, {static: true}) sort: MatSort; 33 | 34 | displayedColumns = ['name', 'email', 'phone', 'role', 'author']; 35 | 36 | constructor(private _backendService: BackendService) { } 37 | 38 | ngOnInit() { 39 | this.toggleField = "searchMode"; 40 | this.dataSource = new MatTableDataSource(this.members); 41 | this.getData(); 42 | } 43 | 44 | toggle(filter?) { 45 | if (!filter) { filter = "searchMode" } 46 | else { filter = filter; } 47 | this.toggleField = filter; 48 | this.dataLoading = false; 49 | } 50 | getData(formData?) { 51 | this.dataLoading = true; 52 | this.querySubscription = this._backendService.getDocs('USERS', formData).subscribe((res) => { 53 | this.dataSource = new MatTableDataSource(res); 54 | this.dataSource.paginator = this.paginator; 55 | this.dataSource.sort = this.sort; 56 | }, 57 | (error) => { 58 | this.error = true; 59 | this.errorMessage = error.message; 60 | this.dataLoading = false; 61 | }, 62 | () => { 63 | this.dataLoading = false; 64 | }); 65 | } 66 | 67 | updateData(formData) { 68 | this.dataLoading = true; 69 | this._backendService.updateDoc('USERS', formData.author, formData).then(res => { 70 | if (res) { 71 | this.savedChanges = true; 72 | this.error = false; 73 | this.errorMessage = ""; 74 | this.dataLoading = false; 75 | } 76 | } 77 | ).catch(err => { 78 | if (err) { 79 | this.error = true; 80 | this.errorMessage = err.message; 81 | this.dataLoading = false; 82 | } 83 | } 84 | ); 85 | } 86 | 87 | getDoc(docId) { 88 | this.dataLoading = true; 89 | this.data$ = this._backendService.getDoc('USERS', docId); 90 | this.toggle('editMode'); 91 | this.dataLoading = false; 92 | } 93 | 94 | deleteDoc(docId) { 95 | if (confirm("Are you sure want to delete this record ?")) { 96 | this.dataLoading = true; 97 | this._backendService.deleteDoc('USERS', docId).then(res => { 98 | if (res) { 99 | this.error = false; 100 | this.errorMessage = ""; 101 | this.dataLoading = false; 102 | } 103 | } 104 | ).catch(err => { 105 | if (err) { 106 | this.error = true; 107 | this.errorMessage = err.message; 108 | this.dataLoading = false; 109 | } 110 | } 111 | ); 112 | } 113 | } 114 | 115 | //mat table paginator and filter functions 116 | ngAfterViewInit() { 117 | this.dataSource.paginator = this.paginator; 118 | this.dataSource.sort = this.sort; 119 | } 120 | 121 | applyFilter(filterValue: string) { 122 | filterValue = filterValue.trim(); // Remove whitespace 123 | filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches 124 | this.dataSource.filter = filterValue; 125 | } 126 | ngOnDestroy() { 127 | // this is not needed when observable is used, in this case, we are registering user on subscription 128 | if (this.querySubscription) { 129 | this.querySubscription.unsubscribe(); 130 | } 131 | } 132 | } -------------------------------------------------------------------------------- /src/app/ui/auth/login.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/ui/auth/login.component.css -------------------------------------------------------------------------------- /src/app/ui/auth/login.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | CRM Cloud 8 | ElishConsulting.com 9 |
10 | 11 | Login credentials are not verified. Error: {{ IBData.statusMessage }} 12 | 13 | Your app is up and running. 14 | 15 | 16 |



17 | 18 |
19 |



20 |



21 |
22 |
23 |
24 |
25 | 26 | 27 | 28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 | Please enter a valid email. 37 | 38 | 40 | 41 | 42 | Password is Required. 43 | Password can't be less than 4 characters. 44 | Password can't be more than 30 characters. 45 | 46 |
47 | 48 | 49 | 53 | 54 |

55 | 56 | 57 | Login with Facebook 58 | 59 | 60 | Login with Google 61 | 62 | 63 |
64 |
-------------------------------------------------------------------------------- /src/app/ui/auth/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { moveIn, fallIn } from '../../shared/router.animations'; 3 | import { environment } from '../../../environments/environment'; 4 | import { BackendService } from '../../services/backend.service'; 5 | import { DBInBoundData, DBOutBoundData } from '../../services/datamodel'; 6 | import { AngularFireAuth } from '@angular/fire/auth'; 7 | 8 | @Component({ 9 | selector: 'app-login', 10 | templateUrl: './login.component.html', 11 | styleUrls: ['./login.component.css'], 12 | animations: [moveIn(), fallIn()], 13 | host: { '[@fallIn]': '' } 14 | }) 15 | export class LoginComponent implements OnInit { 16 | 17 | showPage: boolean = true; 18 | showFiller: boolean = true; 19 | socialAuth: boolean = false; // show Google and FB Sign in only when social auth is enabled 20 | state: string = ''; // required for router animation 21 | dataLoading: boolean = false; // spinner booleana 22 | IBData: DBInBoundData; // inbound data 23 | OBData: DBOutBoundData; // outbound data 24 | 25 | constructor(public auth: AngularFireAuth, private _backendService: BackendService) { } 26 | 27 | ngOnInit() { 28 | if (environment.socialAuthEnabled) { 29 | this.socialAuth = true; // show Google and FB Sign in only when social auth is enabled 30 | } 31 | this.IBData = { 32 | error: false, 33 | statusCode: 0, // 0 initial, 1 saved, 2 others 34 | statusMessage: "", // error or success message from server 35 | rowCount: 0, // number of rows returned 36 | data: "" // actual data 37 | } // inbound data 38 | this.OBData = { 39 | rowCount: 1, 40 | recordType: "login", 41 | data: "" 42 | }; // outbound data 43 | } 44 | 45 | loginEmail(formData) { 46 | this.dataLoading = true; 47 | this.OBData.data = formData; 48 | return this._backendService.loginEmail(this.OBData).then(res => { 49 | this.IBData.error = false; 50 | this.IBData.statusCode = 1; 51 | }).catch(error => { 52 | this.IBData.error = true; 53 | this.IBData.statusCode = 0; 54 | this.IBData.statusMessage = error; 55 | }).then(r => this.dataLoading = false); 56 | } 57 | loginSocial(formType) { 58 | this.dataLoading = true; 59 | return this._backendService.loginSocialAuth(formType).then(res => { 60 | this.IBData.error = false; 61 | this.IBData.statusCode = 1; 62 | }).catch(error => { 63 | this.IBData.error = true; 64 | this.IBData.statusCode = 0; 65 | this.IBData.statusMessage = error; 66 | }).then(r => this.dataLoading = false); 67 | } 68 | 69 | logout() { 70 | this.auth.signOut(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/app/ui/auth/settings.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/ui/auth/settings.component.css -------------------------------------------------------------------------------- /src/app/ui/auth/settings.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 | 7 | 8 | Update Settings - New User 9 | 10 | 11 | 12 | {{ errorMessage }} 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Name is Required. 25 | Name can't be less than 5 characters. 26 | Name can't be more than 30 characters. 27 | 28 |
29 | 30 | 31 | 32 |
33 | Please enter a valid email. 34 | 35 | 37 | 38 | Please enter a valid phone. 39 |
40 | 41 | 42 | 43 | 44 |




45 |
46 |
47 |
48 |
49 | 50 | 51 | Your changes are saved. Please start using CRM App.
52 | 53 |
54 | 55 | 56 |
57 | 58 | 59 | Update Settings 60 | 61 | 62 | 63 | {{ errorMessage }} 64 | 65 | 66 | 67 | 69 | 70 | 71 | 72 | 74 | 75 | 76 | Name is Required. 77 | Name can't be less than 5 characters. 78 | Name can't be more than 30 characters. 79 | 80 |
81 | 82 | 83 | 84 |
85 | Please enter a valid email. 86 | 87 | 89 | 90 | Please enter a valid phone. 91 |
92 | 93 | 94 | 95 | 96 |




97 |
98 |
99 | -------------------------------------------------------------------------------- /src/app/ui/auth/settings.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { AngularFireAuth } from '@angular/fire/auth'; 4 | import { BackendService } from '../../services/backend.service'; 5 | 6 | @Component({ 7 | selector: 'app-settings', 8 | templateUrl: './settings.component.html', 9 | styleUrls: ['./settings.component.css'] 10 | }) 11 | export class SettingsComponent implements OnInit { 12 | savedChanges: boolean = false; 13 | dataLoading: boolean = false; 14 | error: boolean = false; 15 | errorMessage: String = ""; 16 | authState: any = null; 17 | newUser: boolean = false; 18 | data$; 19 | 20 | constructor(public afAuth: AngularFireAuth, private _backendService: BackendService, private _router: Router) { } 21 | 22 | ngOnInit(): void { 23 | this.afAuth.authState.subscribe(authState => { 24 | this.authState = authState; 25 | this.getUserDoc(); 26 | }) 27 | } 28 | 29 | onSubmit_newuser(formData) { 30 | this.dataLoading = true; 31 | this._backendService.setUserDoc("USERS", this.authState.uid, formData) 32 | .then( 33 | res => { 34 | if (res) { 35 | this.savedChanges = true; 36 | this.errorMessage = "Changes are saved"; 37 | this.dataLoading = false; 38 | } 39 | }) 40 | .catch(e => { 41 | if (e) { 42 | this.error = true; 43 | this.errorMessage = e.message; 44 | this.dataLoading = false; 45 | } 46 | }); 47 | } 48 | onSubmit_update(formData) { 49 | this.dataLoading = true; 50 | this._backendService.updateDoc("USERS", this.authState.uid, formData) 51 | .then( 52 | res => { 53 | if (res) { 54 | this.savedChanges = true; 55 | this.errorMessage = "Changes are saved"; 56 | this.dataLoading = false; 57 | } 58 | }) 59 | .catch(e => { 60 | if (e) { 61 | this.error = true; 62 | this.errorMessage = e.message; 63 | this.dataLoading = false; 64 | } 65 | }); 66 | } 67 | getUserDoc() { 68 | this.dataLoading = true; 69 | return this._backendService.getDoc("USERS", this.authState.uid).subscribe( 70 | (res) => { 71 | if (res) { 72 | this.data$ = res; 73 | } else { 74 | this.newUser = true; 75 | } 76 | this.dataLoading = false; 77 | }, 78 | error => { 79 | this.newUser = true; 80 | this.error = true; 81 | this.errorMessage = error; 82 | this.dataLoading = false; 83 | }, 84 | () => this.dataLoading = false 85 | ); 86 | } 87 | 88 | logout() { 89 | this.afAuth.signOut().then(res => { 90 | this._router.navigate(['/login']); 91 | }).catch(e => { 92 | this._router.navigate(['/login']) 93 | }); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/app/ui/auth/signup.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/ui/auth/signup.component.css -------------------------------------------------------------------------------- /src/app/ui/auth/signup.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | Create new account 8 | ElishConsulting.com 9 | 10 | 13 | 14 |
15 | 16 | Sign up failed. {{ IBData.statusMessage }} 17 | 18 |
19 |
20 |
21 |
22 | 23 | A New userId is created. Plese use your emailid and password to login back in future. or If you used Social authentication, 24 | you may already have signed in. Please browse to login page now. 25 | 26 |
27 |
28 |
29 |
30 | 31 | 33 | 34 |
35 |
36 |
37 |
38 | 39 | 40 | 41 |
42 | 43 | 44 | 45 | 46 | 47 | 48 |
49 | Please enter a valid email. 50 | 51 | 53 | 54 | 55 | Password is Required. 56 | Password can't be less than 6 characters. 57 | Password can't be more than 30 characters. 58 | 59 |
60 |




61 |
62 | -------------------------------------------------------------------------------- /src/app/ui/auth/signup.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { moveIn, fallIn } from '../../shared/router.animations'; 4 | import { environment } from '../../../environments/environment'; 5 | import { BackendService } from '../../services/backend.service'; 6 | import { DBInBoundData, DBOutBoundData } from '../../services/datamodel'; 7 | import { AngularFireAuth } from '@angular/fire/auth'; 8 | // import { auth } from 'firebase/app'; 9 | import auth from 'firebase'; 10 | 11 | @Component({ 12 | selector: 'app-signup', 13 | templateUrl: './signup.component.html', 14 | styleUrls: ['./signup.component.css'], 15 | animations: [moveIn(), fallIn()], 16 | host: { '[@fallIn]': '' } 17 | }) 18 | 19 | export class SignupComponent implements OnInit { 20 | 21 | state: string = ''; // required for router animation 22 | dataLoading: boolean = false; // spinner boolean 23 | IBData: DBInBoundData; // inbound data 24 | OBData: DBOutBoundData; // outbound data 25 | 26 | constructor(public auth: AngularFireAuth, private _router: Router, private _backendService: BackendService) { } 27 | 28 | ngOnInit() { 29 | this.IBData = { 30 | error: false, 31 | statusCode: 0, // 0 initial, 1 saved, 2 others 32 | statusMessage: "", // error or success message from server 33 | rowCount: 0, // number of rows returned 34 | data: "" // actual data 35 | } // inbound data 36 | this.OBData = { 37 | rowCount: 1, 38 | recordType: "signup", 39 | data: "" 40 | }; // outbound data 41 | } 42 | 43 | onSubmit(formData) { 44 | this.dataLoading = true; 45 | this.OBData.data = formData; 46 | return this._backendService.createUser(this.OBData).then(res => { 47 | this.IBData.error = false; 48 | this.IBData.statusCode = 1; 49 | this.IBData.statusMessage = res.user.email; 50 | }).catch(error => { 51 | this.IBData.error = true; 52 | this.IBData.statusCode = 0; 53 | this.IBData.statusMessage = error; 54 | }).then(r => this.dataLoading=false); 55 | } 56 | 57 | routeLoginPage() { 58 | this._router.navigate(['/login']); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/app/ui/callregister/calls.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/ui/callregister/calls.component.css -------------------------------------------------------------------------------- /src/app/ui/callregister/calls.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; 2 | import { moveIn, fallIn } from '../../shared/router.animations'; 3 | import { Observable } from 'rxjs'; 4 | import { DataSource } from '@angular/cdk/collections'; 5 | import { MatTableModule, MatTableDataSource } from '@angular/material/table'; 6 | import { MatPaginator } from '@angular/material/paginator'; 7 | import { MatSort } from '@angular/material/sort'; 8 | import { AngularFireAuth } from '@angular/fire/auth'; 9 | 10 | import { BackendService } from '../../services/backend.service'; 11 | import { FormBuilder, FormGroup, FormArray, FormControl, Validators } from '@angular/forms'; 12 | 13 | @Component({ 14 | selector: 'app-calls', 15 | templateUrl: './calls.component.html', 16 | styleUrls: ['./calls.component.css'], 17 | animations: [moveIn(), fallIn()], 18 | host: { '[@moveIn]': '' } 19 | }) 20 | export class CallsComponent implements OnInit, OnDestroy { 21 | panelOpenState = false; 22 | contacts = ['Personal', 'Customer', 'Manufacturer', 'Vendor', 'Other', 'Campaign', 'Lead', 'Oppurtunity']; 23 | addTypes = ['Home', 'Office', 'Primary', 'Mailing']; 24 | emailTypes = ['Home', 'Office', 'Primary', 'Personal']; 25 | phoneTypes = ['Home', 'Office', 'Primary', 'Personal']; 26 | members: any[]; 27 | dataSource: MatTableDataSource; 28 | myDocData; 29 | data$; 30 | toggleField: string; 31 | state: string = ''; 32 | savedChanges = false; 33 | error: boolean = false; 34 | errorMessage: String = ""; 35 | dataLoading: boolean = false; 36 | private querySubscription; 37 | authState: any = null; 38 | 39 | total_amount = 0; 40 | addDataForm: FormGroup; 41 | editDataForm: FormGroup; 42 | 43 | @ViewChild(MatPaginator) paginator: MatPaginator; 44 | @ViewChild(MatSort) sort: MatSort; 45 | displayedColumns = ['contacttype', 'name', 'phone', '_id']; 46 | // file upload 47 | docId: string; 48 | fileName: string; 49 | showFileUpload: boolean = false; 50 | showDocument: boolean = false; 51 | docUrl: Observable; 52 | userRole$; 53 | 54 | constructor(public afAuth: AngularFireAuth, private _backendService: BackendService, private _fb: FormBuilder) { 55 | this._backendService.userRole$.subscribe(res => this.userRole$ = res); 56 | } 57 | 58 | ngOnInit() { 59 | this.toggleField = "searchMode"; 60 | this.error = false; 61 | this.errorMessage = ""; 62 | this.dataSource = new MatTableDataSource(this.members); 63 | this.addDataForm = this._fb.group({ 64 | name: ['', [Validators.minLength(2), Validators.required]], 65 | phone: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 66 | contacttype: ['', [Validators.required]], 67 | purpose: ['',Validators.required], 68 | addresses: this._fb.array([]), 69 | emails: this._fb.array([]), 70 | phones: this._fb.array([]) 71 | }); 72 | this.editDataForm = this._fb.group({ 73 | _id: ['', Validators.required], 74 | name: ['', [Validators.minLength(2), Validators.required]], 75 | phone: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 76 | contacttype: ['', [Validators.required]], 77 | purpose: ['',Validators.required], 78 | addresses: this._fb.array([]), 79 | emails: this._fb.array([]), 80 | phones: this._fb.array([]) 81 | }); 82 | this.afAuth.authState.subscribe(authState => { 83 | this.authState = authState; 84 | }) 85 | } 86 | 87 | ADDRESSLINES(formName) { 88 | return this[formName].get('addresses') as FormArray; 89 | } 90 | 91 | addAddress(formName) { 92 | this.ADDRESSLINES(formName).push(this._fb.group({ 93 | addtype: [''], 94 | address: [''] 95 | })); 96 | } 97 | deleteAddress(index, formName) { 98 | this.ADDRESSLINES(formName).removeAt(index); 99 | } 100 | 101 | EMAILLINES(formName) { 102 | return this[formName].get('emails') as FormArray; 103 | } 104 | 105 | addEmail(formName) { 106 | this.EMAILLINES(formName).push(this._fb.group({ 107 | emailtype: [''], 108 | email: ['', [Validators.email]] 109 | })); 110 | } 111 | deleteEmail(index, formName) { 112 | this.EMAILLINES(formName).removeAt(index); 113 | } 114 | 115 | PHONELINES(formName) { 116 | return this[formName].get('phones') as FormArray; 117 | } 118 | addPhone(formName) { 119 | this.PHONELINES(formName).push(this._fb.group({ 120 | phonetype: [''], 121 | phone: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]] 122 | })); 123 | } 124 | deletePhone(index, formName) { 125 | this.PHONELINES(formName).removeAt(index); 126 | } 127 | 128 | toggle(filter?) { 129 | if (!filter) { filter = "searchMode" } 130 | else { filter = filter; } 131 | this.toggleField = filter; 132 | this.dataLoading = false; 133 | } 134 | 135 | getData(formData?) { 136 | this.dataLoading = true; 137 | this.querySubscription = this._backendService.getDocs('CALLS', formData).subscribe((res) => { 138 | if (res.length > 0) { 139 | this.dataSource = new MatTableDataSource(res); 140 | this.dataSource.paginator = this.paginator; 141 | this.dataSource.sort = this.sort; 142 | } 143 | }, 144 | (error) => { 145 | this.error = true; 146 | this.errorMessage = error.message; 147 | this.dataLoading = false; 148 | }, 149 | () => { 150 | this.dataLoading = false; 151 | }); 152 | } 153 | 154 | setData(formData) { 155 | this.dataLoading = true; 156 | return this._backendService.setDoc('CALLS', formData, this.authState.uid).then(res => { 157 | if (res) { 158 | this.savedChanges = true; 159 | this.error = false; 160 | this.errorMessage = ""; 161 | this.dataLoading = false; 162 | } 163 | } 164 | ).catch(err => { 165 | if (err) { 166 | this.error = true; 167 | this.errorMessage = err.message; 168 | this.dataLoading = false; 169 | } 170 | } 171 | ); 172 | } 173 | 174 | updateData(formData) { 175 | this.dataLoading = true; 176 | this.querySubscription = this._backendService.updateDoc('CALLS', formData._id, formData).then(res => { 177 | if (res) { 178 | this.savedChanges = true; 179 | this.error = false; 180 | this.errorMessage = ""; 181 | this.dataLoading = false; 182 | } 183 | } 184 | ).catch(err => { 185 | if (err) { 186 | this.error = true; 187 | this.errorMessage = err.message; 188 | this.dataLoading = false; 189 | } 190 | }); 191 | } 192 | 193 | getDoc(docId) { 194 | this.docId = docId; // this is required to pass at file upload directive 195 | this.dataLoading = true; 196 | this.data$ = this._backendService.getDoc('CALLS', docId).subscribe(res => { 197 | if (res) { 198 | this.data$ = res; 199 | this.editDataForm = this._fb.group({ 200 | _id: ['', Validators.required], 201 | name: ['', [Validators.minLength(2), Validators.required]], 202 | phone: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 203 | contacttype: ['', [Validators.required]], 204 | purpose: ['',Validators.required], 205 | addresses: this._fb.array([]), 206 | emails: this._fb.array([]), 207 | phones: this._fb.array([]) 208 | }); 209 | this.editDataForm.patchValue(this.data$); 210 | for (let i = 0; i < this.data$["addresses"].length; i++) { 211 | this.ADDRESSLINES('editDataForm').push(this._fb.group(this.data$["addresses"][i])); 212 | } 213 | for (let i = 0; i < this.data$["emails"].length; i++) { 214 | this.EMAILLINES('editDataForm').push(this._fb.group(this.data$["emails"][i])); 215 | } 216 | for (let i = 0; i < this.data$["phones"].length; i++) { 217 | this.PHONELINES('editDataForm').push(this._fb.group(this.data$["phones"][i])); 218 | } 219 | this.toggle('editMode'); 220 | this.dataLoading = false; 221 | } 222 | }, 223 | (error) => { 224 | this.error = true; 225 | this.errorMessage = error.message; 226 | this.dataLoading = false; 227 | }, 228 | () => { 229 | this.dataLoading = false; 230 | }); 231 | } 232 | 233 | deleteDoc(docId) { 234 | if (confirm("Are you sure want to delete this record ?")) { 235 | this.dataLoading = true; 236 | this._backendService.deleteDoc('CALLS', docId).then(res => { 237 | if (res) { 238 | this.error = false; 239 | this.errorMessage = ""; 240 | this.dataLoading = false; 241 | } 242 | } 243 | ).catch(err => { 244 | if (err) { 245 | this.error = true; 246 | this.errorMessage = err.message; 247 | this.dataLoading = false; 248 | } 249 | } 250 | ); 251 | } 252 | } 253 | getDocUrl(docUrl) { 254 | this.fileName = docUrl; 255 | this.docUrl = this._backendService.getFileDownloadUrl(docUrl); 256 | } 257 | //mat table paginator and filter functions 258 | ngAfterViewInit() { 259 | this.dataSource.paginator = this.paginator; 260 | this.dataSource.sort = this.sort; 261 | } 262 | 263 | applyFilter(filterValue: string) { 264 | filterValue = filterValue.trim(); // Remove whitespace 265 | filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches 266 | this.dataSource.filter = filterValue; 267 | } 268 | ngOnDestroy() { 269 | // this is not needed when observable is used, in this case, we are registering user on subscription 270 | if (this.querySubscription) { 271 | this.querySubscription.unsubscribe(); 272 | } 273 | } 274 | } -------------------------------------------------------------------------------- /src/app/ui/helpdesk/appointments.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/ui/helpdesk/appointments.component.css -------------------------------------------------------------------------------- /src/app/ui/helpdesk/appointments.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; 2 | import { moveIn, fallIn } from '../../shared/router.animations'; 3 | import { Observable } from 'rxjs'; 4 | import { DataSource } from '@angular/cdk/collections'; 5 | import { MatTableModule, MatTableDataSource } from '@angular/material/table'; 6 | import { MatPaginator } from '@angular/material/paginator'; 7 | import { MatSort } from '@angular/material/sort'; 8 | import { AngularFireAuth } from '@angular/fire/auth'; 9 | 10 | import { BackendService } from '../../services/backend.service'; 11 | import { FormBuilder, FormGroup, FormArray, FormControl, Validators } from '@angular/forms'; 12 | 13 | @Component({ 14 | selector: 'app-appointments', 15 | templateUrl: './appointments.component.html', 16 | styleUrls: ['./appointments.component.css'], 17 | animations: [moveIn(), fallIn()], 18 | host: { '[@moveIn]': '' } 19 | }) 20 | export class AppointmentsComponent implements OnInit, OnDestroy { 21 | panelOpenState = false; 22 | contacts = ['Personal', 'Customer', 'Manufacturer', 'Vendor', 'Other', 'Campaign', 'Lead', 'Oppurtunity']; 23 | addTypes = ['Home', 'Office', 'Primary', 'Mailing']; 24 | emailTypes = ['Home', 'Office', 'Primary', 'Personal']; 25 | phoneTypes = ['Home', 'Office', 'Primary', 'Personal']; 26 | members: any[]; 27 | dataSource: MatTableDataSource; 28 | myDocData; 29 | data$; 30 | toggleField: string; 31 | state: string = ''; 32 | savedChanges = false; 33 | error: boolean = false; 34 | errorMessage: String = ""; 35 | dataLoading: boolean = false; 36 | private querySubscription; 37 | authState: any = null; 38 | 39 | total_amount = 0; 40 | addDataForm: FormGroup; 41 | editDataForm: FormGroup; 42 | 43 | @ViewChild(MatPaginator) paginator: MatPaginator; 44 | @ViewChild(MatSort) sort: MatSort; 45 | displayedColumns = ['contacttype', 'name', 'phone', '_id']; 46 | // file upload 47 | docId: string; 48 | fileName: string; 49 | showFileUpload: boolean = false; 50 | showDocument: boolean = false; 51 | docUrl: Observable; 52 | userRole$; 53 | 54 | constructor(public afAuth: AngularFireAuth, private _backendService: BackendService, private _fb: FormBuilder) { 55 | this._backendService.userRole$.subscribe(res => this.userRole$ = res); 56 | } 57 | 58 | ngOnInit() { 59 | this.toggleField = "searchMode"; 60 | this.error = false; 61 | this.errorMessage = ""; 62 | this.dataSource = new MatTableDataSource(this.members); 63 | this.addDataForm = this._fb.group({ 64 | name: ['', [Validators.minLength(2), Validators.required]], 65 | phone: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 66 | contacttype: ['', [Validators.required]], 67 | purpose: ['',Validators.required], 68 | appointmentdt: ['',Validators.required], 69 | appointmenttm: ['',Validators.required], 70 | addresses: this._fb.array([]), 71 | emails: this._fb.array([]), 72 | phones: this._fb.array([]) 73 | }); 74 | this.editDataForm = this._fb.group({ 75 | _id: ['', Validators.required], 76 | name: ['', [Validators.minLength(2), Validators.required]], 77 | phone: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 78 | contacttype: ['', [Validators.required]], 79 | purpose: ['',Validators.required], 80 | appointmentdt: ['',Validators.required], 81 | appointmenttm: ['',Validators.required], 82 | addresses: this._fb.array([]), 83 | emails: this._fb.array([]), 84 | phones: this._fb.array([]) 85 | }); 86 | this.afAuth.authState.subscribe(authState => { 87 | this.authState = authState; 88 | }) 89 | } 90 | 91 | ADDRESSLINES(formName) { 92 | return this[formName].get('addresses') as FormArray; 93 | } 94 | 95 | addAddress(formName) { 96 | this.ADDRESSLINES(formName).push(this._fb.group({ 97 | addtype: [''], 98 | address: [''] 99 | })); 100 | } 101 | deleteAddress(index, formName) { 102 | this.ADDRESSLINES(formName).removeAt(index); 103 | } 104 | 105 | EMAILLINES(formName) { 106 | return this[formName].get('emails') as FormArray; 107 | } 108 | 109 | addEmail(formName) { 110 | this.EMAILLINES(formName).push(this._fb.group({ 111 | emailtype: [''], 112 | email: ['', [Validators.email]] 113 | })); 114 | } 115 | deleteEmail(index, formName) { 116 | this.EMAILLINES(formName).removeAt(index); 117 | } 118 | 119 | PHONELINES(formName) { 120 | return this[formName].get('phones') as FormArray; 121 | } 122 | addPhone(formName) { 123 | this.PHONELINES(formName).push(this._fb.group({ 124 | phonetype: [''], 125 | phone: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]] 126 | })); 127 | } 128 | deletePhone(index, formName) { 129 | this.PHONELINES(formName).removeAt(index); 130 | } 131 | 132 | toggle(filter?) { 133 | if (!filter) { filter = "searchMode" } 134 | else { filter = filter; } 135 | this.toggleField = filter; 136 | this.dataLoading = false; 137 | } 138 | 139 | getData(formData?) { 140 | this.dataLoading = true; 141 | this.querySubscription = this._backendService.getDocs('APPOINTMENTS', formData).subscribe((res) => { 142 | if (res.length > 0) { 143 | this.dataSource = new MatTableDataSource(res); 144 | this.dataSource.paginator = this.paginator; 145 | this.dataSource.sort = this.sort; 146 | } 147 | }, 148 | (error) => { 149 | this.error = true; 150 | this.errorMessage = error.message; 151 | this.dataLoading = false; 152 | }, 153 | () => { 154 | this.dataLoading = false; 155 | }); 156 | } 157 | 158 | setData(formData) { 159 | this.dataLoading = true; 160 | return this._backendService.setDoc('APPOINTMENTS', formData, this.authState.uid).then(res => { 161 | if (res) { 162 | this.savedChanges = true; 163 | this.error = false; 164 | this.errorMessage = ""; 165 | this.dataLoading = false; 166 | } 167 | } 168 | ).catch(err => { 169 | if (err) { 170 | this.error = true; 171 | this.errorMessage = err.message; 172 | this.dataLoading = false; 173 | } 174 | } 175 | ); 176 | } 177 | 178 | updateData(formData) { 179 | this.dataLoading = true; 180 | this.querySubscription = this._backendService.updateDoc('APPOINTMENTS', formData._id, formData).then(res => { 181 | if (res) { 182 | this.savedChanges = true; 183 | this.error = false; 184 | this.errorMessage = ""; 185 | this.dataLoading = false; 186 | } 187 | } 188 | ).catch(err => { 189 | if (err) { 190 | this.error = true; 191 | this.errorMessage = err.message; 192 | this.dataLoading = false; 193 | } 194 | }); 195 | } 196 | 197 | getDoc(docId) { 198 | this.docId = docId; // this is required to pass at file upload directive 199 | this.dataLoading = true; 200 | this.data$ = this._backendService.getDoc('APPOINTMENTS', docId).subscribe(res => { 201 | if (res) { 202 | this.data$ = res; 203 | this.editDataForm = this._fb.group({ 204 | _id: ['', Validators.required], 205 | name: ['', [Validators.minLength(2), Validators.required]], 206 | phone: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 207 | contacttype: ['', [Validators.required]], 208 | purpose: ['',Validators.required], 209 | appointmentdt: ['',Validators.required], 210 | appointmenttm: ['',Validators.required], 211 | addresses: this._fb.array([]), 212 | emails: this._fb.array([]), 213 | phones: this._fb.array([]) 214 | }); 215 | this.editDataForm.patchValue(this.data$); 216 | for (let i = 0; i < this.data$["addresses"].length; i++) { 217 | this.ADDRESSLINES('editDataForm').push(this._fb.group(this.data$["addresses"][i])); 218 | } 219 | for (let i = 0; i < this.data$["emails"].length; i++) { 220 | this.EMAILLINES('editDataForm').push(this._fb.group(this.data$["emails"][i])); 221 | } 222 | for (let i = 0; i < this.data$["phones"].length; i++) { 223 | this.PHONELINES('editDataForm').push(this._fb.group(this.data$["phones"][i])); 224 | } 225 | this.toggle('editMode'); 226 | this.dataLoading = false; 227 | } 228 | }, 229 | (error) => { 230 | this.error = true; 231 | this.errorMessage = error.message; 232 | this.dataLoading = false; 233 | }, 234 | () => { 235 | this.dataLoading = false; 236 | }); 237 | } 238 | 239 | deleteDoc(docId) { 240 | if (confirm("Are you sure want to delete this record ?")) { 241 | this.dataLoading = true; 242 | this._backendService.deleteDoc('APPOINTMENTS', docId).then(res => { 243 | if (res) { 244 | this.error = false; 245 | this.errorMessage = ""; 246 | this.dataLoading = false; 247 | } 248 | } 249 | ).catch(err => { 250 | if (err) { 251 | this.error = true; 252 | this.errorMessage = err.message; 253 | this.dataLoading = false; 254 | } 255 | } 256 | ); 257 | } 258 | } 259 | getDocUrl(docUrl) { 260 | this.fileName = docUrl; 261 | this.docUrl = this._backendService.getFileDownloadUrl(docUrl); 262 | } 263 | //mat table paginator and filter functions 264 | ngAfterViewInit() { 265 | this.dataSource.paginator = this.paginator; 266 | this.dataSource.sort = this.sort; 267 | } 268 | 269 | applyFilter(filterValue: string) { 270 | filterValue = filterValue.trim(); // Remove whitespace 271 | filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches 272 | this.dataSource.filter = filterValue; 273 | } 274 | ngOnDestroy() { 275 | // this is not needed when observable is used, in this case, we are registering user on subscription 276 | if (this.querySubscription) { 277 | this.querySubscription.unsubscribe(); 278 | } 279 | } 280 | } -------------------------------------------------------------------------------- /src/app/ui/helpdesk/tickets.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/ui/helpdesk/tickets.component.css -------------------------------------------------------------------------------- /src/app/ui/helpdesk/tickets.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; 2 | import { moveIn, fallIn } from '../../shared/router.animations'; 3 | import { Observable } from 'rxjs'; 4 | import { DataSource } from '@angular/cdk/collections'; 5 | import { MatTableModule, MatTableDataSource } from '@angular/material/table'; 6 | import { MatPaginator } from '@angular/material/paginator'; 7 | import { MatSort } from '@angular/material/sort'; 8 | import { AngularFireAuth } from '@angular/fire/auth'; 9 | 10 | import { BackendService } from '../../services/backend.service'; 11 | import { FormBuilder, FormGroup, FormArray, FormControl, Validators } from '@angular/forms'; 12 | 13 | @Component({ 14 | selector: 'app-tickets', 15 | templateUrl: './tickets.component.html', 16 | styleUrls: ['./tickets.component.css'], 17 | animations: [moveIn(), fallIn()], 18 | host: { '[@moveIn]': '' } 19 | }) 20 | export class TicketsComponent implements OnInit, OnDestroy { 21 | panelOpenState = false; 22 | contacts = ['Personal', 'Customer', 'Manufacturer', 'Vendor', 'Other', 'Campaign', 'Lead', 'Oppurtunity']; 23 | addTypes = ['Home', 'Office', 'Primary', 'Mailing']; 24 | assignedTypes = ['Home', 'Office', 'Primary', 'Personal']; 25 | expenseTypes = ['Home', 'Office', 'Primary', 'Personal']; 26 | statuses = ['Open', 'In Progress', 'Hold', 'Closed']; 27 | members: any[]; 28 | dataSource: MatTableDataSource; 29 | myDocData; 30 | data$; 31 | toggleField: string; 32 | state: string = ''; 33 | savedChanges = false; 34 | error: boolean = false; 35 | errorMessage: String = ""; 36 | dataLoading: boolean = false; 37 | private querySubscription; 38 | authState: any = null; 39 | 40 | total_amount = 0; 41 | addDataForm: FormGroup; 42 | editDataForm: FormGroup; 43 | 44 | @ViewChild(MatPaginator) paginator: MatPaginator; 45 | @ViewChild(MatSort) sort: MatSort; 46 | displayedColumns = ['campaignType', 'name', 'campaignID', '_id']; 47 | // file upload 48 | docId: string; 49 | fileName: string; 50 | showFileUpload: boolean = false; 51 | showDocument: boolean = false; 52 | docUrl: Observable; 53 | userRole$; 54 | 55 | constructor(public afAuth: AngularFireAuth, private _backendService: BackendService, private _fb: FormBuilder) { 56 | this._backendService.userRole$.subscribe(res => this.userRole$ = res); 57 | } 58 | 59 | ngOnInit() { 60 | this.toggleField = "searchMode"; 61 | this.error = false; 62 | this.errorMessage = ""; 63 | this.dataSource = new MatTableDataSource(this.members); 64 | this.addDataForm = this._fb.group({ 65 | name: ['', [Validators.minLength(2), Validators.required]], 66 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 67 | campaignType: ['', [Validators.required]], 68 | startDt: ['', [Validators.required]], 69 | endDt: ['', [Validators.required]], 70 | status: ['', [Validators.required]], 71 | purpose: ['',Validators.required], 72 | addresses: this._fb.array([]), 73 | assigned: this._fb.array([]), 74 | expenses: this._fb.array([]) 75 | }); 76 | this.editDataForm = this._fb.group({ 77 | _id: ['', Validators.required], 78 | name: ['', [Validators.minLength(2), Validators.required]], 79 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 80 | campaignType: ['', [Validators.required]], 81 | startDt: ['', [Validators.required]], 82 | endDt: ['', [Validators.required]], 83 | status: ['', [Validators.required]], 84 | purpose: ['',Validators.required], 85 | addresses: this._fb.array([]), 86 | assigned: this._fb.array([]), 87 | expenses: this._fb.array([]) 88 | }); 89 | this.afAuth.authState.subscribe(authState => { 90 | this.authState = authState; 91 | }) 92 | } 93 | 94 | ADDRESSLINES(formName) { 95 | return this[formName].get('addresses') as FormArray; 96 | } 97 | 98 | addAddress(formName) { 99 | this.ADDRESSLINES(formName).push(this._fb.group({ 100 | addtype: [''], 101 | address: [''] 102 | })); 103 | } 104 | deleteAddress(index, formName) { 105 | this.ADDRESSLINES(formName).removeAt(index); 106 | } 107 | 108 | ASSIGNEDLINES(formName) { 109 | return this[formName].get('assigned') as FormArray; 110 | } 111 | 112 | addAssigned(formName) { 113 | this.ASSIGNEDLINES(formName).push(this._fb.group({ 114 | assignedtype: [''], 115 | assigned: [''] 116 | })); 117 | } 118 | deleteAssigned(index, formName) { 119 | this.ASSIGNEDLINES(formName).removeAt(index); 120 | } 121 | 122 | EXPENSESLINES(formName) { 123 | return this[formName].get('expenses') as FormArray; 124 | } 125 | addExpenses(formName) { 126 | this.EXPENSESLINES(formName).push(this._fb.group({ 127 | expensestype: [''], 128 | expenses: ['', [Validators.minLength(1)]] 129 | })); 130 | } 131 | deleteExpenses(index, formName) { 132 | this.EXPENSESLINES(formName).removeAt(index); 133 | } 134 | 135 | toggle(filter?) { 136 | if (!filter) { filter = "searchMode" } 137 | else { filter = filter; } 138 | this.toggleField = filter; 139 | this.dataLoading = false; 140 | } 141 | 142 | getData(formData?) { 143 | this.dataLoading = true; 144 | this.querySubscription = this._backendService.getDocs('TICKETS', formData).subscribe((res) => { 145 | if (res.length > 0) { 146 | this.dataSource = new MatTableDataSource(res); 147 | this.dataSource.paginator = this.paginator; 148 | this.dataSource.sort = this.sort; 149 | } 150 | }, 151 | (error) => { 152 | this.error = true; 153 | this.errorMessage = error.message; 154 | this.dataLoading = false; 155 | }, 156 | () => { 157 | this.dataLoading = false; 158 | }); 159 | } 160 | 161 | setData(formData) { 162 | this.dataLoading = true; 163 | return this._backendService.setDoc('TICKETS', formData, this.authState.uid).then(res => { 164 | if (res) { 165 | this.savedChanges = true; 166 | this.error = false; 167 | this.errorMessage = ""; 168 | this.dataLoading = false; 169 | } 170 | } 171 | ).catch(err => { 172 | if (err) { 173 | this.error = true; 174 | this.errorMessage = err.message; 175 | this.dataLoading = false; 176 | } 177 | } 178 | ); 179 | } 180 | 181 | updateData(formData) { 182 | this.dataLoading = true; 183 | this.querySubscription = this._backendService.updateDoc('TICKETS', formData._id, formData).then(res => { 184 | if (res) { 185 | this.savedChanges = true; 186 | this.error = false; 187 | this.errorMessage = ""; 188 | this.dataLoading = false; 189 | } 190 | } 191 | ).catch(err => { 192 | if (err) { 193 | this.error = true; 194 | this.errorMessage = err.message; 195 | this.dataLoading = false; 196 | } 197 | }); 198 | } 199 | 200 | getDoc(docId) { 201 | this.docId = docId; // this is required to pass at file upload directive 202 | this.dataLoading = true; 203 | this.data$ = this._backendService.getDoc('TICKETS', docId).subscribe(res => { 204 | if (res) { 205 | this.data$ = res; 206 | this.editDataForm = this._fb.group({ 207 | _id: ['', Validators.required], 208 | name: ['', [Validators.minLength(2), Validators.required]], 209 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 210 | campaignType: ['', [Validators.required]], 211 | startDt: ['', [Validators.required]], 212 | endDt: ['', [Validators.required]], 213 | status: ['', [Validators.required]], 214 | purpose: ['',Validators.required], 215 | addresses: this._fb.array([]), 216 | assigned: this._fb.array([]), 217 | expenses: this._fb.array([]) 218 | }); 219 | this.editDataForm.patchValue(this.data$); 220 | for (let i = 0; i < this.data$["addresses"].length; i++) { 221 | this.ADDRESSLINES('editDataForm').push(this._fb.group(this.data$["addresses"][i])); 222 | } 223 | for (let i = 0; i < this.data$["assigned"].length; i++) { 224 | this.ASSIGNEDLINES('editDataForm').push(this._fb.group(this.data$["assigned"][i])); 225 | } 226 | for (let i = 0; i < this.data$["expenses"].length; i++) { 227 | this.EXPENSESLINES('editDataForm').push(this._fb.group(this.data$["expenses"][i])); 228 | } 229 | this.toggle('editMode'); 230 | this.dataLoading = false; 231 | } 232 | }, 233 | (error) => { 234 | this.error = true; 235 | this.errorMessage = error.message; 236 | this.dataLoading = false; 237 | }, 238 | () => { 239 | this.dataLoading = false; 240 | }); 241 | } 242 | 243 | deleteDoc(docId) { 244 | if (confirm("Are you sure want to delete this record ?")) { 245 | this.dataLoading = true; 246 | this._backendService.deleteDoc('TICKETS', docId).then(res => { 247 | if (res) { 248 | this.error = false; 249 | this.errorMessage = ""; 250 | this.dataLoading = false; 251 | } 252 | } 253 | ).catch(err => { 254 | if (err) { 255 | this.error = true; 256 | this.errorMessage = err.message; 257 | this.dataLoading = false; 258 | } 259 | } 260 | ); 261 | } 262 | } 263 | getDocUrl(docUrl) { 264 | this.fileName = docUrl; 265 | this.docUrl = this._backendService.getFileDownloadUrl(docUrl); 266 | } 267 | //mat table paginator and filter functions 268 | ngAfterViewInit() { 269 | this.dataSource.paginator = this.paginator; 270 | this.dataSource.sort = this.sort; 271 | } 272 | 273 | applyFilter(filterValue: string) { 274 | filterValue = filterValue.trim(); // Remove whitespace 275 | filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches 276 | this.dataSource.filter = filterValue; 277 | } 278 | ngOnDestroy() { 279 | // this is not needed when observable is used, in this case, we are registering user on subscription 280 | if (this.querySubscription) { 281 | this.querySubscription.unsubscribe(); 282 | } 283 | } 284 | } -------------------------------------------------------------------------------- /src/app/ui/helpdesk/workorders.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/ui/helpdesk/workorders.component.css -------------------------------------------------------------------------------- /src/app/ui/market/campaign.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/ui/market/campaign.component.css -------------------------------------------------------------------------------- /src/app/ui/market/campaign.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; 2 | import { moveIn, fallIn } from '../../shared/router.animations'; 3 | import { Observable } from 'rxjs'; 4 | import { DataSource } from '@angular/cdk/collections'; 5 | import { MatTableModule, MatTableDataSource } from '@angular/material/table'; 6 | import { MatPaginator } from '@angular/material/paginator'; 7 | import { MatSort } from '@angular/material/sort'; 8 | import { AngularFireAuth } from '@angular/fire/auth'; 9 | 10 | import { BackendService } from '../../services/backend.service'; 11 | import { FormBuilder, FormGroup, FormArray, FormControl, Validators } from '@angular/forms'; 12 | 13 | @Component({ 14 | selector: 'app-campaign', 15 | templateUrl: './campaign.component.html', 16 | styleUrls: ['./campaign.component.css'], 17 | animations: [moveIn(), fallIn()], 18 | host: { '[@moveIn]': '' } 19 | }) 20 | export class CampaignComponent implements OnInit, OnDestroy { 21 | panelOpenState = false; 22 | contacts = ['Personal', 'Customer', 'Manufacturer', 'Vendor', 'Other', 'Campaign', 'Lead', 'Oppurtunity']; 23 | addTypes = ['Home', 'Office', 'Primary', 'Mailing']; 24 | assignedTypes = ['Home', 'Office', 'Primary', 'Personal']; 25 | expenseTypes = ['Home', 'Office', 'Primary', 'Personal']; 26 | statuses = ['Open', 'In Progress', 'Hold', 'Closed']; 27 | members: any[]; 28 | dataSource: MatTableDataSource; 29 | myDocData; 30 | data$; 31 | toggleField: string; 32 | state: string = ''; 33 | savedChanges = false; 34 | error: boolean = false; 35 | errorMessage: String = ""; 36 | dataLoading: boolean = false; 37 | private querySubscription; 38 | authState: any = null; 39 | 40 | total_amount = 0; 41 | addDataForm: FormGroup; 42 | editDataForm: FormGroup; 43 | 44 | @ViewChild(MatPaginator) paginator: MatPaginator; 45 | @ViewChild(MatSort) sort: MatSort; 46 | displayedColumns = ['campaignType', 'name', 'campaignID', '_id']; 47 | // file upload 48 | docId: string; 49 | fileName: string; 50 | showFileUpload: boolean = false; 51 | showDocument: boolean = false; 52 | docUrl: Observable; 53 | userRole$; 54 | 55 | constructor(public afAuth: AngularFireAuth, private _backendService: BackendService, private _fb: FormBuilder) { 56 | this._backendService.userRole$.subscribe(res => this.userRole$ = res); 57 | } 58 | 59 | ngOnInit() { 60 | this.toggleField = "searchMode"; 61 | this.error = false; 62 | this.errorMessage = ""; 63 | this.dataSource = new MatTableDataSource(this.members); 64 | this.addDataForm = this._fb.group({ 65 | name: ['', [Validators.minLength(2), Validators.required]], 66 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 67 | campaignType: ['', [Validators.required]], 68 | startDt: ['', [Validators.required]], 69 | endDt: ['', [Validators.required]], 70 | status: ['', [Validators.required]], 71 | addresses: this._fb.array([]), 72 | assigned: this._fb.array([]), 73 | expenses: this._fb.array([]) 74 | }); 75 | this.editDataForm = this._fb.group({ 76 | _id: ['', Validators.required], 77 | name: ['', [Validators.minLength(2), Validators.required]], 78 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 79 | campaignType: ['', [Validators.required]], 80 | startDt: ['', [Validators.required]], 81 | endDt: ['', [Validators.required]], 82 | status: ['', [Validators.required]], 83 | addresses: this._fb.array([]), 84 | assigned: this._fb.array([]), 85 | expenses: this._fb.array([]) 86 | }); 87 | this.afAuth.authState.subscribe(authState => { 88 | this.authState = authState; 89 | }) 90 | } 91 | 92 | ADDRESSLINES(formName) { 93 | return this[formName].get('addresses') as FormArray; 94 | } 95 | 96 | addAddress(formName) { 97 | this.ADDRESSLINES(formName).push(this._fb.group({ 98 | addtype: [''], 99 | address: [''] 100 | })); 101 | } 102 | deleteAddress(index, formName) { 103 | this.ADDRESSLINES(formName).removeAt(index); 104 | } 105 | 106 | ASSIGNEDLINES(formName) { 107 | return this[formName].get('assigned') as FormArray; 108 | } 109 | 110 | addAssigned(formName) { 111 | this.ASSIGNEDLINES(formName).push(this._fb.group({ 112 | assignedtype: [''], 113 | assigned: [''] 114 | })); 115 | } 116 | deleteAssigned(index, formName) { 117 | this.ASSIGNEDLINES(formName).removeAt(index); 118 | } 119 | 120 | EXPENSESLINES(formName) { 121 | return this[formName].get('expenses') as FormArray; 122 | } 123 | addExpenses(formName) { 124 | this.EXPENSESLINES(formName).push(this._fb.group({ 125 | expensestype: [''], 126 | expenses: ['', [Validators.minLength(1)]] 127 | })); 128 | } 129 | deleteExpenses(index, formName) { 130 | this.EXPENSESLINES(formName).removeAt(index); 131 | } 132 | 133 | toggle(filter?) { 134 | if (!filter) { filter = "searchMode" } 135 | else { filter = filter; } 136 | this.toggleField = filter; 137 | this.dataLoading = false; 138 | } 139 | 140 | getData(formData?) { 141 | this.dataLoading = true; 142 | this.querySubscription = this._backendService.getDocs('CAMPAIGN', formData).subscribe((res) => { 143 | if (res.length > 0) { 144 | this.dataSource = new MatTableDataSource(res); 145 | this.dataSource.paginator = this.paginator; 146 | this.dataSource.sort = this.sort; 147 | } 148 | }, 149 | (error) => { 150 | this.error = true; 151 | this.errorMessage = error.message; 152 | this.dataLoading = false; 153 | }, 154 | () => { 155 | this.dataLoading = false; 156 | }); 157 | } 158 | 159 | setData(formData) { 160 | this.dataLoading = true; 161 | return this._backendService.setDoc('CAMPAIGN', formData, this.authState.uid).then(res => { 162 | if (res) { 163 | this.savedChanges = true; 164 | this.error = false; 165 | this.errorMessage = ""; 166 | this.dataLoading = false; 167 | } 168 | } 169 | ).catch(err => { 170 | if (err) { 171 | this.error = true; 172 | this.errorMessage = err.message; 173 | this.dataLoading = false; 174 | } 175 | } 176 | ); 177 | } 178 | 179 | updateData(formData) { 180 | this.dataLoading = true; 181 | this.querySubscription = this._backendService.updateDoc('CAMPAIGN', formData._id, formData).then(res => { 182 | if (res) { 183 | this.savedChanges = true; 184 | this.error = false; 185 | this.errorMessage = ""; 186 | this.dataLoading = false; 187 | } 188 | } 189 | ).catch(err => { 190 | if (err) { 191 | this.error = true; 192 | this.errorMessage = err.message; 193 | this.dataLoading = false; 194 | } 195 | }); 196 | } 197 | 198 | getDoc(docId) { 199 | this.docId = docId; // this is required to pass at file upload directive 200 | this.dataLoading = true; 201 | this.data$ = this._backendService.getDoc('CAMPAIGN', docId).subscribe(res => { 202 | if (res) { 203 | this.data$ = res; 204 | this.editDataForm = this._fb.group({ 205 | _id: ['', Validators.required], 206 | name: ['', [Validators.minLength(2), Validators.required]], 207 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 208 | campaignType: ['', [Validators.required]], 209 | startDt: ['', [Validators.required]], 210 | endDt: ['', [Validators.required]], 211 | status: ['', [Validators.required]], 212 | addresses: this._fb.array([]), 213 | assigned: this._fb.array([]), 214 | expenses: this._fb.array([]) 215 | }); 216 | this.editDataForm.patchValue(this.data$); 217 | for (let i = 0; i < this.data$["addresses"].length; i++) { 218 | this.ADDRESSLINES('editDataForm').push(this._fb.group(this.data$["addresses"][i])); 219 | } 220 | for (let i = 0; i < this.data$["assigned"].length; i++) { 221 | this.ASSIGNEDLINES('editDataForm').push(this._fb.group(this.data$["assigned"][i])); 222 | } 223 | for (let i = 0; i < this.data$["expenses"].length; i++) { 224 | this.EXPENSESLINES('editDataForm').push(this._fb.group(this.data$["expenses"][i])); 225 | } 226 | this.toggle('editMode'); 227 | this.dataLoading = false; 228 | } 229 | }, 230 | (error) => { 231 | this.error = true; 232 | this.errorMessage = error.message; 233 | this.dataLoading = false; 234 | }, 235 | () => { 236 | this.dataLoading = false; 237 | }); 238 | } 239 | 240 | deleteDoc(docId) { 241 | if (confirm("Are you sure want to delete this record ?")) { 242 | this.dataLoading = true; 243 | this._backendService.deleteDoc('CAMPAIGN', docId).then(res => { 244 | if (res) { 245 | this.error = false; 246 | this.errorMessage = ""; 247 | this.dataLoading = false; 248 | } 249 | } 250 | ).catch(err => { 251 | if (err) { 252 | this.error = true; 253 | this.errorMessage = err.message; 254 | this.dataLoading = false; 255 | } 256 | } 257 | ); 258 | } 259 | } 260 | getDocUrl(docUrl) { 261 | this.fileName = docUrl; 262 | this.docUrl = this._backendService.getFileDownloadUrl(docUrl); 263 | } 264 | //mat table paginator and filter functions 265 | ngAfterViewInit() { 266 | this.dataSource.paginator = this.paginator; 267 | this.dataSource.sort = this.sort; 268 | } 269 | 270 | applyFilter(filterValue: string) { 271 | filterValue = filterValue.trim(); // Remove whitespace 272 | filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches 273 | this.dataSource.filter = filterValue; 274 | } 275 | ngOnDestroy() { 276 | // this is not needed when observable is used, in this case, we are registering user on subscription 277 | if (this.querySubscription) { 278 | this.querySubscription.unsubscribe(); 279 | } 280 | } 281 | } -------------------------------------------------------------------------------- /src/app/ui/market/lead.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/ui/market/lead.component.css -------------------------------------------------------------------------------- /src/app/ui/market/lead.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; 2 | import { moveIn, fallIn } from '../../shared/router.animations'; 3 | import { Observable } from 'rxjs'; 4 | import { DataSource } from '@angular/cdk/collections'; 5 | import { MatTableModule, MatTableDataSource } from '@angular/material/table'; 6 | import { MatPaginator } from '@angular/material/paginator'; 7 | import { MatSort } from '@angular/material/sort'; 8 | import { AngularFireAuth } from '@angular/fire/auth'; 9 | 10 | import { BackendService } from '../../services/backend.service'; 11 | import { FormBuilder, FormGroup, FormArray, FormControl, Validators } from '@angular/forms'; 12 | 13 | @Component({ 14 | selector: 'app-lead', 15 | templateUrl: './lead.component.html', 16 | styleUrls: ['./lead.component.css'], 17 | animations: [moveIn(), fallIn()], 18 | host: { '[@moveIn]': '' } 19 | }) 20 | export class LeadComponent implements OnInit, OnDestroy { 21 | panelOpenState = false; 22 | contacts = ['Personal', 'Customer', 'Manufacturer', 'Vendor', 'Other', 'Campaign', 'Lead', 'Oppurtunity']; 23 | addTypes = ['Home', 'Office', 'Primary', 'Mailing']; 24 | assignedTypes = ['Home', 'Office', 'Primary', 'Personal']; 25 | expenseTypes = ['Home', 'Office', 'Primary', 'Personal']; 26 | statuses = ['Open', 'In Progress', 'Hold', 'Closed']; 27 | members: any[]; 28 | dataSource: MatTableDataSource; 29 | myDocData; 30 | data$; 31 | toggleField: string; 32 | state: string = ''; 33 | savedChanges = false; 34 | error: boolean = false; 35 | errorMessage: String = ""; 36 | dataLoading: boolean = false; 37 | private querySubscription; 38 | authState: any = null; 39 | 40 | total_amount = 0; 41 | addDataForm: FormGroup; 42 | editDataForm: FormGroup; 43 | 44 | @ViewChild(MatPaginator) paginator: MatPaginator; 45 | @ViewChild(MatSort) sort: MatSort; 46 | displayedColumns = ['campaignType', 'name', 'campaignID', '_id']; 47 | // file upload 48 | docId: string; 49 | fileName: string; 50 | showFileUpload: boolean = false; 51 | showDocument: boolean = false; 52 | docUrl: Observable; 53 | userRole$; 54 | 55 | constructor(public afAuth: AngularFireAuth, private _backendService: BackendService, private _fb: FormBuilder) { 56 | this._backendService.userRole$.subscribe(res => this.userRole$ = res); 57 | } 58 | 59 | ngOnInit() { 60 | this.toggleField = "searchMode"; 61 | this.error = false; 62 | this.errorMessage = ""; 63 | this.dataSource = new MatTableDataSource(this.members); 64 | this.addDataForm = this._fb.group({ 65 | name: ['', [Validators.minLength(2), Validators.required]], 66 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 67 | campaignType: ['', [Validators.required]], 68 | startDt: ['', [Validators.required]], 69 | endDt: ['', [Validators.required]], 70 | status: ['', [Validators.required]], 71 | addresses: this._fb.array([]), 72 | assigned: this._fb.array([]), 73 | expenses: this._fb.array([]) 74 | }); 75 | this.editDataForm = this._fb.group({ 76 | _id: ['', Validators.required], 77 | name: ['', [Validators.minLength(2), Validators.required]], 78 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 79 | campaignType: ['', [Validators.required]], 80 | startDt: ['', [Validators.required]], 81 | endDt: ['', [Validators.required]], 82 | status: ['', [Validators.required]], 83 | addresses: this._fb.array([]), 84 | assigned: this._fb.array([]), 85 | expenses: this._fb.array([]) 86 | }); 87 | this.afAuth.authState.subscribe(authState => { 88 | this.authState = authState; 89 | }) 90 | } 91 | 92 | ADDRESSLINES(formName) { 93 | return this[formName].get('addresses') as FormArray; 94 | } 95 | 96 | addAddress(formName) { 97 | this.ADDRESSLINES(formName).push(this._fb.group({ 98 | addtype: [''], 99 | address: [''] 100 | })); 101 | } 102 | deleteAddress(index, formName) { 103 | this.ADDRESSLINES(formName).removeAt(index); 104 | } 105 | 106 | ASSIGNEDLINES(formName) { 107 | return this[formName].get('assigned') as FormArray; 108 | } 109 | 110 | addAssigned(formName) { 111 | this.ASSIGNEDLINES(formName).push(this._fb.group({ 112 | assignedtype: [''], 113 | assigned: [''] 114 | })); 115 | } 116 | deleteAssigned(index, formName) { 117 | this.ASSIGNEDLINES(formName).removeAt(index); 118 | } 119 | 120 | EXPENSESLINES(formName) { 121 | return this[formName].get('expenses') as FormArray; 122 | } 123 | addExpenses(formName) { 124 | this.EXPENSESLINES(formName).push(this._fb.group({ 125 | expensestype: [''], 126 | expenses: ['', [Validators.minLength(1)]] 127 | })); 128 | } 129 | deleteExpenses(index, formName) { 130 | this.EXPENSESLINES(formName).removeAt(index); 131 | } 132 | 133 | toggle(filter?) { 134 | if (!filter) { filter = "searchMode" } 135 | else { filter = filter; } 136 | this.toggleField = filter; 137 | this.dataLoading = false; 138 | } 139 | 140 | getData(formData?) { 141 | this.dataLoading = true; 142 | this.querySubscription = this._backendService.getDocs('LEADS', formData).subscribe((res) => { 143 | if (res.length > 0) { 144 | this.dataSource = new MatTableDataSource(res); 145 | this.dataSource.paginator = this.paginator; 146 | this.dataSource.sort = this.sort; 147 | } 148 | }, 149 | (error) => { 150 | this.error = true; 151 | this.errorMessage = error.message; 152 | this.dataLoading = false; 153 | }, 154 | () => { 155 | this.dataLoading = false; 156 | }); 157 | } 158 | 159 | setData(formData) { 160 | this.dataLoading = true; 161 | return this._backendService.setDoc('LEADS', formData, this.authState.uid).then(res => { 162 | if (res) { 163 | this.savedChanges = true; 164 | this.error = false; 165 | this.errorMessage = ""; 166 | this.dataLoading = false; 167 | } 168 | } 169 | ).catch(err => { 170 | if (err) { 171 | this.error = true; 172 | this.errorMessage = err.message; 173 | this.dataLoading = false; 174 | } 175 | } 176 | ); 177 | } 178 | 179 | updateData(formData) { 180 | this.dataLoading = true; 181 | this.querySubscription = this._backendService.updateDoc('LEADS', formData._id, formData).then(res => { 182 | if (res) { 183 | this.savedChanges = true; 184 | this.error = false; 185 | this.errorMessage = ""; 186 | this.dataLoading = false; 187 | } 188 | } 189 | ).catch(err => { 190 | if (err) { 191 | this.error = true; 192 | this.errorMessage = err.message; 193 | this.dataLoading = false; 194 | } 195 | }); 196 | } 197 | 198 | getDoc(docId) { 199 | this.docId = docId; // this is required to pass at file upload directive 200 | this.dataLoading = true; 201 | this.data$ = this._backendService.getDoc('LEADS', docId).subscribe(res => { 202 | if (res) { 203 | this.data$ = res; 204 | this.editDataForm = this._fb.group({ 205 | _id: ['', Validators.required], 206 | name: ['', [Validators.minLength(2), Validators.required]], 207 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 208 | campaignType: ['', [Validators.required]], 209 | startDt: ['', [Validators.required]], 210 | endDt: ['', [Validators.required]], 211 | status: ['', [Validators.required]], 212 | addresses: this._fb.array([]), 213 | assigned: this._fb.array([]), 214 | expenses: this._fb.array([]) 215 | }); 216 | this.editDataForm.patchValue(this.data$); 217 | for (let i = 0; i < this.data$["addresses"].length; i++) { 218 | this.ADDRESSLINES('editDataForm').push(this._fb.group(this.data$["addresses"][i])); 219 | } 220 | for (let i = 0; i < this.data$["assigned"].length; i++) { 221 | this.ASSIGNEDLINES('editDataForm').push(this._fb.group(this.data$["assigned"][i])); 222 | } 223 | for (let i = 0; i < this.data$["expenses"].length; i++) { 224 | this.EXPENSESLINES('editDataForm').push(this._fb.group(this.data$["expenses"][i])); 225 | } 226 | this.toggle('editMode'); 227 | this.dataLoading = false; 228 | } 229 | }, 230 | (error) => { 231 | this.error = true; 232 | this.errorMessage = error.message; 233 | this.dataLoading = false; 234 | }, 235 | () => { 236 | this.dataLoading = false; 237 | }); 238 | } 239 | 240 | deleteDoc(docId) { 241 | if (confirm("Are you sure want to delete this record ?")) { 242 | this.dataLoading = true; 243 | this._backendService.deleteDoc('LEADS', docId).then(res => { 244 | if (res) { 245 | this.error = false; 246 | this.errorMessage = ""; 247 | this.dataLoading = false; 248 | } 249 | } 250 | ).catch(err => { 251 | if (err) { 252 | this.error = true; 253 | this.errorMessage = err.message; 254 | this.dataLoading = false; 255 | } 256 | } 257 | ); 258 | } 259 | } 260 | getDocUrl(docUrl) { 261 | this.fileName = docUrl; 262 | this.docUrl = this._backendService.getFileDownloadUrl(docUrl); 263 | } 264 | //mat table paginator and filter functions 265 | ngAfterViewInit() { 266 | this.dataSource.paginator = this.paginator; 267 | this.dataSource.sort = this.sort; 268 | } 269 | 270 | applyFilter(filterValue: string) { 271 | filterValue = filterValue.trim(); // Remove whitespace 272 | filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches 273 | this.dataSource.filter = filterValue; 274 | } 275 | ngOnDestroy() { 276 | // this is not needed when observable is used, in this case, we are registering user on subscription 277 | if (this.querySubscription) { 278 | this.querySubscription.unsubscribe(); 279 | } 280 | } 281 | } -------------------------------------------------------------------------------- /src/app/ui/market/opportunity.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/ui/market/opportunity.component.css -------------------------------------------------------------------------------- /src/app/ui/market/opportunity.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; 2 | import { moveIn, fallIn } from '../../shared/router.animations'; 3 | import { Observable } from 'rxjs'; 4 | import { DataSource } from '@angular/cdk/collections'; 5 | import { MatTableModule, MatTableDataSource } from '@angular/material/table'; 6 | import { MatPaginator } from '@angular/material/paginator'; 7 | import { MatSort } from '@angular/material/sort'; 8 | import { AngularFireAuth } from '@angular/fire/auth'; 9 | 10 | import { BackendService } from '../../services/backend.service'; 11 | import { FormBuilder, FormGroup, FormArray, FormControl, Validators } from '@angular/forms'; 12 | 13 | @Component({ 14 | selector: 'app-opportunity', 15 | templateUrl: './opportunity.component.html', 16 | styleUrls: ['./opportunity.component.css'], 17 | animations: [moveIn(), fallIn()], 18 | host: { '[@moveIn]': '' } 19 | }) 20 | export class OpportunityComponent implements OnInit, OnDestroy { 21 | panelOpenState = false; 22 | contacts = ['Personal', 'Customer', 'Manufacturer', 'Vendor', 'Other', 'Campaign', 'Lead', 'Oppurtunity']; 23 | addTypes = ['Home', 'Office', 'Primary', 'Mailing']; 24 | assignedTypes = ['Home', 'Office', 'Primary', 'Personal']; 25 | expenseTypes = ['Home', 'Office', 'Primary', 'Personal']; 26 | statuses = ['Open', 'In Progress', 'Hold', 'Closed']; 27 | members: any[]; 28 | dataSource: MatTableDataSource; 29 | myDocData; 30 | data$; 31 | toggleField: string; 32 | state: string = ''; 33 | savedChanges = false; 34 | error: boolean = false; 35 | errorMessage: String = ""; 36 | dataLoading: boolean = false; 37 | private querySubscription; 38 | authState: any = null; 39 | 40 | total_amount = 0; 41 | addDataForm: FormGroup; 42 | editDataForm: FormGroup; 43 | 44 | @ViewChild(MatPaginator) paginator: MatPaginator; 45 | @ViewChild(MatSort) sort: MatSort; 46 | displayedColumns = ['campaignType', 'name', 'campaignID', '_id']; 47 | // file upload 48 | docId: string; 49 | fileName: string; 50 | showFileUpload: boolean = false; 51 | showDocument: boolean = false; 52 | docUrl: Observable; 53 | userRole$; 54 | 55 | constructor(public afAuth: AngularFireAuth, private _backendService: BackendService, private _fb: FormBuilder) { 56 | this._backendService.userRole$.subscribe(res => this.userRole$ = res); 57 | } 58 | 59 | ngOnInit() { 60 | this.toggleField = "searchMode"; 61 | this.error = false; 62 | this.errorMessage = ""; 63 | this.dataSource = new MatTableDataSource(this.members); 64 | this.addDataForm = this._fb.group({ 65 | name: ['', [Validators.minLength(2), Validators.required]], 66 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 67 | campaignType: ['', [Validators.required]], 68 | startDt: ['', [Validators.required]], 69 | endDt: ['', [Validators.required]], 70 | status: ['', [Validators.required]], 71 | addresses: this._fb.array([]), 72 | assigned: this._fb.array([]), 73 | expenses: this._fb.array([]) 74 | }); 75 | this.editDataForm = this._fb.group({ 76 | _id: ['', Validators.required], 77 | name: ['', [Validators.minLength(2), Validators.required]], 78 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 79 | campaignType: ['', [Validators.required]], 80 | startDt: ['', [Validators.required]], 81 | endDt: ['', [Validators.required]], 82 | status: ['', [Validators.required]], 83 | addresses: this._fb.array([]), 84 | assigned: this._fb.array([]), 85 | expenses: this._fb.array([]) 86 | }); 87 | this.afAuth.authState.subscribe(authState => { 88 | this.authState = authState; 89 | }) 90 | } 91 | 92 | ADDRESSLINES(formName) { 93 | return this[formName].get('addresses') as FormArray; 94 | } 95 | 96 | addAddress(formName) { 97 | this.ADDRESSLINES(formName).push(this._fb.group({ 98 | addtype: [''], 99 | address: [''] 100 | })); 101 | } 102 | deleteAddress(index, formName) { 103 | this.ADDRESSLINES(formName).removeAt(index); 104 | } 105 | 106 | ASSIGNEDLINES(formName) { 107 | return this[formName].get('assigned') as FormArray; 108 | } 109 | 110 | addAssigned(formName) { 111 | this.ASSIGNEDLINES(formName).push(this._fb.group({ 112 | assignedtype: [''], 113 | assigned: [''] 114 | })); 115 | } 116 | deleteAssigned(index, formName) { 117 | this.ASSIGNEDLINES(formName).removeAt(index); 118 | } 119 | 120 | EXPENSESLINES(formName) { 121 | return this[formName].get('expenses') as FormArray; 122 | } 123 | addExpenses(formName) { 124 | this.EXPENSESLINES(formName).push(this._fb.group({ 125 | expensestype: [''], 126 | expenses: ['', [Validators.minLength(1)]] 127 | })); 128 | } 129 | deleteExpenses(index, formName) { 130 | this.EXPENSESLINES(formName).removeAt(index); 131 | } 132 | 133 | toggle(filter?) { 134 | if (!filter) { filter = "searchMode" } 135 | else { filter = filter; } 136 | this.toggleField = filter; 137 | this.dataLoading = false; 138 | } 139 | 140 | getData(formData?) { 141 | this.dataLoading = true; 142 | this.querySubscription = this._backendService.getDocs('OPPURTUNITY', formData).subscribe((res) => { 143 | if (res.length > 0) { 144 | this.dataSource = new MatTableDataSource(res); 145 | this.dataSource.paginator = this.paginator; 146 | this.dataSource.sort = this.sort; 147 | } 148 | }, 149 | (error) => { 150 | this.error = true; 151 | this.errorMessage = error.message; 152 | this.dataLoading = false; 153 | }, 154 | () => { 155 | this.dataLoading = false; 156 | }); 157 | } 158 | 159 | setData(formData) { 160 | this.dataLoading = true; 161 | return this._backendService.setDoc('OPPURTUNITY', formData, this.authState.uid).then(res => { 162 | if (res) { 163 | this.savedChanges = true; 164 | this.error = false; 165 | this.errorMessage = ""; 166 | this.dataLoading = false; 167 | } 168 | } 169 | ).catch(err => { 170 | if (err) { 171 | this.error = true; 172 | this.errorMessage = err.message; 173 | this.dataLoading = false; 174 | } 175 | } 176 | ); 177 | } 178 | 179 | updateData(formData) { 180 | this.dataLoading = true; 181 | this.querySubscription = this._backendService.updateDoc('OPPURTUNITY', formData._id, formData).then(res => { 182 | if (res) { 183 | this.savedChanges = true; 184 | this.error = false; 185 | this.errorMessage = ""; 186 | this.dataLoading = false; 187 | } 188 | } 189 | ).catch(err => { 190 | if (err) { 191 | this.error = true; 192 | this.errorMessage = err.message; 193 | this.dataLoading = false; 194 | } 195 | }); 196 | } 197 | 198 | getDoc(docId) { 199 | this.docId = docId; // this is required to pass at file upload directive 200 | this.dataLoading = true; 201 | this.data$ = this._backendService.getDoc('OPPURTUNITY', docId).subscribe(res => { 202 | if (res) { 203 | this.data$ = res; 204 | this.editDataForm = this._fb.group({ 205 | _id: ['', Validators.required], 206 | name: ['', [Validators.minLength(2), Validators.required]], 207 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 208 | campaignType: ['', [Validators.required]], 209 | startDt: ['', [Validators.required]], 210 | endDt: ['', [Validators.required]], 211 | status: ['', [Validators.required]], 212 | addresses: this._fb.array([]), 213 | assigned: this._fb.array([]), 214 | expenses: this._fb.array([]) 215 | }); 216 | this.editDataForm.patchValue(this.data$); 217 | for (let i = 0; i < this.data$["addresses"].length; i++) { 218 | this.ADDRESSLINES('editDataForm').push(this._fb.group(this.data$["addresses"][i])); 219 | } 220 | for (let i = 0; i < this.data$["assigned"].length; i++) { 221 | this.ASSIGNEDLINES('editDataForm').push(this._fb.group(this.data$["assigned"][i])); 222 | } 223 | for (let i = 0; i < this.data$["expenses"].length; i++) { 224 | this.EXPENSESLINES('editDataForm').push(this._fb.group(this.data$["expenses"][i])); 225 | } 226 | this.toggle('editMode'); 227 | this.dataLoading = false; 228 | } 229 | }, 230 | (error) => { 231 | this.error = true; 232 | this.errorMessage = error.message; 233 | this.dataLoading = false; 234 | }, 235 | () => { 236 | this.dataLoading = false; 237 | }); 238 | } 239 | 240 | deleteDoc(docId) { 241 | if (confirm("Are you sure want to delete this record ?")) { 242 | this.dataLoading = true; 243 | this._backendService.deleteDoc('OPPURTUNITY', docId).then(res => { 244 | if (res) { 245 | this.error = false; 246 | this.errorMessage = ""; 247 | this.dataLoading = false; 248 | } 249 | } 250 | ).catch(err => { 251 | if (err) { 252 | this.error = true; 253 | this.errorMessage = err.message; 254 | this.dataLoading = false; 255 | } 256 | } 257 | ); 258 | } 259 | } 260 | getDocUrl(docUrl) { 261 | this.fileName = docUrl; 262 | this.docUrl = this._backendService.getFileDownloadUrl(docUrl); 263 | } 264 | //mat table paginator and filter functions 265 | ngAfterViewInit() { 266 | this.dataSource.paginator = this.paginator; 267 | this.dataSource.sort = this.sort; 268 | } 269 | 270 | applyFilter(filterValue: string) { 271 | filterValue = filterValue.trim(); // Remove whitespace 272 | filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches 273 | this.dataSource.filter = filterValue; 274 | } 275 | ngOnDestroy() { 276 | // this is not needed when observable is used, in this case, we are registering user on subscription 277 | if (this.querySubscription) { 278 | this.querySubscription.unsubscribe(); 279 | } 280 | } 281 | } -------------------------------------------------------------------------------- /src/app/ui/orders/orders.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/app/ui/orders/orders.component.css -------------------------------------------------------------------------------- /src/app/ui/orders/orders.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; 2 | import { moveIn, fallIn } from '../../shared/router.animations'; 3 | import { Observable } from 'rxjs'; 4 | import { DataSource } from '@angular/cdk/collections'; 5 | import { MatTableModule, MatTableDataSource } from '@angular/material/table'; 6 | import { MatPaginator } from '@angular/material/paginator'; 7 | import { MatSort } from '@angular/material/sort'; 8 | import { AngularFireAuth } from '@angular/fire/auth'; 9 | 10 | import { BackendService } from '../../services/backend.service'; 11 | import { FormBuilder, FormGroup, FormArray, FormControl, Validators } from '@angular/forms'; 12 | 13 | @Component({ 14 | selector: 'app-orders', 15 | templateUrl: './orders.component.html', 16 | styleUrls: ['./orders.component.css'], 17 | animations: [moveIn(), fallIn()], 18 | host: { '[@moveIn]': '' } 19 | }) 20 | export class OrdersComponent implements OnInit, OnDestroy { 21 | panelOpenState = false; 22 | contacts = ['Personal', 'Customer', 'Manufacturer', 'Vendor', 'Other', 'Campaign', 'Lead', 'Oppurtunity']; 23 | addTypes = ['Home', 'Office', 'Primary', 'Mailing']; 24 | assignedTypes = ['Home', 'Office', 'Primary', 'Personal']; 25 | expenseTypes = ['Home', 'Office', 'Primary', 'Personal']; 26 | statuses = ['Open', 'In Progress', 'Hold', 'Closed']; 27 | members: any[]; 28 | dataSource: MatTableDataSource; 29 | myDocData; 30 | data$; 31 | toggleField: string; 32 | state: string = ''; 33 | savedChanges = false; 34 | error: boolean = false; 35 | errorMessage: String = ""; 36 | dataLoading: boolean = false; 37 | private querySubscription; 38 | authState: any = null; 39 | 40 | total_amount = 0; 41 | addDataForm: FormGroup; 42 | editDataForm: FormGroup; 43 | 44 | @ViewChild(MatPaginator) paginator: MatPaginator; 45 | @ViewChild(MatSort) sort: MatSort; 46 | displayedColumns = ['campaignType', 'name', 'campaignID', '_id']; 47 | // file upload 48 | docId: string; 49 | fileName: string; 50 | showFileUpload: boolean = false; 51 | showDocument: boolean = false; 52 | docUrl: Observable; 53 | userRole$; 54 | 55 | constructor(public afAuth: AngularFireAuth, private _backendService: BackendService, private _fb: FormBuilder) { 56 | this._backendService.userRole$.subscribe(res => this.userRole$ = res); 57 | } 58 | 59 | ngOnInit() { 60 | this.toggleField = "searchMode"; 61 | this.error = false; 62 | this.errorMessage = ""; 63 | this.dataSource = new MatTableDataSource(this.members); 64 | this.addDataForm = this._fb.group({ 65 | name: ['', [Validators.minLength(2), Validators.required]], 66 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 67 | campaignType: ['', [Validators.required]], 68 | startDt: ['', [Validators.required]], 69 | endDt: ['', [Validators.required]], 70 | status: ['', [Validators.required]], 71 | purpose: ['',Validators.required], 72 | addresses: this._fb.array([]), 73 | assigned: this._fb.array([]), 74 | expenses: this._fb.array([]) 75 | }); 76 | this.editDataForm = this._fb.group({ 77 | _id: ['', Validators.required], 78 | name: ['', [Validators.minLength(2), Validators.required]], 79 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 80 | campaignType: ['', [Validators.required]], 81 | startDt: ['', [Validators.required]], 82 | endDt: ['', [Validators.required]], 83 | status: ['', [Validators.required]], 84 | purpose: ['',Validators.required], 85 | addresses: this._fb.array([]), 86 | assigned: this._fb.array([]), 87 | expenses: this._fb.array([]) 88 | }); 89 | this.afAuth.authState.subscribe(authState => { 90 | this.authState = authState; 91 | }) 92 | } 93 | 94 | ADDRESSLINES(formName) { 95 | return this[formName].get('addresses') as FormArray; 96 | } 97 | 98 | addAddress(formName) { 99 | this.ADDRESSLINES(formName).push(this._fb.group({ 100 | addtype: [''], 101 | address: [''] 102 | })); 103 | } 104 | deleteAddress(index, formName) { 105 | this.ADDRESSLINES(formName).removeAt(index); 106 | } 107 | 108 | ASSIGNEDLINES(formName) { 109 | return this[formName].get('assigned') as FormArray; 110 | } 111 | 112 | addAssigned(formName) { 113 | this.ASSIGNEDLINES(formName).push(this._fb.group({ 114 | assignedtype: [''], 115 | assigned: [''] 116 | })); 117 | } 118 | deleteAssigned(index, formName) { 119 | this.ASSIGNEDLINES(formName).removeAt(index); 120 | } 121 | 122 | EXPENSESLINES(formName) { 123 | return this[formName].get('expenses') as FormArray; 124 | } 125 | addExpenses(formName) { 126 | this.EXPENSESLINES(formName).push(this._fb.group({ 127 | expensestype: [''], 128 | expenses: ['', [Validators.minLength(1)]] 129 | })); 130 | } 131 | deleteExpenses(index, formName) { 132 | this.EXPENSESLINES(formName).removeAt(index); 133 | } 134 | 135 | toggle(filter?) { 136 | if (!filter) { filter = "searchMode" } 137 | else { filter = filter; } 138 | this.toggleField = filter; 139 | this.dataLoading = false; 140 | } 141 | 142 | getData(formData?) { 143 | this.dataLoading = true; 144 | this.querySubscription = this._backendService.getDocs('ORDERS', formData).subscribe((res) => { 145 | if (res.length > 0) { 146 | this.dataSource = new MatTableDataSource(res); 147 | this.dataSource.paginator = this.paginator; 148 | this.dataSource.sort = this.sort; 149 | } 150 | }, 151 | (error) => { 152 | this.error = true; 153 | this.errorMessage = error.message; 154 | this.dataLoading = false; 155 | }, 156 | () => { 157 | this.dataLoading = false; 158 | }); 159 | } 160 | 161 | setData(formData) { 162 | this.dataLoading = true; 163 | return this._backendService.setDoc('ORDERS', formData, this.authState.uid).then(res => { 164 | if (res) { 165 | this.savedChanges = true; 166 | this.error = false; 167 | this.errorMessage = ""; 168 | this.dataLoading = false; 169 | } 170 | } 171 | ).catch(err => { 172 | if (err) { 173 | this.error = true; 174 | this.errorMessage = err.message; 175 | this.dataLoading = false; 176 | } 177 | } 178 | ); 179 | } 180 | 181 | updateData(formData) { 182 | this.dataLoading = true; 183 | this.querySubscription = this._backendService.updateDoc('ORDERS', formData._id, formData).then(res => { 184 | if (res) { 185 | this.savedChanges = true; 186 | this.error = false; 187 | this.errorMessage = ""; 188 | this.dataLoading = false; 189 | } 190 | } 191 | ).catch(err => { 192 | if (err) { 193 | this.error = true; 194 | this.errorMessage = err.message; 195 | this.dataLoading = false; 196 | } 197 | }); 198 | } 199 | 200 | getDoc(docId) { 201 | this.docId = docId; // this is required to pass at file upload directive 202 | this.dataLoading = true; 203 | this.data$ = this._backendService.getDoc('ORDERS', docId).subscribe(res => { 204 | if (res) { 205 | this.data$ = res; 206 | this.editDataForm = this._fb.group({ 207 | _id: ['', Validators.required], 208 | name: ['', [Validators.minLength(2), Validators.required]], 209 | campaignID: ['', [Validators.minLength(10), Validators.pattern("^[0-9]*$")]], 210 | campaignType: ['', [Validators.required]], 211 | startDt: ['', [Validators.required]], 212 | endDt: ['', [Validators.required]], 213 | status: ['', [Validators.required]], 214 | purpose: ['',Validators.required], 215 | addresses: this._fb.array([]), 216 | assigned: this._fb.array([]), 217 | expenses: this._fb.array([]) 218 | }); 219 | this.editDataForm.patchValue(this.data$); 220 | for (let i = 0; i < this.data$["addresses"].length; i++) { 221 | this.ADDRESSLINES('editDataForm').push(this._fb.group(this.data$["addresses"][i])); 222 | } 223 | for (let i = 0; i < this.data$["assigned"].length; i++) { 224 | this.ASSIGNEDLINES('editDataForm').push(this._fb.group(this.data$["assigned"][i])); 225 | } 226 | for (let i = 0; i < this.data$["expenses"].length; i++) { 227 | this.EXPENSESLINES('editDataForm').push(this._fb.group(this.data$["expenses"][i])); 228 | } 229 | this.toggle('editMode'); 230 | this.dataLoading = false; 231 | } 232 | }, 233 | (error) => { 234 | this.error = true; 235 | this.errorMessage = error.message; 236 | this.dataLoading = false; 237 | }, 238 | () => { 239 | this.dataLoading = false; 240 | }); 241 | } 242 | 243 | deleteDoc(docId) { 244 | if (confirm("Are you sure want to delete this record ?")) { 245 | this.dataLoading = true; 246 | this._backendService.deleteDoc('ORDERS', docId).then(res => { 247 | if (res) { 248 | this.error = false; 249 | this.errorMessage = ""; 250 | this.dataLoading = false; 251 | } 252 | } 253 | ).catch(err => { 254 | if (err) { 255 | this.error = true; 256 | this.errorMessage = err.message; 257 | this.dataLoading = false; 258 | } 259 | } 260 | ); 261 | } 262 | } 263 | getDocUrl(docUrl) { 264 | this.fileName = docUrl; 265 | this.docUrl = this._backendService.getFileDownloadUrl(docUrl); 266 | } 267 | //mat table paginator and filter functions 268 | ngAfterViewInit() { 269 | this.dataSource.paginator = this.paginator; 270 | this.dataSource.sort = this.sort; 271 | } 272 | 273 | applyFilter(filterValue: string) { 274 | filterValue = filterValue.trim(); // Remove whitespace 275 | filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches 276 | this.dataSource.filter = filterValue; 277 | } 278 | ngOnDestroy() { 279 | // this is not needed when observable is used, in this case, we are registering user on subscription 280 | if (this.querySubscription) { 281 | this.querySubscription.unsubscribe(); 282 | } 283 | } 284 | } -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/assets/css/styles.css: -------------------------------------------------------------------------------- 1 | @import '~@angular/material/prebuilt-themes/indigo-pink.css'; 2 | 3 | .small-headline { 4 | font-family: times, Times New Roman, times-roman, georgia, serif; 5 | font-size: 8; 6 | line-height: 40px; 7 | letter-spacing: -1px; 8 | color: #0088cc; 9 | } 10 | 11 | .middle-headline { 12 | font-family: times, Times New Roman, times-roman, georgia, serif; 13 | font-size: 28px; 14 | line-height: 40px; 15 | letter-spacing: -1px; 16 | color: #0088cc; 17 | } 18 | 19 | .large-headline { 20 | font-family: times, Times New Roman, times-roman, georgia, serif; 21 | font-size: 48px; 22 | line-height: 40px; 23 | letter-spacing: -1px; 24 | color: #0088cc; 25 | margin: 0 0 0 0; 26 | padding: 0 0 0 0; 27 | font-weight: 100; 28 | } 29 | 30 | .small-spacer { 31 | margin-left: 10px; 32 | } 33 | 34 | .med-spacer { 35 | margin-left: 70px; 36 | } 37 | 38 | .large-spacer { 39 | margin-left: 170px; 40 | } 41 | 42 | .body { 43 | background-color: white; 44 | color: #777777; 45 | font-family: Arial, Helvetica, sans-serif; 46 | font-size: 10; 47 | line-height: 22px; 48 | margin: 0; 49 | } 50 | 51 | html, 52 | body { 53 | height: 100%; 54 | } 55 | 56 | body { 57 | margin: 0; 58 | font-family: Roboto, "Helvetica Neue", sans-serif; 59 | } 60 | 61 | .circle-link { 62 | height: 40px; 63 | width: 40px; 64 | border-radius: 40px; 65 | margin: 8px; 66 | background-color: white; 67 | border: 1px solid #eeeeee; 68 | display: flex; 69 | justify-content: center; 70 | align-items: center; 71 | cursor: pointer; 72 | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); 73 | transition: 1s ease-out; 74 | } 75 | 76 | .circle-link:hover { 77 | transform: translateY(-0.25rem); 78 | box-shadow: 0px 3px 15px rgba(0, 0, 0, 0.2); 79 | } 80 | 81 | .example-icon { 82 | padding: 0 7px; 83 | color: #777777; 84 | } 85 | .example-icon-link { 86 | padding: 0 6px; 87 | color: steelblue; 88 | background-color: white; 89 | } 90 | .example-icon-link-large { 91 | color: steelblue; 92 | } 93 | .mat-menu-item { 94 | padding: 0 7px; 95 | color: steelblue; 96 | } 97 | .example-spacer { 98 | flex: 1 1 auto; 99 | } 100 | .example-card { 101 | max-width: 100%; 102 | } 103 | .example-card-fixed { 104 | max-width: 400px; 105 | } 106 | .example-header-image { 107 | background-image: url('http://localhost:4200/assets/images/sound.gif'); 108 | background-size: cover; 109 | } 110 | .example-form { 111 | min-width: 150px; 112 | max-width: 500px; 113 | width: 100%; 114 | } 115 | .example-full-width { 116 | width: 100%; 117 | } 118 | mat-chip { 119 | max-width: 200px; 120 | } -------------------------------------------------------------------------------- /src/assets/icons/account_circle.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/add.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/backspace.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/bars.svg: -------------------------------------------------------------------------------- 1 | 2 | bars-line 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/book.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/business.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/cached.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/clear.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/cloud.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/code.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/create.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/dashboard-black.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/delete.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/drop_down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/assets/icons/edit.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/email.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/equalizer.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/event.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/assets/icons/favicon.ico -------------------------------------------------------------------------------- /src/assets/icons/fb.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/assets/icons/github.svg: -------------------------------------------------------------------------------- 1 | GitHub icon -------------------------------------------------------------------------------- /src/assets/icons/group.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/help.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/home.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/assets/icons/language.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/linkedin.svg: -------------------------------------------------------------------------------- 1 | LinkedIn icon -------------------------------------------------------------------------------- /src/assets/icons/menu.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/more_vert.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/new.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/assets/icons/person.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/phone.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/place.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/radio_off.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/radio_on.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/salary.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 19 | 21 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/assets/icons/search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/security.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/star.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/track_changes.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/icons/twitter_1.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/icons/twitter_2.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/icons/vpn.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/images/ERP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/assets/images/ERP.png -------------------------------------------------------------------------------- /src/assets/images/barcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/assets/images/barcode.png -------------------------------------------------------------------------------- /src/assets/images/person.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/assets/images/person.gif -------------------------------------------------------------------------------- /src/assets/images/sound.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/assets/images/sound.gif -------------------------------------------------------------------------------- /src/assets/images/wifi-search.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/assets/images/wifi-search.gif -------------------------------------------------------------------------------- /src/custom-theme.scss: -------------------------------------------------------------------------------- 1 | 2 | // Custom Theming for Angular Material 3 | // For more information: https://material.angular.io/guide/theming 4 | @import '~@angular/material/theming'; 5 | // Plus imports for other components in your app. 6 | 7 | // Include the common styles for Angular Material. We include this here so that you only 8 | // have to load a single css file for Angular Material in your app. 9 | // Be sure that you only ever include this mixin once! 10 | @include mat-core(); 11 | 12 | // Define the palettes for your theme using the Material Design palettes available in palette.scss 13 | // (imported above). For each palette, you can optionally specify a default, lighter, and darker 14 | // hue. Available color palettes: https://material.io/design/color/ 15 | $angularUI-primary: mat-palette($mat-indigo); 16 | $angularUI-accent: mat-palette($mat-pink, A200, A100, A400); 17 | 18 | // The warn palette is optional (defaults to red). 19 | $angularUI-warn: mat-palette($mat-red); 20 | 21 | // Create the theme object (a Sass map containing all of the palettes). 22 | $angularUI-theme: mat-light-theme($angularUI-primary, $angularUI-accent, $angularUI-warn); 23 | 24 | // Include theme styles for core and each component used in your app. 25 | // Alternatively, you can import and @include the theme mixins for each component 26 | // that you are using. 27 | @include angular-material-theme($angularUI-theme); 28 | 29 | -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | emailAPI: 'http://XXXXXX.com/contact-form.php', 4 | database: 'guest', 5 | adminKey: 'guest', 6 | firebase: { 7 | apiKey: "", 8 | authDomain: "", 9 | databaseURL: "", 10 | projectId: "", 11 | storageBucket: "", 12 | messagingSenderId: "", 13 | appId: "", 14 | measurementId: "" 15 | }, 16 | social: { 17 | fblink: 'https://www.facebook.com/elishconsulting', 18 | linkedin: 'https://www.linkedin.com/in/elishconsulting/', 19 | github: 'https://github.com/AmitXShukla', 20 | emailid: 'info@elishconsulting.com', 21 | twitter: 'https://twitter.com/ashuklax', 22 | website: 'http://elishconsulting.com', 23 | copyright: 'PoweredBy @copyright elishconsulting.com', 24 | company: "elishconsulting.com" 25 | }, 26 | socialAuthEnabled: true, 27 | graphql: 'http://localhost:3000/graphql', 28 | helptext: { 29 | login: "Elish ERP CRM Cloud App provide three different methods to sign in. You can use existing Google/Facebook login or using your email with any password. app password is NOT same as your email password. Please send email to contact@elishconsulting.com for any support.", 30 | register: "This page is used to checkin and check out. Please chose appropraite checkin our checout type based on your guest status.", 31 | checkin: "Please pick your host and add your details for check in. Please see your address and photo is optional", 32 | checkout: "Please use your phone # or scan your basr code for faster check out.", 33 | aboutus: "Product about us information page.", 34 | badge: "Please accepts terms & condition and Print your badge, Please wear your badge while visiting and discard it after checkout.", 35 | config: "Setup your company branding defaults.", 36 | reports: "Run visitor register reports by Date or not-checked out visitor.", 37 | } 38 | }; -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: false, 3 | emailAPI: 'http://XXXXXX.com/contact-form.php', 4 | database: 'guest', 5 | adminKey: 'guest', 6 | firebase: { 7 | apiKey: "", 8 | authDomain: "", 9 | databaseURL: "", 10 | projectId: "", 11 | storageBucket: "", 12 | messagingSenderId: "", 13 | appId: "", 14 | measurementId: "" 15 | }, 16 | social: { 17 | fblink: 'https://www.facebook.com/elishconsulting', 18 | linkedin: 'https://www.linkedin.com/in/elishconsulting/', 19 | github: 'https://github.com/AmitXShukla', 20 | emailid: 'info@elishconsulting.com', 21 | twitter: 'https://twitter.com/ashuklax', 22 | website: 'http://elishconsulting.com', 23 | copyright: 'PoweredBy @copyright elishconsulting.com', 24 | company: "elishconsulting.com" 25 | }, 26 | socialAuthEnabled: true, 27 | graphql: 'http://localhost:3000/graphql', 28 | helptext: { 29 | login: "Elish ERP CRM Cloud App provide three different methods to sign in. You can use existing Google/Facebook login or using your email with any password. app password is NOT same as your email password. Please send email to contact@elishconsulting.com for any support.", 30 | register: "This page is used to checkin and check out. Please chose appropraite checkin our checout type based on your guest status.", 31 | checkin: "Please pick your host and add your details for check in. Please see your address and photo is optional", 32 | checkout: "Please use your phone # or scan your basr code for faster check out.", 33 | aboutus: "Product about us information page.", 34 | badge: "Please accepts terms & condition and Print your badge, Please wear your badge while visiting and discard it after checkout.", 35 | config: "Setup your company branding defaults.", 36 | reports: "Run visitor register reports by Date or not-checked out visitor.", 37 | } 38 | }; -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmitXShukla/ERP-Apps-CRM-Cloud-Angular_Firebase/999125fee3ffe382ecff2af9f6dd7e93405ae05b/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NEWCRMAPP 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by default for Angular itself. 57 | */ 58 | import 'zone.js/dist/zone'; // Included with Angular CLI. 59 | 60 | 61 | /*************************************************************************************************** 62 | * APPLICATION IMPORTS 63 | */ 64 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | html, body { height: 100%; } 4 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 5 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": [ 8 | "src/main.ts", 9 | "src/polyfills.ts", 10 | ], 11 | "include": [ 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "downlevelIteration": true, 9 | "experimentalDecorators": true, 10 | "module": "esnext", 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "lib": [ 15 | "es2018", 16 | "dom" 17 | ] 18 | }, 19 | "angularCompilerOptions": { 20 | "fullTemplateTypeCheck": true, 21 | "strictInjectionParameters": true 22 | } 23 | } -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rules": { 4 | "align": { 5 | "options": [ 6 | "parameters", 7 | "statements" 8 | ] 9 | }, 10 | "array-type": false, 11 | "arrow-return-shorthand": true, 12 | "curly": true, 13 | "deprecation": { 14 | "severity": "warning" 15 | }, 16 | "component-class-suffix": true, 17 | "contextual-lifecycle": true, 18 | "directive-class-suffix": true, 19 | "directive-selector": [ 20 | true, 21 | "attribute", 22 | "app", 23 | "camelCase" 24 | ], 25 | "component-selector": [ 26 | true, 27 | "element", 28 | "app", 29 | "kebab-case" 30 | ], 31 | "eofline": true, 32 | "import-blacklist": [ 33 | true, 34 | "rxjs/Rx" 35 | ], 36 | "import-spacing": true, 37 | "indent": { 38 | "options": [ 39 | "spaces" 40 | ] 41 | }, 42 | "max-classes-per-file": false, 43 | "max-line-length": [ 44 | true, 45 | 140 46 | ], 47 | "member-ordering": [ 48 | true, 49 | { 50 | "order": [ 51 | "static-field", 52 | "instance-field", 53 | "static-method", 54 | "instance-method" 55 | ] 56 | } 57 | ], 58 | "no-console": [ 59 | true, 60 | "debug", 61 | "info", 62 | "time", 63 | "timeEnd", 64 | "trace" 65 | ], 66 | "no-empty": false, 67 | "no-inferrable-types": [ 68 | true, 69 | "ignore-params" 70 | ], 71 | "no-non-null-assertion": true, 72 | "no-redundant-jsdoc": true, 73 | "no-switch-case-fall-through": true, 74 | "no-var-requires": false, 75 | "object-literal-key-quotes": [ 76 | true, 77 | "as-needed" 78 | ], 79 | "quotemark": [ 80 | true, 81 | "single" 82 | ], 83 | "semicolon": { 84 | "options": [ 85 | "always" 86 | ] 87 | }, 88 | "space-before-function-paren": { 89 | "options": { 90 | "anonymous": "never", 91 | "asyncArrow": "always", 92 | "constructor": "never", 93 | "method": "never", 94 | "named": "never" 95 | } 96 | }, 97 | "typedef-whitespace": { 98 | "options": [ 99 | { 100 | "call-signature": "nospace", 101 | "index-signature": "nospace", 102 | "parameter": "nospace", 103 | "property-declaration": "nospace", 104 | "variable-declaration": "nospace" 105 | }, 106 | { 107 | "call-signature": "onespace", 108 | "index-signature": "onespace", 109 | "parameter": "onespace", 110 | "property-declaration": "onespace", 111 | "variable-declaration": "onespace" 112 | } 113 | ] 114 | }, 115 | "variable-name": { 116 | "options": [ 117 | "ban-keywords", 118 | "check-format", 119 | "allow-pascal-case" 120 | ] 121 | }, 122 | "whitespace": { 123 | "options": [ 124 | "check-branch", 125 | "check-decl", 126 | "check-operator", 127 | "check-separator", 128 | "check-type", 129 | "check-typecast" 130 | ] 131 | }, 132 | "no-conflicting-lifecycle": true, 133 | "no-host-metadata-property": true, 134 | "no-input-rename": true, 135 | "no-inputs-metadata-property": true, 136 | "no-output-native": true, 137 | "no-output-on-prefix": true, 138 | "no-output-rename": true, 139 | "no-outputs-metadata-property": true, 140 | "template-banana-in-box": true, 141 | "template-no-negated-async": true, 142 | "use-lifecycle-interface": true, 143 | "use-pipe-transform-interface": true 144 | }, 145 | "rulesDirectory": [ 146 | "codelyzer" 147 | ] 148 | } --------------------------------------------------------------------------------