@qubesense/customer-farm 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/esm2020/lib/customer-farm.component.mjs +203 -0
  2. package/esm2020/lib/customer-farm.module.mjs +106 -0
  3. package/esm2020/lib/customer-farm.service.mjs +129 -0
  4. package/esm2020/lib/dependencies/customer-farm-api-urls.mjs +19 -0
  5. package/esm2020/lib/dependencies/customer-farm-model.mjs +57 -0
  6. package/esm2020/public-api.mjs +9 -0
  7. package/esm2020/qubesense-customer-farm.mjs +5 -0
  8. package/fesm2015/qubesense-customer-farm.mjs +539 -0
  9. package/fesm2015/qubesense-customer-farm.mjs.map +1 -0
  10. package/fesm2020/qubesense-customer-farm.mjs +514 -0
  11. package/fesm2020/qubesense-customer-farm.mjs.map +1 -0
  12. package/index.d.ts +5 -0
  13. package/lib/customer-farm.component.d.ts +80 -0
  14. package/lib/customer-farm.module.d.ts +24 -0
  15. package/lib/customer-farm.service.d.ts +58 -0
  16. package/lib/dependencies/customer-farm-api-urls.d.ts +9 -0
  17. package/lib/dependencies/customer-farm-model.d.ts +48 -0
  18. package/package.json +31 -11
  19. package/{src/public-api.ts → public-api.d.ts} +0 -4
  20. package/.eslintrc.json +0 -44
  21. package/karma.conf.js +0 -44
  22. package/ng-package.json +0 -7
  23. package/src/lib/customer-farm.component.html +0 -93
  24. package/src/lib/customer-farm.component.scss +0 -0
  25. package/src/lib/customer-farm.component.ts +0 -207
  26. package/src/lib/customer-farm.module.ts +0 -54
  27. package/src/lib/customer-farm.service.ts +0 -126
  28. package/src/lib/dependencies/customer-farm-api-urls.ts +0 -22
  29. package/src/lib/dependencies/customer-farm-model.ts +0 -52
  30. package/src/test.ts +0 -27
  31. package/tsconfig.lib.json +0 -15
  32. package/tsconfig.lib.prod.json +0 -10
  33. package/tsconfig.spec.json +0 -17
