ngx-st-sap-bp 18.0.0 → 18.0.2

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.
package/README.md CHANGED
@@ -1,11 +1,592 @@
1
1
  # NgxStSapBp
2
2
 
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.2.0.
3
+ Angular components for managing SAP Business Partners (BP) with full CRUD operations.
4
4
 
5
- ## Code scaffolding
5
+ ## Table of Contents
6
+ - [Overview](#overview)
7
+ - [Installation](#installation)
8
+ - [Components](#components)
9
+ - [Models](#models)
10
+ - [Services](#services)
11
+ - [Examples](#examples)
6
12
 
7
- Run `ng generate component component-name --project ngx-st-sap-bp` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-st-sap-bp`.
8
- > Note: Don't forget to add `--project ngx-st-sap-bp` or else it will be added to the default project in your `angular.json` file.
13
+ ---
14
+
15
+ ## Overview
16
+
17
+ The `ngx-st-sap-bp` library provides a complete suite of components for managing SAP Business Partners including:
18
+ - Business Partner list with search and pagination
19
+ - Create new Business Partners
20
+ - Edit existing Business Partners
21
+ - View Business Partner details
22
+ - Manage addresses (ship-to and bill-to)
23
+ - Manage contact persons
24
+ - Support for both Customer and Vendor types
25
+
26
+ ---
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ npm install ngx-st-sap-bp
32
+ ```
33
+
34
+ Import the module in your application:
35
+
36
+ ```typescript
37
+ import { NgxStSapBpModule } from 'ngx-st-sap-bp';
38
+
39
+ @NgModule({
40
+ imports: [
41
+ NgxStSapBpModule
42
+ ]
43
+ })
44
+ export class AppModule { }
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Components
50
+
51
+ ### SapBpList
52
+
53
+ Displays a searchable, paginated list of Business Partners.
54
+
55
+ #### Selector
56
+ ```html
57
+ <ngx-st-sap-bp-list></ngx-st-sap-bp-list>
58
+ ```
59
+
60
+ #### Inputs
61
+
62
+ ##### `onlyView`
63
+ - **Type:** `boolean`
64
+ - **Default:** `false`
65
+ - **Description:** When true, hides action buttons (edit/delete).
66
+ - **Example:**
67
+ ```typescript
68
+ [onlyView]="true"
69
+ ```
70
+
71
+ ##### `userSettings` (required)
72
+ - **Type:** `SapBpUserSettings`
73
+ - **Description:** User permissions and settings for BP operations.
74
+ - **Example:**
75
+ ```typescript
76
+ [userSettings]="bpSettings"
77
+
78
+ bpSettings: SapBpUserSettings = {
79
+ canCreate: true,
80
+ canEdit: true,
81
+ canDelete: true,
82
+ defaultCountry: 'US'
83
+ };
84
+ ```
85
+
86
+ #### Features
87
+ - Search by card code or name
88
+ - Pagination with configurable page size
89
+ - Shows active/inactive status
90
+ - Displays address information
91
+ - Edit and delete actions
92
+ - Persistent page size in localStorage
93
+
94
+ #### Example
95
+
96
+ ```html
97
+ <ngx-st-sap-bp-list
98
+ [userSettings]="userSettings"
99
+ [onlyView]="false">
100
+ </ngx-st-sap-bp-list>
101
+ ```
102
+
103
+ ---
104
+
105
+ ### SapBpCreate
106
+
107
+ Form component for creating new Business Partners.
108
+
109
+ #### Selector
110
+ ```html
111
+ <ngx-st-sap-bp-create></ngx-st-sap-bp-create>
112
+ ```
113
+
114
+ #### Features
115
+ - Complete BP creation form
116
+ - Customer and Vendor type selection
117
+ - Address management
118
+ - Contact person management
119
+ - Validation
120
+ - Tax configuration
121
+
122
+ #### Example
123
+
124
+ ```html
125
+ <ngx-st-sap-bp-create
126
+ (created)="onBpCreated($event)">
127
+ </ngx-st-sap-bp-create>
128
+ ```
129
+
130
+ ```typescript
131
+ onBpCreated(bp: SapBpModel): void {
132
+ this.router.navigate(['/bp', bp.cardCode]);
133
+ }
134
+ ```
135
+
136
+ ---
137
+
138
+ ### SapBpEdit
139
+
140
+ Form component for editing existing Business Partners.
141
+
142
+ #### Selector
143
+ ```html
144
+ <ngx-st-sap-bp-edit></ngx-st-sap-bp-edit>
145
+ ```
146
+
147
+ #### Features
148
+ - Edit all BP fields
149
+ - Update addresses
150
+ - Update contact persons
151
+ - Activate/deactivate BP
152
+ - Validation
153
+
154
+ #### Example
155
+
156
+ ```html
157
+ <ngx-st-sap-bp-edit
158
+ [cardCode]="selectedBpCode"
159
+ (updated)="onBpUpdated($event)">
160
+ </ngx-st-sap-bp-edit>
161
+ ```
162
+
163
+ ---
164
+
165
+ ### SapBpDetails
166
+
167
+ Read-only view of Business Partner details.
168
+
169
+ #### Selector
170
+ ```html
171
+ <ngx-st-sap-bp-details></ngx-st-sap-bp-details>
172
+ ```
173
+
174
+ #### Features
175
+ - Display all BP information
176
+ - Show addresses
177
+ - Show contact persons
178
+ - Export/print functionality
179
+
180
+ #### Example
181
+
182
+ ```html
183
+ <ngx-st-sap-bp-details
184
+ [cardCode]="bpCode">
185
+ </ngx-st-sap-bp-details>
186
+ ```
187
+
188
+ ---
189
+
190
+ ### SapBpListAddress
191
+
192
+ List and manage Business Partner addresses.
193
+
194
+ #### Selector
195
+ ```html
196
+ <ngx-st-sap-bp-list-address></ngx-st-sap-bp-list-address>
197
+ ```
198
+
199
+ #### Features
200
+ - Display ship-to addresses
201
+ - Display bill-to addresses
202
+ - Add new addresses
203
+ - Edit existing addresses
204
+ - Delete addresses
205
+ - Set default address
206
+
207
+ ---
208
+
209
+ ### SapBpCreateAddress
210
+
211
+ Dialog component for creating new addresses.
212
+
213
+ #### Selector
214
+ Used as a dialog component via MatDialog.
215
+
216
+ #### Features
217
+ - Address type selection (ship-to/bill-to)
218
+ - Complete address form
219
+ - Country/state selection
220
+ - Address validation
221
+
222
+ ---
223
+
224
+ ### SapBpDetailsAddress
225
+
226
+ View address details in read-only mode.
227
+
228
+ #### Selector
229
+ ```html
230
+ <ngx-st-sap-bp-details-address></ngx-st-sap-bp-details-address>
231
+ ```
232
+
233
+ ---
234
+
235
+ ### SapBpListContactPerson
236
+
237
+ List and manage contact persons for a Business Partner.
238
+
239
+ #### Selector
240
+ ```html
241
+ <ngx-st-sap-bp-list-contact-person></ngx-st-sap-bp-list-contact-person>
242
+ ```
243
+
244
+ #### Features
245
+ - Display all contact persons
246
+ - Add new contacts
247
+ - Edit existing contacts
248
+ - Delete contacts
249
+ - Primary contact designation
250
+
251
+ ---
252
+
253
+ ### SapBpCreateContactPerson
254
+
255
+ Dialog component for creating contact persons.
256
+
257
+ #### Features
258
+ - Name and title
259
+ - Email and phone
260
+ - Position
261
+ - Primary contact flag
262
+
263
+ ---
264
+
265
+ ### SapBpDetailsContactPerson
266
+
267
+ View contact person details.
268
+
269
+ ---
270
+
271
+ ## Models
272
+
273
+ ### SapBpModel
274
+
275
+ Main Business Partner model:
276
+
277
+ ```typescript
278
+ interface SapBpModel {
279
+ cardCode: string; // Unique identifier
280
+ cardName: string; // BP name
281
+ cardType: 'C' | 'S'; // Customer or Supplier
282
+ active: 'Y' | 'N'; // Active status
283
+ cardForeignName: string; // Foreign name
284
+ groupCode: number; // BP group
285
+ currency: string; // Default currency
286
+ phone1: string; // Primary phone
287
+ phone2: string; // Secondary phone
288
+ fax: string; // Fax number
289
+ emailAddress: string; // Email
290
+ website: string; // Website URL
291
+ remarks: string; // Notes/remarks
292
+
293
+ // Address lists
294
+ billToAddresses: SapBpAddressModel[];
295
+ shipToAddresses: SapBpAddressModel[];
296
+
297
+ // Contact persons
298
+ contactPersons: SapBpContactPersonModel[];
299
+
300
+ // Tax & financial
301
+ taxId: string; // Tax ID number
302
+ taxType: BpTaxTypeEnum; // Tax type
303
+ paymentTerms: number; // Payment terms code
304
+ priceList: number; // Price list ID
305
+
306
+ // Sales
307
+ salesEmployee: number; // Sales person code
308
+ territory: number; // Territory code
309
+
310
+ // Additional
311
+ industry: number; // Industry code
312
+ sicCode: string; // SIC classification
313
+ }
314
+ ```
315
+
316
+ ### SapBpAddressModel
317
+
318
+ ```typescript
319
+ interface SapBpAddressModel {
320
+ addressName: string; // Address identifier
321
+ street: string; // Street address
322
+ city: string; // City
323
+ county: string; // County
324
+ country: string; // Country code
325
+ state: string; // State code
326
+ zipCode: string; // Postal code
327
+ addressType: 'B' | 'S'; // Bill-to or Ship-to
328
+
329
+ // Contact at address
330
+ contactPerson: string;
331
+ phone1: string;
332
+ phone2: string;
333
+ fax: string;
334
+ email: string;
335
+ }
336
+ ```
337
+
338
+ ### SapBpContactPersonModel
339
+
340
+ ```typescript
341
+ interface SapBpContactPersonModel {
342
+ cardCode: string; // BP code
343
+ name: string; // Contact name
344
+ position: string; // Job title/position
345
+ phone1: string; // Primary phone
346
+ phone2: string; // Secondary phone
347
+ mobilePhone: string; // Mobile number
348
+ fax: string; // Fax number
349
+ email: string; // Email address
350
+ remarks: string; // Notes
351
+ isPrimary: boolean; // Primary contact flag
352
+ }
353
+ ```
354
+
355
+ ### SapBpUserSettings
356
+
357
+ ```typescript
358
+ interface SapBpUserSettings {
359
+ canCreate: boolean; // Can create new BPs
360
+ canEdit: boolean; // Can edit BPs
361
+ canDelete: boolean; // Can delete BPs
362
+ defaultCountry: string; // Default country code
363
+ defaultCurrency: string; // Default currency
364
+ defaultPaymentTerms: number; // Default payment terms
365
+ defaultPriceList: number; // Default price list
366
+ }
367
+ ```
368
+
369
+ ---
370
+
371
+ ## Services
372
+
373
+ ### SapBpService
374
+
375
+ Main service for Business Partner operations.
376
+
377
+ #### Methods
378
+
379
+ ##### `getList(page: number, pageSize: number, code?: string, name?: string): Observable<SapBpListResponse>`
380
+ Get paginated list of Business Partners.
381
+
382
+ ##### `getById(cardCode: string): Observable<SapBpModel>`
383
+ Get single Business Partner by code.
384
+
385
+ ##### `create(bp: SapBpCreateModel): Observable<SapBpModel>`
386
+ Create new Business Partner.
387
+
388
+ ##### `update(cardCode: string, bp: SapBpEditModel): Observable<SapBpModel>`
389
+ Update existing Business Partner.
390
+
391
+ ##### `delete(cardCode: string): Observable<void>`
392
+ Delete Business Partner.
393
+
394
+ ##### `getAddresses(cardCode: string): Observable<SapBpAddressModel[]>`
395
+ Get all addresses for a BP.
396
+
397
+ ##### `createAddress(cardCode: string, address: SapBpAddressModel): Observable<void>`
398
+ Add new address to BP.
399
+
400
+ ##### `getContactPersons(cardCode: string): Observable<SapBpContactPersonModel[]>`
401
+ Get all contact persons for a BP.
402
+
403
+ ##### `createContactPerson(cardCode: string, contact: SapBpContactPersonModel): Observable<void>`
404
+ Add new contact person to BP.
405
+
406
+ ---
407
+
408
+ ### SapBpHelperService
409
+
410
+ Helper service for dropdown data.
411
+
412
+ #### Methods
413
+
414
+ ##### `getCountries(): Observable<SapBpAddrCountryModel[]>`
415
+ Get list of countries.
416
+
417
+ ##### `getStates(countryCode: string): Observable<SapBpAddrStateModel[]>`
418
+ Get states for a country.
419
+
420
+ ##### `getPaymentTerms(): Observable<SapBpPaymentTermsModel[]>`
421
+ Get payment terms list.
422
+
423
+ ##### `getPriceLists(): Observable<SapBpPricelistModel[]>`
424
+ Get price lists.
425
+
426
+ ##### `getSalesEmployees(): Observable<SapBpSalesEmployeeModel[]>`
427
+ Get sales employees.
428
+
429
+ ##### `getTerritories(): Observable<SapBpTerritoryModel[]>`
430
+ Get territories.
431
+
432
+ ---
433
+
434
+ ## Examples
435
+
436
+ ### Basic Business Partner List
437
+
438
+ ```html
439
+ <mat-card>
440
+ <mat-card-header>
441
+ <mat-card-title>Business Partners</mat-card-title>
442
+ </mat-card-header>
443
+ <mat-card-content>
444
+ <ngx-st-sap-bp-list
445
+ [userSettings]="userSettings">
446
+ </ngx-st-sap-bp-list>
447
+ </mat-card-content>
448
+ </mat-card>
449
+ ```
450
+
451
+ ```typescript
452
+ export class BpListComponent {
453
+ userSettings: SapBpUserSettings = {
454
+ canCreate: true,
455
+ canEdit: true,
456
+ canDelete: true,
457
+ defaultCountry: 'US',
458
+ defaultCurrency: 'USD',
459
+ defaultPaymentTerms: 1,
460
+ defaultPriceList: 1
461
+ };
462
+ }
463
+ ```
464
+
465
+ ### Create New Business Partner
466
+
467
+ ```html
468
+ <mat-dialog-content>
469
+ <ngx-st-sap-bp-create
470
+ (created)="onCreated($event)"
471
+ (cancelled)="onCancelled()">
472
+ </ngx-st-sap-bp-create>
473
+ </mat-dialog-content>
474
+ ```
475
+
476
+ ```typescript
477
+ export class CreateBpDialogComponent {
478
+ constructor(
479
+ private dialogRef: MatDialogRef<CreateBpDialogComponent>,
480
+ private snackBar: MatSnackBar
481
+ ) {}
482
+
483
+ onCreated(bp: SapBpModel): void {
484
+ this.snackBar.open(`Business Partner ${bp.cardCode} created successfully`, 'Close');
485
+ this.dialogRef.close(bp);
486
+ }
487
+
488
+ onCancelled(): void {
489
+ this.dialogRef.close();
490
+ }
491
+ }
492
+ ```
493
+
494
+ ### Edit Business Partner
495
+
496
+ ```html
497
+ <div class="edit-bp-container">
498
+ <h2>Edit Business Partner: {{ cardCode }}</h2>
499
+
500
+ <ngx-st-sap-bp-edit
501
+ [cardCode]="cardCode"
502
+ (updated)="onUpdated($event)"
503
+ (cancelled)="goBack()">
504
+ </ngx-st-sap-bp-edit>
505
+ </div>
506
+ ```
507
+
508
+ ```typescript
509
+ export class EditBpComponent implements OnInit {
510
+ cardCode: string;
511
+
512
+ constructor(
513
+ private route: ActivatedRoute,
514
+ private router: Router,
515
+ private snackBar: MatSnackBar
516
+ ) {}
517
+
518
+ ngOnInit() {
519
+ this.cardCode = this.route.snapshot.params['code'];
520
+ }
521
+
522
+ onUpdated(bp: SapBpModel): void {
523
+ this.snackBar.open('Business Partner updated successfully', 'Close');
524
+ this.router.navigate(['/bp', bp.cardCode]);
525
+ }
526
+
527
+ goBack(): void {
528
+ this.router.navigate(['/bp']);
529
+ }
530
+ }
531
+ ```
532
+
533
+ ### Business Partner Details with Tabs
534
+
535
+ ```html
536
+ <mat-card>
537
+ <mat-card-header>
538
+ <mat-card-title>{{ bp?.cardName }}</mat-card-title>
539
+ <mat-card-subtitle>Code: {{ bp?.cardCode }}</mat-card-subtitle>
540
+ </mat-card-header>
541
+
542
+ <mat-card-content>
543
+ <mat-tab-group>
544
+ <mat-tab label="Details">
545
+ <ngx-st-sap-bp-details
546
+ [cardCode]="cardCode">
547
+ </ngx-st-sap-bp-details>
548
+ </mat-tab>
549
+
550
+ <mat-tab label="Addresses">
551
+ <ngx-st-sap-bp-list-address
552
+ [cardCode]="cardCode">
553
+ </ngx-st-sap-bp-list-address>
554
+ </mat-tab>
555
+
556
+ <mat-tab label="Contacts">
557
+ <ngx-st-sap-bp-list-contact-person
558
+ [cardCode]="cardCode">
559
+ </ngx-st-sap-bp-list-contact-person>
560
+ </mat-tab>
561
+ </mat-tab-group>
562
+ </mat-card-content>
563
+
564
+ <mat-card-actions>
565
+ <button mat-button (click)="edit()">Edit</button>
566
+ <button mat-button color="warn" (click)="delete()">Delete</button>
567
+ </mat-card-actions>
568
+ </mat-card>
569
+ ```
570
+
571
+ ### Read-Only View
572
+
573
+ ```html
574
+ <ngx-st-sap-bp-list
575
+ [onlyView]="true"
576
+ [userSettings]="viewOnlySettings">
577
+ </ngx-st-sap-bp-list>
578
+ ```
579
+
580
+ ```typescript
581
+ viewOnlySettings: SapBpUserSettings = {
582
+ canCreate: false,
583
+ canEdit: false,
584
+ canDelete: false,
585
+ defaultCountry: 'US'
586
+ };
587
+ ```
588
+
589
+ ---
9
590
 
10
591
  ## Build
11
592
 
@@ -15,10 +596,3 @@ Run `ng build ngx-st-sap-bp` to build the project. The build artifacts will be s
15
596
 
16
597
  After building your library with `ng build ngx-st-sap-bp`, go to the dist folder `cd dist/ngx-st-sap-bp` and run `npm publish`.
17
598
 
18
- ## Running unit tests
19
-
20
- Run `ng test ngx-st-sap-bp` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
- ## Further help
23
-
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.