Skip to content

Commit

Permalink
feat (experiment): new experiment setup with nurses
Browse files Browse the repository at this point in the history
  • Loading branch information
santanche committed Oct 23, 2023
1 parent e3e0296 commit 58e47ef
Show file tree
Hide file tree
Showing 34 changed files with 3,297 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/adonisjs/public/dccs
Submodule dccs updated 1 files
+2 −2 lib/oid/oid-full-dev.js
235 changes: 235 additions & 0 deletions src/adonisjs/public/infra/dcc-basic-jacinto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
(function () {
DCC.component(
'submit-login',
'dcc-submit',
{
pre: function (message, form, schema) {
// console.log('============ logging')
if (form.checkValidity() === false) {
for ( i = 0; i < form.elements.length; i++){
if(form[i].required && form[i].validity.valid){
form[i].classList.add('is-valid')
form[i].classList.remove('is-invalid')
}else{
form[i].classList.add('is-invalid')
form[i].classList.remove('is-valid')
}
}
// console.log('form invalid')
return false
}
// console.log('form valid')
for ( i = 0; i < form.elements.length; i++){
// form[i].classList.add('is-valid')
form[i].classList.remove('is-invalid')
}
// form.classList.add('was-validated')
return true

},
pos: function (response) {
// console.log(response['harena-login']['response'])
if(response['harena-login']['response'] === 'Login successful'){
// console.log('login successful');
if(document.querySelector('#login-message-alert')){
document.querySelector('#btn-submit-login').firstElementChild.innerHTML = 'Logging...'
document.querySelector('#login-message-alert').innerHTML = response['harena-login']['response']
document.querySelector('#login-message-alert').classList.add('alert-success')
document.querySelector('#login-message-alert').classList.remove('alert-danger')

}

setTimeout(function(){
if(new URL(document.location).searchParams.get('redirected')){
let redirectTo = sessionStorage.getItem('redirectBack')
if(redirectTo == null || redirectTo == '')
redirectTo = '/index-jacinto.html'
sessionStorage.removeItem('redirectBack')
window.location.href = redirectTo
}else{
sessionStorage.removeItem('redirectBack')
window.location.href = '/index-jacinto.html'
}

}, 2000)
}else if (response['harena-login']['response'] === 'Email or password incorrect'){
// console.log('login failed, password or email incorrect');
if(document.querySelector('#login-message-alert')){
document.querySelector('#login-message-alert').innerHTML = response['harena-login']['response']
document.querySelector('#login-message-alert').classList.add('alert-danger')
document.querySelector('#login-message-alert').classList.remove('alert-success')

document.querySelector('#email').classList.add('is-invalid')
document.querySelector('#password').classList.add('is-invalid')

}
}
}
}
)
DCC.component(
'submit-logout',
'dcc-submit',
{
pre: async function (message, form, schema) {
if(MessageBus.progn && MessageBus.progn.hasSubscriber('user/#')){
// console.log('============ if logout')
MessageBus.progn.publish(`user/logout/${sessionStorage.getItem('harena-user-id')}`)
// console.log(await MessageBus.progn.waitMessage('system/logout/ready'))
// console.log('============ true')
return true
}else{
// console.log('============ else logout')
return true
}
},
pos: function (response) {
// console.log(response)
window.location.href = '/index-jacinto.html'
}
}
)

DCC.component(
'submit-change-password',
'dcc-submit',
{
pos: async function (response) {
// console.log(response['harena-change-password'])
const responseContainer = document.querySelector('#updatePasswordResponse')
responseContainer.innerHTML = response['harena-change-password']
if(response['harena-change-password'] === 'Password changed successfully.'){
// console.log('if')
responseContainer.classList.remove('text-danger')
responseContainer.classList.add('text-success')
const promise = new Promise((resolve, reject) => {
setTimeout(() => resolve(window.location.href = '/index-jacinto.html'), 1000)
})
}else {
// console.log('else')
responseContainer.classList.remove('text-success')
responseContainer.classList.add('text-danger')
}
}
}
)

DCC.component(
'submit-case-property',
'dcc-submit',
{
pos: async function (response) {
// console.log('============ pos dcc-submit prop')
let propValue = null
if(response['harena-case-property']['case_property']){
propValue = response['harena-case-property']['case_property']['value']
}else{
propValue = response['harena-case-property']['value']
}
LayoutController.instance.feedbackButtonCaseState(propValue)
}
}
)

DCC.component(
'submit-save-case-and-property',
'dcc-submit',
{
pre: function (message, form, schema) {
const saveCase = document.querySelector(`button[id="btn-save-draft"]`)
saveCase.click()
return true
},
pos: async function (response) {

// console.log(response)
let propValue = null
if(response['harena-case-property']['case_property']){
propValue = response['harena-case-property']['case_property']['value']
}else{
propValue = response['harena-case-property']['value']
}
LayoutController.instance.labDeliverButtonCaseState(propValue)
}
}
)

DCC.component(
'submit-filter',
'dcc-submit',
{
pre: function (message, form, schema) {
// console.log('============ pre submit-filter')
// console.log(message['value'])
// console.log('============ form')
// console.log(form)
var url = new URL(document.location)
for(_info in message['value']){
url.searchParams.set(_info,message['value'][_info])
}
document.location = url
return true

},
pos: function (response) {

}
}
)

DCC.component(
'submit-share',
'dcc-submit',
{
pre: function (message, form, schema) {
$('#notice-modal').modal('show')
var txt = document.querySelector('#modal-notice-txt')
var modalBody = document.querySelector('#modal-notice-body')
txt.innerHTML = 'Sharing cases...'

modalBody.classList.remove('bg-danger')
modalBody.classList.remove('bg-success')
txt.classList.remove('text-white')
modalBody.classList.add('bg-white')
txt.classList.add('text-secondary')

return true
},
pos: async function (response) {

// console.log(response['harena-share-cases'].message)
var txt = document.querySelector('#modal-notice-txt')
var modalBody = document.querySelector('#modal-notice-body')

txt.innerHTML = response['harena-share-cases'].message
if(response['harena-share-cases'].message.includes('Error')){
modalBody.classList.remove('bg-success')
modalBody.classList.remove('bg-white')
txt.classList.remove('text-secondary')
modalBody.classList.add('bg-danger')
txt.classList.add('text-white')
}else if(response['harena-share-cases'].message.includes("Cannot read property 'split'")){
txt.innerHTML = 'Error. Please select at least one case to share.'

modalBody.classList.remove('bg-success')
modalBody.classList.remove('bg-white')
txt.classList.remove('text-secondary')
modalBody.classList.add('bg-danger')
txt.classList.add('text-white')
}else{
modalBody.classList.remove('bg-danger')
modalBody.classList.remove('bg-white')
txt.classList.remove('text-secondary')
modalBody.classList.add('bg-success')
txt.classList.add('text-white')
}

setTimeout(function(){
$('#notice-modal').modal('hide')
}, 7000)

}
}
)

})()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/adonisjs/public/player/case/images/heart/images/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Image Sources

* `heart1.svg` - https://pixabay.com/vectors/human-heart-blood-flow-1700453/
* `heart2.svg` - https://pixabay.com/vectors/anatomical-healthcare-heart-human-2023188/

* `character-2023874.svg` - https://pixabay.com/vectors/character-creature-robot-2023874/
Loading

0 comments on commit 58e47ef

Please sign in to comment.