@nice2dev/ui-erp 1.0.11 → 1.0.12

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/dist/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import { default as default_2 } from 'react';
2
+ import { ForwardRefExoticComponent } from 'react';
3
+ import { NiceBaseProps } from '@nice2dev/ui-core';
4
+ import { RefAttributes } from 'react';
2
5
 
3
6
  export declare interface Address {
4
7
  line1: string;
@@ -49,6 +52,8 @@ export declare interface AvailabilityException {
49
52
  reason?: string;
50
53
  }
51
54
 
55
+ export declare function buildJpkXml(opts: JpkExportOptions): string;
56
+
52
57
  export declare interface Currency {
53
58
  code: string;
54
59
  symbol: string;
@@ -64,6 +69,20 @@ export declare interface DateRange {
64
69
  end: Date;
65
70
  }
66
71
 
72
+ export declare interface Employee {
73
+ id: string;
74
+ firstName: string;
75
+ lastName: string;
76
+ email?: string;
77
+ department?: string;
78
+ position?: string;
79
+ hiredAt?: Date;
80
+ fte?: number;
81
+ vacationBalanceDays?: number;
82
+ sickLeaveDaysYtd?: number;
83
+ active?: boolean;
84
+ }
85
+
67
86
  export declare interface InventoryFilters {
68
87
  categories?: string[];
69
88
  statuses?: InventoryStatus[];
@@ -130,11 +149,116 @@ export declare interface InventoryViewConfig {
130
149
  pageSize: number;
131
150
  }
132
151
 
152
+ export declare interface Invoice {
153
+ id: string;
154
+ invoiceNumber: string;
155
+ issueDate: Date;
156
+ dueDate: Date;
157
+ seller: {
158
+ name: string;
159
+ vatId?: string;
160
+ address?: Address;
161
+ };
162
+ buyer: {
163
+ name: string;
164
+ vatId?: string;
165
+ address?: Address;
166
+ };
167
+ lines: InvoiceLine[];
168
+ status: InvoiceStatus;
169
+ paymentMethod?: 'transfer' | 'card' | 'cash' | 'blik' | 'other';
170
+ notes?: string;
171
+ currency?: string;
172
+ subtotal?: Money;
173
+ vatTotal?: Money;
174
+ total?: Money;
175
+ history?: Array<{
176
+ at: Date;
177
+ status: InvoiceStatus;
178
+ by?: string;
179
+ note?: string;
180
+ }>;
181
+ }
182
+
183
+ export declare interface InvoiceLine {
184
+ id: string;
185
+ description: string;
186
+ quantity: number;
187
+ unit?: string;
188
+ unitPrice: Money;
189
+ vatRate: number;
190
+ discount?: number;
191
+ }
192
+
193
+ export declare type InvoiceStatus = 'draft' | 'issued' | 'sent' | 'paid' | 'partially-paid' | 'overdue' | 'cancelled';
194
+
195
+ export declare interface JpkExportOptions {
196
+ format: 'JPK_V7M' | 'JPK_V7K' | 'JPK_FA';
197
+ period: {
198
+ from: Date;
199
+ to: Date;
200
+ };
201
+ taxpayer: {
202
+ name: string;
203
+ nip: string;
204
+ regon?: string;
205
+ address?: Address;
206
+ };
207
+ invoices: Invoice[];
208
+ }
209
+
210
+ export declare interface MockErpApi {
211
+ loading: boolean;
212
+ error: Error | null;
213
+ invoices: Invoice[];
214
+ purchaseOrders: PurchaseOrder[];
215
+ inventory: InventoryItem[];
216
+ suppliers: Supplier[];
217
+ employees: Employee[];
218
+ resources: Resource[];
219
+ vatRates: VatRate[];
220
+ refresh: () => Promise<void>;
221
+ upsertInvoice: (invoice: Invoice) => Promise<void>;
222
+ upsertPurchaseOrder: (po: PurchaseOrder) => Promise<void>;
223
+ upsertInventory: (item: InventoryItem) => Promise<void>;
224
+ }
225
+
133
226
  export declare interface Money {
134
227
  amount: number;
135
228
  currency: Currency;
136
229
  }
137
230
 
231
+ export declare const NICE_VAT_PRESETS: Record<'PL' | 'EU' | 'UK', VatRate[]>;
232
+
233
+ export declare const NiceHRDashboard: default_2.ForwardRefExoticComponent<NiceHRDashboardProps & default_2.RefAttributes<HTMLDivElement>>;
234
+
235
+ export declare interface NiceHRDashboardProps extends NiceBaseProps {
236
+ employees: Employee[];
237
+ /** Custom widget labels. */
238
+ labels?: Partial<{
239
+ headcount: string;
240
+ fte: string;
241
+ vacationBalance: string;
242
+ sickLeave: string;
243
+ departments: string;
244
+ activeEmployees: string;
245
+ }>;
246
+ /** Hide individual widgets. */
247
+ hideWidgets?: Partial<{
248
+ headcount: boolean;
249
+ fte: boolean;
250
+ vacation: boolean;
251
+ sick: boolean;
252
+ departments: boolean;
253
+ }>;
254
+ /** Locale for number formatting. */
255
+ locale?: string;
256
+ /** Density. */
257
+ density?: 'comfortable' | 'compact';
258
+ /** Click handler for a widget — useful for drilldowns. */
259
+ onWidgetClick?: (widget: 'headcount' | 'fte' | 'vacation' | 'sick' | 'departments') => void;
260
+ }
261
+
138
262
  export declare const NiceInventoryManager: default_2.FC<NiceInventoryManagerProps>;
139
263
 
140
264
  export declare interface NiceInventoryManagerProps {
@@ -151,6 +275,84 @@ export declare interface NiceInventoryManagerProps {
151
275
  className?: string;
152
276
  }
153
277
 
278
+ export declare const NiceInvoiceView: default_2.ForwardRefExoticComponent<NiceInvoiceViewProps & default_2.RefAttributes<HTMLElement>>;
279
+
280
+ export declare interface NiceInvoiceViewProps extends NiceBaseProps {
281
+ invoice: Invoice;
282
+ /** Locale for formatting amounts and dates. */
283
+ locale?: string;
284
+ /** Currency code; falls back to `invoice.currency` then to the line currency. */
285
+ currency?: string;
286
+ /** Hide individual sections. */
287
+ hideSections?: Partial<{
288
+ header: boolean;
289
+ lines: boolean;
290
+ vat: boolean;
291
+ totals: boolean;
292
+ timeline: boolean;
293
+ notes: boolean;
294
+ }>;
295
+ /** Custom labels (i18n hook). */
296
+ labels?: Partial<{
297
+ invoiceNumber: string;
298
+ issueDate: string;
299
+ dueDate: string;
300
+ seller: string;
301
+ buyer: string;
302
+ description: string;
303
+ qty: string;
304
+ unitPrice: string;
305
+ vat: string;
306
+ net: string;
307
+ gross: string;
308
+ subtotal: string;
309
+ vatTotal: string;
310
+ total: string;
311
+ status: string;
312
+ vatBreakdown: string;
313
+ timeline: string;
314
+ notes: string;
315
+ vatId: string;
316
+ }>;
317
+ /** Optional click handler for actions (e.g. download PDF). */
318
+ onAction?: (action: 'download' | 'print' | 'send') => void;
319
+ /** Show action toolbar. Default: false. */
320
+ showActions?: boolean;
321
+ /** Density. */
322
+ density?: 'comfortable' | 'compact';
323
+ }
324
+
325
+ export declare const NiceJpkExporter: ForwardRefExoticComponent<NiceJpkExporterProps & RefAttributes<HTMLDivElement>>;
326
+
327
+ export declare interface NiceJpkExporterProps extends NiceBaseProps {
328
+ invoices: Invoice[];
329
+ taxpayer: JpkExportOptions['taxpayer'];
330
+ /** Default export format. */
331
+ defaultFormat?: JpkExportOptions['format'];
332
+ /** Default reporting period. */
333
+ defaultPeriod?: {
334
+ from: Date;
335
+ to: Date;
336
+ };
337
+ /** Custom XML builder (advanced override). */
338
+ buildXml?: (opts: JpkExportOptions) => string;
339
+ /** Called with the produced XML and Blob. */
340
+ onExport?: (xml: string, blob: Blob, opts: JpkExportOptions) => void;
341
+ /** Filename helper (default: `JPK_V7M_${YYYY}-${MM}.xml`). */
342
+ filenameFor?: (opts: JpkExportOptions) => string;
343
+ /** Custom labels. */
344
+ labels?: Partial<{
345
+ format: string;
346
+ period: string;
347
+ from: string;
348
+ to: string;
349
+ export: string;
350
+ download: string;
351
+ }>;
352
+ }
353
+
354
+ export declare const NicePurchaseOrder: ForwardRefExoticComponent<NicePurchaseOrderViewProps & RefAttributes<HTMLDivElement>>;
355
+
154
356
  export declare interface NicePurchaseOrderProps {
155
357
  orders: PurchaseOrder[];
156
358
  suppliers: Supplier[];
@@ -167,6 +369,36 @@ export declare interface NicePurchaseOrderProps {
167
369
  className?: string;
168
370
  }
169
371
 
372
+ export declare interface NicePurchaseOrderViewProps extends NicePurchaseOrderProps, NiceBaseProps {
373
+ /** Show in list+detail master/detail mode (default `true`). */
374
+ selectable?: boolean;
375
+ /** Initial selection. */
376
+ initialSelectedId?: string;
377
+ /** Locale. */
378
+ locale?: string;
379
+ /** Custom labels. */
380
+ labels?: Partial<{
381
+ orderNumber: string;
382
+ supplier: string;
383
+ status: string;
384
+ orderDate: string;
385
+ expected: string;
386
+ actual: string;
387
+ total: string;
388
+ items: string;
389
+ sku: string;
390
+ name: string;
391
+ qty: string;
392
+ received: string;
393
+ unitPrice: string;
394
+ lineTotal: string;
395
+ notes: string;
396
+ approve: string;
397
+ cancel: string;
398
+ receive: string;
399
+ }>;
400
+ }
401
+
170
402
  export declare const NiceResourceAllocation: default_2.FC<NiceResourceAllocationProps>;
171
403
 
172
404
  export declare interface NiceResourceAllocationProps {
@@ -182,6 +414,57 @@ export declare interface NiceResourceAllocationProps {
182
414
  className?: string;
183
415
  }
184
416
 
417
+ export declare const NiceVatTable: ForwardRefExoticComponent<NiceVatTableProps & RefAttributes<HTMLDivElement>>;
418
+
419
+ export declare interface NiceVatTableProps extends NiceBaseProps {
420
+ /** Country/preset (used when `rates` not supplied). */
421
+ country?: 'PL' | 'EU' | 'UK';
422
+ /** Explicit rates (override preset). */
423
+ rates?: VatRate[];
424
+ /** Allow inline editing. */
425
+ editable?: boolean;
426
+ /** Notify on rate change. */
427
+ onChange?: (rates: VatRate[]) => void;
428
+ /** Called when a row is removed. */
429
+ onRemove?: (code: string) => void;
430
+ /** Locale for percentage formatting. */
431
+ locale?: string;
432
+ /** Custom labels. */
433
+ labels?: Partial<{
434
+ code: string;
435
+ rate: string;
436
+ label: string;
437
+ description: string;
438
+ add: string;
439
+ remove: string;
440
+ }>;
441
+ /** Density. */
442
+ density?: 'comfortable' | 'compact';
443
+ }
444
+
445
+ export declare const NiceWarehouseView: default_2.ForwardRefExoticComponent<NiceWarehouseViewProps & default_2.RefAttributes<HTMLDivElement>>;
446
+
447
+ export declare interface NiceWarehouseViewProps extends NiceBaseProps {
448
+ /** Warehouse identifier (used in the title). */
449
+ warehouseName: string;
450
+ /** Cells to render. */
451
+ cells: WarehouseCell[];
452
+ /** Heat-map color stops (low → high). */
453
+ colors?: {
454
+ low: string;
455
+ mid: string;
456
+ high: string;
457
+ };
458
+ /** Click handler for a cell. */
459
+ onCellClick?: (cell: WarehouseCell) => void;
460
+ /** Show legend (default `true`). */
461
+ showLegend?: boolean;
462
+ /** Cell size in px (default 48). */
463
+ cellSize?: number;
464
+ /** Optional aisle separators every N columns. */
465
+ aisleEvery?: number;
466
+ }
467
+
185
468
  export declare interface PurchaseOrder {
186
469
  id: string;
187
470
  orderNumber: string;
@@ -276,6 +559,49 @@ export declare type TimeUnit = 'hour' | 'day' | 'week' | 'month' | 'quarter' | '
276
559
 
277
560
  export declare type TransactionType = 'receipt' | 'issue' | 'transfer' | 'adjustment' | 'return' | 'count' | 'write-off';
278
561
 
562
+ /**
563
+ * Hook returning a mock ERP API with simulated loading/error states.
564
+ * Useful for storybook stories, integration tests, and offline demos.
565
+ */
566
+ export declare function useMockErpApi(options?: UseMockErpApiOptions): MockErpApi;
567
+
568
+ export declare interface UseMockErpApiOptions {
569
+ /** Artificial latency in ms (default 300). */
570
+ latencyMs?: number;
571
+ /** Probability (0..1) that a write will reject — handy for error-state UI testing. */
572
+ errorRate?: number;
573
+ /** Seed data overrides. */
574
+ seed?: Partial<{
575
+ invoices: Invoice[];
576
+ purchaseOrders: PurchaseOrder[];
577
+ inventory: InventoryItem[];
578
+ suppliers: Supplier[];
579
+ employees: Employee[];
580
+ resources: Resource[];
581
+ vatRates: VatRate[];
582
+ }>;
583
+ }
584
+
585
+ export declare interface VatRate {
586
+ code: string;
587
+ rate: number;
588
+ label?: string;
589
+ description?: string;
590
+ appliesTo?: string[];
591
+ }
592
+
593
+ export declare interface WarehouseCell {
594
+ /** Composite location, used as React key (e.g. `A-12-3-B`). */
595
+ location: WarehouseLocation;
596
+ /** Items currently stored at the location. */
597
+ items: InventoryItem[];
598
+ /** 0..1 occupancy ratio. */
599
+ occupancy: number;
600
+ /** Optional row/col coordinates for layout. Otherwise derived from rack/aisle/shelf/bin. */
601
+ row?: number;
602
+ col?: number;
603
+ }
604
+
279
605
  export declare interface WarehouseLocation {
280
606
  warehouseId: string;
281
607
  warehouseName: string;