Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
santanche committed Sep 4, 2023
2 parents 953c8af + eb43f5b commit e6e1a7e
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 24 deletions.
13 changes: 13 additions & 0 deletions src/adonisjs/public/author/drafts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,22 @@ <h5 class="modal-title">Filter by:</h5>
<option value="student">Student</option>
</select>
</div>
<div class="pr-3" style="width: 120px;">
<dcc-rest id="harena-user-groups" bind="harena-user-groups"></dcc-rest>
<dcc-dhtml id="harena-dhtml-groups" connect="retrieve:harena-user-groups:service/request/get">
<select id="fGroup" name="fGroup" class="custom-select custom-select-sm">
<option selected value="">Group</option>
{{@foreach . group}}
<option value={{group.group_id}}>{{group.group_title}}</option>
{{@endfor}}
</select>
</dcc-dhtml>
</div>

<div class="pr-3" style="width: 120px;">
<input type="text" class="form-control custom-select-sm" id="fSpecialty" placeholder="Specialty">
</div>

<input type="text" class="mr-2 my-2 form-control custom-select-sm" id="fSearchStr"
placeholder="Search similar title, keywords or description...">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@
// console.log('============',this.getDateString(currentDate))
// console.log('============',this.getTimeString(this.labRelease[1]))
// console.log('============',this.convertToLocalTz(currentDate,true))
console.log(labProgressManager.i.lab)
let createdBtn = false
let released = true
const lateReleaseTxt = 'Não publicado...(atraso)'
Expand Down
89 changes: 86 additions & 3 deletions src/adonisjs/public/author/env/inf331_2023/lab/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
<script src="/author/js/author.js"></script>

<script src="/author/env/inf331_2023/js/lab-rest-proxy.js"></script>
<script src="/author/env/inf331_2023/js/lab-progress.js"></script>
</head>

<body onload="AuthorManager.i.start()">
Expand All @@ -146,6 +147,89 @@ <h5 class="" id="modal-notice-txt"></h5>
<!-- Login/logout header -->
<dcc-include src="/author/partials/header.html"></dcc-include>
<dcc-rest id="harena-case" bind="harena-case" subscribe="service/request/get"></dcc-rest>
<dcc-dhtml id="dhtml-case" subscribe="service/response/get/harena-case:update">
<div class="modal fade" id="settings-modal" tabindex="-1" role="dialog" aria-labelledby="settings-modal" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<h3>Settings</h3>
<form>
<input type="hidden" id="case_id" name="case_id" value="{{id}}">
<input type="hidden" id="case_source" name="case_source" value="{{source}}">

<div class="form-group">
<label for="case_title">Title</label>
<input type="text" class="form-control" id="case_title" name="case_title" value="{{title}}" placeholder="Enter the title">
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea class="form-control" id="description" name="description">{{description}}</textarea>
</div>
<div class="form-group">
<label for="creationDate">Creation Date</label>
<input type="date" class="form-control" id="creationDate" name="creationDate" value="{{original_date}}">
{{-- <small id="keywords-help" class="form-text text-muted">Inform the date of case creation on Jacinto Moodle</small> --}}
</div>
<div class="form-group">
<label for="language">Language</label>
<select name="language" id="language" value="{{language}}">
<option value="{{language}}" selected disabled hidden>{{language}}</option>
<option value="pt-BR">Portuguese (Brazil)</option>
<option value="pt-PT">Portuguese (Portugal)</option>
<option value="en">English</option>
</select>
</div>
<!-- <div class="form-group">
<label for="institution">Institution</label>
<select name="institution" id="institution" value="{{institution_acronym}}">
<option value="{{institution_acronym}}" selected disabled hidden>{{institution}}</option>
<option value="unicamp">Universidade Estadual de Campinas</option>
<option value="minho">Universidade do Minho</option>
</select>
</div> -->
<div class="form-group">
<label for="domain">Domain</label>
<select name="domain" id="domain" value="{{domain}}">
<option value="{{domain}}" selected disabled hidden>{{domain}}</option>
<option value="Medicine">Medicine</option>
<option value="Nurse">Nurse</option>
<option value="Physioterapy">Physioterapy</option>
<option value="Pharmacy">Pharmacy</option>
<option value="Occupational Therapy">Occupational Therapy</option>
</select>
</div>

