123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- var Bizgaze;
- (function (Bizgaze) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class OfferContact extends Unibase.Platform.Core.BaseComponent {
- init(formpropertyid, prop, callback) {
- var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- for (let obj of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters) {
- if (obj.Key === "hf_" + InstalledAppId + "_lobid") {
- var LoBId = obj.Value.toString();
- }
- if (obj.Key === "hf_" + InstalledAppId + "_taggroupid") {
- var TagGroupId = obj.Value.toString();
- }
- }
- Unibase.Platform.Forms.Managers.TagManager.Instance().getTagcategoryByuniqueId('Bizgaze_Platform_Crm_Crm_TagCategory_Organizations').then(function (tagres) {
- var tagCategoryId = tagres.result.TagCategoryId;
- var Parameters = [{ ColumnName: 'TagCategoryId', Value: tagCategoryId }, { ColumnName: 'LobId', Value: LoBId }, { ColumnName: 'TagId', Value: 0 }];
- var offerid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_offerid").Value;
- Bizgaze.Forms.Controls.OfferContact.Instance().GetTags(offerid, Parameters);
- });
- $('#btnIncludedTags').click(function () {
- Bizgaze.Forms.Controls.OfferContact.Instance().AddTags('section_IncludedTags', 'select2_IncludedTags', 0, LoBId, 0);
- });
- }
- loadControl(containerid, prop) {
- var instance = this;
- var html = `<div class="row"><input type="hidden" id="hdn_customcontrol" class="value-control" value="Bizgaze.Forms.Controls.OfferContact.Instance().getIncludedTags();"><div class="col-sm-6 floating-label-form-group-with-value" id="IncludedTags"><label for="txt_IncludedTags">Included Tags</label><input type="hidden" class="hf_IncludedTags_" value="" /><select style="width:100%" id="txt_IncludedTags" value="" class="no-border form-control select2_IncludedTags txtIncludedTags" IsTagSelect="false" multiple="multiple"><option value="0">Select</option></select></div><div class="btn-group text-center text-white btn-group-justified mt-30"><a class="btn btn-primary mt-10" id="btnIncludedTags">+</a></div></div>`;
- $("#" + containerid).html(html);
- var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- for (let obj of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters) {
- if (obj.Key === "hf_" + InstalledAppId + "_lobid") {
- var LoBId = obj.Value.toString();
- }
- if (obj.Key === "hf_" + InstalledAppId + "_taggroupid") {
- var TagGroupId = obj.Value.toString();
- }
- }
- Unibase.Platform.Forms.Managers.TagManager.Instance().getTagcategoryByuniqueId('Bizgaze_Platform_Crm_Crm_TagCategory_Organizations').then(function (tagres) {
- var tagCategoryId = tagres.result.TagCategoryId;
- var selectedtags = 'undefined';
- var url = _appsettings.server_url() + '/apis/v4/unibase/platform/forms/autoincludedtags/taggroupid/' + TagGroupId + '/tagcategoryid/' + tagCategoryId + '/includedtags/' + selectedtags + '';
- AutoCompleteHelper.getHelper().Create("#txt_IncludedTags", ".hf_IncludedTags_", url, function (response) {
- });
- });
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- throw new Error("Method not implemented.");
- }
- loadPropertySettings(propertysettings, formpropertyid, DocPropertyName) {
- throw new Error("Method not implemented.");
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- var instance = this;
- }
- AddTags(TagType, control, TagCategoryId, LoBId, Value) {
- var len = $('.' + control).length;
- var instance = this;
- var html = '<div class="row" id="div_' + control + '_' + len + '" class="includedtags""><div class="col-sm-6 mt-10 col-9">' +
- '<input type="hidden" id="hdn_customcontrol" class="value-control" value="Bizgaze.Forms.Controls.OfferContact.Instance().getTags();">' +
- '<input type="hidden" class="hf_IncludedTags" value="" /><select id=' + control + '_' + len + ' style="width:100%" class="b-a ' + control + ' txt_IncludedTag " value="" multiple="multiple"></select></div>' +
- '<div class="mt-20 ml-30"><a href="javascript:;" onclick="Bizgaze.Forms.Controls.OfferContact.Instance().RemoveTags(' + "'" + control + "'" + ',' + len + ')"><i class="fa fa-times"></a></div></div>';
- $('.' + TagType).find('.card-body').find('.row:last').after(html);
- instance.fileCacheHelper.loadJsFile("platform/tag/managers/tagmanager.js", function () {
- var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- for (let obj of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters) {
- if (obj.Key === "hf_" + InstalledAppId + "_lobid") {
- var LoBId = obj.Value.toString();
- }
- }
- for (let obj of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters) {
- if (obj.Key === "hf_" + InstalledAppId + "_taggroupid") {
- var TagGroupId = obj.Value.toString();
- }
- }
- Unibase.Platform.Forms.Managers.TagManager.Instance().getTagcategoryByuniqueId('Bizgaze_Platform_Crm_Crm_TagCategory_Organizations').then(function (tagres) {
- var tagCategoryId = tagres.result.TagCategoryId;
- var selectedtags = 'undefined';
- var url = _appsettings.server_url() + '/apis/v4/unibase/platform/forms/autoincludedtags/taggroupid/' + TagGroupId + '/tagcategoryid/' + tagCategoryId + '/includedtags/' + selectedtags + '';
- AutoCompleteHelper.getHelper().Create(".txt_IncludedTag", ".hf_IncludedTags", url, function (response) {
- });
- });
- });
- }
- RemoveTags(ctrl, len) {
- $('#div_' + ctrl + '_' + len).remove();
- }
- GetTags(OfferId, Parameters) {
- var jsfiles = ['apps/transact/managers/offers/offermanager.js', 'apps/transact/managers/interfaces/offers/ioffermanager.js'];
- this.fileCacheHelper.loadJsFiles(jsfiles, function () {
- Bizgaze.Apps.Transact.Managers.OfferManager.Instance().getoffer(OfferId).then(function (response) {
- var data = response.result;
- Bizgaze.Forms.Controls.OfferContact.Instance().ShowTags(data, 'section_IncludedTags', 'select2_IncludedTags', Parameters);
- });
- });
- }
- ShowTags(data, TagType, control, Parameters) {
- var IncludedTags = data.IncludedTags.split('&');
- for (var i = 0; i < IncludedTags.length; i++) {
- if (i == 0) {
- if (IncludedTags[0] == '|')
- IncludedTags[0] = null;
- }
- else {
- Bizgaze.Forms.Controls.OfferContact.Instance().AddTags(TagType, control, Parameters[0].Value, Parameters[1].Value, IncludedTags[i]);
- }
- }
- }
- getIncludedTags() {
- var includedtags = "|";
- var ar = new Array();
- $('.select2_IncludedTags').each(function () {
- ar.push($(this).val());
- for (let i = 0; i < ar[0].length; i++) {
- includedtags = includedtags + ar[0][i] + '|';
- }
- includedtags = includedtags + '&|';
- ar = [];
- });
- var includedtagsids = includedtags.slice(0, includedtags.lastIndexOf("&|") - 1);
- return includedtagsids;
- }
- static Instance() {
- if (this._instance === undefined)
- this._instance = new OfferContact();
- return this._instance;
- }
- }
- Controls.OfferContact = OfferContact;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Bizgaze.Forms || (Bizgaze.Forms = {}));
- })(Bizgaze || (Bizgaze = {}));
|