123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Transact;
- (function (Transact) {
- let Controls;
- (function (Controls) {
- class BalanceSheetIndexing extends Unibase.Platform.Core.BaseComponent {
- cssFiles() {
- return [];
- }
- jsFiles() {
- return ["apps/transact/controls/ledgers/balancesheetindexing.js"];
- }
- html(id, containerid) {
- var instance = this;
- let formid = 0, configrationid = 0;
- var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- Unibase.Platform.Apps.Managers.AppManager.Instance().getFormAppConfigurations(Number(_installedAppId)).then(function (response) {
- if (response.result != null) {
- var d = response.result;
- }
- });
- let html = '<div class="bg-white modal-header BalanceSheetHeader"><strong class="text-dark titlename"> Balance Sheets <strong id="sg_item"></strong></strong>' +
- '<span class="Balancesheet_errormsg text-danger text-center" id = "Balancesheet_errormsg">' +
- '</span>' +
- '</div> ' +
- '<div data-simplebar class="simple-scroll-bar modal-body BalanceSheetBody"><form id="form_balancesheetindexing"><div class="BalanceSheetAutocompleteContainer row align-items-center mx-0">' +
- '<div class="BalanceSheetAutocomplete2 col-sm-5 pl-sm-0 d-flex align-items-center">' +
- '<span class="col-sm-12 pl-0 pr-0"><select type="text" id="txt_Ledgertype_TRN2' + formid + '" style="width:100%" class="LedgertypeName required form-control floating-label-control" data-isdynamic="false" placeholder="Ledgertype" data-placeholder="Select type" data-label="Ledger Type"></select></span>' +
- '<input type="hidden" id="hf_ledgertype_TRN' + formid + '" class="hf_LedgertypeIdSelected form-control" data-isdynamic="true"/><input type="hidden" class="hf_LedgerTypeId" /> <input type="hidden" class="hf_LedgertypeId" /><label for="Validation" id="lblValidation_LedgertypeName"></label><input type="hidden" id="hfFormPropertyId" />' +
- '</div>' +
- '<div class="BalanceSheetAutocomplete1 col-sm-5 d-flex align-items-center">' +
- '<span class="col-sm-12 pl-0 pr-0"><select type="text" id="txt_Groups_TRN' + formid + '" style="width:100%" class="GroupName required form-control floating-label-control" data-isdynamic="false" placeholder="Group" data-placeholder="Select Group" data-label="Account"></select></span>' +
- '<input type="hidden" id="hf_LedgerGroupIdSelected_TRN' + formid + '" class="hf_LedgerGroupIdSelected form-control" data-isdynamic="true"/><input type="hidden" class="hf_GroupId" /> <input type="hidden" class="hf_GroupId" /><label for="Validation" id="lblValidation_GroupName"></label><input type="hidden" id="hfFormPropertyId" />' +
- '</div>' +
- '<a class="col-sm-2 btn btn-sm btn-primary btn_AddBalSheetS">Add</a>' +
- '</div></form>' +
- '<div class="balance_indexing"></div></div>' +
- '<div class="bg-white modal-footer BalanceSheetFooter"><a href="javascript:;" class="btn btn-light btn-sm mr-auto btn_BalanceSheetClose">Close</a><span class="mr-auto" id="spn_Quantity"></span > <a href="javascript:;" class="btn btn-primary btn-sm btn_BalSheetSave" id ="btn_BalSheetSave">Save</a></div>';
- return html;
- }
- load(id, containerid, callback) {
- var instance = this;
- instance.fileCacheHelper.loadJsFile('apps/transact/managers/ledgers/ledgermanager.js', function () {
- var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- var reporttypeid = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + _installedAppId + "_reporttypeid").Value);
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().AllBalanceSheetIndexes(reporttypeid).then(function (response) {
- var reporttypeid = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + _installedAppId + "_reporttypeid").Value);
- instance.loadlist(response);
- });
- });
- instance.navigationHelper.popup("", "", Bizgaze.Apps.Transact.Controls.BalanceSheetIndexing.Instance(), function () {
- }, Unibase.Platform.Helpers.Size.Large);
- }
- init() {
- var instance = this;
- instance.load(0, "", null);
- }
- loadlist(response) {
- var html1 = '<ul class="list-group gutter list-group-lg list-group-sp sortable biz-custom-scrollbar" id="ul_BalanceSheets">';
- for (var i = 0; i < response.result.length; i++) {
- var data = response.result[i];
- html1 += '<li class="list-group-item box-shadow status-item group-item_' + data.balsheetid + '" id="group-item_' + data.balsheetid + '" data-id=' + i + '>' +
- '<input type="hidden" id="hfBalSheetId" value=' + data.balsheetid + '>' +
- '<span class="pull-left media-xs balindex" val=' + data.index + '><i class="fa fa-sort text-muted fa m-r-sm"></i> <strong class="mr-10 BS_Index">' + data.index + '</strong> </span>' +
- '<div class="clear">' +
- '<div class="stageheading">' +
- '<a href="#stage-' + data.balsheetid + '" data-parent="#togglestage" data-toggle="collapse" class="d-flex justify-content-between align-items-center accordion-toggle collapsed"> ' +
- ' <label class="" id="hfBalGroupName">' + data.groupname + ' </label>' +
- '</a></div></div>' +
- '<div class="panel-collapse collapse" id="stage-' + data.balsheetid + '" style="height:0px;">' +
- '<div id="CreateStageDiv_' + data.balsheetid + '" class="bg-white m-t-sm CreateStageDiv">' +
- '</div>' +
- '</div>'
- + '</div></li>';
- }
- html1 += '</ul>';
- var instance = this;
- $('.balance_indexing').append(html1);
- var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- Bizgaze.Apps.Transact.Controls.BalanceSheetIndexing.Instance().ledgertypeAutoComplete(0);
- $('#txt_Ledgertype_TRN20').change(function () {
- Bizgaze.Apps.Transact.Controls.BalanceSheetIndexing.Instance().ledgerGroupAutoComplete(0);
- $("#txt_Groups_TRN0").text("");
- });
- $(".btn_BalanceSheetClose").click(function () {
- instance.navigationHelper.closePopUp();
- });
- $('#ul_BalanceSheets').sortable({
- update: function (event, ui) {
- $("#ul_BalanceSheets").each(function () {
- let ul = $("#ul_BalanceSheets li");
- for (var i = 0; i < ul.length; i++) {
- let id = $(ul[i]).attr("id");
- $("#" + id + " .BS_Index").text(i + 1);
- $("#" + id).attr("data-id", i + 1);
- }
- });
- }
- });
- $(".btn_AddBalSheetS").off().click(function () {
- for (var inc = 1; inc <= 1; inc++) {
- $('#form_balancesheetindexing select').each(function (i, e) {
- let controlId = $(e).attr('id');
- let result = Unibase.Platform.Forms.Components.FormViewer.Instance().requiredFieldValidation(controlId);
- if (result == false) {
- return false;
- }
- });
- var balsheetids = [];
- var i = $("#ul_BalanceSheets").find(".list-group-item").length + 1;
- var groupid = $('#txt_Groups_TRN0').val();
- var typeid = $('#txt_Ledgertype_TRN20').val();
- var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- var identity = "";
- var reporttypeid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + _installedAppId + "_reporttypeid").Value.toString();
- if (groupid == null && typeid == null) {
- MessageHelper.Instance().showError('Group and Type are mandatory ', 'Balancesheet_errormsg');
- }
- else {
- balsheetids.push({
- Groupid: groupid,
- Typeid: typeid,
- reportypeid: reporttypeid,
- index: i.toString(),
- installedappid: _installedAppId,
- identity: identity
- });
- if (groupid != null && typeid != null) {
- Bizgaze.Apps.Transact.Controls.BalanceSheetIndexing.Instance().SaveBalSheetIndex(balsheetids);
- $('#txt_Groups_TRN0').text(null);
- $('#txt_Groups_TRN0').val(null);
- $('#txt_Ledgertype_TRN20').val(null);
- $('#txt_Ledgertype_TRN20').text(null);
- $('#txtsheetidentity').val(null);
- }
- }
- }
- });
- $(".btn_BalSheetSave").click(function () {
- var balsheetids = [];
- $("#ul_BalanceSheets").find(".list-group-item").each(function () {
- var balsheetid = $(this).find("#hfBalSheetId").val();
- if (balsheetid != 0) {
- balsheetids.push(balsheetid);
- }
- });
- var postdata = {
- Ids: balsheetids
- };
- instance.UpdateBalSheetIndex(postdata);
- });
- let BalanceSheetHeaderHeight = $(".BalanceSheetHeader").outerHeight(true);
- let BalanceSheetFooterHeight = $(".BalanceSheetFooter").outerHeight(true);
- let BalanceSheetBodyPaddingHeight = parseInt($('.BalanceSheetBody').css('padding-top')) + parseInt($('.BalanceSheetBody').css('padding-bottom'));
- let BalanceSheetFormHeight = $('#form_balancesheetindexing').outerHeight(true);
- let totalBalanceSheetsHeight = BalanceSheetHeaderHeight + BalanceSheetFooterHeight + BalanceSheetBodyPaddingHeight + BalanceSheetFormHeight;
- $("#ul_BalanceSheets").css({ 'height': `${$(window).innerHeight() - totalBalanceSheetsHeight}px`, 'overflow-y': 'overlay' }).attr('data-deductheight', `${totalBalanceSheetsHeight}`);
- }
- SaveBalSheetIndex(postdata) {
- var instance = this;
- instance.fileCacheHelper.loadJsFile('apps/transact/managers/ledgers/ledgermanager.js', function () {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().SaveBalSheetIndex(postdata).then(function (response) {
- var info = response.result;
- if (info != null) {
- $('.balance_indexing').empty();
- Bizgaze.Apps.Transact.Controls.BalanceSheetIndexing.Instance().loadlist(response);
- }
- else {
- MessageHelper.Instance().showError(response.message, 'Balancesheet_errormsg');
- }
- });
- });
- }
- UpdateBalSheetIndex(postdata) {
- var instance = this;
- instance.fileCacheHelper.loadJsFile('apps/transact/managers/ledgers/ledgermanager.js', function () {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().UpdateBalanceSheetIndexes(postdata).then(function (response) {
- Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp();
- var detail_instance = Unibase.Themes.Compact.Components.Details.Instance();
- var containerid = $("._bizgaze_detail_container:visible").attr("id");
- var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- var portletid = detail_instance.unibase_core_activeportletid;
- detail_instance.loadWidgets(_installedAppId, portletid, "#" + containerid + "");
- MessageHelper.Instance().showSuccess(response.message, '');
- });
- });
- }
- ledgerGroupAutoComplete(LedgerGroupId) {
- var ledgertypeid = Number($('#txt_Ledgertype_TRN20').val());
- var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/ledgers/ledgergroupautocomplete/ledgertypeid/' + ledgertypeid;
- AutoCompleteHelper.getHelper().Create("#txt_Groups_TRN0", "#hf_LedgerGroupIdSelected_TRN0", url, function (response) {
- var data = response;
- });
- }
- ledgertypeAutoComplete(LedgertypeId) {
- var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/ledgers/ledgertypeautocomplete';
- AutoCompleteHelper.getHelper().Create("#txt_Ledgertype_TRN20", "#hf_LedgerGroupIdSelected_TRN0", url, function (response) {
- var data = response;
- });
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new BalanceSheetIndexing();
- }
- return this.instance;
- }
- }
- Controls.BalanceSheetIndexing = BalanceSheetIndexing;
- })(Controls = Transact.Controls || (Transact.Controls = {}));
- })(Transact = Apps.Transact || (Apps.Transact = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
|