<div class="form-group">
<label for="complexity">Complexity</label>
<select name="complexity" id="complexity" value="{{complexity}}">
<option value="{{complexity}}" selected disabled hidden>{{complexity}}</option>
<option value="undergraduate">Undergraduate</option>
<option value="postgraduate">Postgraduate</option>
</select>
</div>
<div class="form-group">
<label for="specialty">Specialty</label>
<input type="text" class="form-control" id="specialty" name="specialty" value="{{specialty}}" placeholder="Inform the case specialty">
</div>
<div class="form-group">
<label for="keywords">Keywords</label>
<textarea class="form-control" id="keywords" name="keywords" aria-describedby="keywords-help">{{keywords}}</textarea>
<small id="keywords-help" class="form-text text-muted">Inform your keywords separated by semicolon.</small>
</div>

<input type="hidden" id="source" name="source" value="{{source}}">
<button type="button" class="btn btn-secondary" id="btn-save-settings" data-toggle="modal" data-target="#settings-modal" >Save</button>
<dcc-button topic="control/case/save" label="SAVE" location="btn-save-settings" xstyle="out"></dcc-button>

<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
</form>

</div>
</div>
</div>
</div>

</dcc-dhtml>
<!-- Start of settings modal -->

<dcc-dhtml id="dhtml-case" subscribe="service/response/get/harena-case:update">
Expand Down Expand Up @@ -246,7 +330,7 @@ <h3>Settings</h3>
<select class="custom-select" id="entity" name="entity">
<option value="user">User </option>
<option selected value="institution">Institution</option>
<option value="group" hidden disabled >Group</option>
<option value="group">Group</option>
</select>
</div>
<div class="form-group col-md-4" id="wrapper-subject_grade">
Expand Down Expand Up @@ -337,8 +421,7 @@ <h5 class="" id="modal-notice-txt"></h5>
<!-- Page title and description -->
<div class="container-fluid">
<dcc-dhtml subscribe="service/response/get/harena-case:update">
<h1>Edit case - {{title}}</h1>
<h6 style="color:#808080;">Created by {{author_grade}}: {{username}} ({{institution_acronym}}). </h6>
<h1>{{title}}</h1>

