Skip to content

Commit

Permalink
Ajustes de revisao
Browse files Browse the repository at this point in the history
  • Loading branch information
urielfcampos committed May 18, 2019
1 parent 0687a9e commit 88fe587
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 51 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ sw.*
# dev and test databases
dev.sqlite3
test.sqlite3

#storage
storage/
35 changes: 17 additions & 18 deletions components/importStudents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<p class="title">
Importar alunos (SIGAA)
</p>
<p class="subtitle">Curso: {{ displayCurso() }}</p>
<p class="subtitle">Curso: {{ course }}</p>
<b-field class="file">
<b-upload v-model="studentsCsv" @input="validateUpload">
<a class="button is-primary">
Expand All @@ -22,7 +22,7 @@
</span>
<button
class="button is-primary"
:disabled="hasErrors || noFileSelected()"
:disabled="toggleUpload"
@click="uploadCsv"
>
Submeter
Expand All @@ -45,37 +45,36 @@ export default {
data() {
return {
studentsCsv: new File([''], 'Nenhum arquivo selecionado'),
course: '',
course: 'Selecione um arquivo',
hasErrors: false,
isLoading: false
}
},
methods: {
displayCurso() {
computed: {
toggleUpload() {
return this.hasErrors || !this.FileSelected()
}
},
watch: {
studentsCsv() {
const reader = new FileReader()
let csv
if (!this.noFileSelected()) {
let csv = File
if (this.FileSelected()) {
reader.readAsText(this.studentsCsv)
reader.onload = e => {
csv = reader.result
csv = csv.replace('\r\n', '\n')
const lines = csv.split('\n')
const col = lines[1].split(',')
// eslint-disable-next-line no-console
console.log('lines', col)
this.course = col[7]
}
return this.course
} else return 'Selecione um arquivo '
},
noFileSelected() {
// eslint-disable-next-line no-console
console.log(
'conditional',
this.hasErrors || this.studentsCsv.name === 'Nenhum arquivo selecionado'
)
return this.studentsCsv.name === 'Nenhum arquivo selecionado'
}
},
methods: {
FileSelected() {
return this.studentsCsv.name !== 'Nenhum arquivo selecionado'
},
validateUpload() {
if (this.studentsCsv.name.split('.').pop() === 'csv') {
Expand Down
2 changes: 1 addition & 1 deletion components/searchInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export default {
page: this.page,
sort: this.sortField,
order: this.sortOrder === 'asc' ? 'ASC' : 'DESC',
isActive: this.isActive !== 3 ? this.isActive : null,
isActive: this.isActive !== 'AllStudents' ? this.isActive : null,
...maybeParam('name', this.searchName),
...maybeParam('registrationNumber', this.searchRegistration),
...maybeParam('email', this.searchEmail)
Expand Down
46 changes: 21 additions & 25 deletions components/studentComboBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@
</td>
<td>
<a
v-if="!checkDocumentIsNotEmpty(ataDocument)"
:href="
`http://localhost:3000${ataDocument.URL}/download`
"
v-if="!checkDocumentIsEmpty(ataDocument)"
:href="`${ataDocument.URL}/download`"
target="_blank"
>
<b-icon icon="file-pdf"></b-icon>
Expand All @@ -64,7 +62,7 @@
>
<a
class="button is-primary"
:disabled="!ataCheck || !canEdit"
:disabled="disableUpload"
>
<b-icon icon="upload"></b-icon>
</a>
Expand All @@ -81,8 +79,9 @@
</td>
<td>
<a
v-if="checkDocumentIsNotEmpty(laudaDocument)"
:href="laudaDocument.url"
v-if="!checkDocumentIsEmpty(laudaDocument)"
:href="`${ataDocument.URL}/download`"
target="_blank"
>
<b-icon icon="file-pdf"></b-icon>
</a>
Expand Down Expand Up @@ -127,8 +126,9 @@
</td>
<td>
<a
v-if="checkDocumentIsNotEmpty(presDocument)"
:href="presDocument.url"
v-if="!checkDocumentIsEmpty(presDocument)"
:href="`${ataDocument.URL}/download`"
target="_blank"
>
<b-icon icon="file-pdf"></b-icon>
</a>
Expand Down Expand Up @@ -203,13 +203,16 @@ export default {
uploadFile: File,
crg: '',
pendencies: '',
studentData: Object.assign(this.student),
studentData: Object.assign({}, this.student),
isLoading: false
}
},
computed: {
displayStatus() {
return '"Sei não, hein?"'
},
disableUpload() {
return !this.ataCheck || !this.canEdit
}
},
created() {
Expand All @@ -232,12 +235,9 @@ export default {
},
putStudents() {
this.isLoading = true
const student = Object.assign(this.studentData)
// student.pendencies = this.pendencies
// student.cd = this.CdCheck
this.$axios
.put(`/api/students/${this.student.id}`, student)
.put(`/api/students/${this.student.id}`, this.studentData)
.then(res => {
this.isLoading = false
this.studentData = res.data
Expand All @@ -255,29 +255,27 @@ export default {
this.canEdit = !this.canEdit
},
mapDocuments(documents) {
// eslint-disable-next-line no-console
console.log(documents)
documents.forEach(element => {
if (element.type === 1) {
this.ataDocument = Object.assign(element)
this.ataDocument = Object.assign({}, element)
this.ataCheck = true
} else if (element.type === 2) {
Object.assign(this.laudaDocument, element)
this.laudaDocument = Object.assign({}, element)
this.laudaCheck = true
} else if (element.type === 3) {
Object.assign(this.presDocument, element)
this.presDocument = Object.assign({}, element)
this.presCheck = true
}
})
},
checkDocumentIsNotEmpty(document) {
checkDocumentIsEmpty(document) {
return (
!Object.entries(document).length === 0 &&
document.constructor === Object
Object.entries(document).length === 0 &&
typeof document === 'object' &&
document !== null
)
},
documentUpload(type) {
// TODO ENDPOINT
this.isLoading = true
const body = new FormData()
body.append('file', this.uploadFile)
Expand Down Expand Up @@ -308,8 +306,6 @@ export default {
})
},
validateUpload(type) {
// eslint-disable-next-line no-console
console.log(this.uploadFile)
if (this.uploadFile.name.split('.').pop() === 'pdf') {
this.documentUpload(type)
} else {
Expand Down
12 changes: 6 additions & 6 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a
v-if="showSideNavBurger"
href="#"
role="button"
class="navbar-burger burger"
:class="{ 'is-active': showNavBurger }"
class="navbar-burger burger is-marginless is-pulled-left"
:class="{ 'is-active': active }"
aria-label="menu"
aria-expanded="false"
data-target="navbarBasicExample"
@click="showNavBurger = !showNavBurger"
@click="active = !active"
>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
<a
v-if="showSideNavBurger"
href="#"
role="button"
class="navbar-burger burger"
:class="{ 'is-active': active }"
:class="{ 'is-active': showNavBurger }"
aria-label="menu"
aria-expanded="false"
data-target="navbarBasicExample"
@click="active = !active"
@click="showNavBurger = !showNavBurger"
>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
Expand Down
2 changes: 1 addition & 1 deletion pages/allStudents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<search-input
:title="'Alunos totais'"
:students="students"
:is-active="3"
:is-active="'AllStudents'"
></search-input>
</div>
</template>
Expand Down
Binary file removed storage/201704940001/201704940001-ATA.pdf
Binary file not shown.

0 comments on commit 88fe587

Please sign in to comment.