@@ -1,207 +0,0 @@
1
- import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2
- import { FormBuilder, FormGroup, Validators } from '@angular/forms';
3
- import { CustomerFarmConfigrationModel, CustomerFarmModel } from './dependencies/customer-farm-model';
4
- import { ErrorLogService, GridEventsModel, KendoGridviewConfigurationModel, ToastrNotificationService } from '@qubesense/base-services';
5
- import { CustomerFarmService } from './customer-farm.service';
6
-
7
- @Component({
8
- selector: 'lib-customer-farm',
9
- templateUrl: './customer-farm.component.html',
10
- styleUrls: ['./customer-farm.component.scss']
11
- })
12
- export class CustomerFarmComponent implements OnInit {
13
- @Output() customerFarmData = new EventEmitter<any>();
14
- @Input() public customerFarmConfiguration: CustomerFarmConfigrationModel = new CustomerFarmConfigrationModel();
15
- customerFarmForm: FormGroup;
16
- userMessages: string[] = [];
17
- public gridData: any[] = [];
18
- gridConfiguration: KendoGridviewConfigurationModel = new KendoGridviewConfigurationModel();
19
- hideButtons = false;
20
- isViewCall = false;
21
- speciesList: any[] = [];
22
- filteredCustomers:[];
23
-
24
- constructor(private customerFarmService: CustomerFarmService,
25
- private formBuilder: FormBuilder,
26
- private errorLogService: ErrorLogService,
27
- private toastr: ToastrNotificationService
28
- ) { }
29
-
30
- ngOnInit() {
31
- this.DeclareForm();
32
- if (this.customerFarmConfiguration.showGrid) {
33
- this.gridConfiguration.FormCode = 'CUFA';
34
- this.gridConfiguration.showModal = true;
35
- this.gridConfiguration.actions = { 'View': false, 'Edit': true, 'Delete': true, 'Generate PDF': false };
36
- this.GetListData();
37
- }
38
- }
39
-
40
- DeclareForm() {
41
- this.customerFarmForm = this.formBuilder.group({
42
- recordId : [null],
43
- customerId : [null],
44
- customerName : [null],
45
- defaultWarehouse : [null],
46
- personInCharge : [null],
47
- displayName : [null],
48
- primaryVetId : [null],
49
- PICTattoo : [null],
50
- isActive : [true]
51
- });
52
- if (this.customerFarmConfiguration.requiredCustomerFarmFields.customerName) {
53
- this.customerFarmForm.get('customerName').addValidators(Validators.required);
54
- this.customerFarmForm.get('customerName').addValidators(Validators.pattern('^[a-zA-Z ]*$'));
55
- this.customerFarmForm.get('customerName').addValidators(Validators.minLength(3));
56
- }
57
- if (this.customerFarmConfiguration.requiredCustomerFarmFields.defaultWarehouse) {
58
- this.customerFarmForm.get('defaultWarehouse').addValidators(Validators.required);
59
- }
60
- if (this.customerFarmConfiguration.requiredCustomerFarmFields.personInCharge) {
61
- this.customerFarmForm.get('personInCharge').addValidators(Validators.required);
62
- }
63
- if (this.customerFarmConfiguration.requiredCustomerFarmFields.primaryVetId) {
64
- this.customerFarmForm.get('primaryVetId').addValidators(Validators.required);
65
- }
66
- }
67
-
68
- ///////////////////////////////////standard methods/////////////////////////////////////////////////////
69
-
70
- /**
71
- * @description
72
- *
73
- * edit data list item using data item GUID
74
- *
75
- * @param customerId
76
- *
77
- * gets customer GUID from gridData and passes it to this function
78
- */
79
- async EditData(customerId:string) {
80
- const getResponse = await this.customerFarmService.GetDataById(customerId);
81
- this.customerFarmForm.controls['recordId'].setValue(getResponse.apiData.recordId);
82
- this.customerFarmForm.controls['customerId'].setValue(getResponse.apiData.customerId);
83
- this.customerFarmForm.controls['customerName'].setValue(getResponse.apiData.customerName);
84
- this.customerFarmForm.controls['defaultWarehouse'].setValue(getResponse.apiData.defaultWarehouse);
85
- this.customerFarmForm.controls['personInCharge'].setValue(getResponse.apiData.personInCharge);
86
- this.customerFarmForm.controls['displayName'].setValue(getResponse.apiData.displayName);
87
- this.customerFarmForm.controls['primaryVetId'].setValue(getResponse.apiData.primaryVetId);
88
- this.customerFarmForm.controls['PICTattoo'].setValue(getResponse.apiData.PICTattoo);
89
- this.customerFarmForm.controls['isActive'].setValue(getResponse.apiData.isActive);
90
- }
91
-
92
- /**
93
- * @description
94
- *
95
- * this method converts all form inputs into model class
96
- *
97
- * @returns model with new form values
98
- */
99
- ConvertFormToModel() {
100
- const customerFarmModel = new CustomerFarmModel();
101
- customerFarmModel.recordId = this.customerFarmForm.value.recordId;
102
- customerFarmModel.customerName = this.customerFarmForm.value.customerName;
103
- customerFarmModel.defaultWarehouse = this.customerFarmForm.value.defaultWarehouse;
104
- customerFarmModel.personInCharge = this.customerFarmForm.value.personInCharge;
105
- customerFarmModel.displayName = this.customerFarmForm.value.displayName;
106
- customerFarmModel.primaryVetId = this.customerFarmForm.value.primaryVetId;
107
- customerFarmModel.PICTattoo = this.customerFarmForm.value.PICTattoo;
108
- customerFarmModel.customerId = this.customerFarmConfiguration.customerId;
109
- customerFarmModel.formCode = this.customerFarmConfiguration.formCode;
110
-
111
- return customerFarmModel;
112
- }
113
-
114
- /**
115
- * @description
116
- * clear form data
117
- */
118
- ClearForm() {
119
- this.DeclareForm();
120
- }
121
-
122
- emitDataToParent() {
123
- let customerFarmModel = new CustomerFarmModel();
124
- customerFarmModel = this.ConvertFormToModel();
125
- this.customerFarmData.emit(customerFarmModel);
126
- }
127
-
128
- /**
129
- * @description
130
- *
131
- * Insert customer data into database
132
- */
133
- public async InsertData() {
134
- let customerFarmModel = new CustomerFarmModel();
135
- customerFarmModel = this.ConvertFormToModel();
136
- const getResponse = await this.customerFarmService.InsertData(customerFarmModel);
137
- this.userMessages = getResponse.message.userMessage;
138
- if (this.customerFarmConfiguration.userMessages) {
139
- this.toastr.ShowSuccess(this.userMessages.toString());
140
- }
141
- }
142
-
143
- /**
144
- * @description
145
- *
146
- * update customer data into database
147
- */
148
- public async UpdateData() {
149
- let customerFarmModel = new CustomerFarmModel();
150
- customerFarmModel = this.ConvertFormToModel();
151
- const getResponse = await this.customerFarmService.UpdateData(customerFarmModel);
152
- this.userMessages = getResponse.message.userMessage;
153
- if (this.customerFarmConfiguration.userMessages) {
154
- this.toastr.ShowSuccess(this.userMessages.toString());
155
- }
156
- }
157
-
158
- /**
159
- * @description
160
- *
161
- * Delete customer data into database
162
- */
163
- public async DeleteData(value) {
164
- const getResponse = await this.customerFarmService.DeleteData(value);
165
- this.userMessages = getResponse.message.userMessage;
166
- if (this.customerFarmConfiguration.userMessages) {
167
- this.toastr.ShowSuccess(this.userMessages.toString());
168
- }
169
- }
170
-
171
- /**
172
- * @description
173
- *
174
- * Grid events calls
175
- */
176
- handleGridEvents(gridEvents: GridEventsModel) {
177
- gridEvents.editRecord.subscribe((recordId) => {
178
- this.hideButtons = false;
179
- this.isViewCall = false;
180
- this.EditData(recordId);
181
- this.customerFarmForm.enable();
182
- });
183
- gridEvents.deleteRecord.subscribe((recordId) => {
184
- this.DeleteData(recordId);
185
- });
186
- gridEvents.viewRecord.subscribe(async (recordId) => {
187
- this.EditData(recordId);
188
- this.customerFarmForm.disable();
189
- });
190
- }
191
-
192
-
193
- /**
194
- * @description
195
- * get data for Customer grid list
196
- */
197
- public async GetListData() {
198
- const customerFarmModel = new CustomerFarmModel();
199
- try {
200
- const getResponse = await this.customerFarmService.GetListData(customerFarmModel);
201
- this.gridData = getResponse.apiData;
202
- } catch (error) {
203
- this.errorLogService.saveError(error);
204
- this.toastr.ShowAllErrors(error.error.message.userMessage);
205
- }
206
- }
207
- }
@@ -1,54 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { CustomerFarmComponent } from './customer-farm.component';
3
- import { MatCheckboxModule } from '@angular/material/checkbox';
4
- import { CdkStepperModule } from '@angular/cdk/stepper';
5
- import { CommonModule } from '@angular/common';
6
- import { ReactiveFormsModule, FormsModule } from '@angular/forms';
7
- import { MatButtonModule } from '@angular/material/button';
8
- import { MatOptionModule, MatNativeDateModule } from '@angular/material/core';
9
- import { MatDatepickerModule } from '@angular/material/datepicker';
10
- import { MatFormFieldModule } from '@angular/material/form-field';
11
- import { MatGridListModule } from '@angular/material/grid-list';
12
- import { MatIconModule } from '@angular/material/icon';
13
- import { MatInputModule } from '@angular/material/input';
14
- import { MatSelectModule } from '@angular/material/select';
15
- import { MatStepperModule } from '@angular/material/stepper';
16
- import { MatToolbarModule } from '@angular/material/toolbar';
17
- import { ButtonsModule } from '@progress/kendo-angular-buttons';
18
- import { GridModule, SharedModule, ExcelModule } from '@progress/kendo-angular-grid';
19
- import { KendoGridViewModule } from '@qubesense/base-services';
20
-
21
- @NgModule({
22
- declarations: [
23
- CustomerFarmComponent
24
- ],
25
- imports: [
26
- MatIconModule,
27
- MatInputModule,
28
- MatToolbarModule,
29
- ReactiveFormsModule,
30
- FormsModule,
31
- CommonModule,
32
- GridModule,
33
- ButtonsModule,
34
- MatGridListModule,
35
- MatFormFieldModule,
36
- ReactiveFormsModule,
37
- MatInputModule,
38
- MatOptionModule,
39
- MatSelectModule,
40
- MatCheckboxModule,
41
- SharedModule,
42
- MatButtonModule,
43
- MatDatepickerModule,
44
- MatNativeDateModule,
45
- ExcelModule,
46
- MatStepperModule,
47
- CdkStepperModule,
48
- KendoGridViewModule
49
- ],
50
- exports: [
51
- CustomerFarmComponent
52
- ]
53
- })
54
- export class CustomerFarmModule { }
@@ -1,126 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { DataAccessService, WebApiResult } from '@qubesense/base-services';
3
- import { CustomerFarmApiUrls } from './dependencies/customer-farm-api-urls';
4
- import { CustomerFarmModel } from './dependencies/customer-farm-model';
5
-
6
-
7
- @Injectable({
8
- providedIn: 'root'
9
- })
10
- export class CustomerFarmService {
11
-
12
- constructor(private dataAccessService: DataAccessService) { }
13
-
14
- customerFarmApiUrls = new CustomerFarmApiUrls();
15
-
16
- /**
17
- * service for get customer data by Id
18
- *
19
- * @param customerGUID
20
- *
21
- * @returns Response Data from Database
22
- */
23
- public async GetDataById(customerGUID: string): Promise<WebApiResult> {
24
- try {
25
- const url = this.customerFarmApiUrls.getCustomerFarmByIdUrl + '/' + customerGUID;
26
- const resultResponse = await this.dataAccessService.GetDataById(url);
27
- return resultResponse;
28
- } catch (error) {
29
- throw error;
30
- }
31
- }
32
-
33
- /**
34
- * service for inserting customer data into database
35
- *
36
- * @param customerFarmModel
37
- *
38
- * @returns Response message from Database
39
- */
40
- public async InsertData(customerFarmModel: CustomerFarmModel) {
41
- try {
42
- const url = this.customerFarmApiUrls.insertCustomerFarmDataUrl;
43
- const resultResponse = await this.dataAccessService.InsertData(url, customerFarmModel);
44
- return resultResponse;
45
- } catch (error) {
46
- throw error;
47
- }
48
- }
49
-
50
- /**
51
- * service for update customer Data
52
- *
53
- * @param customerFarmModel
54
- *
55
- * @returns Response message from Database
56
- */
57
- public async UpdateData(customerFarmModel: CustomerFarmModel) {
58
- try {
59
- const url = this.customerFarmApiUrls.updateCustomerFarmDataUrl;
60
- const resultResponse = await this.dataAccessService.UpdateData(url, customerFarmModel);
61
- return resultResponse;
62
- } catch (error) {
63
- throw error;
64
- }
65
- }
66
-
67
- /**
68
- * service for delete customer data by GUID
69
- *
70
- * @param customerFarmModel
71
- *
72
- * @returns Response message from Database
73
- */
74
- public async DeleteData(recordId: any) {
75
- try {
76
- const url = this.customerFarmApiUrls.deleteCustomerFarmDataUrl + '/' + recordId;
77
- const resultResponse = await this.dataAccessService.DeleteData(url);
78
- return resultResponse;
79
- }
80
- catch (error) {
81
- throw error;
82
- }
83
- }
84
-
85
- /**
86
- * service for get data for customer grid
87
- *
88
- * @param customerFarmModel
89
- *
90
- * @returns Response Data from Database
91
- */
92
- public async GetListData(customerDataModel: CustomerFarmModel) {
93
- try {
94
- const url = this.customerFarmApiUrls.getCustomerFarmListUrl;
95
- const resultResponse = await this.dataAccessService.GetListData(url, customerDataModel);
96
- return resultResponse;
97
- } catch (error) {
98
- throw error;
99
- }
100
- }
101
-
102
- /**
103
- * service for get data for customer DropDown List
104
- *
105
- * @returns
106
- */
107
- public async GetCustomersDropdownList() {
108
- try {
109
- const url = this.customerFarmApiUrls.getCustomerFarmDropdownListUrl;
110
- const resultResponse = await this.dataAccessService.GetDropdownListData(url);
111
- return resultResponse;
112
- } catch (error) {
113
- throw error;
114
- }
115
- }
116
-
117
- public async GetCustomerListByKeyword(value:string) {
118
- try {
119
- const url = this.customerFarmApiUrls.getcustomerlistbykeyword + '/' + value;
120
- const resultResponse = await this.dataAccessService.GetDataById(url);
121
- return resultResponse;
122
- } catch (error) {
123
- throw error;
124
- }
125
- }
126
- }
@@ -1,22 +0,0 @@
1
- export class CustomerFarmApiUrls {
2
- //api Url string for get data by Id
3
- getCustomerFarmByIdUrl: string = 'api/CustomerFarm/GetById';
4
-
5
- //api Url string for insert Customer data
6
- insertCustomerFarmDataUrl: string = 'api/CustomerFarm/Create';
7
-
8
- //api Url string for update Customer record
9
- updateCustomerFarmDataUrl: string = 'api/CustomerFarm/Update';
10
-
11
- //api Url string for delete Customer record
12
- deleteCustomerFarmDataUrl: string = 'api/CustomerFarm/Delete';
13
-
14
- //api Url string for get Customer list
15
- getCustomerFarmListUrl: string = 'api/CustomerFarm/GetAll';
16
-
17
- //api Url string for get Customer dropdown list
18
- getCustomerFarmDropdownListUrl: string = 'api/CustomerFarm/GetDropdownList';
19
-
20
- //api Url string for get Customer dropdown list
21
- getcustomerlistbykeyword: string = 'api/CustomerFarm/SearchCustomer';
22
- }
@@ -1,52 +0,0 @@
1
- export class CustomerFarmModel {
2
- formCode: string = null;
3
- formId: string = '';
4
- recordId: string = null;
5
- customerId: string = null;
6
- customerName: string = '';
7
- defaultWarehouse: string = '';
8
- personInCharge: string = '';
9
- displayName: string = '';
10
- primaryVetId: string = '';
11
- PICTattoo: string = '';
12
- isActive: boolean = true;
13
- isDeleted: boolean = false;
14
- }
15
-
16
- export class CustomerFarmConfigrationModel {
17
- formCode: string = null;
18
- customerId: string = null;
19
- defaultView: boolean = false;
20
- showModal: boolean = false;
21
- showGrid: boolean = false;
22
- isSearchable: boolean = false;
23
- showClientData: boolean = false;
24
- customerData: CustomerFarmModel = null;
25
- userMessages: boolean = false;
26
- requiredCustomerFarmSection: boolean = false;
27
- allowedCustomerFarmSection: boolean = false;
28
- requiredCustomerFarmFields: RequiredCustomerFarmFields = new RequiredCustomerFarmFields();
29
- allowedCustomerFarmFields: AllowedCustomerFarmFields = new AllowedCustomerFarmFields();
30
- }
31
-
32
- export class RequiredCustomerFarmFields {
33
- customerName: boolean = true;
34
- customerId: boolean = true;
35
- defaultWarehouse: boolean = true;
36
- personInCharge: boolean = true;
37
- primaryVetId: boolean = true;
38
- displayName: boolean = true;
39
- PICTattoo: boolean = false;
40
- profileImageURL: boolean = false;
41
- }
42
-
43
- export class AllowedCustomerFarmFields {
44
- customerName: boolean = true;
45
- defaultWarehouse: boolean = true;
46
- personInCharge: boolean = true;
47
- primaryVetId: boolean = true;
48
- PICTattoo: boolean = true;
49
- displayName: boolean = true;
50
- profileImageURL: boolean = false;
51
- }
52
-
package/src/test.ts DELETED
@@ -1,27 +0,0 @@
1
- // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
-
3
- import 'zone.js';
4
- import 'zone.js/testing';
5
- import { getTestBed } from '@angular/core/testing';
6
- import {
7
- BrowserDynamicTestingModule,
8
- platformBrowserDynamicTesting
9
- } from '@angular/platform-browser-dynamic/testing';
10
-
11
- declare const require: {
12
- context(path: string, deep?: boolean, filter?: RegExp): {
13
- <T>(id: string): T;
14
- keys(): string[];
15
- };
16
- };
17
-
18
- // First, initialize the Angular testing environment.
19
- getTestBed().initTestEnvironment(
20
- BrowserDynamicTestingModule,
21
- platformBrowserDynamicTesting(),
22
- );
23
-
24
- // Then we find all the tests.
25
- const context = require.context('./', true, /\.spec\.ts$/);
26
- // And load the modules.
27
- context.keys().forEach(context);
package/tsconfig.lib.json DELETED
@@ -1,15 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../out-tsc/lib",
6
- "declaration": true,
7
- "declarationMap": true,
8
- "inlineSources": true,
9
- "types": []
10
- },
11
- "exclude": [
12
- "src/test.ts",
13
- "**/*.spec.ts"
14
- ]
15
- }
@@ -1,10 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "./tsconfig.lib.json",
4
- "compilerOptions": {
5
- "declarationMap": false
6
- },
7
- "angularCompilerOptions": {
8
- "compilationMode": "partial"
9
- }
10
- }
@@ -1,17 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../out-tsc/spec",
6
- "types": [
7
- "jasmine"
8
- ]
9
- },
10
- "files": [
11
- "src/test.ts"
12
- ],
13
- "include": [
14
- "**/*.spec.ts",
15
- "**/*.d.ts"
16
- ]
17
- }