ubk.erp.webpack 1.4.1 → 1.4.3

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
@@ -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 `onReturn` callback per step. |
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 `onReturn` callback receives an object:
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"` | `{ roleValue, departmentValue, designationValue, genderValue, shiftValue, dob, doj, file }` |
637
- | `"experience"` | `rows` array (each row: `{ name, from, to, image }`) |
638
- | `"payroll"` | `{ staffType, salaryType, amount, basicPay, declaration }` |
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
- - `onReturn` is only called when the step's API responds with `Status === "Success"`.
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
- - The callback allows the parent to react to each step's completion (e.g., refresh data, update UI state).
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 handleReturn = (payload) => {
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
- onReturn={handleReturn}
720
+ onStepComplete={handleStepComplete}
666
721
  onFinished={handleFinished}
667
722
  />
668
723
  );
@@ -732,6 +787,84 @@ const CommunicatePage = ({ token }) => {
732
787
  };
733
788
  ```
734
789
 
790
+ ### Exam
791
+
792
+ | Component | Description |
793
+ | :--- | :--- |
794
+ |
795
+ | `Exam` | Create an exam schedule. |
796
+ | `ExamList` | Exam schedule list. |
797
+ | `ExamEdit` | Edit an exam schedule. |
798
+ | `ExamDetails` | Exam schedule details. |
799
+ | `ExamLink` | Exam links. |
800
+ | `ExamType` | Exam type list. |
801
+ | `Grade` | Grade master — add, edit and delete grades with a mark range (Mark From / Mark To) and remark. |
802
+ | `CoScholasticAreaGrade` | Co-scholastic grade master — add, edit and delete grades with a remark (no mark range). |
803
+ | `ExamSetting` | Per exam/class report card settings: class-teacher signature per section, Exam I/C signature, report card title, marksheet issue date, promoted-to and abbreviations. |
804
+ | `ExamInstruction` | Pick an exam and edit its instructions in a rich-text editor (bold, italic, underline, lists). Saved as HTML and printed on the admit card. |
805
+ | `Assessment` | Assessment management. |
806
+ | `AssignMarks` | Enter exam marks for students. |
807
+ | `CoScholasticAreaMarks` | Search by Class / Section / Exam / Co-Scholastic Category, then enter a grade per student per skill and save. |
808
+ | `StudentResult` | Search by Class / Section / Exam to see each student's marks, percentage, marks-entry progress, meetings and attendance. Edit remarks, meeting dates, attendance and result per student. |
809
+ | `MarksReport` | Marks report. |
810
+ | `AdmitCardSetting` | Admit card settings (photo, room no, subject list, exam time, invigilator and Exam I/C signature toggles). |
811
+ | `AdmitPrint` | Search by Class / Section / Exam and print admit cards using one of three templates. The class's assigned template is preselected. |
812
+ | `RoomManagment` | Add/delete exam rooms, and assign rooms with roll-number ranges per section for a class and exam. |
813
+
814
+ ### Using the Exam Module
815
+
816
+ ```jsx
817
+ import {
818
+ Grade,
819
+ CoScholasticAreaGrade,
820
+ ExamSetting,
821
+ ExamInstruction,
822
+ CoScholasticAreaMarks,
823
+ StudentResult,
824
+ AdmitPrint,
825
+ RoomManagment,
826
+ } from "ubk.erp.webpack";
827
+
828
+ const ExamPage = ({ token }) => {
829
+ return (
830
+ <>
831
+ <Grade token={token} />
832
+ <CoScholasticAreaGrade token={token} />
833
+ <ExamSetting token={token} />
834
+ <ExamInstruction token={token} />
835
+ <CoScholasticAreaMarks token={token} />
836
+ <StudentResult token={token} />
837
+ <AdmitPrint token={token} />
838
+ <RoomManagment token={token} />
839
+ </>
840
+ );
841
+ };
842
+ ```
843
+
844
+ **Notes:**
845
+ - `AdmitPrint` reads the session name from `localStorage.academy_session` (templates 2 and 3). Set it in the host app, otherwise the session shows as blank / `-`.
846
+ - `AdmitPrint` requests `per_page=10` students per search.
847
+ - The **View Result** button in `StudentResult` navigates to `/ExamDashboard/SingleResult?id=…&exam_id=…`, which is not part of this library yet.
848
+ - `RoomManagment` is spelled as in the original project (no "e" after "g").
849
+
850
+ **Endpoint overrides** — each Exam endpoint has a built-in default and can be overridden with a `VITE_*` variable in `.env`, for example:
851
+
852
+ | Variable | Default |
853
+ | :--- | :--- |
854
+ | `VITE_GRADE_TABLE_URL` / `_ADD_URL` / `_EDIT_URL` / `_DELETE_URL` | `/api/exam/exam/getgradeTable`, `addGrade`, `editGradec`, `deleteGrade` |
855
+ | `VITE_COSCHOLASTIC_GRADE_TABLE_URL` / `_ADD_URL` / `_EDIT_URL` / `_DELETE_URL` | `/api/exam/exam/getgradeTableCoScholastic`, `addGradeCoScholastic`, `editGradeCoScholastic`, `deleteGradeCoScholastic` |
856
+ | `VITE_COSCHOLASTIC_GRADE_DROPDOWN_URL` | `/api/exam/exam/gradeDropdownCoScholastic` |
857
+ | `VITE_COSCHOLASTIC_ASSIGN_MARKS_URL` | `/api/exam/exam/assignCoscholasticMarks` |
858
+ | `VITE_COSCHOLASTIC_CATEGORY_DROPDOWN_URL` | `/api/branchapi/academy/getscholasticCategoryByClassId` |
859
+ | `VITE_EXAM_SETTING_UPLOAD_FILE_URL` | `api/SuperAdmin/uploadFile` (signature uploads, saved to `schoolFile`) |
860
+ | `VITE_EXAM_ROOM_LIST_URL` / `_DELETE_URL` | `/api/exam/Exam/listClassRoom`, `/api/exam/Exam/removeClassRoom` |
861
+ | `VITE_EXAM_ROOM_ADD_URL` | `/api/exam/exam/addClassRoom` |
862
+ | `VITE_EXAM_ROOM_ASSIGNED_LIST_URL` | `/api/exam/Exam/getClassRoomdata` |
863
+ | `VITE_EXAM_ROOM_ASSIGN_URL` / `_REMOVE_URL` | `/api/exam/exam/assignClassRoom`, `/api/exam/exam/remove_exam_class_room` |
864
+ | `VITE_EXAM_ROOM_DROPDOWN_URL` / `_EXAM_DROPDOWN_URL` | `/api/exam/exam/roomDropdown`, `examdropdown_new` |
865
+
866
+ See `src/Layout/Exam/Services/examsService.js` for the full list.
867
+
735
868
 
736
869
 
737
870
  ## 🛠️ Development
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ export default AdmitPrint;
3
+ declare function AdmitPrint({ token }: {
4
+ token: any;
5
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ export default CoScholasticAreaGrade;
3
+ declare function CoScholasticAreaGrade({ token }: {
4
+ token: any;
5
+ }): React.JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { default as React } from 'react';
2
+ export function templateOptionAdmit(): {
3
+ label: string;
4
+ value: string;
5
+ }[];
6
+ export function buildTemplateContext(data: any): {
7
+ academy_session: any;
8
+ exam_details: any;
9
+ receipt_info: any;
10
+ general_setting: any;
11
+ students: any;
12
+ settings: any;
13
+ };
14
+ export default AdmitCardTemplate;
15
+ declare function AdmitCardTemplate({ templateId, data }: {
16
+ templateId: any;
17
+ data: any;
18
+ }): React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ export default AssignClassRoomEditor;
3
+ /**
4
+ * Add mode (no rowData): pick class + exam, then fill roll ranges per section.
5
+ * Update mode (rowData = an assigned-room record): locked to that record's class, exam and section.
6
+ * Calls onSubmit(formData) with class_id, exam_id, the row arrays and added/updated/deleted JSON.
7
+ */
8
+ declare function AssignClassRoomEditor({ token, rowData, onSubmit }: {
9
+ token: any;
10
+ rowData: any;
11
+ onSubmit: any;
12
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ export default Grade;
3
+ declare function Grade({ token }: {
4
+ token: any;
5
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ export default AdmitPrintPage;
3
+ declare function AdmitPrintPage({ token }: {
4
+ token: any;
5
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ export default CoScholasticAreaGradePage;
3
+ declare function CoScholasticAreaGradePage({ token }: {
4
+ token: any;
5
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ export default GradePage;
3
+ declare function GradePage({ token }: {
4
+ token: any;
5
+ }): React.JSX.Element;
@@ -6,11 +6,31 @@ export namespace endpoints {
6
6
  let edit: any;
7
7
  let remove: any;
8
8
  }
9
- export namespace examSchedule {
9
+ export namespace grade {
10
+ let table_1: any;
11
+ export { table_1 as table };
10
12
  let add_1: any;
11
13
  export { add_1 as add };
12
14
  let edit_1: any;
13
15
  export { edit_1 as edit };
16
+ let remove_1: any;
17
+ export { remove_1 as remove };
18
+ }
19
+ export namespace coScholasticGrade {
20
+ let table_2: any;
21
+ export { table_2 as table };
22
+ let add_2: any;
23
+ export { add_2 as add };
24
+ let edit_2: any;
25
+ export { edit_2 as edit };
26
+ let remove_2: any;
27
+ export { remove_2 as remove };
28
+ }
29
+ export namespace examSchedule {
30
+ let add_3: any;
31
+ export { add_3 as add };
32
+ let edit_3: any;
33
+ export { edit_3 as edit };
14
34
  export let getById: any;
15
35
  export let list: any;
16
36
  let dropdown_1: any;
@@ -29,17 +49,17 @@ export namespace endpoints {
29
49
  export let update: any;
30
50
  }
31
51
  export namespace examSetting {
32
- let table_1: any;
33
- export { table_1 as table };
34
- let add_2: any;
35
- export { add_2 as add };
52
+ let table_3: any;
53
+ export { table_3 as table };
54
+ let add_4: any;
55
+ export { add_4 as add };
36
56
  export let uploadSignature: any;
37
57
  export let typeByExamId: any;
38
58
  export let assignMarksheetClass: any;
39
59
  }
40
60
  export namespace assessment {
41
- let table_2: any;
42
- export { table_2 as table };
61
+ let table_4: any;
62
+ export { table_4 as table };
43
63
  let dropdown_3: any;
44
64
  export { dropdown_3 as dropdown };
45
65
  let _delete: any;
@@ -62,6 +82,7 @@ export namespace endpoints {
62
82
  let getGradeTable: any;
63
83
  let getGradeTableCoScholastic: any;
64
84
  let getAdmitCard: any;
85
+ let subjectDropdown: any;
65
86
  }
66
87
  export namespace admitCardSetting {
67
88
  let get_1: any;
@@ -72,14 +93,18 @@ export namespace endpoints {
72
93
  export namespace roomManagement {
73
94
  let list_1: any;
74
95
  export { list_1 as list };
75
- let remove_1: any;
76
- export { remove_1 as remove };
96
+ export let removeRoom: any;
97
+ export let assignedList: any;
98
+ export let examDropdown: any;
99
+ let remove_3: any;
100
+ export { remove_3 as remove };
77
101
  export let assign: any;
78
- let add_3: any;
79
- export { add_3 as add };
102
+ let add_5: any;
103
+ export { add_5 as add };
80
104
  export let roomDropdown: any;
81
105
  }
82
- export let examDropdown: any;
106
+ let examDropdown_1: any;
107
+ export { examDropdown_1 as examDropdown };
83
108
  export let examDropdownInstruction: any;
84
109
  export namespace observation {
85
110
  let dropdown_4: any;
@@ -89,19 +114,24 @@ export namespace endpoints {
89
114
  export let deleteType: any;
90
115
  export let editType: any;
91
116
  export let addType: any;
92
- let add_4: any;
93
- export { add_4 as add };
117
+ let add_6: any;
118
+ export { add_6 as add };
94
119
  }
95
120
  export let coscholasticCategoryDropdown: any;
121
+ export namespace coScholasticMarks {
122
+ export let gradeDropdown: any;
123
+ let assign_1: any;
124
+ export { assign_1 as assign };
125
+ }
96
126
  export namespace templateType {
97
127
  let get_2: any;
98
128
  export { get_2 as get };
99
129
  export let assignClassDropdown: any;
100
130
  export let assignTable: any;
101
- let assign_1: any;
102
- export { assign_1 as assign };
103
- let remove_2: any;
104
- export { remove_2 as remove };
131
+ let assign_2: any;
132
+ export { assign_2 as assign };
133
+ let remove_4: any;
134
+ export { remove_4 as remove };
105
135
  }
106
136
  export let classSubjectDropdown: any;
107
137
  export let sectionDropdown: any;
@@ -1,35 +1,10 @@
1
- export function useExamTypeDropdown(token: any): {
2
- isLoading: boolean;
3
- error: any;
4
- examTypeOptions: any;
5
- };
6
- export function useExamDropdown(classId: any, token: any): {
7
- isLoading: boolean;
8
- error: any;
9
- examList: any;
10
- mutate: import('swr').KeyedMutator<any>;
11
- };
12
- export function useExamSchedule(token: any): {
13
- isLoading: boolean;
14
- error: any;
15
- examSchedule: any;
16
- mutate: import('swr').KeyedMutator<any>;
17
- };
18
- export function useAssessmentTable(token: any): {
19
- isLoading: boolean;
20
- error: any;
21
- assessmentData: any;
22
- mutate: import('swr').KeyedMutator<any>;
23
- };
24
- export function useExamSettingTable(page: any, perPage: any, token: any): {
25
- isLoading: boolean;
26
- error: any;
27
- examSettingData: any;
28
- mutate: import('swr').KeyedMutator<any>;
29
- };
30
- export function useStudentResult(token: any): {
31
- isLoading: boolean;
32
- error: any;
33
- studentResultData: any;
34
- mutate: import('swr').KeyedMutator<any>;
35
- };
1
+ export function useSubmit(handler: any): (boolean | ((...args: any[]) => Promise<any>))[];
2
+ export function usePaginatedFetcher(): {
3
+ fetchAllPagesWithProgress: (tableData: any, exam_id: any, onProgress: any, token: any) => Promise<any[]>;
4
+ isMutating: boolean;
5
+ };
6
+ declare namespace _default {
7
+ export { useSubmit };
8
+ export { usePaginatedFetcher };
9
+ }
10
+ export default _default;
@@ -2,6 +2,9 @@ export { default as StudentResult } from './StudentResult';
2
2
  export { default as Exam } from './Exam';
3
3
  export { default as ExamList } from './ExamList';
4
4
  export { default as ExamType } from './ExamType';
5
+ export { default as Grade } from './Grade';
6
+ export { default as AdmitPrint } from './AdmitPrint';
7
+ export { default as CoScholasticAreaGrade } from './CoScholasticAreaGrade';
5
8
  export { default as ExamSetting } from './ExamSetting';
6
9
  export { default as Assessment } from './Assessment';
7
10
  export { default as ExamInstruction } from './ExamInstruction';
@@ -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;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ export default StaffWizard;
3
+ declare function StaffWizard({ token, mode, staffId: staffIdProp, onFinished }: {
4
+ token: any;
5
+ mode?: string | undefined;
6
+ staffId: any;
7
+ onFinished: any;
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;