123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- var Unibase;
- (function (Unibase) {
- let Platform;
- (function (Platform) {
- let Integrations;
- (function (Integrations) {
- let Components;
- (function (Components) {
- class Setting extends Platform.Core.BaseComponent {
- jsFiles() {
- return ["platform/integrations/enums/methodtype.js",
- "platform/integrations/enums/encryptdecrypttype.js",
- "platform/integrations/enums/responsetype.js",
- "platform/integrations/managers/integrationmanager.js"];
- }
- cssFiles() {
- return [];
- }
- html(id, containerid) {
- return '<div id="Unibase_integrationSettings" default="" data-validate="parsley" data-isdynamic="false"><div class="b-b bg-white header integrationSettingHeader" ><strong class="text-dark">Edit</strong><a class="btn btn-sm ml-auto" id="resetsettings" data-toggle="tooltip" title="Reset"><i class="fa fa-refresh"></i></a><a class="btn btn-sm"><i class="ti-help-alt" title="help" href="javascript:;" target="_blank"></i></a></div><div data-simplebar class="simple-scroll-bar scrollable integration-setting-body"><div id="Unibase_ValidationSummary" class="clear mt-10"></div><div class="card hidden"><div class="card-body"><div class="row"><div class="col-sm-6"><div class="floating-label-form-group" ><label for= "txtLastUpdatedDate">StartDate</label><input type= "text" id = "txtLastUpdatedDate" class="form-control value-control datepicker-input hasDatepicker txtLastUpdatedDate floating-label-control" /><span class="input-group-addon mt-10" > <i class="fa fa-calendar"> </i></span></div></div> <div class="col-sm-6" id="timeint"> <div class="floating-label-form-group-with-value" for="cmbSttxtLastSyncDateartHours" id="div_StartHours"><label for="cmbStartHours" id="lbl_StartHours">Time Interval(min)</label><select id="cmbTimeInterval" style="background-color:white" class="form-control mb-10" data-isdynamic="false"><option value="0">-- Select --</option><option value="20">20</option><option value="30">30</option><option value="45">45</option><option value="60">60</option><option value="90">1.30hr</option><option value="120">2.00hr</option><option value="150">2.30hr</option><option value="180">3.00hr</option> <option value="210">3.30hr</option> <option value="240">4.00hr</option><option value="270">4.30hr</option><option value="300">5.00hr</option><option value="330">5.30hr</option><option value="360">6.00hr</option></select></div></div></div></div></div>' +
- '<div class="card card-body" id="updatedisplaytext"><div class="row mx-0 mb-15"><div class="col-6"><label for="displayText" id="lbl_displayText" class="font-18"><strong>Display text</strong></label></div><div class="col-6"><input type="textbox" class="form-control required" id="displayText" value=""></div></div><div class="row mx-0 mb-15"><div class="col-6"><label for="LastSyncDate" id="lbl_syncDate" class="font-18"><strong>LastSyncDate/FromDate</strong></label></div><div class="col-6 d-flex align-item-center"><input type="text" id="txtLastSyncDate" class="lastSyncDate datepicker-input form-control required" placeholder="yyyy/mm/dd hh:mm" data-placeholder="yyyy/mm/dd hh:mm" data-label="LastSyncDate"><span class="input-group-addon"><i class="fa fa-calendar ml-20 font-18 required"></i></span></div></div><div class="row mx-0 mb-15"><div class="col-7"><label for="chkIsToDate" class="font-18"><strong>Is ToDate</strong></label><label id="lblIsToDate" class="switch form-inline pull-right"><input id="chkIsToDate" data-group="chkIsToDate" type="checkbox" data-isdynamic="false" onchange=""><span></span></label></div></div><div class="row mx-0 mb-15 todate"><div class="col-6"><label for="ToDate" id="lbl_ToDate" class="font-18"><strong>ToDate</strong></label></div><div class="col-6 d-flex align-item-center"><input type="text" id="txtToDate" class="toDate datepicker-input form-control required" placeholder="yyyy/mm/dd hh:mm" data-placeholder="yyyy/mm/dd hh:mm" data-label="ToDate"><span class="input-group-addon"><i class="fa fa-calendar ml-20 font-18 required"></i></span></div></div><div class="row mx-0"><div class="col-7"><label for="frmchkIsUpdate" class="font-18"><strong>Is Update</strong></label><label id="lblIsUpdate" class="switch form-inline pull-right"><input id="chkIsUpdate" data-group="chkIsUpdate" type="checkbox" data-isdynamic="false" onchange=""><span></span></label></div></div></div>' +
- '<div class="SettingValue Service-summary edit-SettingName" id="UpdateSettingsValues" style="min-height:200px;overflow-x:hidden;"><ul class="list-group no-border" id = "ulSettingValueDetails" ></ul></div></div><div id="div_integrationSettingFooter" class="bg-white footer"><a class="btn btn-light btn-sm btn-center mr-auto btn-close" id="btnClose">Close</a><a class="btn btn-primary btn-center btn-sm text-white" id="btn_updateSetting">Save</a></div></div>';
- }
- init(serviceIntegratorId, serviceId, update) {
- Unibase.Platform.Integrations.Components.Setting.serviceIntegratorId = serviceIntegratorId;
- Unibase.Platform.Integrations.Components.Setting.serviceId = serviceId;
- Unibase.Platform.Integrations.Components.Setting.update = update;
- this.navigationHelper.popup(0, '', Unibase.Platform.Integrations.Components.Setting.Instance(), null, Platform.Helpers.Size.Large);
- this.getServiceIntegrator();
- }
- load(id, containerid, callback) {
- $("#resetsettings").hide();
- $("#btn_updateSetting").click(function () {
- Setting.Instance().updateSetting(containerid);
- });
- $("#chkIsToDate").click(function () {
- Unibase.Platform.Integrations.Components.Setting.Instance().istodate();
- });
- $("#txtLastSyncDate").daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- locale: {
- format: 'YYYY/MM/DD HH:mm:ss'
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- maxDate: new Date(2050, 11, 31)
- });
- $("#txtToDate").daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- locale: {
- format: 'YYYY/MM/DD HH:mm:ss'
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- maxDate: new Date(2050, 11, 31)
- });
- }
- istodate() {
- if (($("#chkIsToDate").prop("checked") == false)) {
- $(".todate").addClass("hidden");
- }
- else {
- $(".todate").removeClass("hidden");
- var date = new Date().toUTCString();
- var olderDate = moment(date).subtract(5, 'hours').toDate();
- var olderDate1 = moment(olderDate).subtract(30, 'minutes').toDate();
- var tdate = moment(olderDate1).format();
- var d = this.formatDateTime(tdate);
- $("#txtToDate").val(d);
- $("#txtToDate").daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- locale: {
- format: 'YYYY/MM/DD HH:mm:ss'
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- maxDate: new Date(2050, 11, 31)
- });
- }
- }
- loadForm(FormId, Pk_Value, AppConfigurationId, Callback, ElementId) {
- }
- formatDateTime(dateTime) {
- if (dateTime.toString().indexOf("T") > -1) {
- dateTime = dateTime.toString().replace("T", " ");
- dateTime = moment(dateTime).format("YYYY/MM/DD HH:mm:ss");
- }
- dateTime = dateTime + " +00:00";
- var date = moment.utc(dateTime).local();
- return date.format("YYYY/MM/DD HH:mm:ss");
- }
- getServiceIntegrator() {
- var serviceIntegratorId = Setting.serviceIntegratorId;
- Unibase.Platform.Integrations.Managers.IntegrationManager.Instance().getServiceIntegratorById(serviceIntegratorId).then(function (response) {
- $("#chkIsUpdate").prop("checked", response.result.IsUpdate);
- $("#chkIsToDate").prop("checked", response.result.IsTodate);
- $("#displayText").val(response.result.DisplayText);
- $("#displayText").prop("disabled", true);
- var ToDate = response.result.ToDate;
- var LastSyncDate = response.result.LastSyncDate;
- if (LastSyncDate == "0001-01-01T00:00:00") {
- date = moment(LastSyncDate).format("YYYY/MM/DD HH:mm:ss");
- $("#txtLastSyncDate").val(date);
- $("#txtLastSyncDate").daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- locale: {
- format: 'YYYY/MM/DD HH:mm:ss'
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- maxDate: new Date(2050, 11, 31)
- });
- }
- else {
- var date = Unibase.Platform.Integrations.Components.Setting.Instance().formatDateTime(response.result.LastSyncDate);
- $("#txtLastSyncDate").val(date);
- $("#txtLastSyncDate").daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- locale: {
- format: 'YYYY/MM/DD HH:mm:ss'
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- maxDate: new Date(2050, 11, 31)
- });
- }
- if (!$("#chkIsToDate").prop("checked")) {
- var tdate = moment(ToDate).format("YYYY/MM/DD HH:mm:ss");
- $("#txtToDate").val(tdate);
- $("#chkIsToDate").prop("checked", false);
- if (($("#chkIsToDate").prop("checked") == false)) {
- $(".todate").addClass("hidden");
- }
- $("#txtToDate").daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- locale: {
- format: 'YYYY/MM/DD HH:mm:ss'
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- maxDate: new Date(2050, 11, 31)
- });
- }
- else {
- var tdate = Unibase.Platform.Integrations.Components.Setting.Instance().formatDateTime(response.result.ToDate);
- $("#txtToDate").val(tdate);
- $("#chkIsToDate").prop("checked", true);
- $("#txtToDate").daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- locale: {
- format: 'YYYY/MM/DD HH:mm:ss'
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- maxDate: new Date(2050, 11, 31)
- });
- }
- });
- }
- changeUpdateStatus() {
- var isUpdate = $("#chkIsUpdate").prop("checked");
- var serviceIntegratorId = Setting.serviceIntegratorId;
- Unibase.Platform.Integrations.Managers.IntegrationManager.Instance().changeServiceIntegratorStatus(serviceIntegratorId, isUpdate).then(function (response) {
- if (response.status == 0) {
- MessageHelper.Instance().showSuccess(response.message, "");
- }
- else {
- MessageHelper.Instance().showError(response.message, "Unibase_ValidationSummary");
- return false;
- }
- });
- }
- updateSetting(containerid) {
- var isUpdate = $("#chkIsUpdate").prop("checked");
- var isTodate = $("#chkIsToDate").prop("checked");
- var displayText = $("#displayText").val();
- var lastsdate = $("#txtLastSyncDate").val();
- var olderDate = moment(lastsdate).subtract(5, 'hours').toDate();
- var olderDate1 = moment(olderDate).subtract(30, 'minutes').toDate();
- var lastsyncdate = moment(olderDate1).format("YYYY-MM-DD HH:mm:ss");
- var todate = $("#txtToDate").val();
- if ($("#chkIsToDate").prop("checked")) {
- var tolderDate = moment(todate).subtract(5, 'hours').toDate();
- var tolderDate1 = moment(tolderDate).subtract(30, 'minutes').toDate();
- todate = moment(tolderDate1).format("YYYY-MM-DD HH:mm:ss");
- }
- var serviceIntegratorId = Setting.serviceIntegratorId;
- var postData = {
- IsUpdate: isUpdate,
- isTodate: isTodate,
- DisplayText: displayText,
- LastSyncDate: lastsyncdate,
- ToDate: todate,
- ServiceIntegratorId: serviceIntegratorId
- };
- let appcontrolid = "Unibase_integrationSettings";
- let result = Unibase.Platform.Forms.Components.FormViewer.Instance().requiredFieldValidation(appcontrolid);
- if (result == false) {
- MessageHelper.Instance().showError("Mandatory fields are missing", "Unibase_ValidationSummary");
- return false;
- }
- else if ($("#displayText").val() == "") {
- MessageHelper.Instance().showError("DisplayText should not be empty", "Unibase_ValidationSummary");
- }
- else if ($("#chkIsToDate").prop("checked") && lastsyncdate > todate) {
- MessageHelper.Instance().showError("ToDate is lessthan FromDate", "Unibase_ValidationSummary");
- }
- else {
- Unibase.Platform.Integrations.Managers.IntegrationManager.Instance().UpdateServiceIntegrator(postData).then(function (response) {
- if (response.status == 0) {
- $('#' + containerid).modal('hide');
- $('#' + containerid).remove();
- MessageHelper.Instance().showSuccess(response.message, "");
- }
- else {
- MessageHelper.Instance().showError(response.message, "Unibase_ValidationSummary");
- return false;
- }
- });
- }
- }
- static Instance() {
- return new Setting();
- }
- }
- Setting.serviceId = 0;
- Setting.serviceIntegratorId = 0;
- Setting.update = "";
- Components.Setting = Setting;
- })(Components = Integrations.Components || (Integrations.Components = {}));
- })(Integrations = Platform.Integrations || (Platform.Integrations = {}));
- })(Platform = Unibase.Platform || (Unibase.Platform = {}));
- })(Unibase || (Unibase = {}));
|