-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77629ec
commit e20f6c0
Showing
10 changed files
with
205 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const BASE_API = 'https://webkiosk-server.azurewebsites.net/api'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { getAttendance, getDateWiseAttendance, getTimeTable } from './requests'; | ||
import { BASE_API } from './constants'; | ||
|
||
export { getAttendance, getDateWiseAttendance, getTimeTable, BASE_API }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import axios from 'axios'; | ||
import { BASE_API } from './constants'; | ||
|
||
export const getAttendance = async ({ | ||
enrollmentNumber, | ||
password, | ||
dateOfBirth, | ||
college, | ||
}) => { | ||
let formData = new FormData(); | ||
formData.append('enrll', String(enrollmentNumber)); | ||
formData.append('psswd', String(password)); | ||
formData.append('dob', String(dateOfBirth)); | ||
formData.append('college', String(college)); | ||
formData.append('type', 'S'); | ||
try { | ||
let res = await axios({ | ||
method: 'post', | ||
url: `${BASE_API}/attendance`, | ||
data: formData, | ||
config: { headers: { 'Content-Type': 'multipart/form-data' } }, | ||
}); | ||
return res.data; | ||
} catch (error) { | ||
console.log(error); | ||
return false; | ||
} | ||
}; | ||
|
||
export const getDateWiseAttendance = async ({ | ||
enrollmentNumber, | ||
password, | ||
dateOfBirth, | ||
college, | ||
}) => { | ||
let formData = new FormData(); | ||
formData.append('enrll', String(enrollmentNumber)); | ||
formData.append('psswd', String(password)); | ||
formData.append('dob', String(dateOfBirth)); | ||
formData.append('college', String(college)); | ||
formData.append('type', 'S'); | ||
try { | ||
let res = await axios({ | ||
method: 'post', | ||
url: `${BASE_API}/datewiseattendance`, | ||
data: formData, | ||
config: { headers: { 'Content-Type': 'multipart/form-data' } }, | ||
}); | ||
return res.data; | ||
} catch (error) { | ||
console.log(error); | ||
return false; | ||
} | ||
}; | ||
|
||
export const getTimeTable = async (subString, batch, year) => { | ||
try { | ||
let res = await axios.post( | ||
`${BASE_API}/timetable?batch=${batch}&subject=${subString}&year=${year}&college=62` | ||
); | ||
return res.data; | ||
} catch (error) { | ||
console.log(error); | ||
return false; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { | ||
getSubjectString, | ||
getCurrClass, | ||
getAttendance, | ||
} from './utilityFunctions'; | ||
|
||
export { getSubjectString, getCurrClass, getAttendance }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
export const getSubjectString = (attendance) => { | ||
let subject_codes = []; | ||
|
||
Object.keys(attendance).forEach((key) => | ||
subject_codes.push(key.substring(key.length - 11, key.length)) | ||
); | ||
|
||
let sub_string = ''; | ||
|
||
for (let i = 0; i < subject_codes.length; i++) { | ||
if (i == subject_codes.length - 1) { | ||
sub_string += subject_codes[i].split(' ')[1]; | ||
} else { | ||
sub_string += subject_codes[i].split(' ')[1] + ','; | ||
} | ||
} | ||
|
||
return sub_string; | ||
}; | ||
|
||
export const getCurrClass = (code, attendance) => { | ||
let res = ''; | ||
code = code.substring(code.length - 4, code.length); | ||
Object.keys(attendance).forEach((key) => { | ||
if (key.indexOf(code) > 0) { | ||
res = `${key.split(' - ')[0]}`; | ||
} | ||
}); | ||
return res; | ||
}; | ||
|
||
export const getAttendance = (code, att) => { | ||
let res; | ||
code = code.substring(code.length - 4, code.length); | ||
|
||
Object.keys(att).forEach((sub) => { | ||
if (sub.indexOf(code) > -1) { | ||
res = String(att[sub][0]['Total']).substring( | ||
0, | ||
att[sub][0]['Total'].length - 2 | ||
); | ||
} | ||
}); | ||
return res; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3872,6 +3872,11 @@ mkdirp@^0.5.1: | |
dependencies: | ||
minimist "^1.2.5" | ||
|
||
moment@^2.26.0: | ||
version "2.26.0" | ||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.26.0.tgz#5e1f82c6bafca6e83e808b30c8705eed0dcbd39a" | ||
integrity sha512-oIixUO+OamkUkwjhAVE18rAMfRJNsNe/Stid/gwHSOfHrOtw9EhAY2AHvdKZ/k/MggcYELFCJz/Sn2pL8b8JMw== | ||
|
||
morgan@^1.9.0: | ||
version "1.10.0" | ||
resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.10.0.tgz#091778abc1fc47cd3509824653dae1faab6b17d7" | ||
|
@@ -4446,6 +4451,14 @@ range-parser@~1.2.1: | |
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" | ||
integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== | ||
|
||
[email protected]: | ||
version "15.6.2" | ||
resolved "https://registry.yarnpkg.com/react-addons-shallow-compare/-/react-addons-shallow-compare-15.6.2.tgz#198a00b91fc37623db64a28fd17b596ba362702f" | ||
integrity sha1-GYoAuR/DdiPbZKKP0XtZa6NicC8= | ||
dependencies: | ||
fbjs "^0.8.4" | ||
object-assign "^4.1.0" | ||
|
||
react-devtools-core@^3.6.3: | ||
version "3.6.3" | ||
resolved "https://registry.yarnpkg.com/react-devtools-core/-/react-devtools-core-3.6.3.tgz#977d95b684c6ad28205f0c62e1e12c5f16675814" | ||
|
@@ -4512,6 +4525,14 @@ react-native-screens@~2.2.0: | |
dependencies: | ||
debounce "^1.2.0" | ||
|
||
react-native-snap-carousel@^3.9.1: | ||
version "3.9.1" | ||
resolved "https://registry.yarnpkg.com/react-native-snap-carousel/-/react-native-snap-carousel-3.9.1.tgz#6fd9bd8839546c2c6043a41d2035afbc6fe0443e" | ||
integrity sha512-xWEGusacIgK1YaDXLi7Gao2+ISLoGPVEBR8fcMf4tOOJQufutlNwkoLu0l6B8Qgsrre0nTxoVZikRgGRDWlLaQ== | ||
dependencies: | ||
prop-types "^15.6.1" | ||
react-addons-shallow-compare "15.6.2" | ||
|
||
[email protected]: | ||
version "3.1.2" | ||
resolved "https://registry.yarnpkg.com/react-native-view-shot/-/react-native-view-shot-3.1.2.tgz#8c8e84c67a4bc8b603e697dbbd59dbc9b4f84825" | ||
|