ubk.erp.webpack 1.4.1 → 1.4.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 +70 -15
- package/dist/Layout/HumanResource/StaffDirectory/Pages/StaffDirectoryPage.d.ts +3 -1
- package/dist/Layout/HumanResource/StaffDirectory/StaffDirectory.d.ts +3 -1
- package/dist/Layout/HumanResource/StaffWizard/StaffWizard copy.d.ts +8 -0
- package/dist/Layout/HumanResource/StaffWizard/StaffWizard.d.ts +2 -1
- package/dist/index.cjs +16 -16
- package/dist/index.js +5907 -5838
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -562,9 +562,9 @@ const LibraryPage = ({ token }) => {
|
|
|
562
562
|
import { AddStaff } from "ubk.erp.webpack";
|
|
563
563
|
|
|
564
564
|
const AddStaffPage = ({ token }) => {
|
|
565
|
-
const handleFinished = () => {
|
|
565
|
+
const handleFinished = (rec) => {
|
|
566
566
|
// Optionally refresh staff list or show a notification
|
|
567
|
-
console.log("Staff created successfully");
|
|
567
|
+
console.log("Staff created successfully",rec);
|
|
568
568
|
};
|
|
569
569
|
|
|
570
570
|
return <AddStaff token={token} onFinished={handleFinished} />;
|
|
@@ -602,7 +602,65 @@ const AddStaffPage = ({ token }) => {
|
|
|
602
602
|
| `Shift` | Shift master. |
|
|
603
603
|
| `StaffDailyAttendance` | Daily attendance report + print. |
|
|
604
604
|
| `PayrollReceiptDetails` | Payroll receipt details (page/component). |
|
|
605
|
-
| `StaffWizard` | Multi-step staff creation/edit wizard with `
|
|
605
|
+
| `StaffWizard` | Multi-step staff creation/edit wizard with `onStepComplete` callback per step. |
|
|
606
|
+
| `StaffDirectory` | Staff list with search, edit (drawer), and delete/deactivate actions. |
|
|
607
|
+
|
|
608
|
+
# 📚 StaffDirectory — Edit & Delete Callbacks
|
|
609
|
+
|
|
610
|
+
`StaffDirectory` supports several callback props for integration with parent components:
|
|
611
|
+
|
|
612
|
+
## Props
|
|
613
|
+
|
|
614
|
+
| Prop | Type | Required | Description |
|
|
615
|
+
| :--- | :--- | :--- | :--- |
|
|
616
|
+
| `token` | `string` | Yes | Authentication token for API requests. |
|
|
617
|
+
| `onNavigate` | `(action: string, record: object) => void` | No | Called when the Edit button is clicked. Receives `("staff-edit", record)`. If provided, the parent handles navigation. |
|
|
618
|
+
| `onFinished` | `(res: any) => void` | No | Called after the wizard (edit drawer) completes successfully. |
|
|
619
|
+
| `onDelete` | `(payload: DeletePayload) => void` | No | Called after a staff member is deactivated. |
|
|
620
|
+
|
|
621
|
+
## DeletePayload Shape
|
|
622
|
+
|
|
623
|
+
```ts
|
|
624
|
+
{
|
|
625
|
+
id: string | number;
|
|
626
|
+
record: object; // The full staff record
|
|
627
|
+
response: any; // API response from the delete/deactivate endpoint
|
|
628
|
+
}
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
## Behavior
|
|
632
|
+
|
|
633
|
+
- Clicking the **Edit** button: if `onNavigate` is provided, it calls `onNavigate("staff-edit", record)`. Otherwise, opens an inline edit drawer with `StaffWizard` in `mode="edit"`.
|
|
634
|
+
- Clicking **Delete/Deactivate**: sends a deactivate request to the API. On success, refreshes the list and calls `onDelete({ id, record, response })`.
|
|
635
|
+
- `onFinished` fires after the edit wizard completes successfully, allowing the parent to refresh its own data.
|
|
636
|
+
|
|
637
|
+
## Usage
|
|
638
|
+
|
|
639
|
+
```jsx
|
|
640
|
+
import { StaffDirectory } from "ubk.erp.webpack";
|
|
641
|
+
|
|
642
|
+
const StaffPage = ({ token }) => {
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
const handleFinished = (res) => {
|
|
646
|
+
console.log("Staff updated:", res);
|
|
647
|
+
// Refresh external data
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
const handleDelete = (payload) => {
|
|
651
|
+
console.log("Staff deactivated:", payload);
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
return (
|
|
655
|
+
<StaffDirectory
|
|
656
|
+
token={token}
|
|
657
|
+
|
|
658
|
+
onFinished={handleFinished}
|
|
659
|
+
onDelete={handleDelete}
|
|
660
|
+
/>
|
|
661
|
+
);
|
|
662
|
+
};
|
|
663
|
+
```
|
|
606
664
|
|
|
607
665
|
# 📚 StaffWizard — Return Callback
|
|
608
666
|
|
|
@@ -615,34 +673,31 @@ const AddStaffPage = ({ token }) => {
|
|
|
615
673
|
| `token` | `string` | Yes | Authentication token for API requests. |
|
|
616
674
|
| `mode` | `'add' \| 'edit'` | No | Determines whether basic info is edited or created. Default: `"add"`. |
|
|
617
675
|
| `staffId` | `string` | No | Staff ID when editing; ignored when `mode="add"`. |
|
|
676
|
+
| `onStepComplete` | `(payload: object) => void` | No | Called after **every** step's successful save. |
|
|
618
677
|
| `onFinished` | `() => void` | No | Called after the final (Payroll) step completes. |
|
|
619
|
-
| `onReturn` | `(payload: object) => void` | No | Called after **every** step's successful save. |
|
|
620
678
|
|
|
621
679
|
## Payload Shape
|
|
622
680
|
|
|
623
|
-
The `
|
|
681
|
+
The `onStepComplete` callback receives an object:
|
|
624
682
|
|
|
625
683
|
```ts
|
|
626
684
|
{
|
|
627
685
|
step: "basic" | "experience" | "payroll";
|
|
628
|
-
staffId: string | null;
|
|
629
686
|
data?: object; // Step-specific data
|
|
630
|
-
result?: object; // API response (experience step only)
|
|
631
687
|
}
|
|
632
688
|
```
|
|
633
689
|
|
|
634
690
|
| Step | `data` contents |
|
|
635
691
|
| :--- | :--- |
|
|
636
|
-
| `"basic"` | `{
|
|
637
|
-
| `"experience"` | `
|
|
638
|
-
| `"payroll"` | `{
|
|
692
|
+
| `"basic"` | `{ staffId, basic }` from Step1's `onSubmitted` |
|
|
693
|
+
| `"experience"` | `{ experience, result }` from Step2's `onSubmitted` |
|
|
694
|
+
| `"payroll"` | `{ payroll, result }` from Step3's `onSubmitted` |
|
|
639
695
|
|
|
640
696
|
## Behavior
|
|
641
697
|
|
|
642
|
-
- `
|
|
698
|
+
- `onStepComplete` is only called when the step's API responds with `Status === "Success"`.
|
|
643
699
|
- It is **not** called if the API returns `Failed` or throws an error.
|
|
644
|
-
-
|
|
645
|
-
- `onFinished` is still called at the end (after the Payroll step) for backward compatibility.
|
|
700
|
+
- `onFinished` is called after the Payroll step completes (and also calls `onStepComplete` for the `"payroll"` step).
|
|
646
701
|
|
|
647
702
|
## Usage
|
|
648
703
|
|
|
@@ -650,7 +705,7 @@ The `onReturn` callback receives an object:
|
|
|
650
705
|
import { StaffWizard } from "ubk.erp.webpack";
|
|
651
706
|
|
|
652
707
|
const StaffPage = ({ token }) => {
|
|
653
|
-
const
|
|
708
|
+
const handleStepComplete = (payload) => {
|
|
654
709
|
console.log("Step completed:", payload.step, payload);
|
|
655
710
|
};
|
|
656
711
|
|
|
@@ -662,7 +717,7 @@ const StaffPage = ({ token }) => {
|
|
|
662
717
|
<StaffWizard
|
|
663
718
|
token={token}
|
|
664
719
|
mode="add"
|
|
665
|
-
|
|
720
|
+
onStepComplete={handleStepComplete}
|
|
666
721
|
onFinished={handleFinished}
|
|
667
722
|
/>
|
|
668
723
|
);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export default StaffDirectoryPage;
|
|
3
|
-
declare function StaffDirectoryPage({ token, onNavigate }: {
|
|
3
|
+
declare function StaffDirectoryPage({ token, onNavigate, onFinished, onDelete, }: {
|
|
4
4
|
token: any;
|
|
5
5
|
onNavigate: any;
|
|
6
|
+
onFinished: any;
|
|
7
|
+
onDelete: any;
|
|
6
8
|
}): React.JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export default StaffDirectory;
|
|
3
|
-
declare function StaffDirectory({ token, onNavigate }: {
|
|
3
|
+
declare function StaffDirectory({ token, onNavigate, onFinished, onDelete }: {
|
|
4
4
|
token: any;
|
|
5
5
|
onNavigate: any;
|
|
6
|
+
onFinished: any;
|
|
7
|
+
onDelete: any;
|
|
6
8
|
}): React.JSX.Element;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export default StaffWizard;
|
|
3
|
-
declare function StaffWizard({ token, mode, staffId: staffIdProp, onFinished }: {
|
|
3
|
+
declare function StaffWizard({ token, mode, staffId: staffIdProp, onStepComplete, onFinished, }: {
|
|
4
4
|
token: any;
|
|
5
5
|
mode?: string | undefined;
|
|
6
6
|
staffId: any;
|
|
7
|
+
onStepComplete: any;
|
|
7
8
|
onFinished: any;
|
|
8
9
|
}): React.JSX.Element;
|