|
|
@@ -285,7 +285,7 @@ app.state.Home = function() |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function callSetAttendanceStatus( appId, status, profileChildId = null )
|
|
|
|
|
|
|
|
|
function callSetAttendanceStatus( appId, status, profileChildId = null)
|
|
|
{
|
|
|
{
|
|
|
app.core.Rpc.call(
|
|
|
app.core.Rpc.call(
|
|
|
'Appointment',
|
|
|
'Appointment',
|
|
|
@@ -301,11 +301,23 @@ app.state.Home = function() |
|
|
{
|
|
|
{
|
|
|
app.core.View.toastSuccess( _lc( 'SAVED' ) );
|
|
|
app.core.View.toastSuccess( _lc( 'SAVED' ) );
|
|
|
renderAppointmentItem( new app.model.Appointment( res.appointment, res.attendee_data ) );
|
|
|
renderAppointmentItem( new app.model.Appointment( res.appointment, res.attendee_data ) );
|
|
|
|
|
|
|
|
|
|
|
|
let profileContainer = profileChildId !== null ?
|
|
|
|
|
|
$('[data-row-child-profile-id="' + profileChildId + '"]') :
|
|
|
|
|
|
$('[data-row-parent="true"]');
|
|
|
|
|
|
if (status === 'accepted') {
|
|
|
|
|
|
profileContainer.find("section").hide();
|
|
|
|
|
|
profileContainer.find('[data-type="section-rsvp-icon-accepted"]').show();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
profileContainer.find("section").hide();
|
|
|
|
|
|
profileContainer.find('[data-type="section-rsvp-icon-unchecked"]').show();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
else
|
|
|
{
|
|
|
{
|
|
|
if ( res.err == 'max_reached' )
|
|
|
if ( res.err == 'max_reached' )
|
|
|
{
|
|
|
{
|
|
|
|
|
|
$rsvpContainer = $content.find( '[data-type="appointment-rsvp-container"][data-appointment-id="' + appId + '"]' ).first();
|
|
|
$rsvpContainer.find( '[data-type="section-rsvp-icon-loading"]' ).first().hide();
|
|
|
$rsvpContainer.find( '[data-type="section-rsvp-icon-loading"]' ).first().hide();
|
|
|
$rsvpContainer.find( '[data-type="section-rsvp-icon-unchecked"]' ).first().show();
|
|
|
$rsvpContainer.find( '[data-type="section-rsvp-icon-unchecked"]' ).first().show();
|
|
|
|
|
|
|
|
|
@@ -321,7 +333,8 @@ app.state.Home = function() |
|
|
'setAttendanceStatus',
|
|
|
'setAttendanceStatus',
|
|
|
{
|
|
|
{
|
|
|
appointmentId : appId,
|
|
|
appointmentId : appId,
|
|
|
status : 'waiting'
|
|
|
|
|
|
|
|
|
status : 'waiting',
|
|
|
|
|
|
profileChildId : profileChildId
|
|
|
},
|
|
|
},
|
|
|
function( res )
|
|
|
function( res )
|
|
|
{
|
|
|
{
|
|
|
@@ -334,6 +347,23 @@ app.state.Home = function() |
|
|
]
|
|
|
]
|
|
|
)
|
|
|
)
|
|
|
);
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
let profileContainer = profileChildId !== null ?
|
|
|
|
|
|
$('[data-row-child-profile-id="' + profileChildId + '"]') :
|
|
|
|
|
|
$('[data-row-parent="true"]');
|
|
|
|
|
|
|
|
|
|
|
|
profileContainer.find("section").hide();
|
|
|
|
|
|
profileContainer.find('[data-type="section-rsvp-icon-waiting"]').show();
|
|
|
|
|
|
|
|
|
|
|
|
// if (status === 'accepted') {
|
|
|
|
|
|
// profileContainer.find("section").hide();
|
|
|
|
|
|
// profileContainer.find('[data-type="section-rsvp-icon-accepted"]').show();
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// profileContainer.find("section").hide();
|
|
|
|
|
|
// profileContainer.find('[data-type="section-rsvp-icon-unchecked"]').show();
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
renderAppointmentItem( newAppointment );
|
|
|
renderAppointmentItem( newAppointment );
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
);
|
|
|
@@ -583,12 +613,12 @@ app.state.Home = function() |
|
|
}
|
|
|
}
|
|
|
else if ( "deadline_reject_over" === res.err )
|
|
|
else if ( "deadline_reject_over" === res.err )
|
|
|
{
|
|
|
{
|
|
|
app.core.View.alert( _lc( 'DEADLINE_REJECT_IS_OVER' ) );
|
|
|
|
|
|
|
|
|
app.core.View.toastError( _lc( 'DEADLINE_REJECT_IS_OVER' ) );
|
|
|
renderAppointmentItem( getAppointment( appId ) );
|
|
|
renderAppointmentItem( getAppointment( appId ) );
|
|
|
}
|
|
|
}
|
|
|
else if ( "appointment_is_cancelled" === res.err )
|
|
|
else if ( "appointment_is_cancelled" === res.err )
|
|
|
{
|
|
|
{
|
|
|
app.core.View.alert( _lc( 'APPOINTMENT_IS_ALREADY_CANCELLED' ) );
|
|
|
|
|
|
|
|
|
app.core.View.toastError( _lc( 'APPOINTMENT_IS_ALREADY_CANCELLED' ) );
|
|
|
renderAppointmentItem( getAppointment( appId ) );
|
|
|
renderAppointmentItem( getAppointment( appId ) );
|
|
|
}
|
|
|
}
|
|
|
else if ( "appointment_not_accessible" === res.err )
|
|
|
else if ( "appointment_not_accessible" === res.err )
|
|
|
@@ -620,6 +650,7 @@ app.state.Home = function() |
|
|
|
|
|
|
|
|
$rsvpContainer.find( '[data-type="section-rsvp-icon-accepted"]' ).first().hide();
|
|
|
$rsvpContainer.find( '[data-type="section-rsvp-icon-accepted"]' ).first().hide();
|
|
|
$rsvpContainer.find( '[data-type="section-rsvp-icon-unchecked"]' ).first().hide();
|
|
|
$rsvpContainer.find( '[data-type="section-rsvp-icon-unchecked"]' ).first().hide();
|
|
|
|
|
|
$rsvpContainer.find( '[data-type="section-rsvp-icon-waiting"]' ).first().hide();
|
|
|
$rsvpContainer.find( '[data-type="section-rsvp-icon-loading"]' ).first().show();
|
|
|
$rsvpContainer.find( '[data-type="section-rsvp-icon-loading"]' ).first().show();
|
|
|
|
|
|
|
|
|
app.core.View.showModal(
|
|
|
app.core.View.showModal(
|
|
|
@@ -634,24 +665,30 @@ app.state.Home = function() |
|
|
$modalRoot.on( 'click', '[data-type="rsvp-button-accept"]', function()
|
|
|
$modalRoot.on( 'click', '[data-type="rsvp-button-accept"]', function()
|
|
|
{
|
|
|
{
|
|
|
callSetAttendanceStatus( appId, "accepted", $(this).attr( 'data-child-profile-id' ) );
|
|
|
callSetAttendanceStatus( appId, "accepted", $(this).attr( 'data-child-profile-id' ) );
|
|
|
app.core.View.closeModal();
|
|
|
|
|
|
|
|
|
console.log('accept');
|
|
|
|
|
|
//app.core.View.closeModal();
|
|
|
|
|
|
//renderAppointmentItem( appointment );
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
$modalRoot.on( 'click', '[data-type="rsvp-button-recall"]', function()
|
|
|
$modalRoot.on( 'click', '[data-type="rsvp-button-recall"]', function()
|
|
|
{
|
|
|
{
|
|
|
callSetAttendanceStatus( appId, "declined", $(this).attr( 'data-child-profile-id' ) );
|
|
|
callSetAttendanceStatus( appId, "declined", $(this).attr( 'data-child-profile-id' ) );
|
|
|
app.core.View.closeModal();
|
|
|
|
|
|
|
|
|
console.log('decline');
|
|
|
|
|
|
//app.core.View.closeModal();
|
|
|
|
|
|
//renderAppointmentItem( appointment );
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
'onHide' : function()
|
|
|
'onHide' : function()
|
|
|
{
|
|
|
{
|
|
|
const $modalRoot = app.core.View.getModalContent();
|
|
|
const $modalRoot = app.core.View.getModalContent();
|
|
|
$modalRoot.off( 'click', '[data-type="rsvp-button-accept"]' );
|
|
|
$modalRoot.off( 'click', '[data-type="rsvp-button-accept"]' );
|
|
|
|
|
|
console.log('onHide - 685');
|
|
|
|
|
|
renderAppointmentItem( getAppointment(appId) );
|
|
|
},
|
|
|
},
|
|
|
'onConfirm' : function()
|
|
|
'onConfirm' : function()
|
|
|
{
|
|
|
|
|
|
|
|
|
{
|
|
|
app.core.View.closeModal();
|
|
|
app.core.View.closeModal();
|
|
|
renderAppointmentItem( appointment );
|
|
|
|
|
|
|
|
|
console.log('onConfirm - 690');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
);
|
|
|
|