ubk.erp.webpack 1.1.7 → 1.1.8

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,106 @@ 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
+ branchId: number;
280
+ academicYearId: number;
281
+ fromDate: string; // "YYYY-MM-DD"
282
+ toDate: string; // "YYYY-MM-DD"
283
+ customField1: number; // book_issues_id
284
+ description: string; // "book_title-author"
285
+ amount: number; // individual book totalfine
286
+ }
287
+ ```
288
+
289
+ ## Usage
290
+
291
+ ```jsx
292
+ import { IssueReturn } from "ubk.erp.webpack";
293
+
294
+ const LibraryPage = ({ token }) => {
295
+ const handleIssueReturn = (returnArray) => {
296
+ // Example returnArray:
297
+ const example = [
298
+ {
299
+ studentId: 8,
300
+ fromDate: "2026-09-13",
301
+ toDate: "2026-08-13",
302
+ customField1: 21,
303
+ description: "Mathematics-John Smith",
304
+ amount: 100,
305
+ },
306
+ {
307
+ studentId: 8,
308
+ fromDate: "2026-09-13",
309
+ toDate: "2026-08-13",
310
+ customField1: 22,
311
+ description: "Science-Jane Doe",
312
+ amount: 50,
313
+ },
314
+ ];
315
+ };
316
+
317
+ return (
318
+ <IssueReturn
319
+ token={token}
320
+ onReturn={handleIssueReturn}
321
+ />
322
+ );
323
+ };
324
+ ```
325
+
326
+ ## Behavior
327
+
328
+ - `onReturn` is only called when the return API responds with `Status: "Success"`.
329
+ - It is **not** called if the API returns `Failed`.
330
+ - The callback receives **one object per returned book**, mapped from the current return selection.
331
+ - `amount` always reflects the individual book’s `totalfine`, regardless of the collection type (`NO_FINE`, `FINE_PAID`, or `FINE_PAY_LATER`).
332
+ - Existing return, fine, and payment workflows remain unchanged.
333
+
334
+ ## Example Output
335
+
336
+ ```js
337
+ [
338
+ {
339
+ studentId: 8,
340
+ branchId: 2,
341
+ academicYearId: 2026,
342
+ fromDate: "2026-09-13",
343
+ toDate: "2026-08-13",
344
+ customField1: 21,
345
+ description: "Mathematics-John Smith",
346
+ amount: 100
347
+ },
348
+ {
349
+ studentId: 8,
350
+ branchId: 2,
351
+ academicYearId: 2026,
352
+ fromDate: "2026-09-13",
353
+ toDate: "2026-08-13",
354
+ customField1: 22,
355
+ description: "Science-Jane Doe",
356
+ amount: 50
357
+ }
358
+ ]
359
+ ```
360
+
261
361
  ### Store
262
362
 
263
363
  | 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;