nazar-salary 3.4.3 → 3.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/index.d.ts +27 -2
- package/index.js +12 -4
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -818,7 +818,10 @@ declare module 'nazar-salary' {
|
|
|
818
818
|
|
|
819
819
|
export interface DashboardKpi {
|
|
820
820
|
students: {
|
|
821
|
+
/** Students whose latest course record is active (excludes deleted students) */
|
|
821
822
|
active: number;
|
|
823
|
+
/** Students whose latest course record is closed — finished, stopped or refunded (excludes deleted students) */
|
|
824
|
+
inactive: number;
|
|
822
825
|
new_this_month: number;
|
|
823
826
|
finished_this_month: number;
|
|
824
827
|
};
|
|
@@ -1061,6 +1064,7 @@ declare module 'nazar-salary' {
|
|
|
1061
1064
|
date_to?: string;
|
|
1062
1065
|
display: string;
|
|
1063
1066
|
};
|
|
1067
|
+
/** Totals for the requested period (respects period/status/teacher_id filters) */
|
|
1064
1068
|
summary: {
|
|
1065
1069
|
total_teachers: number;
|
|
1066
1070
|
total_payments: number;
|
|
@@ -1071,6 +1075,21 @@ declare module 'nazar-salary' {
|
|
|
1071
1075
|
paid: number;
|
|
1072
1076
|
};
|
|
1073
1077
|
};
|
|
1078
|
+
/**
|
|
1079
|
+
* Lesson totals as of now — a snapshot, NOT limited by period/status
|
|
1080
|
+
* (student_history has no per-lesson dates). Respects teacher_id if passed.
|
|
1081
|
+
* Deleted students are excluded.
|
|
1082
|
+
*/
|
|
1083
|
+
lessons_summary: {
|
|
1084
|
+
/** Lessons conducted across all courses ever (finished and stopped included) */
|
|
1085
|
+
completed_lessons: number;
|
|
1086
|
+
/** Lessons still to be conducted — active courses only */
|
|
1087
|
+
remaining_lessons: number;
|
|
1088
|
+
/** completed_lessons valued at the current price (rate_per_lesson) */
|
|
1089
|
+
completed_amount: number;
|
|
1090
|
+
/** remaining_lessons valued at the current price — future teacher payout */
|
|
1091
|
+
remaining_amount: number;
|
|
1092
|
+
};
|
|
1074
1093
|
teachers: TeacherSalaryItem[];
|
|
1075
1094
|
}
|
|
1076
1095
|
|
|
@@ -1727,9 +1746,10 @@ declare module 'nazar-salary' {
|
|
|
1727
1746
|
// Forecast endpoints
|
|
1728
1747
|
/**
|
|
1729
1748
|
* Get teacher salary forecast for upcoming months (Admin only)
|
|
1730
|
-
* @param monthsAhead Number of months
|
|
1749
|
+
* @param monthsAhead Number of forecast months (1–12). Default: 6
|
|
1750
|
+
* @param monthsBefore Number of past months prepended to monthly_data (0–12). Default: 4
|
|
1731
1751
|
*/
|
|
1732
|
-
getTeacherExpensesForecast(monthsAhead?: number): Promise<TeacherExpensesForecastResponse>;
|
|
1752
|
+
getTeacherExpensesForecast(monthsAhead?: number, monthsBefore?: number): Promise<TeacherExpensesForecastResponse>;
|
|
1733
1753
|
|
|
1734
1754
|
// Export endpoints
|
|
1735
1755
|
/**
|
|
@@ -1854,6 +1874,10 @@ declare module 'nazar-salary' {
|
|
|
1854
1874
|
forecast_metadata: {
|
|
1855
1875
|
generated_at: string;
|
|
1856
1876
|
current_month: string;
|
|
1877
|
+
/** How many past months are prepended to monthly_data */
|
|
1878
|
+
previous_months: number;
|
|
1879
|
+
/** Earliest month present in monthly_data (current_month minus previous_months) */
|
|
1880
|
+
data_from: string;
|
|
1857
1881
|
forecast_period_months: number;
|
|
1858
1882
|
forecast_from: string;
|
|
1859
1883
|
forecast_to: string;
|
|
@@ -1867,6 +1891,7 @@ declare module 'nazar-salary' {
|
|
|
1867
1891
|
min_month: string | null;
|
|
1868
1892
|
max_month: string | null;
|
|
1869
1893
|
};
|
|
1894
|
+
/** First entry is the previous month (see forecast_metadata.previous_month), then the forecast window from current_month onward. summary/risk_analysis cover the forecast window only. */
|
|
1870
1895
|
monthly_data: Array<{
|
|
1871
1896
|
month: string;
|
|
1872
1897
|
month_display: string;
|
package/index.js
CHANGED
|
@@ -362,7 +362,14 @@ class SalaryAPI {
|
|
|
362
362
|
* @param {string} [params.date_to] - End date YYYY-MM-DD (required if period_type=custom)
|
|
363
363
|
* @param {string} [params.status] - Filter by status: 'not_paid', 'pending', 'paid'
|
|
364
364
|
* @param {number} [params.teacher_id] - Filter by teacher ID
|
|
365
|
-
*
|
|
365
|
+
*
|
|
366
|
+
* Response also carries `lessons_summary` — a snapshot as of now (NOT limited by
|
|
367
|
+
* period/status; respects teacher_id, excludes deleted students):
|
|
368
|
+
* completed_lessons — lessons conducted across all courses ever
|
|
369
|
+
* remaining_lessons — lessons still to conduct (active courses only)
|
|
370
|
+
* completed_amount — completed_lessons x current rate_per_lesson
|
|
371
|
+
* remaining_amount — remaining_lessons x current rate_per_lesson (future payout)
|
|
372
|
+
* @returns {Promise<{period: object, summary: object, lessons_summary: object, teachers: array}>}
|
|
366
373
|
*/
|
|
367
374
|
async getTeachersSalary(params) {
|
|
368
375
|
return await this.client.get("/api/v1/admin/salary/teachers", { params });
|
|
@@ -1033,12 +1040,13 @@ class SalaryAPI {
|
|
|
1033
1040
|
|
|
1034
1041
|
/**
|
|
1035
1042
|
* Get teacher salary forecast for upcoming months (Admin only)
|
|
1036
|
-
* @param {number} [monthsAhead=6] - Number of months
|
|
1043
|
+
* @param {number} [monthsAhead=6] - Number of forecast months (1-12)
|
|
1044
|
+
* @param {number} [monthsBefore=4] - Number of past months to prepend to monthly_data (0-12)
|
|
1037
1045
|
* @returns {Promise<object>}
|
|
1038
1046
|
*/
|
|
1039
|
-
async getTeacherExpensesForecast(monthsAhead = 6) {
|
|
1047
|
+
async getTeacherExpensesForecast(monthsAhead = 6, monthsBefore = 4) {
|
|
1040
1048
|
return await this.client.get("/api/v1/forecast/teacher-expenses", {
|
|
1041
|
-
params: { months_ahead: monthsAhead },
|
|
1049
|
+
params: { months_ahead: monthsAhead, months_before: monthsBefore },
|
|
1042
1050
|
});
|
|
1043
1051
|
}
|
|
1044
1052
|
|