/** * Created by Pensare Software. * User: Theo Weijmer * Date: 13/12/2017 * Time: 17:08 */ var notifyMe = function ( options, callback ) { dbo.notifyModel.init( options, callback ); } dbo.notifyModel = { title : ko.observable( null ), message : ko.observable( null ), notify : ko.observable( false ), alert : ko.observable( false ), noText : ko.observable( null ), yesText : ko.observable( null ), closeText: ko.observable( null ), callback : null, init: function ( options, callback ) { var vm = dbo.notifyModel; vm.callback = callback; vm.setOptions( options ); $( "#notify-me" ).modal( 'show' ); }, setOptions: function ( options ) { var vm = dbo.notifyModel; vm.title( options.title || '' ); vm.message( options.message || '' ); vm.notify( options.notify || true ); vm.noText( options.noText || 'Nee' ); vm.yesText( options.yesText || 'Ja' ); vm.closeText( options.closeText || 'ok' ); }, closeNo: function () { if ( typeof( dbo.notifyModel.callback ) == 'function' ) callback( false ); }, closeYes: function () { if ( typeof( dbo.notifyModel.callback ) == 'function' ) callback( true ); }, closeOk: function () { if ( typeof( dbo.notifyModel.callback ) == 'function' ) callback(); }, close: function () { if ( typeof( dbo.notifyModel.callback ) == 'function' ) callback(); } } ko.applyBindings( dbo.notifyModel, document.getElementById( "notify-me" ) );