(function(){"use strict";u8.Crm.Widgets.LyrisTargetGroupTransferScheduler=function(e,r){this.Widget(e,$.extend({},u8.Crm.Widgets.LyrisTargetGroupTransferScheduler.defaults,r));this.commandBindings={ScheduleTargetGroupTransfer:this._onCommandScheduleTargetGroupTransfer.bind(this)};this._create()};u8.Crm.Widgets.LyrisTargetGroupTransferScheduler.defaults={};u8.Crm.Widgets.LyrisTargetGroupTransferScheduler.makeClass({name:"LyrisTargetGroupTransferScheduler",deriveFrom:u8.Base.Widgets.Widget,events:["Create","Schedule"]});$.extend(u8.Crm.Widgets.LyrisTargetGroupTransferScheduler.prototype,{_create:function(){Function.chain({onError:"abort"},this._initViewModel,this._initTemplate,this._raiseCreateEvent).call(this)},_initViewModel:function(e){this._viewModel=u8.create("Model",{properties:{denyScheduleTransfer:this.status!=u8.Crm.Lyris.TransferTargetGroupToLyrisPreconditionStatus.canBeStarted}});e()},_initTemplate:function(e){this.$(this.element).utml({url:"~/crm/LyrisTargetGroupTransferScheduler.utml.htm",data:{transferScheduled:this.status===u8.Crm.Lyris.TransferTargetGroupToLyrisPreconditionStatus.alreadyScheduled,canSchedule:this.status===u8.Crm.Lyris.TransferTargetGroupToLyrisPreconditionStatus.canBeStarted},itemOptions:{parent:this,context:this._viewModel}},e)},_raiseCreateEvent:function(){this.raise("Create")},_onCommandScheduleTargetGroupTransfer:function(){this.scheduleTargetGroupTransfer()},scheduleTargetGroupTransfer:function(){var e=this;var r=function(r){var t={transferScheduled:r.success,errorMessage:r.errorMessage,canSchedule:!r.success};e.$(e.element).utml({url:"~/crm/LyrisTargetGroupTransferScheduler.utml.htm",data:t,itemOptions:{parent:e,context:e._viewModel}},function(){e.raise("Schedule")})};u8.services.lyris.scheduleTransferTargetGroupToLyris(this.activityUid,r)}})})();