nazar-salary 2.7.1 → 2.8.1

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.
Files changed (3) hide show
  1. package/index.d.ts +139 -6
  2. package/index.js +38 -1
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -648,16 +648,104 @@ declare module 'nazar-salary' {
648
648
  status: string;
649
649
  student: {
650
650
  id: number;
651
- is_active: boolean;
652
- finished_at: string;
651
+ name: string;
652
+ is_active: false;
653
+ finished_at: number;
653
654
  stop_reason: StopReason;
655
+ stop_comment: string | null;
654
656
  completed_lessons: number;
657
+ total_lessons: number;
658
+ remaining_lessons: number;
655
659
  };
656
- teacher_payment_created?: {
660
+ lesson_group_id: number | null;
661
+ remaining_group_students: Array<{ id: number; name: string }> | null;
662
+ }
663
+
664
+ export interface ResumeStudentData {
665
+ comment?: string;
666
+ }
667
+
668
+ export interface ResumeStudentResponse {
669
+ status: string;
670
+ student: {
657
671
  id: number;
658
- lessons_count: number;
659
- amount: number;
660
- status: string;
672
+ name: string;
673
+ is_active: true;
674
+ resumed_at: number;
675
+ previous_stop_reason: StopReason | null;
676
+ completed_lessons: number;
677
+ total_lessons: number;
678
+ remaining_lessons: number;
679
+ };
680
+ lesson_group_id: number | null;
681
+ }
682
+
683
+ export interface DashboardKpi {
684
+ students: {
685
+ active: number;
686
+ new_this_month: number;
687
+ finished_this_month: number;
688
+ };
689
+ staff: {
690
+ managers: number;
691
+ teachers: number;
692
+ };
693
+ finance: {
694
+ verified_amount: number;
695
+ verified_count: number;
696
+ manager_commission: number;
697
+ teacher_pending_amount: number;
698
+ teacher_pending_count: number;
699
+ };
700
+ }
701
+
702
+ export interface DashboardAlerts {
703
+ discrepancies: number;
704
+ orphan_payments: number;
705
+ teacher_not_paid_count: number;
706
+ teacher_not_paid_amount: number;
707
+ }
708
+
709
+ export interface DashboardManagerItem {
710
+ id: number;
711
+ name: string;
712
+ students_count?: number;
713
+ total_commission?: number;
714
+ }
715
+
716
+ export interface DashboardRecentReceipt {
717
+ id: number;
718
+ file_name: string;
719
+ status: 'processing' | 'completed' | 'failed';
720
+ uploaded_by: string;
721
+ uploaded_at: number;
722
+ verified_count: number;
723
+ discrepancies_count: number;
724
+ orphan_count: number;
725
+ }
726
+
727
+ export interface DashboardRecentStudent {
728
+ id: number;
729
+ name: string;
730
+ manager_name: string;
731
+ created_at: number;
732
+ }
733
+
734
+ export interface DashboardResponse {
735
+ period: {
736
+ month: string;
737
+ month_start: number;
738
+ month_end: number;
739
+ };
740
+ kpi: DashboardKpi;
741
+ alerts: DashboardAlerts;
742
+ top_managers: {
743
+ by_students: DashboardManagerItem[];
744
+ by_commission: DashboardManagerItem[];
745
+ };
746
+ recent: {
747
+ receipts: DashboardRecentReceipt[];
748
+ students: DashboardRecentStudent[];
661
749
  };
662
750
  }
663
751
 
@@ -891,6 +979,46 @@ declare module 'nazar-salary' {
891
979
  students: StudentListItem[];
892
980
  }
893
981
 
982
+ export interface StoppedStudentsParams {
983
+ search?: string;
984
+ manager_id?: number;
985
+ teacher_id?: number;
986
+ stop_reason?: string;
987
+ page?: number;
988
+ limit?: number;
989
+ }
990
+
991
+ export interface StoppedStudentItem {
992
+ id: number;
993
+ first_name: string;
994
+ last_name: string;
995
+ phone: string;
996
+ age: number;
997
+ created_at: number;
998
+ history_id: number;
999
+ price_id: number;
1000
+ teacher_id: number;
1001
+ owned_by: number;
1002
+ manager_name: string;
1003
+ enrollment_months: number;
1004
+ total_lessons: number;
1005
+ completed_lessons: number;
1006
+ remaining_lessons: number;
1007
+ main_course: string;
1008
+ group_name: string | null;
1009
+ lesson_group_id: number | null;
1010
+ stop_reason: string;
1011
+ stop_comment: string | null;
1012
+ finished_at: number;
1013
+ }
1014
+
1015
+ export interface StoppedStudentsResponse {
1016
+ total_students: number;
1017
+ current_page: number;
1018
+ total_pages: number;
1019
+ students: StoppedStudentItem[];
1020
+ }
1021
+
894
1022
  export interface StudentsListParams {
895
1023
  manager_id?: number;
896
1024
  prepayment?: boolean;
@@ -1007,6 +1135,9 @@ declare module 'nazar-salary' {
1007
1135
  getBanksConfig(): Promise<BanksConfigResponse>;
1008
1136
  getManagerStudentsAdmin(managerId: number, params?: StudentsListParams): Promise<StudentsListResponse>;
1009
1137
 
1138
+ // Dashboard endpoints
1139
+ getDashboard(): Promise<DashboardResponse>;
1140
+
1010
1141
  // Salary endpoints
1011
1142
  getManagerSalary(month: string, managerId?: number): Promise<ManagerSalaryResponse>;
1012
1143
  getTeachersSalary(params: TeachersSalaryParams): Promise<TeachersSalaryResponse>;
@@ -1036,8 +1167,10 @@ declare module 'nazar-salary' {
1036
1167
  changeStudentManager(studentId: number, data: ChangeStudentManagerData): Promise<ChangeStudentManagerResponse>;
1037
1168
  updateStudentProgress(studentId: number, data: UpdateStudentProgressData): Promise<UpdateStudentProgressResponse>;
1038
1169
  stopStudent(studentId: number, data: StopStudentData): Promise<StopStudentResponse>;
1170
+ resumeStudent(studentId: number, data?: ResumeStudentData): Promise<ResumeStudentResponse>;
1039
1171
  getStudent(studentId: number): Promise<StudentDetail>;
1040
1172
  searchStudents(params: SearchStudentsParams): Promise<SearchStudentsResponse>;
1173
+ getStoppedStudents(params?: StoppedStudentsParams): Promise<StoppedStudentsResponse>;
1041
1174
  getStudentsList(params?: StudentsListParams): Promise<StudentsListResponse>;
1042
1175
  /** @deprecated Use getStudentsList instead */
1043
1176
  getManagerStudents(managerId: number, params?: ManagerStudentsParams): Promise<ManagerStudentsResponse>;
package/index.js CHANGED
@@ -567,13 +567,21 @@ class SalaryAPI {
567
567
  );
568
568
  }
569
569
 
570
+ /**
571
+ * Get admin dashboard summary (Admin only)
572
+ * @returns {Promise<DashboardResponse>}
573
+ */
574
+ async getDashboard() {
575
+ return await this.client.get("/api/v1/admin/dashboard/");
576
+ }
577
+
570
578
  /**
571
579
  * Stop student enrollment (Admin only)
572
580
  * @param {number} studentId - Student ID
573
581
  * @param {object} data - Stop data
574
582
  * @param {string} data.reason - Reason for stopping (student_quit, moved_away, health_issues, financial, other)
575
583
  * @param {string} [data.comment] - Optional comment
576
- * @returns {Promise<{status: string, student: object, teacher_payment_created?: object}>}
584
+ * @returns {Promise<StopStudentResponse>}
577
585
  */
578
586
  async stopStudent(studentId, data) {
579
587
  return await this.client.post(
@@ -582,6 +590,20 @@ class SalaryAPI {
582
590
  );
583
591
  }
584
592
 
593
+ /**
594
+ * Resume stopped student enrollment (Admin only)
595
+ * @param {number} studentId - Student ID
596
+ * @param {object} [data] - Resume data
597
+ * @param {string} [data.comment] - Optional comment
598
+ * @returns {Promise<ResumeStudentResponse>}
599
+ */
600
+ async resumeStudent(studentId, data = {}) {
601
+ return await this.client.post(
602
+ `/api/v1/admin/progress/${studentId}/resume`,
603
+ data,
604
+ );
605
+ }
606
+
585
607
  /**
586
608
  * Get student by ID (requireAuth)
587
609
  * @param {number} studentId - Student ID
@@ -612,6 +634,21 @@ class SalaryAPI {
612
634
  return await this.client.get("/api/v1/admin/students", { params });
613
635
  }
614
636
 
637
+ /**
638
+ * Get stopped students list (Admin only)
639
+ * @param {object} [params] - Filter parameters
640
+ * @param {string} [params.search] - Search by name or phone
641
+ * @param {number} [params.manager_id] - Filter by manager ID
642
+ * @param {number} [params.teacher_id] - Filter by teacher ID
643
+ * @param {string} [params.stop_reason] - Filter by stop reason
644
+ * @param {number} [params.page=1] - Page number
645
+ * @param {number} [params.limit=30] - Page size
646
+ * @returns {Promise<object>}
647
+ */
648
+ async getStoppedStudents(params = {}) {
649
+ return await this.client.get("/api/v1/admin/students/stopped", { params });
650
+ }
651
+
615
652
  /**
616
653
  * Get students of specific manager (Admin provides manager_id, Manager gets own students)
617
654
  * @param {object} [params] - Filter parameters
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nazar-salary",
3
- "version": "2.7.1",
3
+ "version": "2.8.1",
4
4
  "description": "Frontend library for Nazar Salary API",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",