ubk.erp.webpack 1.1.7 → 1.1.9

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
@@ -258,6 +258,104 @@ const GeneralSettingPage = ({ token }) => {
258
258
  | `LibraryCategory` | Manage book categories. |
259
259
  | `LibraryReport` | Monthly report. |
260
260
 
261
+ # 📚 Library `IssueReturn` — Return Callback
262
+
263
+ `IssueReturn` accepts an optional `onReturn` callback that is invoked after a successful book return.
264
+
265
+ ## Props
266
+
267
+ | Prop | Type | Required | Description |
268
+ | :--- | :--- | :--- | :--- |
269
+ | `token` | `string` | Yes | Authentication token for API requests. |
270
+ | `onReturn` | `(returnArray: ReturnItem[]) => void` | No | Callback fired after a successful return. |
271
+
272
+ ## Return Item Shape
273
+
274
+ Each object in the returned array represents one returned book:
275
+
276
+ ```ts
277
+ {
278
+ studentId: number;
279
+ fromDate: string; // "YYYY-MM-DD"
280
+ toDate: string; // "YYYY-MM-DD"
281
+ customField1: number; // book_issues_id
282
+ description: string; // "book_title-author"
283
+ amount: number; // individual book totalfine
284
+ }
285
+ ```
286
+
287
+ ## Usage
288
+
289
+ ```jsx
290
+ import { IssueReturn } from "ubk.erp.webpack";
291
+
292
+ const LibraryPage = ({ token }) => {
293
+ const handleIssueReturn = (returnArray) => {
294
+ // Example returnArray:
295
+ const example = [
296
+ {
297
+ studentId: 8,
298
+ fromDate: "2026-09-13",
299
+ toDate: "2026-08-13",
300
+ customField1: 21,
301
+ description: "Mathematics-John Smith",
302
+ amount: 100,
303
+ },
304
+ {
305
+ studentId: 8,
306
+ fromDate: "2026-09-13",
307
+ toDate: "2026-08-13",
308
+ customField1: 22,
309
+ description: "Science-Jane Doe",
310
+ amount: 50,
311
+ },
312
+ ];
313
+ };
314
+
315
+ return (
316
+ <IssueReturn
317
+ token={token}
318
+ onReturn={handleIssueReturn}
319
+ />
320
+ );
321
+ };
322
+ ```
323
+
324
+ ## Behavior
325
+
326
+ - `onReturn` is only called when the return API responds with `Status: "Success"`.
327
+ - It is **not** called if the API returns `Failed`.
328
+ - The callback receives **one object per returned book**, mapped from the current return selection.
329
+ - `amount` always reflects the individual book’s `totalfine`, regardless of the collection type (`NO_FINE`, `FINE_PAID`, or `FINE_PAY_LATER`).
330
+ - Existing return, fine, and payment workflows remain unchanged.
331
+
332
+ ## Example Output
333
+
334
+ ```js
335
+ [
336
+ {
337
+ studentId: 8,
338
+ branchId: 2,
339
+ academicYearId: 2026,
340
+ fromDate: "2026-09-13",
341
+ toDate: "2026-08-13",
342
+ customField1: 21,
343
+ description: "Mathematics-John Smith",
344
+ amount: 100
345
+ },
346
+ {
347
+ studentId: 8,
348
+ branchId: 2,
349
+ academicYearId: 2026,
350
+ fromDate: "2026-09-13",
351
+ toDate: "2026-08-13",
352
+ customField1: 22,
353
+ description: "Science-Jane Doe",
354
+ amount: 50
355
+ }
356
+ ]
357
+ ```
358
+
261
359
  ### Store
262
360
 
263
361
  | Component | Description |
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ export default IssueReturn;
3
+ declare function IssueReturn({ token: tokenProp }: {
4
+ token: any;
5
+ }): React.JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  export default IssueReturn;
3
- declare function IssueReturn({ token: tokenProp }: {
3
+ declare function IssueReturn({ token: tokenProp, onReturn }: {
4
4
  token: any;
5
+ onReturn: any;
5
6
  }): React.JSX.Element;