</dcc-dhtml>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/adonisjs/public/author/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ <h3>Settings</h3>
<select class="custom-select" id="entity" name="entity">
<option value="user">User </option>
<option selected value="institution">Institution</option>
<option value="group" hidden disabled >Group</option>
<option value="group">Group</option>
</select>
</div>
<div class="form-group col-md-4" id="wrapper-subject_grade">
Expand Down
46 changes: 27 additions & 19 deletions src/adonisjs/public/infra/conditional-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,14 @@ class LayoutController {
dccSubmitProp.setAttribute('xstyle','btn btn-secondary m-1')
dccSubmitProp.setAttribute('label', "Entregar")
dccSubmitProp.setAttribute('topic','service/request/post')
// dccSubmitProp.setAttribute('connect','submit:harena-case-property:service/request/post')
dccSubmitProp.setAttribute('data-toggle','tooltip')
dccSubmitProp.setAttribute('data-placement','top')
dccSubmitProp.setAttribute('title',"Entregar laboratório para o/a professor/a.")
await formProp.appendChild(dccSubmitProp)

inputPropertyValue.value = '0'

//Disable save button if expiration date is met
}
// else if(userGrade === 'professor' || userGrade === 'coordinator'){
// dccSubmitProp.setAttribute('id','dcc-submit-feedback')
Expand Down Expand Up @@ -287,24 +287,26 @@ class LayoutController {

async labDeliverButtonCaseState (propValue){
const userGrade = LayoutController.user.message.grade
const btnFeedback = document.querySelector('#dcc-submit-feedback')
const btnLabDelivered = document.querySelector('#dcc-submit-feedback')
if(propValue){
LayoutController.case.message.property.complete = propValue
}
if(userGrade === 'student'){

let labN = LayoutController.case.message.keywords
labN = labN.substring(labN.length-1)
const expirationDate = labProgressManager.i.labExpiration[labN]
//Verifies property 'feedback' to disable button and change layout
if(LayoutController.case.message.property.complete){
if(LayoutController.case.message.property.complete == 0){

btnFeedback.firstElementChild.innerHTML = 'Entregue'
btnLabDelivered.firstElementChild.innerHTML = 'Entregue'
}
// else {
// btnFeedback.firstElementChild.innerHTML = 'Recieved'
// btnLabDelivered.firstElementChild.innerHTML = 'Recieved'
// }

btnFeedback.firstElementChild.classList.add('disabled')
btnFeedback.style.pointerEvents = 'none'
btnLabDelivered.firstElementChild.classList.add('disabled')
btnLabDelivered.style.pointerEvents = 'none'
document.querySelector('#dcc-submit-feedback').removeAttribute('topic')
document.querySelector('#dcc-submit-feedback').removeAttribute('connect')
try {
Expand All @@ -316,16 +318,22 @@ class LayoutController {
console.log(e)
}
}
btnFeedback.addEventListener("click", function(event) {
btnFeedback.firstElementChild.innerHTML = 'Entregue'
btnFeedback.firstElementChild.classList.add('disabled')
btnFeedback.style.pointerEvents = 'none'
btnLabDelivered.addEventListener("click", function(event) {
btnLabDelivered.firstElementChild.innerHTML = 'Entregue'
btnLabDelivered.firstElementChild.classList.add('disabled')
btnLabDelivered.style.pointerEvents = 'none'
document.querySelector('#dcc-submit-feedback').removeAttribute('topic')
document.querySelector('#dcc-submit-feedback').removeAttribute('connect')
document.querySelector('#harena-case-property').remove()
document.querySelector('#harena-inf331-complete-lab').remove()
})

if (expirationDate < new Date()){
const saveBtn = document.querySelector('#btn-save-draft')
saveBtn.innerHTML = 'Data da entrega expirada'
btnLabDelivered.firstElementChild.innerHTML = btnLabDelivered.firstElementChild.innerHTML == 'Entregar'?'Não entregue':'Entregue'
saveBtn.classList.add('disabled')
saveBtn.nextElementSibling.remove()
}
}
/*else if(userGrade === 'professor' || userGrade === 'coordinator'){
if(document.querySelector('#harena-inf331-complete-lab'))
Expand All @@ -335,13 +343,13 @@ class LayoutController {
let caseDccSubmit = document.querySelector('#dcc-submit-feedback')
if(LayoutController.case.message.property.feedback){
btnFeedback.firstElementChild.innerHTML = 'Notify as Complete'
btnLabDelivered.firstElementChild.innerHTML = 'Notify as Complete'
if(LayoutController.case.message.property.feedback == 1){
casePropertyRest.remove()
btnFeedback.firstElementChild.innerHTML = 'Notified as Complete'
btnFeedback.firstElementChild.classList.add('disabled')
btnFeedback.style.pointerEvents = 'none'
btnLabDelivered.firstElementChild.innerHTML = 'Notified as Complete'
btnLabDelivered.firstElementChild.classList.add('disabled')
btnLabDelivered.style.pointerEvents = 'none'
caseDccSubmit.removeAttribute('topic')
caseDccSubmit.removeAttribute('connect')
try {
Expand All @@ -352,8 +360,8 @@ class LayoutController {
}
}
btnFeedback.addEventListener("click", function(event) {
btnFeedback.firstElementChild.innerHTML = 'Notified as Complete'
btnLabDelivered.addEventListener("click", function(event) {
btnLabDelivered.firstElementChild.innerHTML = 'Notified as Complete'
})
}
}*/
Expand Down Expand Up @@ -438,7 +446,7 @@ class LayoutController {
// console.log('============ entered dynamic modal')
const selEntity = document.querySelector('#entity')
const wrapperSelEntity = document.querySelector('#wrapper-entity')
const selSubject = document.querySelector('#wrapper-subject .sel-institution')
const selSubject = document.querySelector('#wrapper-subject #subject')
const inputSubject = document.querySelector('#wrapper-input-subject')
const wrapperSelSubject = document.querySelector('#wrapper-subject')
const selSubjectGrade = document.querySelector('#subject_grade')
Expand Down
27 changes: 27 additions & 0 deletions src/adonisjs/public/infra/dcc-rest-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
'fSpecialty': new URL(document.location).searchParams.get('fSpecialty'),
'fPropertyValue': new URL(document.location).searchParams.get('fPropertyValue'),
'fSearchStr': new URL(document.location).searchParams.get('fSearchStr'),
'fGroup': new URL(document.location).searchParams.get('fGroup'),
'page': new URL(document.location).searchParams.get('page'),
'nItems': new URL(document.location).searchParams.get('limit'),
},
Expand All @@ -287,6 +288,8 @@
in: 'query'},
{name: 'fSearchStr',
in: 'query'},
{name: 'fGroup',
in: 'query'},
{name: 'page',
in: 'query'},
{name: 'nItems',
Expand Down Expand Up @@ -430,6 +433,30 @@
}
)

//Retrieves groups that user is a part of
DCC.component(
'harena-user-groups',
'dcc-rest',
{
environment: {
'url-manager': HarenaConfig.manager.url + HarenaConfig.manager.api,
},
oas: {
paths: {
'{url-manager}/group': {
'get': {
operationId: 'user-group-list',
parameters: [
{name: 'url-manager',
in: 'path'}
]
}
}
}
}
}
)

DCC.component(
'harena-ask-feedback',
'dcc-rest',
Expand Down

0 comments on commit e6e1a7e

Please sign in to comment.