YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/Calendar/resources/ActivityStateModal.min.js

Summary

Maintainability
A
0 mins
Test Coverage
'use strict';

/* {[The file is published on the basis of YetiForce Public License 6.5 that can be found in the following directory: licenses/LicenseEN.txt or yetiforce.com]} */"use strict";jQuery.Class("Calendar_ActivityStateModal_Js",{},{registerActivityState:function registerActivityState(){var self=this;$(".js-activity-buttons button:not(.close)").on("click",function(e){var currentTarget=$(e.currentTarget),viewName=app.getViewName();if(app.hideModalWindow(),1===currentTarget.data("type"))self.updateActivityState(currentTarget);else {var isReminder=currentTarget.closest("#calendar-reminder-modal").length;if(currentTarget.hasClass("showQuickCreate")||isReminder){var progressIndicatorElement=$.progressIndicator({position:"html",blockInfo:{enabled:!0}}),url="index.php?module=Calendar&view=QuickCreateAjax&addRelation=true&sourceModule=Calendar&sourceRecord="+currentTarget.data("id")+"&fillFields=all",params={};params.noCache=!0,App.Components.QuickCreate.getForm(url,"Calendar",params).done(function(data){progressIndicatorElement.progressIndicator({mode:"hide"}),App.Components.QuickCreate.showModal(data,{callbackFunction:function callbackFunction(data){data&&data.success&&data.result.followup.value==currentTarget.data("id")&&self.updateActivityState(currentTarget);}});});}}});},updateActivityState:function updateActivityState(currentTarget){var params={module:"Calendar",action:"ActivityStateAjax",record:currentTarget.data("id"),state:currentTarget.data("state")};app.hideModalWindow();var progressIndicatorElement=jQuery.progressIndicator({position:"html",blockInfo:{enabled:!0}});AppConnector.request(params).done(function(data){if(data.success){var viewName=app.getViewName();if("Detail"===viewName){var thisInstance=Vtiger_Detail_Js.getInstance(),widget=$(".activityWidgetContainer .widgetContentBlock");if(widget.length)thisInstance.loadWidget(widget);else {var recentActivitiesTab=thisInstance.getTabByLabel(thisInstance.detailViewRecentActivitiesTabLabel);recentActivitiesTab&&recentActivitiesTab.trigger("click"),"Calendar"===app.getModuleName()&&(recentActivitiesTab=thisInstance.getSelectedTab().length&&thisInstance.getSelectedTab().data("linkKey")!=thisInstance.detailViewDetailsTabLabel?$("<div></div>"):thisInstance.getTabContainer().find("[data-link-key=\""+thisInstance.detailViewDetailsTabLabel+"\"]:not(.d-none)"),$(".showModal.closeCalendarRekord").addClass("d-none"),recentActivitiesTab.trigger("click"));}}if("List"===viewName){var listinstance=new Vtiger_List_Js;listinstance.getListViewRecords();}//updates the Calendar Reminder popup's status
"DashBoard"===viewName&&new Vtiger_DashBoard_Js().getContainer().find(".js-widget-refresh").trigger("click"),"Calendar"===app.getModuleName()&&"Calendar"===viewName&&(app.pageController.loadCalendarData(),app.pageController.getCalendarCreateView()),Vtiger_Index_Js.requestReminder(),progressIndicatorElement.progressIndicator({mode:"hide"});}else return !1});},registerEvents:function registerEvents(){this.registerActivityState();}}),jQuery(document).ready(function(){var instance=new Calendar_ActivityStateModal_Js;instance.registerEvents();});
//# sourceMappingURL=ActivityStateModal.min.js.map