@@ -164,14 +164,9 @@ export default {
164164 }
165165 } ,
166166
167- /**
168- * Fetches users related to attendance based on course, session, or group.
169- * @param {Object } params - Object with courseId, sessionId, and/or groupId.
170- * @returns {Promise<Array> } - List of users.
171- */
172- getAttendanceSheetUsers : async ( params ) => {
167+ getAttendanceSheetUsers : async ( attendanceId , params ) => {
173168 try {
174- const response = await axios . get ( `/attendance/users/context` , { params } )
169+ const response = await axios . get ( `/attendance/${ attendanceId } / users/context` , { params } )
175170 return response . data
176171 } catch ( error ) {
177172 console . error ( "Error fetching attendance sheet users:" , error )
@@ -215,27 +210,36 @@ export default {
215210 return response . data
216211 } ,
217212
218- /**
219- * Exports an attendance list to PDF format.
220- * @param {Number|String } attendanceId - ID of the attendance list.
221- * @returns {Promise<Blob> } - PDF file of the attendance list.
222- */
223- exportAttendanceToPdf : async ( attendanceId ) => {
224- const response = await axios . get ( `${ ENTRYPOINT } attendances/${ attendanceId } /export/pdf` , {
225- responseType : "blob" ,
226- } )
213+ exportAttendanceToPdf : async ( attendanceId , { cid, sid, gid } ) => {
214+ const response = await axios . get (
215+ `/attendance/${ attendanceId } /export/pdf` ,
216+ {
217+ params : { cid, sid, gid } ,
218+ responseType : "blob" ,
219+ }
220+ )
227221 return response . data
228222 } ,
229223
230- /**
231- * Exports an attendance list to XLS format.
232- * @param {Number|String } attendanceId - ID of the attendance list.
233- * @returns {Promise<Blob> } - XLS file of the attendance list.
234- */
235- exportAttendanceToXls : async ( attendanceId ) => {
236- const response = await axios . get ( `${ ENTRYPOINT } attendances/${ attendanceId } /export/xls` , {
237- responseType : "blob" ,
238- } )
224+ exportAttendanceToXls : async ( attendanceId , { cid, sid, gid } ) => {
225+ const response = await axios . get (
226+ `/attendance/${ attendanceId } /export/xls` ,
227+ {
228+ params : { cid, sid, gid } ,
229+ responseType : "blob" ,
230+ }
231+ )
232+ return response . data
233+ } ,
234+
235+ generateQrCode : async ( attendanceId , { cid, sid, gid } ) => {
236+ const response = await axios . get (
237+ `/attendance/${ attendanceId } /qrcode` ,
238+ {
239+ params : { cid, sid, gid } ,
240+ responseType : "blob" ,
241+ }
242+ )
239243 return response . data
240244 } ,
241245
@@ -250,4 +254,19 @@ export default {
250254 throw error
251255 }
252256 } ,
257+
258+ getAttendancesWithDoneCount : async ( params ) => {
259+ const response = await axios . get ( `/attendance/list_with_done_count` , { params } ) ;
260+ return response . data ;
261+ } ,
262+
263+ getStudentAttendanceData : async ( attendanceId ) => {
264+ try {
265+ const response = await axios . get ( `/attendance/${ attendanceId } /student-dates` )
266+ return response . data
267+ } catch ( error ) {
268+ console . error ( "Error fetching student attendance data:" , error )
269+ throw error
270+ }
271+ } ,
253272}
0 commit comments