├── .editorconfig
├── .gitignore
├── README.md
├── angular.json
├── e2e
├── protractor.conf.js
├── src
│ ├── app.e2e-spec.ts
│ └── app.po.ts
└── tsconfig.e2e.json
├── package-lock.json
├── package.json
├── src
├── app
│ ├── account-create
│ │ ├── account-create.component.css
│ │ ├── account-create.component.html
│ │ ├── account-create.component.spec.ts
│ │ └── account-create.component.ts
│ ├── account-list
│ │ ├── account-list.component.css
│ │ ├── account-list.component.html
│ │ ├── account-list.component.spec.ts
│ │ └── account-list.component.ts
│ ├── api.service.spec.ts
│ ├── api.service.ts
│ ├── app-routing.module.ts
│ ├── app.component.css
│ ├── app.component.html
│ ├── app.component.spec.ts
│ ├── app.component.ts
│ ├── app.module.ts
│ ├── contact-create
│ │ ├── contact-create.component.css
│ │ ├── contact-create.component.html
│ │ ├── contact-create.component.spec.ts
│ │ └── contact-create.component.ts
│ ├── contact-list
│ │ ├── contact-list.component.css
│ │ ├── contact-list.component.html
│ │ ├── contact-list.component.spec.ts
│ │ └── contact-list.component.ts
│ ├── lead-create
│ │ ├── lead-create.component.css
│ │ ├── lead-create.component.html
│ │ ├── lead-create.component.spec.ts
│ │ └── lead-create.component.ts
│ ├── lead-list
│ │ ├── lead-list.component.css
│ │ ├── lead-list.component.html
│ │ ├── lead-list.component.spec.ts
│ │ └── lead-list.component.ts
│ ├── opportunity-create
│ │ ├── opportunity-create.component.css
│ │ ├── opportunity-create.component.html
│ │ ├── opportunity-create.component.spec.ts
│ │ └── opportunity-create.component.ts
│ └── opportunity-list
│ │ ├── opportunity-list.component.css
│ │ ├── opportunity-list.component.html
│ │ ├── opportunity-list.component.spec.ts
│ │ └── opportunity-list.component.ts
├── assets
│ └── .gitkeep
├── browserslist
├── environments
│ ├── environment.prod.ts
│ └── environment.ts
├── favicon.ico
├── index.html
├── karma.conf.js
├── main.ts
├── polyfills.ts
├── styles.css
├── test.ts
├── tsconfig.app.json
├── tsconfig.spec.json
└── tslint.json
├── tsconfig.json
└── tslint.json
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/.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 |
8 | # dependencies
9 | /node_modules
10 |
11 | # IDEs and editors
12 | /.idea
13 | .project
14 | .classpath
15 | .c9/
16 | *.launch
17 | .settings/
18 | *.sublime-workspace
19 |
20 | # IDE - VSCode
21 | .vscode/*
22 | !.vscode/settings.json
23 | !.vscode/tasks.json
24 | !.vscode/launch.json
25 | !.vscode/extensions.json
26 |
27 | # misc
28 | /.sass-cache
29 | /connect.lock
30 | /coverage
31 | /libpeerconnection.log
32 | npm-debug.log
33 | yarn-error.log
34 | testem.log
35 | /typings
36 |
37 | # System Files
38 | .DS_Store
39 | Thumbs.db
40 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CRM App with Angular 6
2 |
3 | This is the front-end application for this [back-end](https://github.com/techiediaries/django-crm) built with Django.
4 |
5 | You can read this [tutorial](https://www.techiediaries.com/angular-tutorial) accompanying this repository for more information.
6 |
7 | For v7, read the [Angular 7 tutorial](https://www.techiediaries.com/angular-tutorial-basics/).
8 |
9 | Also read:
10 |
11 | [Angular 7|6 Tutorial: Using Angular HttpClient with Node & Express.js - Example POST Requests](https://www.techiediaries.com/angular-tutorial-httpclient-post/)
12 |
13 | [Angular 7|6 By Example: HTTP GET Requests with HttpClient (Services, async pipe and Observables)](https://www.techiediaries.com/angular-by-example-httpclient-get/)
14 |
15 | [Angular Http — Angular 6|7 HttpClient Tutorial](https://www.techiediaries.com/angular-http-client)
16 |
17 |
18 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.0.
19 |
20 | ## Development server
21 |
22 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
23 |
24 | ## Code scaffolding
25 |
26 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
27 |
28 | ## Build
29 |
30 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
31 |
32 | ## Running unit tests
33 |
34 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
35 |
36 | ## Running end-to-end tests
37 |
38 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
39 |
40 | ## Further help
41 |
42 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
43 |
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "crmapp": {
7 | "root": "",
8 | "sourceRoot": "src",
9 | "projectType": "application",
10 | "prefix": "app",
11 | "schematics": {},
12 | "architect": {
13 | "build": {
14 | "builder": "@angular-devkit/build-angular:browser",
15 | "options": {
16 | "outputPath": "dist/crmapp",
17 | "index": "src/index.html",
18 | "main": "src/main.ts",
19 | "polyfills": "src/polyfills.ts",
20 | "tsConfig": "src/tsconfig.app.json",
21 | "assets": [
22 | "src/favicon.ico",
23 | "src/assets"
24 | ],
25 | "styles": [
26 | "src/styles.css"
27 | ],
28 | "scripts": []
29 | },
30 | "configurations": {
31 | "production": {
32 | "fileReplacements": [
33 | {
34 | "replace": "src/environments/environment.ts",
35 | "with": "src/environments/environment.prod.ts"
36 | }
37 | ],
38 | "optimization": true,
39 | "outputHashing": "all",
40 | "sourceMap": false,
41 | "extractCss": true,
42 | "namedChunks": false,
43 | "aot": true,
44 | "extractLicenses": true,
45 | "vendorChunk": false,
46 | "buildOptimizer": true
47 | }
48 | }
49 | },
50 | "serve": {
51 | "builder": "@angular-devkit/build-angular:dev-server",
52 | "options": {
53 | "browserTarget": "crmapp:build"
54 | },
55 | "configurations": {
56 | "production": {
57 | "browserTarget": "crmapp:build:production"
58 | }
59 | }
60 | },
61 | "extract-i18n": {
62 | "builder": "@angular-devkit/build-angular:extract-i18n",
63 | "options": {
64 | "browserTarget": "crmapp:build"
65 | }
66 | },
67 | "test": {
68 | "builder": "@angular-devkit/build-angular:karma",
69 | "options": {
70 | "main": "src/test.ts",
71 | "polyfills": "src/polyfills.ts",
72 | "tsConfig": "src/tsconfig.spec.json",
73 | "karmaConfig": "src/karma.conf.js",
74 | "styles": [
75 | "styles.css"
76 | ],
77 | "scripts": [],
78 | "assets": [
79 | "src/favicon.ico",
80 | "src/assets"
81 | ]
82 | }
83 | },
84 | "lint": {
85 | "builder": "@angular-devkit/build-angular:tslint",
86 | "options": {
87 | "tsConfig": [
88 | "src/tsconfig.app.json",
89 | "src/tsconfig.spec.json"
90 | ],
91 | "exclude": [
92 | "**/node_modules/**"
93 | ]
94 | }
95 | }
96 | }
97 | },
98 | "crmapp-e2e": {
99 | "root": "e2e/",
100 | "projectType": "application",
101 | "architect": {
102 | "e2e": {
103 | "builder": "@angular-devkit/build-angular:protractor",
104 | "options": {
105 | "protractorConfig": "e2e/protractor.conf.js",
106 | "devServerTarget": "crmapp:serve"
107 | }
108 | },
109 | "lint": {
110 | "builder": "@angular-devkit/build-angular:tslint",
111 | "options": {
112 | "tsConfig": "e2e/tsconfig.e2e.json",
113 | "exclude": [
114 | "**/node_modules/**"
115 | ]
116 | }
117 | }
118 | }
119 | }
120 | },
121 | "defaultProject": "crmapp"
122 | }
--------------------------------------------------------------------------------
/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // Protractor configuration file, see link for more information
2 | // https://github.com/angular/protractor/blob/master/lib/config.ts
3 |
4 | const { SpecReporter } = require('jasmine-spec-reporter');
5 |
6 | exports.config = {
7 | allScriptsTimeout: 11000,
8 | specs: [
9 | './src/**/*.e2e-spec.ts'
10 | ],
11 | capabilities: {
12 | 'browserName': 'chrome'
13 | },
14 | directConnect: true,
15 | baseUrl: 'http://localhost:4200/',
16 | framework: 'jasmine',
17 | jasmineNodeOpts: {
18 | showColors: true,
19 | defaultTimeoutInterval: 30000,
20 | print: function() {}
21 | },
22 | onPrepare() {
23 | require('ts-node').register({
24 | project: require('path').join(__dirname, './tsconfig.e2e.json')
25 | });
26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27 | }
28 | };
--------------------------------------------------------------------------------
/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 |
3 | describe('workspace-project App', () => {
4 | let page: AppPage;
5 |
6 | beforeEach(() => {
7 | page = new AppPage();
8 | });
9 |
10 | it('should display welcome message', () => {
11 | page.navigateTo();
12 | expect(page.getParagraphText()).toEqual('Welcome to app!');
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo() {
5 | return browser.get('/');
6 | }
7 |
8 | getParagraphText() {
9 | return element(by.css('app-root h1')).getText();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/e2e/tsconfig.e2e.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "crmapp",
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": "^6.0.0",
15 | "@angular/common": "^6.0.0",
16 | "@angular/compiler": "^6.0.0",
17 | "@angular/core": "^6.0.0",
18 | "@angular/forms": "^6.0.0",
19 | "@angular/http": "^6.0.0",
20 | "@angular/platform-browser": "^6.0.0",
21 | "@angular/platform-browser-dynamic": "^6.0.0",
22 | "@angular/router": "^6.0.0",
23 | "core-js": "^2.5.4",
24 | "rxjs": "^6.0.0",
25 | "zone.js": "^0.8.26"
26 | },
27 | "devDependencies": {
28 | "@angular/compiler-cli": "^6.0.0",
29 | "@angular-devkit/build-angular": "~0.6.0",
30 | "typescript": "~2.7.2",
31 | "@angular/cli": "~6.0.0",
32 | "@angular/language-service": "^6.0.0",
33 | "@types/jasmine": "~2.8.6",
34 | "@types/jasminewd2": "~2.0.3",
35 | "@types/node": "~8.9.4",
36 | "codelyzer": "~4.2.1",
37 | "jasmine-core": "~2.99.1",
38 | "jasmine-spec-reporter": "~4.2.1",
39 | "karma": "~1.7.1",
40 | "karma-chrome-launcher": "~2.2.0",
41 | "karma-coverage-istanbul-reporter": "~1.4.2",
42 | "karma-jasmine": "~1.1.1",
43 | "karma-jasmine-html-reporter": "^0.2.2",
44 | "protractor": "~5.3.0",
45 | "ts-node": "~5.0.1",
46 | "tslint": "~5.9.1"
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/app/account-create/account-create.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techiediaries/ng-crm/b3a3adee6e2bae67817f855325c5602da59c9cf6/src/app/account-create/account-create.component.css
--------------------------------------------------------------------------------
/src/app/account-create/account-create.component.html:
--------------------------------------------------------------------------------
1 |
2 | account-create works!
3 |
4 |
--------------------------------------------------------------------------------
/src/app/account-create/account-create.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { AccountCreateComponent } from './account-create.component';
4 |
5 | describe('AccountCreateComponent', () => {
6 | let component: AccountCreateComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ AccountCreateComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(AccountCreateComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/account-create/account-create.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-account-create',
5 | templateUrl: './account-create.component.html',
6 | styleUrls: ['./account-create.component.css']
7 | })
8 | export class AccountCreateComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/app/account-list/account-list.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techiediaries/ng-crm/b3a3adee6e2bae67817f855325c5602da59c9cf6/src/app/account-list/account-list.component.css
--------------------------------------------------------------------------------
/src/app/account-list/account-list.component.html:
--------------------------------------------------------------------------------
1 |
2 | account-list works!
3 |
4 |
--------------------------------------------------------------------------------
/src/app/account-list/account-list.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { AccountListComponent } from './account-list.component';
4 |
5 | describe('AccountListComponent', () => {
6 | let component: AccountListComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ AccountListComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(AccountListComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/account-list/account-list.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | import { APIService } from '../api.service';
4 |
5 | @Component({
6 | selector: 'app-account-list',
7 | templateUrl: './account-list.component.html',
8 | styleUrls: ['./account-list.component.css']
9 | })
10 | export class AccountListComponent implements OnInit {
11 |
12 | constructor(private apiService: APIService) { }
13 |
14 | ngOnInit() {
15 | this.getAccounts();
16 | }
17 |
18 | public getAccounts(){
19 | this.apiService.getAccounts();
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/app/api.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, inject } from '@angular/core/testing';
2 |
3 | import { APIService } from './api.service';
4 |
5 | describe('APIService', () => {
6 | beforeEach(() => {
7 | TestBed.configureTestingModule({
8 | providers: [APIService]
9 | });
10 | });
11 |
12 | it('should be created', inject([APIService], (service: APIService) => {
13 | expect(service).toBeTruthy();
14 | }));
15 | });
16 |
--------------------------------------------------------------------------------
/src/app/api.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 |
3 | import { HttpClient} from '@angular/common/http';
4 |
5 | @Injectable({
6 | providedIn: 'root'
7 | })
8 | export class APIService {
9 |
10 | API_URL = 'http://localhost:8000';
11 |
12 | constructor(private httpClient: HttpClient) {}
13 |
14 | getAccounts(){
15 | return this.httpClient.get(`${this.API_URL}/accounts`);
16 | }
17 |
18 | getContacts(){
19 | return this.httpClient.get(`${this.API_URL}/contacts`);
20 | }
21 | createContact(contact){
22 | return this.httpClient.post(`${this.API_URL}/contacts/`,contact);
23 | }
24 | updateContact(contact){
25 | return this.httpClient.put(`${this.API_URL}/contacts/`,contact);
26 | }
27 | deleteContact(contact){
28 | return this.httpClient.delete(`${this.API_URL}/contacts/${contact.pk}`);
29 | }
30 | getLeads(){
31 | return this.httpClient.get(`${this.API_URL}/leads`);
32 | }
33 | getOpportunities(){
34 | return this.httpClient.get(`${this.API_URL}/opportunities`);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { Routes, RouterModule } from '@angular/router';
3 |
4 | import { AccountListComponent } from './account-list/account-list.component';
5 | import { AccountCreateComponent } from './account-create/account-create.component';
6 | import { ContactListComponent } from './contact-list/contact-list.component';
7 | import { ContactCreateComponent } from './contact-create/contact-create.component';
8 | import { LeadListComponent } from './lead-list/lead-list.component';
9 | import { LeadCreateComponent } from './lead-create/lead-create.component';
10 | import { OpportunityListComponent } from './opportunity-list/opportunity-list.component';
11 | import { OpportunityCreateComponent } from './opportunity-create/opportunity-create.component';
12 |
13 |
14 | const routes: Routes = [
15 |
16 | { path: '', redirectTo: 'accounts', pathMatch: 'full' },
17 | {
18 | path: 'accounts',
19 | component: AccountListComponent
20 | },
21 | {
22 | path: 'create-account',
23 | component: AccountCreateComponent
24 | },
25 | {
26 | path: 'contacts',
27 | component: ContactListComponent
28 | },
29 | {
30 | path: 'create-contact',
31 | component: ContactCreateComponent
32 | },
33 | {
34 | path: 'leads',
35 | component: LeadListComponent
36 | },
37 | {
38 | path: 'create-lead',
39 | component: LeadCreateComponent
40 | },
41 | {
42 | path: 'opportunities',
43 | component: OpportunityListComponent
44 | },
45 | {
46 | path: 'create-opportunity',
47 | component: OpportunityCreateComponent
48 | }
49 | ];
50 |
51 | @NgModule({
52 | imports: [RouterModule.forRoot(routes)],
53 | exports: [RouterModule]
54 | })
55 | export class AppRoutingModule { }
--------------------------------------------------------------------------------
/src/app/app.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techiediaries/ng-crm/b3a3adee6e2bae67817f855325c5602da59c9cf6/src/app/app.component.css
--------------------------------------------------------------------------------
/src/app/app.component.html:
--------------------------------------------------------------------------------
1 | Accounts
2 | Create Account
3 |
4 | Contacts
5 | Create Contact
6 |
7 | Leads
8 | Create Lead
9 |
10 |
11 | Opportunities
12 | Create Opportunity
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { AppComponent } from './app.component';
3 | describe('AppComponent', () => {
4 | beforeEach(async(() => {
5 | TestBed.configureTestingModule({
6 | declarations: [
7 | AppComponent
8 | ],
9 | }).compileComponents();
10 | }));
11 | it('should create the app', async(() => {
12 | const fixture = TestBed.createComponent(AppComponent);
13 | const app = fixture.debugElement.componentInstance;
14 | expect(app).toBeTruthy();
15 | }));
16 | it(`should have as title 'app'`, async(() => {
17 | const fixture = TestBed.createComponent(AppComponent);
18 | const app = fixture.debugElement.componentInstance;
19 | expect(app.title).toEqual('app');
20 | }));
21 | it('should render title in a h1 tag', async(() => {
22 | const fixture = TestBed.createComponent(AppComponent);
23 | fixture.detectChanges();
24 | const compiled = fixture.debugElement.nativeElement;
25 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
26 | }));
27 | });
28 |
--------------------------------------------------------------------------------
/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 = 'app';
10 | }
11 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 |
4 | import { AppComponent } from './app.component';
5 | import { AccountListComponent } from './account-list/account-list.component';
6 | import { AccountCreateComponent } from './account-create/account-create.component';
7 | import { ContactListComponent } from './contact-list/contact-list.component';
8 | import { ContactCreateComponent } from './contact-create/contact-create.component';
9 | import { LeadListComponent } from './lead-list/lead-list.component';
10 | import { LeadCreateComponent } from './lead-create/lead-create.component';
11 | import { OpportunityListComponent } from './opportunity-list/opportunity-list.component';
12 | import { OpportunityCreateComponent } from './opportunity-create/opportunity-create.component';
13 |
14 | import {AppRoutingModule} from './app-routing.module';
15 |
16 | import { HttpClientModule } from '@angular/common/http';
17 |
18 |
19 | @NgModule({
20 | declarations: [
21 | AppComponent,
22 | AccountListComponent,
23 | AccountCreateComponent,
24 | ContactListComponent,
25 | ContactCreateComponent,
26 | LeadListComponent,
27 | LeadCreateComponent,
28 | OpportunityListComponent,
29 | OpportunityCreateComponent
30 | ],
31 | imports: [
32 | BrowserModule,
33 | AppRoutingModule,
34 | HttpClientModule
35 | ],
36 | providers: [],
37 | bootstrap: [AppComponent]
38 | })
39 | export class AppModule { }
40 |
--------------------------------------------------------------------------------
/src/app/contact-create/contact-create.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techiediaries/ng-crm/b3a3adee6e2bae67817f855325c5602da59c9cf6/src/app/contact-create/contact-create.component.css
--------------------------------------------------------------------------------
/src/app/contact-create/contact-create.component.html:
--------------------------------------------------------------------------------
1 |
2 | Create Contact
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/app/contact-create/contact-create.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ContactCreateComponent } from './contact-create.component';
4 |
5 | describe('ContactCreateComponent', () => {
6 | let component: ContactCreateComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ContactCreateComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ContactCreateComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/contact-create/contact-create.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { APIService } from '../api.service';
3 |
4 | @Component({
5 | selector: 'app-contact-create',
6 | templateUrl: './contact-create.component.html',
7 | styleUrls: ['./contact-create.component.css']
8 | })
9 | export class ContactCreateComponent implements OnInit {
10 |
11 | constructor(private apiService: APIService) { }
12 |
13 | ngOnInit() {
14 | }
15 |
16 | createContact(){
17 | var contact = {
18 | account: 1,
19 | address: "Home N 333 Apartment 300",
20 | createdBy: 1,
21 | description: "This is the third contact",
22 | email: "abbess@email.com",
23 | first_name: "kaya",
24 | isActive: true,
25 | last_name: "Abbes",
26 | phone: "00121212101",
27 | };
28 |
29 | this.apiService.createContact(contact).subscribe((response) => {
30 | console.log(response);
31 | });
32 | };
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/app/contact-list/contact-list.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techiediaries/ng-crm/b3a3adee6e2bae67817f855325c5602da59c9cf6/src/app/contact-list/contact-list.component.css
--------------------------------------------------------------------------------
/src/app/contact-list/contact-list.component.html:
--------------------------------------------------------------------------------
1 |
2 | My Contacts
3 |
4 |
5 |
6 |
7 |
8 | First Name |
9 | Last Name |
10 | Phone |
11 | Email |
12 | Address |
13 |
14 |
15 |
16 | {{ contact.first_name }} |
17 | {{ contact.last_name }} |
18 | {{ contact.phone }} |
19 | {{ contact.email }} |
20 | {{ contact.address }} |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/app/contact-list/contact-list.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ContactListComponent } from './contact-list.component';
4 |
5 | describe('ContactListComponent', () => {
6 | let component: ContactListComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ContactListComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ContactListComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/contact-list/contact-list.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | import { APIService } from '../api.service';
4 | @Component({
5 | selector: 'app-contact-list',
6 | templateUrl: './contact-list.component.html',
7 | styleUrls: ['./contact-list.component.css']
8 | })
9 | export class ContactListComponent implements OnInit {
10 |
11 | private contacts: Array