Iniit
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
var Bizgaze;
|
||||
(function (Bizgaze) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Routes;
|
||||
(function (Routes) {
|
||||
let Components;
|
||||
(function (Components) {
|
||||
class routeaddress extends Unibase.Platform.Core.BaseComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.routeAddressIds = [];
|
||||
}
|
||||
cssFiles() {
|
||||
return [];
|
||||
}
|
||||
jsFiles() {
|
||||
return ['apps/routes/managers/routemanager.js'];
|
||||
}
|
||||
html(id, containerid) {
|
||||
let html = ``;
|
||||
return html;
|
||||
}
|
||||
load(id, containerid, callback) {
|
||||
}
|
||||
getrouteaddressids(containerid) {
|
||||
const instance = this;
|
||||
instance.routeAddressIds = [];
|
||||
$(`#layout_list_container_${containerid}`).find(".added-copy-item").each(function (i, e) {
|
||||
$(e).find('.index-number').text(i);
|
||||
var routeaddressid = $(e).find("#hf_routeaddressid").val();
|
||||
if (routeaddressid != 0) {
|
||||
instance.routeAddressIds.push(routeaddressid);
|
||||
}
|
||||
});
|
||||
return instance.routeAddressIds;
|
||||
}
|
||||
Updateindex(containerid) {
|
||||
var instance = this;
|
||||
$(`#layout_list_container_${containerid}`).sortable({
|
||||
update: function (event, ui) {
|
||||
Bizgaze.Apps.Routes.Components.routeaddress.Instance().getrouteaddressids(containerid);
|
||||
instance.updateRouteIndex();
|
||||
}
|
||||
});
|
||||
}
|
||||
updateRouteIndex() {
|
||||
var instance = this;
|
||||
instance.fileCacheHelper.loadJsFile("apps/routes/managers/routemanager.js", function () {
|
||||
Bizgaze.Apps.Routes.Managers.RouteManager.Instance().updateRouteIndexes(instance.routeAddressIds).then(function (response) {
|
||||
MessageHelper.Instance().showSuccess(response.message, '');
|
||||
});
|
||||
});
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new routeaddress();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
Components.routeaddress = routeaddress;
|
||||
})(Components = Routes.Components || (Routes.Components = {}));
|
||||
})(Routes = Apps.Routes || (Apps.Routes = {}));
|
||||
})(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
|
||||
})(Bizgaze || (Bizgaze = {}));
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"routeaddress.js","sourceRoot":"","sources":["routeaddress.ts"],"names":[],"mappings":"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"}
|
||||
+1
@@ -0,0 +1 @@
|
||||
var Bizgaze;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){class i extends Unibase.Platform.Core.BaseComponent{constructor(){super(...arguments);this.routeAddressIds=[]}cssFiles(){return[]}jsFiles(){return["apps/routes/managers/routemanager.js"]}html(){return``}load(){}getrouteaddressids(n){const t=this;return t.routeAddressIds=[],$(`#layout_list_container_${n}`).find(".added-copy-item").each(function(n,i){$(i).find(".index-number").text(n);var r=$(i).find("#hf_routeaddressid").val();r!=0&&t.routeAddressIds.push(r)}),t.routeAddressIds}Updateindex(t){var i=this;$(`#layout_list_container_${t}`).sortable({update:function(){n.Apps.Routes.Components.routeaddress.Instance().getrouteaddressids(t);i.updateRouteIndex()}})}updateRouteIndex(){var t=this;t.fileCacheHelper.loadJsFile("apps/routes/managers/routemanager.js",function(){n.Apps.Routes.Managers.RouteManager.Instance().updateRouteIndexes(t.routeAddressIds).then(function(n){MessageHelper.Instance().showSuccess(n.message,"")})})}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.routeaddress=i})(i=t.Components||(t.Components={}))})(i=t.Routes||(t.Routes={}))})(t=n.Apps||(n.Apps={}))})(Bizgaze||(Bizgaze={}));
|
||||
@@ -0,0 +1,431 @@
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var Bizgaze;
|
||||
(function (Bizgaze) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Routes;
|
||||
(function (Routes) {
|
||||
let Components;
|
||||
(function (Components) {
|
||||
class savegpstracking extends Unibase.Platform.Core.BaseComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.latid = 0;
|
||||
this.lngid = 0;
|
||||
this.isenable = false;
|
||||
this.Addrlatd = 0;
|
||||
this.Addrlgtd = 0;
|
||||
this.contactaddressid = 0;
|
||||
this.tripid = 0;
|
||||
}
|
||||
cssFiles() {
|
||||
return [];
|
||||
}
|
||||
jsFiles() {
|
||||
return [];
|
||||
}
|
||||
html(id, containerid) {
|
||||
let html = ``;
|
||||
return html;
|
||||
}
|
||||
load(id, containerid, callback) {
|
||||
}
|
||||
savegpstrackingtrip(containerid) {
|
||||
this.widgetContainerId = containerid;
|
||||
const instance = this;
|
||||
const containerEl = $(`#${containerid}`);
|
||||
let isTripEnabled = false;
|
||||
containerEl.find('.reach-btn').addClass('d-sm-none');
|
||||
containerEl.find('.starttrip-btn').click(function () {
|
||||
Unibase.Platform.Forms.Managers.FormManager.Instance().getFormbyUniqueId("Bizgazecrm_Create_MeterReading_Start_Trips").then(function (res) {
|
||||
var formid = res.result.FormId;
|
||||
const onSuccessObj = {
|
||||
CallBack: function () {
|
||||
var portletid = +$("#hf_DashboardPortletId").val();
|
||||
Unibase.Themes.Compact.Components.Nav.Instance().loadDashboard(portletid, '');
|
||||
},
|
||||
Parameters: null,
|
||||
};
|
||||
var formviewerObj = {
|
||||
FormId: formid,
|
||||
AppConfigurationId: 0,
|
||||
Pk_Value: 0,
|
||||
PortletWidgetId: 0,
|
||||
OnSuccess: onSuccessObj,
|
||||
OnFail: null,
|
||||
OnLoad: null,
|
||||
};
|
||||
Unibase.Platform.Forms.Components.FormViewer.Instance().init(formviewerObj);
|
||||
});
|
||||
});
|
||||
containerEl.find('.end-btn').click(function () {
|
||||
var ActiveId = 0;
|
||||
$(`#layout_list_container_${containerid} .gps-tracking-list`).each(function () {
|
||||
ActiveId = +$(this).find("#hf_activeid").val();
|
||||
});
|
||||
if (ActiveId != 0) {
|
||||
bootbox.alert({ message: 'Complete the ongoing Route before you end the Trip.', closeButton: false });
|
||||
}
|
||||
else {
|
||||
Unibase.Platform.Forms.Managers.FormManager.Instance().getFormbyUniqueId("BizgazeCrm_MeterReading_End_Trips").then(function (res) {
|
||||
var formid = res.result.FormId;
|
||||
const tripGroupId = +containerEl.find('#hf_tripgroupid').val();
|
||||
var onSuccessObj = {
|
||||
CallBack: function () {
|
||||
var portletid = +$("#hf_DashboardPortletId").val();
|
||||
Unibase.Themes.Compact.Components.Nav.Instance().loadDashboard(portletid, '');
|
||||
},
|
||||
Parameters: null,
|
||||
};
|
||||
const onloadObj = {
|
||||
CallBack: function () {
|
||||
var startreading = containerEl.find('hf_startreading').val();
|
||||
+$(".div_startreading").val(startreading);
|
||||
},
|
||||
Parameters: null,
|
||||
};
|
||||
var formviewerObj = {
|
||||
FormId: formid,
|
||||
AppConfigurationId: 0,
|
||||
Pk_Value: tripGroupId,
|
||||
PortletWidgetId: 0,
|
||||
OnSuccess: onSuccessObj,
|
||||
OnFail: null,
|
||||
OnLoad: onloadObj,
|
||||
};
|
||||
Unibase.Platform.Forms.Components.FormViewer.Instance().init(formviewerObj);
|
||||
});
|
||||
}
|
||||
});
|
||||
containerEl.find('.customer-btn').click(function () {
|
||||
instance.navigationHelper.showLoading();
|
||||
Unibase.Platform.Forms.Managers.FormManager.Instance().getFormbyUniqueId("Bizgaze_Platform_Crm_CreateCustomer_Duplicate2").then(function (res) {
|
||||
var formid = res.result.FormId;
|
||||
const onloadObj = {
|
||||
CallBack: function () {
|
||||
instance.navigationHelper.hideLoading();
|
||||
const containerEl = $(`#${containerid}`);
|
||||
const listEl = $(this).closest('.gps-tracking-list');
|
||||
var tripgroupid = +containerEl.find('#hf_tripgroupid').val();
|
||||
$(".hdn_refid").val(tripgroupid);
|
||||
},
|
||||
Parameters: null,
|
||||
};
|
||||
var formviewerObj = {
|
||||
FormId: formid,
|
||||
AppConfigurationId: 0,
|
||||
Pk_Value: 0,
|
||||
PortletWidgetId: 0,
|
||||
OnSuccess: null,
|
||||
OnFail: null,
|
||||
OnLoad: onloadObj,
|
||||
};
|
||||
Unibase.Platform.Forms.Components.FormViewer.Instance().init(formviewerObj);
|
||||
});
|
||||
});
|
||||
$(`#layout_list_container_${containerid} .gps-tracking-list`).each(function () {
|
||||
const tripid = +$(this).find('#hf_tripid').val();
|
||||
const tripstatusid = +$(this).find('#hf_tripstatusid').val();
|
||||
const routeid = +$(this).find('#hf_routeid').val();
|
||||
const tripgroupid = +$(this).find('#hf_tripgroupid').val();
|
||||
const latid = +$(this).find('#hf_latid').val();
|
||||
const lngid = +$(this).find('#hf_lngid').val();
|
||||
const Addrlatd = +$(this).find("#hf_addrlatd").val();
|
||||
const Addrlgtd = +$(this).find("#hf_addrlgtd").val();
|
||||
const ActiveId = +$(this).find("#hf_activeid").val();
|
||||
if (routeid) {
|
||||
$(this).find('.icon-route').removeClass('d-none');
|
||||
}
|
||||
if (tripgroupid) {
|
||||
containerEl.find('.starttrip-btn').addClass('d-none');
|
||||
containerEl.find('.end-btn').removeClass('d-none');
|
||||
containerEl.find('.customer-btn').removeClass('d-none');
|
||||
}
|
||||
else if (tripgroupid == 0) {
|
||||
isTripEnabled = true;
|
||||
containerEl.find('.customer-btn').addClass('d-none');
|
||||
}
|
||||
if (tripid) {
|
||||
$(this).find('.start-btn').addClass('d-none');
|
||||
$(this).find('.nav-btn,.reach-btn,.undo-btn').removeClass('d-none');
|
||||
$(this).find('.txt-task').addClass('d-none');
|
||||
}
|
||||
if (tripstatusid == 1) {
|
||||
isTripEnabled = true;
|
||||
}
|
||||
if (tripstatusid == 2) {
|
||||
isTripEnabled = true;
|
||||
$(this).find('.order-btn,.estimate-btn,.receipt-btn,.complete-btn,.cancel-btn,.create-btn').removeClass('d-none');
|
||||
$(this).find('.nav-btn,.reach-btn,.undo-btn').addClass('d-none');
|
||||
}
|
||||
if (tripstatusid == 3) {
|
||||
$(this).find('.end-btn,.cancel-btn,.order-btn,.estimate-btn,.receipt-btn,.complete-btn,.undo-btn,.nav-btn,.reach-btn,.create-btn').addClass('d-none');
|
||||
$(this).find('.cancelled-btn').removeClass('d-none');
|
||||
$(this).find('.start-btn').addClass('d-none trip-cancelled');
|
||||
}
|
||||
if (tripstatusid == 4) {
|
||||
$(this).find('.start-btn').addClass('d-none trip-completed');
|
||||
$(this).find('.end-btn,.cancel-btn,.order-btn,.estimate-btn,.receipt-btn,.complete-btn,.undo-btn,.nav-btn,.reach-btn,.create-btn').addClass('d-none');
|
||||
$(this).find('.txt-task').removeClass('d-none');
|
||||
}
|
||||
if (Addrlatd == 0 && Addrlgtd == 0) {
|
||||
$(this).find('.nav-btn').addClass('d-none');
|
||||
}
|
||||
if (ActiveId != 0) {
|
||||
isTripEnabled = true;
|
||||
}
|
||||
});
|
||||
const startBtns = $(`#layout_list_container_${containerid} .start-btn`);
|
||||
if (!isTripEnabled) {
|
||||
startBtns.not('.trip-completed,.trip-cancelled').removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
startBtns.addClass('d-none');
|
||||
}
|
||||
this.fileCacheHelper.loadJsFiles(['apps/routes/managers/routemanager.js', 'platform/forms/managers/formmanager.js', 'platform/forms/components/formviewer/formviewer.js', 'tenants/themes/compact/components/details/details.js'], function () {
|
||||
containerEl.find('.config-btn').click(function () {
|
||||
const clickedEl = $(this);
|
||||
const listEl = $(this).closest('.gps-tracking-list');
|
||||
let tripstatusid = 0;
|
||||
let refstatusid = 0;
|
||||
const employeeid = +listEl.find('#hf_employeeid').val();
|
||||
const routeaddressid = +listEl.find('#hf_routeaddressid').val();
|
||||
const contactaddressid = +listEl.find('#hf_contactaddressid').val();
|
||||
const routeid = +listEl.find('#hf_routeid').val();
|
||||
const contactid = +listEl.find('#hf_contactid').val();
|
||||
const routeversionguid = listEl.find('#hf_routeversionguid').val() || null;
|
||||
const formid = +listEl.find('#hf_formid').val() || 0;
|
||||
const endformid = +listEl.find('#hf_endformid').val();
|
||||
const tripid = +listEl.find('#hf_tripid').val();
|
||||
const latid = +listEl.find('#hf_latid').val();
|
||||
const lngid = +listEl.find('#hf_lngid').val();
|
||||
const organizationname = listEl.find('#hf_organizationname').val() && listEl.find('#hf_organizationname').val().toString();
|
||||
const tripgroupid = +listEl.find('#hf_tripgroupid').val();
|
||||
const Tripgroupstatusid = +listEl.find("#hf_tripgroupstatusid").val();
|
||||
const stageid = +listEl.find("#hf_stageid").val();
|
||||
const installedappid = +listEl.find("#hf_installedappid").val();
|
||||
const Addrlatd = +listEl.find("#hf_addrlatd").val();
|
||||
const Addrlgtd = +listEl.find("#hf_addrlgtd").val();
|
||||
if ($(this).hasClass('start-btn')) {
|
||||
tripstatusid = 1;
|
||||
refstatusid = 1;
|
||||
}
|
||||
if ($(this).hasClass('reach-btn')) {
|
||||
tripstatusid = 2;
|
||||
refstatusid = 2;
|
||||
}
|
||||
if ($(this).hasClass('complete-btn')) {
|
||||
tripstatusid = 4;
|
||||
refstatusid = 4;
|
||||
}
|
||||
const reqObj = { employeeid, routeaddressid, contactaddressid, routeid, contactid, routeversionguid, tripstatusid, tripgroupid, tripid, refstatusid };
|
||||
instance.reqObj = reqObj;
|
||||
instance.Addrlatd = Addrlatd;
|
||||
instance.Addrlgtd = Addrlgtd;
|
||||
instance.contactaddressid = contactaddressid;
|
||||
instance.tripid = tripid;
|
||||
if ($(this).hasClass('start-btn')) {
|
||||
var portletid = +$("#hf_DashboardPortletId").val();
|
||||
Unibase.Themes.Compact.Components.Nav.Instance().loadDashboard(portletid, '');
|
||||
Bizgaze.Apps.Routes.Managers.RouteManager.Instance().savegpstrackingtrip(reqObj).then(function (res) {
|
||||
if (res.result) {
|
||||
const result = JSON.parse(res.result).Result;
|
||||
if (result) {
|
||||
MessageHelper.Instance().showSuccess(res.message, '');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if ($(this).hasClass('reach-btn')) {
|
||||
if (instance.Addrlatd == 0 && instance.Addrlgtd == 0) {
|
||||
bootbox.confirm({
|
||||
size: "sm", message: "Please capture the Geo Location for this customer before reaching.", closeButton: false,
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/crm/address/components/w_address.js", function () {
|
||||
const addressInstance = Bizgaze.Apps.Crm.Components.Address.Instance();
|
||||
addressInstance.navigationHelper.popup(0, "", addressInstance, function () {
|
||||
addressInstance.editmap(instance.contactaddressid);
|
||||
addressInstance.isEmployeeDashboardRoute = true;
|
||||
}, Unibase.Platform.Helpers.Size.Auto);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (isMobileApp()) {
|
||||
instance.navigationHelper.showLoading();
|
||||
Unibase.Platform.Helpers.MobileHelper.Instance().getCurrentLocation(instance.tripid, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($(this).hasClass('undo-btn')) {
|
||||
bootbox.confirm({
|
||||
size: "sm", message: "Are you sure,Cancel the Trip",
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
Bizgaze.Apps.Routes.Managers.RouteManager.Instance().savegpstrackingtrip(reqObj).then(function (res) {
|
||||
if (res.result) {
|
||||
MessageHelper.Instance().showSuccess(res.message, '');
|
||||
var portletid = +$("#hf_DashboardPortletId").val();
|
||||
Unibase.Themes.Compact.Components.Nav.Instance().loadDashboard(portletid, '');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if ($(this).hasClass('complete-btn')) {
|
||||
Bizgaze.Apps.Routes.Managers.RouteManager.Instance().savegpstrackingtrip(reqObj).then(function (res) {
|
||||
if (res.result) {
|
||||
const result = JSON.parse(res.result).Result;
|
||||
if (result) {
|
||||
MessageHelper.Instance().showSuccess(res.message, '');
|
||||
var portletid = +$("#hf_DashboardPortletId").val();
|
||||
Unibase.Themes.Compact.Components.Nav.Instance().loadDashboard(portletid, '');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if ($(this).hasClass('nav-btn')) {
|
||||
if (Addrlatd > 0 && Addrlgtd > 0) {
|
||||
Unibase.Platform.Helpers.MobileHelper.Instance().NavigateMap(Addrlatd.toString(), Addrlgtd.toString());
|
||||
}
|
||||
}
|
||||
if ($(this).is('.order-btn,.estimate-btn,.receipt-btn')) {
|
||||
var formuniqueid = "";
|
||||
var isReceipt = false;
|
||||
let isOrder = false;
|
||||
let isEstimate = false;
|
||||
if ($(this).hasClass('order-btn')) {
|
||||
isOrder = true;
|
||||
formuniqueid = "Bizgaze_Extension_Transact_SalesOrder_App_SalesOrder_CreateForm";
|
||||
}
|
||||
if ($(this).hasClass('estimate-btn')) {
|
||||
isEstimate = true;
|
||||
formuniqueid = "Bizgaze_Extension_Transact_SalesEstimate_App_SalesEstimate_CreateForm";
|
||||
}
|
||||
if ($(this).hasClass('receipt-btn')) {
|
||||
isReceipt = true;
|
||||
formuniqueid = "Bizgaze_Extension_Transact_Receipt_App_Receipt_CreateForm";
|
||||
}
|
||||
Unibase.Platform.Forms.Managers.FormManager.Instance().getFormbyUniqueId(formuniqueid).then(function (res) {
|
||||
var formid = res.result.FormId;
|
||||
var onload = {
|
||||
CallBack: function () {
|
||||
const containerEl = $("#" + instance.navigationHelper.getLastContainerId());
|
||||
containerEl.find(".hdn_refid").val(tripgroupid);
|
||||
let contact = new Option(organizationname, contactid.toString(), true);
|
||||
if (isReceipt) {
|
||||
containerEl.find(".txtAutoComplete_contactid").append(contact).val(contactid).trigger("change");
|
||||
return;
|
||||
}
|
||||
containerEl.find('#hf_pk_value').after(`<input type="hidden" id="hf_employeerouteorder" data-contactid='${contactid}' data-organization='${organizationname}'>`);
|
||||
if (isOrder) {
|
||||
Bizgaze.Apps.Transact.Controls.Order.Instance().loadOrderFromEmployeeRoute();
|
||||
}
|
||||
else if (isEstimate) {
|
||||
Bizgaze.Apps.Transact.Controls.Estimate.Instance().loadEstimateFromEmployeeRoute();
|
||||
}
|
||||
},
|
||||
Parameters: null,
|
||||
};
|
||||
const onSuccess = {
|
||||
CallBack: function () {
|
||||
},
|
||||
Parameters: null
|
||||
};
|
||||
var formviewerObj = {
|
||||
FormId: formid,
|
||||
AppConfigurationId: 0,
|
||||
Pk_Value: 0,
|
||||
PortletWidgetId: 0,
|
||||
OnSuccess: onSuccess,
|
||||
OnFail: null,
|
||||
OnLoad: onload,
|
||||
};
|
||||
Unibase.Platform.Forms.Components.FormViewer.Instance().init(formviewerObj);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
setgpscurrentlocation(latid, lngid, tripid) {
|
||||
const instance = this;
|
||||
if (latid > 0 && lngid > 0) {
|
||||
Bizgaze.Apps.Routes.Managers.RouteManager.Instance().setgpscurrentlocation(latid, lngid, tripid).then(function (res) {
|
||||
instance.navigationHelper.hideLoading();
|
||||
if (res.status === Unibase.Data.Status.Success) {
|
||||
Bizgaze.Apps.Routes.Components.savegpstracking.Instance().getDistanceFromLatLonInKm(instance.Addrlatd, instance.Addrlgtd, latid, lngid).then(function (met) {
|
||||
if (met >= 100) {
|
||||
bootbox.alert({ message: 'Your are out of 100 meters range from the Customer. Please reach the customer location & click on Reached button.', closeButton: false });
|
||||
}
|
||||
else {
|
||||
Bizgaze.Apps.Routes.Managers.RouteManager.Instance().savegpstrackingtrip(instance.reqObj).then(function (res) {
|
||||
if (res.status === Unibase.Data.Status.Success) {
|
||||
var portletid = +$("#hf_DashboardPortletId").val();
|
||||
Unibase.Themes.Compact.Components.Nav.Instance().loadDashboard(portletid, '');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
MessageHelper.Instance().showError('Please Try Again Capturing', 'div_ErrorMessage', instance.widgetContainerId);
|
||||
}
|
||||
}
|
||||
Canceltrip(containerid, tripid) {
|
||||
var TripId = +tripid;
|
||||
tripid = TripId;
|
||||
const refstatusid = 3;
|
||||
const tripstatusid = 3;
|
||||
const reqObj = { tripid, refstatusid, tripstatusid };
|
||||
Bizgaze.Apps.Routes.Managers.RouteManager.Instance().savegpstrackingtrip(reqObj).then(function (res) {
|
||||
if (res.result) {
|
||||
MessageHelper.Instance().showSuccess(res.message, '');
|
||||
var portletid = +$("#hf_DashboardPortletId").val();
|
||||
Unibase.Themes.Compact.Components.Nav.Instance().loadDashboard(portletid, '');
|
||||
}
|
||||
});
|
||||
}
|
||||
getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const instance = this;
|
||||
var R = 6371;
|
||||
var dLat = this.deg2rad(lat2 - lat1);
|
||||
var dLon = this.deg2rad(lon2 - lon1);
|
||||
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
|
||||
Math.cos(this.deg2rad(lat1)) * Math.cos(this.deg2rad(lat2)) *
|
||||
Math.sin(dLon / 2) * Math.sin(dLon / 2);
|
||||
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
||||
var km = R * c;
|
||||
var met = km * 1000;
|
||||
return met;
|
||||
});
|
||||
}
|
||||
deg2rad(deg) {
|
||||
return deg * (Math.PI / 180);
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new savegpstracking();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
Components.savegpstracking = savegpstracking;
|
||||
})(Components = Routes.Components || (Routes.Components = {}));
|
||||
})(Routes = Apps.Routes || (Apps.Routes = {}));
|
||||
})(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
|
||||
})(Bizgaze || (Bizgaze = {}));
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,589 @@
|
||||
var Bizgaze;
|
||||
(function (Bizgaze) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Routes;
|
||||
(function (Routes) {
|
||||
let Components;
|
||||
(function (Components) {
|
||||
class scheduler extends Unibase.Platform.Core.BaseComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.arr = new Array();
|
||||
this.WeekWise = new Array();
|
||||
this.arr1 = new Array();
|
||||
}
|
||||
cssFiles() {
|
||||
return [];
|
||||
}
|
||||
jsFiles() {
|
||||
return ['apps/routes/managers/routemanager.js', 'platform/forms/managers/formmanager.js',
|
||||
'platform/forms/components/formviewer/formviewer.js'];
|
||||
}
|
||||
html(id, containerid) {
|
||||
let html = ``;
|
||||
return html;
|
||||
}
|
||||
load(id, containerid, callback) {
|
||||
}
|
||||
init(containerid) {
|
||||
this.arr = new Array();
|
||||
let tbl = "";
|
||||
var instance = this;
|
||||
instance.render(containerid);
|
||||
var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
|
||||
var RouteScheduleType = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_schedulertypeid").Value);
|
||||
var schedulerdates = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_schedulerdate").Value;
|
||||
$("#scheduler_spin").click(function () {
|
||||
Bizgaze.Apps.Routes.Components.scheduler.Instance().genetrateSchedulerDates(RouteScheduleType);
|
||||
});
|
||||
if (RouteScheduleType == 2) {
|
||||
$("#bizgazecrm_Routes_tbl_DayWise").show();
|
||||
tbl = $("#bizgazecrm_Routes_tbl_DayWise td");
|
||||
}
|
||||
else if (RouteScheduleType == 1) {
|
||||
$("#bizgazecrm_Routes_tbl_DateWise").show();
|
||||
tbl = $("#bizgazecrm_Routes_tbl_DateWise td");
|
||||
}
|
||||
else if (RouteScheduleType == 3) {
|
||||
$("#bizgazecrm_Routes_tbl_WeekWise").show();
|
||||
tbl = $("#bizgazecrm_Routes_tbl_WeekWise td");
|
||||
}
|
||||
Bizgaze.Apps.Routes.Components.scheduler.Instance().bindSelectedSchedulerTblCell(RouteScheduleType, schedulerdates, tbl);
|
||||
tbl.off('click').click(function (e) {
|
||||
var date;
|
||||
if ($(this).hasClass('click') || $(this).hasClass('')) {
|
||||
$(this).css('backgroundColor', '#7ABA7A');
|
||||
$(this).removeClass('click');
|
||||
$(this).addClass('Unclick');
|
||||
if (RouteScheduleType != 1 && RouteScheduleType != 3) {
|
||||
var row = $(this).parent().parent().children().index($(this).parent());
|
||||
var col = $(this).parent().children().index($(this));
|
||||
date = Bizgaze.Apps.Routes.Components.scheduler.Instance().getDateByDayWise(row, col + 1);
|
||||
}
|
||||
else {
|
||||
date = $(this).text();
|
||||
}
|
||||
if (RouteScheduleType == 3) {
|
||||
instance.arr = [];
|
||||
$('#bizgazecrm_Routes_tbl_WeekWise td.Unclick').each(function (index, el) {
|
||||
instance.arr.push($(el).find('.date-input').val().toString());
|
||||
});
|
||||
}
|
||||
var date = date;
|
||||
instance.fileCacheHelper.loadJsFile("apps/routes/managers/routemanager.js", function () {
|
||||
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length != 0) {
|
||||
var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
|
||||
var routeId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_routedefinitionid").Value);
|
||||
if (routeId != undefined && RouteScheduleType != 3) {
|
||||
Bizgaze.Apps.Routes.Components.scheduler.Instance().arr.push(date);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else if ($(this).hasClass('Unclick')) {
|
||||
$(this).css('backgroundColor', '#ffffff');
|
||||
$(this).removeClass('Unclick');
|
||||
$(this).addClass('click');
|
||||
if (RouteScheduleType != 1 && RouteScheduleType != 3) {
|
||||
var row = $(this).parent().parent().children().index($(this).parent());
|
||||
var col = $(this).parent().children().index($(this));
|
||||
date = Bizgaze.Apps.Routes.Components.scheduler.Instance().getDateByDayWise(row, col + 1);
|
||||
}
|
||||
else {
|
||||
date = $(this).text();
|
||||
}
|
||||
instance.fileCacheHelper.loadJsFile("apps/routes/managers/routemanager.js", function () {
|
||||
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length != 0) {
|
||||
var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
|
||||
var routeid = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_routedefinitionid").Value);
|
||||
if (routeid != undefined) {
|
||||
const index = Bizgaze.Apps.Routes.Components.scheduler.Instance().arr.indexOf(date, 0);
|
||||
if (index > -1) {
|
||||
Bizgaze.Apps.Routes.Components.scheduler.Instance().arr = Bizgaze.Apps.Routes.Components.scheduler.Instance().arr.filter(obj => obj !== date);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
render(containerid) {
|
||||
const instance = this;
|
||||
$("." + containerid).empty();
|
||||
let html = `<div class="card">
|
||||
<div class="card-header card-header-action">
|
||||
<div class="col-12">
|
||||
<span class="h6 ml-10">
|
||||
Scheduler
|
||||
<a href='javascript: ;' id='scheduler_spin' class='pull-right' onclick="" data-toggle="tooltip" title="ReConfigure"><i class='fa fa-refresh '></i></a>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body" style="overflow-x:auto;">
|
||||
|
||||
<table class="bg-white" id="bizgazecrm_Routes_tbl_DayWise" style="border: 1px solid #c6c6c6;text-align: left; border-collapse: collapse;width: 100%; display:none;">
|
||||
<tr>
|
||||
<th style="text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">First Week</th>
|
||||
<th style="text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">Second Week</th>
|
||||
<th style="text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">Third Week</th>
|
||||
<th style="text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">Fourth Week</th>
|
||||
<th style="text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">Fifth Week</th>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">SUN</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">SUN</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">SUN</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">SUN</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">SUN</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">MON</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">MON</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">MON</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">MON</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">MON</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">TUE</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">TUE</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">TUE</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">TUE</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">TUE</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">WED</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">WED</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">WED</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">WED</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">WED</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">THU</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">THU</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">THU</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">THU</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">THU</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">FRI</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">FRI</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">FRI</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">FRI</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">FRI</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">SAT</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">SAT</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">SAT</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">SAT</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">SAT</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="bg-white" id="bizgazecrm_Routes_tbl_DateWise" style="border: 1px solid #c6c6c6;text-align: left; border-collapse: collapse;width: 100%;display:none;">
|
||||
<tr>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">1</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">2</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">3</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">4</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">5</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">6</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">7</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">8</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">9</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">10</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">11</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">12</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">13</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">14</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">15</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">16</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">17</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">18</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">19</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">20</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">21</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">22</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">23</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">24</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">25</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">26</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">27</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">28</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">29</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">30</td>
|
||||
<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">31</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<table class="bg-white" id="bizgazecrm_Routes_tbl_WeekWise" style="border: 1px solid #c6c6c6;text-align: left; border-collapse: collapse;width: 100%;display:none;">
|
||||
<tr>
|
||||
<th style="text-align:center;border: 1px solid #c6c6c6; vertical-align: middle;" colspan="7" class="pa-10">WeekWise</th>
|
||||
</tr>
|
||||
<tr>
|
||||
${instance.getCurrentWeekTableHtml()}
|
||||
</tr>
|
||||
</table>
|
||||
<button id="btnsave" class='btn-sm bg-success pull-right mt-10' href='javascript: ;' type=button onclick="" >Save</button>
|
||||
</div>
|
||||
</div>`;
|
||||
$("." + containerid).append(html);
|
||||
$("#btnsave").off('click').on("click", function () {
|
||||
Bizgaze.Apps.Routes.Components.scheduler.Instance().saveroute();
|
||||
});
|
||||
}
|
||||
getDateByDayWise(row, col) {
|
||||
var date = "";
|
||||
if (row == 1) {
|
||||
switch (col) {
|
||||
case 1:
|
||||
date = "1";
|
||||
break;
|
||||
case 2:
|
||||
date = "8";
|
||||
break;
|
||||
case 3:
|
||||
date = "15";
|
||||
break;
|
||||
case 4:
|
||||
date = "22";
|
||||
break;
|
||||
case 5:
|
||||
date = "29";
|
||||
}
|
||||
}
|
||||
else if (row == 2) {
|
||||
switch (col) {
|
||||
case 1:
|
||||
date = "2";
|
||||
break;
|
||||
case 2:
|
||||
date = "9";
|
||||
break;
|
||||
case 3:
|
||||
date = "16";
|
||||
break;
|
||||
case 4:
|
||||
date = "23";
|
||||
break;
|
||||
case 5:
|
||||
date = "30";
|
||||
}
|
||||
}
|
||||
else if (row == 3) {
|
||||
switch (col) {
|
||||
case 1:
|
||||
date = "3";
|
||||
break;
|
||||
case 2:
|
||||
date = "10";
|
||||
break;
|
||||
case 3:
|
||||
date = "17";
|
||||
break;
|
||||
case 4:
|
||||
date = "24";
|
||||
break;
|
||||
case 5:
|
||||
date = "31";
|
||||
}
|
||||
}
|
||||
else if (row == 4) {
|
||||
switch (col) {
|
||||
case 1:
|
||||
date = "4";
|
||||
break;
|
||||
case 2:
|
||||
date = "11";
|
||||
break;
|
||||
case 3:
|
||||
date = "18";
|
||||
break;
|
||||
case 4:
|
||||
date = "25";
|
||||
;
|
||||
}
|
||||
}
|
||||
else if (row == 5) {
|
||||
switch (col) {
|
||||
case 1:
|
||||
date = "5";
|
||||
break;
|
||||
case 2:
|
||||
date = "12";
|
||||
break;
|
||||
case 3:
|
||||
date = "19";
|
||||
break;
|
||||
case 4:
|
||||
date = "26";
|
||||
}
|
||||
}
|
||||
else if (row == 6) {
|
||||
switch (col) {
|
||||
case 1:
|
||||
date = "6";
|
||||
break;
|
||||
case 2:
|
||||
date = "13";
|
||||
break;
|
||||
case 3:
|
||||
date = "20";
|
||||
break;
|
||||
case 4:
|
||||
date = "27";
|
||||
}
|
||||
}
|
||||
else if (row == 7) {
|
||||
switch (col) {
|
||||
case 1:
|
||||
date = "7";
|
||||
break;
|
||||
case 2:
|
||||
date = "14";
|
||||
break;
|
||||
case 3:
|
||||
date = "21";
|
||||
break;
|
||||
case 4:
|
||||
date = "28";
|
||||
break;
|
||||
case 4:
|
||||
date = "30";
|
||||
}
|
||||
}
|
||||
return date;
|
||||
}
|
||||
bindSelectedSchedulerTblCell(SchedulerType, schedulerdates, tbl) {
|
||||
var instance = this;
|
||||
this.getDateByDayWise;
|
||||
var tbl = "";
|
||||
var date = "";
|
||||
if (SchedulerType == 2) {
|
||||
$("#bizgazecrm_Routes_tbl_DayWise").show();
|
||||
tbl = $("#bizgazecrm_Routes_tbl_DayWise td");
|
||||
}
|
||||
else if (SchedulerType == 1) {
|
||||
$("#bizgazecrm_Routes_tbl_DateWise").show();
|
||||
tbl = $("#bizgazecrm_Routes_tbl_DateWise td");
|
||||
}
|
||||
else if (SchedulerType == 3) {
|
||||
$("#bizgazecrm_Routes_tbl_WeekWise").show();
|
||||
tbl = $("#bizgazecrm_Routes_tbl_WeekWise td");
|
||||
}
|
||||
if (schedulerdates != null && tbl) {
|
||||
var datesArr = schedulerdates.split("|");
|
||||
for (var i = 0; i < datesArr.length; i++) {
|
||||
if (datesArr[i] != "") {
|
||||
tbl.each(function () {
|
||||
if (SchedulerType === 1) {
|
||||
if ($(this).html() == datesArr[i]) {
|
||||
$(this).css('backgroundColor', '#8ec165');
|
||||
$(this).css('color', '#000000');
|
||||
$(this).addClass('Unclick');
|
||||
Bizgaze.Apps.Routes.Components.scheduler.Instance().arr.push(datesArr[i]);
|
||||
}
|
||||
}
|
||||
else if (SchedulerType === 2) {
|
||||
var row = $(this).parent().parent().children().index($(this).parent());
|
||||
var col = $(this).parent().children().index($(this));
|
||||
date = Bizgaze.Apps.Routes.Components.scheduler.Instance().getDateByDayWise(row, col + 1);
|
||||
if (date == datesArr[i]) {
|
||||
$(this).css('backgroundColor', '#8ec165');
|
||||
$(this).css('color', '#000000');
|
||||
$(this).addClass('Unclick');
|
||||
Bizgaze.Apps.Routes.Components.scheduler.Instance().arr.push(datesArr[i]);
|
||||
}
|
||||
}
|
||||
else if (SchedulerType === 3) {
|
||||
if ($(this).find(`.date-input[value=${datesArr[i]}]`).length) {
|
||||
$(this).css('backgroundColor', '#8ec165');
|
||||
$(this).css('color', '#000000');
|
||||
$(this).addClass('Unclick');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
genetrateSchedulerDates(schedulerType) {
|
||||
const instance = this;
|
||||
var tbl = "";
|
||||
var array = [];
|
||||
this.getDateByDayWise;
|
||||
var date = date;
|
||||
var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
|
||||
var RouteId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_routedefinitionid").Value);
|
||||
var assignto = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_employeeid").Value);
|
||||
$("#scheduler_spin").addClass("fa-spin");
|
||||
if (schedulerType == 1) {
|
||||
tbl = $("#bizgazecrm_Routes_tbl_DateWise td");
|
||||
var selectedDates = [];
|
||||
tbl.each(function () {
|
||||
if ($(this).hasClass('Unclick')) {
|
||||
selectedDates.push($(this).text());
|
||||
}
|
||||
});
|
||||
array = selectedDates;
|
||||
var SchedulerDates = array;
|
||||
var propsettingObj = {
|
||||
RouteId: RouteId,
|
||||
RouteScheduleId: 0,
|
||||
SchedulerDates: selectedDates,
|
||||
AssignedTo: assignto,
|
||||
FirstWeek: [],
|
||||
SecondWeek: [],
|
||||
ThirdWeek: [],
|
||||
FourthWeek: [],
|
||||
FifthWeek: []
|
||||
};
|
||||
this.fileCacheHelper.loadJsFile("apps/routes/managers/routemanager.js", function () {
|
||||
Bizgaze.Apps.Routes.Managers.RouteManager.Instance().SaveDateWiseScheduler(propsettingObj).then(function (response) {
|
||||
MessageHelper.Instance().showSuccess(response.message, '');
|
||||
var detailobj = Unibase.Themes.Compact.Components.Details.Instance();
|
||||
detailobj._recordId = Unibase.Themes.Providers.DetailHelper.recordId;
|
||||
detailobj._installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
|
||||
detailobj._containerId = Unibase.Platform.Helpers.NavigationHelper.Instance().getLastContainerId();
|
||||
var idetailObj = detailobj;
|
||||
detailobj.loadPortlets(idetailObj);
|
||||
});
|
||||
setTimeout(function () {
|
||||
$("#scheduler_spin").removeClass("fa-spin");
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
else if (schedulerType == 2) {
|
||||
var selectedFirstWeek = [];
|
||||
var selectedSecWeek = [];
|
||||
var selectedThirdWeek = [];
|
||||
var selectedFourthWeek = [];
|
||||
var selectedFifththWeek = [];
|
||||
$('#bizgazecrm_Routes_tbl_DayWise td').each(function (index, tr) {
|
||||
if ($(this).hasClass('Unclick')) {
|
||||
var row = $(this).parent().parent().children().index($(this).parent());
|
||||
var col = $(this).parent().children().index($(this));
|
||||
date = Bizgaze.Apps.Routes.Components.scheduler.Instance().getDateByDayWise(row, col + 1);
|
||||
if (date <= 7) {
|
||||
selectedFirstWeek.push(date);
|
||||
}
|
||||
else if (date <= 14) {
|
||||
selectedSecWeek.push(date);
|
||||
}
|
||||
else if (date <= 21) {
|
||||
selectedThirdWeek.push(date);
|
||||
}
|
||||
else if (date <= 28) {
|
||||
selectedFourthWeek.push(date);
|
||||
}
|
||||
else if (date <= 31) {
|
||||
selectedFifththWeek.push(date);
|
||||
}
|
||||
}
|
||||
});
|
||||
var propsettingObj = {
|
||||
RouteId: RouteId,
|
||||
RouteScheduleId: 0,
|
||||
SchedulerDates: [],
|
||||
AssignedTo: assignto,
|
||||
FirstWeek: selectedFirstWeek,
|
||||
SecondWeek: selectedSecWeek,
|
||||
ThirdWeek: selectedThirdWeek,
|
||||
FourthWeek: selectedFourthWeek,
|
||||
FifthWeek: selectedFifththWeek
|
||||
};
|
||||
this.fileCacheHelper.loadJsFile("apps/routes/managers/routemanager.js", function () {
|
||||
Bizgaze.Apps.Routes.Managers.RouteManager.Instance().saveWeekWiseScheduler(propsettingObj).then(function (response) {
|
||||
MessageHelper.Instance().showSuccess(response.message, '');
|
||||
var detailobj = Unibase.Themes.Compact.Components.Details.Instance();
|
||||
detailobj._recordId = Unibase.Themes.Providers.DetailHelper.recordId;
|
||||
detailobj._installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
|
||||
detailobj._containerId = $("._bizgaze_detail_container:visible").attr("id");
|
||||
var idetailObj = detailobj;
|
||||
detailobj.loadPortlets(idetailObj);
|
||||
}, null);
|
||||
});
|
||||
setTimeout(function () {
|
||||
$("#scheduler_spin").removeClass("fa-spin");
|
||||
}, 1000);
|
||||
}
|
||||
else {
|
||||
instance.WeekWise = [];
|
||||
$('#bizgazecrm_Routes_tbl_WeekWise td.Unclick').each(function (index, el) {
|
||||
instance.WeekWise.push($(el).find('.date-input').val().toString());
|
||||
});
|
||||
var propsettingObjs = {
|
||||
RouteId: RouteId,
|
||||
RouteScheduleId: 0,
|
||||
SchedulerDates: [],
|
||||
AssignedTo: assignto,
|
||||
WeekWise: instance.WeekWise,
|
||||
};
|
||||
this.fileCacheHelper.loadJsFile("apps/routes/managers/routemanager.js", function () {
|
||||
Bizgaze.Apps.Routes.Managers.RouteManager.Instance().saveWeekdaysScheduler(propsettingObjs).then(function (response) {
|
||||
MessageHelper.Instance().showSuccess(response.message, '');
|
||||
var detailobj = Unibase.Themes.Compact.Components.Details.Instance();
|
||||
detailobj._recordId = Unibase.Themes.Providers.DetailHelper.recordId;
|
||||
detailobj._installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
|
||||
detailobj._containerId = $("._bizgaze_detail_container:visible").attr("id");
|
||||
var idetailObj = detailobj;
|
||||
detailobj.loadPortlets(idetailObj);
|
||||
}, null);
|
||||
});
|
||||
setTimeout(function () {
|
||||
$("#scheduler_spin").removeClass("fa-spin");
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
getCurrentWeekTableHtml() {
|
||||
var currentDate = moment();
|
||||
var weekStart = currentDate.clone().startOf('isoWeek').isoWeekday(0);
|
||||
var days = [];
|
||||
for (var i = 0; i <= 6; i++) {
|
||||
days.push(moment(weekStart).add(i, 'days').format("DD,dddd"));
|
||||
}
|
||||
const html = days.map(function (day) {
|
||||
const currentDay = day.split(',');
|
||||
return `<td style="cursor:pointer;text-align:center;border: 1px solid #c6c6c6;text-align: left;padding: 15px;">${currentDay[1].substring(0, 3).toUpperCase()} <input type="hidden" class="date-input" value="${currentDay[0]}"/></td>`;
|
||||
}).join('');
|
||||
return html;
|
||||
}
|
||||
saveroute() {
|
||||
this.fileCacheHelper.loadJsFile("apps/routes/managers/routemanager.js", function () {
|
||||
let arr1 = Bizgaze.Apps.Routes.Components.scheduler.Instance().arr;
|
||||
let str = '|';
|
||||
for (var i = 0; i < arr1.length; i++) {
|
||||
str += arr1[i] + '|';
|
||||
}
|
||||
var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
|
||||
var routeid = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_routedefinitionid").Value);
|
||||
Bizgaze.Apps.Routes.Managers.RouteManager.Instance().saveroute(str, routeid).then(function (res) {
|
||||
if (res) {
|
||||
MessageHelper.Instance().showSuccess(res.message, '');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new scheduler();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
Components.scheduler = scheduler;
|
||||
})(Components = Routes.Components || (Routes.Components = {}));
|
||||
})(Routes = Apps.Routes || (Apps.Routes = {}));
|
||||
})(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
|
||||
})(Bizgaze || (Bizgaze = {}));
|
||||
+1
File diff suppressed because one or more lines are too long
+127
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user