ubk.erp.webpack 1.4.3 → 1.4.5

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
@@ -237,6 +237,7 @@ import {
237
237
  Sms,
238
238
  SmsSetting,
239
239
  SmsAlertSetting,
240
+ RolePermission,
240
241
  } from "ubk.erp.webpack";
241
242
 
242
243
  const GeneralSettingPage = ({ token }) => {
@@ -255,6 +256,10 @@ const GeneralSettingPage = ({ token }) => {
255
256
  <Sms token={token} />
256
257
  <SmsSetting token={token} />
257
258
  <SmsAlertSetting token={token} />
259
+ <RolePermission
260
+ token={token}
261
+ onSaved={({ roleId, response }) => console.log("Permissions saved for role", roleId, response)}
262
+ />
258
263
  </>
259
264
  );
260
265
  };
@@ -562,15 +567,22 @@ const LibraryPage = ({ token }) => {
562
567
  import { AddStaff } from "ubk.erp.webpack";
563
568
 
564
569
  const AddStaffPage = ({ token }) => {
570
+ const handleStepComplete = (payload) => {
571
+ // Fires after Basic, Experience and Payroll each save successfully
572
+ console.log("Step saved:", payload.step, payload.staffId, payload.data);
573
+ };
574
+
565
575
  const handleFinished = (rec) => {
566
- // Optionally refresh staff list or show a notification
567
- console.log("Staff created successfully",rec);
576
+ // Fires once, after the final (Payroll) step saves
577
+ console.log("Staff created successfully", rec.staffId, rec);
568
578
  };
569
579
 
570
- return <AddStaff token={token} onFinished={handleFinished} />;
580
+ return <AddStaff token={token} onStepComplete={handleStepComplete} onFinished={handleFinished} />;
571
581
  };
572
582
  ```
573
583
 
584
+ `AddStaff` accepts the same callbacks as `StaffWizard` (`onStepComplete`, `onReturn`, `onFinished`) — see **StaffWizard — Return Callback** below. `onFinished` is only called after all three steps are saved.
585
+
574
586
  ### Store
575
587
 
576
588
  | Component | Description |
@@ -617,6 +629,7 @@ const AddStaffPage = ({ token }) => {
617
629
  | `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
630
  | `onFinished` | `(res: any) => void` | No | Called after the wizard (edit drawer) completes successfully. |
619
631
  | `onDelete` | `(payload: DeletePayload) => void` | No | Called after a staff member is deactivated. |
632
+ | `onPasswordChange` | `(payload: PasswordChangePayload) => void` | No | Called after a staff member's password is changed successfully. Receives `{ id, password, record, response }` — `password` is the new password as entered, `response` is the API response from `updateStaffPassword`. |
620
633
 
621
634
  ## DeletePayload Shape
622
635
 
@@ -632,6 +645,7 @@ const AddStaffPage = ({ token }) => {
632
645
 
633
646
  - 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
647
  - Clicking **Delete/Deactivate**: sends a deactivate request to the API. On success, refreshes the list and calls `onDelete({ id, record, response })`.
648
+ - Clicking **Change password** (key icon): opens a modal with New Password + Confirm Password. On save it posts `{ staff_id, new_passwod }` to `api/branchapi/staff/updateStaffPassword` (override with `VITE_HR_STAFF_CHANGE_PASSWORD_URL`), then calls `onPasswordChange({ id, password, record, response })`.
635
649
  - `onFinished` fires after the edit wizard completes successfully, allowing the parent to refresh its own data.
636
650
 
637
651
  ## Usage
@@ -674,24 +688,26 @@ const StaffPage = ({ token }) => {
674
688
  | `mode` | `'add' \| 'edit'` | No | Determines whether basic info is edited or created. Default: `"add"`. |
675
689
  | `staffId` | `string` | No | Staff ID when editing; ignored when `mode="add"`. |
676
690
  | `onStepComplete` | `(payload: object) => void` | No | Called after **every** step's successful save. |
677
- | `onFinished` | `() => void` | No | Called after the final (Payroll) step completes. |
691
+ | `onReturn` | `(payload: object) => void` | No | Alias of `onStepComplete` — receives the same payload. |
692
+ | `onFinished` | `(result: object) => void` | No | Called after the final (Payroll) step completes. Receives `{ staffId, payroll, result, data }`. |
678
693
 
679
694
  ## Payload Shape
680
695
 
681
- The `onStepComplete` callback receives an object:
696
+ The `onStepComplete` / `onReturn` callback receives an object:
682
697
 
683
698
  ```ts
684
699
  {
685
700
  step: "basic" | "experience" | "payroll";
686
- data?: object; // Step-specific data
701
+ staffId: string | number | null; // id of the staff being created/edited
702
+ data: object; // Step-specific data (below)
687
703
  }
688
704
  ```
689
705
 
690
706
  | Step | `data` contents |
691
707
  | :--- | :--- |
692
- | `"basic"` | `{ staffId, basic }` from Step1's `onSubmitted` |
693
- | `"experience"` | `{ experience, result }` from Step2's `onSubmitted` |
694
- | `"payroll"` | `{ payroll, result }` from Step3's `onSubmitted` |
708
+ | `"basic"` | `{ staffId, basic, data }` from Step1 (`data` = raw API response) |
709
+ | `"experience"` | `{ experience, result, data }` from Step2 |
710
+ | `"payroll"` | `{ payroll, result, data }` from Step3 |
695
711
 
696
712
  ## Behavior
697
713
 
@@ -767,6 +783,7 @@ const ApplyLeavePage = ({ token }) => {
767
783
  | `PaymentGateway` | Payment gateway credentials and integration settings. |
768
784
  | `SmsSetting` | SMS gateway details (API key, URL, header key) with edit/view toggle. |
769
785
  | `SmsAlertSetting` | SMS alert settings — gateway configuration, template CRUD, and status toggling. |
786
+ | `RolePermission` | Pick a role, then tick Add / Edit / View / Delete per submenu (grouped by menu, with per-column select-all) and save. Also adds new roles. Optional `onSaved({ roleId, response })` callback after a successful save. |
770
787
 
771
788
  ### Communicate
772
789
 
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export default RolePermissionPage;
3
+ declare function RolePermissionPage({ token, onSaved }: {
4
+ token: any;
5
+ onSaved: any;
6
+ }): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export default RolePermission;
3
+ declare function RolePermission({ token, onSaved }: {
4
+ token: any;
5
+ onSaved: any;
6
+ }): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ export const rolePermissionEndpoints: {
2
+ roleDropdown: any;
3
+ addRole: any;
4
+ menuAndSubmenu: any;
5
+ save: any;
6
+ };
@@ -0,0 +1 @@
1
+ export { default } from './RolePermission';
@@ -54,23 +54,30 @@ export namespace endpoints {
54
54
  export { remove_2 as remove };
55
55
  export let byId: any;
56
56
  }
57
+ namespace rolePermission {
58
+ export let roleDropdown: any;
59
+ export let addRole: any;
60
+ export let menuAndSubmenu: any;
61
+ let save_3: any;
62
+ export { save_3 as save };
63
+ }
57
64
  namespace paymentGateway {
58
65
  let get_4: any;
59
66
  export { get_4 as get };
60
- let save_3: any;
61
- export { save_3 as save };
67
+ let save_4: any;
68
+ export { save_4 as save };
62
69
  }
63
70
  namespace smsGateway {
64
71
  let get_5: any;
65
72
  export { get_5 as get };
66
- let save_4: any;
67
- export { save_4 as save };
73
+ let save_5: any;
74
+ export { save_5 as save };
68
75
  }
69
76
  namespace smsDetails {
70
77
  let get_6: any;
71
78
  export { get_6 as get };
72
- let save_5: any;
73
- export { save_5 as save };
79
+ let save_6: any;
80
+ export { save_6 as save };
74
81
  }
75
82
  namespace smsTemplates {
76
83
  let table_2: any;
@@ -90,7 +97,8 @@ export namespace endpoints {
90
97
  let classDropdown_1: any;
91
98
  export { classDropdown_1 as classDropdown };
92
99
  export let sectionByClass: any;
93
- export let roleDropdown: any;
100
+ let roleDropdown_1: any;
101
+ export { roleDropdown_1 as roleDropdown };
94
102
  export let staffSearch: any;
95
103
  export let studentDropdown: any;
96
104
  export let sendMessage: any;
@@ -104,8 +112,8 @@ export namespace endpoints {
104
112
  export { classDropdown_2 as classDropdown };
105
113
  let sectionByClass_1: any;
106
114
  export { sectionByClass_1 as sectionByClass };
107
- let roleDropdown_1: any;
108
- export { roleDropdown_1 as roleDropdown };
115
+ let roleDropdown_2: any;
116
+ export { roleDropdown_2 as roleDropdown };
109
117
  }
110
118
  function getMessages(whatsappBaseUrl: any): string;
111
119
  function getSendMessages(whatsappBaseUrl: any): string;
@@ -12,3 +12,4 @@ export { default as PaymentGateway } from './PaymentGateway';
12
12
  export { default as Sms } from './Sms';
13
13
  export { default as SmsAlertSetting } from './SmsAlertSetting';
14
14
  export { default as SmsSetting } from './SmsSetting';
15
+ export { default as RolePermission } from './RolePermission';
@@ -1,7 +1,8 @@
1
1
  import { default as React } from 'react';
2
2
  export default AddStaff;
3
- declare function AddStaff({ token, onFinished, onReturn }: {
3
+ declare function AddStaff({ token, onStepComplete, onFinished, onReturn }: {
4
4
  token: any;
5
+ onStepComplete: any;
5
6
  onFinished: any;
6
7
  onReturn: any;
7
8
  }): React.JSX.Element;
@@ -1,7 +1,8 @@
1
1
  import { default as React } from 'react';
2
2
  export default AddStaffPage;
3
- declare function AddStaffPage({ token, onFinished, onReturn }: {
3
+ declare function AddStaffPage({ token, onStepComplete, onFinished, onReturn }: {
4
4
  token: any;
5
+ onStepComplete: any;
5
6
  onFinished: any;
6
7
  onReturn: any;
7
8
  }): React.JSX.Element;
@@ -3,6 +3,7 @@ export const addStaffEndpoints: {
3
3
  searchByRole: any;
4
4
  searchByKeywords: any;
5
5
  deactivate: any;
6
+ changePassword: any;
6
7
  basicById: any;
7
8
  experienceById: any;
8
9
  payrollById: any;
@@ -6,6 +6,7 @@ export namespace endpoints {
6
6
  let searchByRole: any;
7
7
  let searchByKeywords: any;
8
8
  let deactivate: any;
9
+ let changePassword: any;
9
10
  let basicById: any;
10
11
  let experienceById: any;
11
12
  let payrollById: any;
@@ -1,8 +1,9 @@
1
1
  import { default as React } from 'react';
2
2
  export default StaffDirectoryPage;
3
- declare function StaffDirectoryPage({ token, onNavigate, onFinished, onDelete, }: {
3
+ declare function StaffDirectoryPage({ token, onNavigate, onFinished, onDelete, onPasswordChange, }: {
4
4
  token: any;
5
5
  onNavigate: any;
6
6
  onFinished: any;
7
7
  onDelete: any;
8
+ onPasswordChange: any;
8
9
  }): React.JSX.Element;
@@ -3,6 +3,7 @@ export const staffEndpoints: {
3
3
  searchByRole: any;
4
4
  searchByKeywords: any;
5
5
  deactivate: any;
6
+ changePassword: any;
6
7
  basicById: any;
7
8
  experienceById: any;
8
9
  payrollById: any;
@@ -1,8 +1,9 @@
1
1
  import { default as React } from 'react';
2
2
  export default StaffDirectory;
3
- declare function StaffDirectory({ token, onNavigate, onFinished, onDelete }: {
3
+ declare function StaffDirectory({ token, onNavigate, onFinished, onDelete, onPasswordChange }: {
4
4
  token: any;
5
5
  onNavigate: any;
6
6
  onFinished: any;
7
7
  onDelete: any;
8
+ onPasswordChange: any;
8
9
  }): React.JSX.Element;
@@ -1,9 +1,10 @@
1
1
  import { default as React } from 'react';
2
2
  export default StaffWizard;
3
- declare function StaffWizard({ token, mode, staffId: staffIdProp, onStepComplete, onFinished, }: {
3
+ declare function StaffWizard({ token, mode, staffId: staffIdProp, onStepComplete, onFinished, onReturn, }: {
4
4
  token: any;
5
5
  mode?: string | undefined;
6
6
  staffId: any;
7
7
  onStepComplete: any;
8
8
  onFinished: any;
9
+ onReturn: any;
9
10
  }): React.JSX.Element;