nazar-salary 2.3.2 → 2.5.0
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 +173 -0
- package/index.js +78 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -602,6 +602,172 @@ declare module 'nazar-salary' {
|
|
|
602
602
|
reassigned_at: number;
|
|
603
603
|
}
|
|
604
604
|
|
|
605
|
+
export interface UpdateStudentProgressData {
|
|
606
|
+
new_completed_lessons: number;
|
|
607
|
+
comment?: string;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export interface UpdateStudentProgressResponse {
|
|
611
|
+
status: string;
|
|
612
|
+
student: {
|
|
613
|
+
id: number;
|
|
614
|
+
completed_lessons: number;
|
|
615
|
+
total_lessons: number;
|
|
616
|
+
progress_percent: number;
|
|
617
|
+
};
|
|
618
|
+
students_in_group?: Array<{
|
|
619
|
+
id: number;
|
|
620
|
+
name: string;
|
|
621
|
+
completed_lessons: number;
|
|
622
|
+
}>;
|
|
623
|
+
teacher_payment_created?: {
|
|
624
|
+
id: number;
|
|
625
|
+
month_number: number;
|
|
626
|
+
amount: number;
|
|
627
|
+
status: string;
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
export type StopReason = 'student_quit' | 'moved_away' | 'health_issues' | 'financial' | 'other';
|
|
632
|
+
|
|
633
|
+
export interface StopStudentData {
|
|
634
|
+
reason: StopReason;
|
|
635
|
+
comment?: string;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export interface StopStudentResponse {
|
|
639
|
+
status: string;
|
|
640
|
+
student: {
|
|
641
|
+
id: number;
|
|
642
|
+
is_active: boolean;
|
|
643
|
+
finished_at: string;
|
|
644
|
+
stop_reason: StopReason;
|
|
645
|
+
completed_lessons: number;
|
|
646
|
+
};
|
|
647
|
+
teacher_payment_created?: {
|
|
648
|
+
id: number;
|
|
649
|
+
lessons_count: number;
|
|
650
|
+
amount: number;
|
|
651
|
+
status: string;
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
// Salary interfaces
|
|
656
|
+
export interface ManagerPayment {
|
|
657
|
+
payment_id: number;
|
|
658
|
+
student_id: number;
|
|
659
|
+
student_name: string;
|
|
660
|
+
operation_number: string;
|
|
661
|
+
purchase_amount: number;
|
|
662
|
+
prepayment: boolean;
|
|
663
|
+
kaspi_amount: number;
|
|
664
|
+
kaspi_commission: number;
|
|
665
|
+
net_amount: number;
|
|
666
|
+
manager_commission: number;
|
|
667
|
+
verified_at: string;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export interface ManagerSalaryItem {
|
|
671
|
+
manager_id: number;
|
|
672
|
+
first_name: string;
|
|
673
|
+
last_name: string;
|
|
674
|
+
phone: string;
|
|
675
|
+
hire_date: string;
|
|
676
|
+
work_days: number;
|
|
677
|
+
students_count: number;
|
|
678
|
+
payments_count: number;
|
|
679
|
+
total_commission: number;
|
|
680
|
+
payments: ManagerPayment[];
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
export interface ManagerSalaryResponse {
|
|
684
|
+
period: {
|
|
685
|
+
month: string;
|
|
686
|
+
display: string;
|
|
687
|
+
date_from: string;
|
|
688
|
+
date_to: string;
|
|
689
|
+
};
|
|
690
|
+
summary: {
|
|
691
|
+
total_managers: number;
|
|
692
|
+
total_students: number;
|
|
693
|
+
total_payments: number;
|
|
694
|
+
total_commission: number;
|
|
695
|
+
};
|
|
696
|
+
manager_list: ManagerSalaryItem[];
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
export type TeacherPaymentStatus = 'not_paid' | 'pending' | 'paid';
|
|
700
|
+
|
|
701
|
+
export interface TeacherPayment {
|
|
702
|
+
id: number;
|
|
703
|
+
type: 'individual' | 'group';
|
|
704
|
+
month_number: number | null;
|
|
705
|
+
lessons_count: number;
|
|
706
|
+
rate_per_lesson: number;
|
|
707
|
+
amount: number;
|
|
708
|
+
status: TeacherPaymentStatus;
|
|
709
|
+
created_at: string;
|
|
710
|
+
paid_at?: string;
|
|
711
|
+
student_id?: number;
|
|
712
|
+
student_name?: string;
|
|
713
|
+
lesson_group_id?: number;
|
|
714
|
+
lesson_group_name?: string;
|
|
715
|
+
students?: Array<{ id: number; name: string }>;
|
|
716
|
+
note?: string;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
export interface TeacherSalaryItem {
|
|
720
|
+
teacher_id: number;
|
|
721
|
+
first_name: string;
|
|
722
|
+
last_name: string;
|
|
723
|
+
phone: string;
|
|
724
|
+
payments_count: number;
|
|
725
|
+
total_amount: number;
|
|
726
|
+
payments: TeacherPayment[];
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export interface TeachersSalaryParams {
|
|
730
|
+
period_type: 'month' | 'custom';
|
|
731
|
+
month?: string;
|
|
732
|
+
date_from?: string;
|
|
733
|
+
date_to?: string;
|
|
734
|
+
status?: TeacherPaymentStatus;
|
|
735
|
+
teacher_id?: number;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
export interface TeachersSalaryResponse {
|
|
739
|
+
period: {
|
|
740
|
+
type: 'month' | 'custom';
|
|
741
|
+
month?: string;
|
|
742
|
+
date_from?: string;
|
|
743
|
+
date_to?: string;
|
|
744
|
+
display: string;
|
|
745
|
+
};
|
|
746
|
+
summary: {
|
|
747
|
+
total_teachers: number;
|
|
748
|
+
total_payments: number;
|
|
749
|
+
total_amount: number;
|
|
750
|
+
by_status: {
|
|
751
|
+
not_paid: number;
|
|
752
|
+
pending: number;
|
|
753
|
+
paid: number;
|
|
754
|
+
};
|
|
755
|
+
};
|
|
756
|
+
teachers: TeacherSalaryItem[];
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
export interface MarkTeacherPaymentsPaidData {
|
|
760
|
+
payment_ids?: number[];
|
|
761
|
+
teacher_id?: number;
|
|
762
|
+
mark_all?: boolean;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
export interface MarkTeacherPaymentsPaidResponse {
|
|
766
|
+
status: string;
|
|
767
|
+
updated_count: number;
|
|
768
|
+
total_amount: number;
|
|
769
|
+
}
|
|
770
|
+
|
|
605
771
|
export interface StudentBasicInfo {
|
|
606
772
|
id: number;
|
|
607
773
|
first_name: string;
|
|
@@ -811,6 +977,11 @@ declare module 'nazar-salary' {
|
|
|
811
977
|
getOrphanPayments(params?: { page?: number; limit?: number }): Promise<OrphanPaymentsResponse>;
|
|
812
978
|
getBanksConfig(): Promise<BanksConfigResponse>;
|
|
813
979
|
getManagerStudentsAdmin(managerId: number, params?: StudentsListParams): Promise<StudentsListResponse>;
|
|
980
|
+
|
|
981
|
+
// Salary endpoints
|
|
982
|
+
getManagerSalary(month: string, managerId?: number): Promise<ManagerSalaryResponse>;
|
|
983
|
+
getTeachersSalary(params: TeachersSalaryParams): Promise<TeachersSalaryResponse>;
|
|
984
|
+
markTeacherPaymentsPaid(data: MarkTeacherPaymentsPaidData): Promise<MarkTeacherPaymentsPaidResponse>;
|
|
814
985
|
|
|
815
986
|
// Teacher endpoints
|
|
816
987
|
getTeacherLanguages(): Promise<TeacherLanguagesResponse>;
|
|
@@ -834,6 +1005,8 @@ declare module 'nazar-salary' {
|
|
|
834
1005
|
updateStudent(studentId: number, data: UpdateStudentData): Promise<UpdateStudentResponse>;
|
|
835
1006
|
transferStudent(studentId: number, data: TransferStudentData): Promise<TransferResponse>;
|
|
836
1007
|
changeStudentManager(studentId: number, data: ChangeStudentManagerData): Promise<ChangeStudentManagerResponse>;
|
|
1008
|
+
updateStudentProgress(studentId: number, data: UpdateStudentProgressData): Promise<UpdateStudentProgressResponse>;
|
|
1009
|
+
stopStudent(studentId: number, data: StopStudentData): Promise<StopStudentResponse>;
|
|
837
1010
|
getStudent(studentId: number): Promise<StudentDetail>;
|
|
838
1011
|
searchStudents(params: SearchStudentsParams): Promise<SearchStudentsResponse>;
|
|
839
1012
|
getStudentsList(params?: StudentsListParams): Promise<StudentsListResponse>;
|
package/index.js
CHANGED
|
@@ -274,7 +274,54 @@ class SalaryAPI {
|
|
|
274
274
|
* @returns {Promise<{manager: object, total_students: number, current_page: number, total_pages: number, students: array}>}
|
|
275
275
|
*/
|
|
276
276
|
async getManagerStudentsAdmin(managerId, params = {}) {
|
|
277
|
-
return await this.client.get(
|
|
277
|
+
return await this.client.get(
|
|
278
|
+
`/api/v1/admin/manager/${managerId}/students`,
|
|
279
|
+
{ params },
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Get manager salary for specific month (Admin only)
|
|
285
|
+
* @param {string} month - Month in YYYY-MM format
|
|
286
|
+
* @param {number} [managerId] - Optional manager ID filter
|
|
287
|
+
* @returns {Promise<{period: object, summary: object, manager_list: array}>}
|
|
288
|
+
*/
|
|
289
|
+
async getManagerSalary(month, managerId = null) {
|
|
290
|
+
const params = { month };
|
|
291
|
+
if (managerId) {
|
|
292
|
+
params.manager_id = managerId;
|
|
293
|
+
}
|
|
294
|
+
return await this.client.get("/api/v1/admin/salary/manager", { params });
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Get teachers salary for specific period (Admin only)
|
|
299
|
+
* @param {object} params - Query parameters
|
|
300
|
+
* @param {string} params.period_type - 'month' or 'custom'
|
|
301
|
+
* @param {string} [params.month] - Month in YYYY-MM format (required if period_type=month)
|
|
302
|
+
* @param {string} [params.date_from] - Start date YYYY-MM-DD (required if period_type=custom)
|
|
303
|
+
* @param {string} [params.date_to] - End date YYYY-MM-DD (required if period_type=custom)
|
|
304
|
+
* @param {string} [params.status] - Filter by status: 'not_paid', 'pending', 'paid'
|
|
305
|
+
* @param {number} [params.teacher_id] - Filter by teacher ID
|
|
306
|
+
* @returns {Promise<{period: object, summary: object, teachers: array}>}
|
|
307
|
+
*/
|
|
308
|
+
async getTeachersSalary(params) {
|
|
309
|
+
return await this.client.get("/api/v1/admin/salary/teachers", { params });
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Mark teacher payments as paid (Admin only)
|
|
314
|
+
* @param {object} data - Payment data
|
|
315
|
+
* @param {number[]} [data.payment_ids] - Array of payment IDs to mark as paid
|
|
316
|
+
* @param {number} [data.teacher_id] - Teacher ID (used with mark_all)
|
|
317
|
+
* @param {boolean} [data.mark_all] - Mark all pending payments for teacher
|
|
318
|
+
* @returns {Promise<{status: string, updated_count: number, total_amount: number}>}
|
|
319
|
+
*/
|
|
320
|
+
async markTeacherPaymentsPaid(data) {
|
|
321
|
+
return await this.client.post(
|
|
322
|
+
"/api/v1/admin/salary/teachers/mark-paid",
|
|
323
|
+
data,
|
|
324
|
+
);
|
|
278
325
|
}
|
|
279
326
|
|
|
280
327
|
// ===== TEACHER ENDPOINTS =====
|
|
@@ -502,6 +549,36 @@ class SalaryAPI {
|
|
|
502
549
|
);
|
|
503
550
|
}
|
|
504
551
|
|
|
552
|
+
/**
|
|
553
|
+
* Update student progress (Admin only)
|
|
554
|
+
* @param {number} studentId - Student ID
|
|
555
|
+
* @param {object} data - Progress data
|
|
556
|
+
* @param {number} data.new_completed_lessons - New completed lessons count
|
|
557
|
+
* @param {string} [data.comment] - Optional comment for logging
|
|
558
|
+
* @returns {Promise<{status: string, student: object, students_in_group?: array, teacher_payment_created?: object}>}
|
|
559
|
+
*/
|
|
560
|
+
async updateStudentProgress(studentId, data) {
|
|
561
|
+
return await this.client.put(
|
|
562
|
+
`/api/v1/admin/progress/${studentId}/progress`,
|
|
563
|
+
data,
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Stop student enrollment (Admin only)
|
|
569
|
+
* @param {number} studentId - Student ID
|
|
570
|
+
* @param {object} data - Stop data
|
|
571
|
+
* @param {string} data.reason - Reason for stopping (student_quit, moved_away, health_issues, financial, other)
|
|
572
|
+
* @param {string} [data.comment] - Optional comment
|
|
573
|
+
* @returns {Promise<{status: string, student: object, teacher_payment_created?: object}>}
|
|
574
|
+
*/
|
|
575
|
+
async stopStudent(studentId, data) {
|
|
576
|
+
return await this.client.post(
|
|
577
|
+
`/api/v1/admin/progress/${studentId}/stop`,
|
|
578
|
+
data,
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
|
|
505
582
|
/**
|
|
506
583
|
* Get student by ID (requireAuth)
|
|
507
584
|
* @param {number} studentId - Student ID
|