diff --git a/.gitignore b/.gitignore index 3e0081c98..026556d69 100644 --- a/.gitignore +++ b/.gitignore @@ -222,7 +222,6 @@ FakesAssemblies/ *.opt azure-pipelines.yml -appsettings.json # Visual Studio LightSwitch build output **/*.HTMLClient/GeneratedArtifacts @@ -245,11 +244,12 @@ ModelManifest.xml *.db src/applications/**/PublishProfiles/ -src/applications/**/mixcontent/ src/applications/**/ServiceDependencies/ src/applications/Mixcore/wwwroot/portal-apps/ src/**/__pycache__/ src/**/logs/ -src/**/mixcontent/ +src/**/*.sqlite-shm +src/**/*.sqlite-wal +src/applications/mixcore/wwwroot/**/*.sqlite diff --git a/src/Mixcore.sln b/src/Mixcore.sln index 2ab0101d1..9bcd3656a 100644 --- a/src/Mixcore.sln +++ b/src/Mixcore.sln @@ -1,4 +1,3 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31912.275 @@ -130,6 +129,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution Readme.md = Readme.md EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.scylladb", "platform\mix.scylladb\mix.scylladb.csproj", "{A15A6930-30D6-46DC-B02B-0015D059A0C8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -292,6 +293,10 @@ Global {737720EE-DF6F-4457-84D6-45E0E2F209E6}.Debug|Any CPU.Build.0 = Debug|Any CPU {737720EE-DF6F-4457-84D6-45E0E2F209E6}.Release|Any CPU.ActiveCfg = Release|Any CPU {737720EE-DF6F-4457-84D6-45E0E2F209E6}.Release|Any CPU.Build.0 = Release|Any CPU + {A15A6930-30D6-46DC-B02B-0015D059A0C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A15A6930-30D6-46DC-B02B-0015D059A0C8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A15A6930-30D6-46DC-B02B-0015D059A0C8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A15A6930-30D6-46DC-B02B-0015D059A0C8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -320,7 +325,7 @@ Global {081A8E1E-B431-4044-B4B7-203BD1E00589} = {84C68A6F-ECE0-467E-91C0-AE63AC4FC4C7} {E974EBC1-B6C9-4BC0-AFA5-33EB182CB6A6} = {6F925183-31E6-4DEB-BAB1-80F330B9E199} {5486F6D4-6144-470A-BEB5-270C4D02486B} = {98FE9DF6-4B31-4A0D-A4F9-74196114CD9D} - {C6B46863-6A6E-4BC0-84F6-EF9DCBCA77D1} = {84C68A6F-ECE0-467E-91C0-AE63AC4FC4C7} + {C6B46863-6A6E-4BC0-84F6-EF9DCBCA77D1} = {69169108-92D3-411D-87EB-DF2DD026FE64} {728EBD5B-266E-4476-9BDC-37D12194AFE2} = {175276C1-45BB-4C30-BB93-4CB2C2D4A60C} {2D4838F0-251E-4383-9DAD-7FF91B0E0606} = {45077DFB-D35A-4491-993C-2AC4C8AC838E} {C0A05428-767E-46C5-A31F-0D220E41F7C5} = {38F30F45-7DB6-4097-BA85-788ACCCBC5F2} @@ -357,6 +362,7 @@ Global {A094BEBE-9607-4AE9-A9DB-9BF7BF704F2F} = {4E880812-C336-4EB2-9FED-2E437957F50A} {4B4B73DD-9014-4609-89A0-3297289157A6} = {7E1C5D8B-58B4-40B1-8BA7-F8F80B76F276} {737720EE-DF6F-4457-84D6-45E0E2F209E6} = {C93898B7-2001-4C29-9BBE-33A2E61C350A} + {A15A6930-30D6-46DC-B02B-0015D059A0C8} = {69169108-92D3-411D-87EB-DF2DD026FE64} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0143C230-7F40-44B2-8BA3-EF5B92D55848} diff --git a/src/applications/mixcore.gateway/Program.cs b/src/applications/mixcore.gateway/Program.cs index 7ca965d7c..6581c37b6 100644 --- a/src/applications/mixcore.gateway/Program.cs +++ b/src/applications/mixcore.gateway/Program.cs @@ -2,29 +2,21 @@ using Microsoft.Extensions.DependencyInjection.Extensions; using Mix.Constant.Constants; using Mix.Database.Entities.Cms; +using Mix.Database.Services.MixGlobalSettings; using Mix.Heart.Services; +using Mix.Lib.Extensions; using Mix.Lib.Helpers; using Mix.Lib.Services; -using Mix.Shared.Services; +using Mix.Shared.Extensions; using Ocelot.DependencyInjection; using Ocelot.Middleware; using System.Reflection; -using System.Text.Encodings.Web; -using System.Text.Unicode; bool isInit = true; -if (Directory.Exists("../mixcore/mixcontent/shared")) -{ - isInit = false; - MixFileHelper.CopyFolder("../mixcore/mixcontent/shared", MixFolders.MixContentSharedFolder); -} var builder = MixCmsHelper.CreateWebApplicationBuilder(args); -if (builder.Environment.IsDevelopment()) -{ - builder.AddServiceDefaults(); -} +builder.AddServiceDefaults(); builder.WebHost.UseContentRoot(Directory.GetCurrentDirectory()); builder.Configuration.SetBasePath(builder.Environment.ContentRootPath) @@ -35,13 +27,13 @@ .AddEnvironmentVariables(); builder.Services.AddOutputCache(); builder.Services.AddControllers(); -builder.Services.AddMixServices(Assembly.GetExecutingAssembly(), builder.Configuration); +builder.AddConfigurations(); +builder.AddMixServices(Assembly.GetExecutingAssembly()); builder.Services.AddMixAuthorize(builder.Configuration); builder.Services.AddScoped(); -builder.Services.TryAddSingleton(); builder.Services.AddOcelot(builder.Configuration); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle -if (!builder.Environment.IsDevelopment()) +if (!builder.Environment.IsLocal()) { builder.Services.AddEndpointsApiExplorer(); } @@ -59,22 +51,20 @@ } else { - builder.Services.AddMixCors(); + builder.AddMixCors(); } var app = builder.Build(); +app.MapDefaultEndpoints(); -Configure(app, builder.Environment, isInit); +Configure(app, builder.Environment, builder.Configuration); app.UseOutputCache(); -if (app.Environment.IsDevelopment()) -{ - app.MapDefaultEndpoints(); -} +app.MapDefaultEndpoints(); app.Run(); // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. -static void Configure(WebApplication app, IWebHostEnvironment env, bool isInit) +static void Configure(WebApplication app, IWebHostEnvironment env, IConfiguration configuration) { if (!env.IsDevelopment()) { @@ -84,18 +74,18 @@ static void Configure(WebApplication app, IWebHostEnvironment env, bool isInit) } //app.UseResponseCompression(); app.UseRouting(); - if (isInit) + if (configuration.IsInit()) { app.UseCors(); } else { - app.UseMixCors(); + app.UseMixCors(configuration); } // ref: app.UseMixAuth(); app.UseMixAuth(); - app.UseMixSwaggerApps(app.Environment.IsDevelopment(), Assembly.GetExecutingAssembly()); + app.UseMixSwaggerApps(!app.Environment.IsProduction(), Assembly.GetExecutingAssembly()); app.MapControllers(); app.UseOcelot().Wait(); } diff --git a/src/applications/mixcore.gateway/Properties/launchSettings.json b/src/applications/mixcore.gateway/Properties/launchSettings.json index 232e3e59c..5e0319c88 100644 --- a/src/applications/mixcore.gateway/Properties/launchSettings.json +++ b/src/applications/mixcore.gateway/Properties/launchSettings.json @@ -1,42 +1,18 @@ { - "profiles": { - "https": { - "commandName": "Project", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "dotnetRunMessages": true, - "applicationUrl": "https://localhost:7142;http://localhost:5025" + "profiles": { + "local": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Local", + "API_ENCRYPT_KEY": "NElUempOSmx4QVlXRFRmSys5Z0lpZz09LERBSENTUUlZWEVNYVRJRlErc256bE9Ibmo1Z0wwcm5PRm9iMDlXSEJSM0U9", + "SETTINGS_CONNECTION_STRING": "Host=localhost;Port=5432;Database=mixcore_portal;Username=postgres;Password=postgres", + "DATABASE_PROVIDER": "SQLITE", + "SERVICE_NAME": "gateway" + }, + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7142;http://localhost:5025" + } }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Docker": { - "commandName": "Docker", - "launchBrowser": true, - "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", - "environmentVariables": { - "ASPNETCORE_HTTPS_PORTS": "8081", - "ASPNETCORE_HTTP_PORTS": "8080" - }, - "publishAllPorts": true, - "useSSL": true - } - }, - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:24614", - "sslPort": 44331 - } - } + "$schema": "http://json.schemastore.org/launchsettings.json" } \ No newline at end of file diff --git a/src/services/mix-message-queue/mix.mq.server/appsettings.Development.json b/src/applications/mixcore.gateway/appsettings.json similarity index 53% rename from src/services/mix-message-queue/mix.mq.server/appsettings.Development.json rename to src/applications/mixcore.gateway/appsettings.json index 0c208ae91..f63721fd6 100644 --- a/src/services/mix-message-queue/mix.mq.server/appsettings.Development.json +++ b/src/applications/mixcore.gateway/appsettings.json @@ -1,8 +1,12 @@ { "Logging": { + "Console": { + "TimestampFormat": "[yyyy-MM-dd HH:mm:ss] " + }, "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } - } + }, + "AllowedHosts": "*" } diff --git a/src/applications/mixcore.gateway/mixcore.gateway.csproj b/src/applications/mixcore.gateway/mixcore.gateway.csproj index 674fa9c5d..6f11ee60e 100644 --- a/src/applications/mixcore.gateway/mixcore.gateway.csproj +++ b/src/applications/mixcore.gateway/mixcore.gateway.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 false enable enable @@ -15,9 +15,6 @@ - - - diff --git a/src/services/mix-message-queue/mix.mq.server/runtimeconfig.template.json b/src/applications/mixcore.gateway/runtimeconfig.template.json similarity index 100% rename from src/services/mix-message-queue/mix.mq.server/runtimeconfig.template.json rename to src/applications/mixcore.gateway/runtimeconfig.template.json diff --git a/src/applications/mixcore.host.aspire.AppHost/Properties/launchSettings.json b/src/applications/mixcore.host.aspire.AppHost/Properties/launchSettings.json new file mode 100644 index 000000000..f0fd5f4b9 --- /dev/null +++ b/src/applications/mixcore.host.aspire.AppHost/Properties/launchSettings.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:17222;http://localhost:15061", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development", + "DOTNET_ENVIRONMENT": "Development", + "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21048", + "DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22225" + } + }, + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:15061", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development", + "DOTNET_ENVIRONMENT": "Development", + "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19212", + "DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20180" + } + } + } +} diff --git a/src/applications/mixcore.host.aspire.AppHost/appsettings.json b/src/applications/mixcore.host.aspire.AppHost/appsettings.json new file mode 100644 index 000000000..168a9bbaf --- /dev/null +++ b/src/applications/mixcore.host.aspire.AppHost/appsettings.json @@ -0,0 +1,12 @@ +{ + "Logging": { + "Console": { + "TimestampFormat": "[yyyy-MM-dd HH:mm:ss] " + }, + "LogLevel": { + "Default": "Error", + "Microsoft.AspNetCore": "Warning", + "Aspire.Hosting.Dcp": "Warning" + } + } +} diff --git a/src/applications/mixcore.host.aspire.AppHost/mixcore.host.aspire.AppHost.csproj b/src/applications/mixcore.host.aspire.AppHost/mixcore.host.aspire.AppHost.csproj index 30102f25b..da953b480 100644 --- a/src/applications/mixcore.host.aspire.AppHost/mixcore.host.aspire.AppHost.csproj +++ b/src/applications/mixcore.host.aspire.AppHost/mixcore.host.aspire.AppHost.csproj @@ -1,23 +1,23 @@  - - Exe - net8.0 - enable - enable - true - + + + Exe + net9.0 + enable + enable + true + - - - - + + + - - - - - - + + + + + + diff --git a/src/applications/mixcore.host.aspire.ServiceDefaults/mixcore.host.aspire.ServiceDefaults.csproj b/src/applications/mixcore.host.aspire.ServiceDefaults/mixcore.host.aspire.ServiceDefaults.csproj index a398224f1..3180ec292 100644 --- a/src/applications/mixcore.host.aspire.ServiceDefaults/mixcore.host.aspire.ServiceDefaults.csproj +++ b/src/applications/mixcore.host.aspire.ServiceDefaults/mixcore.host.aspire.ServiceDefaults.csproj @@ -1,8 +1,8 @@ - + Library - net8.0 + net9.0 enable enable true @@ -10,21 +10,19 @@ - - + + - - - - - - - - - - - - + + + + + + + + + + diff --git a/src/applications/mixcore/Controllers/AppController.cs b/src/applications/mixcore/Controllers/AppController.cs index c07645d34..e526e8dbe 100644 --- a/src/applications/mixcore/Controllers/AppController.cs +++ b/src/applications/mixcore/Controllers/AppController.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore.Mvc; -using Mix.Database.Services; +using Mix.Database.Services.MixGlobalSettings; +using Mix.Lib.Extensions; using Mix.Lib.Interfaces; using Mix.Lib.Services; using Mix.Shared.Models.Configurations; -using Mix.Shared.Services; namespace Mixcore.Controllers { @@ -37,7 +37,7 @@ protected override void ValidateRequest() base.ValidateRequest(); // If this site has not been inited yet - if (GlobalConfig.IsInit) + if (Configuration.IsInit()) { IsValid = false; if (string.IsNullOrEmpty(_databaseService.GetConnectionString(MixConstants.CONST_CMS_CONNECTION))) @@ -46,7 +46,7 @@ protected override void ValidateRequest() } else { - var status = GlobalConfig.InitStatus; + var status = Configuration.GetGlobalConfiguration(nameof(AppSettingsModel.InitStatus)); RedirectUrl = $"/init/step{status}"; } } @@ -73,7 +73,7 @@ protected async Task App(string baseHref) { // Home App var pageRepo = ApplicationViewModel.GetRepository(Uow, _cacheService); - var page = await pageRepo.GetSingleAsync(m => m.BaseHref == baseHref && m.MixTenantId == CurrentTenant.Id); + var page = await pageRepo.GetSingleAsync(m => m.BaseHref == baseHref && m.TenantId == CurrentTenant.Id); if (page == null) return NotFound(); diff --git a/src/applications/mixcore/Controllers/HomeController.cs b/src/applications/mixcore/Controllers/HomeController.cs index 7bf8d3758..d3e8cbf9c 100644 --- a/src/applications/mixcore/Controllers/HomeController.cs +++ b/src/applications/mixcore/Controllers/HomeController.cs @@ -1,13 +1,14 @@ using Microsoft.AspNetCore.Mvc; -using Mix.Database.Services; +using Mix.Database.Services.MixGlobalSettings; using Mix.Heart.Exceptions; using Mix.Heart.Extensions; +using Mix.Lib.Extensions; using Mix.Lib.Interfaces; using Mix.Lib.Services; -using Mix.RepoDb.Interfaces; +using Mix.Mixdb.Interfaces; using Mix.RepoDb.Repositories; using Mix.Services.Databases.Lib.Interfaces; -using Mix.Shared.Services; +using Mix.Shared.Models.Configurations; using Mixcore.Domain.Bases; using System.Linq.Expressions; @@ -20,7 +21,6 @@ public class HomeController( TranslatorService translator, DatabaseService databaseService, UnitOfWorkInfo uow, - MixRepoDbRepository repoDbRepository, IMixMetadataService metadataService, MixCacheService cacheService, IMixTenantService tenantService, @@ -28,14 +28,13 @@ public class HomeController( IMixDbDataService mixDbDataService) : MvcBaseController(httpContextAccessor, ipSecurityConfigService, mixCmsService, translator, databaseService, uow, cacheService, tenantService, configuration) { private readonly IMixMetadataService _metadataService = metadataService; - private readonly MixRepoDbRepository _repoDbRepository = repoDbRepository; private readonly IMixDbDataService _mixDbDataService = mixDbDataService; protected override void ValidateRequest() { base.ValidateRequest(); // If this site has not been inited yet - if (GlobalConfig.IsInit) + if (Configuration.IsInit()) { IsValid = false; if (string.IsNullOrEmpty(DatabaseService.GetConnectionString(MixConstants.CONST_CMS_CONNECTION))) @@ -44,7 +43,7 @@ protected override void ValidateRequest() } else { - var status = GlobalConfig.InitStatus; + var status = Configuration.GetGlobalConfiguration(nameof(AppSettingsModel.InitStatus)); RedirectUrl = $"/init/step{status}"; } } @@ -72,7 +71,7 @@ private async Task LoadPage(string seoName = null) try { var pageRepo = PageContentViewModel.GetRepository(Uow, CacheService); - Expression> predicate = p => p.MixTenantId == CurrentTenant.Id + Expression> predicate = p => p.TenantId == CurrentTenant.Id && p.Specificulture == Culture; predicate = predicate.AndAlsoIf(string.IsNullOrEmpty(seoName), m => m.Type == MixPageType.Home); predicate = predicate.AndAlsoIf(!string.IsNullOrEmpty(seoName), m => m.SeoName == seoName); @@ -82,7 +81,10 @@ private async Task LoadPage(string seoName = null) { await page.LoadDataAsync(_mixDbDataService, _metadataService, new(Request) { - SortBy = MixQueryColumnName.Priority + SortByColumns = new List() + { + new Mix.Heart.Model.MixSortByColumn(MixQueryColumnName.Priority, SortDirection.Asc) + } }, CacheService); ViewData["Tenant"] = CurrentTenant; @@ -100,16 +102,16 @@ private async Task LoadPage(string seoName = null) return page; } - catch (Exception ex) + catch { - throw new MixException(MixErrorStatus.Badrequest, ex); + throw; } } private async Task LoadAlias(string seoName = null) { try { - var alias = await MixUrlAliasViewModel.GetRepository(Uow, CacheService).GetSingleAsync(m => m.MixTenantId == CurrentTenant.Id && m.Alias == seoName); + var alias = await MixUrlAliasViewModel.GetRepository(Uow, CacheService).GetSingleAsync(m => m.TenantId == CurrentTenant.Id && m.Alias == seoName); if (alias != null) { switch (alias.Type) @@ -122,7 +124,10 @@ private async Task LoadAlias(string seoName = null) { await page.LoadDataAsync(_mixDbDataService, _metadataService, new(Request) { - SortBy = MixQueryColumnName.Priority + SortByColumns = new List() + { + new Mix.Heart.Model.MixSortByColumn(MixQueryColumnName.Priority, SortDirection.Asc) + } }, CacheService); ViewData["Tenant"] = CurrentTenant; ViewData["Title"] = page.SeoTitle; diff --git a/src/applications/mixcore/Controllers/InitController.cs b/src/applications/mixcore/Controllers/InitController.cs index 040bf9b57..4a8946b94 100644 --- a/src/applications/mixcore/Controllers/InitController.cs +++ b/src/applications/mixcore/Controllers/InitController.cs @@ -1,12 +1,16 @@ using Microsoft.AspNetCore.Mvc; +using Mix.Database.Services; +using Mix.Database.Services.MixGlobalSettings; +using Mix.Heart.Helpers; +using Mix.Lib.Extensions; using Mix.Shared.Models.Configurations; -using Mix.Shared.Services; using Mixcore.Domain.Constants; namespace Mixcore.Controllers { public class InitController : MixControllerBase { + private readonly AppSettingsService _appSettingsService; private readonly MixEndpointService _mixEndpointService; private readonly GlobalSettingsModel _globalConfig; public InitController( @@ -15,11 +19,12 @@ public InitController( IPSecurityConfigService ipSecurityConfigService, MixEndpointService mixEndpointService, IMixTenantService tenantService, - IConfiguration configuration) + IConfiguration configuration, + AppSettingsService appSettingsService) : base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService, configuration) { _mixEndpointService = mixEndpointService; - _globalConfig = configuration.GetSection(MixAppSettingsSection.GlobalSettings).Get()!; + _appSettingsService = appSettingsService; } [HttpGet] @@ -27,39 +32,43 @@ public InitController( [Route("init/{page}")] public IActionResult Index(string page) { - if (!_globalConfig.IsInit) + if (!Configuration.IsInit()) { return Redirect("/"); } else { + if (string.IsNullOrEmpty(Configuration.AesKey())) + { + var newKey = AesEncryptionHelper.GenerateCombinedKeys(); + _appSettingsService.SetConfig("AesKey", newKey); + Configuration["AesKey"] = newKey; + _appSettingsService.SaveSettings(); + } page ??= ""; - var initStatus = _globalConfig.InitStatus; - - switch (initStatus) + switch (Configuration.InitStep()) { case InitStep.Blank: + case InitStep.InitTenant: InitEndpoints(); if (!string.IsNullOrEmpty(page.ToLower())) { return Redirect(InitRoutePath.Default); } break; - - case InitStep.InitTenant: + case InitStep.InitAccount: if (page.ToLower() != "step2") { return Redirect(InitRoutePath.Step2); } break; - - case InitStep.InitAccount: + case InitStep.SelectTheme: if (page.ToLower() != "step3") { return Redirect(InitRoutePath.Step3); } break; - case InitStep.SelectTheme: + case InitStep.InitTheme: if (page.ToLower() != "step4") { return Redirect(InitRoutePath.Step4); diff --git a/src/applications/mixcore/Controllers/ModuleDataController.cs b/src/applications/mixcore/Controllers/ModuleDataController.cs index 9b4f96d96..b0bbeda01 100644 --- a/src/applications/mixcore/Controllers/ModuleDataController.cs +++ b/src/applications/mixcore/Controllers/ModuleDataController.cs @@ -24,7 +24,10 @@ public ModuleDataController(IHttpContextAccessor httpContextAccessor, cacheService, translator, mixIdentityService, uow, queueService, portalHub, mixTenantService) { } - + protected override Task CreateHandlerAsync(ModuleDataViewModel data, CancellationToken cancellationToken = default) + { + return base.CreateHandlerAsync(data, cancellationToken); + } [HttpGet("get-module-data")] public async Task>> GetByModule([FromQuery] SearchModuleDataDto req, CancellationToken cancellationToken = default) { diff --git a/src/applications/mixcore/Controllers/PageContentApiController.cs b/src/applications/mixcore/Controllers/PageContentApiController.cs index a58a23113..7884b1591 100644 --- a/src/applications/mixcore/Controllers/PageContentApiController.cs +++ b/src/applications/mixcore/Controllers/PageContentApiController.cs @@ -3,8 +3,8 @@ using Mix.Heart.Helpers; using Mix.Lib.Models.Common; using Mix.Lib.Services; +using Mix.Mixdb.Interfaces; using Mix.Mq.Lib.Models; -using Mix.RepoDb.Interfaces; using Mix.RepoDb.Repositories; using Mix.Services.Databases.Lib.Interfaces; using Mix.Shared.Models; @@ -36,9 +36,9 @@ public PageContentApiController( _mixDbDataService = mixDbDataService; } - protected override async Task GetById(int id) + protected override async Task GetById(int id, CancellationToken cancellationToken = default) { - var result = await base.GetById(id); + var result = await base.GetById(id, cancellationToken); await result.LoadDataAsync(_mixDbDataService, _metadataService, new(), CacheService); return result; } diff --git a/src/applications/mixcore/Controllers/PageController.cs b/src/applications/mixcore/Controllers/PageController.cs index aef220707..6c2b858ca 100644 --- a/src/applications/mixcore/Controllers/PageController.cs +++ b/src/applications/mixcore/Controllers/PageController.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc; using Mix.Database.Services; -using Mix.RepoDb.Interfaces; +using Mix.Database.Services.MixGlobalSettings; +using Mix.Mixdb.Interfaces; using Mix.RepoDb.Repositories; using Mix.Services.Databases.Lib.Interfaces; using Mix.Shared.Services; @@ -14,11 +15,13 @@ public class PageController : MixControllerBase protected readonly MixCmsContext CmsContext; private readonly DatabaseService _databaseService; private readonly MixCacheService _cacheService; + private readonly AppSettingsService _appSettingsService; + private readonly GlobalSettingsService _globalConfigService; private readonly IMixMetadataService _metadataService; private readonly IMixDbDataService _mixDbDataService; public PageController(IHttpContextAccessor httpContextAccessor, IPSecurityConfigService ipSecurityConfigService, IMixCmsService mixCmsService, DatabaseService databaseService, MixCmsContext cmsContext, IMixMetadataService metadataService, MixCacheService cacheService, IMixTenantService tenantService, - IConfiguration configuration, IMixDbDataService mixDbDataService) : + IConfiguration configuration, IMixDbDataService mixDbDataService, GlobalSettingsService globalConfigService, AppSettingsService appSettingsService) : base(httpContextAccessor, mixCmsService, ipSecurityConfigService, tenantService, configuration) { CmsContext = cmsContext; @@ -28,6 +31,8 @@ public PageController(IHttpContextAccessor httpContextAccessor, IPSecurityConfig _metadataService = metadataService; _cacheService = cacheService; _mixDbDataService = mixDbDataService; + _globalConfigService = globalConfigService; + _appSettingsService = appSettingsService; } protected override void ValidateRequest() @@ -35,7 +40,7 @@ protected override void ValidateRequest() base.ValidateRequest(); // If this site has not been inited yet - if (GlobalConfigService.Instance.AppSettings.IsInit) + if (_appSettingsService.AppSettings.IsInit) { IsValid = false; if (string.IsNullOrEmpty(_databaseService.GetConnectionString(MixConstants.CONST_CMS_CONNECTION))) @@ -44,7 +49,7 @@ protected override void ValidateRequest() } else { - var status = GlobalConfigService.Instance.AppSettings.InitStatus; + var status = _appSettingsService.AppSettings.InitStatus; RedirectUrl = $"/init/step{status}"; } } @@ -71,14 +76,11 @@ protected async Task Page(int pageId, string keyword = null) { // Home Page var pageRepo = PageContentViewModel.GetRepository(Uow, _cacheService); - var page = await pageRepo.GetSingleAsync(m => m.Id == pageId && m.MixTenantId == CurrentTenant.Id); + var page = await pageRepo.GetSingleAsync(m => m.Id == pageId && m.TenantId == CurrentTenant.Id); if (page == null) return NotFound(); - await page.LoadDataAsync(_mixDbDataService, _metadataService, new(Request) - { - SortBy = MixQueryColumnName.Priority - }, _cacheService); + await page.LoadDataAsync(_mixDbDataService, _metadataService, new(Request), _cacheService); ViewData["Title"] = page.SeoTitle; diff --git a/src/applications/mixcore/Controllers/PortalController.cs b/src/applications/mixcore/Controllers/PortalController.cs index 594a18640..ec4942227 100644 --- a/src/applications/mixcore/Controllers/PortalController.cs +++ b/src/applications/mixcore/Controllers/PortalController.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Mvc; -using Mix.Database.Services; -using Mix.Shared.Services; +using Mix.Database.Services.MixGlobalSettings; +using Mix.Lib.Extensions; namespace Mixcore.Controllers { @@ -69,7 +69,7 @@ protected override void ValidateRequest() base.ValidateRequest(); // If this site has not been inited yet - if (GlobalConfigService.Instance.AppSettings.IsInit) + if (Configuration.IsInit()) { IsValid = false; if (string.IsNullOrEmpty(_databaseService.GetConnectionString(MixConstants.CONST_CMS_CONNECTION))) @@ -78,8 +78,7 @@ protected override void ValidateRequest() } else { - var status = GlobalConfigService.Instance.AppSettings.InitStatus; - RedirectUrl = $"/init/step{status}"; + RedirectUrl = $"/init/step{Configuration.InitStep()}"; } } } diff --git a/src/applications/mixcore/Controllers/PostContentApiController.cs b/src/applications/mixcore/Controllers/PostContentApiController.cs index 1edd3e24a..114211269 100644 --- a/src/applications/mixcore/Controllers/PostContentApiController.cs +++ b/src/applications/mixcore/Controllers/PostContentApiController.cs @@ -5,10 +5,11 @@ using Mix.Heart.Helpers; using Mix.Lib.Models.Common; using Mix.Lib.Services; +using Mix.Mixdb.Interfaces; using Mix.Mq.Lib.Models; -using Mix.RepoDb.Interfaces; using Mix.RepoDb.Repositories; using Mix.Services.Databases.Lib.Interfaces; +using Mix.Shared.Models; using Mix.SignalR.Interfaces; namespace Mixcore.Controllers @@ -18,8 +19,8 @@ namespace Mixcore.Controllers public sealed class PostContentApiController : MixQueryApiControllerBase { private readonly IMixDbDataService _mixDbDataService; - private readonly MixRepoDbRepository _repoDbRepository; - private readonly MixRepoDbRepository _mixRepoDbRepository; + private readonly RepoDbRepository _repoDbRepository; + private readonly RepoDbRepository _mixRepoDbRepository; private readonly IMixMetadataService _metadataService; private readonly MixcorePostService _postService; public PostContentApiController( @@ -31,9 +32,8 @@ public PostContentApiController( UnitOfWorkInfo uow, IMemoryQueueService queueService, MixcorePostService postService, - MixRepoDbRepository mixRepoDbRepository, + RepoDbRepository mixRepoDbRepository, IMixMetadataService metadataService, - MixRepoDbRepository repoDbRepository, IPortalHubClientService portalHub, IMixTenantService mixTenantService, IMixDbDataService mixDbDataService) @@ -43,12 +43,11 @@ public PostContentApiController( _postService = postService; _mixRepoDbRepository = mixRepoDbRepository; _metadataService = metadataService; - _repoDbRepository = repoDbRepository; _mixDbDataService = mixDbDataService; } [HttpPost("filter")] - public async Task>> Filter([FromBody] FilterContentRequestDto req) + public async Task>> Filter([FromBody] FilterContentRequestDto req, CancellationToken cancellationToken = default) { try { @@ -57,8 +56,12 @@ public async Task>> Filte !string.IsNullOrEmpty(req.MixDatabaseName), m => m.MixDatabaseName == req.MixDatabaseName); if (!string.IsNullOrEmpty(req.MixDatabaseName) && req.Queries.Count > 0) { - _mixRepoDbRepository.InitTableName(req.MixDatabaseName); - var listData = await _mixRepoDbRepository.GetListByAsync(req.Queries, "Id, ParentId"); + var listData = await _mixDbDataService.GetListByAsync( + new SearchMixDbRequestModel() + { + TableName = req.MixDatabaseName, + Queries = req.Queries, + },cancellationToken); if (listData != null) { List allowIds = new(); @@ -73,7 +76,7 @@ public async Task>> Filte var result = await Repository.GetPagingAsync(searchRequest.Predicate, searchRequest.PagingData); foreach (var item in result.Items) { - await item.LoadAdditionalDataAsync(_mixDbDataService, _metadataService, CacheService); + await item.LoadAdditionalDataAsync(_mixDbDataService, _metadataService, CacheService, cancellationToken); } return Ok(ParseSearchResult(req, result)); } @@ -94,16 +97,16 @@ protected override async Task> SearchH var result = await _postService.SearchPosts(searchPostQuery, cancellationToken); foreach (var item in result.Items) { - await item.LoadAdditionalDataAsync(_mixDbDataService, _metadataService, CacheService); + await item.LoadAdditionalDataAsync(_mixDbDataService, _metadataService, CacheService, cancellationToken); } return RestApiService.ParseSearchResult(req, result); } - protected override async Task GetById(int id) + protected override async Task GetById(int id, CancellationToken cancellationToken = default) { var result = await base.GetById(id); - await result.LoadAdditionalDataAsync(_mixDbDataService, _metadataService, CacheService); + await result.LoadAdditionalDataAsync(_mixDbDataService, _metadataService, CacheService, cancellationToken); return result; } } diff --git a/src/applications/mixcore/Controllers/PostController.cs b/src/applications/mixcore/Controllers/PostController.cs index eb8c2d1be..d136deae7 100644 --- a/src/applications/mixcore/Controllers/PostController.cs +++ b/src/applications/mixcore/Controllers/PostController.cs @@ -1,22 +1,22 @@ using Microsoft.AspNetCore.Mvc; using Mix.Database.Entities.MixDb; -using Mix.Database.Services; +using Mix.Database.Services.MixGlobalSettings; +using Mix.Lib.Extensions; using Mix.Lib.Interfaces; -using Mix.RepoDb.Interfaces; +using Mix.Mixdb.Interfaces; using Mix.RepoDb.Repositories; using Mix.Services.Databases.Lib.Interfaces; -using Mix.Shared.Services; namespace Mixcore.Controllers { [Route("{controller}")] public class PostController : MixControllerBase { - protected UnitOfWorkInfo Uow; + protected UnitOfWorkInfo Uow; protected readonly MixCmsContext CmsContext; private readonly DatabaseService _databaseService; private readonly MixCacheService _cacheService; - private readonly MixRepoDbRepository _repoDbRepository; + private readonly RepoDbRepository _repoDbRepository; private readonly IMixMetadataService _metadataService; private readonly IMixDbDataService _mixDbDataService; public PostController( @@ -25,7 +25,6 @@ public PostController( IMixCmsService mixCmsService, DatabaseService databaseService, MixCmsContext cmsContext, - MixRepoDbRepository repoDbRepository, IMixMetadataService metadataService, UnitOfWorkInfo dbUow, MixCacheService cacheService, @@ -38,11 +37,10 @@ public PostController( Uow = new(CmsContext); _databaseService = databaseService; CmsContext = cmsContext; - _repoDbRepository = repoDbRepository; _metadataService = metadataService; - _repoDbRepository.SetDbConnection(dbUow); _cacheService = cacheService; _mixDbDataService = mixDbDataService; + _mixDbDataService.SetDbConnection(Uow); } protected override void ValidateRequest() @@ -50,7 +48,7 @@ protected override void ValidateRequest() base.ValidateRequest(); // If this site has not been inited yet - if (GlobalConfigService.Instance.AppSettings.IsInit) + if (Configuration.IsInit()) { IsValid = false; if (string.IsNullOrEmpty(_databaseService.GetConnectionString(MixConstants.CONST_CMS_CONNECTION))) @@ -59,8 +57,7 @@ protected override void ValidateRequest() } else { - var status = GlobalConfigService.Instance.AppSettings.InitStatus; - RedirectUrl = $"/init/step{status}"; + RedirectUrl = $"/init/step{Configuration.InitStep()}"; } } } @@ -83,16 +80,16 @@ public async Task Index(int id, string seoName) #endregion Routes #region Helper - protected async Task Post(int postId, string seoName = null) + protected async Task Post(int postId, string seoName = null, CancellationToken cancellationToken = default) { // Home Post var postRepo = PostContentViewModel.GetRepository(Uow, _cacheService); - var post = await postRepo.GetSingleAsync(m => m.Id == postId && m.MixTenantId == CurrentTenant.Id); + var post = await postRepo.GetSingleAsync(m => m.Id == postId && m.TenantId == CurrentTenant.Id); if (post == null) { return NotFound(); } - await post.LoadAdditionalDataAsync(_mixDbDataService, _metadataService, _cacheService); + await post.LoadAdditionalDataAsync(_mixDbDataService, _metadataService, _cacheService, cancellationToken); ViewData["Title"] = post.SeoTitle; ViewData["Description"] = post.SeoDescription; diff --git a/src/applications/mixcore/Controllers/SecurityController.cs b/src/applications/mixcore/Controllers/SecurityController.cs index 72d5e8c5e..2abb823da 100644 --- a/src/applications/mixcore/Controllers/SecurityController.cs +++ b/src/applications/mixcore/Controllers/SecurityController.cs @@ -4,9 +4,9 @@ using Mix.Auth.Enums; using Mix.Auth.Models; using Mix.Database.Entities.Account; +using Mix.Database.Services.MixGlobalSettings; using Mix.Heart.Exceptions; using Mix.Lib.Services; -using Mix.Shared.Services; using Quartz.Listener; using System.Security.Claims; diff --git a/src/applications/mixcore/Dockerfile_linux b/src/applications/mixcore/Dockerfile_linux deleted file mode 100644 index d6d19806e..000000000 --- a/src/applications/mixcore/Dockerfile_linux +++ /dev/null @@ -1,41 +0,0 @@ -#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. - -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base -USER app -EXPOSE 8080 -EXPOSE 8081 - -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build -ARG BUILD_CONFIGURATION=Release -COPY ["src/applications/mixcore.gateway/mixcore.gateway.csproj", "src/applications/mixcore.gateway/"] -COPY ["src/platform/mix.library/mix.library.csproj", "src/platform/mix.library/"] -COPY ["src/platform/core/mix.mixdb.event/mix.mixdb.event.csproj", "src/platform/core/mix.mixdb.event/"] -COPY ["src/platform/mix.mixdb/mix.mixdb.csproj", "src/platform/mix.mixdb/"] -COPY ["src/platform/mix.database/mix.database.csproj", "src/platform/mix.database/"] -COPY ["src/platform/mix.shared/mix.shared.csproj", "src/platform/mix.shared/"] -COPY ["src/platform/core/mix-heart/src/mix.heart/mix.heart.csproj", "src/platform/core/mix-heart/src/mix.heart/"] -COPY ["src/platform/mix.constant/mix.constant.csproj", "src/platform/mix.constant/"] -COPY ["src/platform/mix.service/mix.service.csproj", "src/platform/mix.service/"] -COPY ["src/platform/mix.identity/mix.identity.csproj", "src/platform/mix.identity/"] -COPY ["src/platform/mix.auth/mix.auth.csproj", "src/platform/mix.auth/"] -COPY ["src/platform/mix.quartz/mix.quartz.csproj", "src/platform/mix.quartz/"] -COPY ["src/platform/mix.queue/mix.queue.csproj", "src/platform/mix.queue/"] -COPY ["src/services/mix-message-queue/mix.mq.server/mix.mq.server.csproj", "src/services/mix-message-queue/mix.mq/"] -COPY ["src/applications/mixcore.host.aspire/mixcore.host.aspire.ServiceDefaults/mixcore.host.aspire.ServiceDefaults.csproj", "src/applications/mixcore.host.aspire/mixcore.host.aspire.ServiceDefaults/"] -COPY ["src/services/mix-message-queue/mix.mq.lib/mix.mq.lib.csproj", "src/services/mix-message-queue/mix.mq.lib/"] -COPY ["src/platform/mix.signalr/mix.signalr.csproj", "src/platform/mix.signalr/"] -COPY ["src/platform/mix.repodb/mix.repodb.csproj", "src/platform/mix.repodb/"] -COPY ["src/platform/mix.communicator/mix.communicator.csproj", "src/platform/mix.communicator/"] -COPY ["src/platform/mix.signalr.hub/mix.signalr.hub.csproj", "src/platform/mix.signalr.hub/"] -COPY ["src/platform/mix.log/mix.log.lib.csproj", "src/platform/mix.log/"] -RUN dotnet restore "src/applications/mixcore.gateway/mixcore.gateway.csproj" -COPY . . -RUN dotnet build "/src/applications/mixcore.gateway/mixcore.gateway.csproj" -c $BUILD_CONFIGURATION -o /app/build - -FROM build AS publish -ARG BUILD_CONFIGURATION=Release -RUN dotnet publish "/src/applications/mixcore.gateway/mixcore.gateway.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false - -FROM base AS final -COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "mixcore.gateway.dll"] \ No newline at end of file diff --git a/src/applications/mixcore/Domain/Bases/MvcBaseController.cs b/src/applications/mixcore/Domain/Bases/MvcBaseController.cs index a04c8ba7e..149b108ab 100644 --- a/src/applications/mixcore/Domain/Bases/MvcBaseController.cs +++ b/src/applications/mixcore/Domain/Bases/MvcBaseController.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Mvc; -using Mix.Database.Services; +using Mix.Database.Services.MixGlobalSettings; +using Mix.Lib.Extensions; using Mix.Lib.Services; -using Mix.Shared.Services; namespace Mixcore.Domain.Bases { @@ -27,7 +27,7 @@ protected override void ValidateRequest() base.ValidateRequest(); // If this site has not been inited yet - if (GlobalConfig.IsInit) + if (Configuration.IsInit()) { IsValid = false; if (string.IsNullOrEmpty(DatabaseService.GetConnectionString(MixConstants.CONST_CMS_CONNECTION))) @@ -36,8 +36,7 @@ protected override void ValidateRequest() } else { - var status = GlobalConfig.InitStatus; - RedirectUrl = $"/init/step{status}"; + RedirectUrl = $"/init/step{Configuration.InitStep()}"; } } } diff --git a/src/applications/mixcore/Domain/Extensions/ServiceExtension.cs b/src/applications/mixcore/Domain/Extensions/ServiceExtension.cs index 2e1b9ee47..2676790cd 100644 --- a/src/applications/mixcore/Domain/Extensions/ServiceExtension.cs +++ b/src/applications/mixcore/Domain/Extensions/ServiceExtension.cs @@ -21,7 +21,7 @@ public static void AddMixRoutes(this IServiceCollection services) public static void UseMixMVCEndpoints(this IEndpointRouteBuilder routes) { - string notStartWithPattern = "regex(^(?!(mix-app|graph|app|init|page|post|security|portal|api|vue|error|swagger|graphql|ReDoc|OpenAPI|.+Hub))(.+)$)"; + string notStartWithPattern = "regex(^(?!(mixcontent|mix-app|graph|app|init|page|post|security|portal|api|vue|error|swagger|graphql|ReDoc|OpenAPI|.+Hub))(.+)$)"; //string urlPathPattern = @"regex((([A-z0-9\-\%]+\/)*[A-z0-9\-\%]+$)?)"; routes.MapDynamicControllerRoute( diff --git a/src/applications/mixcore/Domain/Protos/mixmq.proto b/src/applications/mixcore/Domain/Protos/mixmq.proto index 359260311..c07a9d14f 100644 --- a/src/applications/mixcore/Domain/Protos/mixmq.proto +++ b/src/applications/mixcore/Domain/Protos/mixmq.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -option csharp_namespace = "Mix.Mq"; +option csharp_namespace = "Mix.Mq.Server"; import "google/protobuf/empty.proto"; package mixmq; @@ -8,23 +8,23 @@ package mixmq; // The greeting service definition. service MixMq { // Sends a greeting - rpc Subscribe (SubscribeRequest) returns (stream SubscribeReply); - rpc Disconnect (SubscribeRequest) returns (google.protobuf.Empty); - rpc Publish (PublishMessageRequest) returns (google.protobuf.Empty); + rpc Subscribe (MixSubscribeRequest) returns (stream MixSubscribeReply); + rpc Disconnect (MixSubscribeRequest) returns (google.protobuf.Empty); + rpc Publish (MixPublishMessageRequest) returns (google.protobuf.Empty); } // The request message containing the user's name. -message SubscribeRequest { +message MixSubscribeRequest { string topicId = 1; string subsctiptionId = 2; } -message PublishMessageRequest { +message MixPublishMessageRequest { string topicId = 1; string message = 2; } // The response message containing the greetings. -message SubscribeReply { +message MixSubscribeReply { repeated string messages = 1; } diff --git a/src/applications/mixcore/Domain/Services/MixSEORouteTransformer.cs b/src/applications/mixcore/Domain/Services/MixSEORouteTransformer.cs index 5c6766a86..7fa58f26b 100644 --- a/src/applications/mixcore/Domain/Services/MixSEORouteTransformer.cs +++ b/src/applications/mixcore/Domain/Services/MixSEORouteTransformer.cs @@ -1,21 +1,24 @@ using Microsoft.AspNetCore.Mvc.Routing; -using Mix.Shared.Services; +using Mix.Database.Services.MixGlobalSettings; +using Mix.Lib.Extensions; namespace Mixcore.Domain.Services { // Ref: https://www.strathweb.com/2019/08/dynamic-controller-routing-in-asp-net-core-3-0/ public sealed class MixSEORouteTransformer : DynamicRouteValueTransformer { + private IConfiguration _configuration; private readonly IMixTenantService _tenantService; - public MixSEORouteTransformer(IMixTenantService tenantService) + public MixSEORouteTransformer(IMixTenantService tenantService, IConfiguration configuration) { _tenantService = tenantService; + _configuration = configuration; } public override ValueTask TransformAsync( HttpContext httpContext, RouteValueDictionary values) { - if (GlobalConfigService.Instance.AppSettings.IsInit) + if (_configuration.IsInit()) { return ValueTask.FromResult(values); } diff --git a/src/applications/mixcore/Domain/StartupServices.cs b/src/applications/mixcore/Domain/StartupServices.cs index fcf8ab1d6..8c1548ab3 100644 --- a/src/applications/mixcore/Domain/StartupServices.cs +++ b/src/applications/mixcore/Domain/StartupServices.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.DependencyInjection.Extensions; +using Mix.Lib.Extensions; using Mix.Lib.Middlewares; using Mix.Lib.Publishers; using Mix.Lib.Subscribers; @@ -6,10 +7,9 @@ using Mix.Log.Lib.Models; using Mix.Log.Lib.Publishers; using Mix.Log.Lib.Services; -using Mix.Log.Lib.Subscribers; +using Mix.Mixdb.Publishers; +using Mix.Mixdb.Subscribers; using Mix.Quartz.Services; -using Mix.RepoDb.Publishers; -using Mix.RepoDb.Subscribers; using Mix.Shared.Interfaces; using Mix.Shared.Models.Configurations; using Mix.Storage.Lib.Subscribers; @@ -18,32 +18,32 @@ namespace Mixcore.Domain { public class StartupServices : IStartupService { - public void AddServices(IServiceCollection services, IConfiguration configuration) + public void AddServices(IHostApplicationBuilder builder) { - var globalConfigs = configuration.GetSection(MixAppSettingsSection.GlobalSettings).Get()!; - services.AddMixRoutes(); + var globalConfigs = builder.Configuration.GetSection(MixAppSettingsSection.GlobalSettings).Get()!; + builder.Services.AddMixRoutes(); - services.AddHostedService(); - services.AddHostedService(); - services.AddHostedService(); - services.AddHostedService(); + builder.Services.AddHostedService(); + builder.Services.AddHostedService(); + builder.Services.AddHostedService(); + builder.Services.AddHostedService(); - services.AddHostedService(); - services.AddHostedService(); - services.AddHostedService(); - services.AddHostedService(); + builder.Services.AddHostedService(); + builder.Services.AddHostedService(); + builder.Services.AddHostedService(); + builder.Services.AddHostedService(); - services.AddHostedService(); - services.AddHostedService(); + builder.Services.AddHostedService(); + builder.Services.AddHostedService(); - if (!globalConfigs!.IsInit) + if (!builder.Configuration.IsInit()) { - services.TryAddSingleton(); - services.TryAddScoped(); - services.AddHostedService(); + builder.Services.TryAddSingleton(); + builder.Services.TryAddScoped(); + builder.Services.AddHostedService(); } - services.AddMixRateLimiter(configuration); + builder.AddMixRateLimiter(); } public void UseApps(IApplicationBuilder app, IConfiguration configuration, bool isDevelop) diff --git a/src/applications/mixcore/Domain/ViewModels/ApplicationViewModel.cs b/src/applications/mixcore/Domain/ViewModels/ApplicationViewModel.cs index a53d3cc4e..d28cf9ded 100644 --- a/src/applications/mixcore/Domain/ViewModels/ApplicationViewModel.cs +++ b/src/applications/mixcore/Domain/ViewModels/ApplicationViewModel.cs @@ -1,6 +1,6 @@ using Mix.Heart.Helpers; using Mix.Lib.ViewModels.ReadOnly; -using Mix.RepoDb.Interfaces; +using Mix.Mixdb.Interfaces; using Mix.RepoDb.Repositories; namespace Mixcore.Domain.ViewModels @@ -65,9 +65,9 @@ public T Property(string fieldName) #endregion #region Private Methods - public async Task LoadAdditionalDataAsync(IMixDbDataService mixDbDataService) + public async Task LoadAdditionalDataAsync(IMixDbDataService mixDbDataService, CancellationToken cancellationToken = default) { - var obj = await mixDbDataService.GetSingleByParent(MixDatabaseName, MixContentType.Post, Id, true); + var obj = await mixDbDataService.GetSingleByParentAsync(MixDatabaseName, MixContentType.Post, Id, string.Empty, cancellationToken); ExtraData = obj != null ? ReflectionHelper.ParseObject(obj) : null; } diff --git a/src/applications/mixcore/Domain/ViewModels/ModuleContentViewModel.cs b/src/applications/mixcore/Domain/ViewModels/ModuleContentViewModel.cs index fa75ccca4..d7f4d27aa 100644 --- a/src/applications/mixcore/Domain/ViewModels/ModuleContentViewModel.cs +++ b/src/applications/mixcore/Domain/ViewModels/ModuleContentViewModel.cs @@ -1,5 +1,5 @@ using Mix.Heart.Helpers; -using Mix.RepoDb.Interfaces; +using Mix.Mixdb.Interfaces; using Mix.RepoDb.Repositories; using Mix.Services.Databases.Lib.Interfaces; using MySqlX.XDevAPI.Common; @@ -61,17 +61,17 @@ public T Property(string fieldName) : default; } - private async Task LoadAdditionalDataAsync(IMixDbDataService mixDbDataService) + private async Task LoadAdditionalDataAsync(IMixDbDataService mixDbDataService, CancellationToken cancellationToken = default) { if (!string.IsNullOrEmpty(MixDatabaseName)) { - var obj = await mixDbDataService.GetSingleByParent(MixDatabaseName, MixContentType.Page, Id); + var obj = await mixDbDataService.GetSingleByParentAsync(MixDatabaseName, MixContentType.Page, Id, string.Empty, cancellationToken); AdditionalData = obj != null ? ReflectionHelper.ParseObject(obj) : null; } } public async Task LoadData(PagingModel pagingModel, IMixDbDataService mixDbDataService, IMixMetadataService metadataService, - MixCacheService cacheService) + MixCacheService cacheService, CancellationToken cancellationToken = default) { await LoadAdditionalDataAsync(mixDbDataService); var getData = await ModuleDataViewModel.GetRepository(UowInfo, CacheService).GetPagingAsync( @@ -90,7 +90,7 @@ public async Task LoadData(PagingModel pagingModel, IMixDbDataService mixDbDataS pagingModel); foreach (var item in Posts.Items) { - await item.Post.LoadAdditionalDataAsync(mixDbDataService, metadataService, cacheService); + await item.Post.LoadAdditionalDataAsync(mixDbDataService, metadataService, cacheService, cancellationToken); } } #endregion diff --git a/src/applications/mixcore/Domain/ViewModels/PageContentViewModel.cs b/src/applications/mixcore/Domain/ViewModels/PageContentViewModel.cs index eebf27ea3..9eaf16bb3 100644 --- a/src/applications/mixcore/Domain/ViewModels/PageContentViewModel.cs +++ b/src/applications/mixcore/Domain/ViewModels/PageContentViewModel.cs @@ -1,6 +1,6 @@ using Microsoft.EntityFrameworkCore; using Mix.Heart.Helpers; -using Mix.RepoDb.Interfaces; +using Mix.Mixdb.Interfaces; using Mix.RepoDb.Repositories; using Mix.Services.Databases.Lib.Interfaces; using Mix.Shared.Models; @@ -77,11 +77,11 @@ public T Property(string fieldName) #endregion #region Private Methods - private async Task LoadAdditionalDataAsync(IMixDbDataService mixDbDataService) + private async Task LoadAdditionalDataAsync(IMixDbDataService mixDbDataService, CancellationToken cancellationToken = default) { if (!string.IsNullOrEmpty(MixDatabaseName)) { - var obj = await mixDbDataService.GetSingleByParent(MixDatabaseName, MixContentType.Page, Id, true); + var obj = await mixDbDataService.GetSingleByParentAsync(MixDatabaseName, MixContentType.Page, Id, string.Empty, cancellationToken); AdditionalData = obj != null ? ReflectionHelper.ParseObject(obj) : null; } } diff --git a/src/applications/mixcore/Domain/ViewModels/PagePostViewModel.cs b/src/applications/mixcore/Domain/ViewModels/PagePostViewModel.cs index f5ff27728..da1411400 100644 --- a/src/applications/mixcore/Domain/ViewModels/PagePostViewModel.cs +++ b/src/applications/mixcore/Domain/ViewModels/PagePostViewModel.cs @@ -1,4 +1,4 @@ -using Mix.RepoDb.Interfaces; +using Mix.Mixdb.Interfaces; using Mix.Services.Databases.Lib.Interfaces; namespace Mixcore.Domain.ViewModels @@ -36,10 +36,10 @@ public PagePostAssociationViewModel(UnitOfWorkInfo unitOfWorkInfo) : base(unitOf public async Task LoadPost(IMixDbDataService mixDbDataService, IMixMetadataService metadataService, - MixCacheService cacheService) + MixCacheService cacheService, CancellationToken cancellationToken = default) { Post = await PostContentViewModel.GetRepository(UowInfo, CacheService).GetSingleAsync(ChildId); - await Post.LoadAdditionalDataAsync(mixDbDataService, metadataService, cacheService); + await Post.LoadAdditionalDataAsync(mixDbDataService, metadataService, cacheService, cancellationToken); } #endregion } diff --git a/src/applications/mixcore/Domain/ViewModels/PostContentViewModel.cs b/src/applications/mixcore/Domain/ViewModels/PostContentViewModel.cs index 2ccce7963..67d07c133 100644 --- a/src/applications/mixcore/Domain/ViewModels/PostContentViewModel.cs +++ b/src/applications/mixcore/Domain/ViewModels/PostContentViewModel.cs @@ -1,5 +1,5 @@ using Mix.Heart.Helpers; -using Mix.RepoDb.Interfaces; +using Mix.Mixdb.Interfaces; using Mix.RepoDb.Repositories; using Mix.Services.Databases.Lib.Interfaces; using Mix.Services.Databases.Lib.Models; @@ -58,14 +58,15 @@ public T Property(string fieldName) public async Task LoadAdditionalDataAsync( IMixDbDataService mixDbDataService, IMixMetadataService metadataService, - MixCacheService cacheService) + MixCacheService cacheService, + CancellationToken cancellationToken) { bool isChanged = false; if (AdditionalData == null && !string.IsNullOrEmpty(MixDatabaseName)) { isChanged = true; var relationships = Context.MixDatabaseRelationship.Where(m => m.SourceDatabaseName == MixDatabaseName).ToList(); - var obj = await mixDbDataService.GetSingleByParent(MixDatabaseName, MixContentType.Post, Id, true); + var obj = await mixDbDataService.GetSingleByParentAsync(MixDatabaseName, MixContentType.Post, Id, string.Empty, cancellationToken); if (obj != null) { AdditionalData = ReflectionHelper.ParseObject(obj); diff --git a/src/applications/mixcore/Program.cs b/src/applications/mixcore/Program.cs index 114be4664..8c21154b4 100644 --- a/src/applications/mixcore/Program.cs +++ b/src/applications/mixcore/Program.cs @@ -11,121 +11,105 @@ using Mix.Lib.Publishers; using Mix.Lib.Subscribers; using Mix.Quartz.Services; -using Mix.RepoDb.Publishers; -using Mix.RepoDb.Subscribers; using Mix.Storage.Lib.Subscribers; using Mix.Log.Lib.Publishers; using Mix.Log.Lib.Interfaces; using Mix.Log.Lib.Services; using Mix.Log.Lib.Models; -internal class Program +using Mix.Shared.Extensions; +using Mix.Mixdb.Publishers; +using Mix.Mixdb.Subscribers; +using Mix.Lib.Extensions; + +var builder = MixCmsHelper.CreateWebApplicationBuilder(args); + +builder.AddServiceDefaults(); +// Add services to the container. +builder.Services.AddControllersWithViews(); + + +builder.Services.AddWebEncoders(options => +{ + options.TextEncoderSettings = new TextEncoderSettings(UnicodeRanges.All); +}); +builder.Services.AddEndpointsApiExplorer(); +builder.AddConfigurations(); +var globalConfig = builder.Configuration.GetSection(MixAppSettingsSection.GlobalSettings) + .Get(); +builder.AddMixQueue(); +builder.AddMixServices(Assembly.GetExecutingAssembly()); +builder.AddMixLogPublisher(); +builder.Services.ApplyMigrations(builder.Configuration, globalConfig); +builder.AddMixCors(); +builder.Services.AddScoped(); +builder.Services.AddMixLogSubscriber(builder.Configuration); +builder.Services.AddMixAuthorize(builder.Configuration); +builder.Services.AddScoped(); +builder.Services.TryAddScoped(); + +AddPortalServices(builder.Services, builder.Configuration); +var app = builder.Build(); + +app.MapDefaultEndpoints(); + +Configure(app, builder.Environment, builder.Configuration); + +app.Run(); + + +void Configure(IApplicationBuilder app, IWebHostEnvironment env, IConfiguration configuration) { - private static void Main(string[] args) + if (!env.IsLocal()) { - var builder = MixCmsHelper.CreateWebApplicationBuilder(args); - - if (builder.Environment.IsDevelopment()) - { - builder.AddServiceDefaults(); - } - // Add services to the container. - builder.Services.AddControllersWithViews(); - - - builder.Services.AddWebEncoders(options => - { - options.TextEncoderSettings = new TextEncoderSettings(UnicodeRanges.All); - }); - var globalConfig = builder.Configuration.GetSection(MixAppSettingsSection.GlobalSettings) - .Get(); - builder.Services.AddEndpointsApiExplorer(); - builder.AddMixQueue(); - builder.Services.AddMixServices(Assembly.GetExecutingAssembly(), builder.Configuration); - builder.AddMixLogPublisher(); - builder.Services.ApplyMigrations(globalConfig); - builder.Services.AddMixCors(); - builder.Services.AddScoped(); - builder.Services.AddMixLogSubscriber(builder.Configuration); - builder.Services.AddMixAuthorize(builder.Configuration); - builder.Services.AddScoped(); - builder.Services.TryAddScoped(); - - AddPortalServices(builder.Services, builder.Configuration); - var app = builder.Build(); - - if (builder.Environment.IsDevelopment()) - { - app.MapDefaultEndpoints(); - } - - Configure(app, builder.Environment, builder.Configuration); - - app.Run(); - - - void Configure(IApplicationBuilder app, IWebHostEnvironment env, IConfiguration configuration) - { - if (!env.IsDevelopment()) - { - // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. - app.UseHsts(); - } - app.UseHttpsRedirection(); - app.UseMixTenant(); - app.UseRouting(); - - // Typically, UseStaticFiles is called before UseCors. Apps that use JavaScript to retrieve static files cross site must call UseCors before UseStaticFiles. - app.UseMixStaticFiles(env.ContentRootPath); - - - // UseCors must be placed after UseRouting and before UseAuthorization. This is to ensure that CORS headers are included in the response for both authorized and unauthorized calls. - app.UseMixCors(); - - // must go between app.UseRouting() and app.UseEndpoints. - app.UseMixAuth(); - // auditlog middleware must go after auth - app.UseMiddleware(); - app.UseMixRateLimiter(); - app.UseMixApps(Assembly.GetExecutingAssembly(), configuration, env.ContentRootPath, env.IsDevelopment()); - app.UseMixSwaggerApps(env.IsDevelopment(), Assembly.GetExecutingAssembly()); - app.UseResponseCompression(); - app.UseMixResponseCaching(); - - - - //if (GlobalConfigService.Instance.AppSettings.IsHttps) - //{ - // app.UseHttpsRedirection(); - //} - - - } - - void AddPortalServices(IServiceCollection services, IConfiguration configuration) - { - var globalConfigs = configuration.GetSection(MixAppSettingsSection.GlobalSettings).Get()!; - services.AddMixRoutes(); - - services.AddHostedService(); - services.AddHostedService(); - services.AddHostedService(); - services.AddHostedService(); - - services.AddHostedService(); - services.AddHostedService(); - services.AddHostedService(); - services.AddHostedService(); - - services.AddHostedService(); - services.AddHostedService(); - - if (!globalConfigs!.IsInit) - { - services.TryAddSingleton(); - services.TryAddScoped(); - services.AddHostedService(); - } - - } + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); } -} \ No newline at end of file + app.UseHttpsRedirection(); + app.UseMixTenant(); + app.UseRouting(); + + // Typically, UseStaticFiles is called before UseCors. Apps that use JavaScript to retrieve static files cross site must call UseCors before UseStaticFiles. + app.UseMixStaticFiles(env.ContentRootPath); + + + // UseCors must be placed after UseRouting and before UseAuthorization. This is to ensure that CORS headers are included in the response for both authorized and unauthorized calls. + app.UseMixCors(configuration); + + // must go between app.UseRouting() and app.UseEndpoints. + app.UseMixAuth(); + + // auditlog middleware must go after auth + app.UseMiddleware(); + app.UseMixRateLimiter(); + app.UseMixApps(Assembly.GetExecutingAssembly(), configuration, !env.IsProduction()); + app.UseMixSwaggerApps(!env.IsProduction(), Assembly.GetExecutingAssembly()); + app.UseResponseCompression(); + app.UseMixResponseCaching(); +} + +void AddPortalServices(IServiceCollection services, IConfiguration configuration) +{ + var globalConfigs = configuration.GetSection(MixAppSettingsSection.GlobalSettings).Get()!; + services.AddMixRoutes(); + + services.AddHostedService(); + services.AddHostedService(); + services.AddHostedService(); + services.AddHostedService(); + + services.AddHostedService(); + services.AddHostedService(); + services.AddHostedService(); + services.AddHostedService(); + + services.AddHostedService(); + services.AddHostedService(); + + if (!configuration.IsInit()) + { + services.TryAddSingleton(); + services.TryAddScoped(); + services.AddHostedService(); + } + +} diff --git a/src/applications/mixcore/Properties/launchSettings.json b/src/applications/mixcore/Properties/launchSettings.json index 2023ea7b1..0b3f7185b 100644 --- a/src/applications/mixcore/Properties/launchSettings.json +++ b/src/applications/mixcore/Properties/launchSettings.json @@ -1,14 +1,20 @@ { - "profiles": { - "https": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "dotnetRunMessages": true, - "applicationUrl": "https://localhost:5010;http://localhost:5011" - } - }, - "$schema": "http://json.schemastore.org/launchsettings.json" + "profiles": { + "Development": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Local", + "API_ENCRYPT_KEY": "", + "SETTINGS_CONNECTION_STRING": "Data Source=wwwroot\\mixcontent\\settings.sqlite", + "DATABASE_PROVIDER": "SQLITE", + "SERVICE_NAME": "portal", + "INIT_STATUS": "Blank", + "ASPNETCORE_URLS": "https://localhost:5010;http://localhost:5011" + }, + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:5010;http://localhost:5011" + } + }, + "$schema": "http://json.schemastore.org/launchsettings.json" } \ No newline at end of file diff --git a/src/applications/mixcore/Views/Init/Index.cshtml b/src/applications/mixcore/Views/Init/Index.cshtml index ffbca80cd..f1bf20526 100644 --- a/src/applications/mixcore/Views/Init/Index.cshtml +++ b/src/applications/mixcore/Views/Init/Index.cshtml @@ -6,7 +6,7 @@ + href="@(configService.GetConfig("Favicon", ViewData["Culture"]?.ToString(), 1, "/mix-app/css/portal/img/mixcore-logo-green.svg"))"> Init Cms - Mixcore - net8.0 + net9.0 false en disable @@ -11,6 +11,9 @@ ..\.. false true + False + False + none @@ -61,15 +64,15 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/applications/mixcore/mixcore.gateway.csproj b/src/applications/mixcore/mixcore.gateway.csproj deleted file mode 100644 index 008722f7c..000000000 --- a/src/applications/mixcore/mixcore.gateway.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - - net8.0 - false - true - false - enable - enable - true - Mixcore.Gateway - bbdd7c53-6dfa-4f6f-ab46-5ecda7005ed0 - Linux - ..\.. - - - - - - - - - - - - - - - - - - - - diff --git a/src/applications/mixcore/mixcore.gateway.http b/src/applications/mixcore/mixcore.gateway.http deleted file mode 100644 index 32ea4bf3d..000000000 --- a/src/applications/mixcore/mixcore.gateway.http +++ /dev/null @@ -1,6 +0,0 @@ -@mixcore.gateway_HostAddress = http://localhost:5025 - -GET {{mixcore.gateway_HostAddress}}/weatherforecast/ -Accept: application/json - -### diff --git a/src/applications/mixcore/p4ps.csproj b/src/applications/mixcore/p4ps.csproj deleted file mode 100644 index f09c6261a..000000000 --- a/src/applications/mixcore/p4ps.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - - net8.0 - false - en - disable - enable - aeea975a-4fec-4193-846d-3a3d92606bd7 - Linux - ..\.. - false - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - PreserveNewest - true - PreserveNewest - - - PreserveNewest - true - PreserveNewest - - - PreserveNewest - true - PreserveNewest - - - - - - diff --git a/src/applications/mixcore/wwwroot/default-mixcontent/default.zip b/src/applications/mixcore/wwwroot/default-mixcontent/default.zip index 41cec9936..22bcc645f 100644 Binary files a/src/applications/mixcore/wwwroot/default-mixcontent/default.zip and b/src/applications/mixcore/wwwroot/default-mixcontent/default.zip differ diff --git a/src/applications/mixcore/wwwroot/default-mixcontent/shared/appconfigs/google.json b/src/applications/mixcore/wwwroot/default-mixcontent/shared/appconfigs/google.json new file mode 100644 index 000000000..8b55666d5 --- /dev/null +++ b/src/applications/mixcore/wwwroot/default-mixcontent/shared/appconfigs/google.json @@ -0,0 +1,16 @@ +{ + "Google": { + "FileName": "mixcontent/shared/appconfigs/google_credential.json", + "ProjectId": "", + "GoogleFirebase": { + "WebApiKey": "", + "AuthDomain": "", + "StorageBucket": "", + "MessagingSenderId": "", + "AppId": "" + }, + "GoogleStorage": { + "BucketName": null + } + } +} diff --git a/src/applications/mixcore/wwwroot/default-mixcontent/shared/json/init-new-dbcontext-databases.json b/src/applications/mixcore/wwwroot/default-mixcontent/shared/json/init-new-dbcontext-databases.json index cb9910ef5..1e9c5cb82 100644 --- a/src/applications/mixcore/wwwroot/default-mixcontent/shared/json/init-new-dbcontext-databases.json +++ b/src/applications/mixcore/wwwroot/default-mixcontent/shared/json/init-new-dbcontext-databases.json @@ -1,7 +1,7 @@ { "databases": [ { - "systemName": "MixDatabaseAssociation", + "systemName": "mix_database_association", "displayName": "Data Relationship", "description": null, "type": "Service", @@ -23,216 +23,216 @@ "isDeleted": false } ], - "columns": [ - { - "displayName": "Parent Database Name", - "systemName": "ParentDatabaseName", - "mixDatabaseName": "MixDatabaseAssociation", - "dataType": "Text", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 25, - "mixDatabase": null, - "id": 1, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 2, - "status": "Published", - "isDeleted": false - }, - { - "displayName": "Child Database Name", - "systemName": "ChildDatabaseName", - "mixDatabaseName": "MixDatabaseAssociation", - "dataType": "Text", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 25, - "mixDatabase": null, - "id": 2, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 3, - "status": "Published", - "isDeleted": false - }, - { - "displayName": "Guid Parent Id", - "systemName": "GuidParentId", - "mixDatabaseName": "MixDatabaseAssociation", - "dataType": "Guid", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 25, - "mixDatabase": null, - "id": 3, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 3, - "status": "Published", - "isDeleted": false - }, - { - "displayName": "Child Parent Id", - "systemName": "GuidChildId", - "mixDatabaseName": "MixDatabaseAssociation", - "dataType": "Guid", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 25, - "mixDatabase": null, - "id": 4, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 4, - "status": "Published", - "isDeleted": false - }, - { - "displayName": "Parent Id", - "systemName": "ParentId", - "mixDatabaseName": "MixDatabaseAssociation", - "dataType": "Integer", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 25, - "mixDatabase": null, - "id": 5, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 5, - "status": "Published", - "isDeleted": false - }, - { - "displayName": "Child Id", - "systemName": "ChildId", - "mixDatabaseName": "MixDatabaseAssociation", - "dataType": "Integer", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false + "columns": [ + { + "systemName": "parent_database_name", + "displayName": "Source Database Name", + "mixDatabaseName": "mix_database_association", + "dataType": "Text", + "configurations": { + "isUnique": false, + "isRequire": false, + "isEncrypt": false, + "isSelect": false, + "maxLength": null, + "belongTo": null, + "optionsConfigurationName": null, + "allowedValues": null, + "upload": { + "arrayAccepts": [], + "accepts": "", + "width": null, + "height": null, + "isCrop": false + } + }, + "referenceId": null, + "defaultValue": null, + "mixDatabaseId": 1, + "mixDatabase": null, + "id": 1, + "createdDateTime": "2023-06-15T08:56:50", + "lastModified": null, + "createdBy": null, + "modifiedBy": null, + "priority": 2, + "status": "Published", + "isDeleted": false + }, + { + "systemName": "child_database_name", + "displayName": "Destination Database Name", + "mixDatabaseName": "mix_database_association", + "dataType": "Text", + "configurations": { + "isUnique": false, + "isRequire": false, + "isEncrypt": false, + "isSelect": false, + "maxLength": null, + "belongTo": null, + "optionsConfigurationName": null, + "allowedValues": null, + "upload": { + "arrayAccepts": [], + "accepts": "", + "width": null, + "height": null, + "isCrop": false + } + }, + "referenceId": null, + "defaultValue": null, + "mixDatabaseId": 1, + "mixDatabase": null, + "id": 2, + "createdDateTime": "2023-06-15T08:56:50", + "lastModified": null, + "createdBy": null, + "modifiedBy": null, + "priority": 3, + "status": "Published", + "isDeleted": false + }, + { + "systemName": "guid_parent_id", + "displayName": "Guid Source Id", + "mixDatabaseName": "mix_database_association", + "dataType": "Guid", + "configurations": { + "isUnique": false, + "isRequire": false, + "isEncrypt": false, + "isSelect": false, + "maxLength": null, + "belongTo": null, + "optionsConfigurationName": null, + "allowedValues": null, + "upload": { + "arrayAccepts": [], + "accepts": "", + "width": null, + "height": null, + "isCrop": false + } + }, + "referenceId": null, + "defaultValue": null, + "mixDatabaseId": 1, + "mixDatabase": null, + "id": 3, + "createdDateTime": "2023-06-15T08:56:50", + "lastModified": null, + "createdBy": null, + "modifiedBy": null, + "priority": 3, + "status": "Published", + "isDeleted": false + }, + { + "systemName": "guild_child_id", + "displayName": "Destination Guid Id", + "mixDatabaseName": "mix_database_association", + "dataType": "Guid", + "configurations": { + "isUnique": false, + "isRequire": false, + "isEncrypt": false, + "isSelect": false, + "maxLength": null, + "belongTo": null, + "optionsConfigurationName": null, + "allowedValues": null, + "upload": { + "arrayAccepts": [], + "accepts": "", + "width": null, + "height": null, + "isCrop": false + } + }, + "referenceId": null, + "defaultValue": null, + "mixDatabaseId": 1, + "mixDatabase": null, + "id": 4, + "createdDateTime": "2023-06-15T08:56:50", + "lastModified": null, + "createdBy": null, + "modifiedBy": null, + "priority": 4, + "status": "Published", + "isDeleted": false + }, + { + "systemName": "parent_id", + "displayName": "Source Integer Id", + "mixDatabaseName": "mix_database_association", + "dataType": "Integer", + "configurations": { + "isUnique": false, + "isRequire": false, + "isEncrypt": false, + "isSelect": false, + "maxLength": null, + "belongTo": null, + "optionsConfigurationName": null, + "allowedValues": null, + "upload": { + "arrayAccepts": [], + "accepts": "", + "width": null, + "height": null, + "isCrop": false + } + }, + "referenceId": null, + "defaultValue": null, + "mixDatabaseId": 1, + "mixDatabase": null, + "id": 5, + "createdDateTime": "2023-06-15T08:56:50", + "lastModified": null, + "createdBy": null, + "modifiedBy": null, + "priority": 5, + "status": "Published", + "isDeleted": false + }, + { + "systemName": "child_id", + "displayName": "Destination Integer Id", + "mixDatabaseName": "mix_database_association", + "dataType": "Integer", + "configurations": { + "isUnique": false, + "isRequire": false, + "isEncrypt": false, + "isSelect": false, + "maxLength": null, + "belongTo": null, + "optionsConfigurationName": null, + "allowedValues": null, + "upload": { + "arrayAccepts": [], + "accepts": "", + "width": null, + "height": null, + "isCrop": false + } + }, + "referenceId": null, + "defaultValue": null, + "mixDatabaseId": 1, + "mixDatabase": null, + "id": 6, + "createdDateTime": "2023-06-15T08:56:50", + "lastModified": null, + "createdBy": null, + "modifiedBy": null, + "priority": 6, + "status": "Published", + "isDeleted": false } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 25, - "mixDatabase": null, - "id": 6, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 6, - "status": "Published", - "isDeleted": false - } - ] + ] } diff --git a/src/applications/mixcore/wwwroot/default-mixcontent/shared/json/portal-menus.json b/src/applications/mixcore/wwwroot/default-mixcontent/shared/json/portal-menus.json index f58430439..e44ae9c49 100644 --- a/src/applications/mixcore/wwwroot/default-mixcontent/shared/json/portal-menus.json +++ b/src/applications/mixcore/wwwroot/default-mixcontent/shared/json/portal-menus.json @@ -1,1092 +1,1092 @@ { - "items": [ - { - "path": "/admin", - "icon": "mi mi-Tiles", - "svg": "tabler-icon-smart-home.svg", - "title": "Dashboard", - "subMenus": [] - }, - { - "path": "/admin/scheduler", - "icon": "mi mi-Tiles", - "svg": "tabler-icon-smart-home.svg", - "title": "Scheduler", - "subMenus": [] - }, - { - "title": "Tenants", - "path": "#", - "icon": "mi mi-ReadingList", - "svg": "tabler-icon-notebook.svg", - "subMenus": [ - { - "title": "Create Tenant", - "icon": "mi mi-Add", - "path": "/admin/tenant/create" - }, - { - "path": "/admin/tenant/list", - "title": "List Tenant", - "icon": "mi mi-List" - }, - { - "path": "/admin/domain/list", - "title": "List Domain", - "icon": "mi mi-List" - } - ] - }, - { - "title": "Applications", - "path": "#", - "icon": "mi mi-ReadingList", - "svg": "tabler-icon-notebook.svg", - "subMenus": [ - { - "title": "Create Applications", - "icon": "mi mi-Add", - "path": "/admin/mix-application/create" - }, - { - "path": "/admin/mix-application/list", - "title": "List Applications", - "icon": "mi mi-List" - } - ] - }, - { - "title": "Posts", - "path": "#", - "icon": "mi mi-ReadingList", - "svg": "tabler-icon-notebook.svg", - "subMenus": [ - { - "title": "Create Post", - "icon": "mi mi-Add", - "path": "/admin/post/create" - }, - { - "path": "/admin/post/list", - "title": "List Post", - "icon": "mi mi-List" - } - ] - }, - { - "title": "Pages", - "path": "#", - "icon": "mi mi-Page", - "svg": "tabler-icon-file-horizontal.svg", - "subMenus": [ - { - "title": "Create", - "icon": "mi mi-Add", - "path": "/admin/page/create" - }, - { - "path": "/admin/page/list", - "title": "List Page", - "icon": "mi mi-List" - } - ] - }, - { - "title": "Metadata", - "path": "#", - "icon": "mi mi-Tag", - "svg": "tabler-icon-tag.svg", - "subMenus": [ - { - "title": "Create New", - "icon": "mi mi-Add", - "path": "/admin/mix-database-data/create?mixDatabaseName=metadata&mixDatabaseTitle=Metadata" - }, - { - "path": "/admin/mix-database-data/list?mixDatabaseName=Metadata&mixDatabaseTitle=Metadata&isGroup=true", - "title": "List", - "icon": "mi mi-List" - } - ] - }, - { - "title": "Media", - "path": "#", - "icon": "mi mi-Media", - "svg": "tabler-icon-photo.svg", - "subMenus": [ - { - "title": "Create New", - "icon": "mi mi-Add", - "path": "/admin/media/create" - }, - { - "path": "/admin/media/list", - "title": "List", - "icon": "mi mi-List" - } - ] - }, - { - "title": "Modules", - "path": "#", - "icon": "mi mi-Puzzle", - "svg": "tabler-icon-layout-grid-add.svg", - "isHiden": true, - "subMenus": [ - { - "title": "Create new", - "icon": "mi mi-Add", - "path": "/admin/module/create" - }, - { - "path": "/admin/module/list", - "title": "List Module", - "icon": "mi mi-List" - } - ] - }, - { - "title": "Services", - "isHiden": true, - "path": "#", - "icon": "mi mi-AdjustHologram", - "subMenus": [ - { - "title": "Create New", - "icon": "mi mi-Add", - "path": "/admin/service/create" - }, - { - "path": "/admin/service/list", - "title": "List", - "icon": "mi mi-List" - } - ] - }, - { - "title": "MixDb Context", - "path": "#", - "icon": "mi mi-ResolutionLegacy", - "svg": "tabler-icon-table.svg", - "isHiden": true, - "subMenus": [ - { - "title": "Create New", - "icon": "mi mi-Add", - "path": "/admin/mixdb-context/create" - }, - { - "path": "/admin/mixdb-context/list", - "title": "List", - "icon": "mi mi-List" - } - ] - }, - { - "title": "Databases", - "path": "#", - "icon": "mi mi-ResolutionLegacy", - "svg": "tabler-icon-table.svg", - "isHiden": true, - "subMenus": [ - { - "title": "Create New", - "icon": "mi mi-Add", - "path": "/admin/mix-database/create" - }, - { - "path": "/admin/mix-database/list", - "title": "List", - "icon": "mi mi-List" - } - ] - }, - { - "title": "Navigations", - "path": "#", - "icon": "mi mi-Relationship", - "svg": "tabler-icon-directions.svg", - "isHiden": true, - "subMenus": [ - { - "title": "Create New", - "icon": "mi mi-Add", - "path": "/admin/mix-database-data/create?mixDatabaseId=2&mixDatabaseName=sysNavigation&mixDatabaseTitle=Navigation&dataId=default" - }, - { - "path": "/admin/mix-database-data/list?mixDatabaseId=2&mixDatabaseName=sysNavigation&mixDatabaseTitle=Navigation", + "items": [ + { + "path": "/admin", + "icon": "mi mi-Tiles", + "svg": "tabler-icon-smart-home.svg", + "title": "Dashboard", + "subMenus": [] + }, + { + "path": "/admin/scheduler", + "icon": "mi mi-Tiles", + "svg": "tabler-icon-smart-home.svg", + "title": "Scheduler", + "subMenus": [] + }, + { + "title": "Tenants", + "path": "#", + "icon": "mi mi-ReadingList", + "svg": "tabler-icon-notebook.svg", + "subMenus": [ + { + "title": "Create Tenant", + "icon": "mi mi-Add", + "path": "/admin/tenant/create" + }, + { + "path": "/admin/tenant/list", + "title": "List Tenant", + "icon": "mi mi-List" + }, + { + "path": "/admin/domain/list", + "title": "List Domain", + "icon": "mi mi-List" + } + ] + }, + { + "title": "Applications", + "path": "#", + "icon": "mi mi-ReadingList", + "svg": "tabler-icon-notebook.svg", + "subMenus": [ + { + "title": "Create Applications", + "icon": "mi mi-Add", + "path": "/admin/mix-application/create" + }, + { + "path": "/admin/mix-application/list", + "title": "List Applications", + "icon": "mi mi-List" + } + ] + }, + { + "title": "Posts", + "path": "#", + "icon": "mi mi-ReadingList", + "svg": "tabler-icon-notebook.svg", + "subMenus": [ + { + "title": "Create Post", + "icon": "mi mi-Add", + "path": "/admin/post/create" + }, + { + "path": "/admin/post/list", + "title": "List Post", + "icon": "mi mi-List" + } + ] + }, + { + "title": "Pages", + "path": "#", + "icon": "mi mi-Page", + "svg": "tabler-icon-file-horizontal.svg", + "subMenus": [ + { + "title": "Create", + "icon": "mi mi-Add", + "path": "/admin/page/create" + }, + { + "path": "/admin/page/list", + "title": "List Page", + "icon": "mi mi-List" + } + ] + }, + { + "title": "Metadata", + "path": "#", + "icon": "mi mi-Tag", + "svg": "tabler-icon-tag.svg", + "subMenus": [ + { + "title": "Create New", + "icon": "mi mi-Add", + "path": "/admin/mix-database-data/create?mixDatabaseName=metadata&mixDatabaseTitle=Metadata" + }, + { + "path": "/admin/mix-database-data/list?mixDatabaseName=Metadata&mixDatabaseTitle=Metadata&isGroup=true", + "title": "List", + "icon": "mi mi-List" + } + ] + }, + { + "title": "Media", + "path": "#", + "icon": "mi mi-Media", + "svg": "tabler-icon-photo.svg", + "subMenus": [ + { + "title": "Create New", + "icon": "mi mi-Add", + "path": "/admin/media/create" + }, + { + "path": "/admin/media/list", + "title": "List", + "icon": "mi mi-List" + } + ] + }, + { + "title": "Modules", + "path": "#", + "icon": "mi mi-Puzzle", + "svg": "tabler-icon-layout-grid-add.svg", + "isHiden": true, + "subMenus": [ + { + "title": "Create new", + "icon": "mi mi-Add", + "path": "/admin/module/create" + }, + { + "path": "/admin/module/list", + "title": "List Module", + "icon": "mi mi-List" + } + ] + }, + { + "title": "Services", + "isHiden": true, + "path": "#", + "icon": "mi mi-AdjustHologram", + "subMenus": [ + { + "title": "Create New", + "icon": "mi mi-Add", + "path": "/admin/service/create" + }, + { + "path": "/admin/service/list", + "title": "List", + "icon": "mi mi-List" + } + ] + }, + { + "title": "MixDb Context", + "path": "#", + "icon": "mi mi-ResolutionLegacy", + "svg": "tabler-icon-table.svg", + "isHiden": true, + "subMenus": [ + { + "title": "Create New", + "icon": "mi mi-Add", + "path": "/admin/mixdb-context/create" + }, + { + "path": "/admin/mixdb-context/list", + "title": "List", + "icon": "mi mi-List" + } + ] + }, + { + "title": "Databases", + "path": "#", + "icon": "mi mi-ResolutionLegacy", + "svg": "tabler-icon-table.svg", + "isHiden": true, + "subMenus": [ + { + "title": "Create New", + "icon": "mi mi-Add", + "path": "/admin/mix-database/create" + }, + { + "path": "/admin/mix-database/list", + "title": "List", + "icon": "mi mi-List" + } + ] + }, + { + "title": "Navigations", + "path": "#", + "icon": "mi mi-Relationship", + "svg": "tabler-icon-directions.svg", + "isHiden": true, + "subMenus": [ + { + "title": "Create New", + "icon": "mi mi-Add", + "path": "/admin/mix-database-data/create?mixDatabaseId=2&mixDatabaseName=sysNavigation&mixDatabaseTitle=Navigation&dataId=default" + }, + { + "path": "/admin/mix-database-data/list?mixDatabaseId=2&mixDatabaseName=sysNavigation&mixDatabaseTitle=Navigation", - "title": "List", - "icon": "mi mi-List" - } - ] - }, - { - "title": "Files", - "path": "#", - "icon": "mi mi-FileExplorer", - "svg": "tabler-icon-file.svg", - "isHiden": true, - "subMenus": [ - { - "path": "/admin/file/list", - "title": "List", - "icon": "mi mi-List" - }, - { - "path": "/admin/file/list?folder=logs", - "title": "Logs", - "icon": "mi mi-Error" - } - ] - }, - { - "title": "Users", - "path": "#", - "icon": "mi mi-Emoji", - "svg": "tabler-icon-users.svg", - "subMenus": [ - { - "title": "Create", - "icon": "mi mi-Add", - "path": "/admin/user/create" - }, - { - "path": "/admin/user/list", - "title": "List", - "icon": "mi mi-List" - }, - { - "path": "/admin/role/list", - "title": "Roles", - "icon": "mi mi-GuestUser" - }, - { - "path": "/admin/permission/list", - "title": "Permission", - "icon": "mi mi-Permissions" - } - ] - }, - { - "title": "Localize", - "path": "#", - "icon": "mi mi-Characters", - "isHiden": true, - "subMenus": [ - { - "title": "Create New", - "icon": "mi mi-Add", - "path": "/admin/localize/create" - }, - { - "path": "/admin/localize/list", - "title": "List", - "icon": "mi mi-List" - } - ] - }, - { - "title": "Permission", - "path": "#", - "icon": "mi mi-LockscreenDesktop", - "isHiden": true, - "subMenus": [ - { - "title": "Create New", - "icon": "mi mi-Add", - "path": "/admin/permission/create" - }, - { - "path": "/admin/permission/list", - "title": "List", - "icon": "mi mi-List" - } - ] - }, - { - "title": "Themes", - "path": "#", - "icon": "mi mi-Layout", - "svg": "tabler-icon-template.svg", - "subMenus": [ - { - "title": "Create Theme", - "icon": "mi mi-Add", - "path": "/admin/theme/create" - }, - { - "path": "/admin/theme/list", - "title": "Theme List", - "icon": "mi mi-List" - }, - { - "title": "Store", - "icon": "mi mi-ShoppingCart", - "path": "/admin/store/list" - }, - { - "path": "/admin/mix-database-data/list?mixDatabaseId=2&mixDatabaseName=sysNavigation&mixDatabaseTitle=Navigation", + "title": "List", + "icon": "mi mi-List" + } + ] + }, + { + "title": "Files", + "path": "#", + "icon": "mi mi-FileExplorer", + "svg": "tabler-icon-file.svg", + "isHiden": true, + "subMenus": [ + { + "path": "/admin/file/list", + "title": "List", + "icon": "mi mi-List" + }, + { + "path": "/admin/file/list?folder=logs", + "title": "Logs", + "icon": "mi mi-Error" + } + ] + }, + { + "title": "Users", + "path": "#", + "icon": "mi mi-Emoji", + "svg": "tabler-icon-users.svg", + "subMenus": [ + { + "title": "Create", + "icon": "mi mi-Add", + "path": "/admin/user/create" + }, + { + "path": "/admin/user/list", + "title": "List", + "icon": "mi mi-List" + }, + { + "path": "/admin/role/list", + "title": "Roles", + "icon": "mi mi-GuestUser" + }, + { + "path": "/admin/oauth-client/list", + "title": "Oauth Clients", + "icon": "mi mi-GuestUser" + }, + { + "path": "/admin/mix-database-data/list?mixDatabaseId=6&mixDatabaseName=sysPermission&mixDatabaseTitle=Permission", + "title": "Permission", + "icon": "mi mi-Permissions" + } + ] + }, + { + "title": "Localize", + "path": "#", + "icon": "mi mi-Characters", + "isHiden": true, + "subMenus": [ + { + "title": "Create New", + "icon": "mi mi-Add", + "path": "/admin/localize/create" + }, + { + "path": "/admin/localize/list", + "title": "List", + "icon": "mi mi-List" + } + ] + }, + { + "title": "Permission", + "path": "#", + "icon": "mi mi-LockscreenDesktop", + "isHiden": true, + "subMenus": [ + { + "title": "Create New", + "icon": "mi mi-Add", + "path": "/admin/permission/create" + }, + { + "path": "/admin/permission/list", + "title": "List", + "icon": "mi mi-List" + } + ] + }, + { + "title": "Themes", + "path": "#", + "icon": "mi mi-Layout", + "svg": "tabler-icon-template.svg", + "subMenus": [ + { + "title": "Create Theme", + "icon": "mi mi-Add", + "path": "/admin/theme/create" + }, + { + "path": "/admin/theme/list", + "title": "Theme List", + "icon": "mi mi-List" + }, + { + "title": "Store", + "icon": "mi mi-ShoppingCart", + "path": "/admin/store/list" + }, + { + "path": "/admin/mix-database-data/list?mixDatabaseId=2&mixDatabaseName=sysNavigation&mixDatabaseTitle=Navigation", - "title": "Navigations", - "icon": "mi mi-ButtonMenu" - }, - { - "path": "/admin/module/list", - "title": "Modules", - "icon": "mi mi-Apps" - }, - { - "path": "/admin/mixdb-context/list", - "title": "MixDb Context", - "icon": "mi mi-Wheel" - }, - { - "path": "/admin/mix-database/list", - "title": "Databases", - "icon": "mi mi-Wheel" - } - ] - }, - { - "title": "Mix Store", - "path": "#", - "icon": "mi mi-Shop", - "svg": "tabler-icon-building-store.svg", - "isHiden": true, - "subMenus": [ - { - "title": "List Online", - "icon": "mi mi-Cloud", - "path": "/admin/store/list" - } - ] - }, - { - "title": "Settings", - "path": "#", - "icon": "mi mi-Settings mi-spin", - "svg": "tabler-icon-settings.svg", - "subMenus": [ - { - "title": "Global Settings", - "icon": "mi mi-Equalizer", - "path": "/admin/app-settings/details" - }, - { - "path": "/admin/configuration/list", - "title": "Local settings", - "icon": "mi mi-Repair" - }, - { - "path": "/admin/language/list", - "title": "Languages", - "icon": "mi mi-World" - }, - { - "path": "/admin/localize/list", - "title": "Localization", - "icon": "mi mi-TimeLanguage" - }, - { - "path": "/admin/file/list", - "title": "Files", - "icon": "mi mi-FileExplorer" - }, - { - "path": "/admin/file/list?folder=logs", - "title": "Logs", - "icon": "mi mi-Error" - }, - { - "path": "/admin/audit-log/list", - "title": "Audit Logs", - "icon": "mi mi-Error" - }, - { - "path": "/admin/queue-log/list", - "title": "Queue Logs", - "icon": "mi mi-FileExplorer" - } - ] - } - ], - "routes": [ - { - "cate": "common", - "items": [ - { - "path": "/admin", - "templatePath": "/mix-app/views/app-portal/pages/dashboard/dashboard.html", - "controller": "DashboardController" - }, - { - "path": "/admin/scheduler", - "templatePath": "/mix-app/views/app-portal/pages/scheduler/list.html", - "controller": "SchedulerController" - }, - { - "path": "/admin/scheduler/create", - "templatePath": "/mix-app/views/app-portal/pages/scheduler/details.html", - "controller": "SchedulerController" - }, - { - "path": "/admin/scheduler/details/:name", - "templatePath": "/mix-app/views/app-portal/pages/scheduler/details.html", - "controller": "SchedulerController" - }, - { - "path": "/admin/import", - "templatePath": "/mix-app/views/app-portal/pages/import/details.html", - "controller": "ImportFileController" - }, - { - "path": "/admin/app-settings/details", - "templatePath": "/mix-app/views/app-portal/pages/app-settings/details.html", - "controller": "AppSettingsController" - }, - { - "path": "/admin/messenger", - "templatePath": "/mix-app/views/app-portal/pages/messenger/index.html", - "controller": "MessengerController" - }, - { - "path": "/admin/social-feed", - "templatePath": "/mix-app/views/app-portal/pages/social-feed/index.html", - "controller": "SocialFeedController" - }, - { - "path": "/admin/json-data/list", - "templatePath": "/mix-app/views/app-portal/pages/json-data/list.html", - "controller": "JsonDataController" - }, - { - "path": "/admin/json-data/details", - "templatePath": "/mix-app/views/app-portal/pages/json-data/details.html", - "controller": "JsonDataController" - }, - { - "path": "/admin/json-data/create", - "templatePath": "/mix-app/views/app-portal/pages/json-data/details.html", - "controller": "JsonDataController" - }, - { - "path": "/admin/floralpunk/membership/list", - "templatePath": "/mix-app/views/app-portal/pages/floralpunk/membership/list.html", - "controller": "FloralpunkMembershipController" - }, - { - "path": "/admin/floralpunk/membership/create", - "templatePath": "/mix-app/views/app-portal/pages/floralpunk/membership/details.html", - "controller": "FloralpunkMembershipController" - }, - { - "path": "/admin/floralpunk/membership/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/floralpunk/membership/details.html", - "controller": "FloralpunkMembershipController" - }, - { - "path": "/admin/floralpunk/coupon/list", - "templatePath": "/mix-app/views/app-portal/pages/floralpunk/coupon/list.html", - "controller": "FloralpunkCouponController" - }, - { - "path": "/admin/floralpunk/coupon/create", - "templatePath": "/mix-app/views/app-portal/pages/floralpunk/coupon/details.html", - "controller": "FloralpunkCouponController" - }, - { - "path": "/admin/floralpunk/coupon/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/floralpunk/coupon/details.html", - "controller": "FloralpunkCouponController" - }, - { - "path": "/admin/floralpunk/coupon-rule/create", - "templatePath": "/mix-app/views/app-portal/pages/floralpunk/coupon-rule/details.html", - "controller": "FloralpunkCouponRuleController" - }, - { - "path": "/admin/floralpunk/coupon-rule/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/floralpunk/coupon-rule/details.html", - "controller": "FloralpunkCouponRuleController" - } - ] - }, - { - "cate": "tenant", - "items": [ - { - "path": "/admin/tenant/create", - "templatePath": "/mix-app/views/app-portal/pages/tenant/details.html", - "controller": "TenantController" - }, - { - "path": "/admin/tenant/list", - "templatePath": "/mix-app/views/app-portal/pages/tenant/list.html", - "controller": "TenantController" - }, - { - "path": "/admin/tenant/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/tenant/details.html", - "controller": "TenantController" - } - ] - }, - { - "cate": "application", - "items": [ - { - "path": "/admin/mix-application/create", - "templatePath": "/mix-app/views/app-portal/pages/application/details.html", - "controller": "MixApplicationController" - }, - { - "path": "/admin/mix-application/list", - "templatePath": "/mix-app/views/app-portal/pages/application/list.html", - "controller": "MixApplicationController" - }, - { - "path": "/admin/mix-application/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/application/details.html", - "controller": "MixApplicationController" - } - ] - }, - { - "cate": "domain", - "items": [ - { - "path": "/admin/domain/create", - "templatePath": "/mix-app/views/app-portal/pages/domain/details.html", - "controller": "DomainController" - }, - { - "path": "/admin/domain/list", - "templatePath": "/mix-app/views/app-portal/pages/domain/list.html", - "controller": "DomainController" - }, - { - "path": "/admin/domain/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/domain/details.html", - "controller": "DomainController" - } - ] - }, - { - "cate": "audit-log", - "items": [ - { - "path": "/admin/audit-log/list", - "templatePath": "/mix-app/views/app-portal/pages/audit-log/list.html", - "controller": "AuditLogController" - }, - { - "path": "/admin/audit-log/stream", - "templatePath": "/mix-app/views/app-portal/pages/audit-log/stream.html", - "controller": "AuditLogController" - } - ] - }, - { - "cate": "queue-log", - "items": [ - { - "path": "/admin/queue-log/list", - "templatePath": "/mix-app/views/app-portal/pages/queue-log/list.html", - "controller": "QueueLogController" - } - ] - }, - { - "cate": "post", - "items": [ - { - "path": "/admin/post/create", - "templatePath": "/mix-app/views/app-portal/pages/post/details.html", - "controller": "PostController" - }, - { - "path": "/admin/post/list", - "templatePath": "/mix-app/views/app-portal/pages/post/list.html", - "controller": "PostController" - }, - { - "path": "/admin/post/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/post/details.html", - "controller": "PostController" - }, - { - "path": "/admin/post/gallery-list", - "templatePath": "/mix-app/views/app-portal/pages/post/gallery-list.html", - "controller": "PostController" - }, - { - "path": "/admin/post/gallery-details/:id", - "templatePath": "/mix-app/views/app-portal/pages/post/gallery-details.html", - "controller": "PostController" - }, - { - "path": "/admin/post/create-gallery", - "templatePath": "/mix-app/views/app-portal/pages/post/gallery-details.html", - "controller": "PostController" - } - ] - }, - { - "cate": "page", - "items": [ - { - "path": "/admin/page/create", - "templatePath": "/mix-app/views/app-portal/pages/page/details.html", - "controller": "PageController" - }, - { - "path": "/admin/page/list", - "templatePath": "/mix-app/views/app-portal/pages/page/list.html", - "controller": "PageController" - }, - { - "path": "/admin/page/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/page/details.html", - "controller": "PageController" - }, - { - "path": "/admin/page/page-post/list/:id", - "templatePath": "/mix-app/views/app-portal/pages/page-post/list.html", - "controller": "PagePostController" - }, - { - "path": "/admin/page/page-gallery/list/:id", - "templatePath": "/mix-app/views/app-portal/pages/page-gallery/list.html", - "controller": "PageGalleryController" - } - ] - }, - { - "cate": "module", - "items": [ - { - "path": "/admin/module/create", - "templatePath": "/mix-app/views/app-portal/pages/module/details.html", - "controller": "ModuleController" - }, - { - "path": "/admin/module/list", - "templatePath": "/mix-app/views/app-portal/pages/module/list.html", - "controller": "ModuleController" - }, - { - "path": "/admin/module/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/module/details.html", - "controller": "ModuleController" - }, - { - "path": "/admin/module/data/:id", - "templatePath": "/mix-app/views/app-portal/pages/module/data.html", - "controller": "ModuleController" - }, - { - "path": "/admin/module-post/list/:id", - "templatePath": "/mix-app/views/app-portal/pages/module-post/list.html", - "controller": "ModulePostController" - }, - { - "path": "/admin/module-gallery/list/:id", - "templatePath": "/mix-app/views/app-portal/pages/module-gallery/list.html", - "controller": "ModuleGalleryController" - }, - { - "path": "/admin/module-data/details/:moduleContentId", - "templatePath": "/mix-app/views/app-portal/pages/module-data/details.html", - "controller": "ModuleDataController" - }, - { - "path": "/admin/module-data/details/:moduleContentId/:id", - "templatePath": "/mix-app/views/app-portal/pages/module-data/details.html", - "controller": "ModuleDataController" - }, - { - "path": "/admin/module-data/list/:moduleContentId", - "templatePath": "/mix-app/views/app-portal/pages/module-data/list.html", - "controller": "ModuleDataController" - } - ] - }, - { - "cate": "theme", - "items": [ - { - "path": "/admin/theme/create", - "templatePath": "/mix-app/views/app-portal/pages/theme/details.html", - "controller": "ThemeController" - }, - { - "path": "/admin/theme/list", - "templatePath": "/mix-app/views/app-portal/pages/theme/list.html", - "controller": "ThemeController" - }, - { - "path": "/admin/theme/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/theme/details.html", - "controller": "ThemeController" - }, - { - "path": "/admin/theme/export/:id", - "templatePath": "/mix-app/views/app-portal/pages/theme/export.html", - "controller": "ThemeController" - }, - { - "path": "/admin/theme/import/:id", - "templatePath": "/mix-app/views/app-portal/pages/theme-import/import.html", - "controller": "ThemeImportController" - } - ] - }, - { - "cate": "template", - "items": [ - { - "path": "/admin/template/list/:themeId/:folderType", - "templatePath": "/mix-app/views/app-portal/pages/template/list.html", - "controller": "TemplateController" - }, - { - "path": "/admin/template/details/:themeId/:folderType/:id", - "templatePath": "/mix-app/views/app-portal/pages/template/details.html", - "controller": "TemplateController" - }, - { - "path": "/admin/template/create/:themeId/:folderType", - "templatePath": "/mix-app/views/app-portal/pages/template/details.html", - "controller": "TemplateController" - }, - { - "path": "/admin/template/list/:themeId", - "templatePath": "/mix-app/views/app-portal/pages/template/list.html", - "controller": "TemplateController" - } - ] - }, - { - "cate": "role", - "items": [ - { - "path": "/admin/role/create", - "templatePath": "/mix-app/views/app-portal/pages/role/details.html", - "controller": "RoleController" - }, - { - "path": "/admin/role/list", - "templatePath": "/mix-app/views/app-portal/pages/role/list.html", - "controller": "RoleController" - }, - { - "path": "/admin/role/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/role/details.html", - "controller": "RoleController" - } - ] - }, - { - "cate": "user", - "items": [ - { - "path": "/admin/user/create", - "templatePath": "/mix-app/views/app-portal/pages/user/register.html", - "controller": "UserController" - }, - { - "path": "/admin/user/list", - "templatePath": "/mix-app/views/app-portal/pages/user/list.html", - "controller": "UserController" - }, - { - "path": "/admin/user/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/user/details.html", - "controller": "UserController" - }, - { - "path": "/admin/my-profile", - "templatePath": "/mix-app/views/app-portal/pages/user/my-profile.html", - "controller": "UserController" - } - ] - }, - { - "cate": "media", - "items": [ - { - "path": "/admin/media/create", - "templatePath": "/mix-app/views/app-portal/pages/media/details.html", - "controller": "MediaController" - }, - { - "path": "/admin/media/list", - "templatePath": "/mix-app/views/app-portal/pages/media/list.html", - "controller": "MediaController" - }, - { - "path": "/admin/media/grid", - "templatePath": "/mix-app/views/app-portal/pages/media/list-grid.html", - "controller": "MediaController" - }, - { - "path": "/admin/media/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/media/details.html", - "controller": "MediaController" - } - ] - }, - { - "cate": "file", - "items": [ - { - "path": "/admin/file/create", - "templatePath": "/mix-app/views/app-portal/pages/file/details.html", - "controller": "FileController" - }, - { - "path": "/admin/file/list", - "templatePath": "/mix-app/views/app-portal/pages/file/list.html", - "controller": "FileController" - }, - { - "path": "/admin/file/details", - "templatePath": "/mix-app/views/app-portal/pages/file/details.html", - "controller": "FileController" - } - ] - }, - { - "cate": "permission", - "items": [ - { - "path": "/admin/permission/create", - "templatePath": "/mix-app/views/app-portal/pages/permission/details.html", - "controller": "PermissionController" - }, - { - "path": "/admin/permission/list", - "templatePath": "/mix-app/views/app-portal/pages/permission/list.html", - "controller": "PermissionController" - }, - { - "path": "/admin/permission/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/permission/details.html", - "controller": "PermissionController" - } - ] - }, - { - "cate": "localize", - "items": [ - { - "path": "/admin/localize/create", - "templatePath": "/mix-app/views/app-portal/pages/localize/details.html", - "controller": "LocalizeController" - }, - { - "path": "/admin/localize/list", - "templatePath": "/mix-app/views/app-portal/pages/localize/list.html", - "controller": "LocalizeController" - }, - { - "path": "/admin/localize/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/localize/details.html", - "controller": "LocalizeController" - } - ] - }, - { - "cate": "language", - "items": [ - { - "path": "/admin/language/create", - "templatePath": "/mix-app/views/app-portal/pages/culture/details.html", - "controller": "CultureController" - }, - { - "path": "/admin/language/list", - "templatePath": "/mix-app/views/app-portal/pages/culture/list.html", - "controller": "CultureController" - }, - { - "path": "/admin/language/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/culture/details.html", - "controller": "CultureController" - } - ] - }, - { - "cate": "Mix Database", - "items": [ - { - "path": "/admin/mix-database/create", - "templatePath": "/mix-app/views/app-portal/pages/mix-database/details.html", - "controller": "MixDatabaseController" - }, - { - "path": "/admin/mix-database/list", - "templatePath": "/mix-app/views/app-portal/pages/mix-database/list.html", - "controller": "MixDatabaseController" - }, - { - "path": "/admin/mix-database/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/mix-database/details.html", - "controller": "MixDatabaseController" - } - ] - }, - { - "cate": "MixDb Context", - "items": [ - { - "path": "/admin/mixdb-context/create", - "templatePath": "/mix-app/views/app-portal/pages/mixdb-context/details.html", - "controller": "MixDatabaseContextController" - }, - { - "path": "/admin/mixdb-context/list", - "templatePath": "/mix-app/views/app-portal/pages/mixdb-context/list.html", - "controller": "MixDatabaseContextController" - }, - { - "path": "/admin/mixdb-context/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/mixdb-context/details.html", - "controller": "MixDatabaseContextController" - } - ] - }, - { - "cate": "Mix Store", - "items": [ - { - "path": "/admin/store/list", - "templatePath": "/mix-app/views/app-portal/pages/store/list.html", - "controller": "StoreController" - } - ] - }, - { - "cate": "configuration", - "items": [ - { - "path": "/admin/configuration/create", - "templatePath": "/mix-app/views/app-portal/pages/configuration/details.html", - "controller": "ConfigurationController" - }, - { - "path": "/admin/configuration/list", - "templatePath": "/mix-app/views/app-portal/pages/configuration/list.html", - "controller": "ConfigurationController" - }, - { - "path": "/admin/configuration/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/configuration/details.html", - "controller": "ConfigurationController" + "title": "Navigations", + "icon": "mi mi-ButtonMenu" + }, + { + "path": "/admin/module/list", + "title": "Modules", + "icon": "mi mi-Apps" + }, + { + "path": "/admin/mixdb-context/list", + "title": "MixDb Context", + "icon": "mi mi-Wheel" + }, + { + "path": "/admin/mix-database/list", + "title": "Databases", + "icon": "mi mi-Wheel" + } + ] + }, + { + "title": "Mix Store", + "path": "#", + "icon": "mi mi-Shop", + "svg": "tabler-icon-building-store.svg", + "isHiden": true, + "subMenus": [ + { + "title": "List Online", + "icon": "mi mi-Cloud", + "path": "/admin/store/list" + } + ] + }, + { + "title": "Settings", + "path": "#", + "icon": "mi mi-Settings mi-spin", + "svg": "tabler-icon-settings.svg", + "subMenus": [ + { + "title": "Global Settings", + "icon": "mi mi-Equalizer", + "path": "/admin/global-settings/list" + }, + { + "path": "/admin/configuration/list", + "title": "Local settings", + "icon": "mi mi-Repair" + }, + { + "path": "/admin/language/list", + "title": "Languages", + "icon": "mi mi-World" + }, + { + "path": "/admin/localize/list", + "title": "Localization", + "icon": "mi mi-TimeLanguage" + }, + { + "path": "/admin/file/list", + "title": "Files", + "icon": "mi mi-FileExplorer" + }, + { + "path": "/admin/file/list?folder=logs", + "title": "Logs", + "icon": "mi mi-Error" + }, + { + "path": "/admin/audit-log/list", + "title": "Audit Logs", + "icon": "mi mi-Error" + }, + { + "path": "/admin/queue-log/list", + "title": "Queue Logs", + "icon": "mi mi-FileExplorer" + } + ] } - ] - }, - { - "cate": "url alias", - "items": [ - { - "path": "/admin/url-alias/create", - "templatePath": "/mix-app/views/app-portal/pages/url-alias/details.html", - "controller": "UrlAliasController" - }, - { - "path": "/admin/url-alias/list", - "templatePath": "/mix-app/views/app-portal/pages/url-alias/list.html", - "controller": "UrlAliasController" - }, - { - "path": "/admin/url-alias/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/url-alias/details.html", - "controller": "UrlAliasController" - } - ] - }, - { - "cate": "file", - "items": [ - { - "path": "/admin/file/create", - "templatePath": "/mix-app/views/app-portal/pages/file/details.html", - "controller": "FileController" - }, - { - "path": "/admin/file/list", - "templatePath": "/mix-app/views/app-portal/pages/file/list.html", - "controller": "FileController" - }, - { - "path": "/admin/file/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/file/details.html", - "controller": "FileController" - } - ] - }, - { - "cate": "mix database data", - "items": [ - { - "path": "/admin/mix-database-data/create", - "templatePath": "/mix-app/views/app-portal/pages/mix-database-data/details.html", - "controller": "MixDatabaseDataController" - }, - { - "path": "/admin/mix-database-data/list", - "templatePath": "/mix-app/views/app-portal/pages/mix-database-data/list.html", - "controller": "MixDatabaseDataController" - }, - { - "path": "/admin/mix-database-data/details", - "templatePath": "/mix-app/views/app-portal/pages/mix-database-data/details.html", - "controller": "MixDatabaseDataController" - } - ] - }, - { - "cate": "Navigation", - "items": [ - { - "path": "/admin/navigation/create", - "templatePath": "/mix-app/views/app-portal/pages/navigation/details.html", - "controller": "NavigationController" - }, - { - "path": "/admin/navigation/list", - "templatePath": "/mix-app/views/app-portal/pages/navigation/list.html", - "controller": "NavigationController" - }, - { - "path": "/admin/navigation/details", - "templatePath": "/mix-app/views/app-portal/pages/navigation/details.html", - "controller": "NavigationController" - } - ] - }, - { - "cate": "service", - "items": [ - { - "path": "/admin/service/create", - "templatePath": "/mix-app/views/app-portal/pages/service/details.html", - "controller": "ServiceController" - }, - { - "path": "/admin/service/list", - "templatePath": "/mix-app/views/app-portal/pages/service/list.html", - "controller": "ServiceController" - }, - { - "path": "/admin/service/details/:id", - "templatePath": "/mix-app/views/app-portal/pages/service/details.html", - "controller": "ServiceController" + ], + "routes": [ + { + "cate": "common", + "items": [ + { + "path": "/admin", + "templatePath": "/mix-app/views/app-portal/pages/dashboard/dashboard.html", + "controller": "DashboardController" + }, + { + "path": "/admin/scheduler", + "templatePath": "/mix-app/views/app-portal/pages/scheduler/list.html", + "controller": "SchedulerController" + }, + { + "path": "/admin/scheduler/create", + "templatePath": "/mix-app/views/app-portal/pages/scheduler/details.html", + "controller": "SchedulerController" + }, + { + "path": "/admin/scheduler/details/:name", + "templatePath": "/mix-app/views/app-portal/pages/scheduler/details.html", + "controller": "SchedulerController" + }, + { + "path": "/admin/import", + "templatePath": "/mix-app/views/app-portal/pages/import/details.html", + "controller": "ImportFileController" + }, + { + "path": "/admin/messenger", + "templatePath": "/mix-app/views/app-portal/pages/messenger/index.html", + "controller": "MessengerController" + }, + { + "path": "/admin/social-feed", + "templatePath": "/mix-app/views/app-portal/pages/social-feed/index.html", + "controller": "SocialFeedController" + }, + { + "path": "/admin/json-data/list", + "templatePath": "/mix-app/views/app-portal/pages/json-data/list.html", + "controller": "JsonDataController" + }, + { + "path": "/admin/json-data/details", + "templatePath": "/mix-app/views/app-portal/pages/json-data/details.html", + "controller": "JsonDataController" + }, + { + "path": "/admin/json-data/create", + "templatePath": "/mix-app/views/app-portal/pages/json-data/details.html", + "controller": "JsonDataController" + } + ] + }, + { + "cate": "tenant", + "items": [ + { + "path": "/admin/tenant/create", + "templatePath": "/mix-app/views/app-portal/pages/tenant/details.html", + "controller": "TenantController" + }, + { + "path": "/admin/tenant/list", + "templatePath": "/mix-app/views/app-portal/pages/tenant/list.html", + "controller": "TenantController" + }, + { + "path": "/admin/tenant/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/tenant/details.html", + "controller": "TenantController" + } + ] + }, + { + "cate": "application", + "items": [ + { + "path": "/admin/mix-application/create", + "templatePath": "/mix-app/views/app-portal/pages/application/details.html", + "controller": "MixApplicationController" + }, + { + "path": "/admin/mix-application/list", + "templatePath": "/mix-app/views/app-portal/pages/application/list.html", + "controller": "MixApplicationController" + }, + { + "path": "/admin/mix-application/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/application/details.html", + "controller": "MixApplicationController" + } + ] + }, + { + "cate": "global-settings", + "items": [ + { + "path": "/admin/global-settings/create", + "templatePath": "/mix-app/views/app-portal/pages/global-setting/details.html", + "controller": "GlobalSettingController" + }, + { + "path": "/admin/global-settings/list", + "templatePath": "/mix-app/views/app-portal/pages/global-setting/list.html", + "controller": "GlobalSettingController" + }, + { + "path": "/admin/global-settings/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/global-setting/details.html", + "controller": "GlobalSettingController" + } + ] + }, + { + "cate": "domain", + "items": [ + { + "path": "/admin/domain/create", + "templatePath": "/mix-app/views/app-portal/pages/domain/details.html", + "controller": "DomainController" + }, + { + "path": "/admin/domain/list", + "templatePath": "/mix-app/views/app-portal/pages/domain/list.html", + "controller": "DomainController" + }, + { + "path": "/admin/domain/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/domain/details.html", + "controller": "DomainController" + } + ] + }, + { + "cate": "audit-log", + "items": [ + { + "path": "/admin/audit-log/list", + "templatePath": "/mix-app/views/app-portal/pages/audit-log/list.html", + "controller": "AuditLogController" + }, + { + "path": "/admin/audit-log/stream", + "templatePath": "/mix-app/views/app-portal/pages/audit-log/stream.html", + "controller": "AuditLogController" + } + ] + }, + { + "cate": "queue-log", + "items": [ + { + "path": "/admin/queue-log/list", + "templatePath": "/mix-app/views/app-portal/pages/queue-log/list.html", + "controller": "QueueLogController" + } + ] + }, + { + "cate": "post", + "items": [ + { + "path": "/admin/post/create", + "templatePath": "/mix-app/views/app-portal/pages/post/details.html", + "controller": "PostController" + }, + { + "path": "/admin/post/list", + "templatePath": "/mix-app/views/app-portal/pages/post/list.html", + "controller": "PostController" + }, + { + "path": "/admin/post/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/post/details.html", + "controller": "PostController" + }, + { + "path": "/admin/post/gallery-list", + "templatePath": "/mix-app/views/app-portal/pages/post/gallery-list.html", + "controller": "PostController" + }, + { + "path": "/admin/post/gallery-details/:id", + "templatePath": "/mix-app/views/app-portal/pages/post/gallery-details.html", + "controller": "PostController" + }, + { + "path": "/admin/post/create-gallery", + "templatePath": "/mix-app/views/app-portal/pages/post/gallery-details.html", + "controller": "PostController" + } + ] + }, + { + "cate": "page", + "items": [ + { + "path": "/admin/page/create", + "templatePath": "/mix-app/views/app-portal/pages/page/details.html", + "controller": "PageController" + }, + { + "path": "/admin/page/list", + "templatePath": "/mix-app/views/app-portal/pages/page/list.html", + "controller": "PageController" + }, + { + "path": "/admin/page/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/page/details.html", + "controller": "PageController" + }, + { + "path": "/admin/page/page-post/list/:id", + "templatePath": "/mix-app/views/app-portal/pages/page-post/list.html", + "controller": "PagePostController" + }, + { + "path": "/admin/page/page-gallery/list/:id", + "templatePath": "/mix-app/views/app-portal/pages/page-gallery/list.html", + "controller": "PageGalleryController" + } + ] + }, + { + "cate": "module", + "items": [ + { + "path": "/admin/module/create", + "templatePath": "/mix-app/views/app-portal/pages/module/details.html", + "controller": "ModuleController" + }, + { + "path": "/admin/module/list", + "templatePath": "/mix-app/views/app-portal/pages/module/list.html", + "controller": "ModuleController" + }, + { + "path": "/admin/module/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/module/details.html", + "controller": "ModuleController" + }, + { + "path": "/admin/module/data/:id", + "templatePath": "/mix-app/views/app-portal/pages/module/data.html", + "controller": "ModuleController" + }, + { + "path": "/admin/module-post/list/:id", + "templatePath": "/mix-app/views/app-portal/pages/module-post/list.html", + "controller": "ModulePostController" + }, + { + "path": "/admin/module-gallery/list/:id", + "templatePath": "/mix-app/views/app-portal/pages/module-gallery/list.html", + "controller": "ModuleGalleryController" + }, + { + "path": "/admin/module-data/details/:moduleContentId", + "templatePath": "/mix-app/views/app-portal/pages/module-data/details.html", + "controller": "ModuleDataController" + }, + { + "path": "/admin/module-data/details/:moduleContentId/:id", + "templatePath": "/mix-app/views/app-portal/pages/module-data/details.html", + "controller": "ModuleDataController" + }, + { + "path": "/admin/module-data/list/:moduleContentId", + "templatePath": "/mix-app/views/app-portal/pages/module-data/list.html", + "controller": "ModuleDataController" + } + ] + }, + { + "cate": "theme", + "items": [ + { + "path": "/admin/theme/create", + "templatePath": "/mix-app/views/app-portal/pages/theme/details.html", + "controller": "ThemeController" + }, + { + "path": "/admin/theme/list", + "templatePath": "/mix-app/views/app-portal/pages/theme/list.html", + "controller": "ThemeController" + }, + { + "path": "/admin/theme/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/theme/details.html", + "controller": "ThemeController" + }, + { + "path": "/admin/theme/export/:id", + "templatePath": "/mix-app/views/app-portal/pages/theme/export.html", + "controller": "ThemeController" + }, + { + "path": "/admin/theme/import/:id", + "templatePath": "/mix-app/views/app-portal/pages/theme-import/import.html", + "controller": "ThemeImportController" + } + ] + }, + { + "cate": "template", + "items": [ + { + "path": "/admin/template/list/:themeId/:folderType", + "templatePath": "/mix-app/views/app-portal/pages/template/list.html", + "controller": "TemplateController" + }, + { + "path": "/admin/template/details/:themeId/:folderType/:id", + "templatePath": "/mix-app/views/app-portal/pages/template/details.html", + "controller": "TemplateController" + }, + { + "path": "/admin/template/create/:themeId/:folderType", + "templatePath": "/mix-app/views/app-portal/pages/template/details.html", + "controller": "TemplateController" + }, + { + "path": "/admin/template/list/:themeId", + "templatePath": "/mix-app/views/app-portal/pages/template/list.html", + "controller": "TemplateController" + } + ] + }, + { + "cate": "role", + "items": [ + { + "path": "/admin/role/create", + "templatePath": "/mix-app/views/app-portal/pages/role/details.html", + "controller": "RoleController" + }, + { + "path": "/admin/role/list", + "templatePath": "/mix-app/views/app-portal/pages/role/list.html", + "controller": "RoleController" + }, + { + "path": "/admin/role/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/role/details.html", + "controller": "RoleController" + } + ] + }, + { + "cate": "OAuth Client", + "items": [ + { + "path": "/admin/oauth-client/create", + "templatePath": "/mix-app/views/app-portal/pages/oauth-client/details.html", + "controller": "OAuthClientController" + }, + { + "path": "/admin/oauth-client/list", + "templatePath": "/mix-app/views/app-portal/pages/oauth-client/list.html", + "controller": "OAuthClientController" + }, + { + "path": "/admin/oauth-client/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/oauth-client/details.html", + "controller": "OAuthClientController" + } + ] + }, + { + "cate": "user", + "items": [ + { + "path": "/admin/user/create", + "templatePath": "/mix-app/views/app-portal/pages/user/register.html", + "controller": "UserController" + }, + { + "path": "/admin/user/list", + "templatePath": "/mix-app/views/app-portal/pages/user/list.html", + "controller": "UserController" + }, + { + "path": "/admin/user/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/user/details.html", + "controller": "UserController" + }, + { + "path": "/admin/my-profile", + "templatePath": "/mix-app/views/app-portal/pages/user/my-profile.html", + "controller": "UserController" + } + ] + }, + { + "cate": "media", + "items": [ + { + "path": "/admin/media/create", + "templatePath": "/mix-app/views/app-portal/pages/media/details.html", + "controller": "MediaController" + }, + { + "path": "/admin/media/list", + "templatePath": "/mix-app/views/app-portal/pages/media/list.html", + "controller": "MediaController" + }, + { + "path": "/admin/media/grid", + "templatePath": "/mix-app/views/app-portal/pages/media/list-grid.html", + "controller": "MediaController" + }, + { + "path": "/admin/media/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/media/details.html", + "controller": "MediaController" + } + ] + }, + { + "cate": "file", + "items": [ + { + "path": "/admin/file/create", + "templatePath": "/mix-app/views/app-portal/pages/file/details.html", + "controller": "FileController" + }, + { + "path": "/admin/file/list", + "templatePath": "/mix-app/views/app-portal/pages/file/list.html", + "controller": "FileController" + }, + { + "path": "/admin/file/details", + "templatePath": "/mix-app/views/app-portal/pages/file/details.html", + "controller": "FileController" + } + ] + }, + { + "cate": "permission", + "items": [ + { + "path": "/admin/permission/create", + "templatePath": "/mix-app/views/app-portal/pages/permission/details.html", + "controller": "PermissionController" + }, + { + "path": "/admin/mix-database-data/list?mixDatabaseId=6&mixDatabaseName=sysPermission&mixDatabaseTitle=Permission", + "templatePath": "/mix-app/views/app-portal/pages/permission/list.html", + "controller": "PermissionController" + }, + { + "path": "/admin/permission/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/permission/details.html", + "controller": "PermissionController" + } + ] + }, + { + "cate": "localize", + "items": [ + { + "path": "/admin/localize/create", + "templatePath": "/mix-app/views/app-portal/pages/localize/details.html", + "controller": "LocalizeController" + }, + { + "path": "/admin/localize/list", + "templatePath": "/mix-app/views/app-portal/pages/localize/list.html", + "controller": "LocalizeController" + }, + { + "path": "/admin/localize/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/localize/details.html", + "controller": "LocalizeController" + } + ] + }, + { + "cate": "language", + "items": [ + { + "path": "/admin/language/create", + "templatePath": "/mix-app/views/app-portal/pages/culture/details.html", + "controller": "CultureController" + }, + { + "path": "/admin/language/list", + "templatePath": "/mix-app/views/app-portal/pages/culture/list.html", + "controller": "CultureController" + }, + { + "path": "/admin/language/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/culture/details.html", + "controller": "CultureController" + } + ] + }, + { + "cate": "Mix Database", + "items": [ + { + "path": "/admin/mix-database/create", + "templatePath": "/mix-app/views/app-portal/pages/mix-database/details.html", + "controller": "MixDatabaseController" + }, + { + "path": "/admin/mix-database/list", + "templatePath": "/mix-app/views/app-portal/pages/mix-database/list.html", + "controller": "MixDatabaseController" + }, + { + "path": "/admin/mix-database/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/mix-database/details.html", + "controller": "MixDatabaseController" + } + ] + }, + { + "cate": "MixDb Context", + "items": [ + { + "path": "/admin/mixdb-context/create", + "templatePath": "/mix-app/views/app-portal/pages/mixdb-context/details.html", + "controller": "MixDatabaseContextController" + }, + { + "path": "/admin/mixdb-context/list", + "templatePath": "/mix-app/views/app-portal/pages/mixdb-context/list.html", + "controller": "MixDatabaseContextController" + }, + { + "path": "/admin/mixdb-context/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/mixdb-context/details.html", + "controller": "MixDatabaseContextController" + } + ] + }, + { + "cate": "Mix Store", + "items": [ + { + "path": "/admin/store/list", + "templatePath": "/mix-app/views/app-portal/pages/store/list.html", + "controller": "StoreController" + } + ] + }, + { + "cate": "configuration", + "items": [ + { + "path": "/admin/configuration/create", + "templatePath": "/mix-app/views/app-portal/pages/configuration/details.html", + "controller": "ConfigurationController" + }, + { + "path": "/admin/configuration/list", + "templatePath": "/mix-app/views/app-portal/pages/configuration/list.html", + "controller": "ConfigurationController" + }, + { + "path": "/admin/configuration/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/configuration/details.html", + "controller": "ConfigurationController" + } + ] + }, + { + "cate": "url alias", + "items": [ + { + "path": "/admin/url-alias/create", + "templatePath": "/mix-app/views/app-portal/pages/url-alias/details.html", + "controller": "UrlAliasController" + }, + { + "path": "/admin/url-alias/list", + "templatePath": "/mix-app/views/app-portal/pages/url-alias/list.html", + "controller": "UrlAliasController" + }, + { + "path": "/admin/url-alias/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/url-alias/details.html", + "controller": "UrlAliasController" + } + ] + }, + { + "cate": "file", + "items": [ + { + "path": "/admin/file/create", + "templatePath": "/mix-app/views/app-portal/pages/file/details.html", + "controller": "FileController" + }, + { + "path": "/admin/file/list", + "templatePath": "/mix-app/views/app-portal/pages/file/list.html", + "controller": "FileController" + }, + { + "path": "/admin/file/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/file/details.html", + "controller": "FileController" + } + ] + }, + { + "cate": "mix database data", + "items": [ + { + "path": "/admin/mix-database-data/create", + "templatePath": "/mix-app/views/app-portal/pages/mix-database-data/details.html", + "controller": "MixDatabaseDataController" + }, + { + "path": "/admin/mix-database-data/list", + "templatePath": "/mix-app/views/app-portal/pages/mix-database-data/list.html", + "controller": "MixDatabaseDataController" + }, + { + "path": "/admin/mix-database-data/details", + "templatePath": "/mix-app/views/app-portal/pages/mix-database-data/details.html", + "controller": "MixDatabaseDataController" + } + ] + }, + { + "cate": "Navigation", + "items": [ + { + "path": "/admin/navigation/create", + "templatePath": "/mix-app/views/app-portal/pages/navigation/details.html", + "controller": "NavigationController" + }, + { + "path": "/admin/navigation/list", + "templatePath": "/mix-app/views/app-portal/pages/navigation/list.html", + "controller": "NavigationController" + }, + { + "path": "/admin/navigation/details", + "templatePath": "/mix-app/views/app-portal/pages/navigation/details.html", + "controller": "NavigationController" + } + ] + }, + { + "cate": "service", + "items": [ + { + "path": "/admin/service/create", + "templatePath": "/mix-app/views/app-portal/pages/service/details.html", + "controller": "ServiceController" + }, + { + "path": "/admin/service/list", + "templatePath": "/mix-app/views/app-portal/pages/service/list.html", + "controller": "ServiceController" + }, + { + "path": "/admin/service/details/:id", + "templatePath": "/mix-app/views/app-portal/pages/service/details.html", + "controller": "ServiceController" + } + ] } - ] - } - ] + ] } diff --git a/src/applications/mixcore/wwwroot/default-mixcontent/shared/json/system-databases.json b/src/applications/mixcore/wwwroot/default-mixcontent/shared/json/system-databases.json index 72b6135d0..f5fbadb1f 100644 --- a/src/applications/mixcore/wwwroot/default-mixcontent/shared/json/system-databases.json +++ b/src/applications/mixcore/wwwroot/default-mixcontent/shared/json/system-databases.json @@ -1,7 +1,7 @@ { "databases": [ { - "systemName": "sysMixDatabaseAssociation", + "systemName": "sys_mix_database_association", "displayName": "Data Relationship", "description": null, "type": "Service", @@ -23,73 +23,7 @@ "isDeleted": false }, { - "systemName": "warehouse", - "displayName": "Warehouse", - "description": null, - "type": "Service", - "readPermissions": [ "Owner" ], - "createPermissions": [ "Owner" ], - "updatePermissions": [ "Owner" ], - "deletePermissions": [ "Owner" ], - "selfManaged": false, - "mixDatabaseColumns": null, - "sourceRelationships": null, - "destinateRelationships": null, - "id": 25, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": "administrator", - "modifiedBy": "administrator", - "priority": 0, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "OrderDetail", - "displayName": "Order", - "description": null, - "type": "Service", - "readPermissions": [ "Owner" ], - "createPermissions": [], - "updatePermissions": [], - "deletePermissions": [], - "selfManaged": false, - "mixDatabaseColumns": null, - "sourceRelationships": null, - "destinateRelationships": null, - "id": 13, - "createdDateTime": "2022-11-27T14:52:59", - "lastModified": null, - "createdBy": "tinku", - "modifiedBy": "tinku", - "priority": 0, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "OrderItem", - "displayName": "Order Item", - "description": null, - "type": "Service", - "readPermissions": [ "Owner" ], - "createPermissions": [], - "updatePermissions": [], - "deletePermissions": [], - "selfManaged": false, - "mixDatabaseColumns": null, - "sourceRelationships": null, - "destinateRelationships": null, - "id": 14, - "createdDateTime": "2022-11-27T14:56:45", - "lastModified": null, - "createdBy": "tinku", - "modifiedBy": "tinku", - "priority": 0, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "PortalMenu", + "systemName": "portal_menu", "displayName": "Portal Menu", "description": null, "type": "Service", @@ -111,7 +45,7 @@ "isDeleted": false }, { - "systemName": "sysUserData", + "systemName": "sys_user_data", "displayName": "User Data", "description": null, "type": "GuidAdditionalData", @@ -133,7 +67,7 @@ "isDeleted": false }, { - "systemName": "sysNavigation", + "systemName": "sys_navigation", "displayName": "Navigation", "description": null, "type": "System", @@ -155,7 +89,7 @@ "isDeleted": false }, { - "systemName": "sysMenuItem", + "systemName": "sys_menu_item", "displayName": "Menu Item", "description": null, "type": "System", @@ -177,7 +111,7 @@ "isDeleted": false }, { - "systemName": "sysMedia", + "systemName": "sys_media", "displayName": "Media", "description": null, "type": "System", @@ -199,7 +133,7 @@ "isDeleted": false }, { - "systemName": "sysPermission", + "systemName": "sys_permission", "displayName": "Permission", "description": null, "type": "System", @@ -221,7 +155,7 @@ "isDeleted": false }, { - "systemName": "sysPermissionEndpoint", + "systemName": "sys_permission_endpoint", "displayName": "Permission Endpoint", "description": null, "type": "System", @@ -243,7 +177,7 @@ "isDeleted": false }, { - "systemName": "sysUserPermission", + "systemName": "sys_user_permission", "displayName": "User Permission", "description": null, "type": "Association", @@ -265,7 +199,7 @@ "isDeleted": false }, { - "systemName": "MixcoreCmsHelper", + "systemName": "mixcore_cms_helper", "displayName": "Mixcore CMS Helper", "description": null, "type": "System", @@ -287,8 +221,8 @@ "isDeleted": false }, { - "systemName": "Metadata", - "displayName": "Metadata", + "systemName": "mix_metadata", + "displayName": "mix_metadata", "description": null, "type": "Service", "readPermissions": [ "Owner" ], @@ -309,7 +243,7 @@ "isDeleted": false }, { - "systemName": "MetadataContentAssociation", + "systemName": "mix_metadata_content_association", "displayName": "Metadata Content Association", "description": null, "type": "Service", @@ -331,29 +265,7 @@ "isDeleted": false }, { - "systemName": "ContactAddress", - "displayName": "Contact Address", - "description": null, - "type": "Service", - "readPermissions": [], - "createPermissions": [], - "updatePermissions": [], - "deletePermissions": [], - "selfManaged": false, - "mixDatabaseColumns": null, - "sourceRelationships": null, - "destinateRelationships": null, - "id": 12, - "createdDateTime": "2023-05-05T03:11:24.435566", - "lastModified": null, - "createdBy": "tinku", - "modifiedBy": "administrator", - "priority": 0, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "MixDbEventSubscriber", + "systemName": "mixdb_event_subscriber", "displayName": "MixDb Event Subscriber", "description": null, "type": "Service", @@ -377,9 +289,9 @@ ], "columns": [ { - "systemName": "ParentDatabaseName", + "systemName": "parent_database_name", "displayName": "Source Database Name", - "mixDatabaseName": "MixDatabaseAssociation", + "mixDatabaseName": "sys_mix_database_association", "dataType": "Text", "configurations": { "isUnique": false, @@ -412,9 +324,9 @@ "isDeleted": false }, { - "systemName": "ChildDatabaseName", + "systemName": "child_database_name", "displayName": "Destination Database Name", - "mixDatabaseName": "MixDatabaseAssociation", + "mixDatabaseName": "sys_mix_database_association", "dataType": "Text", "configurations": { "isUnique": false, @@ -447,9 +359,9 @@ "isDeleted": false }, { - "systemName": "GuidParentId", + "systemName": "guid_parent_id", "displayName": "Guid Source Id", - "mixDatabaseName": "MixDatabaseAssociation", + "mixDatabaseName": "sys_mix_database_association", "dataType": "Guid", "configurations": { "isUnique": false, @@ -482,9 +394,9 @@ "isDeleted": false }, { - "systemName": "GuidChildId", + "systemName": "guild_child_id", "displayName": "Destination Guid Id", - "mixDatabaseName": "MixDatabaseAssociation", + "mixDatabaseName": "sys_mix_database_association", "dataType": "Guid", "configurations": { "isUnique": false, @@ -499,1050 +411,97 @@ "arrayAccepts": [], "accepts": "", "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 1, - "mixDatabase": null, - "id": 4, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 4, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "ParentId", - "displayName": "Source Integer Id", - "mixDatabaseName": "MixDatabaseAssociation", - "dataType": "Integer", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 1, - "mixDatabase": null, - "id": 5, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 5, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "ChildId", - "displayName": "Destination Integer Id", - "mixDatabaseName": "MixDatabaseAssociation", - "dataType": "Integer", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 1, - "mixDatabase": null, - "id": 6, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 6, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "postId", - "displayName": "Post Id", - "mixDatabaseName": "warehouse", - "dataType": "Integer", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 25, - "mixDatabase": null, - "id": 153, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 1, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "sku", - "displayName": "Sku", - "mixDatabaseName": "warehouse", - "dataType": "Text", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 25, - "mixDatabase": null, - "id": 154, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 2, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "currency", - "displayName": "Currency", - "mixDatabaseName": "warehouse", - "dataType": "Text", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 25, - "mixDatabase": null, - "id": 155, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 3, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "price", - "displayName": "Price", - "mixDatabaseName": "warehouse", - "dataType": "Double", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 25, - "mixDatabase": null, - "id": 156, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 4, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "inStock", - "displayName": "In Stock", - "mixDatabaseName": "warehouse", - "dataType": "Integer", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 25, - "mixDatabase": null, - "id": 157, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 5, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "sold", - "displayName": "Sold", - "mixDatabaseName": "warehouse", - "dataType": "Integer", - "configurations": { - "isUnique": false, - "isRequire": false, - "isEncrypt": false, - "isSelect": false, - "maxLength": null, - "belongTo": null, - "optionsConfigurationName": null, - "allowedValues": null, - "upload": { - "arrayAccepts": [], - "accepts": "", - "width": null, - "height": null, - "isCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 25, - "mixDatabase": null, - "id": 158, - "createdDateTime": "2023-06-15T08:56:50", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 6, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "title", - "displayName": "Title", - "mixDatabaseName": "OrderDetail", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 13, - "mixDatabase": null, - "id": 49, - "createdDateTime": "2022-11-27T14:52:59", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 0, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "total", - "displayName": "Total", - "mixDatabaseName": "OrderDetail", - "dataType": "Double", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 13, - "mixDatabase": null, - "id": 50, - "createdDateTime": "2022-11-27T14:52:59", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 1, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "orderStatus", - "displayName": "Order Status", - "mixDatabaseName": "OrderDetail", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": true, - "AllowedValues": [ - "NEW", - "WAITING_FOR_PAYMENT", - "PAID", - "SHIPPING", - "SUCCESS", - "PAYMENT_FAILED", - "SHIPPING_FAILED", - "CANCELED" - ], - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 13, - "mixDatabase": null, - "id": 51, - "createdDateTime": "2022-11-27T14:52:59", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 2, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "title", - "displayName": "Title", - "mixDatabaseName": "OrderItem", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 14, - "mixDatabase": null, - "id": 52, - "createdDateTime": "2022-11-27T14:56:45", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 0, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "image", - "displayName": "Image", - "mixDatabaseName": "OrderItem", - "dataType": "Upload", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 14, - "mixDatabase": null, - "id": 53, - "createdDateTime": "2022-11-27T14:56:45", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 2, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "price", - "displayName": "Price", - "mixDatabaseName": "OrderItem", - "dataType": "Double", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 14, - "mixDatabase": null, - "id": 54, - "createdDateTime": "2022-11-27T14:56:45", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 4, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "quantity", - "displayName": "Quantity", - "mixDatabaseName": "OrderItem", - "dataType": "Integer", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 14, - "mixDatabase": null, - "id": 55, - "createdDateTime": "2022-11-27T14:56:45", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 5, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "postId", - "displayName": "Post Id", - "mixDatabaseName": "OrderItem", - "dataType": "Integer", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 14, - "mixDatabase": null, - "id": 56, - "createdDateTime": "2022-11-27T14:56:45", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 7, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "referenceUrl", - "displayName": "Reference Url", - "mixDatabaseName": "OrderItem", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 14, - "mixDatabase": null, - "id": 57, - "createdDateTime": "2022-11-27T14:56:45", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 8, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "userId", - "displayName": "User Id", - "mixDatabaseName": "OrderDetail", - "dataType": "Guid", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 13, - "mixDatabase": null, - "id": 63, - "createdDateTime": "2022-11-27T15:45:28", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 11, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "total", - "displayName": "Total", - "mixDatabaseName": "OrderItem", - "dataType": "Double", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 14, - "mixDatabase": null, - "id": 64, - "createdDateTime": "2022-11-30T04:26:03", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 6, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "OrderDetailId", - "displayName": "OrderDetailId", - "mixDatabaseName": "OrderItem", - "dataType": "Reference", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 14, - "mixDatabase": null, - "id": 65, - "createdDateTime": "2022-11-30T06:54:49", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 1, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "description", - "displayName": "Description", - "mixDatabaseName": "OrderDetail", - "dataType": "MultilineText", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 13, - "mixDatabase": null, - "id": 67, - "createdDateTime": "2022-11-30T06:55:28", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 5, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "paymentGateway", - "displayName": "Payment Gateway", - "mixDatabaseName": "OrderDetail", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": true, - "AllowedValues": [ "Onepay", "Momo" ], - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": "Onepay", - "mixDatabaseId": 13, - "mixDatabase": null, - "id": 68, - "createdDateTime": "2022-11-30T09:44:43", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 3, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "currency", - "displayName": "Currency", - "mixDatabaseName": "OrderItem", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 14, - "mixDatabase": null, - "id": 79, - "createdDateTime": "2022-12-07T05:43:10", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 10, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "description", - "displayName": "Description", - "mixDatabaseName": "OrderItem", - "dataType": "MultilineText", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 14, - "mixDatabase": null, - "id": 80, - "createdDateTime": "2022-12-07T05:44:47", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 11, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "percent", - "displayName": "Percent", - "mixDatabaseName": "OrderItem", - "dataType": "Double", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 14, - "mixDatabase": null, - "id": 81, - "createdDateTime": "2022-12-07T05:45:15", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 12, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "currency", - "displayName": "Currency", - "mixDatabaseName": "OrderDetail", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 13, - "mixDatabase": null, - "id": 98, - "createdDateTime": "2022-12-11T03:36:17", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 6, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "email", - "displayName": "Email", - "mixDatabaseName": "OrderDetail", - "dataType": "EmailAddress", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 13, - "mixDatabase": null, - "id": 106, - "createdDateTime": "2022-12-25T13:57:19", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 7, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "paymentStatus", - "displayName": "Payment Status", - "mixDatabaseName": "OrderDetail", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": true, - "AllowedValues": [ - "SENT", - "PENDING", - "SUCCESS", - "FAILED", - "INVALIDRESPONSE" - ], - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 13, - "mixDatabase": null, - "id": 107, - "createdDateTime": "2022-12-25T13:57:19", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 4, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "sku", - "displayName": "Sku", - "mixDatabaseName": "OrderItem", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 14, - "mixDatabase": null, - "id": 122, - "createdDateTime": "2023-01-01T16:40:47", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 3, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "isActive", - "displayName": "IsActive", - "mixDatabaseName": "OrderItem", - "dataType": "Boolean", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 14, - "mixDatabase": null, - "id": 132, - "createdDateTime": "2023-01-03T09:32:43", - "lastModified": null, - "createdBy": null, - "modifiedBy": null, - "priority": 14, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "shippingAddress", - "displayName": "Shipping Address", - "mixDatabaseName": "OrderDetail", - "dataType": "Json", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false + "height": null, + "isCrop": false } }, "referenceId": null, "defaultValue": null, - "mixDatabaseId": 13, + "mixDatabaseId": 1, "mixDatabase": null, - "id": 142, - "createdDateTime": "2023-01-04T04:26:28", + "id": 4, + "createdDateTime": "2023-06-15T08:56:50", "lastModified": null, "createdBy": null, "modifiedBy": null, - "priority": 8, + "priority": 4, "status": "Published", "isDeleted": false }, { - "systemName": "paymentResponse", - "displayName": "Payment Response", - "mixDatabaseName": "OrderDetail", - "dataType": "Json", + "systemName": "parent_id", + "displayName": "Source Integer Id", + "mixDatabaseName": "sys_mix_database_association", + "dataType": "Integer", "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false + "isUnique": false, + "isRequire": false, + "isEncrypt": false, + "isSelect": false, + "maxLength": null, + "belongTo": null, + "optionsConfigurationName": null, + "allowedValues": null, + "upload": { + "arrayAccepts": [], + "accepts": "", + "width": null, + "height": null, + "isCrop": false } }, "referenceId": null, "defaultValue": null, - "mixDatabaseId": 13, + "mixDatabaseId": 1, "mixDatabase": null, - "id": 144, - "createdDateTime": "2023-01-06T08:35:44", + "id": 5, + "createdDateTime": "2023-06-15T08:56:50", "lastModified": null, "createdBy": null, "modifiedBy": null, - "priority": 10, + "priority": 5, "status": "Published", "isDeleted": false }, { - "systemName": "paymentRequest", - "displayName": "Payment Request", - "mixDatabaseName": "OrderDetail", - "dataType": "Json", + "systemName": "child_id", + "displayName": "Destination Integer Id", + "mixDatabaseName": "sys_mix_database_association", + "dataType": "Integer", "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false + "isUnique": false, + "isRequire": false, + "isEncrypt": false, + "isSelect": false, + "maxLength": null, + "belongTo": null, + "optionsConfigurationName": null, + "allowedValues": null, + "upload": { + "arrayAccepts": [], + "accepts": "", + "width": null, + "height": null, + "isCrop": false } }, "referenceId": null, "defaultValue": null, - "mixDatabaseId": 13, + "mixDatabaseId": 1, "mixDatabase": null, - "id": 145, - "createdDateTime": "2023-01-06T09:33:07", + "id": 6, + "createdDateTime": "2023-06-15T08:56:50", "lastModified": null, "createdBy": null, "modifiedBy": null, - "priority": 9, + "priority": 6, "status": "Published", "isDeleted": false }, { "systemName": "title", "displayName": "Title", - "mixDatabaseName": "PortalMenu", + "mixDatabaseName": "portal_menu", "dataType": "Text", "configurations": { "IsUnique": false, @@ -1571,7 +530,7 @@ { "systemName": "icon", "displayName": "Icon", - "mixDatabaseName": "PortalMenu", + "mixDatabaseName": "portal_menu", "dataType": "Icon", "configurations": { "IsUnique": false, @@ -1600,7 +559,7 @@ { "systemName": "path", "displayName": "Path", - "mixDatabaseName": "PortalMenu", + "mixDatabaseName": "portal_menu", "dataType": "Text", "configurations": { "IsUnique": false, @@ -1629,7 +588,7 @@ { "systemName": "role", "displayName": "Role", - "mixDatabaseName": "PortalMenu", + "mixDatabaseName": "portal_menu", "dataType": "Text", "configurations": { "IsRequire": false, @@ -1654,9 +613,9 @@ "isDeleted": false }, { - "systemName": "PortalMenuId", - "displayName": "PortalMenuId", - "mixDatabaseName": "PortalMenu", + "systemName": "portal_menu_id", + "displayName": "Portal Menu Id", + "mixDatabaseName": "portal_menu", "dataType": "Reference", "configurations": { "IsUnique": false, @@ -1685,7 +644,7 @@ { "systemName": "svg", "displayName": "Svg", - "mixDatabaseName": "PortalMenu", + "mixDatabaseName": "portal_menu", "dataType": "Text", "configurations": { "IsUnique": false, @@ -1714,7 +673,7 @@ { "systemName": "avatar", "displayName": "Avatar", - "mixDatabaseName": "sysUserData", + "mixDatabaseName": "sys_user_data", "dataType": "Upload", "configurations": { "IsUnique": false, @@ -1741,9 +700,9 @@ "isDeleted": false }, { - "systemName": "parentId", + "systemName": "parent_d", "displayName": "Parent Id", - "mixDatabaseName": "sysUserData", + "mixDatabaseName": "sys_user_data", "dataType": "Reference", "configurations": { "IsUnique": false, @@ -1770,9 +729,9 @@ "isDeleted": false }, { - "systemName": "parentType", + "systemName": "parent_type", "displayName": "Parent Type", - "mixDatabaseName": "sysUserData", + "mixDatabaseName": "sys_user_data", "dataType": "Text", "configurations": { "IsRequire": false, @@ -1797,9 +756,9 @@ "isDeleted": false }, { - "systemName": "phoneNumber", + "systemName": "phone_number", "displayName": "Phone Number", - "mixDatabaseName": "sysUserData", + "mixDatabaseName": "sys_user_data", "dataType": "Text", "configurations": { "IsUnique": false, @@ -1828,7 +787,7 @@ { "systemName": "fullname", "displayName": "Fullname", - "mixDatabaseName": "sysUserData", + "mixDatabaseName": "sys_user_data", "dataType": "Text", "configurations": { "IsUnique": false, @@ -1857,7 +816,7 @@ { "systemName": "email", "displayName": "Email", - "mixDatabaseName": "sysUserData", + "mixDatabaseName": "sys_user_data", "dataType": "Text", "configurations": { "IsUnique": false, @@ -1884,9 +843,9 @@ "isDeleted": false }, { - "systemName": "dateOfBirth", + "systemName": "date_of_birth", "displayName": "Date Of Birth", - "mixDatabaseName": "sysUserData", + "mixDatabaseName": "sys_user_data", "dataType": "DateTime", "configurations": { "IsUnique": false, @@ -1915,7 +874,7 @@ { "systemName": "title", "displayName": "Title", - "mixDatabaseName": "sysNavigation", + "mixDatabaseName": "sys_navigation", "dataType": "Text", "configurations": { "IsRequire": false, @@ -1942,7 +901,7 @@ { "systemName": "name", "displayName": "Name", - "mixDatabaseName": "sysNavigation", + "mixDatabaseName": "sys_navigation", "dataType": "Text", "configurations": { "IsRequire": false, @@ -1969,7 +928,7 @@ { "systemName": "title", "displayName": "Title", - "mixDatabaseName": "sysMenuItem", + "mixDatabaseName": "sys_menu_item", "dataType": "Text", "configurations": { "IsRequire": false, @@ -1996,7 +955,7 @@ { "systemName": "url", "displayName": "Url", - "mixDatabaseName": "sysMenuItem", + "mixDatabaseName": "sys_menu_item", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2023,7 +982,7 @@ { "systemName": "icon", "displayName": "Icon", - "mixDatabaseName": "sysMenuItem", + "mixDatabaseName": "sys_menu_item", "dataType": "Icon", "configurations": { "IsRequire": false, @@ -2050,7 +1009,7 @@ { "systemName": "type", "displayName": "Type", - "mixDatabaseName": "sysMenuItem", + "mixDatabaseName": "sys_menu_item", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2077,7 +1036,7 @@ { "systemName": "target", "displayName": "Target", - "mixDatabaseName": "sysMenuItem", + "mixDatabaseName": "sys_menu_item", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2102,9 +1061,9 @@ "isDeleted": false }, { - "systemName": "targetId", + "systemName": "target_id", "displayName": "Target Id", - "mixDatabaseName": "sysMenuItem", + "mixDatabaseName": "sys_menu_item", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2131,7 +1090,7 @@ { "systemName": "classes", "displayName": "Classes", - "mixDatabaseName": "sysMenuItem", + "mixDatabaseName": "sys_menu_item", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2158,7 +1117,7 @@ { "systemName": "description", "displayName": "Description", - "mixDatabaseName": "sysMenuItem", + "mixDatabaseName": "sys_menu_item", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2185,7 +1144,7 @@ { "systemName": "alt", "displayName": "Alt", - "mixDatabaseName": "sysMenuItem", + "mixDatabaseName": "sys_menu_item", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2212,7 +1171,7 @@ { "systemName": "hreflang", "displayName": "Hreflang", - "mixDatabaseName": "sysMenuItem", + "mixDatabaseName": "sys_menu_item", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2237,9 +1196,9 @@ "isDeleted": false }, { - "systemName": "sysMenuItemId", - "displayName": "sysMenuItemId", - "mixDatabaseName": "sysMenuItem", + "systemName": "sys_menu_item_id", + "displayName": "Menu Item Id", + "mixDatabaseName": "sys_menu_item", "dataType": "Reference", "configurations": { "IsRequire": false, @@ -2264,9 +1223,9 @@ "isDeleted": false }, { - "systemName": "sysNavigationId", - "displayName": "sysNavigationId", - "mixDatabaseName": "sysMenuItem", + "systemName": "sys_navigation_id", + "displayName": "Navigation Id", + "mixDatabaseName": "sys_menu_item", "dataType": "Reference", "configurations": { "IsRequire": false, @@ -2293,7 +1252,7 @@ { "systemName": "title", "displayName": "Title", - "mixDatabaseName": "sysMedia", + "mixDatabaseName": "sys_media", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2320,7 +1279,7 @@ { "systemName": "type", "displayName": "Type", - "mixDatabaseName": "sysMedia", + "mixDatabaseName": "sys_media", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2347,7 +1306,7 @@ { "systemName": "file", "displayName": "File", - "mixDatabaseName": "sysMedia", + "mixDatabaseName": "sys_media", "dataType": "Upload", "configurations": { "IsRequire": false, @@ -2372,9 +1331,9 @@ "isDeleted": false }, { - "systemName": "DisplayName", + "systemName": "display_name", "displayName": "Display Name", - "mixDatabaseName": "sysPermission", + "mixDatabaseName": "sys_permission", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2399,9 +1358,9 @@ "isDeleted": false }, { - "systemName": "Group", + "systemName": "group", "displayName": "Group", - "mixDatabaseName": "sysPermission", + "mixDatabaseName": "sys_permission", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2426,9 +1385,9 @@ "isDeleted": false }, { - "systemName": "Key", + "systemName": "key", "displayName": "Key", - "mixDatabaseName": "sysPermission", + "mixDatabaseName": "sys_permission", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2455,7 +1414,7 @@ { "systemName": "title", "displayName": "Title", - "mixDatabaseName": "sysPermissionEndpoint", + "mixDatabaseName": "sys_permission_endpoint", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2482,7 +1441,7 @@ { "systemName": "path", "displayName": "Path", - "mixDatabaseName": "sysPermissionEndpoint", + "mixDatabaseName": "sys_permission_endpoint", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2509,7 +1468,7 @@ { "systemName": "method", "displayName": "Method", - "mixDatabaseName": "sysPermissionEndpoint", + "mixDatabaseName": "sys_permission_endpoint", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2536,7 +1495,7 @@ { "systemName": "description", "displayName": "Description", - "mixDatabaseName": "sysPermissionEndpoint", + "mixDatabaseName": "sys_permission_endpoint", "dataType": "MultilineText", "configurations": { "IsRequire": false, @@ -2561,9 +1520,9 @@ "isDeleted": false }, { - "systemName": "SysPermissionId", + "systemName": "sys_permission_id", "displayName": "SysPermissionId", - "mixDatabaseName": "sysPermissionEndpoint", + "mixDatabaseName": "sys_permission_endpoint", "dataType": "Reference", "configurations": { "IsRequire": false, @@ -2590,7 +1549,7 @@ { "systemName": "SysUserDataId", "displayName": "SysUserDataId", - "mixDatabaseName": "sysPermissionEndpoint", + "mixDatabaseName": "sys_permission_endpoint", "dataType": "Reference", "configurations": { "IsUnique": false, @@ -2619,7 +1578,7 @@ { "systemName": "userId", "displayName": "User Id", - "mixDatabaseName": "sysUserPermission", + "mixDatabaseName": "sys_user_permission", "dataType": "Guid", "configurations": { "IsRequire": false, @@ -2644,9 +1603,9 @@ "isDeleted": false }, { - "systemName": "permissionId", + "systemName": "permission_id", "displayName": "Permission Id", - "mixDatabaseName": "sysUserPermission", + "mixDatabaseName": "sys_user_permission", "dataType": "Integer", "configurations": { "IsRequire": false, @@ -2673,7 +1632,7 @@ { "systemName": "description", "displayName": "Description", - "mixDatabaseName": "sysUserPermission", + "mixDatabaseName": "sys_user_permission", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2700,7 +1659,7 @@ { "systemName": "title", "displayName": "Title", - "mixDatabaseName": "MixcoreCmsHelper", + "mixDatabaseName": "mixcore_cms_helper", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2727,7 +1686,7 @@ { "systemName": "description", "displayName": "Description", - "mixDatabaseName": "MixcoreCmsHelper", + "mixDatabaseName": "mixcore_cms_helper", "dataType": "Html", "configurations": { "IsRequire": false, @@ -2752,9 +1711,9 @@ "isDeleted": false }, { - "systemName": "sampleCode", + "systemName": "sample_code", "displayName": "Sample Code", - "mixDatabaseName": "MixcoreCmsHelper", + "mixDatabaseName": "mixcore_cms_helper", "dataType": "Html", "configurations": { "IsRequire": false, @@ -2781,7 +1740,7 @@ { "systemName": "type", "displayName": "Type", - "mixDatabaseName": "Metadata", + "mixDatabaseName": "mix_metadata", "dataType": "Text", "configurations": { "IsRequire": false, @@ -2808,7 +1767,7 @@ { "systemName": "content", "displayName": "Content", - "mixDatabaseName": "Metadata", + "mixDatabaseName": "mix_metadata", "dataType": "Text", "configurations": { "IsUnique": false, @@ -2835,9 +1794,9 @@ "isDeleted": false }, { - "systemName": "seoContent", + "systemName": "seo_content", "displayName": "Seo Content", - "mixDatabaseName": "Metadata", + "mixDatabaseName": "mix_metadata", "dataType": "Text", "configurations": { "IsUnique": false, @@ -2864,38 +1823,67 @@ "isDeleted": false }, { - "systemName": "MetadataId", - "displayName": "MetadataId", - "mixDatabaseName": "Metadata", - "dataType": "Reference", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 10, - "mixDatabase": null, - "id": 49, - "createdDateTime": "2023-05-05T03:11:24.4054243", - "lastModified": null, - "createdBy": "tinku", - "modifiedBy": null, - "priority": 0, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "contentId", + "systemName": "metadata_id", + "displayName": "Metadata Id", + "mixDatabaseName": "mix_metadata", + "dataType": "Integer", + "configurations": { + "IsUnique": false, + "IsRequire": false, + "IsEncrypt": false, + "IsSelect": false, + "Upload": { + "ArrayAccepts": [], + "Accepts": "", + "IsCrop": false + } + }, + "referenceId": null, + "defaultValue": null, + "mixDatabaseId": 10, + "mixDatabase": null, + "id": 49, + "createdDateTime": "2023-05-05T03:11:24.4054243", + "lastModified": null, + "createdBy": "tinku", + "modifiedBy": null, + "priority": 0, + "status": "Published", + "isDeleted": false + }, + { + "systemName": "tenant_id", + "displayName": "Tenant Id", + "mixDatabaseName": "mix_metadata_content_association", + "dataType": "Integer", + "configurations": { + "IsUnique": false, + "IsRequire": false, + "IsEncrypt": false, + "IsSelect": false, + "Upload": { + "ArrayAccepts": [], + "Accepts": "", + "IsCrop": false + } + }, + "referenceId": null, + "defaultValue": null, + "mixDatabaseId": 11, + "mixDatabase": null, + "id": 50, + "createdDateTime": "2023-05-05T03:11:24.4115187", + "lastModified": null, + "createdBy": "tinku", + "modifiedBy": null, + "priority": 1, + "status": "Published", + "isDeleted": false + }, + { + "systemName": "content_id", "displayName": "Content Id", - "mixDatabaseName": "MetadataContentAssociation", + "mixDatabaseName": "mix_metadata_content_association", "dataType": "Integer", "configurations": { "IsUnique": false, @@ -2922,9 +1910,9 @@ "isDeleted": false }, { - "systemName": "contentType", + "systemName": "content_type", "displayName": "Content Type", - "mixDatabaseName": "MetadataContentAssociation", + "mixDatabaseName": "mix_metadata_content_association", "dataType": "Text", "configurations": { "IsUnique": false, @@ -2953,7 +1941,7 @@ { "systemName": "description", "displayName": "Description", - "mixDatabaseName": "MetadataContentAssociation", + "mixDatabaseName": "mix_metadata_content_association", "dataType": "MultilineText", "configurations": { "IsUnique": false, @@ -2980,9 +1968,9 @@ "isDeleted": false }, { - "systemName": "MetadataId", - "displayName": "MetadataId", - "mixDatabaseName": "MetadataContentAssociation", + "systemName": "metadata_id", + "displayName": "Metadata Id", + "mixDatabaseName": "mix_metadata_content_association", "dataType": "Reference", "configurations": { "IsUnique": false, @@ -3009,212 +1997,9 @@ "isDeleted": false }, { - "systemName": "street", - "displayName": "Street", - "mixDatabaseName": "ContactAddress", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 12, - "mixDatabase": null, - "id": 54, - "createdDateTime": "2023-05-05T03:11:24.4389793", - "lastModified": null, - "createdBy": "tinku", - "modifiedBy": null, - "priority": 1, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "district", - "displayName": "District", - "mixDatabaseName": "ContactAddress", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 12, - "mixDatabase": null, - "id": 55, - "createdDateTime": "2023-05-05T03:11:24.4415987", - "lastModified": null, - "createdBy": "tinku", - "modifiedBy": null, - "priority": 2, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "city", - "displayName": "City", - "mixDatabaseName": "ContactAddress", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 12, - "mixDatabase": null, - "id": 56, - "createdDateTime": "2023-05-05T03:11:24.4452855", - "lastModified": null, - "createdBy": "tinku", - "modifiedBy": null, - "priority": 3, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "province", - "displayName": "Province", - "mixDatabaseName": "ContactAddress", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 12, - "mixDatabase": null, - "id": 57, - "createdDateTime": "2023-05-05T03:11:24.4507218", - "lastModified": null, - "createdBy": "tinku", - "modifiedBy": null, - "priority": 4, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "ward", - "displayName": "Ward", - "mixDatabaseName": "ContactAddress", - "dataType": "Text", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 12, - "mixDatabase": null, - "id": 58, - "createdDateTime": "2023-05-05T03:11:24.4549568", - "lastModified": null, - "createdBy": "tinku", - "modifiedBy": null, - "priority": 5, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "isDefault", - "displayName": "Is Default", - "mixDatabaseName": "ContactAddress", - "dataType": "Boolean", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 12, - "mixDatabase": null, - "id": 59, - "createdDateTime": "2023-05-05T03:11:24.4587436", - "lastModified": null, - "createdBy": "tinku", - "modifiedBy": null, - "priority": 6, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "SysUserDataId", - "displayName": "SysUserDataId", - "mixDatabaseName": "ContactAddress", - "dataType": "Reference", - "configurations": { - "IsUnique": false, - "IsRequire": false, - "IsEncrypt": false, - "IsSelect": false, - "Upload": { - "ArrayAccepts": [], - "Accepts": "", - "IsCrop": false - } - }, - "referenceId": null, - "defaultValue": null, - "mixDatabaseId": 12, - "mixDatabase": null, - "id": 60, - "createdDateTime": "2023-05-05T03:11:24.4614705", - "lastModified": null, - "createdBy": "tinku", - "modifiedBy": null, - "priority": 0, - "status": "Published", - "isDeleted": false - }, - { - "systemName": "mixDbName", - "displayName": "MixDbName", - "mixDatabaseName": "MixDbEventSubscriber", + "systemName": "mixdb_name", + "displayName": "Mixdb Name", + "mixDatabaseName": "mixdb_event_subscriber", "dataType": "Text", "configurations": { "isUnique": false, @@ -3249,7 +2034,7 @@ { "systemName": "callback", "displayName": "Callback", - "mixDatabaseName": "MixDbEventSubscriber", + "mixDatabaseName": "mixdb_event_subscriber", "dataType": "Json", "configurations": { "isUnique": false, @@ -3284,7 +2069,7 @@ { "systemName": "action", "displayName": "Action", - "mixDatabaseName": "MixDbEventSubscriber", + "mixDatabaseName": "mixdb_event_subscriber", "dataType": "Text", "configurations": { "isUnique": false, diff --git a/src/applications/mixcore/wwwroot/mix-app/assets/img/svg/mixcore-logo.svg b/src/applications/mixcore/wwwroot/mix-app/assets/img/svg/mixcore-logo.svg new file mode 100644 index 000000000..ac1111ac8 --- /dev/null +++ b/src/applications/mixcore/wwwroot/mix-app/assets/img/svg/mixcore-logo.svg @@ -0,0 +1,4 @@ + + PIZZA 4P'S + + diff --git a/src/applications/mixcore/wwwroot/mix-app/css/portal/micon/README.md b/src/applications/mixcore/wwwroot/mix-app/css/portal/micon/README.md index 2a4e605c4..10bd99c39 100644 --- a/src/applications/mixcore/wwwroot/mix-app/css/portal/micon/README.md +++ b/src/applications/mixcore/wwwroot/mix-app/css/portal/micon/README.md @@ -2,5 +2,5 @@ this font include mdl2 icons and webbrand icons -- 1095 orginal icons (path) -- 1415 (orginal name + alias name) => in css +- 1095 Original icons (path) +- 1415 (Original name + alias name) => in css diff --git a/src/applications/mixcore/wwwroot/mix-app/js/app-init.min.js b/src/applications/mixcore/wwwroot/mix-app/js/app-init.min.js index 00dc56014..cf271e549 100644 --- a/src/applications/mixcore/wwwroot/mix-app/js/app-init.min.js +++ b/src/applications/mixcore/wwwroot/mix-app/js/app-init.min.js @@ -57,6 +57,12 @@ app.controller("Step1Controller", [ var rand = Math.floor(Math.random() * 10000) + 1; $scope.settings = { providers: [ + { + text: "PostgreSQL Database", + value: "PostgreSQL", + port: "5432", + img: "/mix-app/assets/img/postgresql.jpg", + }, { text: "MySQL Database", value: "MySQL", @@ -69,18 +75,6 @@ app.controller("Step1Controller", [ port: null, img: "/mix-app/assets/img/mssql.jpg", }, - { - text: "PostgreSQL Database", - value: "PostgreSQL", - port: "5432", - img: "/mix-app/assets/img/postgresql.jpg", - }, - { - text: "SQLite Database", - value: "SQLITE", - port: null, - img: "/mix-app/assets/img/sqlite.jpg", - }, ], cultures: [], }; @@ -127,7 +121,8 @@ app.controller("Step1Controller", [ "Server=(localdb)\\MSSQLLocalDB;Initial Catalog=" + rand + "-mix-cms.sqlite;Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Encrypt=False;TrustServerCertificate=True", - sqliteDbConnectionString: "Data Source=MixContent\\mix-cms.sqlite", + sqliteDbConnectionString: + "Data Source=wwwroot\\mixcontent\\mix-cms.sqlite", localDbName: rand + "-mix-cms", databaseServer: "", databasePort: "", @@ -200,6 +195,127 @@ app.factory("Step1Services", [ }, ]); +"use strict"; +app.controller("Step3Controller", [ + "$scope", + "$rootScope", + "ApiService", + "StoreService", + "Step3Services", + function ($scope, $rootScope, apiService, storeService, service) { + var rand = Math.random(); + $scope.data = { + isCreateDefault: true, + theme: null, + }; + $scope.request = { + pageSize: "20", + pageIndex: 0, + status: "Published", + sortBy: "id", + direction: "Desc", + fromDate: null, + toDate: null, + postType: "theme", + }; + $scope.themeType = "materialkit"; + $scope.init = async function () { + await apiService.getGlobalSettings(); + $scope.form = document.getElementById("frm-theme"); + $scope.request.mixDatabaseName = "mixcoreTheme"; + var getThemes = await storeService.getThemes($scope.request); + if (getThemes.success) { + $scope.themes = getThemes.data; + $scope.$apply(); + } + $(".preventUncheck").on("change", function (e) { + if ($(".preventUncheck:checked").length == 0 && !this.checked) + this.checked = true; + }); + $(".option").click(function () { + $(".option").removeClass("active"); + $(this).addClass("active"); + }); + }; + $scope.submit = async function () { + let theme = $scope.form["theme"].files[0]; + if ($scope.mode === "Upload your theme" && !theme) { + $rootScope.showErrors(["Please select theme file"]); + return; + } + $rootScope.isBusy = true; + var frm = new FormData(); + var url = "/rest/mix-tenancy/setup/extract-theme"; + $scope.data.isCreateDefault = $scope.themeType === "materialkit"; + $rootScope.isBusy = true; + // Looping over all files and add it to FormData object + frm.append("theme", theme); + // Adding one more key to FormData object + frm.append("model", angular.toJson($scope.data)); + var response = await service.ajaxSubmitForm(frm, url); + $rootScope.isBusy = false; + if (response.success) { + $rootScope.goToPath("/init/step4"); + $scope.$apply(); + } else { + $rootScope.showErrors(response.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } + }; + $scope.install = function (resp) { + if (resp.success) { + $rootScope.goToPath("/init/step4"); + } else { + $rootScope.showErrors(["Cannot install theme"]); + } + }; + $scope.selectPane = function (pane) { + $scope.canContinue = pane.header !== "Mixcore Store"; + $scope.mode = pane.header; + }; + }, +]); + +"use strict"; +app.factory("Step3Services", [ + "ApiService", + function (apiService) { + var service = {}; + var _submit = async function (data) { + var req = { + method: "POST", + url: "/init/init-cms/step-3", + data: JSON.stringify(data), + }; + return await apiService.sendRequest(req); + }; + var _activeTheme = async function (data) { + var req = { + method: "POST", + url: "/init/init-cms/step-3/active", + data: JSON.stringify(data), + }; + return await apiService.sendRequest(req); + }; + var _ajaxSubmitForm = async function (form, url) { + var req = { + method: "POST", + url: url, + headers: { "Content-Type": undefined }, + contentType: false, // Not to set any content header + processData: false, // Not to process data + data: form, + }; + return await apiService.sendRequest(req); + }; + service.submit = _submit; + service.activeTheme = _activeTheme; + service.ajaxSubmitForm = _ajaxSubmitForm; + return service; + }, +]); + "use strict"; app.controller("Step2Controller", [ "$scope", @@ -322,122 +438,63 @@ app.factory("Step2Services", [ ]); "use strict"; -app.controller("Step3Controller", [ +app.controller("Step5Controller", [ "$scope", "$rootScope", + "$location", "ApiService", - "StoreService", - "Step3Services", - function ($scope, $rootScope, apiService, storeService, service) { + "CommonService", + "Step5Services", + function ($scope, $rootScope, $location, apiService, commonService, service) { var rand = Math.random(); - $scope.data = { - isCreateDefault: true, - theme: null, - }; - $scope.request = { - pageSize: "20", - pageIndex: 0, - status: "Published", - orderBy: "CreatedDateTime", - direction: "Desc", - fromDate: null, - toDate: null, - postType: "theme", - }; - $scope.themeType = "materialkit"; + $scope.data = []; $scope.init = async function () { - await apiService.getGlobalSettings(); - $scope.form = document.getElementById("frm-theme"); - $scope.request.mixDatabaseName = "mixcoreTheme"; - var getThemes = await storeService.getThemes($scope.request); - if (getThemes.success) { - $scope.themes = getThemes.data; - $scope.$apply(); - } - $(".preventUncheck").on("change", function (e) { - if ($(".preventUncheck:checked").length == 0 && !this.checked) - this.checked = true; - }); - $(".option").click(function () { - $(".option").removeClass("active"); - $(this).addClass("active"); - }); - }; - $scope.submit = async function () { - let theme = $scope.form["theme"].files[0]; - if ($scope.mode === "Upload your theme" && !theme) { - $rootScope.showErrors(["Please select theme file"]); - return; - } - $rootScope.isBusy = true; - var frm = new FormData(); - var url = "/rest/mix-tenancy/setup/extract-theme"; - $scope.data.isCreateDefault = $scope.themeType === "materialkit"; - $rootScope.isBusy = true; - // Looping over all files and add it to FormData object - frm.append("theme", theme); - // Adding one more key to FormData object - frm.append("model", angular.toJson($scope.data)); - var response = await service.ajaxSubmitForm(frm, url); - $rootScope.isBusy = false; - if (response.success) { - $rootScope.goToPath("/init/step4"); + var getData = await commonService.loadJsonData("configurations"); + if (getData.success) { + $scope.data = getData.data.items; + $rootScope.isBusy = false; $scope.$apply(); } else { - $rootScope.showErrors(response.errors); + if (getData) { + $rootScope.showErrors(getData.errors); + } $rootScope.isBusy = false; $scope.$apply(); } }; - $scope.install = function (resp) { - if (resp.success) { - $rootScope.goToPath("/init/step4"); + $scope.submit = async function () { + $rootScope.isBusy = true; + var result = await service.submit($scope.data); + if (result.success) { + $rootScope.isBusy = false; + window.top.location = "/"; } else { - $rootScope.showErrors(["Cannot install theme"]); + if (result) { + $rootScope.showErrors(result.errors); + } + $rootScope.isBusy = false; } }; - $scope.selectPane = function (pane) { - $scope.canContinue = pane.header !== "Mixcore Store"; - $scope.mode = pane.header; - }; }, ]); "use strict"; -app.factory("Step3Services", [ +app.factory("Step5Services", [ "ApiService", - function (apiService) { + "CommonService", + function (apiService, commonService) { + //var serviceBase = 'http://ngauthenticationapi.azurewebsites.net/'; + var service = {}; var _submit = async function (data) { var req = { method: "POST", - url: "/init/init-cms/step-3", - data: JSON.stringify(data), - }; - return await apiService.sendRequest(req); - }; - var _activeTheme = async function (data) { - var req = { - method: "POST", - url: "/init/init-cms/step-3/active", + url: "/init/init-cms/step-5", data: JSON.stringify(data), }; return await apiService.sendRequest(req); }; - var _ajaxSubmitForm = async function (form, url) { - var req = { - method: "POST", - url: url, - headers: { "Content-Type": undefined }, - contentType: false, // Not to set any content header - processData: false, // Not to process data - data: form, - }; - return await apiService.sendRequest(req); - }; service.submit = _submit; - service.activeTheme = _activeTheme; - service.ajaxSubmitForm = _ajaxSubmitForm; return service; }, ]); @@ -506,68 +563,6 @@ app.factory("Step4Services", [ }, ]); -"use strict"; -app.controller("Step5Controller", [ - "$scope", - "$rootScope", - "$location", - "ApiService", - "CommonService", - "Step5Services", - function ($scope, $rootScope, $location, apiService, commonService, service) { - var rand = Math.random(); - $scope.data = []; - $scope.init = async function () { - var getData = await commonService.loadJsonData("configurations"); - if (getData.success) { - $scope.data = getData.data.items; - $rootScope.isBusy = false; - $scope.$apply(); - } else { - if (getData) { - $rootScope.showErrors(getData.errors); - } - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - $scope.submit = async function () { - $rootScope.isBusy = true; - var result = await service.submit($scope.data); - if (result.success) { - $rootScope.isBusy = false; - window.top.location = "/"; - } else { - if (result) { - $rootScope.showErrors(result.errors); - } - $rootScope.isBusy = false; - } - }; - }, -]); - -"use strict"; -app.factory("Step5Services", [ - "ApiService", - "CommonService", - function (apiService, commonService) { - //var serviceBase = 'http://ngauthenticationapi.azurewebsites.net/'; - - var service = {}; - var _submit = async function (data) { - var req = { - method: "POST", - url: "/init/init-cms/step-5", - data: JSON.stringify(data), - }; - return await apiService.sendRequest(req); - }; - service.submit = _submit; - return service; - }, -]); - modules.component("mssqlInfo", { templateUrl: "/mix-app/views/app-init/pages/step1/components/mssql-info/view.html", @@ -606,35 +601,234 @@ modules.component("mysqlInfo", { }, ], bindings: { - initCmsModel: "=", + initCmsModel: "=", + }, +}); + +modules.component("posgresqlInfo", { + templateUrl: + "/mix-app/views/app-init/pages/step1/components/posgresql-info/view.html", + controller: [ + "$rootScope", + function ($rootScope) { + var ctrl = this; + }, + ], + bindings: { + initCmsModel: "=", + }, +}); + +modules.component("sqliteInfo", { + templateUrl: + "/mix-app/views/app-init/pages/step1/components/sqlite-info/view.html", + controller: [ + "$rootScope", + function ($rootScope) { + var ctrl = this; + }, + ], + bindings: { + initCmsModel: "=", + }, +}); + +app.component("initFbConfigurations", { + templateUrl: + "/mix-app/views/app-init/pages/step3/components/fb-configurations/view.html", + controller: [ + "$rootScope", + function ($rootScope) { + var ctrl = this; + ctrl.data = []; + ctrl.$onInit = function () { + ctrl.data = $rootScope.filterArray( + ctrl.configurations, + ["category"], + ["Social_Facebook"] + ); + }; + }, + ], + bindings: { + configurations: "=", + }, +}); + +app.component("initGgConfigurations", { + templateUrl: + "/mix-app/views/app-init/pages/step3/components/gg-configurations/view.html", + controller: [ + "$rootScope", + function ($rootScope) { + var ctrl = this; + ctrl.data = []; + ctrl.$onInit = function () { + ctrl.data = $rootScope.filterArray( + ctrl.configurations, + ["category"], + ["Social_Google"] + ); + }; + }, + ], + bindings: { + configurations: "=", + }, +}); + +modules.component("initValueEditor", { + templateUrl: + "/mix-app/views/app-init/pages/step3/components/init-value-editor/view.html", + controller: [ + "$rootScope", + "$scope", + "ngAppSettings", + "FileService", + function ($rootScope, $scope, ngAppSettings, fileService) { + var ctrl = this; + ctrl.icons = ngAppSettings.icons; + ctrl.mediaFile = { + file: null, + fullPath: "", + fileFolder: "content/site", + title: "", + description: "", + }; + this.dataTypes = ngAppSettings.dataTypes; + ctrl.initEditor = function () { + ctrl.data.value = ctrl.data.default || null; + setTimeout(function () { + // Init Code editor + $.each($(".code-editor"), function (i, e) { + var container = $(this); + var editor = ace.edit(e); + if (container.hasClass("json")) { + editor.session.setMode("ace/mode/json"); + } else { + editor.session.setMode("ace/mode/razor"); + } + editor.setTheme("ace/theme/chrome"); + //editor.setReadOnly(true); + + editor.session.setUseWrapMode(true); + editor.setOptions({ + maxLines: Infinity, + }); + editor.getSession().on("change", function (e) { + // e.type, etc + $(container) + .parent() + .find(".code-content") + .val(editor.getValue()); + }); + }); + $.each($(".editor-content"), function (i, e) { + var $demoTextarea = $(e); + $demoTextarea + .trumbowyg({ + semantic: false, + }) + .on("tbwblur", function () { + ctrl.data.value = $demoTextarea.val(); + }); + }); + }, 200); + }; + ctrl.selectFile = function (file, errFiles) { + if (file !== undefined && file !== null) { + ctrl.mediaFile.folder = ctrl.folder ? ctrl.folder : "Media"; + ctrl.mediaFile.title = ctrl.title ? ctrl.title : ""; + ctrl.mediaFile.description = ctrl.description ? ctrl.description : ""; + ctrl.mediaFile.file = file; + + ctrl.uploadFile(file); + } + }; + ctrl.uploadFile = async function (file) { + if (file !== null) { + $rootScope.isBusy = true; + var reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = async function () { + ctrl.mediaFile.fileName = file.name.substring( + 0, + file.name.lastIndexOf(".") + ); + ctrl.mediaFile.extension = file.name.substring( + file.name.lastIndexOf(".") + ); + ctrl.mediaFile.fileBase64 = reader.result; + var resp = await fileService.save(ctrl.mediaFile); + if (resp && resp.success) { + ctrl.data.value = resp.data.webPath; + ctrl.srcUrl = resp.data.webPath; + $rootScope.isBusy = false; + $scope.$apply(); + } else { + if (resp) { + $rootScope.showErrors(resp.errors); + } + $rootScope.isBusy = false; + $scope.$apply(); + } + }; + reader.onerror = function (error) {}; + } else { + return null; + } + }; + }, + ], + bindings: { + data: "=", + inputClass: "=", + isShowTitle: "=", + title: "=", }, }); -modules.component("posgresqlInfo", { +app.component("initSiteConfigurations", { templateUrl: - "/mix-app/views/app-init/pages/step1/components/posgresql-info/view.html", + "/mix-app/views/app-init/pages/step3/components/site-configurations/view.html", controller: [ "$rootScope", function ($rootScope) { var ctrl = this; + ctrl.data = []; + ctrl.$onInit = function () { + ctrl.data = $rootScope.filterArray( + ctrl.configurations, + ["category"], + ["Site_Common"] + ); + }; }, ], bindings: { - initCmsModel: "=", + configurations: "=", }, }); -modules.component("sqliteInfo", { +app.component("initSysConfigurations", { templateUrl: - "/mix-app/views/app-init/pages/step1/components/sqlite-info/view.html", + "/mix-app/views/app-init/pages/step3/components/site-configurations/view.html", controller: [ "$rootScope", function ($rootScope) { var ctrl = this; + ctrl.data = []; + ctrl.$onInit = function () { + ctrl.data = $rootScope.filterArray( + ctrl.configurations, + ["category"], + ["System"] + ); + }; }, ], bindings: { - initCmsModel: "=", + configurations: "=", }, }); @@ -1017,202 +1211,3 @@ app.component("themeImportPosts", { importThemeDto: "=", }, }); - -app.component("initFbConfigurations", { - templateUrl: - "/mix-app/views/app-init/pages/step3/components/fb-configurations/view.html", - controller: [ - "$rootScope", - function ($rootScope) { - var ctrl = this; - ctrl.data = []; - ctrl.$onInit = function () { - ctrl.data = $rootScope.filterArray( - ctrl.configurations, - ["category"], - ["Social_Facebook"] - ); - }; - }, - ], - bindings: { - configurations: "=", - }, -}); - -app.component("initGgConfigurations", { - templateUrl: - "/mix-app/views/app-init/pages/step3/components/gg-configurations/view.html", - controller: [ - "$rootScope", - function ($rootScope) { - var ctrl = this; - ctrl.data = []; - ctrl.$onInit = function () { - ctrl.data = $rootScope.filterArray( - ctrl.configurations, - ["category"], - ["Social_Google"] - ); - }; - }, - ], - bindings: { - configurations: "=", - }, -}); - -modules.component("initValueEditor", { - templateUrl: - "/mix-app/views/app-init/pages/step3/components/init-value-editor/view.html", - controller: [ - "$rootScope", - "$scope", - "ngAppSettings", - "FileService", - function ($rootScope, $scope, ngAppSettings, fileService) { - var ctrl = this; - ctrl.icons = ngAppSettings.icons; - ctrl.mediaFile = { - file: null, - fullPath: "", - fileFolder: "content/site", - title: "", - description: "", - }; - this.dataTypes = ngAppSettings.dataTypes; - ctrl.initEditor = function () { - ctrl.data.value = ctrl.data.default || null; - setTimeout(function () { - // Init Code editor - $.each($(".code-editor"), function (i, e) { - var container = $(this); - var editor = ace.edit(e); - if (container.hasClass("json")) { - editor.session.setMode("ace/mode/json"); - } else { - editor.session.setMode("ace/mode/razor"); - } - editor.setTheme("ace/theme/chrome"); - //editor.setReadOnly(true); - - editor.session.setUseWrapMode(true); - editor.setOptions({ - maxLines: Infinity, - }); - editor.getSession().on("change", function (e) { - // e.type, etc - $(container) - .parent() - .find(".code-content") - .val(editor.getValue()); - }); - }); - $.each($(".editor-content"), function (i, e) { - var $demoTextarea = $(e); - $demoTextarea - .trumbowyg({ - semantic: false, - }) - .on("tbwblur", function () { - ctrl.data.value = $demoTextarea.val(); - }); - }); - }, 200); - }; - ctrl.selectFile = function (file, errFiles) { - if (file !== undefined && file !== null) { - ctrl.mediaFile.folder = ctrl.folder ? ctrl.folder : "Media"; - ctrl.mediaFile.title = ctrl.title ? ctrl.title : ""; - ctrl.mediaFile.description = ctrl.description ? ctrl.description : ""; - ctrl.mediaFile.file = file; - - ctrl.uploadFile(file); - } - }; - ctrl.uploadFile = async function (file) { - if (file !== null) { - $rootScope.isBusy = true; - var reader = new FileReader(); - reader.readAsDataURL(file); - reader.onload = async function () { - ctrl.mediaFile.fileName = file.name.substring( - 0, - file.name.lastIndexOf(".") - ); - ctrl.mediaFile.extension = file.name.substring( - file.name.lastIndexOf(".") - ); - ctrl.mediaFile.fileStream = reader.result; - var resp = await fileService.save(ctrl.mediaFile); - if (resp && resp.success) { - ctrl.data.value = resp.data.webPath; - ctrl.srcUrl = resp.data.webPath; - $rootScope.isBusy = false; - $scope.$apply(); - } else { - if (resp) { - $rootScope.showErrors(resp.errors); - } - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - reader.onerror = function (error) {}; - } else { - return null; - } - }; - }, - ], - bindings: { - data: "=", - inputClass: "=", - isShowTitle: "=", - title: "=", - }, -}); - -app.component("initSiteConfigurations", { - templateUrl: - "/mix-app/views/app-init/pages/step3/components/site-configurations/view.html", - controller: [ - "$rootScope", - function ($rootScope) { - var ctrl = this; - ctrl.data = []; - ctrl.$onInit = function () { - ctrl.data = $rootScope.filterArray( - ctrl.configurations, - ["category"], - ["Site_Common"] - ); - }; - }, - ], - bindings: { - configurations: "=", - }, -}); - -app.component("initSysConfigurations", { - templateUrl: - "/mix-app/views/app-init/pages/step3/components/site-configurations/view.html", - controller: [ - "$rootScope", - function ($rootScope) { - var ctrl = this; - ctrl.data = []; - ctrl.$onInit = function () { - ctrl.data = $rootScope.filterArray( - ctrl.configurations, - ["category"], - ["System"] - ); - }; - }, - ], - bindings: { - configurations: "=", - }, -}); diff --git a/src/applications/mixcore/wwwroot/mix-app/js/app-portal.min.js b/src/applications/mixcore/wwwroot/mix-app/js/app-portal.min.js index 0db7a10eb..bc0126587 100644 --- a/src/applications/mixcore/wwwroot/mix-app/js/app-portal.min.js +++ b/src/applications/mixcore/wwwroot/mix-app/js/app-portal.min.js @@ -1,4 +1,4 @@ -/* Fri Aug 23 2024 17:02:35 GMT+0700 (Indochina Time) */"use strict"; +/* Thu Feb 13 2025 10:29:46 GMT+0700 (Indochina Time) */"use strict"; var app = angular.module("MixPortal", [ "angularCroppie", "ui.bootstrap", @@ -212,7 +212,7 @@ app.controller("AppSettingsController", [ "Storage", "Queue", "Payments", - "GoogleFirebase", + "Google", "GoogleCredential", ]; $scope.type = "Global"; @@ -375,7 +375,7 @@ app.controller("MixApplicationController", [ $scope.viewMode = "list"; $scope.current = null; $scope.themeRequest = angular.copy(ngAppSettings.request); - $scope.themeRequest.orderBy = "createdDatetime"; + $scope.themeRequest.sortBy = "id"; $scope.themeRequest.mixDatabaseName = "mixApplicationPackage"; $scope.themeRequest.queries = [ { fieldName: "mixcoreVersion", value: "2.0.1" }, @@ -389,7 +389,7 @@ app.controller("MixApplicationController", [ "createdBy", ]; $scope.canDrag = - $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; $scope.generateBaseHref = (forceRename) => { if ( @@ -597,7 +597,7 @@ app.controller("AuditLogController", [ $scope.request.status = null; $scope.messages = []; $scope.canDrag = - $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; $scope.connect = () => { $scope.startConnection( @@ -701,207 +701,6 @@ app.factory("AuditLogRestService", [ }, ]); -"use strict"; -app.controller("CustomerController", [ - "$scope", - "$rootScope", - "ngAppSettings", - "$routeParams", - "$timeout", - "$location", - "CustomerServices", - function ( - $scope, - $rootScope, - ngAppSettings, - $routeParams, - $timeout, - $location, - customerServices - ) { - $scope.request = angular.copy(ngAppSettings.request); - $scope.request.contentStatuses = ["Active"]; - $scope.request.status = "0"; - $scope.activedCustomer = null; - $scope.relatedCustomers = []; - $rootScope.isBusy = false; - $scope.data = { - pageIndex: 0, - pageSize: 1, - totalItems: 0, - }; - $scope.errors = []; - - $scope.range = function (max) { - var input = []; - for (var i = 1; i <= max; i += 1) input.push(i); - return input; - }; - - $scope.loadCustomer = async function () { - $rootScope.isBusy = true; - var id = $routeParams.id; - var response = await customerServices.getCustomer(id, "portal"); - if (response.success) { - $scope.activedCustomer = response.data; - $rootScope.initEditor(); - $rootScope.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showErrors(response.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - $scope.loadCustomers = async function (pageIndex) { - if (pageIndex !== undefined) { - $scope.request.pageIndex = pageIndex; - } - if ($scope.request.fromDate !== null) { - var d = new Date($scope.request.fromDate); - $scope.request.fromDate = d.toISOString(); - } - if ($scope.request.toDate !== null) { - var d = new Date($scope.request.toDate); - $scope.request.toDate = d.toISOString(); - } - var resp = await customerServices.getCustomers($scope.request); - if (resp && resp.success) { - $scope.data = resp.data; - //$("html, body").animate({ "scrollTop": "0px" }, 500); - $.each($scope.data.items, function (i, customer) { - $.each($scope.activedCustomers, function (i, e) { - if (e.customerId === customer.id) { - customer.isHidden = true; - } - }); - }); - $rootScope.isBusy = false; - $scope.$apply(); - } else { - if (resp) { - $rootScope.showErrors(resp.errors); - } - $scope.$apply(); - } - }; - - $scope.removeCustomer = function (id) { - $rootScope.showConfirm( - $scope, - "removeCustomerConfirmed", - [id], - null, - "Remove Customer", - "Deleted data will not able to recover, are you sure you want to delete this item?" - ); - }; - - $scope.removeCustomerConfirmed = async function (id) { - var result = await customerServices.removeCustomer(id); - if (result.success) { - $rootScope.showMessage("success", "success"); - $scope.loadCustomers(); - } else { - $rootScope.showMessage("failed"); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - - $scope.saveCustomer = async function (customer) { - customer.content = $(".editor-content").val(); - var resp = await customerServices.saveCustomer(customer); - if (resp && resp.success) { - $scope.activedCustomer = resp.data; - $rootScope.showMessage("Update successfully!", "success"); - $rootScope.isBusy = false; - $scope.$apply(); - //$location.path('/admin/customer/details/' + resp.data.id); - } else { - if (resp) { - $rootScope.showErrors(resp.errors); - } - $scope.$apply(); - } - }; - }, -]); - -"use strict"; -app.factory("CustomerServices", [ - "$http", - "$rootScope", - "ApiService", - "CommonService", - function ($http, $rootScope, apiService, commonService) { - //var serviceBase = 'http://ngauthenticationapi.azurewebsites.net/'; - - var customersServiceFactory = {}; - - var settings = $rootScope.globalSettings; - - var _getCustomer = async function (id, type) { - var apiUrl = "/queen-beauty/customer/"; - var url = apiUrl + "details/" + type; - if (id) { - url += "/" + id; - } - var req = { - method: "GET", - url: url, - }; - return await apiService.sendRequest(req); - }; - - var _initCustomer = async function (type) { - var apiUrl = "/queen-beauty/customer/"; - var req = { - method: "GET", - url: apiUrl + "init/" + type, - }; - return await apiService.sendRequest(req); - }; - - var _getCustomers = async function (request) { - var apiUrl = "/queen-beauty/customer/"; - var req = { - method: "POST", - url: apiUrl + "list", - data: JSON.stringify(request), - }; - - return await apiService.sendRequest(req); - }; - - var _removeCustomer = async function (id) { - var apiUrl = "/queen-beauty/customer/"; - var req = { - method: "GET", - url: apiUrl + "delete/" + id, - }; - return await apiService.sendRequest(req); - }; - - var _saveCustomer = async function (customer) { - var apiUrl = "/queen-beauty/customer/"; - var req = { - method: "POST", - url: apiUrl + "save", - data: JSON.stringify(customer), - }; - return await apiService.sendRequest(req); - }; - - customersServiceFactory.getCustomer = _getCustomer; - customersServiceFactory.initCustomer = _initCustomer; - customersServiceFactory.getCustomers = _getCustomers; - customersServiceFactory.removeCustomer = _removeCustomer; - customersServiceFactory.saveCustomer = _saveCustomer; - return customersServiceFactory; - }, -]); - "use strict"; app.controller("CultureController", [ "$scope", @@ -986,53 +785,164 @@ app.factory("CultureService", [ ]); "use strict"; -app.controller("DashboardController", [ +app.controller("ConfigurationController", [ "$scope", "$rootScope", "ngAppSettings", - "$timeout", + "$routeParams", "$location", - "DashboardServices", - "AuthService", + "ConfigurationService", + "ApiService", function ( $scope, $rootScope, ngAppSettings, - $timeout, + $routeParams, $location, - dashboardServices, - authService + service, + apiService ) { - var endpoints = JSON.parse(localStorage.getItem("ls.endpoints") || "{}"); - BaseHub.call(this, $scope, endpoints.POS); - $scope.pageClass = "page-dashboard"; - $(".side-nav li").removeClass("active"); - $(".side-nav .page-dashboard").addClass("active"); - $scope.data = { - totalPage: 0, - totalPost: 0, - totalProduct: 0, - totalUser: 0, + BaseRestCtrl.call( + this, + $scope, + $rootScope, + $location, + $routeParams, + ngAppSettings, + service + ); + $scope.init = function () { + $scope.request.category = $routeParams.category || ""; + $scope.request.culture = $rootScope.globalSettings.defaultCulture; + $scope.getList(); }; - $scope.users = []; - $scope.$on("$viewContentLoaded", function () { - $rootScope.isBusy = false; - }); - $scope.init = async function () { - await $scope.startConnection( - "pos", - authService.authentication.accessToken, - (err) => { - if ( - authService.authentication.refreshToken && - err.message.indexOf("401") >= 0 - ) { - authService.refreshToken().then(async () => { - $scope.startConnection( - "pos", - authService.authentication.accessToken - ); - }); + $scope.getSingleSuccessCallback = function () { + $scope.cates = ngAppSettings.enums?.configuration_cates; + $scope.appSettings = $rootScope.globalSettings; + $scope.request.category = $routeParams.category || ""; + if (!$scope.viewmodel.id) { + $scope.viewmodel.dataType = "Text"; + $scope.viewmodel.specificulture = + $rootScope.globalSettings.defaultCulture; + } + if (!$scope.viewmodel.category) { + $scope.viewmodel.category = "Site"; + } + }; + $scope.saveSuccessCallback = function () { + apiService.getAllSettings().then(function () { + // $location.url($scope.referrerUrl); + $rootScope.isBusy = false; + $scope.$apply(); + }); + }; + $scope.removeCallback = function () { + apiService.getAllSettings().then(function () { + $location.url($scope.referrerUrl); + }); + }; + + $scope.generateName = function () { + $scope.viewmodel.keyword = $rootScope.generateKeyword( + $scope.viewmodel.keyword, + "_", + true + ); + }; + }, +]); + +"use strict"; +app.factory("ConfigurationService", [ + "BaseRestService", + "ApiService", + "CommonService", + function (baseService, apiService, commonService) { + var serviceFactory = Object.create(baseService); + serviceFactory.init("configuration"); + + var _uploadConfiguration = async function (configurationFile) { + //var container = $(this).parents('.model-configuration').first().find('.custom-file').first(); + if ( + configurationFile.file !== undefined && + configurationFile.file !== null + ) { + // Create FormData object + var files = new FormData(); + + // Looping over all files and add it to FormData object + files.append(configurationFile.file.name, configurationFile.file); + + // Adding one more key to FormData object + files.append("fileFolder", configurationFile.folder); + files.append("title", configurationFile.title); + files.append("description", configurationFile.description); + + var req = { + url: this.prefixUrl + "/upload", + type: "POST", + headers: {}, + contentType: false, // Not to set any content header + processData: false, // Not to process data + data: files, + }; + + return await apiService.sendRequest(req); + } + }; + serviceFactory.uploadConfiguration = _uploadConfiguration; + return serviceFactory; + }, +]); + +"use strict"; +app.controller("DashboardController", [ + "$scope", + "$rootScope", + "ngAppSettings", + "$timeout", + "$location", + "DashboardServices", + "AuthService", + function ( + $scope, + $rootScope, + ngAppSettings, + $timeout, + $location, + dashboardServices, + authService + ) { + var endpoints = JSON.parse(localStorage.getItem("ls.endpoints") || "{}"); + BaseHub.call(this, $scope, endpoints.OneApp); + $scope.pageClass = "page-dashboard"; + $(".side-nav li").removeClass("active"); + $(".side-nav .page-dashboard").addClass("active"); + $scope.data = { + totalPage: 0, + totalPost: 0, + totalProduct: 0, + totalUser: 0, + }; + $scope.users = []; + $scope.$on("$viewContentLoaded", function () { + $rootScope.isBusy = false; + }); + $scope.init = async function () { + await $scope.startConnection( + "one", + authService.authentication.accessToken, + (err) => { + if ( + authService.authentication.refreshToken && + err.message.indexOf("401") >= 0 + ) { + authService.refreshToken().then(async () => { + $scope.startConnection( + "one", + authService.authentication.accessToken + ); + }); } } ); @@ -1044,7 +954,7 @@ app.controller("DashboardController", [ $rootScope.showMessage(msg.title, $scope.getMessageType(msg.type)); }; $scope.onConnected = () => { - $scope.joinStore(1); + $scope.joinStore(196); }; $scope.invokeHubMethod = () => { let obj = JSON.parse($scope.hubData); @@ -1060,7 +970,7 @@ app.controller("DashboardController", [ ) { authService.refreshToken().then(async () => { $scope.startConnection( - "pos", + "one", authService.authentication.accessToken ); }); @@ -1070,7 +980,95 @@ app.controller("DashboardController", [ }; $scope.joinStore = function (storeId) { $scope.connection - .invoke("JoinStore", storeId) + .invoke("JoinRoom", `one-ticket-${storeId}`) + .then((result) => { + console.log(result); + $scope.storeId = storeId; + }) + .catch((resp) => { + if ( + authService.authentication.refreshToken && + resp.message.indexOf("unauthorized") >= 0 + ) { + authService.refreshToken().then(async () => { + $scope.startConnection( + "one", + authService.authentication.accessToken + ); + }); + } + console.log(resp); + }); + }; + $scope.leaveRoom = function (storeId) { + $scope.connection + .invoke("LeaveRoom", `one-ticket-${storeId}`) + .then((result) => { + console.log(result); + $scope.storeId = storeId; + }) + .catch((resp) => { + if ( + authService.authentication.refreshToken && + resp.message.indexOf("unauthorized") >= 0 + ) { + authService.refreshToken().then(async () => { + $scope.startConnection( + "one", + authService.authentication.accessToken + ); + }); + } + console.log(resp); + }); + }; + $scope.sendMessage = function (content) { + $scope.connection + .invoke("SendMessageToPublic", content) + .then((result) => { + console.log(result); + $scope.storeId = storeId; + }) + .catch((resp) => { + if ( + authService.authentication.refreshToken && + resp.message.indexOf("unauthorized") >= 0 + ) { + authService.refreshToken().then(async () => { + $scope.startConnection( + "one", + authService.authentication.accessToken + ); + }); + } + console.log(resp); + }); + }; + $scope.sendGroupMessage = function (content) { + $scope.connection + .invoke("SendMessageToPublic", content, `one-ticket-${storeId}`) + .then((result) => { + console.log(result); + $scope.storeId = storeId; + }) + .catch((resp) => { + if ( + authService.authentication.refreshToken && + resp.message.indexOf("unauthorized") >= 0 + ) { + authService.refreshToken().then(async () => { + $scope.startConnection( + "one", + authService.authentication.accessToken + ); + }); + } + console.log(resp); + }); + }; + $scope.sendPrivateMessage = function (content, connectionId) { + $scope.connection + .invoke("SendMessageToConnection", content, connectionId) .then((result) => { console.log(result); $scope.storeId = storeId; @@ -1082,7 +1080,7 @@ app.controller("DashboardController", [ ) { authService.refreshToken().then(async () => { $scope.startConnection( - "pos", + "one", authService.authentication.accessToken ); }); @@ -1157,113 +1155,203 @@ app.factory("DashboardServices", [ ]); "use strict"; -app.controller("ConfigurationController", [ +app.controller("CustomerController", [ "$scope", "$rootScope", "ngAppSettings", "$routeParams", + "$timeout", "$location", - "ConfigurationService", - "ApiService", + "CustomerServices", function ( $scope, $rootScope, ngAppSettings, $routeParams, + $timeout, $location, - service, - apiService + customerServices ) { - BaseRestCtrl.call( - this, - $scope, - $rootScope, - $location, - $routeParams, - ngAppSettings, - service - ); - $scope.init = function () { - $scope.request.category = $routeParams.category || ""; - $scope.request.culture = $rootScope.globalSettings.defaultCulture; - $scope.getList(); + $scope.request = angular.copy(ngAppSettings.request); + $scope.request.contentStatuses = ["Active"]; + $scope.request.status = "0"; + $scope.activedCustomer = null; + $scope.relatedCustomers = []; + $rootScope.isBusy = false; + $scope.data = { + pageIndex: 0, + pageSize: 1, + totalItems: 0, }; - $scope.getSingleSuccessCallback = function () { - $scope.cates = ngAppSettings.enums?.configuration_cates; - $scope.appSettings = $rootScope.globalSettings; - $scope.request.category = $routeParams.category || ""; - if (!$scope.viewmodel.id) { - $scope.viewmodel.dataType = "Text"; - $scope.viewmodel.specificulture = - $rootScope.globalSettings.defaultCulture; - } - if (!$scope.viewmodel.category) { - $scope.viewmodel.category = "Site"; - } + $scope.errors = []; + + $scope.range = function (max) { + var input = []; + for (var i = 1; i <= max; i += 1) input.push(i); + return input; }; - $scope.saveSuccessCallback = function () { - apiService.getAllSettings().then(function () { - // $location.url($scope.referrerUrl); - $rootScope.isBusy = false; - $scope.$apply(); - }); + + $scope.loadCustomer = async function () { + $rootScope.isBusy = true; + var id = $routeParams.id; + var response = await customerServices.getCustomer(id, "portal"); + if (response.success) { + $scope.activedCustomer = response.data; + $rootScope.initEditor(); + $rootScope.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showErrors(response.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } }; - $scope.removeCallback = function () { - apiService.getAllSettings().then(function () { - $location.url($scope.referrerUrl); - }); + $scope.loadCustomers = async function (pageIndex) { + if (pageIndex !== undefined) { + $scope.request.pageIndex = pageIndex; + } + if ($scope.request.fromDate !== null) { + var d = new Date($scope.request.fromDate); + $scope.request.fromDate = d.toISOString(); + } + if ($scope.request.toDate !== null) { + var d = new Date($scope.request.toDate); + $scope.request.toDate = d.toISOString(); + } + var resp = await customerServices.getCustomers($scope.request); + if (resp && resp.success) { + $scope.data = resp.data; + //$("html, body").animate({ "scrollTop": "0px" }, 500); + $.each($scope.data.items, function (i, customer) { + $.each($scope.activedCustomers, function (i, e) { + if (e.customerId === customer.id) { + customer.isHidden = true; + } + }); + }); + $rootScope.isBusy = false; + $scope.$apply(); + } else { + if (resp) { + $rootScope.showErrors(resp.errors); + } + $scope.$apply(); + } }; - $scope.generateName = function () { - $scope.viewmodel.keyword = $rootScope.generateKeyword( - $scope.viewmodel.keyword, - "_", - true + $scope.removeCustomer = function (id) { + $rootScope.showConfirm( + $scope, + "removeCustomerConfirmed", + [id], + null, + "Remove Customer", + "Deleted data will not able to recover, are you sure you want to delete this item?" ); }; + + $scope.removeCustomerConfirmed = async function (id) { + var result = await customerServices.removeCustomer(id); + if (result.success) { + $rootScope.showMessage("success", "success"); + $scope.loadCustomers(); + } else { + $rootScope.showMessage("failed"); + $rootScope.isBusy = false; + $scope.$apply(); + } + }; + + $scope.saveCustomer = async function (customer) { + customer.content = $(".editor-content").val(); + var resp = await customerServices.saveCustomer(customer); + if (resp && resp.success) { + $scope.activedCustomer = resp.data; + $rootScope.showMessage("Update successfully!", "success"); + $rootScope.isBusy = false; + $scope.$apply(); + //$location.path('/admin/customer/details/' + resp.data.id); + } else { + if (resp) { + $rootScope.showErrors(resp.errors); + } + $scope.$apply(); + } + }; }, ]); "use strict"; -app.factory("ConfigurationService", [ - "BaseRestService", +app.factory("CustomerServices", [ + "$http", + "$rootScope", "ApiService", "CommonService", - function (baseService, apiService, commonService) { - var serviceFactory = Object.create(baseService); - serviceFactory.init("configuration"); + function ($http, $rootScope, apiService, commonService) { + //var serviceBase = 'http://ngauthenticationapi.azurewebsites.net/'; - var _uploadConfiguration = async function (configurationFile) { - //var container = $(this).parents('.model-configuration').first().find('.custom-file').first(); - if ( - configurationFile.file !== undefined && - configurationFile.file !== null - ) { - // Create FormData object - var files = new FormData(); + var customersServiceFactory = {}; - // Looping over all files and add it to FormData object - files.append(configurationFile.file.name, configurationFile.file); + var settings = $rootScope.globalSettings; - // Adding one more key to FormData object - files.append("fileFolder", configurationFile.folder); - files.append("title", configurationFile.title); - files.append("description", configurationFile.description); + var _getCustomer = async function (id, type) { + var apiUrl = "/queen-beauty/customer/"; + var url = apiUrl + "details/" + type; + if (id) { + url += "/" + id; + } + var req = { + method: "GET", + url: url, + }; + return await apiService.sendRequest(req); + }; - var req = { - url: this.prefixUrl + "/upload", - type: "POST", - headers: {}, - contentType: false, // Not to set any content header - processData: false, // Not to process data - data: files, - }; + var _initCustomer = async function (type) { + var apiUrl = "/queen-beauty/customer/"; + var req = { + method: "GET", + url: apiUrl + "init/" + type, + }; + return await apiService.sendRequest(req); + }; - return await apiService.sendRequest(req); - } + var _getCustomers = async function (request) { + var apiUrl = "/queen-beauty/customer/"; + var req = { + method: "POST", + url: apiUrl + "list", + data: JSON.stringify(request), + }; + + return await apiService.sendRequest(req); }; - serviceFactory.uploadConfiguration = _uploadConfiguration; - return serviceFactory; + + var _removeCustomer = async function (id) { + var apiUrl = "/queen-beauty/customer/"; + var req = { + method: "GET", + url: apiUrl + "delete/" + id, + }; + return await apiService.sendRequest(req); + }; + + var _saveCustomer = async function (customer) { + var apiUrl = "/queen-beauty/customer/"; + var req = { + method: "POST", + url: apiUrl + "save", + data: JSON.stringify(customer), + }; + return await apiService.sendRequest(req); + }; + + customersServiceFactory.getCustomer = _getCustomer; + customersServiceFactory.initCustomer = _initCustomer; + customersServiceFactory.getCustomers = _getCustomers; + customersServiceFactory.removeCustomer = _removeCustomer; + customersServiceFactory.saveCustomer = _saveCustomer; + return customersServiceFactory; }, ]); @@ -1300,7 +1388,7 @@ app.controller("DomainController", [ "createdBy", ]; $scope.canDrag = - $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; }, ]); @@ -1314,61 +1402,6 @@ app.factory("DomainRestService", [ }, ]); -"use strict"; -app.controller("ImportFileController", [ - "$scope", - "$rootScope", - "ImportFileServices", - "TranslatorService", - "AppSettingsService", - function ( - $scope, - $rootScope, - service, - translatorService, - AppSettingsService - ) { - $scope.saveImportFile = async function () { - $rootScope.isBusy = true; - var form = document.getElementById("frm-import"); - var frm = new FormData(); - frm.append("assets", form["assets"].files[0]); - var response = await service.saveImportFile(frm); - if (response.success) { - $scope.viewmodel = response.data; - $rootScope.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showErrors(response.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - }, -]); - -"use strict"; -app.factory("ImportFileServices", [ - "$rootScope", - "BaseService", - function ($rootScope, baseService) { - //var serviceBase = 'http://ngauthenticationapi.azurewebsites.net/'; - - var serviceFactory = {}; - - var settings = $rootScope.globalSettings; - var serviceFactory = Object.create(baseService); - serviceFactory.init("portal", true); - var _saveImportFile = async function (frm) { - var apiUrl = this.prefixUrl + "/" + settings.lang + "/import"; - return await this.ajaxSubmitForm(frm, apiUrl); - }; - - serviceFactory.saveImportFile = _saveImportFile; - return serviceFactory; - }, -]); - "use strict"; app.controller("FileController", [ "$scope", @@ -1393,7 +1426,7 @@ app.controller("FileController", [ pageSize: "10", pageIndex: 0, status: "Published", - orderBy: "CreatedDateTime", + sortBy: "Id", direction: "Desc", fromDate: null, toDate: null, @@ -1610,20 +1643,131 @@ app.factory("FileServices", [ ]); "use strict"; -app.controller("LocalizeController", [ +app.controller("ImportFileController", [ "$scope", "$rootScope", - "ngAppSettings", - "$routeParams", - "$location", - "LocalizeService", - "ApiService", + "ImportFileServices", + "TranslatorService", + "AppSettingsService", function ( $scope, $rootScope, - ngAppSettings, - $routeParams, - $location, + service, + translatorService, + AppSettingsService + ) { + $scope.saveImportFile = async function () { + $rootScope.isBusy = true; + var form = document.getElementById("frm-import"); + var frm = new FormData(); + frm.append("assets", form["assets"].files[0]); + var response = await service.saveImportFile(frm); + if (response.success) { + $scope.viewmodel = response.data; + $rootScope.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showErrors(response.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } + }; + }, +]); + +"use strict"; +app.factory("ImportFileServices", [ + "$rootScope", + "BaseService", + function ($rootScope, baseService) { + //var serviceBase = 'http://ngauthenticationapi.azurewebsites.net/'; + + var serviceFactory = {}; + + var settings = $rootScope.globalSettings; + var serviceFactory = Object.create(baseService); + serviceFactory.init("portal", true); + var _saveImportFile = async function (frm) { + var apiUrl = this.prefixUrl + "/" + settings.lang + "/import"; + return await this.ajaxSubmitForm(frm, apiUrl); + }; + + serviceFactory.saveImportFile = _saveImportFile; + return serviceFactory; + }, +]); + +"use strict"; +app.controller("GlobalSettingController", [ + "$scope", + "$rootScope", + "ngAppSettings", + "$routeParams", + "$location", + "GlobalSettingService", + "ApiService", + function ( + $scope, + $rootScope, + ngAppSettings, + $routeParams, + $location, + service, + apiService + ) { + BaseRestCtrl.call( + this, + $scope, + $rootScope, + $location, + $routeParams, + ngAppSettings, + service + ); + $scope.init = function () { + $scope.request.category = $routeParams.category || ""; + $scope.request.culture = $rootScope.globalSettings.defaultCulture; + $scope.getList(); + }; + $scope.updateContent = (content) => { + $scope.viewmodel.settings = content; + }; + $scope.getSingleSuccessCallback = function () {}; + $scope.saveSuccessCallback = function () {}; + $scope.removeCallback = function () {}; + + $scope.generateName = function () {}; + }, +]); + +"use strict"; +app.factory("GlobalSettingService", [ + "BaseRestService", + "ApiService", + "CommonService", + function (baseService, apiService, commonService) { + var serviceFactory = Object.create(baseService); + serviceFactory.init("global-settings"); + + return serviceFactory; + }, +]); + +"use strict"; +app.controller("LocalizeController", [ + "$scope", + "$rootScope", + "ngAppSettings", + "$routeParams", + "$location", + "LocalizeService", + "ApiService", + function ( + $scope, + $rootScope, + ngAppSettings, + $routeParams, + $location, service, apiService ) { @@ -2043,100 +2187,6 @@ app.factory("JsonDataService", [ }, ]); -"use strict"; -app.controller("MixDatabaseContextController", [ - "$scope", - "$rootScope", - "$location", - "ngAppSettings", - "$routeParams", - "RestMixDatabaseContextService", - function ( - $scope, - $rootScope, - $location, - ngAppSettings, - $routeParams, - mixdbContextService - ) { - BaseRestCtrl.call( - this, - $scope, - $rootScope, - $location, - $routeParams, - ngAppSettings, - mixdbContextService - ); - $scope.namingConventions = ["TitleCase", "SnakeCase"]; - $scope.defaultAttr = null; - $scope.databaseProvider = ["MySQL", "PostgreSQL", "SQLITE", "SQLSERVER"]; - $scope.actions = ["Delete"]; - // $scope.request.selects = 'id,title,name,createdDateTime'; - $scope.orders = [ - { title: "Id", value: "Id" }, - { title: "Name", value: "DisplayName" }, - { title: "Created Date", value: "CreatedDateTime" }, - ]; - $scope.request.orderBy = "CreatedDateTime"; - $scope.request.columns = "id,displayName,systemName,type,createdDatetime"; - $scope.request.searchColumns = "displayName,systemName"; - $scope.saveDatabase = function () { - $scope.save($scope.viewmodel); - }; - $scope.migrate = async function () { - $rootScope.isBusy = true; - var resp = await mixdbContextService.migrate($scope.viewmodel); - if (resp.success) { - $rootScope.showMessage("success", "success"); - } else if (resp) { - $rootScope.showErrors(resp.errors); - } - $rootScope.isBusy = false; - $scope.$apply(); - }; - $scope.generateName = function () { - $scope.viewmodel.systemName = $rootScope.generateKeyword( - $scope.viewmodel.displayName, - "_", - true, - true - ); - }; - $scope.getSingleSuccessCallback = async function () {}; - }, -]); - -"use strict"; -app.factory("RestMixDatabaseContextService", [ - "BaseRestService", - function (baseService) { - var serviceFactory = Object.create(baseService); - serviceFactory.init("mixdb-context"); - - var _getByName = async function (name) { - var url = `${this.prefixUrl}/get-by-name/${name}`; - var req = { - method: "GET", - url: url, - }; - return await this.getRestApiResult(req); - }; - var _migrate = async function (dbContext) { - var url = `${this.prefixUrl}/migrate`; - var req = { - method: "POST", - url: url, - data: dbContext, - }; - return await this.getRestApiResult(req); - }; - serviceFactory.getByName = _getByName; - serviceFactory.migrate = _migrate; - return serviceFactory; - }, -]); - "use strict"; app.controller("MixDatabaseController", [ "$scope", @@ -2177,7 +2227,7 @@ app.controller("MixDatabaseController", [ { title: "Name", value: "Name" }, { title: "Created Date", value: "CreatedDateTime" }, ]; - $scope.request.orderBy = "CreatedDateTime"; + $scope.request.sortBy = "id"; $scope.request.columns = "id,displayName,systemName,type,createdDatetime"; $scope.request.searchColumns = "displayName,systemName"; $scope.saveDatabase = function () { @@ -2285,22 +2335,20 @@ app.controller("MixDatabaseController", [ ]); "use strict"; -app.controller("MixDatabaseDataController", [ +app.controller("MixDatabaseContextController", [ "$scope", "$rootScope", + "$location", "ngAppSettings", "$routeParams", - "$location", - "RestMixDatabasePortalService", - "MixDbService", + "RestMixDatabaseContextService", function ( $scope, $rootScope, + $location, ngAppSettings, $routeParams, - $location, - databaseService, - mixDbService + mixdbContextService ) { BaseRestCtrl.call( this, @@ -2309,32 +2357,134 @@ app.controller("MixDatabaseDataController", [ $location, $routeParams, ngAppSettings, - mixDbService + mixdbContextService ); - $scope.queries = {}; - $scope.data = null; - $scope.exportAll = true; - $scope.mixConfigurations = $rootScope.globalSettings; - $scope.filterType = "contain"; - $scope.defaultId = "default"; - $scope.importFile = { - file: null, - fullPath: "", - folder: "import", - title: "", - description: "", + $scope.namingConventions = ["TitleCase", "SnakeCase"]; + $scope.defaultAttr = null; + $scope.databaseProvider = [ + "MySQL", + "PostgreSQL", + "SQLITE", + "SQLSERVER", + "SCYLLADB", + ]; + $scope.actions = ["Delete"]; + // $scope.request.selects = 'id,title,name,createdDateTime'; + $scope.orders = [ + { title: "Id", value: "Id" }, + { title: "Name", value: "DisplayName" }, + { title: "Created Date", value: "CreatedDateTime" }, + ]; + $scope.request.sortBy = "id"; + $scope.request.columns = "id,displayName,systemName,type,createdDatetime"; + $scope.request.searchColumns = "displayName,systemName"; + $scope.saveDatabase = function () { + $scope.save($scope.viewmodel); }; - $scope.initRouteParams = async () => { - $scope.requestKey = `request${$rootScope.generateKeyword( - $location.$$path, - "_" - )}_${$routeParams.mixDatabaseId}`; - $scope.request = $rootScope.getRequest($scope.requestKey); - if ($routeParams.mixDatabaseId) { - $scope.request.mixDatabaseId = $routeParams.mixDatabaseId; + $scope.migrate = async function () { + $rootScope.isBusy = true; + var resp = await mixdbContextService.migrate($scope.viewmodel); + if (resp.success) { + $rootScope.showMessage("success", "success"); + } else if (resp) { + $rootScope.showErrors(resp.errors); } - if ($routeParams.queryFields) { - if (Array.isArray($routeParams.queryFields)) { + $rootScope.isBusy = false; + $scope.$apply(); + }; + $scope.generateName = function () { + $scope.viewmodel.systemName = $rootScope.generateKeyword( + $scope.viewmodel.displayName, + "_", + true, + true + ); + }; + $scope.getSingleSuccessCallback = async function () {}; + }, +]); + +"use strict"; +app.factory("RestMixDatabaseContextService", [ + "BaseRestService", + function (baseService) { + var serviceFactory = Object.create(baseService); + serviceFactory.init("mixdb-context"); + + var _getByName = async function (name) { + var url = `${this.prefixUrl}/get-by-name/${name}`; + var req = { + method: "GET", + url: url, + }; + return await this.getRestApiResult(req); + }; + var _migrate = async function (dbContext) { + var url = `${this.prefixUrl}/migrate`; + var req = { + method: "POST", + url: url, + data: dbContext, + }; + return await this.getRestApiResult(req); + }; + serviceFactory.getByName = _getByName; + serviceFactory.migrate = _migrate; + return serviceFactory; + }, +]); + +"use strict"; +app.controller("MixDatabaseDataController", [ + "$scope", + "$rootScope", + "ngAppSettings", + "$routeParams", + "$location", + "RestMixDatabasePortalService", + "MixDbService", + function ( + $scope, + $rootScope, + ngAppSettings, + $routeParams, + $location, + databaseService, + mixDbService + ) { + BaseRestCtrl.call( + this, + $scope, + $rootScope, + $location, + $routeParams, + ngAppSettings, + mixDbService + ); + $scope.queries = {}; + $scope.data = null; + $scope.exportAll = true; + $scope.mixConfigurations = $rootScope.globalSettings; + $scope.filterType = "contain"; + $scope.defaultId = "default"; + $scope.importFile = { + file: null, + fullPath: "", + folder: "import", + title: "", + description: "", + }; + $scope.initRouteParams = async () => { + $scope.requestKey = `request${$rootScope.generateKeyword( + $location.$$path, + "_" + )}_${$routeParams.mixDatabaseId}`; + $scope.request = $rootScope.getRequest($scope.requestKey); + if ($routeParams.mixDatabaseId) { + $scope.request.mixDatabaseId = $routeParams.mixDatabaseId; + } + if ($routeParams.queryFields) { + if (Array.isArray($routeParams.queryFields)) { angular.forEach($routeParams.queryFields, (e) => { let val = e.split(":"); $scope.queries[val[0]] = val[1]; @@ -2381,62 +2531,62 @@ app.controller("MixDatabaseDataController", [ ); if (getDatabase.success) { $scope.database = getDatabase.data; - $scope.fieldNames = { - id: $scope.database.namingConvention == "TitleCase" ? "Id" : "id", - parentId: - $scope.database.namingConvention == "TitleCase" - ? "ParentId" - : "parent_id", - parentDatabaseName: - $scope.database.namingConvention == "TitleCase" - ? "ParentDatabaseName" - : "parent_database_name", - childId: - $scope.database.namingConvention == "TitleCase" - ? "ChildId" - : "child_id", - childDatabaseName: - $scope.database.namingConvention == "TitleCase" - ? "ChildDatabaseName" - : "child_database_name", - createdDateTime: - $scope.database.namingConvention == "TitleCase" - ? "CreatedDateTime" - : "created_date_time", - lastModified: - $scope.database.namingConvention == "TitleCase" - ? "LastModified" - : "last_modified", - tenantId: - $scope.database.namingConvention == "TitleCase" - ? "MixTenantId" - : "mix_tenant_id", - createdBy: - $scope.database.namingConvention == "TitleCase" - ? "CreatedBy" - : "created_by", - modifiedBy: - $scope.database.namingConvention == "TitleCase" - ? "ModifiedBy" - : "modified_by", - priority: - $scope.database.namingConvention == "TitleCase" - ? "Priority" - : "priority", - status: - $scope.database.namingConvention == "TitleCase" - ? "Status" - : "status", - isDeleted: - $scope.database.namingConvention == "TitleCase" - ? "IsDeleted" - : "is_deleted", - }; + // $scope.fieldNames = { + // id: $scope.database.namingConvention == "TitleCase" ? "Id" : "id", + // parentId: + // $scope.database.namingConvention == "TitleCase" + // ? "ParentId" + // : "parent_id", + // parentDatabaseName: + // $scope.database.namingConvention == "TitleCase" + // ? "ParentDatabaseName" + // : "parent_database_name", + // childId: + // $scope.database.namingConvention == "TitleCase" + // ? "ChildId" + // : "child_id", + // childDatabaseName: + // $scope.database.namingConvention == "TitleCase" + // ? "ChildDatabaseName" + // : "child_database_name", + // createdDateTime: + // $scope.database.namingConvention == "TitleCase" + // ? "CreatedDateTime" + // : "created_date_time", + // lastModified: + // $scope.database.namingConvention == "TitleCase" + // ? "LastModified" + // : "last_modified", + // tenantId: + // $scope.database.namingConvention == "TitleCase" + // ? "TenantId" + // : "tenant_id", + // createdBy: + // $scope.database.namingConvention == "TitleCase" + // ? "CreatedBy" + // : "created_by", + // modifiedBy: + // $scope.database.namingConvention == "TitleCase" + // ? "ModifiedBy" + // : "modified_by", + // priority: + // $scope.database.namingConvention == "TitleCase" + // ? "Priority" + // : "priority", + // status: + // $scope.database.namingConvention == "TitleCase" + // ? "Status" + // : "status", + // isDeleted: + // $scope.database.namingConvention == "TitleCase" + // ? "IsDeleted" + // : "is_deleted", + // }; $scope.arrOrderBy = []; - Object.keys($scope.fieldNames).forEach(function (key, index) { - $scope.arrOrderBy.push($scope.fieldNames[key]); + angular.forEach($scope.database.columns, function (column) { + $scope.arrOrderBy.push(column.systemName); }); - $scope.request.orderBy ??= $scope.fieldNames["createdDateTime"]; + $scope.request.sortBy ??= $scope.arrOrderBy[0]; $scope.$apply(); } }; @@ -2711,22 +2861,26 @@ app.controller("MixDatabaseDataController", [ ]); "use strict"; -app.controller("ModuleDataController", [ +app.controller("ModuleController", [ "$scope", "$rootScope", "ngAppSettings", - "$routeParams", "$location", - "ModuleDataRestService", + "$routeParams", "ModuleRestService", + "SharedModuleDataService", + "RestMixDatabaseDataPortalService", + "RestMixDatabaseColumnPortalService", function ( $scope, $rootScope, ngAppSettings, - $routeParams, $location, - service, - moduleService + $routeParams, + moduleServices, + moduleDataService, + dataService, + columnService ) { BaseRestCtrl.call( this, @@ -2735,254 +2889,83 @@ app.controller("ModuleDataController", [ $location, $routeParams, ngAppSettings, - service + moduleServices, + "product" ); $scope.request.culture = $rootScope.globalSettings.defaultCulture; - // $scope.request.orderBy = "Priority"; - // $scope.request.direction = "Asc"; - $scope.cates = ["Site", "System"]; - $scope.others = []; - $scope.mixConfigurations = $rootScope.globalSettings; - $scope.moduleContentId = $routeParams.moduleContentId; - $scope.backUrl = `/admin/module-data/list/${$scope.moduleContentId}`; - $scope.module = null; - $scope.columns = []; - $scope.editDataUrl = "/admin/module-data/details/" + $scope.moduleContentId; - $scope.init = async function () { - $scope.id = $routeParams.id; - }; - $scope.initList = async function () { - $scope.id = $routeParams.id; - if (!$scope.module) { - var getModule = await moduleService.getSingle([$scope.moduleContentId]); - if (getModule.success) { - $scope.module = getModule.data; - $scope.columns = $scope.module.columns; - $scope.$apply(); + $scope.viewmodelType = "module"; + $scope.contentUrl = ""; + $scope.getSingleSuccessCallback = function () { + $scope.loadAdditionalData(); + + if ($scope.viewmodel.id > 0) { + // module => list post or list product + if ($scope.viewmodel.type.localeCompare("ListPost") == 0) { + $scope.contentUrl = "/admin/module-post/list/" + $scope.viewmodel.id; + } else if ($scope.viewmodel.type.localeCompare("Data") == 0) { + $scope.contentUrl = "/admin/module-data/list/" + $scope.viewmodel.id; } } - }; - $scope.getList = async function () { - $rootScope.isBusy = true; - $scope.request.moduleContentId = $scope.moduleContentId; - var response = await service.getList($scope.request); - if (response.success) { - $scope.data = response.data; - $rootScope.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showErrors(response.errors); - $rootScope.isBusy = false; - $scope.$apply(); + if ($scope.viewmodel.sysCategories) { + angular.forEach($scope.viewmodel.sysCategories, function (e) { + e.attributeData.obj.isActived = true; + }); + } + + if ($scope.viewmodel.sysTags) { + angular.forEach($scope.viewmodel.sysTags, function (e) { + e.attributeData.obj.isActived = true; + }); + } + + if ($routeParams.template) { + $scope.viewmodel.view = $rootScope.findObjectByKey( + $scope.viewmodel.templates, + "fileName", + $routeParams.template + ); } }; + $scope.getListByType = async function (pageIndex) { + $scope.request.query = "?type=" + $scope.type; + await $scope.getList(pageIndex); + }; + $scope.defaultAttr = { + name: "", + options: [], + priority: 0, + dataType: 7, + isGroupBy: false, + isSelect: false, + isDisplay: true, + width: 3, + }; + $scope.type = "-1"; - $scope.export = async function () { + $scope.localizeSettings = $rootScope.globalSettings; + $scope.viewmodel = null; + $scope.editDataUrl = ""; + + $scope.loadModuleDatas = async function () { $rootScope.isBusy = true; - $scope.request.moduleContentId = $scope.moduleContentId; - var response = await service.export($scope.request); + var id = $routeParams.id; + $scope.dataColumns = []; + var response = await moduleServices.getSingle([id]); if (response.success) { - window.top.location = response.data.webPath; - $rootScope.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showErrors(response.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - - $scope.getSingle = async function () { - $rootScope.isBusy = true; - var resp = await service.getSingle($routeParams.id, "portal"); - if (resp && resp.success) { - $scope.activedModuleData = resp.data; - $rootScope.initEditor(); - $rootScope.isBusy = false; - $scope.$apply(); - } else { - if (resp) { - $rootScope.showErrors(resp.errors); - } - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - $scope.remove = function (dataContentId) { - $rootScope.showConfirm( - $scope, - "removeConfirmed", - [dataContentId], - null, - "Remove", - "Deleted data will not able to recover, are you sure you want to delete this item?" - ); - }; - - $scope.removeConfirmed = async function (dataContentId) { - $rootScope.isBusy = true; - var result = await service.delete([dataContentId]); - if (result.success) { - if ($scope.removeCallback) { - $rootScope.executeFunctionByName( - "removeCallback", - $scope.removeCallbackArgs, - $scope - ); - } - $scope.getList(); - } else { - $rootScope.showErrors(result.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - - $scope.removeCallback = function () {}; - - $scope.saveOthers = async function () { - var response = await service.saveList($scope.others); - if (response.success) { - $scope.getList(); - $scope.$apply(); - } else { - $rootScope.showErrors(response.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - }, -]); - -"use strict"; -app.factory("ModuleDataRestService", [ - "BaseRestService", - "ApiService", - "CommonService", - function (baseService, apiService, commonService) { - var serviceFactory = Object.create(baseService); - serviceFactory.init("mix-module-data"); - // Define more service methods here - - var _initForm = async function (moduleContentId) { - var url = `${this.prefixUrl}/init-form/${moduleContentId}`; - var req = { - method: "GET", - url: url, - }; - return await apiService.sendRequest(req); - }; - serviceFactory.initForm = _initForm; - return serviceFactory; - }, -]); - -"use strict"; -app.controller("ModuleController", [ - "$scope", - "$rootScope", - "ngAppSettings", - "$location", - "$routeParams", - "ModuleRestService", - "SharedModuleDataService", - "RestMixDatabaseDataPortalService", - "RestMixDatabaseColumnPortalService", - function ( - $scope, - $rootScope, - ngAppSettings, - $location, - $routeParams, - moduleServices, - moduleDataService, - dataService, - columnService - ) { - BaseRestCtrl.call( - this, - $scope, - $rootScope, - $location, - $routeParams, - ngAppSettings, - moduleServices, - "product" - ); - $scope.request.culture = $rootScope.globalSettings.defaultCulture; - $scope.viewmodelType = "module"; - $scope.contentUrl = ""; - $scope.getSingleSuccessCallback = function () { - $scope.loadAdditionalData(); - - if ($scope.viewmodel.id > 0) { - // module => list post or list product - if ($scope.viewmodel.type.localeCompare("ListPost") == 0) { - $scope.contentUrl = "/admin/module-post/list/" + $scope.viewmodel.id; - } else if ($scope.viewmodel.type.localeCompare("Data") == 0) { - $scope.contentUrl = "/admin/module-data/list/" + $scope.viewmodel.id; - } - } - if ($scope.viewmodel.sysCategories) { - angular.forEach($scope.viewmodel.sysCategories, function (e) { - e.attributeData.obj.isActived = true; - }); - } - - if ($scope.viewmodel.sysTags) { - angular.forEach($scope.viewmodel.sysTags, function (e) { - e.attributeData.obj.isActived = true; - }); - } - - if ($routeParams.template) { - $scope.viewmodel.view = $rootScope.findObjectByKey( - $scope.viewmodel.templates, - "fileName", - $routeParams.template - ); - } - }; - $scope.getListByType = async function (pageIndex) { - $scope.request.query = "?type=" + $scope.type; - await $scope.getList(pageIndex); - }; - $scope.defaultAttr = { - name: "", - options: [], - priority: 0, - dataType: 7, - isGroupBy: false, - isSelect: false, - isDisplay: true, - width: 3, - }; - $scope.type = "-1"; - - $scope.localizeSettings = $rootScope.globalSettings; - $scope.viewmodel = null; - $scope.editDataUrl = ""; - - $scope.loadModuleDatas = async function () { - $rootScope.isBusy = true; - var id = $routeParams.id; - $scope.dataColumns = []; - var response = await moduleServices.getSingle([id]); - if (response.success) { - $scope.viewmodel = response.data; - $scope.editDataUrl = - "/admin/module-data/details/" + $scope.viewmodel.id; - $scope.loadMoreModuleDatas(); - angular.forEach($scope.viewmodel.columns, function (e, i) { - if (e.isDisplay) { - $scope.dataColumns.push({ - title: e.title, - name: e.name, - filter: true, - type: 0, // string - ngAppSettings.dataTypes[0] - }); - } - }); + $scope.viewmodel = response.data; + $scope.editDataUrl = + "/admin/module-data/details/" + $scope.viewmodel.id; + $scope.loadMoreModuleDatas(); + angular.forEach($scope.viewmodel.columns, function (e, i) { + if (e.isDisplay) { + $scope.dataColumns.push({ + title: e.title, + name: e.name, + filter: true, + type: 0, // string - ngAppSettings.dataTypes[0] + }); + } + }); $rootScope.isBusy = false; $scope.$apply(); } else { @@ -3189,13 +3172,13 @@ app.factory("ModuleRestService", [ ]); "use strict"; -app.controller("ModulePostController", [ +app.controller("ModuleGalleryController", [ "$scope", "$rootScope", "ngAppSettings", "$routeParams", "$location", - "ModulePostRestService", + "ModuleGalleryService", "ApiService", "CommonService", function ( @@ -3205,6 +3188,7 @@ app.controller("ModulePostController", [ $routeParams, $location, service, + apiService, commonService ) { BaseCtrl.call( @@ -3215,34 +3199,23 @@ app.controller("ModulePostController", [ ngAppSettings, service ); - $scope.request.culture = $rootScope.globalSettings.defaultCulture; $scope.cates = ["Site", "System"]; $scope.others = []; $scope.mixConfigurations = $rootScope.globalSettings; + $scope.moduleContentId = $routeParams.id; $scope.canDrag = - $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; $scope.translate = $rootScope.translate; - $scope.moduleIds = $routeParams.moduleIds || $routeParams.id; - $scope.pageIds = $routeParams.page_ids; - $scope.type = $routeParams.type; - $scope.template = $routeParams.template || ""; - - $scope.init = function () { - $scope.createUrl = `/admin/post/create?page_ids=${$scope.pageIds}&moduleIds=${$scope.moduleIds}&type=${$scope.type}&template=${$scope.template}`; - $scope.getList(); - }; - $scope.getList = async function (pageIndex) { + $scope.moduleContentId = $routeParams.id; + $scope.getList = async function () { $rootScope.isBusy = true; - if (pageIndex !== undefined) { - $scope.request.pageIndex = pageIndex; - } var id = $routeParams.id; $scope.moduleContentId = $routeParams.id; - $scope.request.parentId = id; + $scope.request.query = "&moduleContentId=" + id; $scope.canDrag = - $scope.request.orderBy !== "Priority" || + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; - var response = await service.search($scope.request); + var response = await service.getList($scope.request); if (response.success) { $scope.data = response.data; $rootScope.isBusy = false; @@ -3253,24 +3226,20 @@ app.controller("ModulePostController", [ $scope.$apply(); } }; - $scope.preview = function (item) { - item.editUrl = "/admin/post/details/" + item.id; - $rootScope.preview("post", item, item.title, "modal-lg"); - }; - $scope.remove = function (id) { + $scope.remove = function (moduleContentId, postId) { $rootScope.showConfirm( $scope, "removeConfirmed", - [id], + [moduleContentId, postId], null, "Remove", "Deleted data will not able to recover, are you sure you want to delete this item?" ); }; - $scope.removeConfirmed = async function (id) { + $scope.removeConfirmed = async function (moduleContentId, postId) { $rootScope.isBusy = true; - var result = await service.delete(id); + var result = await service.delete(moduleContentId, postId); if (result.success) { if ($scope.removeCallback) { $rootScope.executeFunctionByName( @@ -3325,40 +3294,23 @@ app.controller("ModulePostController", [ ]); "use strict"; -app.factory("ModulePostRestService", [ +app.factory("ModuleGalleryService", [ "$rootScope", "ApiService", "CommonService", - "BaseRestService", + "BaseService", function ($rootScope, apiService, commonService, baseService) { var serviceFactory = Object.create(baseService); serviceFactory.init("module-post"); - - var _search = async function (objData) { - var data = serviceFactory.parseQuery(objData); - var url = this.prefixUrl; - - if (data) { - url += "/search?"; - url = url.concat(data); - } + var _delete = async function (moduleContentId, postId) { + var url = this.prefixUrl + "/delete/" + moduleContentId + "/" + postId; var req = { - serviceBase: this.serviceBase, method: "GET", url: url, }; - return await this.getRestApiResult(req); + return await apiService.sendRequest(req); }; - - var _delete = async function (id) { - var url = this.prefixUrl + "/" + id; - var req = { - method: "DELETE", - url: url, - }; - return await apiService.sendRequest(req); - }; - var _updateInfos = async function (modules) { + var _updateInfos = async function (modules) { var req = { method: "POST", url: this.prefixUrl + "/update-infos", @@ -3366,7 +3318,6 @@ app.factory("ModulePostRestService", [ }; return await apiService.sendRequest(req); }; - serviceFactory.search = _search; serviceFactory.delete = _delete; serviceFactory.updateInfos = _updateInfos; return serviceFactory; @@ -3374,20 +3325,22 @@ app.factory("ModulePostRestService", [ ]); "use strict"; -app.controller("OAuthClientController", [ +app.controller("ModuleDataController", [ "$scope", "$rootScope", "ngAppSettings", - "$location", "$routeParams", - "RestOAuthClientService", + "$location", + "ModuleDataRestService", + "ModuleRestService", function ( $scope, $rootScope, ngAppSettings, - $location, $routeParams, - service + $location, + service, + moduleService ) { BaseRestCtrl.call( this, @@ -3398,31 +3351,154 @@ app.controller("OAuthClientController", [ ngAppSettings, service ); + $scope.request.culture = $rootScope.globalSettings.defaultCulture; + // $scope.request.sortBy = "Priority"; + // $scope.request.direction = "Asc"; + $scope.cates = ["Site", "System"]; + $scope.others = []; + $scope.mixConfigurations = $rootScope.globalSettings; + $scope.moduleContentId = $routeParams.moduleContentId; + $scope.backUrl = `/admin/module-data/list/${$scope.moduleContentId}`; + $scope.module = null; + $scope.columns = []; + $scope.editDataUrl = "/admin/module-data/details/" + $scope.moduleContentId; + $scope.init = async function () { + $scope.id = $routeParams.id; + }; + $scope.initList = async function () { + $scope.id = $routeParams.id; + if (!$scope.module) { + var getModule = await moduleService.getSingle([$scope.moduleContentId]); + if (getModule.success) { + $scope.module = getModule.data; + $scope.columns = $scope.module.columns; + $scope.$apply(); + } + } + }; + $scope.getList = async function () { + $rootScope.isBusy = true; + $scope.request.moduleContentId = $scope.moduleContentId; + var response = await service.getList($scope.request); + if (response.success) { + $scope.data = response.data; + $rootScope.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showErrors(response.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } + }; - $scope.canDrag = - $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; - $scope.applicationTypes = ["JavaScript", "NativeConfidential"]; + $scope.export = async function () { + $rootScope.isBusy = true; + $scope.request.moduleContentId = $scope.moduleContentId; + var response = await service.export($scope.request); + if (response.success) { + window.top.location = response.data.webPath; + $rootScope.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showErrors(response.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } + }; + + $scope.getSingle = async function () { + $rootScope.isBusy = true; + var resp = await service.getSingle($routeParams.id, "portal"); + if (resp && resp.success) { + $scope.activedModuleData = resp.data; + $rootScope.initEditor(); + $rootScope.isBusy = false; + $scope.$apply(); + } else { + if (resp) { + $rootScope.showErrors(resp.errors); + } + $rootScope.isBusy = false; + $scope.$apply(); + } + }; + $scope.remove = function (dataContentId) { + $rootScope.showConfirm( + $scope, + "removeConfirmed", + [dataContentId], + null, + "Remove", + "Deleted data will not able to recover, are you sure you want to delete this item?" + ); + }; + + $scope.removeConfirmed = async function (dataContentId) { + $rootScope.isBusy = true; + var result = await service.delete([dataContentId]); + if (result.success) { + if ($scope.removeCallback) { + $rootScope.executeFunctionByName( + "removeCallback", + $scope.removeCallbackArgs, + $scope + ); + } + $scope.getList(); + } else { + $rootScope.showErrors(result.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } + }; + + $scope.removeCallback = function () {}; + + $scope.saveOthers = async function () { + var response = await service.saveList($scope.others); + if (response.success) { + $scope.getList(); + $scope.$apply(); + } else { + $rootScope.showErrors(response.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } + }; }, ]); "use strict"; -app.factory("RestOAuthClientService", [ +app.factory("ModuleDataRestService", [ "BaseRestService", - function (baseService) { + "ApiService", + "CommonService", + function (baseService, apiService, commonService) { var serviceFactory = Object.create(baseService); - serviceFactory.initService("/rest/auth", "oauth-client", true); + serviceFactory.init("mix-module-data"); + // Define more service methods here + + var _initForm = async function (moduleContentId) { + var url = `${this.prefixUrl}/init-form/${moduleContentId}`; + var req = { + method: "GET", + url: url, + }; + return await apiService.sendRequest(req); + }; + serviceFactory.initForm = _initForm; return serviceFactory; }, ]); "use strict"; -app.controller("ModuleGalleryController", [ +app.controller("ModulePostController", [ "$scope", "$rootScope", "ngAppSettings", "$routeParams", "$location", - "ModuleGalleryService", + "ModulePostRestService", "ApiService", "CommonService", function ( @@ -3432,7 +3508,6 @@ app.controller("ModuleGalleryController", [ $routeParams, $location, service, - apiService, commonService ) { BaseCtrl.call( @@ -3443,23 +3518,34 @@ app.controller("ModuleGalleryController", [ ngAppSettings, service ); + $scope.request.culture = $rootScope.globalSettings.defaultCulture; $scope.cates = ["Site", "System"]; $scope.others = []; $scope.mixConfigurations = $rootScope.globalSettings; - $scope.moduleContentId = $routeParams.id; $scope.canDrag = - $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; $scope.translate = $rootScope.translate; - $scope.moduleContentId = $routeParams.id; - $scope.getList = async function () { + $scope.moduleIds = $routeParams.moduleIds || $routeParams.id; + $scope.pageIds = $routeParams.page_ids; + $scope.type = $routeParams.type; + $scope.template = $routeParams.template || ""; + + $scope.init = function () { + $scope.createUrl = `/admin/post/create?page_ids=${$scope.pageIds}&moduleIds=${$scope.moduleIds}&type=${$scope.type}&template=${$scope.template}`; + $scope.getList(); + }; + $scope.getList = async function (pageIndex) { $rootScope.isBusy = true; + if (pageIndex !== undefined) { + $scope.request.pageIndex = pageIndex; + } var id = $routeParams.id; $scope.moduleContentId = $routeParams.id; - $scope.request.query = "&moduleContentId=" + id; + $scope.request.parentId = id; $scope.canDrag = - $scope.request.orderBy !== "Priority" || + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; - var response = await service.getList($scope.request); + var response = await service.search($scope.request); if (response.success) { $scope.data = response.data; $rootScope.isBusy = false; @@ -3470,20 +3556,24 @@ app.controller("ModuleGalleryController", [ $scope.$apply(); } }; - $scope.remove = function (moduleContentId, postId) { + $scope.preview = function (item) { + item.editUrl = "/admin/post/details/" + item.id; + $rootScope.preview("post", item, item.title, "modal-lg"); + }; + $scope.remove = function (id) { $rootScope.showConfirm( $scope, "removeConfirmed", - [moduleContentId, postId], + [id], null, "Remove", "Deleted data will not able to recover, are you sure you want to delete this item?" ); }; - $scope.removeConfirmed = async function (moduleContentId, postId) { + $scope.removeConfirmed = async function (id) { $rootScope.isBusy = true; - var result = await service.delete(moduleContentId, postId); + var result = await service.delete(id); if (result.success) { if ($scope.removeCallback) { $rootScope.executeFunctionByName( @@ -3538,20 +3628,37 @@ app.controller("ModuleGalleryController", [ ]); "use strict"; -app.factory("ModuleGalleryService", [ +app.factory("ModulePostRestService", [ "$rootScope", "ApiService", "CommonService", - "BaseService", + "BaseRestService", function ($rootScope, apiService, commonService, baseService) { var serviceFactory = Object.create(baseService); serviceFactory.init("module-post"); - var _delete = async function (moduleContentId, postId) { - var url = this.prefixUrl + "/delete/" + moduleContentId + "/" + postId; + + var _search = async function (objData) { + var data = serviceFactory.parseQuery(objData); + var url = this.prefixUrl; + + if (data) { + url += "/search?"; + url = url.concat(data); + } var req = { + serviceBase: this.serviceBase, method: "GET", url: url, }; + return await this.getRestApiResult(req); + }; + + var _delete = async function (id) { + var url = this.prefixUrl + "/" + id; + var req = { + method: "DELETE", + url: url, + }; return await apiService.sendRequest(req); }; var _updateInfos = async function (modules) { @@ -3562,6 +3669,7 @@ app.factory("ModuleGalleryService", [ }; return await apiService.sendRequest(req); }; + serviceFactory.search = _search; serviceFactory.delete = _delete; serviceFactory.updateInfos = _updateInfos; return serviceFactory; @@ -3569,32 +3677,20 @@ app.factory("ModuleGalleryService", [ ]); "use strict"; -app.controller("PageController", [ +app.controller("OAuthClientController", [ "$scope", "$rootScope", "ngAppSettings", "$location", "$routeParams", - "PageRestService", - "PagePostRestService", - "UrlAliasService", - "RestMixDatabasePortalService", - "RestMixDatabaseDataPortalService", - "RestMixDatabaseColumnPortalService", - "MixDbService", + "RestOAuthClientService", function ( $scope, $rootScope, ngAppSettings, $location, $routeParams, - service, - pagePostRestService, - urlAliasService, - databaseService, - dataService, - columnService, - mixDbService + service ) { BaseRestCtrl.call( this, @@ -3605,26 +3701,170 @@ app.controller("PageController", [ ngAppSettings, service ); - $scope.request.culture = $rootScope.globalSettings.defaultCulture; - var pageModuleService = $rootScope.getRestService("mix-page-module"); - $scope.viewmodelType = "page"; - $scope.request.query = "level=0"; - $scope.pageType = {}; - $scope.pageTypes = $rootScope.globalSettings.pageTypes; - $scope.selectedCategories = []; - $scope.selectedTags = []; - $scope.selectedModules = []; - $scope.pageData = { - posts: [], - products: [], - data: [], - }; - $scope.request.columns = [ - "id", - "title", - "createdDateTime", - "type", - "image", + + $scope.canDrag = + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; + $scope.applicationTypes = ["JavaScript", "NativeConfidential"]; + }, +]); + +"use strict"; +app.factory("RestOAuthClientService", [ + "BaseRestService", + function (baseService) { + var serviceFactory = Object.create(baseService); + serviceFactory.initService("/rest/auth", "oauth-client", true); + return serviceFactory; + }, +]); + +"use strict"; +app.controller("OrderDetailController", [ + "$scope", + "$rootScope", + "ngAppSettings", + "$location", + "$routeParams", + "RestOrderDetailService", + function ( + $scope, + $rootScope, + ngAppSettings, + $location, + $routeParams, + service + ) { + BaseRestCtrl.call( + this, + $scope, + $rootScope, + $location, + $routeParams, + ngAppSettings, + service + ); + BaseHub.call(this, $scope); + + $scope.progress = 0; + $scope.viewMode = "list"; + $scope.current = null; + + $scope.canDrag = + $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; + + $scope.init = async function () { + $scope.startConnection("mixEcommerceHub", null, (err) => { + console.log(err); + }); + $scope.onConnected = () => { + $scope.joinRoom("Admin"); + }; + await $scope.getThemes(); + }; + $scope.receiveMessage = function (resp) { + let msg = JSON.parse(resp); + switch (msg.action) { + case "Downloading": + var index = $scope.data.items.findIndex( + (m) => m.id == $scope.current.id + ); + var progress = Math.round(msg.message); + if (index >= 0) { + $scope.progress = progress; + if (progress == 100) { + $scope.installStatus = "Installing"; + } + $scope.$apply(); + } + break; + + default: + console.log(msg); + break; + } + }; + }, +]); + +"use strict"; +app.factory("RestOrderDetailService", [ + "BaseRestService", + function (baseService) { + var serviceFactory = Object.create(baseService); + serviceFactory.initService("/rest/ecommerce", "order-detail"); + var _updateOrderStatus = async function (id, objData) { + var url = `${this.prefixUrl}/update-order-status/${id}`; + var req = { + serviceBase: this.serviceBase, + method: "POST", + url: url, + data: JSON.stringify(objData), + }; + return await this.getRestApiResult(req); + }; + serviceFactory.updateOrderStatus = _updateOrderStatus; + return serviceFactory; + }, +]); + +"use strict"; +app.controller("PageController", [ + "$scope", + "$rootScope", + "ngAppSettings", + "$location", + "$routeParams", + "PageRestService", + "PagePostRestService", + "UrlAliasService", + "RestMixDatabasePortalService", + "RestMixDatabaseDataPortalService", + "RestMixDatabaseColumnPortalService", + "MixDbService", + function ( + $scope, + $rootScope, + ngAppSettings, + $location, + $routeParams, + service, + pagePostRestService, + urlAliasService, + databaseService, + dataService, + columnService, + mixDbService + ) { + BaseRestCtrl.call( + this, + $scope, + $rootScope, + $location, + $routeParams, + ngAppSettings, + service + ); + $scope.request.culture = $rootScope.globalSettings.defaultCulture; + var pageModuleService = $rootScope.getRestService("page-module"); + $scope.viewmodelType = "page"; + $scope.request.query = "level=0"; + $scope.pageType = {}; + $scope.pageTypes = $rootScope.globalSettings.pageTypes; + $scope.selectedCategories = []; + $scope.selectedTags = []; + $scope.selectedModules = []; + $scope.pageData = { + posts: [], + products: [], + data: [], + }; + $scope.request.columns = [ + "id", + "title", + "createdDateTime", + "type", + "image", + "detailUrl", ]; $scope.additionalData = null; $scope.temp = null; @@ -3634,7 +3874,7 @@ app.controller("PageController", [ ($scope.additionalDatabaseRequest.compareOperator = "Equal"), ($scope.additionalDatabaseRequest.keyword = "AdditionalData"); $scope.canDrag = - $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; $scope.loadPosts = async function () { $rootScope.isBusy = true; var id = $routeParams.id; @@ -3687,7 +3927,7 @@ app.controller("PageController", [ }; $scope.getListSuccessCallback = function () { $scope.canDrag = - $scope.request.orderBy !== "Priority" || + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; }; $scope.loadAdditionalData = async function () { @@ -3925,13 +4165,13 @@ app.factory("PageRestService", [ ]); "use strict"; -app.controller("PageGalleryController", [ +app.controller("PagePostController", [ "$scope", "$rootScope", "ngAppSettings", "$routeParams", "$location", - "PageGalleryService", + "PagePostRestService", "PostRestService", "ApiService", "CommonService", @@ -3943,7 +4183,6 @@ app.controller("PageGalleryController", [ $location, service, postService, - apiService, commonService ) { BaseCtrl.call( @@ -3954,20 +4193,39 @@ app.controller("PageGalleryController", [ ngAppSettings, service ); + $scope.request.culture = $rootScope.globalSettings.defaultCulture; $scope.cates = ["Site", "System"]; $scope.others = []; $scope.mixConfigurations = $rootScope.globalSettings; - $scope.pageId = $routeParams.id; - $scope.canDrag = - $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; - $scope.getList = async function () { + $scope.init = function () { + $scope.pageId = $routeParams.id; + $scope.type = $routeParams.type || ""; + $scope.template = $routeParams.template || ""; + $scope.pageIds = $routeParams.page_ids || $routeParams.id || ""; + $scope.moduleIds = $routeParams.module_ids || ""; + $scope.canDrag = + $scope.request.sortBy === "Priority" && + $scope.request.direction === "Asc"; + $scope.createUrl = + $routeParams.post_type === "gallery" + ? "/admin/post/create-gallery" + : `/admin/post/create?page_ids=${$scope.pageIds}&moduleIds=${$scope.moduleIds}&type=${$scope.type}&template=${$scope.template}`; + $scope.updateUrl = + $routeParams.post_type === "gallery" + ? "/admin/post/gallery-details" + : "/admin/post/details"; + }; + $scope.getList = async function (pageIndex) { + if (pageIndex !== undefined) { + $scope.request.pageIndex = pageIndex; + } $rootScope.isBusy = true; var id = $routeParams.id; - $scope.request.query = "&page_id=" + id; + $scope.request.query = "&parentId=" + id; var response = await service.getList($scope.request); $scope.canDrag = - $scope.request.orderBy !== "Priority" || - $scope.request.direction !== "0"; + $scope.request.sortBy === "Priority" && + $scope.request.direction === "Asc"; if (response.success) { $scope.data = response.data; $rootScope.isBusy = false; @@ -3978,6 +4236,10 @@ app.controller("PageGalleryController", [ $scope.$apply(); } }; + $scope.preview = function (item) { + item.editUrl = "/admin/post/details/" + item.id; + $rootScope.preview("post", item, item.title, "modal-lg"); + }; $scope.remove = function (pageId, postId) { $rootScope.showConfirm( $scope, @@ -3988,10 +4250,13 @@ app.controller("PageGalleryController", [ "Deleted data will not able to recover, are you sure you want to delete this item?" ); }; + $scope.back = function () { + window.history.back(); + }; - $scope.removeConfirmed = async function (pageId, postId) { + $scope.removeConfirmed = async function (id) { $rootScope.isBusy = true; - var result = await service.delete(pageId, postId); + var result = await service.delete(id); if (result.success) { if ($scope.removeCallback) { $rootScope.executeFunctionByName( @@ -4002,7 +4267,7 @@ app.controller("PageGalleryController", [ } $scope.getList(); } else { - $rootScope.showMessage("failed"); + $rootScope.showErrors(result.errors); $rootScope.isBusy = false; $scope.$apply(); } @@ -4040,25 +4305,28 @@ app.controller("PageGalleryController", [ $scope.$apply(); } }; + $scope.toggleModal = function (id) { + $(id).modal("toggle"); + }; }, ]); "use strict"; -app.factory("PageGalleryService", [ +app.factory("PagePostRestService", [ "$rootScope", "ApiService", "CommonService", - "BaseService", + "BaseRestService", function ($rootScope, apiService, commonService, baseService) { var serviceFactory = Object.create(baseService); serviceFactory.init("page-post"); - var _delete = async function (pageId, postId) { - var url = this.prefixUrl + "/delete/" + pageId + "/" + postId; + var _delete = async function (id) { + var url = this.prefixUrl + "/delete/" + id; var req = { method: "GET", url: url, }; - return await apiService.sendRequest(req); + return await apiService.getApiResult(req); }; var _updateInfos = async function (pages) { var req = { @@ -4066,7 +4334,7 @@ app.factory("PageGalleryService", [ url: this.prefixUrl + "/update-infos", data: JSON.stringify(pages), }; - return await apiService.sendRequest(req); + return await apiService.getApiResult(req); }; serviceFactory.delete = _delete; serviceFactory.updateInfos = _updateInfos; @@ -4075,170 +4343,49 @@ app.factory("PageGalleryService", [ ]); "use strict"; -app.controller("QueueLogController", [ +app.controller("PageGalleryController", [ "$scope", "$rootScope", "ngAppSettings", - "$location", "$routeParams", - "AuthService", - "QueueLogRestService", + "$location", + "PageGalleryService", + "PostRestService", + "ApiService", + "CommonService", function ( $scope, $rootScope, ngAppSettings, - $location, $routeParams, - authService, - service + $location, + service, + postService, + apiService, + commonService ) { - BaseRestCtrl.call( + BaseCtrl.call( this, $scope, $rootScope, - $location, $routeParams, ngAppSettings, service ); - authService.fillAuthData(); - $scope.request.status = null; - $scope.messages = []; + $scope.cates = ["Site", "System"]; + $scope.others = []; + $scope.mixConfigurations = $rootScope.globalSettings; + $scope.pageId = $routeParams.id; $scope.canDrag = - $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; - $scope.getListSuccessCallback = function () { - angular.forEach($scope.data.items, function (e) { - switch (e.state) { - case "ACK": - e.objClass = "text-success"; - break; - case "NACK": - e.objClass = "text-warning"; - break; - case "FAILED": - e.objClass = "text-danger"; - break; - default: - e.objClass = "text-info"; - break; - } - }); - }; - $scope.view = function (item) { - switch (item.state) { - case "ACK": - item.objClass = "text-success"; - break; - case "NACK": - item.objClass = "text-warning"; - break; - case "FAILED": - item.objClass = "text-danger"; - break; - default: - item.objClass = "text-info"; - break; - } - $rootScope.preview("object", item, null, "modal-lg"); - }; - }, -]); - -"use strict"; -app.factory("QueueLogRestService", [ - "BaseRestService", - function (baseService) { - var serviceFactory = angular.copy(baseService); - serviceFactory.initService("/rest", "mix-log/queue-log", true); - var _search = async function (objData, queries = null) { - var data = serviceFactory.parseQuery(objData); - - var url = `${this.prefixUrl}/search`; - - if (data) { - url += "?"; - url = url.concat(data); - if (queries) { - url += "&"; - var extraQueries = serviceFactory.parseQuery(queries); - url = url.concat(extraQueries); - } - } - var req = { - serviceBase: this.serviceBase, - apiVersion: this.apiVersion, - method: "GET", - url: url, - }; - return await this.getRestApiResult(req); - }; - serviceFactory.getList = _search; - return serviceFactory; - }, -]); - -"use strict"; -app.controller("PagePostController", [ - "$scope", - "$rootScope", - "ngAppSettings", - "$routeParams", - "$location", - "PagePostRestService", - "PostRestService", - "ApiService", - "CommonService", - function ( - $scope, - $rootScope, - ngAppSettings, - $routeParams, - $location, - service, - postService, - commonService - ) { - BaseCtrl.call( - this, - $scope, - $rootScope, - $routeParams, - ngAppSettings, - service - ); - $scope.request.culture = $rootScope.globalSettings.defaultCulture; - $scope.cates = ["Site", "System"]; - $scope.others = []; - $scope.mixConfigurations = $rootScope.globalSettings; - $scope.init = function () { - $scope.pageId = $routeParams.id; - $scope.type = $routeParams.type || ""; - $scope.template = $routeParams.template || ""; - $scope.pageIds = $routeParams.page_ids || $routeParams.id || ""; - $scope.moduleIds = $routeParams.module_ids || ""; - $scope.canDrag = - $scope.request.orderBy === "Priority" && - $scope.request.direction === "Asc"; - $scope.createUrl = - $routeParams.post_type === "gallery" - ? "/admin/post/create-gallery" - : `/admin/post/create?page_ids=${$scope.pageIds}&moduleIds=${$scope.moduleIds}&type=${$scope.type}&template=${$scope.template}`; - $scope.updateUrl = - $routeParams.post_type === "gallery" - ? "/admin/post/gallery-details" - : "/admin/post/details"; - }; - $scope.getList = async function (pageIndex) { - if (pageIndex !== undefined) { - $scope.request.pageIndex = pageIndex; - } + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; + $scope.getList = async function () { $rootScope.isBusy = true; var id = $routeParams.id; $scope.request.query = "&page_id=" + id; var response = await service.getList($scope.request); $scope.canDrag = - $scope.request.orderBy === "Priority" && - $scope.request.direction === "Asc"; + $scope.request.sortBy !== "Priority" || + $scope.request.direction !== "0"; if (response.success) { $scope.data = response.data; $rootScope.isBusy = false; @@ -4249,10 +4396,6 @@ app.controller("PagePostController", [ $scope.$apply(); } }; - $scope.preview = function (item) { - item.editUrl = "/admin/post/details/" + item.id; - $rootScope.preview("post", item, item.title, "modal-lg"); - }; $scope.remove = function (pageId, postId) { $rootScope.showConfirm( $scope, @@ -4263,13 +4406,10 @@ app.controller("PagePostController", [ "Deleted data will not able to recover, are you sure you want to delete this item?" ); }; - $scope.back = function () { - window.history.back(); - }; - $scope.removeConfirmed = async function (id) { + $scope.removeConfirmed = async function (pageId, postId) { $rootScope.isBusy = true; - var result = await service.delete(id); + var result = await service.delete(pageId, postId); if (result.success) { if ($scope.removeCallback) { $rootScope.executeFunctionByName( @@ -4280,7 +4420,7 @@ app.controller("PagePostController", [ } $scope.getList(); } else { - $rootScope.showErrors(result.errors); + $rootScope.showMessage("failed"); $rootScope.isBusy = false; $scope.$apply(); } @@ -4322,21 +4462,21 @@ app.controller("PagePostController", [ ]); "use strict"; -app.factory("PagePostRestService", [ +app.factory("PageGalleryService", [ "$rootScope", "ApiService", "CommonService", - "BaseRestService", + "BaseService", function ($rootScope, apiService, commonService, baseService) { var serviceFactory = Object.create(baseService); - serviceFactory.init("mix-page-post"); - var _delete = async function (id) { - var url = this.prefixUrl + "/delete/" + id; + serviceFactory.init("page-post"); + var _delete = async function (pageId, postId) { + var url = this.prefixUrl + "/delete/" + pageId + "/" + postId; var req = { method: "GET", url: url, }; - return await apiService.getApiResult(req); + return await apiService.sendRequest(req); }; var _updateInfos = async function (pages) { var req = { @@ -4344,7 +4484,7 @@ app.factory("PagePostRestService", [ url: this.prefixUrl + "/update-infos", data: JSON.stringify(pages), }; - return await apiService.getApiResult(req); + return await apiService.sendRequest(req); }; serviceFactory.delete = _delete; serviceFactory.updateInfos = _updateInfos; @@ -4500,405 +4640,621 @@ app.factory("RestPortalPageNavigationService", [ ]); "use strict"; -app.controller("SchedulerController", [ +app.controller("PostController", [ "$scope", "$rootScope", - "$routeParams", "$location", - "SchedulerService", - function ($scope, $rootScope, $routeParams, $location, service) { - $scope.jobs = []; - $scope.intervalTypes = [ - "Second", - "Minute", - "Hour", - "Day", - "Week", - "Month", - "Year", - ]; - $scope.templates = { - "Mix.Scheduler.Jobs.KeepPoolAliveJob": { - domain: "https://example.com", - }, - "Mix.Scheduler.Jobs.PublishScheduledPostsJob": {}, - "Mix.Scheduler.Jobs.SendMessageQueueJob": { - data: { - topic: "", - action: "", - data: {}, - }, - }, - "Mix.Scheduler.Jobs.SendPortalMessageJob": { - data: { - topic: "", - action: "", - data: "", - }, - }, - }; - $scope.schedule = { - jobData: { - data: { - type: "Info", - from: { - connectionId: "", - userName: "", - avatar: "", - }, - title: "value", - message: "content", - data: {}, - }, - }, - cronExpression: null, - name: null, - groupName: null, - jobName: null, - description: null, - startAt: null, - isStartNow: true, - interval: null, - intervalType: "Second", - repeatCount: null, - }; - $scope.updateMessageTemplate = () => { - if ($scope.templates[$scope.schedule.jobName]) { - $scope.schedule.jobData = null; - setTimeout(() => { - $scope.schedule.jobData = $scope.templates[$scope.schedule.jobName]; - $scope.$apply(); - }, 200); - } - }; - $scope.init = function () { - $scope.getTriggers(); - $scope.getJobs(); - }; - - $scope.getSingle = async function () { - $scope.getJobs(); - $scope.getTrigger(); + "$filter", + "ngAppSettings", + "$routeParams", + "PostRestService", + "UrlAliasService", + "RestMixDatabaseDataPortalService", + "RestMixDatabaseColumnPortalService", + "RestRelatedAttributeDataPortalService", + "RestMixDatabasePortalService", + "MixDbService", + function ( + $scope, + $rootScope, + $location, + $filter, + ngAppSettings, + $routeParams, + service, + urlAliasService, + dataService, + columnService, + navService, + databaseService, + mixDbService + ) { + BaseRestCtrl.call( + this, + $scope, + $rootScope, + $location, + $routeParams, + ngAppSettings, + service + ); + if (!$scope.referrerUrl) { + $scope.referrerUrl = "/admin/post/list"; + } + $scope.request.searchColumns = "title"; + $scope.request.culture = $rootScope.globalSettings.defaultCulture; + $scope.request.queries = []; + $scope.request.metadataQueries = []; + $scope.defaultQuery = { + fieldName: "", + compareOperator: "Equal", + value: "", }; + $scope.viewmodelType = "post"; + $scope.additionalData = {}; + $scope.createUrl = "/admin/post/create?"; + $scope.postTypeRequest = angular.copy(ngAppSettings.request); + ($scope.postTypeRequest.searchColumns = "Type"), + ($scope.postTypeRequest.compareOperator = "Equal"), + ($scope.postTypeRequest.keyword = "AdditionalData"); - $scope.getTrigger = async function () { - if ($routeParams.name) { - $rootScope.isBusy = true; - $scope.isReschedule = true; - var resp = await service.getTrigger($routeParams.name); - if (resp && resp.success) { - $scope.trigger = resp.data.trigger; - // $scope.schedule.trigger = $scope.trigger; - $scope.schedule.name = $scope.trigger.name; - $scope.schedule.jobName = $scope.trigger.jobName; - $scope.schedule.groupName = $scope.trigger.group; - // $scope.schedule.interval = $scope.trigger.repeatInterval; - $scope.schedule.repeatCount = $scope.trigger.repeatCount; - if ($scope.trigger.jobDataMap) { - if ($scope.trigger.jobDataMap.data) { - $scope.schedule.jobData = { - data: JSON.parse($scope.trigger.jobDataMap.data), - }; - } else { - $scope.schedule.jobData = $scope.trigger.jobDataMap; - } - } - $rootScope.isBusy = false; - $scope.$apply(); - } else { - if (resp) { - $rootScope.showErrors(resp.errors || ["Failed"]); - } - $rootScope.isBusy = false; - $scope.$apply(); - } + $scope.initList = async function () { + if ($routeParams.template) { + $scope.createUrl = `${$scope.createUrl}&template=${$routeParams.template}`; + } + if ($routeParams.category) { + $scope.request.category = $routeParams.category; + } + if ($routeParams.type) { + $scope.createUrl = `${$scope.createUrl}&type=${$routeParams.type}`; + $scope.request.additionalDatabase = $routeParams.type; + $scope.request.mixDatabaseName = $routeParams.type; + } + if ($routeParams.layout) { + $scope.createUrl = `${$scope.createUrl}&layout=${$routeParams.layout}`; + } + if ($routeParams.page_ids) { + $scope.createUrl = `${$scope.createUrl}&page_ids=${$routeParams.page_ids}`; } + $scope.pageName = "postList"; + await $scope.loadAdditionalDatabases(); + $scope.filter(); }; - $scope.createSchedule = async function () { + $scope.parseQueryField = function (fieldName, value, operator = "Equal") { + return { + fieldName: fieldName, + value: value, + compareOperator: operator, + }; + }; + $scope.syncProducts = async function () { $rootScope.isBusy = true; - var resp = $scope.isReschedule - ? await service.reschedule($scope.schedule) - : await service.createSchedule($scope.schedule); + let names = $scope.data.items.map((m) => { + return m.title; + }); + await service.syncProducts(names); + $rootScope.isBusy = false; + }; + $scope.filter = async function (pageIndex) { + $rootScope.isBusy = true; + if (pageIndex !== undefined) { + $scope.request.pageIndex = pageIndex; + } + if ($scope.request.fromDate !== null) { + var d = new Date($scope.request.fromDate); + $scope.request.fromDate = d.toISOString(); + } + if ($scope.request.toDate !== null) { + var dt = new Date($scope.request.toDate); + $scope.request.toDate = dt.toISOString(); + } + var resp = await service.filter($scope.request); if (resp && resp.success) { - $rootScope.isBusy = true; - $location.url("/admin/scheduler"); + $scope.data = resp.data; + $.each($scope.data.items, function (i, data) { + $.each($scope.viewmodels, function (i, e) { + if (e.dataContentId === data.id) { + data.isHidden = true; + } + }); + }); + if ($scope.getListSuccessCallback) { + $scope.getListSuccessCallback(); + } + if ($scope.isScrollTop) { + $("html, body").animate({ scrollTop: "0px" }, 500); + } + $rootScope.isBusy = false; $scope.$apply(); } else { if (resp) { $rootScope.showErrors(resp.errors || ["Failed"]); } + if ($scope.getListFailCallback) { + $scope.getListFailCallback(); + } $rootScope.isBusy = false; $scope.$apply(); } }; - $scope.execute = async function (name) { - try { - $rootScope.isBusy = true; - await service.execute(name); - $rootScope.isBusy = false; - $scope.$apply(); - } catch {} + $scope.loadMetadataDatabase = async function () { + var getMixDatabase = await databaseService.getByName(["Metadata"]); + let typeCol = getMixDatabase.data.columns.find( + (c) => c.systemName == "type" + ); + $scope.lstMetadata = typeCol.columnConfigurations.allowedValues; + $scope.$apply(); }; - $scope.updateJobData = function (content) { - try { - $scope.schedule.jobData = JSON.parse(content); + $scope.loadAdditionalDatabases = async function () { + let getTypes = await databaseService.getList($scope.postTypeRequest); + if (getTypes.success) { + $scope.additionalDatabases = getTypes.data.items; + $scope.additionalDatabases.splice(0, 0, { + systemName: null, + displayName: "All", + id: 0, + }); + if ($scope.request.mixDatabaseName) { + $scope.additionalDatabase = $rootScope.findObjectByKey( + $scope.additionalDatabases, + "mixDatabaseName", + $scope.request.mixDatabaseName + ); + } + $scope.request.mixDatabaseName = $routeParams.type || ""; $scope.$apply(); - } catch {} + } }; - $scope.pauseTrigger = async function (name) { + $scope.getDefault = async function (type = null) { $rootScope.isBusy = true; - var resp = await service.pauseTrigger(name); - if (resp && resp.success) { - $scope.schedule = resp.data; - await $scope.getTriggers(); - } else { - if (resp) { - $rootScope.showErrors(resp.errors || ["Failed"]); + type = type || $routeParams.type; + var resp = await service.getDefault({ + type: type || "", + template: $routeParams.template || "", + }); + if (resp.success) { + $scope.viewmodel = resp.data; + mixDbService.initDbName($scope.viewmodel.mixDatabaseName); + if ($scope.getSingleSuccessCallback) { + $scope.getSingleSuccessCallback(); } + + // $scope.viewmodel.createdDateTime = Date.now(); + $scope.viewmodel.createdBy = $rootScope.authentication.username; + $rootScope.isBusy = false; $scope.$apply(); - } - }; - - $scope.resumeTrigger = async function (name) { - $rootScope.isBusy = true; - var resp = await service.resumeTrigger(name); - if (resp && resp.success) { - $scope.schedule = resp.data; - await $scope.getTriggers(); } else { if (resp) { - $rootScope.showErrors(resp.errors || ["Failed"]); + $rootScope.showErrors(resp.errors); + } + if ($scope.getSingleFailCallback) { + $scope.getSingleFailCallback(); } $rootScope.isBusy = false; $scope.$apply(); } }; - - $scope.getTriggers = async function () { - $rootScope.isBusy = true; - var resp = await service.getTriggers(); + $scope.preview = function (item) { + item.editUrl = "/admin/post/details/" + item.id; + $rootScope.preview("post", item, item.title, "modal-lg"); + }; + $scope.onSelectType = function () { + if ($scope.viewmodel) { + $scope.viewmodel.mixDatabaseName = $scope.additionalDatabase.systemName; + mixDbService.initDbName($scope.viewmodel.mixDatabaseName); + $scope.loadAdditionalData(); + } + $scope.request.additionalDatabase = + $scope.additionalDatabase.mixDatabaseName; + $scope.createUrl = `/admin/post/create?type=${$scope.request.additionalDatabase}`; + if ($routeParams.template) { + $scope.createUrl += `&template=${$routeParams.template}`; + } + if ( + $scope.additionalDatabase.mixDatabaseName && + (!$scope.viewmodel || !$scope.viewmodel.id) + ) { + $scope.getDefault($scope.request.additionalDatabase); + } + if ($scope.pageName == "postList") { + $scope.filter(); + } + }; + $scope.getListRelated = async function (pageIndex) { + if (pageIndex !== undefined) { + $scope.request.pageIndex = pageIndex; + } + if ($scope.request.fromDate !== null) { + var d = new Date($scope.request.fromDate); + $scope.request.fromDate = d.toISOString(); + } + if ($scope.request.toDate !== null) { + var d = new Date($scope.request.toDate); + $scope.request.toDate = d.toISOString(); + } + var resp = await service.filter($scope.request); if (resp && resp.success) { - $scope.data = resp.data; + $scope.relatedData = angular.copy(resp.data); + $scope.relatedData.items = []; + angular.forEach(resp.data.items, (element) => { + let isActive = + null != + $scope.viewmodel.postNavs.find( + (p) => p.destinationId == element.id + ); + if (!isActive) { + var obj = { + description: element.title, + destinationId: element.id, + image: element.image, + isActived: isActive, + sourceId: $scope.viewmodel.id, + specificulture: $scope.viewmodel.specificulture, + status: "Published", + }; + result.push(obj); + } + }); + resp.data.items = result; $rootScope.isBusy = false; $scope.$apply(); + return resp.data; } else { - if (resp) { - $rootScope.showErrors(resp.errors || ["Failed"]); - } + $rootScope.showErrors(getData.errors); $rootScope.isBusy = false; $scope.$apply(); } }; - $scope.getJobs = async function () { - $rootScope.isBusy = true; - var resp = await service.getJobs(); - if (resp && resp.success) { - $scope.jobs = resp.data; + $scope.saveFailCallback = function () { + angular.forEach($scope.viewmodel.mixDatabaseNavs, function (nav) { + if (nav.isActived) { + $rootScope.decryptMixDatabase( + nav.mixDatabase.attributes, + nav.mixDatabase.postData.items + ); + } + }); + }; + $scope.saveSuccessCallback = async function () { + if ($scope.additionalData && $scope.viewmodel.mixDatabaseName) { + var creating = !$scope.additionalData.parentId; + $scope.additionalData.parentType = "Post"; + $scope.additionalData.parentId = $scope.viewmodel.id; + mixDbService.initDbName($scope.viewmodel.mixDatabaseName); + var saveResult = await mixDbService.save($scope.additionalData); + if (saveResult.success) { + $rootScope.showMessage("Additional Data Saved", "success"); + $scope.additionalData = saveResult.data; + if (creating) { + $location.url(`/admin/post/details/${$scope.viewmodel.id}`); + } + } else { + $rootScope.showErrors(result.errors); + } + // $scope.additionalData.isClone = $scope.viewmodel.isClone; + // $scope.additionalData.cultures = $scope.viewmodel.cultures; + // $scope.additionalData.intParentId = $scope.viewmodel.id; + // $scope.additionalData.parentType = "Post"; + // let result = await dataService.save($scope.additionalData); + // if (!result.success) { + // $rootScope.showErrors(result.errors); + // } else { + // $scope.additionalData = result.data; + // // $scope.saveColumns(); + // } + } + $rootScope.showMessage("success", "success"); + $rootScope.isBusy = false; + $scope.$apply(); + }; + + $scope.saveColumns = async function () { + let result = await columnService.saveMany($scope.additionalData.columns); + if (result.success) { + $rootScope.showMessage("success", "success"); + } + }; + $scope.getSingleSuccessCallback = async function () { + if (!$scope.viewmodel.id) { + $scope.viewmodel.mixDatabaseName = $routeParams.type; + } + mixDbService.initDbName($scope.viewmodel.mixDatabaseName); + await $scope.loadMetadataDatabase(); + // $scope.defaultThumbnailImgWidth = + // ngAppSettings.mixConfigurations.DefaultThumbnailImgWidth; + // $scope.defaultThumbnailImgHeight = + // ngAppSettings.mixConfigurations.DefaultThumbnailImgHeight; + + // $scope.defaultFeatureImgWidth = + // ngAppSettings.mixConfigurations.DefaultFeatureImgWidth; + // $scope.defaultFeatureImgHeight = + // ngAppSettings.mixConfigurations.DefaultFeatureImgHeight; + $scope.request.additionalDatabase = $scope.viewmodel.mixDatabaseName; + var moduleIds = $routeParams.moduleIds; + var pageIds = $routeParams.page_ids; + $scope.additionalDatabase = $rootScope.findObjectByKey( + $scope.additionalDatabases, + "systemName", + $scope.request.additionalDatabase + ); + $scope.loadAdditionalData(); + if (moduleIds) { + for (var moduleContentId of moduleIds.split(",")) { + var moduleNav = $rootScope.findObjectByKey( + $scope.viewmodel.modules, + "moduleContentId", + moduleContentId + ); + if (moduleNav) { + moduleNav.isActived = true; + } + } + } + if (pageIds) { + for (var pageId of pageIds.split(",")) { + var pageNav = $rootScope.findObjectByKey( + $scope.viewmodel.pages, + "pageId", + pageId + ); + if (pageNav) { + pageNav.isActived = true; + } + } + } + }; + $scope.loadAdditionalData = async function () { + if ($scope.viewmodel.mixDatabaseName) { + $scope.loadingData = true; + mixDbService.initDbName($scope.viewmodel.mixDatabaseName); + if ($scope.viewmodel.id) { + const getData = await mixDbService.getSingleByParent( + "Post", + $scope.viewmodel.id + ); + if (getData.success) { + $scope.additionalData = getData.data; + $scope.loadingData = false; + } + $scope.$apply(); + } else { + $scope.additionalData = { + parentType: "Post", + }; + $scope.loadingData = false; + } + } + }; + $scope.generateSeo = function () { + if ($scope.viewmodel) { + if ( + $scope.viewmodel.seoName === null || + $scope.viewmodel.seoName === "" + ) { + $scope.viewmodel.seoName = $rootScope.generateKeyword( + $scope.viewmodel.title, + "-" + ); + if ($scope.viewmodel.seoName.length > 50) { + $scope.viewmodel.seoName = + $scope.viewmodel.seoName.substring(0, 80) + "..."; + } + } + if ( + $scope.viewmodel.seoTitle === null || + $scope.viewmodel.seoTitle === "" + ) { + $scope.viewmodel.seoTitle = $scope.viewmodel.title; + } + if ( + $scope.viewmodel.seoDescription === null || + $scope.viewmodel.seoDescription === "" + ) { + $scope.viewmodel.seoDescription = $scope.viewmodel.excerpt; + } + if ( + $scope.viewmodel.seoKeywords === null || + $scope.viewmodel.seoKeywords === "" + ) { + $scope.viewmodel.seoKeywords = $scope.viewmodel.title; + } + } + }; + $scope.addAlias = async function () { + var getAlias = await urlAliasService.getDefault(); + if (getAlias.success) { + $scope.viewmodel.urlAliases.push(getAlias.data); $rootScope.isBusy = false; $scope.$apply(); } else { - if (resp) { - $rootScope.showErrors(resp.errors || ["Failed"]); - } + $rootScope.showErrors(getAlias.errors); $rootScope.isBusy = false; $scope.$apply(); } }; - $scope.deleteJob = async function (name) { - $rootScope.isBusy = true; - var resp = await service.deleteJob(name); - if (resp && resp.success) { - $scope.getJobs(); - } else { - if (resp) { - $rootScope.showErrors(resp.errors || ["Failed"]); + $scope.removeAliasCallback = async function (index) { + $scope.viewmodel.urlAliases.splice(index, 1); + $scope.$apply(); + }; + + $scope.validate = function () { + angular.forEach($scope.viewmodel.mixDatabaseNavs, function (nav) { + if (nav.isActived) { + $rootScope.encryptMixDatabase( + nav.mixDatabase.attributes, + nav.mixDatabase.postData.items + ); } - $rootScope.isBusy = false; - $scope.$apply(); - } + }); + return true; }; }, ]); "use strict"; -app.factory("SchedulerService", [ - "AuthService", +app.factory("PostRestService", [ + "BaseRestService", "ApiService", - function (authService, apiService) { - var serviceFactory = {}; - serviceFactory.prefixUrl = "/scheduler"; - var _createSchedule = async function (schedule) { - var url = `${this.prefixUrl}/trigger/create`; + function (baseService, apiService) { + var serviceFactory = Object.create(baseService); + serviceFactory.init("mix-post-content"); + var _syncProducts = async function (names) { + var url = `/api/daphale/sync/products`; var req = { - serviceBase: this.serviceBase, + serviceBase: "", method: "POST", url: url, - data: JSON.stringify(schedule), + data: { + batch: 50, + isScaleImage: true, + isSyncPrice: true, + isSyncAll: false, + productNames: names, + }, }; - return await this.getRestApiResult(req); + return await apiService.sendPureRequest(req); }; - var _reschedule = async function (schedule) { - var url = `${this.prefixUrl}/reschedule`; + var _filter = async function (request) { + var url = `${this.prefixUrl}/filter`; var req = { serviceBase: this.serviceBase, method: "POST", url: url, - data: JSON.stringify(schedule), - }; - return await this.getRestApiResult(req); - }; - var _execute = async function (name) { - var url = `${this.prefixUrl}/execute/${name}`; - var req = { - serviceBase: this.serviceBase, - method: "GET", - url: url, - }; - return await this.getRestApiResult(req); - }; - var _pauseTrigger = async function (name) { - var url = `${this.prefixUrl}/trigger/pause/${name}`; - var req = { - serviceBase: this.serviceBase, - method: "GET", - url: url, + data: request, }; return await this.getRestApiResult(req); }; + // Define more service methods here + serviceFactory.filter = _filter; + serviceFactory.syncProducts = _syncProducts; + return serviceFactory; + }, +]); - var _resumeTrigger = async function (name) { - var url = `${this.prefixUrl}/trigger/resume/${name}`; - var req = { - serviceBase: this.serviceBase, - method: "GET", - url: url, - }; - return await this.getRestApiResult(req); +"use strict"; +app.controller("QueueLogController", [ + "$scope", + "$rootScope", + "ngAppSettings", + "$location", + "$routeParams", + "AuthService", + "QueueLogRestService", + function ( + $scope, + $rootScope, + ngAppSettings, + $location, + $routeParams, + authService, + service + ) { + BaseRestCtrl.call( + this, + $scope, + $rootScope, + $location, + $routeParams, + ngAppSettings, + service + ); + authService.fillAuthData(); + $scope.request.status = null; + $scope.messages = []; + $scope.canDrag = + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; + $scope.getListSuccessCallback = function () { + angular.forEach($scope.data.items, function (e) { + switch (e.state) { + case "ACK": + e.objClass = "text-success"; + break; + case "NACK": + e.objClass = "text-warning"; + break; + case "FAILED": + e.objClass = "text-danger"; + break; + default: + e.objClass = "text-info"; + break; + } + }); }; - - var _getTrigger = async function (name) { - var url = `${this.prefixUrl}/trigger/${name}`; - var req = { - serviceBase: this.serviceBase, - method: "GET", - url: url, - }; - return await this.getRestApiResult(req); + $scope.view = function (item) { + switch (item.state) { + case "ACK": + item.objClass = "text-success"; + break; + case "NACK": + item.objClass = "text-warning"; + break; + case "FAILED": + item.objClass = "text-danger"; + break; + default: + item.objClass = "text-info"; + break; + } + $rootScope.preview("object", item, null, "modal-lg"); }; + }, +]); - var _getTriggers = async function () { - var url = `${this.prefixUrl}/trigger`; - var req = { - serviceBase: this.serviceBase, - method: "GET", - url: url, - }; - return await this.getRestApiResult(req); - }; +"use strict"; +app.factory("QueueLogRestService", [ + "BaseRestService", + function (baseService) { + var serviceFactory = angular.copy(baseService); + serviceFactory.initService("/rest", "mix-log/queue-log", true); + var _search = async function (objData, queries = null) { + var data = serviceFactory.parseQuery(objData); - var _getJobs = async function () { - var url = `${this.prefixUrl}/job`; - var req = { - serviceBase: this.serviceBase, - method: "GET", - url: url, - }; - return await this.getRestApiResult(req); - }; + var url = `${this.prefixUrl}/search`; - var _deleteJob = async function (name) { - var url = `${this.prefixUrl}/job/${name}`; + if (data) { + url += "?"; + url = url.concat(data); + if (queries) { + url += "&"; + var extraQueries = serviceFactory.parseQuery(queries); + url = url.concat(extraQueries); + } + } var req = { serviceBase: this.serviceBase, - method: "DELETE", + apiVersion: this.apiVersion, + method: "GET", url: url, }; return await this.getRestApiResult(req); }; - - var _getRestApiResult = async function (req) { - if (!authService.authentication) { - await authService.fillAuthData(); - } - if (authService.authentication) { - req.Authorization = authService.authentication.accessToken; - } - if (!req.headers) { - req.headers = { - "Content-Type": "application/json", - }; - } - req.headers.Authorization = "Bearer " + req.Authorization || ""; - - return apiService.sendRequest(req).then(function (resp) { - return resp; - }); - }; - var _parseQuery = function (req) { - var result = ""; - if (req) { - for (var key in req) { - if (angular.isObject(req.query)) { - req.query = JSON.stringify(req.query); - } - if (req.hasOwnProperty(key) && req[key]) { - if (result != "") { - result += "&"; - } - result += `${key}=${req[key]}`; - } - } - return result; - } else { - return result; - } - }; - serviceFactory.execute = _execute; - serviceFactory.parseQuery = _parseQuery; - serviceFactory.getRestApiResult = _getRestApiResult; - serviceFactory.createSchedule = _createSchedule; - serviceFactory.reschedule = _reschedule; - serviceFactory.getJobs = _getJobs; - serviceFactory.deleteJob = _deleteJob; - serviceFactory.getTrigger = _getTrigger; - serviceFactory.getTriggers = _getTriggers; - serviceFactory.pauseTrigger = _pauseTrigger; - serviceFactory.resumeTrigger = _resumeTrigger; + serviceFactory.getList = _search; return serviceFactory; }, ]); "use strict"; -app.controller("PostController", [ +app.controller("RoleController", [ "$scope", "$rootScope", "$location", - "$filter", - "ngAppSettings", "$routeParams", - "PostRestService", - "UrlAliasService", + "ngAppSettings", "RestMixDatabaseDataPortalService", "RestMixDatabaseColumnPortalService", - "RestRelatedAttributeDataPortalService", - "RestMixDatabasePortalService", - "MixDbService", + "RoleService", function ( $scope, $rootScope, $location, - $filter, - ngAppSettings, $routeParams, - service, - urlAliasService, + ngAppSettings, dataService, columnService, - navService, - databaseService, - mixDbService + service ) { BaseRestCtrl.call( this, @@ -4909,549 +5265,436 @@ app.controller("PostController", [ ngAppSettings, service ); - if (!$scope.referrerUrl) { - $scope.referrerUrl = "/admin/post/list"; - } - $scope.request.searchColumns = "title"; - $scope.request.culture = $rootScope.globalSettings.defaultCulture; - $scope.request.queries = []; - $scope.request.metadataQueries = []; - $scope.defaultQuery = { - fieldName: "", - compareOperator: "Equal", - value: "", + $scope.role = { name: "" }; + $scope.initPermissions = async function () { + let backUrl = "/admin/role/list"; + $scope.createUrl = `/admin/mix-database-data/create?mixDatabaseName=sysPermission&dataContentId=default&parentId=${$scope.viewmodel.id}&parentName=Role&backUrl=${backUrl}`; + $scope.updateUrl = "/admin/mix-database-data/details"; }; - $scope.viewmodelType = "post"; - $scope.additionalData = {}; - $scope.createUrl = "/admin/post/create?"; - $scope.postTypeRequest = angular.copy(ngAppSettings.request); - ($scope.postTypeRequest.searchColumns = "Type"), - ($scope.postTypeRequest.compareOperator = "Equal"), - ($scope.postTypeRequest.keyword = "AdditionalData"); - $scope.initList = async function () { - if ($routeParams.template) { - $scope.createUrl = `${$scope.createUrl}&template=${$routeParams.template}`; - } - if ($routeParams.category) { - $scope.request.category = $routeParams.category; - } - if ($routeParams.type) { - $scope.createUrl = `${$scope.createUrl}&type=${$routeParams.type}`; - $scope.request.additionalDatabase = $routeParams.type; - $scope.request.mixDatabaseName = $routeParams.type; - } - if ($routeParams.layout) { - $scope.createUrl = `${$scope.createUrl}&layout=${$routeParams.layout}`; - } - if ($routeParams.page_ids) { - $scope.createUrl = `${$scope.createUrl}&page_ids=${$routeParams.page_ids}`; + $scope.createRole = async function () { + $rootScope.isBusy = true; + var result = await service.createRole($scope.role.name); + if (result.success) { + $scope.role.name = ""; + $scope.getList(); + } else { + $rootScope.showErrors(result.errors); + $rootScope.isBusy = false; + $scope.$apply(); } - $scope.pageName = "postList"; - await $scope.loadAdditionalDatabases(); - $scope.filter(); }; + }, +]); - $scope.parseQueryField = function (fieldName, value, operator = "Equal") { - return { - fieldName: fieldName, - value: value, - compareOperator: operator, - }; - }; - $scope.syncProducts = async function () { - $rootScope.isBusy = true; - let names = $scope.data.items.map((m) => { - return m.title; - }); - await service.syncProducts(names); - $rootScope.isBusy = false; - }; - $scope.filter = async function (pageIndex) { - $rootScope.isBusy = true; - if (pageIndex !== undefined) { - $scope.request.pageIndex = pageIndex; - } - if ($scope.request.fromDate !== null) { - var d = new Date($scope.request.fromDate); - $scope.request.fromDate = d.toISOString(); - } - if ($scope.request.toDate !== null) { - var dt = new Date($scope.request.toDate); - $scope.request.toDate = dt.toISOString(); +"use strict"; +app.factory("RoleService", [ + "BaseRestService", + "ApiService", + "CommonService", + function (baseService, apiService, commonService) { + var serviceFactory = Object.create(baseService); + serviceFactory.initService("/rest/auth", "role", true); + + var _getPermissions = async function () { + var req = { + method: "GET", + url: this.prefixUrl + "/permissions", + }; + return await apiService.sendRequest(req); + }; + + var _updatePermission = async function (permission) { + var req = { + method: "POST", + url: this.prefixUrl + "/update-permission", + data: JSON.stringify(permission), + }; + return await apiService.sendRequest(req); + }; + var _createRole = function (name) { + var req = { + method: "POST", + url: this.prefixUrl + "/create", + data: JSON.stringify(name), + }; + + return apiService.sendRequest(req); + }; + serviceFactory.createRole = _createRole; + serviceFactory.getPermissions = _getPermissions; + serviceFactory.updatePermission = _updatePermission; + return serviceFactory; + }, +]); + +"use strict"; +app.controller("SchedulerController", [ + "$scope", + "$rootScope", + "$routeParams", + "$location", + "SchedulerService", + function ($scope, $rootScope, $routeParams, $location, service) { + $scope.jobs = []; + $scope.intervalTypes = [ + "Second", + "Minute", + "Hour", + "Day", + "Week", + "Month", + "Year", + ]; + $scope.templates = { + "Mix.Scheduler.Jobs.KeepPoolAliveJob": { + domain: "https://example.com", + }, + "Mix.Scheduler.Jobs.PublishScheduledPostsJob": {}, + "Mix.Scheduler.Jobs.SendMessageQueueJob": { + data: { + topic: "", + action: "", + data: {}, + }, + }, + "Mix.Scheduler.Jobs.SendPortalMessageJob": { + data: { + topic: "", + action: "", + data: "", + }, + }, + }; + $scope.schedule = { + jobData: { + data: { + type: "Info", + from: { + connectionId: "", + userName: "", + avatar: "", + }, + title: "value", + message: "content", + data: {}, + }, + }, + cronExpression: null, + name: null, + groupName: null, + jobName: null, + description: null, + startAt: null, + isStartNow: true, + interval: null, + intervalType: "Second", + repeatCount: null, + }; + $scope.updateMessageTemplate = () => { + if ($scope.templates[$scope.schedule.jobName]) { + $scope.schedule.jobData = null; + setTimeout(() => { + $scope.schedule.jobData = $scope.templates[$scope.schedule.jobName]; + $scope.$apply(); + }, 200); } - var resp = await service.filter($scope.request); - if (resp && resp.success) { - $scope.data = resp.data; - $.each($scope.data.items, function (i, data) { - $.each($scope.viewmodels, function (i, e) { - if (e.dataContentId === data.id) { - data.isHidden = true; + }; + $scope.init = function () { + $scope.getTriggers(); + $scope.getJobs(); + }; + + $scope.getSingle = async function () { + $scope.getJobs(); + $scope.getTrigger(); + }; + + $scope.getTrigger = async function () { + if ($routeParams.name) { + $rootScope.isBusy = true; + $scope.isReschedule = true; + var resp = await service.getTrigger($routeParams.name); + if (resp && resp.success) { + $scope.trigger = resp.data.trigger; + // $scope.schedule.trigger = $scope.trigger; + $scope.schedule.name = $scope.trigger.name; + $scope.schedule.jobName = $scope.trigger.jobName; + $scope.schedule.groupName = $scope.trigger.group; + // $scope.schedule.interval = $scope.trigger.repeatInterval; + $scope.schedule.repeatCount = $scope.trigger.repeatCount; + if ($scope.trigger.jobDataMap) { + if ($scope.trigger.jobDataMap.data) { + $scope.schedule.jobData = { + data: JSON.parse($scope.trigger.jobDataMap.data), + }; + } else { + $scope.schedule.jobData = $scope.trigger.jobDataMap; } - }); - }); - if ($scope.getListSuccessCallback) { - $scope.getListSuccessCallback(); - } - if ($scope.isScrollTop) { - $("html, body").animate({ scrollTop: "0px" }, 500); + } + $rootScope.isBusy = false; + $scope.$apply(); + } else { + if (resp) { + $rootScope.showErrors(resp.errors || ["Failed"]); + } + $rootScope.isBusy = false; + $scope.$apply(); } - $rootScope.isBusy = false; + } + }; + + $scope.createSchedule = async function () { + $rootScope.isBusy = true; + var resp = $scope.isReschedule + ? await service.reschedule($scope.schedule) + : await service.createSchedule($scope.schedule); + if (resp && resp.success) { + $rootScope.isBusy = true; + $location.url("/admin/scheduler"); $scope.$apply(); } else { if (resp) { $rootScope.showErrors(resp.errors || ["Failed"]); } - if ($scope.getListFailCallback) { - $scope.getListFailCallback(); - } $rootScope.isBusy = false; $scope.$apply(); } }; - $scope.loadMetadataDatabase = async function () { - var getMixDatabase = await databaseService.getByName(["Metadata"]); - let typeCol = getMixDatabase.data.columns.find( - (c) => c.systemName == "type" - ); - $scope.lstMetadata = typeCol.columnConfigurations.allowedValues; - $scope.$apply(); + $scope.execute = async function (name) { + try { + $rootScope.isBusy = true; + await service.execute(name); + $rootScope.isBusy = false; + $scope.$apply(); + } catch {} }; - $scope.loadAdditionalDatabases = async function () { - let getTypes = await databaseService.getList($scope.postTypeRequest); - if (getTypes.success) { - $scope.additionalDatabases = getTypes.data.items; - $scope.additionalDatabases.splice(0, 0, { - systemName: null, - displayName: "All", - id: 0, - }); - if ($scope.request.mixDatabaseName) { - $scope.additionalDatabase = $rootScope.findObjectByKey( - $scope.additionalDatabases, - "mixDatabaseName", - $scope.request.mixDatabaseName - ); - } - $scope.request.mixDatabaseName = $routeParams.type || ""; + $scope.updateJobData = function (content) { + try { + $scope.schedule.jobData = JSON.parse(content); $scope.$apply(); - } + } catch {} }; - $scope.getDefault = async function (type = null) { + $scope.pauseTrigger = async function (name) { $rootScope.isBusy = true; - type = type || $routeParams.type; - var resp = await service.getDefault({ - type: type || "", - template: $routeParams.template || "", - }); - if (resp.success) { - $scope.viewmodel = resp.data; - mixDbService.initDbName($scope.viewmodel.mixDatabaseName); - if ($scope.getSingleSuccessCallback) { - $scope.getSingleSuccessCallback(); - } - - // $scope.viewmodel.createdDateTime = Date.now(); - $scope.viewmodel.createdBy = $rootScope.authentication.username; - - $rootScope.isBusy = false; - $scope.$apply(); + var resp = await service.pauseTrigger(name); + if (resp && resp.success) { + $scope.schedule = resp.data; + await $scope.getTriggers(); } else { if (resp) { - $rootScope.showErrors(resp.errors); - } - if ($scope.getSingleFailCallback) { - $scope.getSingleFailCallback(); + $rootScope.showErrors(resp.errors || ["Failed"]); } $rootScope.isBusy = false; $scope.$apply(); } }; - $scope.preview = function (item) { - item.editUrl = "/admin/post/details/" + item.id; - $rootScope.preview("post", item, item.title, "modal-lg"); - }; - $scope.onSelectType = function () { - if ($scope.viewmodel) { - $scope.viewmodel.mixDatabaseName = $scope.additionalDatabase.systemName; - mixDbService.initDbName($scope.viewmodel.mixDatabaseName); - $scope.loadAdditionalData(); - } - $scope.request.additionalDatabase = - $scope.additionalDatabase.mixDatabaseName; - $scope.createUrl = `/admin/post/create?type=${$scope.request.additionalDatabase}`; - if ($routeParams.template) { - $scope.createUrl += `&template=${$routeParams.template}`; - } - if ( - $scope.additionalDatabase.mixDatabaseName && - (!$scope.viewmodel || !$scope.viewmodel.id) - ) { - $scope.getDefault($scope.request.additionalDatabase); - } - if ($scope.pageName == "postList") { - $scope.filter(); + + $scope.resumeTrigger = async function (name) { + $rootScope.isBusy = true; + var resp = await service.resumeTrigger(name); + if (resp && resp.success) { + $scope.schedule = resp.data; + await $scope.getTriggers(); + } else { + if (resp) { + $rootScope.showErrors(resp.errors || ["Failed"]); + } + $rootScope.isBusy = false; + $scope.$apply(); } }; - $scope.getListRelated = async function (pageIndex) { - if (pageIndex !== undefined) { - $scope.request.pageIndex = pageIndex; - } - if ($scope.request.fromDate !== null) { - var d = new Date($scope.request.fromDate); - $scope.request.fromDate = d.toISOString(); - } - if ($scope.request.toDate !== null) { - var d = new Date($scope.request.toDate); - $scope.request.toDate = d.toISOString(); - } - var resp = await service.filter($scope.request); + + $scope.getTriggers = async function () { + $rootScope.isBusy = true; + var resp = await service.getTriggers(); if (resp && resp.success) { - $scope.relatedData = angular.copy(resp.data); - $scope.relatedData.items = []; - angular.forEach(resp.data.items, (element) => { - let isActive = - null != - $scope.viewmodel.postNavs.find( - (p) => p.destinationId == element.id - ); - if (!isActive) { - var obj = { - description: element.title, - destinationId: element.id, - image: element.image, - isActived: isActive, - sourceId: $scope.viewmodel.id, - specificulture: $scope.viewmodel.specificulture, - status: "Published", - }; - result.push(obj); - } - }); - resp.data.items = result; + $scope.data = resp.data; $rootScope.isBusy = false; $scope.$apply(); - return resp.data; } else { - $rootScope.showErrors(getData.errors); + if (resp) { + $rootScope.showErrors(resp.errors || ["Failed"]); + } $rootScope.isBusy = false; $scope.$apply(); } }; - $scope.saveFailCallback = function () { - angular.forEach($scope.viewmodel.mixDatabaseNavs, function (nav) { - if (nav.isActived) { - $rootScope.decryptMixDatabase( - nav.mixDatabase.attributes, - nav.mixDatabase.postData.items - ); + $scope.getJobs = async function () { + $rootScope.isBusy = true; + var resp = await service.getJobs(); + if (resp && resp.success) { + $scope.jobs = resp.data; + $rootScope.isBusy = false; + $scope.$apply(); + } else { + if (resp) { + $rootScope.showErrors(resp.errors || ["Failed"]); } - }); + $rootScope.isBusy = false; + $scope.$apply(); + } }; - $scope.saveSuccessCallback = async function () { - if ($scope.additionalData && $scope.viewmodel.mixDatabaseName) { - var creating = !$scope.additionalData.parentId; - $scope.additionalData.parentType = "Post"; - $scope.additionalData.parentId = $scope.viewmodel.id; - mixDbService.initDbName($scope.viewmodel.mixDatabaseName); - var saveResult = await mixDbService.save($scope.additionalData); - if (saveResult.success) { - $rootScope.showMessage("Additional Data Saved", "success"); - $scope.additionalData = saveResult.data; - if (creating) { - $location.url(`/admin/post/details/${$scope.viewmodel.id}`); - } - } else { - $rootScope.showErrors(result.errors); + $scope.deleteJob = async function (name) { + $rootScope.isBusy = true; + var resp = await service.deleteJob(name); + if (resp && resp.success) { + $scope.getJobs(); + } else { + if (resp) { + $rootScope.showErrors(resp.errors || ["Failed"]); } - // $scope.additionalData.isClone = $scope.viewmodel.isClone; - // $scope.additionalData.cultures = $scope.viewmodel.cultures; - // $scope.additionalData.intParentId = $scope.viewmodel.id; - // $scope.additionalData.parentType = "Post"; - // let result = await dataService.save($scope.additionalData); - // if (!result.success) { - // $rootScope.showErrors(result.errors); - // } else { - // $scope.additionalData = result.data; - // // $scope.saveColumns(); - // } + $rootScope.isBusy = false; + $scope.$apply(); } - $rootScope.showMessage("success", "success"); - $rootScope.isBusy = false; - $scope.$apply(); }; + }, +]); - $scope.saveColumns = async function () { - let result = await columnService.saveMany($scope.additionalData.columns); - if (result.success) { - $rootScope.showMessage("success", "success"); - } +"use strict"; +app.factory("SchedulerService", [ + "AuthService", + "ApiService", + function (authService, apiService) { + var serviceFactory = {}; + serviceFactory.prefixUrl = "/scheduler"; + var _createSchedule = async function (schedule) { + var url = `${this.prefixUrl}/trigger/create`; + var req = { + serviceBase: this.serviceBase, + method: "POST", + url: url, + data: JSON.stringify(schedule), + }; + return await this.getRestApiResult(req); }; - $scope.getSingleSuccessCallback = async function () { - if (!$scope.viewmodel.id) { - $scope.viewmodel.mixDatabaseName = $routeParams.type; - } - mixDbService.initDbName($scope.viewmodel.mixDatabaseName); - await $scope.loadMetadataDatabase(); - // $scope.defaultThumbnailImgWidth = - // ngAppSettings.mixConfigurations.DefaultThumbnailImgWidth; - // $scope.defaultThumbnailImgHeight = - // ngAppSettings.mixConfigurations.DefaultThumbnailImgHeight; - - // $scope.defaultFeatureImgWidth = - // ngAppSettings.mixConfigurations.DefaultFeatureImgWidth; - // $scope.defaultFeatureImgHeight = - // ngAppSettings.mixConfigurations.DefaultFeatureImgHeight; - $scope.request.additionalDatabase = $scope.viewmodel.mixDatabaseName; - var moduleIds = $routeParams.moduleIds; - var pageIds = $routeParams.page_ids; - $scope.additionalDatabase = $rootScope.findObjectByKey( - $scope.additionalDatabases, - "systemName", - $scope.request.additionalDatabase - ); - $scope.loadAdditionalData(); - if (moduleIds) { - for (var moduleContentId of moduleIds.split(",")) { - var moduleNav = $rootScope.findObjectByKey( - $scope.viewmodel.modules, - "moduleContentId", - moduleContentId - ); - if (moduleNav) { - moduleNav.isActived = true; - } - } - } - if (pageIds) { - for (var pageId of pageIds.split(",")) { - var pageNav = $rootScope.findObjectByKey( - $scope.viewmodel.pages, - "pageId", - pageId - ); - if (pageNav) { - pageNav.isActived = true; - } - } - } + var _reschedule = async function (schedule) { + var url = `${this.prefixUrl}/reschedule`; + var req = { + serviceBase: this.serviceBase, + method: "POST", + url: url, + data: JSON.stringify(schedule), + }; + return await this.getRestApiResult(req); }; - $scope.loadAdditionalData = async function () { - if ($scope.viewmodel.mixDatabaseName) { - $scope.loadingData = true; - mixDbService.initDbName($scope.viewmodel.mixDatabaseName); - if ($scope.viewmodel.id) { - const getData = await mixDbService.getSingleByParent( - "Post", - $scope.viewmodel.id - ); - if (getData.success) { - $scope.additionalData = getData.data; - $scope.loadingData = false; - } - $scope.$apply(); - } else { - $scope.additionalData = { - parentType: "Post", - }; - $scope.loadingData = false; - } - } + var _execute = async function (name) { + var url = `${this.prefixUrl}/execute/${name}`; + var req = { + serviceBase: this.serviceBase, + method: "GET", + url: url, + }; + return await this.getRestApiResult(req); }; - $scope.generateSeo = function () { - if ($scope.viewmodel) { - if ( - $scope.viewmodel.seoName === null || - $scope.viewmodel.seoName === "" - ) { - $scope.viewmodel.seoName = $rootScope.generateKeyword( - $scope.viewmodel.title, - "-" - ); - if ($scope.viewmodel.seoName.length > 50) { - $scope.viewmodel.seoName = - $scope.viewmodel.seoName.substring(0, 80) + "..."; - } - } - if ( - $scope.viewmodel.seoTitle === null || - $scope.viewmodel.seoTitle === "" - ) { - $scope.viewmodel.seoTitle = $scope.viewmodel.title; - } - if ( - $scope.viewmodel.seoDescription === null || - $scope.viewmodel.seoDescription === "" - ) { - $scope.viewmodel.seoDescription = $scope.viewmodel.excerpt; - } - if ( - $scope.viewmodel.seoKeywords === null || - $scope.viewmodel.seoKeywords === "" - ) { - $scope.viewmodel.seoKeywords = $scope.viewmodel.title; - } - } - }; - $scope.addAlias = async function () { - var getAlias = await urlAliasService.getDefault(); - if (getAlias.success) { - $scope.viewmodel.urlAliases.push(getAlias.data); - $rootScope.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showErrors(getAlias.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - $scope.removeAliasCallback = async function (index) { - $scope.viewmodel.urlAliases.splice(index, 1); - $scope.$apply(); - }; - - $scope.validate = function () { - angular.forEach($scope.viewmodel.mixDatabaseNavs, function (nav) { - if (nav.isActived) { - $rootScope.encryptMixDatabase( - nav.mixDatabase.attributes, - nav.mixDatabase.postData.items - ); - } - }); - return true; - }; - }, -]); - -"use strict"; -app.factory("PostRestService", [ - "BaseRestService", - "ApiService", - function (baseService, apiService) { - var serviceFactory = Object.create(baseService); - serviceFactory.init("mix-post-content"); - var _syncProducts = async function (names) { - var url = `/api/daphale/sync/products`; + var _pauseTrigger = async function (name) { + var url = `${this.prefixUrl}/trigger/pause/${name}`; var req = { - serviceBase: "", - method: "POST", + serviceBase: this.serviceBase, + method: "GET", url: url, - data: { - batch: 50, - isScaleImage: true, - isSyncPrice: true, - isSyncAll: false, - productNames: names, - }, }; - return await apiService.sendPureRequest(req); + return await this.getRestApiResult(req); }; - var _filter = async function (request) { - var url = `${this.prefixUrl}/filter`; + + var _resumeTrigger = async function (name) { + var url = `${this.prefixUrl}/trigger/resume/${name}`; var req = { serviceBase: this.serviceBase, - method: "POST", + method: "GET", url: url, - data: request, }; return await this.getRestApiResult(req); }; - // Define more service methods here - serviceFactory.filter = _filter; - serviceFactory.syncProducts = _syncProducts; - return serviceFactory; - }, -]); - -"use strict"; -app.controller("RoleController", [ - "$scope", - "$rootScope", - "$location", - "$routeParams", - "ngAppSettings", - "RestMixDatabaseDataPortalService", - "RestMixDatabaseColumnPortalService", - "RoleService", - function ( - $scope, - $rootScope, - $location, - $routeParams, - ngAppSettings, - dataService, - columnService, - service - ) { - BaseRestCtrl.call( - this, - $scope, - $rootScope, - $location, - $routeParams, - ngAppSettings, - service - ); - $scope.role = { name: "" }; - $scope.initPermissions = async function () { - let backUrl = "/admin/role/list"; - $scope.createUrl = `/admin/mix-database-data/create?mixDatabaseName=sysPermission&dataContentId=default&parentId=${$scope.viewmodel.id}&parentName=Role&backUrl=${backUrl}`; - $scope.updateUrl = "/admin/mix-database-data/details"; - }; - $scope.createRole = async function () { - $rootScope.isBusy = true; - var result = await service.createRole($scope.role.name); - if (result.success) { - $scope.role.name = ""; - $scope.getList(); - } else { - $rootScope.showErrors(result.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } + var _getTrigger = async function (name) { + var url = `${this.prefixUrl}/trigger/${name}`; + var req = { + serviceBase: this.serviceBase, + method: "GET", + url: url, + }; + return await this.getRestApiResult(req); }; - }, -]); - -"use strict"; -app.factory("RoleService", [ - "BaseRestService", - "ApiService", - "CommonService", - function (baseService, apiService, commonService) { - var serviceFactory = Object.create(baseService); - serviceFactory.initService("/rest/auth", "role", true); - var _getPermissions = async function () { + var _getTriggers = async function () { + var url = `${this.prefixUrl}/trigger`; var req = { + serviceBase: this.serviceBase, method: "GET", - url: this.prefixUrl + "/permissions", + url: url, }; - return await apiService.sendRequest(req); + return await this.getRestApiResult(req); }; - var _updatePermission = async function (permission) { + var _getJobs = async function () { + var url = `${this.prefixUrl}/job`; var req = { - method: "POST", - url: this.prefixUrl + "/update-permission", - data: JSON.stringify(permission), + serviceBase: this.serviceBase, + method: "GET", + url: url, }; - return await apiService.sendRequest(req); + return await this.getRestApiResult(req); }; - var _createRole = function (name) { + + var _deleteJob = async function (name) { + var url = `${this.prefixUrl}/job/${name}`; var req = { - method: "POST", - url: this.prefixUrl + "/create", - data: JSON.stringify(name), + serviceBase: this.serviceBase, + method: "DELETE", + url: url, }; + return await this.getRestApiResult(req); + }; - return apiService.sendRequest(req); + var _getRestApiResult = async function (req) { + if (!authService.authentication) { + await authService.fillAuthData(); + } + if (authService.authentication) { + req.Authorization = authService.authentication.accessToken; + } + if (!req.headers) { + req.headers = { + "Content-Type": "application/json", + }; + } + req.headers.Authorization = "Bearer " + req.Authorization || ""; + + return apiService.sendRequest(req).then(function (resp) { + return resp; + }); }; - serviceFactory.createRole = _createRole; - serviceFactory.getPermissions = _getPermissions; - serviceFactory.updatePermission = _updatePermission; + var _parseQuery = function (req) { + var result = ""; + if (req) { + for (var key in req) { + if (angular.isObject(req.query)) { + req.query = JSON.stringify(req.query); + } + if (req.hasOwnProperty(key) && req[key]) { + if (result != "") { + result += "&"; + } + result += `${key}=${req[key]}`; + } + } + return result; + } else { + return result; + } + }; + serviceFactory.execute = _execute; + serviceFactory.parseQuery = _parseQuery; + serviceFactory.getRestApiResult = _getRestApiResult; + serviceFactory.createSchedule = _createSchedule; + serviceFactory.reschedule = _reschedule; + serviceFactory.getJobs = _getJobs; + serviceFactory.deleteJob = _deleteJob; + serviceFactory.getTrigger = _getTrigger; + serviceFactory.getTriggers = _getTriggers; + serviceFactory.pauseTrigger = _pauseTrigger; + serviceFactory.resumeTrigger = _resumeTrigger; return serviceFactory; }, ]); @@ -5490,7 +5733,7 @@ app.controller("ServiceController", [ $scope.others = []; $scope.mixConfigurations = $rootScope.globalSettings; $scope.canDrag = - $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; $scope.init = async function () { $scope.mixDatabaseId = $routeParams.mixDatabaseId; $scope.mixDatabaseName = $routeParams.mixDatabaseName; @@ -5521,7 +5764,7 @@ app.controller("ServiceController", [ parentId ); $scope.canDrag = - $scope.request.orderBy !== "Priority" || + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; if (response) { $scope.data = response; @@ -5883,30 +6126,11 @@ app.controller("SocialFeedController", [ ]); "use strict"; -app.controller("StoreController", [ +app.controller("TemplateController", [ "$scope", "$rootScope", - "ngAppSettings", - "CryptoService", - "ThemeService", - "StoreService", - function ( - $scope, - $rootScope, - ngAppSettings, - cryptoService, - themeService, - service - ) { - }, -]); - -"use strict"; -app.controller("TemplateController", [ - "$scope", - "$rootScope", - "$routeParams", - "$location", + "$routeParams", + "$location", "ngAppSettings", "AuthService", "TemplateService", @@ -6133,6 +6357,173 @@ app.controller("TemplateController", [ }, ]); +"use strict"; +app.controller("StoreController", [ + "$scope", + "$rootScope", + "ngAppSettings", + "CryptoService", + "ThemeService", + "StoreService", + function ( + $scope, + $rootScope, + ngAppSettings, + cryptoService, + themeService, + service + ) { + }, +]); + +"use strict"; +app.controller("TenantController", [ + "$scope", + "$rootScope", + "ngAppSettings", + "$location", + "$routeParams", + "TenantRestService", + function ( + $scope, + $rootScope, + ngAppSettings, + $location, + $routeParams, + service + ) { + BaseRestCtrl.call( + this, + $scope, + $rootScope, + $location, + $routeParams, + ngAppSettings, + service + ); + $scope.request.columns = [ + "id", + "displayName", + "systemName", + "primaryDomain", + "createdDateTime", + "createdBy", + ]; + $scope.canDrag = + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; + }, +]); + +"use strict"; +app.factory("TenantRestService", [ + "BaseRestService", + function (baseService) { + var serviceFactory = Object.create(baseService); + serviceFactory.init("mix-tenant"); + return serviceFactory; + }, +]); + +"use strict"; +app.controller("ThemeImportController", [ + "$scope", + "$rootScope", + "ngAppSettings", + "$routeParams", + "$location", + "ApiService", + "ThemeService", + function ( + $scope, + $rootScope, + ngAppSettings, + $routeParams, + $location, + apiService, + themeService + ) { + $scope.importData = null; + $scope.importThemeDto = { + postIds: [], + pageIds: [], + moduleIds: [], + mixDatabaseIds: [], + configurationIds: [], + languageIds: [], + mixDatabaseDataIds: [], + isIncludeAssets: false, + isIncludeTemplates: false, + }; + $scope.init = function () {}; + $scope.getSingleSuccessCallback = function () { + $scope.assets = null; + $scope.theme = null; + }; + $scope.submit = async function () { + $scope.form = document.getElementById("form-portal"); + let theme = $scope.form["theme"].files[0]; + if (theme) { + await $scope.extract(theme); + document.getElementById("form-portal")["theme"].value = ""; + } else { + $scope.import(); + } + }; + $scope.extract = async function (theme) { + $rootScope.isBusy = true; + var frm = new FormData(); + var url = "/rest/mix-tenancy/setup/extract-theme"; + $rootScope.isBusy = true; + // Looping over all files and add it to FormData object + frm.append("theme", theme); + // Adding one more key to FormData object + frm.append("model", angular.toJson($scope.data)); + var response = await apiService.ajaxSubmitForm(frm, url); + $rootScope.isBusy = false; + if (response.success) { + var getData = await $scope.loadTheme(); + if (getData.success) { + $scope.importData = getData.data; + $rootScope.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showErrors(getData.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } + } else { + $rootScope.showErrors(response.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } + }; + + $scope.loadTheme = async function () { + var req = { + method: "GET", + url: "/rest/mix-tenancy/setup/load-theme", + }; + return await apiService.sendRequest(req); + }; + + $scope.import = async function () { + $scope.importThemeDto.themeId = $routeParams.id; + $rootScope.isBusy = true; + var response = await themeService.import($scope.importThemeDto); + + if (response.success) { + $rootScope.isBusy = false; + window.open("/", "_blank"); + $scope.$apply(); + } else { + $rootScope.showErrors(response.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } + }; + }, +]); + "use strict"; app.controller("ThemeController", [ "$scope", @@ -6176,6 +6567,7 @@ app.controller("ThemeController", [ moduleIds: [], moduleContentIds: [], mixDatabaseIds: [], + mixDatabaseDataIds: [], mixDatabaseContextIds: [], }, associations: { @@ -6315,14 +6707,14 @@ app.controller("UrlAliasController", [ $scope.mixConfigurations = $rootScope.globalSettings; $scope.pageId = $routeParams.id; $scope.canDrag = - $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; $scope.getList = async function () { $rootScope.isBusy = true; var id = $routeParams.id; $scope.request.query = "&page_id=" + id; var response = await service.getList($scope.request); $scope.canDrag = - $scope.request.orderBy !== "Priority" || + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; if (response.success) { $scope.data = response.data; @@ -6411,54 +6803,6 @@ app.factory("UrlAliasService", [ }, ]); -"use strict"; -app.controller("TenantController", [ - "$scope", - "$rootScope", - "ngAppSettings", - "$location", - "$routeParams", - "TenantRestService", - function ( - $scope, - $rootScope, - ngAppSettings, - $location, - $routeParams, - service - ) { - BaseRestCtrl.call( - this, - $scope, - $rootScope, - $location, - $routeParams, - ngAppSettings, - service - ); - $scope.request.columns = [ - "id", - "displayName", - "systemName", - "primaryDomain", - "createdDateTime", - "createdBy", - ]; - $scope.canDrag = - $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; - }, -]); - -"use strict"; -app.factory("TenantRestService", [ - "BaseRestService", - function (baseService) { - var serviceFactory = Object.create(baseService); - serviceFactory.init("mix-tenant"); - return serviceFactory; - }, -]); - "use strict"; app.controller("UserController", [ "$scope", @@ -6485,7 +6829,7 @@ app.controller("UserController", [ pageSize: "10", pageIndex: 0, status: "Published", - orderBy: "CreatedDateTime", + sortBy: "Id", direction: "Desc", fromDate: null, toDate: null, @@ -6877,91 +7221,6 @@ app.factory("UserServices", [ }, ]); -"use strict"; -app.controller("ThemeImportController", [ - "$scope", - "$rootScope", - "ngAppSettings", - "$routeParams", - "$location", - "ApiService", - "ThemeService", - function ( - $scope, - $rootScope, - ngAppSettings, - $routeParams, - $location, - apiService, - themeService - ) { - $scope.importData = null; - $scope.init = function () {}; - $scope.getSingleSuccessCallback = function () { - $scope.assets = null; - $scope.theme = null; - }; - $scope.submit = async function () { - $scope.form = document.getElementById("form-portal"); - let theme = $scope.form["theme"].files[0]; - if (theme) { - await $scope.extract(theme); - document.getElementById("form-portal")["theme"].value = ""; - } else { - $scope.import(); - } - }; - $scope.extract = async function (theme) { - $rootScope.isBusy = true; - var frm = new FormData(); - var url = "/rest/mix-tenancy/setup/extract-theme"; - $rootScope.isBusy = true; - // Looping over all files and add it to FormData object - frm.append("theme", theme); - // Adding one more key to FormData object - frm.append("model", angular.toJson($scope.data)); - var response = await apiService.ajaxSubmitForm(frm, url); - $rootScope.isBusy = false; - if (response.success) { - var getData = await $scope.loadTheme(); - if (getData.success) { - $scope.importThemeDto = getData.data; - $rootScope.isBusy = false; - $scope.$apply(); - } - } else { - $rootScope.showErrors(response.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - - $scope.loadTheme = async function () { - var req = { - method: "GET", - url: "/rest/mix-tenancy/setup/load-theme", - }; - return await apiService.sendRequest(req); - }; - - $scope.import = async function () { - $scope.importThemeDto.themeId = $routeParams.id; - $rootScope.isBusy = true; - var response = await themeService.import($scope.importThemeDto); - - if (response.success) { - $rootScope.isBusy = false; - window.open("/", "_blank"); - $scope.$apply(); - } else { - $rootScope.showErrors(response.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - }, -]); - "use strict"; function PageDetailsController($scope, $element, $attrs) { var ctrl = this; @@ -7294,37 +7553,6 @@ app.component("appSettingsHeart", { ], }); -app.component("appSettingsGeneral", { - templateUrl: - "/mix-app/views/app-portal/pages/app-settings/components/general/view.html", - controller: [ - "$rootScope", - "$scope", - "CryptoService", - "CommonService", - function ($rootScope, $scope, cryptoService, commonService) { - var ctrl = this; - ctrl.$onInit = () => { - var key = cryptoService.parseKeys(ctrl.appSettings.apiEncryptKey); - ctrl.apiKey = key.key; - ctrl.iv = key.iv; - }; - ctrl.stopApplication = async function () { - $rootScope.isBusy = true; - await commonService.stopApplication(); - $rootScope.showMessage("success", "success"); - $rootScope.isBusy = false; - $scope.$apply(); - }; - }, - ], - bindings: { - appSettings: "=", - onDelete: "&", - onUpdate: "&", - }, -}); - app.component("appSettingsSmtp", { templateUrl: "/mix-app/views/app-portal/pages/app-settings/components/smtp/view.html", @@ -7410,6 +7638,16 @@ app.component("customerOrders", { }, }); +app.component("customerMain", { + templateUrl: + "/mix-app/views/app-portal/pages/customer/components/main/customer-main.html", + bindings: { + customer: "=", + onDelete: "&", + onUpdate: "&", + }, +}); + app.component("mixDatabaseEdm", { templateUrl: "/mix-app/views/app-portal/pages/mix-database/components/edm/view.html", @@ -7425,16 +7663,75 @@ app.component("mixDatabaseEdm", { }, }); -app.component("customerMain", { +app.component("appSettingsGeneral", { templateUrl: - "/mix-app/views/app-portal/pages/customer/components/main/customer-main.html", + "/mix-app/views/app-portal/pages/app-settings/components/general/view.html", + controller: [ + "$rootScope", + "$scope", + "CryptoService", + "CommonService", + function ($rootScope, $scope, cryptoService, commonService) { + var ctrl = this; + ctrl.$onInit = () => { + var key = cryptoService.parseKeys(ctrl.appSettings.apiEncryptKey); + ctrl.apiKey = key.key; + ctrl.iv = key.iv; + }; + ctrl.stopApplication = async function () { + $rootScope.isBusy = true; + await commonService.stopApplication(); + $rootScope.showMessage("success", "success"); + $rootScope.isBusy = false; + $scope.$apply(); + }; + }, + ], bindings: { - customer: "=", + appSettings: "=", onDelete: "&", onUpdate: "&", }, }); +app.component("mixDatabaseMain", { + templateUrl: + "/mix-app/views/app-portal/pages/mix-database/components/main/view.html", + controller: [ + "$rootScope", + function ($rootScope) { + var ctrl = this; + + ctrl.$onInit = () => { + ctrl.globalSettings = $rootScope.globalSettings; + ctrl.isInRole = $rootScope.isInRole; + }; + ctrl.gennerateName = function () { + if ( + !ctrl.model.id || + ctrl.model.systemName === null || + ctrl.model.systemName === "" + ) { + let prefix = ctrl.model.type == "System" ? "sys" : ""; + ctrl.model.systemName = $rootScope.generateKeyword( + `${prefix} ${ctrl.model.displayName}`, + ctrl.model.namingConvention == "TitleCase" ? "" : "_", + ctrl.model.namingConvention == "TitleCase", + true + ); + if (ctrl.schema) { + ctrl.model.systemName = `${ctrl.schema}${ctrl.model.systemName}`; + } + } + }; + }, + ], + bindings: { + model: "=", + schema: "=?", + }, +}); + app.component("mixdbContextDatabases", { bindings: { model: "=", @@ -7525,47 +7822,28 @@ app.component("moduleMain", { }, }); -app.component("mixDatabaseMain", { +app.component("moduleAdvanced", { templateUrl: - "/mix-app/views/app-portal/pages/mix-database/components/main/view.html", + "/mix-app/views/app-portal/pages/module/components/module-advanced/view.html", + bindings: { + model: "=", + additionalData: "=", + }, controller: [ "$rootScope", function ($rootScope) { var ctrl = this; - - ctrl.$onInit = () => { - ctrl.globalSettings = $rootScope.globalSettings; - ctrl.isInRole = $rootScope.isInRole; - }; - ctrl.gennerateName = function () { - if ( - !ctrl.model.id || - ctrl.model.systemName === null || - ctrl.model.systemName === "" - ) { - let prefix = ctrl.model.type == "System" ? "sys" : ""; - ctrl.model.systemName = $rootScope.generateKeyword( - `${prefix} ${ctrl.model.displayName}`, - ctrl.model.namingConvention == "TitleCase" ? "" : "_", - ctrl.model.namingConvention == "TitleCase", - true - ); - if (ctrl.schema) { - ctrl.model.systemName = `${ctrl.schema}_${ctrl.model.systemName}`; - } - } + ctrl.mixConfigurations = $rootScope.globalSettings; + ctrl.$onInit = function () { + ctrl.isAdmin = $rootScope.isAdmin; }; }, ], - bindings: { - model: "=", - schema: "=?", - }, }); -app.component("moduleAdvanced", { +app.component("moduleContent", { templateUrl: - "/mix-app/views/app-portal/pages/module/components/module-advanced/view.html", + "/mix-app/views/app-portal/pages/module/components/module-content/view.html", bindings: { model: "=", additionalData: "=", @@ -7574,10 +7852,10 @@ app.component("moduleAdvanced", { "$rootScope", function ($rootScope) { var ctrl = this; - ctrl.mixConfigurations = $rootScope.globalSettings; ctrl.$onInit = function () { - ctrl.isAdmin = $rootScope.isAdmin; + ctrl.backUrl = `/admin/module/details`; }; + ctrl.mixConfigurations = $rootScope.globalSettings; }, ], }); @@ -7597,49 +7875,6 @@ app.component("moduleType", { }, }); -app.component("pageMain", { - templateUrl: "/mix-app/views/app-portal/pages/page/components/main/main.html", - controller: [ - "$rootScope", - "$scope", - "ngAppSettings", - function ($rootScope, $scope) { - var ctrl = this; - ctrl.mixConfigurations = $rootScope.globalSettings; - // ctrl.setPageType = function (type) { - // ctrl.page.type = $index; - // } - ctrl.generateSeo = function () { - if (ctrl.page) { - if (ctrl.page.seoName === null || ctrl.page.seoName === "") { - ctrl.page.seoName = $rootScope.generateKeyword( - ctrl.page.title, - "-" - ); - } - if (ctrl.page.seoTitle === null || ctrl.page.seoTitle === "") { - ctrl.page.seoTitle = ctrl.page.title; - } - if ( - ctrl.page.seoDescription === null || - ctrl.page.seoDescription === "" - ) { - ctrl.page.seoDescription = ctrl.page.excerpt; - } - if (ctrl.page.seoKeywords === null || ctrl.page.seoKeywords === "") { - ctrl.page.seoKeywords = ctrl.page.title; - } - } - }; - }, - ], - bindings: { - page: "=", - onDelete: "&", - onUpdate: "&", - }, -}); - app.component("pageGeneral", { templateUrl: "/mix-app/views/app-portal/pages/page/components/general/general.html", @@ -7747,21 +7982,66 @@ app.component("pageGeneral", { }, }); -app.component("moduleContent", { - templateUrl: - "/mix-app/views/app-portal/pages/module/components/module-content/view.html", - bindings: { - model: "=", - additionalData: "=", - }, +app.component("pageMain", { + templateUrl: "/mix-app/views/app-portal/pages/page/components/main/main.html", controller: [ "$rootScope", - function ($rootScope) { + "$scope", + "ngAppSettings", + function ($rootScope, $scope) { var ctrl = this; - ctrl.$onInit = function () { - ctrl.backUrl = `/admin/module/details`; - }; ctrl.mixConfigurations = $rootScope.globalSettings; + // ctrl.setPageType = function (type) { + // ctrl.page.type = $index; + // } + ctrl.generateSeo = function () { + if (ctrl.page) { + if (ctrl.page.seoName === null || ctrl.page.seoName === "") { + ctrl.page.seoName = $rootScope.generateKeyword( + ctrl.page.title, + "-" + ); + } + if (ctrl.page.seoTitle === null || ctrl.page.seoTitle === "") { + ctrl.page.seoTitle = ctrl.page.title; + } + if ( + ctrl.page.seoDescription === null || + ctrl.page.seoDescription === "" + ) { + ctrl.page.seoDescription = ctrl.page.excerpt; + } + if (ctrl.page.seoKeywords === null || ctrl.page.seoKeywords === "") { + ctrl.page.seoKeywords = ctrl.page.title; + } + } + }; + }, + ], + bindings: { + page: "=", + onDelete: "&", + onUpdate: "&", + }, +}); + +app.component("pageAdvanced", { + templateUrl: + "/mix-app/views/app-portal/pages/page/components/page-advanced/view.html", + bindings: { + model: "=", + additionalData: "=", + }, + controller: [ + "$rootScope", + "$scope", + function ($rootScope, $scope) { + var ctrl = this; + + ctrl.translate = $rootScope.translate; + ctrl.$onInit = function () { + ctrl.isAdmin = $rootScope.isAdmin; + }; }, ], }); @@ -7811,42 +8091,6 @@ app.component("pageModules", { ], }); -app.component("pageAdvanced", { - templateUrl: - "/mix-app/views/app-portal/pages/page/components/page-advanced/view.html", - bindings: { - model: "=", - additionalData: "=", - }, - controller: [ - "$rootScope", - "$scope", - function ($rootScope, $scope) { - var ctrl = this; - - ctrl.translate = $rootScope.translate; - ctrl.$onInit = function () { - ctrl.isAdmin = $rootScope.isAdmin; - }; - }, - ], -}); - -app.component("pageType", { - templateUrl: - "/mix-app/views/app-portal/pages/page/components/page-type/view.html", - bindings: { - model: "=", - }, - controller: [ - "$rootScope", - function ($rootScope) { - var ctrl = this; - ctrl.localizeSettings = $rootScope.globalSettings; - }, - ], -}); - app.component("pageContent", { templateUrl: "/mix-app/views/app-portal/pages/page/components/page-content/view.html", @@ -7892,52 +8136,19 @@ app.component("pageContent", { ], }); -app.component("pagePlugPlay", { +app.component("pageType", { templateUrl: - "/mix-app/views/app-portal/pages/page/components/plug-play/plug-play.html", + "/mix-app/views/app-portal/pages/page/components/page-type/view.html", bindings: { - page: "=", - onDelete: "&", - onUpdate: "&", + model: "=", }, -}); - -app.component("permissionMain", { - templateUrl: - "/mix-app/views/app-portal/pages/permission/components/main/main.html", controller: [ "$rootScope", - "$scope", - "ngAppSettings", - "$routeParams", - function ($rootScope, $scope, ngAppSettings, $routeParams) { + function ($rootScope) { var ctrl = this; - ctrl.mixConfigurations = $rootScope.globalSettings; - ctrl.icons = ngAppSettings.icons; - ctrl.setPageType = function (type) { - ctrl.page.type = $index; - }; - ctrl.generateKeyword = function (text) { - if (!$routeParams.id && text) { - ctrl.page.textKeyword = - "portal_" + - text - .replace(/[^a-zA-Z0-9]+/g, "_") - .replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2") - .replace(/([a-z])([A-Z])/g, "$1-$2") - .replace(/([0-9])([^0-9])/g, "$1-$2") - .replace(/([^0-9])([0-9])/g, "$1-$2") - .replace(/-+/g, "_") - .toLowerCase(); - } - }; + ctrl.localizeSettings = $rootScope.globalSettings; }, ], - bindings: { - page: "=", - onDelete: "&", - onUpdate: "&", - }, }); app.component("pageParents", { @@ -7950,17 +8161,9 @@ app.component("pageParents", { }, }); -app.component("pageSeo", { - templateUrl: "/mix-app/views/app-portal/pages/page/components/seo/seo.html", - controller: [ - "$rootScope", - function ($rootScope) { - var ctrl = this; - ctrl.translate = function (keyword) { - return $rootScope.translate(keyword); - }; - }, - ], +app.component("pagePlugPlay", { + templateUrl: + "/mix-app/views/app-portal/pages/page/components/plug-play/plug-play.html", bindings: { page: "=", onDelete: "&", @@ -8004,9 +8207,55 @@ app.component("productRelated", { }, }); -app.component("permissionParents", { +app.component("pageSeo", { + templateUrl: "/mix-app/views/app-portal/pages/page/components/seo/seo.html", + controller: [ + "$rootScope", + function ($rootScope) { + var ctrl = this; + ctrl.translate = function (keyword) { + return $rootScope.translate(keyword); + }; + }, + ], + bindings: { + page: "=", + onDelete: "&", + onUpdate: "&", + }, +}); + +app.component("permissionMain", { templateUrl: - "/mix-app/views/app-portal/pages/permission/components/parents/parents.html", + "/mix-app/views/app-portal/pages/permission/components/main/main.html", + controller: [ + "$rootScope", + "$scope", + "ngAppSettings", + "$routeParams", + function ($rootScope, $scope, ngAppSettings, $routeParams) { + var ctrl = this; + ctrl.mixConfigurations = $rootScope.globalSettings; + ctrl.icons = ngAppSettings.icons; + ctrl.setPageType = function (type) { + ctrl.page.type = $index; + }; + ctrl.generateKeyword = function (text) { + if (!$routeParams.id && text) { + ctrl.page.textKeyword = + "portal_" + + text + .replace(/[^a-zA-Z0-9]+/g, "_") + .replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2") + .replace(/([a-z])([A-Z])/g, "$1-$2") + .replace(/([0-9])([^0-9])/g, "$1-$2") + .replace(/([^0-9])([0-9])/g, "$1-$2") + .replace(/-+/g, "_") + .toLowerCase(); + } + }; + }, + ], bindings: { page: "=", onDelete: "&", @@ -8039,7 +8288,7 @@ app.component("permissionPlugPlay", { pageSize: "5", pageIndex: 0, status: "Published", - orderBy: "CreatedDateTime", + sortBy: "Id", direction: "Desc", fromDate: null, toDate: null, @@ -8113,38 +8362,14 @@ app.component("permissionPlugPlay", { ], }); -app.component("postMain", { - templateUrl: "/mix-app/views/app-portal/pages/post/components/main/view.html", +app.component("permissionParents", { + templateUrl: + "/mix-app/views/app-portal/pages/permission/components/parents/parents.html", bindings: { - post: "=", + page: "=", + onDelete: "&", + onUpdate: "&", }, - controller: [ - "$rootScope", - "$scope", - function ($rootScope, $scope) { - var ctrl = this; - ctrl.translate = $rootScope.translate; - ctrl.generateSeo = function () { - if (ctrl.post) { - if (!ctrl.post.seoName) { - ctrl.post.seoName = $rootScope.generateKeyword( - ctrl.post.title, - "-" - ); - } - if (!ctrl.post.seoTitle) { - ctrl.post.seoTitle = ctrl.post.title; - } - if (!ctrl.post.seoDescription === null) { - ctrl.post.seoDescription = ctrl.post.excerpt; - } - if (!ctrl.post.seoKeywords) { - ctrl.post.seoKeywords = ctrl.post.title; - } - } - }; - }, - ], }); modules.component("postFilterList", { @@ -8266,30 +8491,64 @@ app.component("postGeneral", { }, }); -app.component("postMedias", { - templateUrl: - "/mix-app/views/app-portal/pages/post/components/medias/view.html", - controller: function () { - var ctrl = this; - ctrl.activeMedia = function (media) { - var currentItem = null; - if (ctrl.post.mediaNavs === null) { - ctrl.post.mediaNavs = []; - } - $.each(ctrl.post.mediaNavs, function (i, e) { - if (e.mediaId === media.id) { - e.isActived = media.isActived; - currentItem = e; - return false; - } - }); - if (currentItem === null) { - currentItem = { - description: - media.description !== "undefined" ? media.description : "", - image: media.filePath, - mediaId: media.id, - post: ctrl.post.id, +app.component("postMain", { + templateUrl: "/mix-app/views/app-portal/pages/post/components/main/view.html", + bindings: { + post: "=", + }, + controller: [ + "$rootScope", + "$scope", + function ($rootScope, $scope) { + var ctrl = this; + ctrl.translate = $rootScope.translate; + ctrl.generateSeo = function () { + if (ctrl.post) { + if (!ctrl.post.seoName) { + ctrl.post.seoName = $rootScope.generateKeyword( + ctrl.post.title, + "-" + ); + } + if (!ctrl.post.seoTitle) { + ctrl.post.seoTitle = ctrl.post.title; + } + if (!ctrl.post.seoDescription === null) { + ctrl.post.seoDescription = ctrl.post.excerpt; + } + if (!ctrl.post.seoKeywords) { + ctrl.post.seoKeywords = ctrl.post.title; + } + } + }; + }, + ], +}); + +app.component("postMedias", { + templateUrl: + "/mix-app/views/app-portal/pages/post/components/medias/view.html", + controller: function () { + var ctrl = this; + ctrl.activeMedia = function (media) { + var currentItem = null; + if (ctrl.post.mediaNavs === null) { + ctrl.post.mediaNavs = []; + } + $.each(ctrl.post.mediaNavs, function (i, e) { + if (e.mediaId === media.id) { + e.isActived = media.isActived; + currentItem = e; + return false; + } + }); + if (currentItem === null) { + currentItem = { + description: + media.description !== "undefined" ? media.description : "", + image: media.filePath, + mediaId: media.id, + post: ctrl.post.id, specificulture: media.specificulture, position: 0, priority: ctrl.post.mediaNavs.length + 1, @@ -8402,6 +8661,33 @@ app.component("postModules", { }, }); +app.component("postAdvanced", { + templateUrl: + "/mix-app/views/app-portal/pages/post/components/post-advanced/view.html", + bindings: { + model: "=", + additionalData: "=", + }, + controller: [ + "$rootScope", + "$scope", + "$routeParams", + function ($rootScope, $scope, $routeParams) { + var ctrl = this; + ctrl.translate = $rootScope.translate; + ctrl.$onInit = function () { + ctrl.isAdmin = $rootScope.isAdmin; + if ($routeParams.template) { + ctrl.defaultTemplate = $routeParams.template; + } + if ($routeParams.layout) { + ctrl.defaultLayout = $routeParams.layout; + } + }; + }, + ], +}); + app.component("postContent", { templateUrl: "/mix-app/views/app-portal/pages/post/components/post-content/view.html", @@ -8496,6 +8782,15 @@ app.component("postContent", { ], }); +app.component("postSeo", { + templateUrl: "/mix-app/views/app-portal/pages/post/components/seo/view.html", + bindings: { + post: "=", + onDelete: "&", + onUpdate: "&", + }, +}); + modules.component("relatedPosts", { templateUrl: "/mix-app/views/app-portal/pages/post/components/related-navigations/view.html", @@ -8637,52 +8932,6 @@ modules.component("relatedPosts", { ], }); -app.component("postAdvanced", { - templateUrl: - "/mix-app/views/app-portal/pages/post/components/post-advanced/view.html", - bindings: { - model: "=", - additionalData: "=", - }, - controller: [ - "$rootScope", - "$scope", - "$routeParams", - function ($rootScope, $scope, $routeParams) { - var ctrl = this; - ctrl.translate = $rootScope.translate; - ctrl.$onInit = function () { - ctrl.isAdmin = $rootScope.isAdmin; - if ($routeParams.template) { - ctrl.defaultTemplate = $routeParams.template; - } - if ($routeParams.layout) { - ctrl.defaultLayout = $routeParams.layout; - } - }; - }, - ], -}); - -app.component("postSeo", { - templateUrl: "/mix-app/views/app-portal/pages/post/components/seo/view.html", - bindings: { - post: "=", - onDelete: "&", - onUpdate: "&", - }, -}); - -app.component("postParents", { - templateUrl: - "/mix-app/views/app-portal/pages/post/components/parents/view.html", - bindings: { - post: "=", - onDelete: "&", - onUpdate: "&", - }, -}); - modules.component("rolePageNav", { templateUrl: "/mix-app/views/app-portal/pages/role/components/role-page-navigation/role-page-navigations.html", @@ -8724,76 +8973,6 @@ modules.component("rolePageNav", { ], }); -app.component("themeExportCultures", { - templateUrl: - "/mix-app/views/app-portal/pages/theme/components/theme-export-cultures/view.html", - controller: [ - "$rootScope", - "$scope", - "ngAppSettings", - function ($rootScope, $scope, ngAppSettings) { - var ctrl = this; - var service = $rootScope.getRestService("culture"); - ctrl.selectAllContent = false; - ctrl.request = angular.copy(ngAppSettings.request); - ctrl.$onInit = async () => { - ctrl.getList(); - }; - ctrl.getList = async (cultureIndex) => { - if (cultureIndex !== undefined) { - ctrl.request.cultureIndex = cultureIndex; - } - if (ctrl.request.fromDate !== null) { - var d = new Date(ctrl.request.fromDate); - ctrl.request.fromDate = d.toISOString(); - } - if (ctrl.request.toDate !== null) { - var d = new Date(ctrl.request.toDate); - ctrl.request.toDate = d.toISOString(); - } - let getData = await service.getList(ctrl.request); - if (getData.success) { - ctrl.data = getData.data; - } - }; - ctrl.selectContent = (culture, selected) => { - ctrl.selectAllContent = ctrl.selectAllContent && selected; - ctrl.selectAllData = ctrl.selectAllData && selected; - culture.isExportData = selected && culture.isExportData; - ctrl.updateContent([culture.id], selected); - }; - ctrl.updateContent = function (arr, selected) { - if (selected) { - ctrl.exportThemeDto.cultureIds = ctrl.unionArray( - ctrl.exportThemeDto.cultureIds, - arr - ); - } else { - ctrl.exportThemeDto.cultureIds = - ctrl.exportThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0); - ctrl.updateData(arr, false); - } - }; - ctrl.selectAll = function (arr) { - // ctrl.selectedList.data = []; - var ids = arr.map(function (obj) { - return obj.id; - }); - ctrl.updateContent(ids, ctrl.selectAllContent); - angular.forEach(arr, function (e) { - e.isActived = ctrl.selectAllContent; - }); - }; - ctrl.unionArray = (a, b) => { - return [...new Set([...a, ...b])]; - }; - }, - ], - bindings: { - exportThemeDto: "=", - }, -}); - app.component("serviceMain", { templateUrl: "/mix-app/views/app-portal/pages/service/components/main/view.html", @@ -8818,125 +8997,107 @@ app.component("serviceMain", { }, }); -app.component("themeExportPosts", { - templateUrl: - "/mix-app/views/app-portal/pages/theme/components/theme-export-posts/view.html", - controller: [ - "$rootScope", - "$scope", - "ngAppSettings", - "BaseRestService", - function ($rootScope, $scope, ngAppSettings, baseRestService) { - var ctrl = this; - var service = angular.copy(baseRestService); - service.initService("/rest/mix-portal", "mix-post"); - ctrl.selectAllContent = false; - ctrl.selectAllData = false; - ctrl.request = angular.copy(ngAppSettings.request); - ctrl.$onInit = async () => { - ctrl.request.pageSize = 1000; - ctrl.getList(); - }; - ctrl.getList = async (postIndex) => { - if (postIndex !== undefined) { - ctrl.request.postIndex = postIndex; - } - if (ctrl.request.fromDate !== null) { - var d = new Date(ctrl.request.fromDate); - ctrl.request.fromDate = d.toISOString(); - } - if (ctrl.request.toDate !== null) { - var d = new Date(ctrl.request.toDate); - ctrl.request.toDate = d.toISOString(); - } - let getData = await service.getList(ctrl.request); - if (getData.success) { - ctrl.data = getData.data; - } - }; - ctrl.selectContent = (post, selected) => { - ctrl.selectAllContent = ctrl.selectAllContent && selected; - ctrl.selectAllData = ctrl.selectAllData && selected; - post.isExportData = selected && post.isExportData; - let contentIds = post.contents.map(function (obj) { - return obj.id; - }); - ctrl.exportThemeDto.content.postIds = ctrl.updateArray( - ctrl.exportThemeDto.content.postIds, - [post.id], - selected - ); - ctrl.exportThemeDto.content.postContentIds = ctrl.updateArray( - ctrl.exportThemeDto.content.postContentIds, - contentIds, - selected - ); - if (!selected) { - ctrl.selectData(post, false); - } - }; - ctrl.selectData = (post, selected) => { - ctrl.selectAllData = ctrl.selectAllData && selected; - let contentIds = post.contents.map(function (obj) { - return obj.id; - }); - ctrl.exportThemeDto.associations.postIds = ctrl.updateArray( - ctrl.exportThemeDto.associations.postIds, - [post.id], - selected - ); - ctrl.exportThemeDto.associations.postContentIds = ctrl.updateArray( - ctrl.exportThemeDto.associations.postContentIds, - contentIds, - selected - ); - }; - ctrl.updateArray = function (src, arr, selected) { - if (selected) { - src = ctrl.unionArray(src, arr); - } else { - src = src.filter((m) => arr.indexOf(m) < 0); - } - return src; - }; - ctrl.selectAll = function (arr) { - angular.forEach(arr, function (e) { - ctrl.selectContent(e, ctrl.selectAllContent); - ctrl.selectData(e, ctrl.selectAllData); - e.isActived = ctrl.selectAllContent; - e.isExportData = ctrl.selectAllData; - }); - }; - ctrl.unionArray = (a, b) => { - return [...new Set([...a, ...b])]; - }; - }, - ], - bindings: { - exportThemeDto: "=", +app.component("themeImportMixDatabases", { + templateUrl: + "/mix-app/views/app-portal/pages/theme-import/components/theme-import-mix-databases/view.html", + bindings: { + importData: "=", + importThemeDto: "=", + }, + controller: [ + "$rootScope", + "$scope", + "ngAppSettings", + function ($rootScope, $scope, ngAppSettings) { + var ctrl = this; + var service = $rootScope.getRestService("mix-database"); + ctrl.selectAllContent = false; + ctrl.selectAllData = false; + ctrl.request = angular.copy(ngAppSettings.request); + ctrl.$onInit = async () => { + ctrl.data = ctrl.importData.mixDatabases; + }; + + ctrl.selectContent = (mixDatabase, selected) => { + ctrl.selectAllContent = ctrl.selectAllContent && selected; + ctrl.selectAllData = ctrl.selectAllData && selected; + mixDatabase.isImportData = selected && mixDatabase.isImportData; + ctrl.importThemeDto.mixDatabaseIds = ctrl.updateArray( + ctrl.importThemeDto.mixDatabaseIds, + [mixDatabase.id], + selected + ); + if (!selected) { + ctrl.selectData(mixDatabase, false); + } + }; + ctrl.selectData = (mixDatabase, selected) => { + ctrl.selectAllData = ctrl.selectAllData && selected; + ctrl.importThemeDto.mixDatabaseDataIds = ctrl.updateArray( + ctrl.importThemeDto.mixDatabaseDataIds, + [mixDatabase.id], + selected + ); + }; + ctrl.updateArray = function (src, arr, selected) { + if (selected) { + src = ctrl.unionArray(src, arr); + } else { + src = src.filter((m) => arr.indexOf(m) < 0); + } + return src; + }; + ctrl.selectAll = function (arr) { + angular.forEach(arr, function (e) { + ctrl.selectContent(e, ctrl.selectAllContent); + ctrl.selectData(e, ctrl.selectAllData); + e.isActived = ctrl.selectAllContent; + e.isImportData = ctrl.selectAllData; + }); + }; + ctrl.checkExist = (mixDatabase) => { + return ctrl.importData.existingDatabases.find( + (m) => m.id == mixDatabase.id + ); + }; + ctrl.unionArray = (a, b) => { + return [...new Set([...a, ...b])]; + }; + ctrl.colClass = (kind) => { + switch (kind) { + case "New": + return "fa fa-plus text-success"; + case "Changed": + return "fa fa-pencil text-warning"; + case "Deleted": + return "fa fa-minus text-danger"; + default: + break; + } + }; }, + ], }); -app.component("themeExportPages", { +app.component("themeImportModules", { templateUrl: - "/mix-app/views/app-portal/pages/theme/components/theme-export-pages/view.html", + "/mix-app/views/app-portal/pages/theme-import/components/theme-import-modules/view.html", controller: [ "$rootScope", "$scope", "ngAppSettings", function ($rootScope, $scope, ngAppSettings) { var ctrl = this; - var service = $rootScope.getRestService("mix-page"); + var service = $rootScope.getRestService("mix-module"); ctrl.selectAllContent = false; ctrl.selectAllData = false; ctrl.request = angular.copy(ngAppSettings.request); ctrl.$onInit = async () => { - ctrl.request.pageSize = null; ctrl.getList(); }; - ctrl.getList = async (pageIndex) => { - if (pageIndex !== undefined) { - ctrl.request.pageIndex = pageIndex; + ctrl.getList = async (moduleIndex) => { + if (moduleIndex !== undefined) { + ctrl.request.moduleIndex = moduleIndex; } if (ctrl.request.fromDate !== null) { var d = new Date(ctrl.request.fromDate); @@ -8951,39 +9112,39 @@ app.component("themeExportPages", { ctrl.data = getData.data; } }; - ctrl.selectContent = (page, selected) => { + ctrl.selectContent = (module, selected) => { ctrl.selectAllContent = ctrl.selectAllContent && selected; ctrl.selectAllData = ctrl.selectAllData && selected; - page.isExportData = selected && page.isExportData; - let contentIds = page.contents.map(function (obj) { + module.isImportData = selected && module.isImportData; + let contentIds = module.contents.map(function (obj) { return obj.id; }); - ctrl.exportThemeDto.content.pageIds = ctrl.updateArray( - ctrl.exportThemeDto.content.pageIds, - [page.id], + ctrl.importThemeDto.content.moduleIds = ctrl.updateArray( + ctrl.importThemeDto.content.moduleIds, + [module.id], selected ); - ctrl.exportThemeDto.content.pageContentIds = ctrl.updateArray( - ctrl.exportThemeDto.content.pageContentIds, + ctrl.importThemeDto.content.moduleContentIds = ctrl.updateArray( + ctrl.importThemeDto.content.moduleContentIds, contentIds, selected ); if (!selected) { - ctrl.selectData(page, false); + ctrl.selectData(module, false); } }; - ctrl.selectData = (page, selected) => { + ctrl.selectData = (module, selected) => { ctrl.selectAllData = ctrl.selectAllData && selected; - let contentIds = page.contents.map(function (obj) { + let contentIds = module.contents.map(function (obj) { return obj.id; }); - ctrl.exportThemeDto.associations.pageIds = ctrl.updateArray( - ctrl.exportThemeDto.associations.pageIds, - [page.id], + ctrl.importThemeDto.associations.moduleIds = ctrl.updateArray( + ctrl.importThemeDto.associations.moduleIds, + [module.id], selected ); - ctrl.exportThemeDto.associations.pageContentIds = ctrl.updateArray( - ctrl.exportThemeDto.associations.pageContentIds, + ctrl.importThemeDto.associations.moduleContentIds = ctrl.updateArray( + ctrl.importThemeDto.associations.moduleContentIds, contentIds, selected ); @@ -9001,7 +9162,7 @@ app.component("themeExportPages", { ctrl.selectContent(e, ctrl.selectAllContent); ctrl.selectData(e, ctrl.selectAllData); e.isActived = ctrl.selectAllContent; - e.isExportData = ctrl.selectAllData; + e.isImportData = ctrl.selectAllData; }); }; ctrl.unionArray = (a, b) => { @@ -9010,7 +9171,7 @@ app.component("themeExportPages", { }, ], bindings: { - exportThemeDto: "=", + importThemeDto: "=", }, }); @@ -9084,26 +9245,25 @@ app.component("themeImportCultures", { }, }); -app.component("themeExportModules", { +app.component("themeImportPages", { templateUrl: - "/mix-app/views/app-portal/pages/theme/components/theme-export-modules/view.html", + "/mix-app/views/app-portal/pages/theme-import/components/theme-import-pages/view.html", controller: [ "$rootScope", "$scope", "ngAppSettings", function ($rootScope, $scope, ngAppSettings) { var ctrl = this; - var service = $rootScope.getRestService("mix-module"); + var service = $rootScope.getRestService("mix-page"); ctrl.selectAllContent = false; ctrl.selectAllData = false; ctrl.request = angular.copy(ngAppSettings.request); ctrl.$onInit = async () => { - ctrl.request.pageSize = null; ctrl.getList(); }; - ctrl.getList = async (moduleIndex) => { - if (moduleIndex !== undefined) { - ctrl.request.moduleIndex = moduleIndex; + ctrl.getList = async (pageIndex) => { + if (pageIndex !== undefined) { + ctrl.request.pageIndex = pageIndex; } if (ctrl.request.fromDate !== null) { var d = new Date(ctrl.request.fromDate); @@ -9118,39 +9278,39 @@ app.component("themeExportModules", { ctrl.data = getData.data; } }; - ctrl.selectContent = (module, selected) => { + ctrl.selectContent = (page, selected) => { ctrl.selectAllContent = ctrl.selectAllContent && selected; ctrl.selectAllData = ctrl.selectAllData && selected; - module.isExportData = selected && module.isExportData; - let contentIds = module.contents.map(function (obj) { + page.isImportData = selected && page.isImportData; + let contentIds = page.contents.map(function (obj) { return obj.id; }); - ctrl.exportThemeDto.content.moduleIds = ctrl.updateArray( - ctrl.exportThemeDto.content.moduleIds, - [module.id], + ctrl.importThemeDto.content.pageIds = ctrl.updateArray( + ctrl.importThemeDto.content.pageIds, + [page.id], selected ); - ctrl.exportThemeDto.content.moduleContentIds = ctrl.updateArray( - ctrl.exportThemeDto.content.moduleContentIds, + ctrl.importThemeDto.content.pageContentIds = ctrl.updateArray( + ctrl.importThemeDto.content.pageContentIds, contentIds, selected ); if (!selected) { - ctrl.selectData(module, false); + ctrl.selectData(page, false); } }; - ctrl.selectData = (module, selected) => { + ctrl.selectData = (page, selected) => { ctrl.selectAllData = ctrl.selectAllData && selected; - let contentIds = module.contents.map(function (obj) { + let contentIds = page.contents.map(function (obj) { return obj.id; }); - ctrl.exportThemeDto.associations.moduleIds = ctrl.updateArray( - ctrl.exportThemeDto.associations.moduleIds, - [module.id], + ctrl.importThemeDto.associations.pageIds = ctrl.updateArray( + ctrl.importThemeDto.associations.pageIds, + [page.id], selected ); - ctrl.exportThemeDto.associations.moduleContentIds = ctrl.updateArray( - ctrl.exportThemeDto.associations.moduleContentIds, + ctrl.importThemeDto.associations.pageContentIds = ctrl.updateArray( + ctrl.importThemeDto.associations.pageContentIds, contentIds, selected ); @@ -9168,7 +9328,7 @@ app.component("themeExportModules", { ctrl.selectContent(e, ctrl.selectAllContent); ctrl.selectData(e, ctrl.selectAllData); e.isActived = ctrl.selectAllContent; - e.isExportData = ctrl.selectAllData; + e.isImportData = ctrl.selectAllData; }); }; ctrl.unionArray = (a, b) => { @@ -9177,48 +9337,77 @@ app.component("themeExportModules", { }, ], bindings: { - exportThemeDto: "=", + importThemeDto: "=", }, }); -app.component("themeImportMixDatabases", { +app.component("themeImportPosts", { templateUrl: - "/mix-app/views/app-portal/pages/theme-import/components/theme-import-mix-databases/view.html", - bindings: { - importThemeDto: "=", - }, + "/mix-app/views/app-portal/pages/theme-import/components/theme-import-posts/view.html", controller: [ "$rootScope", "$scope", "ngAppSettings", function ($rootScope, $scope, ngAppSettings) { var ctrl = this; - var service = $rootScope.getRestService("mix-database"); + var service = $rootScope.getRestService("mix-post"); ctrl.selectAllContent = false; ctrl.selectAllData = false; ctrl.request = angular.copy(ngAppSettings.request); ctrl.$onInit = async () => { - ctrl.data = ctrl.importThemeDto.mixDatabases; + ctrl.getList(); }; - - ctrl.selectContent = (mixDatabase, selected) => { + ctrl.getList = async (postIndex) => { + if (postIndex !== undefined) { + ctrl.request.postIndex = postIndex; + } + if (ctrl.request.fromDate !== null) { + var d = new Date(ctrl.request.fromDate); + ctrl.request.fromDate = d.toISOString(); + } + if (ctrl.request.toDate !== null) { + var d = new Date(ctrl.request.toDate); + ctrl.request.toDate = d.toISOString(); + } + let getData = await service.getList(ctrl.request); + if (getData.success) { + ctrl.data = getData.data; + } + }; + ctrl.selectContent = (post, selected) => { ctrl.selectAllContent = ctrl.selectAllContent && selected; ctrl.selectAllData = ctrl.selectAllData && selected; - mixDatabase.isImportData = selected && mixDatabase.isImportData; - ctrl.importThemeDto.content.mixDatabaseIds = ctrl.updateArray( - ctrl.importThemeDto.content.mixDatabaseIds, - [mixDatabase.id], + post.isImportData = selected && post.isImportData; + let contentIds = post.contents.map(function (obj) { + return obj.id; + }); + ctrl.importThemeDto.content.postIds = ctrl.updateArray( + ctrl.importThemeDto.content.postIds, + [post.id], + selected + ); + ctrl.importThemeDto.content.postContentIds = ctrl.updateArray( + ctrl.importThemeDto.content.postContentIds, + contentIds, selected ); if (!selected) { - ctrl.selectData(mixDatabase, false); + ctrl.selectData(post, false); } }; - ctrl.selectData = (mixDatabase, selected) => { + ctrl.selectData = (post, selected) => { ctrl.selectAllData = ctrl.selectAllData && selected; - ctrl.importThemeDto.associations.mixDatabaseIds = ctrl.updateArray( - ctrl.importThemeDto.associations.mixDatabaseIds, - [mixDatabase.id], + let contentIds = post.contents.map(function (obj) { + return obj.id; + }); + ctrl.importThemeDto.associations.postIds = ctrl.updateArray( + ctrl.importThemeDto.associations.postIds, + [post.id], + selected + ); + ctrl.importThemeDto.associations.postContentIds = ctrl.updateArray( + ctrl.importThemeDto.associations.postContentIds, + contentIds, selected ); }; @@ -9238,114 +9427,19 @@ app.component("themeImportMixDatabases", { e.isImportData = ctrl.selectAllData; }); }; - ctrl.validate = (mixDatabase) => { - if ( - ctrl.importThemeDto.invalidDatabaseNames.indexOf( - mixDatabase.systemName - ) >= 0 - ) { - return `${mixDatabase.systemName} is invalid`; - } - }; ctrl.unionArray = (a, b) => { return [...new Set([...a, ...b])]; }; }, ], + bindings: { + importThemeDto: "=", + }, }); -app.component("themeExportMixDatabaseContexts", { - templateUrl: - "/mix-app/views/app-portal/pages/theme/components/theme-export-mix-databases/view.html", - controller: [ - "$rootScope", - "$scope", - "ngAppSettings", - "RestMixDatabaseContextService", - function ($rootScope, $scope, ngAppSettings, dbContextService) { - var ctrl = this; - var service = $rootScope.getRestService("mix-database"); - ctrl.selectAllContent = false; - ctrl.selectAllData = false; - ctrl.dbContextrequest = angular.copy(ngAppSettings.request); - ctrl.request = angular.copy(ngAppSettings.request); - ctrl.$onInit = async () => { - ctrl.request.pageSize = null; - ctrl.loadDbContexts(); - }; - ctrl.loadDbContexts = async function (pageIndex) { - if (pageIndex !== undefined) { - ctrl.dbContextrequest.pageIndex = pageIndex; - } - - var resp = await dbContextService.getList(ctrl.dbContextrequest); - if (resp && resp.success) { - ctrl.data = resp.data; - ctrl.data.items.prepend({ - displayName: 'Master Database' - }); - $scope.$apply(); - } - }; - - ctrl.selectContent = (mixDatabaseContext, selected) => { - ctrl.selectAllContent = ctrl.selectAllContent && selected; - ctrl.exportThemeDto.content.mixDatabaseContextIds = ctrl.updateArray( - ctrl.exportThemeDto.content.mixDatabaseContextIds, - [mixDatabaseContext.id], - selected - ); - }; - ctrl.selectDbContent = (mixDatabase, selected) => { - ctrl.selectAllContent = ctrl.selectAllContent && selected; - ctrl.selectAllData = ctrl.selectAllData && selected; - mixDatabase.isExportData = selected && mixDatabase.isExportData; - ctrl.exportThemeDto.content.mixDatabaseIds = ctrl.updateArray( - ctrl.exportThemeDto.content.mixDatabaseIds, - [mixDatabase.id], - selected - ); - if (!selected) { - ctrl.selectData(mixDatabase, false); - } - }; - ctrl.selectData = (mixDatabase, selected) => { - ctrl.selectAllData = ctrl.selectAllData && selected; - ctrl.exportThemeDto.associations.mixDatabaseIds = ctrl.updateArray( - ctrl.exportThemeDto.associations.mixDatabaseIds, - [mixDatabase.id], - selected - ); - }; - ctrl.updateArray = function (src, arr, selected) { - if (selected) { - src = ctrl.unionArray(src, arr); - } else { - src = src.filter((m) => arr.indexOf(m) < 0); - } - return src; - }; - - ctrl.selectAll = function (arr) { - angular.forEach(arr, function (e) { - ctrl.selectContent(e, ctrl.selectAllContent); - e.isActived = ctrl.selectAllContent; - e.isExportData = ctrl.selectAllData; - }); - }; - ctrl.unionArray = (a, b) => { - return [...new Set([...a, ...b])]; - }; - }, - ], - bindings: { - exportThemeDto: "=", - }, -}); - -app.component("themeImportModules", { +app.component("themeExportModules", { templateUrl: - "/mix-app/views/app-portal/pages/theme-import/components/theme-import-modules/view.html", + "/mix-app/views/app-portal/pages/theme/components/theme-export-modules/view.html", controller: [ "$rootScope", "$scope", @@ -9357,6 +9451,7 @@ app.component("themeImportModules", { ctrl.selectAllData = false; ctrl.request = angular.copy(ngAppSettings.request); ctrl.$onInit = async () => { + ctrl.request.pageSize = null; ctrl.getList(); }; ctrl.getList = async (moduleIndex) => { @@ -9379,17 +9474,17 @@ app.component("themeImportModules", { ctrl.selectContent = (module, selected) => { ctrl.selectAllContent = ctrl.selectAllContent && selected; ctrl.selectAllData = ctrl.selectAllData && selected; - module.isImportData = selected && module.isImportData; + module.isExportData = selected && module.isExportData; let contentIds = module.contents.map(function (obj) { return obj.id; }); - ctrl.importThemeDto.content.moduleIds = ctrl.updateArray( - ctrl.importThemeDto.content.moduleIds, + ctrl.exportThemeDto.content.moduleIds = ctrl.updateArray( + ctrl.exportThemeDto.content.moduleIds, [module.id], selected ); - ctrl.importThemeDto.content.moduleContentIds = ctrl.updateArray( - ctrl.importThemeDto.content.moduleContentIds, + ctrl.exportThemeDto.content.moduleContentIds = ctrl.updateArray( + ctrl.exportThemeDto.content.moduleContentIds, contentIds, selected ); @@ -9402,13 +9497,13 @@ app.component("themeImportModules", { let contentIds = module.contents.map(function (obj) { return obj.id; }); - ctrl.importThemeDto.associations.moduleIds = ctrl.updateArray( - ctrl.importThemeDto.associations.moduleIds, + ctrl.exportThemeDto.associations.moduleIds = ctrl.updateArray( + ctrl.exportThemeDto.associations.moduleIds, [module.id], selected ); - ctrl.importThemeDto.associations.moduleContentIds = ctrl.updateArray( - ctrl.importThemeDto.associations.moduleContentIds, + ctrl.exportThemeDto.associations.moduleContentIds = ctrl.updateArray( + ctrl.exportThemeDto.associations.moduleContentIds, contentIds, selected ); @@ -9426,7 +9521,7 @@ app.component("themeImportModules", { ctrl.selectContent(e, ctrl.selectAllContent); ctrl.selectData(e, ctrl.selectAllData); e.isActived = ctrl.selectAllContent; - e.isImportData = ctrl.selectAllData; + e.isExportData = ctrl.selectAllData; }); }; ctrl.unionArray = (a, b) => { @@ -9435,77 +9530,70 @@ app.component("themeImportModules", { }, ], bindings: { - importThemeDto: "=", + exportThemeDto: "=", }, }); -app.component("themeImportPages", { +app.component("themeExportMixDatabaseContexts", { templateUrl: - "/mix-app/views/app-portal/pages/theme-import/components/theme-import-pages/view.html", + "/mix-app/views/app-portal/pages/theme/components/theme-export-mix-databases/view.html", controller: [ "$rootScope", "$scope", "ngAppSettings", - function ($rootScope, $scope, ngAppSettings) { + "RestMixDatabaseContextService", + function ($rootScope, $scope, ngAppSettings, dbContextService) { var ctrl = this; - var service = $rootScope.getRestService("mix-page"); + var service = $rootScope.getRestService("mix-database"); ctrl.selectAllContent = false; ctrl.selectAllData = false; + ctrl.dbContextrequest = angular.copy(ngAppSettings.request); ctrl.request = angular.copy(ngAppSettings.request); ctrl.$onInit = async () => { - ctrl.getList(); + ctrl.request.pageSize = null; + ctrl.loadDbContexts(); }; - ctrl.getList = async (pageIndex) => { + ctrl.loadDbContexts = async function (pageIndex) { if (pageIndex !== undefined) { - ctrl.request.pageIndex = pageIndex; - } - if (ctrl.request.fromDate !== null) { - var d = new Date(ctrl.request.fromDate); - ctrl.request.fromDate = d.toISOString(); - } - if (ctrl.request.toDate !== null) { - var d = new Date(ctrl.request.toDate); - ctrl.request.toDate = d.toISOString(); + ctrl.dbContextrequest.pageIndex = pageIndex; } - let getData = await service.getList(ctrl.request); - if (getData.success) { - ctrl.data = getData.data; + + var resp = await dbContextService.getList(ctrl.dbContextrequest); + if (resp && resp.success) { + ctrl.data = resp.data; + ctrl.data.items.prepend({ + displayName: "Master Database", + }); + $scope.$apply(); } }; - ctrl.selectContent = (page, selected) => { + + ctrl.selectContent = (mixDatabaseContext, selected) => { ctrl.selectAllContent = ctrl.selectAllContent && selected; - ctrl.selectAllData = ctrl.selectAllData && selected; - page.isImportData = selected && page.isImportData; - let contentIds = page.contents.map(function (obj) { - return obj.id; - }); - ctrl.importThemeDto.content.pageIds = ctrl.updateArray( - ctrl.importThemeDto.content.pageIds, - [page.id], + ctrl.exportThemeDto.content.mixDatabaseContextIds = ctrl.updateArray( + ctrl.exportThemeDto.content.mixDatabaseContextIds, + [mixDatabaseContext.id], selected ); - ctrl.importThemeDto.content.pageContentIds = ctrl.updateArray( - ctrl.importThemeDto.content.pageContentIds, - contentIds, + }; + ctrl.selectDbContent = (mixDatabase, selected) => { + ctrl.selectAllContent = ctrl.selectAllContent && selected; + ctrl.selectAllData = ctrl.selectAllData && selected; + mixDatabase.isExportData = selected && mixDatabase.isExportData; + ctrl.exportThemeDto.content.mixDatabaseIds = ctrl.updateArray( + ctrl.exportThemeDto.content.mixDatabaseIds, + [mixDatabase.id], selected ); if (!selected) { - ctrl.selectData(page, false); + ctrl.selectData(mixDatabase, false); } }; - ctrl.selectData = (page, selected) => { + ctrl.selectData = (mixDatabase, selected) => { ctrl.selectAllData = ctrl.selectAllData && selected; - let contentIds = page.contents.map(function (obj) { - return obj.id; - }); - ctrl.importThemeDto.associations.pageIds = ctrl.updateArray( - ctrl.importThemeDto.associations.pageIds, - [page.id], - selected - ); - ctrl.importThemeDto.associations.pageContentIds = ctrl.updateArray( - ctrl.importThemeDto.associations.pageContentIds, - contentIds, + ctrl.exportThemeDto.associations.mixDatabaseIds = ctrl.updateArray( + ctrl.exportThemeDto.associations.mixDatabaseIds, + [mixDatabase.id], selected ); }; @@ -9517,12 +9605,12 @@ app.component("themeImportPages", { } return src; }; + ctrl.selectAll = function (arr) { angular.forEach(arr, function (e) { ctrl.selectContent(e, ctrl.selectAllContent); - ctrl.selectData(e, ctrl.selectAllData); e.isActived = ctrl.selectAllContent; - e.isImportData = ctrl.selectAllData; + e.isExportData = ctrl.selectAllData; }); }; ctrl.unionArray = (a, b) => { @@ -9531,29 +9619,100 @@ app.component("themeImportPages", { }, ], bindings: { - importThemeDto: "=", + exportThemeDto: "=", }, }); -app.component("themeImportPosts", { +app.component("themeExportCultures", { + templateUrl: + "/mix-app/views/app-portal/pages/theme/components/theme-export-cultures/view.html", + controller: [ + "$rootScope", + "$scope", + "ngAppSettings", + function ($rootScope, $scope, ngAppSettings) { + var ctrl = this; + var service = $rootScope.getRestService("culture"); + ctrl.selectAllContent = false; + ctrl.request = angular.copy(ngAppSettings.request); + ctrl.$onInit = async () => { + ctrl.getList(); + }; + ctrl.getList = async (cultureIndex) => { + if (cultureIndex !== undefined) { + ctrl.request.cultureIndex = cultureIndex; + } + if (ctrl.request.fromDate !== null) { + var d = new Date(ctrl.request.fromDate); + ctrl.request.fromDate = d.toISOString(); + } + if (ctrl.request.toDate !== null) { + var d = new Date(ctrl.request.toDate); + ctrl.request.toDate = d.toISOString(); + } + let getData = await service.getList(ctrl.request); + if (getData.success) { + ctrl.data = getData.data; + } + }; + ctrl.selectContent = (culture, selected) => { + ctrl.selectAllContent = ctrl.selectAllContent && selected; + ctrl.selectAllData = ctrl.selectAllData && selected; + culture.isExportData = selected && culture.isExportData; + ctrl.updateContent([culture.id], selected); + }; + ctrl.updateContent = function (arr, selected) { + if (selected) { + ctrl.exportThemeDto.cultureIds = ctrl.unionArray( + ctrl.exportThemeDto.cultureIds, + arr + ); + } else { + ctrl.exportThemeDto.cultureIds = + ctrl.exportThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0); + ctrl.updateData(arr, false); + } + }; + ctrl.selectAll = function (arr) { + // ctrl.selectedList.data = []; + var ids = arr.map(function (obj) { + return obj.id; + }); + ctrl.updateContent(ids, ctrl.selectAllContent); + angular.forEach(arr, function (e) { + e.isActived = ctrl.selectAllContent; + }); + }; + ctrl.unionArray = (a, b) => { + return [...new Set([...a, ...b])]; + }; + }, + ], + bindings: { + exportThemeDto: "=", + }, +}); + +app.component("themeExportPages", { templateUrl: - "/mix-app/views/app-portal/pages/theme-import/components/theme-import-posts/view.html", + "/mix-app/views/app-portal/pages/theme/components/theme-export-pages/view.html", controller: [ "$rootScope", "$scope", "ngAppSettings", function ($rootScope, $scope, ngAppSettings) { var ctrl = this; - var service = $rootScope.getRestService("mix-post"); + var service = $rootScope.getRestService("mix-page"); ctrl.selectAllContent = false; ctrl.selectAllData = false; ctrl.request = angular.copy(ngAppSettings.request); ctrl.$onInit = async () => { + ctrl.request.pageSize = null; ctrl.getList(); }; - ctrl.getList = async (postIndex) => { - if (postIndex !== undefined) { - ctrl.request.postIndex = postIndex; + ctrl.getList = async (pageIndex) => { + if (pageIndex !== undefined) { + ctrl.request.pageIndex = pageIndex; } if (ctrl.request.fromDate !== null) { var d = new Date(ctrl.request.fromDate); @@ -9568,39 +9727,39 @@ app.component("themeImportPosts", { ctrl.data = getData.data; } }; - ctrl.selectContent = (post, selected) => { + ctrl.selectContent = (page, selected) => { ctrl.selectAllContent = ctrl.selectAllContent && selected; ctrl.selectAllData = ctrl.selectAllData && selected; - post.isImportData = selected && post.isImportData; - let contentIds = post.contents.map(function (obj) { + page.isExportData = selected && page.isExportData; + let contentIds = page.contents.map(function (obj) { return obj.id; }); - ctrl.importThemeDto.content.postIds = ctrl.updateArray( - ctrl.importThemeDto.content.postIds, - [post.id], + ctrl.exportThemeDto.content.pageIds = ctrl.updateArray( + ctrl.exportThemeDto.content.pageIds, + [page.id], selected ); - ctrl.importThemeDto.content.postContentIds = ctrl.updateArray( - ctrl.importThemeDto.content.postContentIds, + ctrl.exportThemeDto.content.pageContentIds = ctrl.updateArray( + ctrl.exportThemeDto.content.pageContentIds, contentIds, selected ); if (!selected) { - ctrl.selectData(post, false); + ctrl.selectData(page, false); } }; - ctrl.selectData = (post, selected) => { + ctrl.selectData = (page, selected) => { ctrl.selectAllData = ctrl.selectAllData && selected; - let contentIds = post.contents.map(function (obj) { + let contentIds = page.contents.map(function (obj) { return obj.id; }); - ctrl.importThemeDto.associations.postIds = ctrl.updateArray( - ctrl.importThemeDto.associations.postIds, - [post.id], + ctrl.exportThemeDto.associations.pageIds = ctrl.updateArray( + ctrl.exportThemeDto.associations.pageIds, + [page.id], selected ); - ctrl.importThemeDto.associations.postContentIds = ctrl.updateArray( - ctrl.importThemeDto.associations.postContentIds, + ctrl.exportThemeDto.associations.pageContentIds = ctrl.updateArray( + ctrl.exportThemeDto.associations.pageContentIds, contentIds, selected ); @@ -9618,7 +9777,7 @@ app.component("themeImportPosts", { ctrl.selectContent(e, ctrl.selectAllContent); ctrl.selectData(e, ctrl.selectAllData); e.isActived = ctrl.selectAllContent; - e.isImportData = ctrl.selectAllData; + e.isExportData = ctrl.selectAllData; }); }; ctrl.unionArray = (a, b) => { @@ -9627,10 +9786,109 @@ app.component("themeImportPosts", { }, ], bindings: { - importThemeDto: "=", + exportThemeDto: "=", }, }); +app.component("themeExportPosts", { + templateUrl: + "/mix-app/views/app-portal/pages/theme/components/theme-export-posts/view.html", + controller: [ + "$rootScope", + "$scope", + "ngAppSettings", + "BaseRestService", + function ($rootScope, $scope, ngAppSettings, baseRestService) { + var ctrl = this; + var service = angular.copy(baseRestService); + service.initService("/rest/mix-portal", "mix-post"); + ctrl.selectAllContent = false; + ctrl.selectAllData = false; + ctrl.request = angular.copy(ngAppSettings.request); + ctrl.$onInit = async () => { + ctrl.request.pageSize = 1000; + ctrl.getList(); + }; + ctrl.getList = async (postIndex) => { + if (postIndex !== undefined) { + ctrl.request.postIndex = postIndex; + } + if (ctrl.request.fromDate !== null) { + var d = new Date(ctrl.request.fromDate); + ctrl.request.fromDate = d.toISOString(); + } + if (ctrl.request.toDate !== null) { + var d = new Date(ctrl.request.toDate); + ctrl.request.toDate = d.toISOString(); + } + let getData = await service.getList(ctrl.request); + if (getData.success) { + ctrl.data = getData.data; + } + }; + ctrl.selectContent = (post, selected) => { + ctrl.selectAllContent = ctrl.selectAllContent && selected; + ctrl.selectAllData = ctrl.selectAllData && selected; + post.isExportData = selected && post.isExportData; + let contentIds = post.contents.map(function (obj) { + return obj.id; + }); + ctrl.exportThemeDto.content.postIds = ctrl.updateArray( + ctrl.exportThemeDto.content.postIds, + [post.id], + selected + ); + ctrl.exportThemeDto.content.postContentIds = ctrl.updateArray( + ctrl.exportThemeDto.content.postContentIds, + contentIds, + selected + ); + if (!selected) { + ctrl.selectData(post, false); + } + }; + ctrl.selectData = (post, selected) => { + ctrl.selectAllData = ctrl.selectAllData && selected; + let contentIds = post.contents.map(function (obj) { + return obj.id; + }); + ctrl.exportThemeDto.associations.postIds = ctrl.updateArray( + ctrl.exportThemeDto.associations.postIds, + [post.id], + selected + ); + ctrl.exportThemeDto.associations.postContentIds = ctrl.updateArray( + ctrl.exportThemeDto.associations.postContentIds, + contentIds, + selected + ); + }; + ctrl.updateArray = function (src, arr, selected) { + if (selected) { + src = ctrl.unionArray(src, arr); + } else { + src = src.filter((m) => arr.indexOf(m) < 0); + } + return src; + }; + ctrl.selectAll = function (arr) { + angular.forEach(arr, function (e) { + ctrl.selectContent(e, ctrl.selectAllContent); + ctrl.selectData(e, ctrl.selectAllData); + e.isActived = ctrl.selectAllContent; + e.isExportData = ctrl.selectAllData; + }); + }; + ctrl.unionArray = (a, b) => { + return [...new Set([...a, ...b])]; + }; + }, + ], + bindings: { + exportThemeDto: "=", + }, +}); + var demo = { initDashboardPageCharts: function (incomes, services) { incomes = incomes || [ @@ -10012,58 +10270,6 @@ modules.component("aceEditor", { }, }); -modules.component("additionalValue", { - templateUrl: - "/mix-app/views/app-portal/components/additional-value/view.html", - bindings: { - additionalData: "=?", - additionalDataId: "=?", - parentType: "=?", - parentId: "=?", - mixDatabaseName: "=?", - backUrl: "=?", - }, - controller: [ - "$rootScope", - "$scope", - "RestMixDatabaseDataPortalService", - function ($rootScope, $scope, dataService) { - var ctrl = this; - ctrl.value = {}; - ctrl.column = { dataType: "Text" }; - ctrl.selectedCol = null; - ctrl.mixConfigurations = $rootScope.globalSettings; - ctrl.$onInit = async function () { - if (!ctrl.additionalData) { - if (!ctrl.additionalDataId) { - const obj = { - parentType: ctrl.parentType, - parentId: ctrl.parentId, - databaseName: ctrl.mixDatabaseName, - }; - const getData = await dataService.getAdditionalData(obj); - if (getData.success) { - ctrl.additionalData = getData.data; - ctrl.additionalData.mixDatabaseName = ctrl.mixDatabaseName; - ctrl.additionalData.parentType = ctrl.parentType; - $scope.$apply(); - } else { - $rootScope.showErrors(getData.errors); - } - } else { - var getData = await dataService.getSingle([ctrl.additionalDataId]); - ctrl.additionalData = getData.data; - $scope.$apply(); - } - } - if (ctrl.additionalData.id == "00000000-0000-0000-0000-000000000000") { - ctrl.additionalData.id = null; - } - }; - }, - ], -}); - modules.component("actions", { templateUrl: "/mix-app/views/app-portal/components/actions/actions.html", bindings: { @@ -10225,33 +10431,56 @@ modules.component("additionalColumn", { ], }); -modules.component("confirm", { - templateUrl: "/mix-app/views/app-portal/components/confirm/confirm.html", +modules.component("additionalValue", { + templateUrl: + "/mix-app/views/app-portal/components/additional-value/view.html", + bindings: { + additionalData: "=?", + additionalDataId: "=?", + parentType: "=?", + parentId: "=?", + mixDatabaseName: "=?", + backUrl: "=?", + }, controller: [ "$rootScope", "$scope", - "ngAppSettings", - function ($rootScope, $scope) { + "RestMixDatabaseDataPortalService", + function ($rootScope, $scope, dataService) { var ctrl = this; - ctrl.executeFunctionByName = async function ( - functionName, - args, - context - ) { - var result = await $rootScope.executeFunctionByName( - functionName, - args, - context - ); - if (result) { - $scope.$apply(); + ctrl.value = {}; + ctrl.column = { dataType: "Text" }; + ctrl.selectedCol = null; + ctrl.mixConfigurations = $rootScope.globalSettings; + ctrl.$onInit = async function () { + if (!ctrl.additionalData) { + if (!ctrl.additionalDataId) { + const obj = { + parentType: ctrl.parentType, + parentId: ctrl.parentId, + databaseName: ctrl.mixDatabaseName, + }; + const getData = await dataService.getAdditionalData(obj); + if (getData.success) { + ctrl.additionalData = getData.data; + ctrl.additionalData.mixDatabaseName = ctrl.mixDatabaseName; + ctrl.additionalData.parentType = ctrl.parentType; + $scope.$apply(); + } else { + $rootScope.showErrors(getData.errors); + } + } else { + var getData = await dataService.getSingle([ctrl.additionalDataId]); + ctrl.additionalData = getData.data; + $scope.$apply(); + } + } + if (ctrl.additionalData.id == "00000000-0000-0000-0000-000000000000") { + ctrl.additionalData.id = null; } }; }, ], - bindings: { - message: "=", - }, }); modules.component("customImage", { @@ -10393,7 +10622,7 @@ modules.component("customImage", { ctrl.postedFile.extension = file.name.substring( file.name.lastIndexOf(".") ); - ctrl.postedFile.fileStream = reader.result; + ctrl.postedFile.fileBase64 = reader.result; } ctrl.srcUrl = reader.result; ctrl.isImage = @@ -10421,85 +10650,33 @@ modules.component("customImage", { ], }); -modules.component("githubContributers", { - templateUrl: - "/mix-app/views/app-portal/components/github-contributers/view.html", +modules.component("confirm", { + templateUrl: "/mix-app/views/app-portal/components/confirm/confirm.html", controller: [ "$rootScope", - "$http", - function ($rootScope, $http) { + "$scope", + "ngAppSettings", + function ($rootScope, $scope) { var ctrl = this; - ctrl.items = []; - ctrl.init = function () { - var req = { - method: "GET", - url: "https://api.github.com/repos/mixcore/mix.core/contributors", - }; - ctrl.getGithubApiResult(req); - }; - - ctrl.getGithubApiResult = async function (req) { - return $http(req).then( - function (resp) { - if (resp.status == "200") { - ctrl.items = resp.data; - } else { - } - }, - function (error) { - return { - success: false, - errors: [error.statusText || error.status], - }; - } + ctrl.executeFunctionByName = async function ( + functionName, + args, + context + ) { + var result = await $rootScope.executeFunctionByName( + functionName, + args, + context ); + if (result) { + $scope.$apply(); + } }; }, ], - bindings: {}, -}); - -modules.component("funding", { - templateUrl: "/mix-app/views/app-portal/components/funding/view.html", - controller: [ - "$rootScope", - "$http", - function ($rootScope, $http) { - var ctrl = this; - ctrl.items = [ - { - title: "opencollective.com/mixcore", - href: "https://opencollective.com/mixcore", - logo: - "https://github.githubassets.com/images/modules/site/icons/funding_platforms/open_collective.svg", - }, - { - title: "funding.communitybridge.org/projects/mixcore", - href: "https://crowdfunding.lfx.linuxfoundation.org/projects/mixcore", - logo: - "https://github.githubassets.com/images/modules/site/icons/funding_platforms/community_bridge.svg", - }, - { - title: "patreon.com/mixcore", - href: "https://www.patreon.com/mixcore/creators", - logo: - "https://github.githubassets.com/images/modules/site/icons/funding_platforms/patreon.svg", - }, - { - title: "paypalme/mixcore", - href: "https://www.paypal.me/mixcore", - logo: "/mix-app/assets/img/svg/heart.svg", - }, - { - title: "buymeacoffee.com/mixcore", - href: "https://www.buymeacoffee.com/mixcore", - logo: "/mix-app/assets/img/svg/heart.svg", - }, - ]; - ctrl.init = function () {}; - }, - ], - bindings: {}, + bindings: { + message: "=", + }, }); modules.component("filterList", { @@ -10528,7 +10705,7 @@ modules.component("filterList", { "Status", ]; } - ctrl.request.orderBy = ctrl.request.orderBy || ctrl.arrOrderBy[0]; + ctrl.request.sortBy = ctrl.request.sortBy || ctrl.arrOrderBy[0]; ctrl.directions = ["Asc", "Desc"]; ctrl.pageSizes = [5, 10, 15, 20]; ctrl.statuses = $rootScope.globalSettings.statuses; @@ -10576,8 +10753,52 @@ modules.component("filterList", { }, }); -modules.component("githubReleases", { - templateUrl: "/mix-app/views/app-portal/components/github-releases/view.html", +modules.component("funding", { + templateUrl: "/mix-app/views/app-portal/components/funding/view.html", + controller: [ + "$rootScope", + "$http", + function ($rootScope, $http) { + var ctrl = this; + ctrl.items = [ + { + title: "opencollective.com/mixcore", + href: "https://opencollective.com/mixcore", + logo: + "https://github.githubassets.com/images/modules/site/icons/funding_platforms/open_collective.svg", + }, + { + title: "funding.communitybridge.org/projects/mixcore", + href: "https://crowdfunding.lfx.linuxfoundation.org/projects/mixcore", + logo: + "https://github.githubassets.com/images/modules/site/icons/funding_platforms/community_bridge.svg", + }, + { + title: "patreon.com/mixcore", + href: "https://www.patreon.com/mixcore/creators", + logo: + "https://github.githubassets.com/images/modules/site/icons/funding_platforms/patreon.svg", + }, + { + title: "paypalme/mixcore", + href: "https://www.paypal.me/mixcore", + logo: "/mix-app/assets/img/svg/heart.svg", + }, + { + title: "buymeacoffee.com/mixcore", + href: "https://www.buymeacoffee.com/mixcore", + logo: "/mix-app/assets/img/svg/heart.svg", + }, + ]; + ctrl.init = function () {}; + }, + ], + bindings: {}, +}); + +modules.component("githubContributers", { + templateUrl: + "/mix-app/views/app-portal/components/github-contributers/view.html", controller: [ "$rootScope", "$http", @@ -10587,7 +10808,7 @@ modules.component("githubReleases", { ctrl.init = function () { var req = { method: "GET", - url: "https://api.github.com/repos/mixcore/mix.core/releases", + url: "https://api.github.com/repos/mixcore/mix.core/contributors", }; ctrl.getGithubApiResult(req); }; @@ -10613,441 +10834,393 @@ modules.component("githubReleases", { bindings: {}, }); -(function (angular) { - app.component("headerNav", { - templateUrl: - "/mix-app/views/app-portal/components/header-nav/headerNav.html", - controller: [ - "$rootScope", - "$scope", - "ngAppSettings", - "localStorageService", - "CommonService", - "ApiService", - "AuthService", - "CultureService", - function ( - $rootScope, - $scope, - ngAppSettings, - localStorageService, - commonService, - apiService, - authService, - cultureService - ) { - var ctrl = this; - ctrl.appSettings = $rootScope.globalSettings; - ctrl.isInRole = $rootScope.isInRole; - this.$onInit = function () { - ctrl.isAdmin = $rootScope.isAdmin; - ctrl.mixConfigurations = $rootScope.mixConfigurations; - cultureService.getList(ngAppSettings.request).then((resp) => { - ctrl.cultures = resp.data.items; - ctrl.selectedCulture = ctrl.cultures.find( - (m) => - m.specificulture == $rootScope.globalSettings.defaultCulture - ); - $scope.$apply(); - }); - authService.fillAuthData().then(() => { - if ( - authService.authentication && - authService.authentication.info.userData - ) { - ctrl.avatar = authService.authentication.info.userData.avatar; - } - }); - }; - ctrl.translate = $rootScope.translate; - ctrl.getConfiguration = function (keyword, isWrap, defaultText) { - return $rootScope.getConfiguration(keyword, isWrap, defaultText); - }; - ctrl.changeLang = function (culture) { - $rootScope.globalSettings.defaultCulture = culture.specificulture; - localStorageService.set("globalSettings", $rootScope.globalSettings); - window.top.location = location.href; - }; - ctrl.logOut = function () { - $rootScope.logOut(); - }; - ctrl.addPermission = function () { - $("#dlg-permission").modal("show"); - }; - ctrl.addBookmark = function () { - $("#dlg-bookmark").modal("show"); - }; - ctrl.toggleSidebar = function () { - $(".main-sidebar").toggle(); - $(".sub-sidebar").toggle(); - // $('.navbar-brand').toggle(); - }; - ctrl.clearCache = async function () { - $rootScope.isBusy = true; - await commonService.clearCache(); - $rootScope.showMessage("success", "success"); - $rootScope.isBusy = false; - $scope.$apply(); - }; - ctrl.showHelper = function (url) { - $rootScope.helperUrl = url; - $("#dev-helper-modal").modal("show"); - }; - ctrl.generateSitemap = async function () { - $rootScope.isBusy = true; - var resp = await commonService.genrateSitemap(); - if (resp) { - window.top.location.href = - "/admin/file/details?folder=" + - resp.fileFolder + - "&filename=" + - resp.filename + - resp.extension; - } else { - $rootScope.isBusy = false; - $rootScope.showErrors(["Server error"]); - } - }; - }, - ], - bindings: { - breadCrumbs: "=", - settings: "=", - }, - }); -})(window.angular); - -modules.component("jsonBuilder", { - templateUrl: "/mix-app/views/app-portal/components/json-builder/view.html", +modules.component("googleAnalytic", { + templateUrl: "/mix-app/views/app-portal/components/google-analytic/view.html", bindings: { - data: "=?", // json obj (ex: { column1: 'some val' }) - strData: "=?", // json obj (ex: { column1: 'some val' }) - folder: "=?", // filepath (ex: 'data/jsonfile.json') - filename: "=?", // filepath (ex: 'data/jsonfile.json') - allowedTypes: "=?", // string array ( ex: [ 'type1', 'type2' ] ) - backUrl: "=?", // string array ( ex: [ 'type1', 'type2' ] ) - showPreview: "=?", - type: "=?", // array / obj - editMode: "=?", // array / obj - save: "&", - onUpdate: "&", + Google_Client_Id: "=?", + Google_Client_Ids: "=?", + Google_Analytic_Ids: "=?", }, controller: [ "$rootScope", - "$scope", - "$location", - "FileServices", - "ngAppSettings", - function ($rootScope, $scope, $location, fileService, ngAppSettings) { + "ApiService", + "CommonService", + function ($rootScope, apiService, commonService) { var ctrl = this; + ctrl.init = function () { + if (gapi) { + gapi.analytics.ready(function () { + if (ctrl.Google_Client_Id) { + /** + * Authorize the user immediately if the user has already granted access. + * If no access has been created, render an authorize button inside the + * element with the ID "embed-api-auth-container". + */ + gapi.analytics.auth.authorize({ + container: "embed-api-auth-container", + //REPLACE WITH YOUR CLIENT ID + clientid: ctrl.Google_Client_Id, + }); - ctrl.file = null; - ctrl.translate = $rootScope.translate; - ctrl.mixConfigurations = $rootScope.globalSettings; - ctrl.timestamp = Math.random(); - ctrl.templates = [ - { - type: "item", - name: "", - dataType: "Text", - value: "", - columns: [{ allowedTypes: ["item"], items: [] }], - }, - { - type: "string", - dataType: "Text", - value: "", - columns: [{ allowedTypes: ["item"], items: [] }], - }, - { - type: "object", - name: "o1", - columns: [{ allowedTypes: ["array", "object", "item"], items: [] }], - }, - { - type: "array", - name: "a1", - columns: [{ allowedTypes: ["object"], items: [] }], - }, - ]; - ctrl.draft = []; - ctrl.model = {}; - ctrl.dropzones = { - root: [], - }; - ctrl.selected = null; - ctrl.selectedModel = {}; - ctrl.strModel = null; - ctrl.init = async function () { - var arr = []; - if (!ctrl.editMode) { - ctrl.editMode = "json"; - } - if (!ctrl.data && ctrl.filename) { - await ctrl.loadFile(); - ctrl.parseObjToList(ctrl.data, arr); - ctrl.dropzones.root = arr; - } else { - if (!ctrl.data) { - if (ctrl.strData) { - ctrl.data = JSON.parse(ctrl.strData); - } - if (!ctrl.data && ctrl.type) { - ctrl.data = ctrl.type == "array" ? [] : {}; + /** + * Create a ViewSelector for the first view to be rendered inside of an + * element with the id "view-selector-1-container". + */ + var viewSelector1 = new gapi.analytics.ViewSelector({ + container: "view-selector-1-container", + }); + + /** + * Create a ViewSelector for the second view to be rendered inside of an + * element with the id "view-selector-2-container". + */ + var viewSelector2 = new gapi.analytics.ViewSelector({ + container: "view-selector-2-container", + }); + + /** + * Create a new ActiveUsers instance to be rendered inside of an + * element with the id "active-users-container" and poll for changes every + * five seconds. + */ + var activeUsers = new gapi.analytics.ext.ActiveUsers({ + container: "active-users-container", + pollingInterval: 5, + }); + /** + * Add CSS animation to visually show the when users come and go. + */ + activeUsers.once("success", function () { + var element = this.container.firstChild; + var timeout; + + this.on("change", function (data) { + var element = this.container.firstChild; + var animationClass = + data.delta > 0 ? "is-increasing" : "is-decreasing"; + element.className += " " + animationClass; + + clearTimeout(timeout); + timeout = setTimeout(function () { + element.className = element.className.replace( + / is-(increasing|decreasing)/g, + "" + ); + }, 3000); + }); + }); + + /** + * Create a ViewSelector for the second view to be rendered inside of an + * element with the id "view-selector-2-container". + */ + var viewSelector2 = new gapi.analytics.ViewSelector({ + container: "view-selector-2-container", + }); + + // Render both view selectors to the page. + // viewSelector1.execute(); + // viewSelector2.execute(); + + /** + * Create the first DataChart for top countries over the past 30 days. + * It will be rendered inside an element with the id "chart-1-container". + */ + var dataChart1 = new gapi.analytics.googleCharts.DataChart({ + query: { + // ids: ctrl.Google_Client_Ids, + metrics: "ga:sessions", + dimensions: "ga:date", + "start-date": "30daysAgo", + "end-date": "yesterday", + }, + chart: { + container: "chart-1-container", + type: "LINE", + options: { + width: "95%", + legendTextStyle: { color: "#333" }, + titleTextStyle: { color: "#333" }, + backgroundColor: { fill: "transparent" }, + hAxis: { + textStyle: { color: "#333" }, + }, + vAxis: { + textStyle: { color: "#333" }, + }, + series: { + 0: { + color: + $rootScope.globalSettings.portalThemeSettings + .primaryColor, + }, + 1: { color: "#e7711b" }, + 2: { color: "#f1ca3a" }, + 3: { color: "#6f9654" }, + 4: { color: "#1c91c0" }, + 5: { color: "#43459d" }, + }, + }, + }, + }); + + /** + * Create the second DataChart for top countries over the past 30 days. + * It will be rendered inside an element with the id "chart-2-container". + */ + var dataChart2 = new gapi.analytics.googleCharts.DataChart({ + query: { + // ids: ctrl.Google_Analytic_Ids, + metrics: "ga:sessions", + dimensions: "ga:country", + "start-date": "90daysAgo", + "end-date": "yesterday", + "max-results": 6, + sort: "-ga:sessions", + }, + chart: { + container: "chart-2-container", + type: "GEO", + options: { + width: "95%", + pieHole: 4 / 9, + }, + }, + }); + + dataChart1 + .set({ + query: { + ids: ctrl.Google_Analytic_Ids, + }, + }) + .execute(); + dataChart2 + .set({ + query: { + ids: ctrl.Google_Analytic_Ids, + }, + }) + .execute(); + activeUsers + .set({ + ids: ctrl.Google_Analytic_Ids, + }) + .execute(); + + // /** + // * Update the first dataChart when the first view selecter is changed. + // */ + // viewSelector1.on('change', function (ids) { + // dataChart1.set({ query: { ids: ids } }).execute(); + // // Start tracking active users for this view. + // activeUsers.set({ ids: ids }).execute(); + // }); + + // /** + // * Update the first dataChart when the first view selecter is changed. + // */ + // viewSelector2.on('change', function (ids) { + // dataChart2.set({ query: { ids: ids } }).execute(); + // // Start tracking active users for this view. + // activeUsers.set({ ids: ids }).execute(); + // }); + + // /** + // * Update the second dataChart when the second view selecter is changed. + // */ + // viewSelector2.on('change', function (ids) { + // dataChart2.set({ query: { ids: ids } }).execute(); + // }); } - } - ctrl.rootType = Array.isArray(ctrl.data) ? "array" : "object"; - ctrl.parseObjToList(ctrl.data, arr); - ctrl.strData = JSON.stringify(ctrl.data); - ctrl.dropzones.root = arr; - ctrl.preview = angular.copy(ctrl.data); + }); } }; - ctrl.loadFile = async function () { - $rootScope.isBusy = true; - $scope.listUrl = "/admin/json-data/list?folder=" + ctrl.folder; + }, + ], +}); - var response = await fileService.getFile(ctrl.folder, ctrl.filename); - if (response.success) { - ctrl.file = response.data; - ctrl.data = JSON.parse(response.data.content); - $rootScope.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showErrors(response.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - ctrl.saveFile = async function () { - $rootScope.isBusy = true; - ctrl.model = {}; - ctrl.update(); - if (ctrl.save) { - ctrl.save({ data: ctrl.model }); - } else { - // ctrl.parseObj(ctrl.dropzones.root, ctrl.model); - ctrl.file.content = JSON.stringify(ctrl.model); - var resp = await fileService.saveFile(ctrl.file); - if (resp && resp.success) { - $scope.activedFile = resp.data; - $rootScope.showMessage("Update successfully!", "success"); - $rootScope.isBusy = false; - $scope.$apply(); - } else { - if (resp) { - $rootScope.showErrors(resp.errors); - } - $rootScope.isBusy = false; - $scope.$apply(); - } - } - ctrl.select(ctrl.selected); - }; - ctrl.update = function () { - ctrl.model = {}; - var obj = { - type: "object", - name: "data", - columns: [ - { - items: ctrl.dropzones.root, - }, - ], +modules.component("githubReleases", { + templateUrl: "/mix-app/views/app-portal/components/github-releases/view.html", + controller: [ + "$rootScope", + "$http", + function ($rootScope, $http) { + var ctrl = this; + ctrl.items = []; + ctrl.init = function () { + var req = { + method: "GET", + url: "https://api.github.com/repos/mixcore/mix.core/releases", }; - ctrl.parseObj(obj, ctrl.model); - ctrl.strData = JSON.stringify(ctrl.model); - ctrl.onUpdate({ data: ctrl.model }); - }; - ctrl.updateJsonContent = function (strData) { - if (strData) { - ctrl.model = JSON.parse(strData); - ctrl.strData = strData; - ctrl.onUpdate({ data: ctrl.model }); - } - }; - ctrl.parseObjToList = function (item, items) { - // key: the name of the object key - // index: the ordinal position of the key within the object - if (Array.isArray(item)) { - angular.forEach(item, (e) => { - var obj = angular.copy(ctrl.templates[1]); - obj.value = e; - // ctrl.parseObjToList(e, obj.columns[0].items); - items.push(obj); - }); - } else { - Object.keys(item).forEach(function (key) { - var obj = {}; - if (item[key]) { - var objType = typeof item[key]; - switch (objType) { - case "object": - if (Array.isArray(item[key])) { - obj = angular.copy(ctrl.templates[2]); - obj.name = key; - ctrl.parseObjToList(item[key], obj.columns[0].items); - items.push(obj); - } else { - obj = angular.copy(ctrl.templates[1]); - obj.name = key; - ctrl.parseObjToList(item[key], obj.columns[0].items); - items.push(obj); - } - break; - default: - obj = angular.copy(ctrl.templates[0]); - obj.name = key; - obj.value = item[key]; - items.push(obj); - break; - } - } - }); - } - }; - ctrl.parseObj = function (item, obj, name) { - switch (item.type) { - case "array": - obj[item.name] = []; - angular.forEach(item.columns[0].items, (sub) => { - var o = {}; - ctrl.parseObj(sub, o); - obj[item.name].push(o); - }); - break; - case "object": - angular.forEach(item.columns[0].items, (sub) => { - if (sub.type == "object") { - var o = {}; - ctrl.parseObj(sub, o); - obj[item.name] = o; - } else { - ctrl.parseObj(sub, obj, item.name); - } - }); - break; - case "item": - obj[item.name] = item.value; - break; - } + ctrl.getGithubApiResult(req); }; - ctrl.parseJsonObject = function () { - if (ctrl.rootType == "object") { - ctrl.data = {}; - angular.forEach(ctrl.dropzones.root, (sub) => { - if (sub.type == "object") { - var o = {}; - ctrl.parseObj(sub, o); - ctrl.data[sub.name] = o; + + ctrl.getGithubApiResult = async function (req) { + return $http(req).then( + function (resp) { + if (resp.status == "200") { + ctrl.items = resp.data; } else { - ctrl.data[sub.name] = sub.value; } - }); - } else { - ctrl.data = []; - if (ctrl.rootType == "array") { - angular.forEach(ctrl.dropzones.root, (sub) => { - ctrl.data.push(sub.value); - }); + }, + function (error) { + return { + success: false, + errors: [error.statusText || error.status], + }; } - } - ctrl.strData = JSON.stringify(ctrl.data); - ctrl.onUpdate({ data: JSON.stringify(ctrl.data) }); - }; - ctrl.select = function (item) { - if (ctrl.selected == item) { - ctrl.parseObj(item, ctrl.selectedModel); - } else { - ctrl.selected = item; - ctrl.selectedModel = {}; - ctrl.parseObj(item, ctrl.selectedModel); - } - ctrl.timestamp = Math.random(); - }; - ctrl.addField = function () { - var column = angular.copy(ctrl.templates[0]); - ctrl.dropzones.root.push(column); - ctrl.parseJsonObject(); - }; - ctrl.addString = function () { - var column = angular.copy(ctrl.templates[1]); - ctrl.dropzones.root.push(column); - ctrl.parseJsonObject(); - }; - ctrl.addObj = function (item) { - var obj = angular.copy(ctrl.templates[1]); - obj.name = "o" + (item.columns[0].items.length + 1); - item.columns[0].items.push(obj); - item.showMenu = false; - ctrl.parseJsonObject(); - }; - ctrl.addArray = function (item) { - var obj = angular.copy(ctrl.templates[2]); - obj.name = "a" + (item.columns[0].items.length + 1); - item.columns[0].items.push(obj); - item.showMenu = false; - ctrl.parseJsonObject(); - }; - ctrl.clone = function (item, list) { - var obj = angular.copy(item); - obj.name = item.name + "_copy"; - item.showMenu = false; - obj.showMenu = false; - list.items.push(obj); - ctrl.parseJsonObject(); - }; - - ctrl.remove = function (index, list) { - if (confirm("Remove this")) { - list.splice(index, 1); - ctrl.parseJsonObject(); - } + ); }; }, ], -}); - -modules.component("highFrequencyMessages", { - templateUrl: - "/mix-app/views/app-portal/components/high-frequency-messages/view.html", - controller: "HighFrequencyMessagesController", bindings: {}, }); -app.controller("HighFrequencyMessagesController", [ - "$scope", - "$rootScope", - "AuthService", - function ($scope, $rootScope, authService) { - BaseHub.call(this, $scope); - authService.fillAuthData(); - $scope.newMsgCount = 0; - $scope.messages = []; - $scope.mouses = []; - $scope.init = function () { - // $scope.connectHightFrequencyHub(); - }; - $scope.connectHightFrequencyHub = () => { - $scope.startConnection( - "highFrequencyHub", - authService.authentication.accessToken, - (err) => { - if ( - authService.authentication.refreshToken && - err.message.indexOf("401") >= 0 - ) { - authService.refreshToken().then(async () => { - $scope.startConnection( - "highFrequencyHub", - authService.authentication.accessToken - ); - }); - } - } - ); - }; - $scope.onConnected = () => { - $scope.joinRoom("mouseMove_portal"); + +(function (angular) { + app.component("headerNav", { + templateUrl: + "/mix-app/views/app-portal/components/header-nav/headerNav.html", + controller: [ + "$rootScope", + "$scope", + "ngAppSettings", + "localStorageService", + "CommonService", + "ApiService", + "AuthService", + "CultureService", + function ( + $rootScope, + $scope, + ngAppSettings, + localStorageService, + commonService, + apiService, + authService, + cultureService + ) { + var ctrl = this; + ctrl.appSettings = $rootScope.globalSettings; + ctrl.isInRole = $rootScope.isInRole; + this.$onInit = function () { + ctrl.isAdmin = $rootScope.isAdmin; + ctrl.mixConfigurations = $rootScope.mixConfigurations; + cultureService.getList(ngAppSettings.request).then((resp) => { + ctrl.cultures = resp.data.items; + ctrl.selectedCulture = ctrl.cultures.find( + (m) => + m.specificulture == $rootScope.globalSettings.defaultCulture + ); + $scope.$apply(); + }); + authService.fillAuthData().then(() => { + if ( + authService.authentication && + authService.authentication.info.userData + ) { + ctrl.avatar = authService.authentication.info.userData.avatar; + } + }); + }; + ctrl.translate = $rootScope.translate; + ctrl.getConfiguration = function (keyword, isWrap, defaultText) { + return $rootScope.getConfiguration(keyword, isWrap, defaultText); + }; + ctrl.changeLang = function (culture) { + $rootScope.globalSettings.defaultCulture = culture.specificulture; + localStorageService.set("globalSettings", $rootScope.globalSettings); + window.top.location = location.href; + }; + ctrl.logOut = function () { + $rootScope.logOut(); + }; + ctrl.addPermission = function () { + $("#dlg-permission").modal("show"); + }; + ctrl.addBookmark = function () { + $("#dlg-bookmark").modal("show"); + }; + ctrl.toggleSidebar = function () { + $(".main-sidebar").toggle(); + $(".sub-sidebar").toggle(); + // $('.navbar-brand').toggle(); + }; + ctrl.clearCache = async function () { + $rootScope.isBusy = true; + await commonService.clearCache(); + $rootScope.showMessage("success", "success"); + $rootScope.isBusy = false; + $scope.$apply(); + }; + ctrl.showHelper = function (url) { + $rootScope.helperUrl = url; + $("#dev-helper-modal").modal("show"); + }; + ctrl.generateSitemap = async function () { + $rootScope.isBusy = true; + var resp = await commonService.genrateSitemap(); + if (resp) { + window.top.location.href = + "/admin/file/details?folder=" + + resp.fileFolder + + "&filename=" + + resp.filename + + resp.extension; + } else { + $rootScope.isBusy = false; + $rootScope.showErrors(["Server error"]); + } + }; + }, + ], + bindings: { + breadCrumbs: "=", + settings: "=", + }, + }); +})(window.angular); + +modules.component("highFrequencyMessages", { + templateUrl: + "/mix-app/views/app-portal/components/high-frequency-messages/view.html", + controller: "HighFrequencyMessagesController", + bindings: {}, +}); +app.controller("HighFrequencyMessagesController", [ + "$scope", + "$rootScope", + "AuthService", + function ($scope, $rootScope, authService) { + BaseHub.call(this, $scope); + authService.fillAuthData(); + $scope.newMsgCount = 0; + $scope.messages = []; + $scope.mouses = []; + $scope.init = function () { + // $scope.connectHightFrequencyHub(); + }; + $scope.connectHightFrequencyHub = () => { + $scope.startConnection( + "highFrequencyHub", + authService.authentication.accessToken, + (err) => { + if ( + authService.authentication.refreshToken && + err.message.indexOf("401") >= 0 + ) { + authService.refreshToken().then(async () => { + $scope.startConnection( + "highFrequencyHub", + authService.authentication.accessToken + ); + }); + } + } + ); + }; + $scope.onConnected = () => { + $scope.joinRoom("mouseMove_portal"); $scope.streamMouseMove(); }; $scope.onLeave = () => { @@ -11307,206 +11480,315 @@ app.controller("HubMessagesController", [ }, ]); -modules.component("googleAnalytic", { - templateUrl: "/mix-app/views/app-portal/components/google-analytic/view.html", +modules.component("jumbotrons", { + templateUrl: + "/mix-app/views/app-portal/components/jumbotrons/jumbotrons.html", + controller: [ + "$rootScope", + "$scope", + "$location", + function ($rootScope, $scope, $location) { + var ctrl = this; + ctrl.translate = function (keyword) { + return $rootScope.translate(keyword); + }; + // ctrl.back = function () { + // ctrl.backUrl = ctrl.backUrl || '/admin'; + // $location.path(ctrl.backUrl); + // }; + }, + ], bindings: { - Google_Client_Id: "=?", - Google_Client_Ids: "=?", - Google_Analytic_Ids: "=?", + tagName: "=", + tagType: "=", + }, +}); + +modules.component("jsonBuilder", { + templateUrl: "/mix-app/views/app-portal/components/json-builder/view.html", + bindings: { + data: "=?", // json obj (ex: { column1: 'some val' }) + strData: "=?", // json obj (ex: { column1: 'some val' }) + folder: "=?", // filepath (ex: 'data/jsonfile.json') + filename: "=?", // filepath (ex: 'data/jsonfile.json') + allowedTypes: "=?", // string array ( ex: [ 'type1', 'type2' ] ) + backUrl: "=?", // string array ( ex: [ 'type1', 'type2' ] ) + showPreview: "=?", + type: "=?", // array / obj + editMode: "=?", // array / obj + save: "&", + onUpdate: "&", }, controller: [ "$rootScope", - "ApiService", - "CommonService", - function ($rootScope, apiService, commonService) { + "$scope", + "$location", + "FileServices", + "ngAppSettings", + function ($rootScope, $scope, $location, fileService, ngAppSettings) { var ctrl = this; - ctrl.init = function () { - if (gapi) { - gapi.analytics.ready(function () { - if (ctrl.Google_Client_Id) { - /** - * Authorize the user immediately if the user has already granted access. - * If no access has been created, render an authorize button inside the - * element with the ID "embed-api-auth-container". - */ - gapi.analytics.auth.authorize({ - container: "embed-api-auth-container", - //REPLACE WITH YOUR CLIENT ID - clientid: ctrl.Google_Client_Id, - }); - - /** - * Create a ViewSelector for the first view to be rendered inside of an - * element with the id "view-selector-1-container". - */ - var viewSelector1 = new gapi.analytics.ViewSelector({ - container: "view-selector-1-container", - }); - - /** - * Create a ViewSelector for the second view to be rendered inside of an - * element with the id "view-selector-2-container". - */ - var viewSelector2 = new gapi.analytics.ViewSelector({ - container: "view-selector-2-container", - }); - - /** - * Create a new ActiveUsers instance to be rendered inside of an - * element with the id "active-users-container" and poll for changes every - * five seconds. - */ - var activeUsers = new gapi.analytics.ext.ActiveUsers({ - container: "active-users-container", - pollingInterval: 5, - }); - /** - * Add CSS animation to visually show the when users come and go. - */ - activeUsers.once("success", function () { - var element = this.container.firstChild; - var timeout; - - this.on("change", function (data) { - var element = this.container.firstChild; - var animationClass = - data.delta > 0 ? "is-increasing" : "is-decreasing"; - element.className += " " + animationClass; - clearTimeout(timeout); - timeout = setTimeout(function () { - element.className = element.className.replace( - / is-(increasing|decreasing)/g, - "" - ); - }, 3000); - }); - }); - - /** - * Create a ViewSelector for the second view to be rendered inside of an - * element with the id "view-selector-2-container". - */ - var viewSelector2 = new gapi.analytics.ViewSelector({ - container: "view-selector-2-container", - }); - - // Render both view selectors to the page. - // viewSelector1.execute(); - // viewSelector2.execute(); - - /** - * Create the first DataChart for top countries over the past 30 days. - * It will be rendered inside an element with the id "chart-1-container". - */ - var dataChart1 = new gapi.analytics.googleCharts.DataChart({ - query: { - // ids: ctrl.Google_Client_Ids, - metrics: "ga:sessions", - dimensions: "ga:date", - "start-date": "30daysAgo", - "end-date": "yesterday", - }, - chart: { - container: "chart-1-container", - type: "LINE", - options: { - width: "95%", - legendTextStyle: { color: "#333" }, - titleTextStyle: { color: "#333" }, - backgroundColor: { fill: "transparent" }, - hAxis: { - textStyle: { color: "#333" }, - }, - vAxis: { - textStyle: { color: "#333" }, - }, - series: { - 0: { - color: - $rootScope.globalSettings.portalThemeSettings - .primaryColor, - }, - 1: { color: "#e7711b" }, - 2: { color: "#f1ca3a" }, - 3: { color: "#6f9654" }, - 4: { color: "#1c91c0" }, - 5: { color: "#43459d" }, - }, - }, - }, - }); - - /** - * Create the second DataChart for top countries over the past 30 days. - * It will be rendered inside an element with the id "chart-2-container". - */ - var dataChart2 = new gapi.analytics.googleCharts.DataChart({ - query: { - // ids: ctrl.Google_Analytic_Ids, - metrics: "ga:sessions", - dimensions: "ga:country", - "start-date": "90daysAgo", - "end-date": "yesterday", - "max-results": 6, - sort: "-ga:sessions", - }, - chart: { - container: "chart-2-container", - type: "GEO", - options: { - width: "95%", - pieHole: 4 / 9, - }, - }, - }); - - dataChart1 - .set({ - query: { - ids: ctrl.Google_Analytic_Ids, - }, - }) - .execute(); - dataChart2 - .set({ - query: { - ids: ctrl.Google_Analytic_Ids, - }, - }) - .execute(); - activeUsers - .set({ - ids: ctrl.Google_Analytic_Ids, - }) - .execute(); - - // /** - // * Update the first dataChart when the first view selecter is changed. - // */ - // viewSelector1.on('change', function (ids) { - // dataChart1.set({ query: { ids: ids } }).execute(); - // // Start tracking active users for this view. - // activeUsers.set({ ids: ids }).execute(); - // }); - - // /** - // * Update the first dataChart when the first view selecter is changed. - // */ - // viewSelector2.on('change', function (ids) { - // dataChart2.set({ query: { ids: ids } }).execute(); - // // Start tracking active users for this view. - // activeUsers.set({ ids: ids }).execute(); - // }); + ctrl.file = null; + ctrl.translate = $rootScope.translate; + ctrl.mixConfigurations = $rootScope.globalSettings; + ctrl.timestamp = Math.random(); + ctrl.templates = [ + { + type: "item", + name: "", + dataType: "Text", + value: "", + columns: [{ allowedTypes: ["item"], items: [] }], + }, + { + type: "string", + dataType: "Text", + value: "", + columns: [{ allowedTypes: ["item"], items: [] }], + }, + { + type: "object", + name: "o1", + columns: [{ allowedTypes: ["array", "object", "item"], items: [] }], + }, + { + type: "array", + name: "a1", + columns: [{ allowedTypes: ["object"], items: [] }], + }, + ]; + ctrl.draft = []; + ctrl.model = {}; + ctrl.dropzones = { + root: [], + }; + ctrl.selected = null; + ctrl.selectedModel = {}; + ctrl.strModel = null; + ctrl.init = async function () { + var arr = []; + if (!ctrl.editMode) { + ctrl.editMode = "json"; + } + if (!ctrl.data && ctrl.filename) { + await ctrl.loadFile(); + ctrl.parseObjToList(ctrl.data, arr); + ctrl.dropzones.root = arr; + } else { + if (!ctrl.data) { + if (ctrl.strData) { + ctrl.data = JSON.parse(ctrl.strData); + } + if (!ctrl.data && ctrl.type) { + ctrl.data = ctrl.type == "array" ? [] : {}; + } + } + ctrl.rootType = Array.isArray(ctrl.data) ? "array" : "object"; + ctrl.parseObjToList(ctrl.data, arr); + ctrl.strData = JSON.stringify(ctrl.data); + ctrl.dropzones.root = arr; + ctrl.preview = angular.copy(ctrl.data); + } + }; + ctrl.loadFile = async function () { + $rootScope.isBusy = true; + $scope.listUrl = "/admin/json-data/list?folder=" + ctrl.folder; - // /** - // * Update the second dataChart when the second view selecter is changed. - // */ - // viewSelector2.on('change', function (ids) { - // dataChart2.set({ query: { ids: ids } }).execute(); - // }); + var response = await fileService.getFile(ctrl.folder, ctrl.filename); + if (response.success) { + ctrl.file = response.data; + ctrl.data = JSON.parse(response.data.content); + $rootScope.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showErrors(response.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } + }; + ctrl.saveFile = async function () { + $rootScope.isBusy = true; + ctrl.model = {}; + ctrl.update(); + if (ctrl.save) { + ctrl.save({ data: ctrl.model }); + } else { + // ctrl.parseObj(ctrl.dropzones.root, ctrl.model); + ctrl.file.content = JSON.stringify(ctrl.model); + var resp = await fileService.saveFile(ctrl.file); + if (resp && resp.success) { + $scope.activedFile = resp.data; + $rootScope.showMessage("Update successfully!", "success"); + $rootScope.isBusy = false; + $scope.$apply(); + } else { + if (resp) { + $rootScope.showErrors(resp.errors); + } + $rootScope.isBusy = false; + $scope.$apply(); + } + } + ctrl.select(ctrl.selected); + }; + ctrl.update = function () { + ctrl.model = {}; + var obj = { + type: "object", + name: "data", + columns: [ + { + items: ctrl.dropzones.root, + }, + ], + }; + ctrl.parseObj(obj, ctrl.model); + ctrl.strData = JSON.stringify(ctrl.model); + ctrl.onUpdate({ data: ctrl.model }); + }; + ctrl.updateJsonContent = function (strData) { + if (strData) { + ctrl.model = JSON.parse(strData); + ctrl.strData = strData; + ctrl.onUpdate({ data: ctrl.model }); + } + }; + ctrl.parseObjToList = function (item, items) { + // key: the name of the object key + // index: the ordinal position of the key within the object + if (Array.isArray(item)) { + angular.forEach(item, (e) => { + var obj = angular.copy(ctrl.templates[1]); + obj.value = e; + // ctrl.parseObjToList(e, obj.columns[0].items); + items.push(obj); + }); + } else { + Object.keys(item).forEach(function (key) { + var obj = {}; + if (item[key]) { + var objType = typeof item[key]; + switch (objType) { + case "object": + if (Array.isArray(item[key])) { + obj = angular.copy(ctrl.templates[2]); + obj.name = key; + ctrl.parseObjToList(item[key], obj.columns[0].items); + items.push(obj); + } else { + obj = angular.copy(ctrl.templates[1]); + obj.name = key; + ctrl.parseObjToList(item[key], obj.columns[0].items); + items.push(obj); + } + break; + default: + obj = angular.copy(ctrl.templates[0]); + obj.name = key; + obj.value = item[key]; + items.push(obj); + break; + } + } + }); + } + }; + ctrl.parseObj = function (item, obj, name) { + switch (item.type) { + case "array": + obj[item.name] = []; + angular.forEach(item.columns[0].items, (sub) => { + var o = {}; + ctrl.parseObj(sub, o); + obj[item.name].push(o); + }); + break; + case "object": + angular.forEach(item.columns[0].items, (sub) => { + if (sub.type == "object") { + var o = {}; + ctrl.parseObj(sub, o); + obj[item.name] = o; + } else { + ctrl.parseObj(sub, obj, item.name); + } + }); + break; + case "item": + obj[item.name] = item.value; + break; + } + }; + ctrl.parseJsonObject = function () { + if (ctrl.rootType == "object") { + ctrl.data = {}; + angular.forEach(ctrl.dropzones.root, (sub) => { + if (sub.type == "object") { + var o = {}; + ctrl.parseObj(sub, o); + ctrl.data[sub.name] = o; + } else { + ctrl.data[sub.name] = sub.value; } }); + } else { + ctrl.data = []; + if (ctrl.rootType == "array") { + angular.forEach(ctrl.dropzones.root, (sub) => { + ctrl.data.push(sub.value); + }); + } + } + ctrl.strData = JSON.stringify(ctrl.data); + ctrl.onUpdate({ data: JSON.stringify(ctrl.data) }); + }; + ctrl.select = function (item) { + if (ctrl.selected == item) { + ctrl.parseObj(item, ctrl.selectedModel); + } else { + ctrl.selected = item; + ctrl.selectedModel = {}; + ctrl.parseObj(item, ctrl.selectedModel); + } + ctrl.timestamp = Math.random(); + }; + ctrl.addField = function () { + var column = angular.copy(ctrl.templates[0]); + ctrl.dropzones.root.push(column); + ctrl.parseJsonObject(); + }; + ctrl.addString = function () { + var column = angular.copy(ctrl.templates[1]); + ctrl.dropzones.root.push(column); + ctrl.parseJsonObject(); + }; + ctrl.addObj = function (item) { + var obj = angular.copy(ctrl.templates[1]); + obj.name = "o" + (item.columns[0].items.length + 1); + item.columns[0].items.push(obj); + item.showMenu = false; + ctrl.parseJsonObject(); + }; + ctrl.addArray = function (item) { + var obj = angular.copy(ctrl.templates[2]); + obj.name = "a" + (item.columns[0].items.length + 1); + item.columns[0].items.push(obj); + item.showMenu = false; + ctrl.parseJsonObject(); + }; + ctrl.clone = function (item, list) { + var obj = angular.copy(item); + obj.name = item.name + "_copy"; + item.showMenu = false; + obj.showMenu = false; + list.items.push(obj); + ctrl.parseJsonObject(); + }; + + ctrl.remove = function (index, list) { + if (confirm("Remove this")) { + list.splice(index, 1); + ctrl.parseJsonObject(); } }; }, @@ -11551,9 +11833,11 @@ modules.component("listMixColumn", { childId: null, displayName: null, }; + ctrl.$onInit = async function () { ctrl.dataTypes = $rootScope.globalSettings.dataTypes; ctrl.request.mixDatabaseContextId = $routeParams.mixDatabaseContextId; + ctrl.updateNamingConvention(); ctrl.databases = await databaseService.getList(ctrl.request); var getDefaultAttr = await service.getDefault(); if (getDefaultAttr.success) { @@ -11566,13 +11850,42 @@ modules.component("listMixColumn", { $rootScope.sortArray(ctrl.columns, "priority"); $scope.$apply(); }; - ctrl.addAttr = function () { + ctrl.addColumn = function ( + colName = undefined, + dataType = undefined, + required = false, + defaultValue = undefined + ) { if (ctrl.columns) { var t = angular.copy(ctrl.defaultAttr); t.priority = ctrl.columns.length + 1; + t.columnConfigurations.isRequire = required; + t.defaultValue = defaultValue; + if (colName) { + t.displayName = colName; + t.systemName = colName; + } + if (dataType) { + t.dataType = dataType; + } + if (defaultValue) { + t.defaultValue = defaultValue; + } ctrl.columns.push(t); } }; + ctrl.addDefaultColumns = () => { + ctrl.addColumn(ctrl.fieldNames.id, "Integer", true); + ctrl.addColumn(ctrl.fieldNames.createdBy, "String"); + ctrl.addColumn( + ctrl.fieldNames.createdDateTime, + "DateTime", + true, + "now()" + ); + ctrl.addColumn(ctrl.fieldNames.lastModified, "DateTime", true, "now()"); + ctrl.addColumn(ctrl.fieldNames.priority, "Integer", false, 0); + }; ctrl.showModal = (id) => { $(`#advance-${id}`).modal("toggle"); }; @@ -11696,7 +12009,42 @@ modules.component("listMixColumn", { }); ctrl.viewmodel.formView.content = formHtml.innerHTML; }; - + ctrl.updateNamingConvention = () => { + ctrl.fieldNames = { + id: ctrl.namingConvention == "TitleCase" ? "Id" : "id", + parentId: + ctrl.namingConvention == "TitleCase" ? "ParentId" : "parent_id", + parentDatabaseName: + ctrl.namingConvention == "TitleCase" + ? "ParentDatabaseName" + : "parent_database_name", + childId: + ctrl.namingConvention == "TitleCase" ? "ChildId" : "child_id", + childDatabaseName: + ctrl.namingConvention == "TitleCase" + ? "ChildDatabaseName" + : "child_database_name", + createdDateTime: + ctrl.namingConvention == "TitleCase" + ? "CreatedDateTime" + : "created_date_time", + lastModified: + ctrl.namingConvention == "TitleCase" + ? "LastModified" + : "last_modified", + tenantId: + ctrl.namingConvention == "TitleCase" ? "TenantId" : "tenant_id", + createdBy: + ctrl.namingConvention == "TitleCase" ? "CreatedBy" : "created_by", + modifiedBy: + ctrl.namingConvention == "TitleCase" ? "ModifiedBy" : "modified_by", + priority: + ctrl.namingConvention == "TitleCase" ? "Priority" : "priority", + status: ctrl.namingConvention == "TitleCase" ? "Status" : "status", + isDeleted: + ctrl.namingConvention == "TitleCase" ? "IsDeleted" : "is_deleted", + }; + }; ctrl.generateName = function (col, isForce = false) { if (isForce || !col.systemName) { col.systemName = $rootScope.generateKeyword( @@ -11745,6 +12093,41 @@ modules.component("listMixColumn", { ], }); +modules.component("mainSideBar", { + templateUrl: + "/mix-app/views/app-portal/components/main-side-bar/main-side-bar.html", + controller: [ + "$rootScope", + "$scope", + "ngAppSettings", + "TranslatorService", + "ApiService", + "CommonService", + function ( + $rootScope, + $scope, + ngAppSettings, + translatorService, + apiService, + commonService + ) { + var ctrl = this; + ctrl.items = []; + ctrl.init = async function () { + var resp = await apiService.getPortalMenus(); + if (resp.success && resp.data && resp.data.length) { + ctrl.items = resp.data; + } else { + ctrl.items = JSON.parse($("#portal-menus").val()).items; + } + }; + }, + ], + bindings: { + items: "=?", + }, +}); + modules.component("logStream", { templateUrl: "/mix-app/views/app-portal/components/log-stream/view.html", controller: "LogStreamController", @@ -11839,205 +12222,67 @@ app.controller("LogStreamController", [ }, ]); -modules.component("mainSideBarDynamic", { - templateUrl: - "/mix-app/views/app-portal/components/main-side-bar-dynamic/main-side-bar-dynamic.html", - controller: [ - "$rootScope", - "$scope", - "ngAppSettings", - "CommonService", - "TranslatorService", - "AuthService", - function ( - $rootScope, - $scope, - ngAppSettings, - commonService, - translatorService, - authService - ) { - var ctrl = this; - ctrl.init = function () { - // commonService.getPermissions().then(function (response) { - // if (response && response.success) { - // ctrl.isInit = true; - // ctrl.roles = response.data; - // if (ctrl.roles.data) { - // ctrl.role = ctrl.roles.data[0]; - // } - // $rootScope.isBusy = false; - // $scope.$apply(); - // } - // }); - }; - }, - ], - bindings: { - roles: "=", - activedRole: "=", - translate: "&", - }, -}); - -modules.component("jumbotrons", { - templateUrl: - "/mix-app/views/app-portal/components/jumbotrons/jumbotrons.html", - controller: [ - "$rootScope", - "$scope", - "$location", - function ($rootScope, $scope, $location) { - var ctrl = this; - ctrl.translate = function (keyword) { - return $rootScope.translate(keyword); - }; - // ctrl.back = function () { - // ctrl.backUrl = ctrl.backUrl || '/admin'; - // $location.path(ctrl.backUrl); - // }; - }, - ], - bindings: { - tagName: "=", - tagType: "=", - }, -}); - -modules.component("mainSideBarItem", { - templateUrl: - "/mix-app/views/app-portal/components/main-side-bar-item/main-side-bar-item.html", - controller: [ - "$rootScope", - function ($rootScope) { - var ctrl = this; - ctrl.translate = $rootScope.translate; - ctrl.addClass = function (obj) { - obj.currentTarget.classList.add("btn-group-lg"); - //alert(obj); - }; - ctrl.removeClass = function (obj) { - obj.currentTarget.classList.remove("btn-group-lg"); - //alert(obj); - }; - }, - ], - bindings: { - item: "=", - }, -}); - -modules.component("mainSideBar", { - templateUrl: - "/mix-app/views/app-portal/components/main-side-bar/main-side-bar.html", - controller: [ - "$rootScope", - "$scope", - "ngAppSettings", - "TranslatorService", - "ApiService", - "CommonService", - function ( - $rootScope, - $scope, - ngAppSettings, - translatorService, - apiService, - commonService - ) { - var ctrl = this; - ctrl.items = []; - ctrl.init = async function () { - var resp = await apiService.getPortalMenus(); - if (resp.success && resp.data && resp.data.length) { - ctrl.items = resp.data; - } else { - ctrl.items = JSON.parse($("#portal-menus").val()).items; - } - }; - }, - ], - bindings: { - items: "=?", - }, -}); - -modules.component("mainSideBarItemDynamic", { +modules.component("mainSideBarItem", { templateUrl: - "/mix-app/views/app-portal/components/main-side-bar-item-dynamic/main-side-bar-item-dynamic.html", + "/mix-app/views/app-portal/components/main-side-bar-item/main-side-bar-item.html", controller: [ "$rootScope", function ($rootScope) { var ctrl = this; ctrl.translate = $rootScope.translate; + ctrl.addClass = function (obj) { + obj.currentTarget.classList.add("btn-group-lg"); + //alert(obj); + }; + ctrl.removeClass = function (obj) { + obj.currentTarget.classList.remove("btn-group-lg"); + //alert(obj); + }; }, ], bindings: { - iconSize: "=", - linkStyle: "=", - itemStyle: "=", item: "=", }, }); -modules.component("mediaUpload", { +modules.component("mainSideBarDynamic", { templateUrl: - "/mix-app/views/app-portal/components/media-upload/media-upload.html", + "/mix-app/views/app-portal/components/main-side-bar-dynamic/main-side-bar-dynamic.html", controller: [ - "$scope", "$rootScope", - "MediaService", - "ApiService", + "$scope", + "ngAppSettings", "CommonService", - function ($scope, $rootScope, service, apiService, commonService) { + "TranslatorService", + "AuthService", + function ( + $rootScope, + $scope, + ngAppSettings, + commonService, + translatorService, + authService + ) { var ctrl = this; - ctrl.default = { - title: "", - description: "", - status: "Published", - fileFolder: "Medias", - mediaFile: { - file: null, - fullPath: "", - folderName: "Media", - fileFolder: "", - fileName: "", - extension: "", - content: "", - fileStream: "", - }, - }; - ctrl.viewmodel = angular.copy(ctrl.default); - ctrl.onInsert = function (data) { - if (ctrl.onUpdate) { - ctrl.onUpdate(); - } - }; - ctrl.save = async function (data) { - $rootScope.isBusy = true; - var resp = await service.save(data); - if (resp && resp.success) { - $scope.viewmodel = resp.data; - $rootScope.showMessage("success", "success"); - $rootScope.isBusy = false; - ctrl.viewmodel = angular.copy(ctrl.default); - if (ctrl.onUpdate) { - ctrl.onUpdate(); - } - $("#modal-files .modal-body").animate({ scrollTop: "0px" }, 500); - $scope.$apply(); - } else { - if (resp) { - $rootScope.showErrors(resp.errors); - } - $rootScope.isBusy = false; - $scope.$apply(); - } + ctrl.init = function () { + // commonService.getPermissions().then(function (response) { + // if (response && response.success) { + // ctrl.isInit = true; + // ctrl.roles = response.data; + // if (ctrl.roles.data) { + // ctrl.role = ctrl.roles.data[0]; + // } + // $rootScope.isBusy = false; + // $scope.$apply(); + // } + // }); }; }, ], bindings: { - onUpdate: "&?", + roles: "=", + activedRole: "=", + translate: "&", }, }); @@ -12123,7 +12368,7 @@ modules.component("mediaFileUpload", { ctrl.isImage = true; if (!ctrl.autoSave) { ctrl.src = result; - ctrl.fileStream = result; + ctrl.fileBase64 = result; } else { ctrl.src = result; ctrl.srcUrl = result; @@ -12205,152 +12450,121 @@ modules.component("mediaFileUpload", { ], }); -modules.component("mediumNews", { - templateUrl: "/mix-app/views/app-portal/components/medium-news/view.html", +modules.component("mainSideBarItemDynamic", { + templateUrl: + "/mix-app/views/app-portal/components/main-side-bar-item-dynamic/main-side-bar-item-dynamic.html", controller: [ "$rootScope", - "$http", - function ($rootScope, $http) { + function ($rootScope) { var ctrl = this; - ctrl.items = []; - ctrl.init = function () { - var req = { - method: "GET", - url: - "https://api.rss2json.com/v1/api.json?rss_url=https://medium.com/feed/mixcore&api_key=qww481wpgat3g4iqvqss7spzrilkbekpxpjgrbof&t=" + - Math.floor(Date.now() / 1000), - }; - ctrl.getMediumApiResult(req); - }; - - ctrl.getMediumApiResult = async function (req) { - return $http(req).then( - function (resp) { - if (resp.status == "200") { - ctrl.items = resp.data.items; - } - }, - function (error) { - return { - success: false, - errors: [error.statusText || error.status], - }; - } - ); - }; + ctrl.translate = $rootScope.translate; }, ], - bindings: {}, + bindings: { + iconSize: "=", + linkStyle: "=", + itemStyle: "=", + item: "=", + }, }); -modules.component("mixDatabaseColumn", { +modules.component("mediaUpload", { templateUrl: - "/mix-app/views/app-portal/components/mix-database-column/view.html", - bindings: { - column: "=", - }, + "/mix-app/views/app-portal/components/media-upload/media-upload.html", controller: [ - "$rootScope", "$scope", - "RestMixDatabaseColumnPortalService", - function ($rootScope, $scope, columnService) { + "$rootScope", + "MediaService", + "ApiService", + "CommonService", + function ($scope, $rootScope, service, apiService, commonService) { var ctrl = this; - ctrl.value = {}; - ctrl.column = { - dataType: "Text", - mixDatabaseName: "sysAdditionalColumn", - mixDatabaseId: 6, - }; - ctrl.selectedCol = null; - ctrl.mixConfigurations = $rootScope.globalSettings; - ctrl.$onInit = async function () {}; - ctrl.addAttr = async function () { - if (ctrl.column.name) { - var current = $rootScope.findObjectByKey( - ctrl.additionalData.columns, - "name", - ctrl.column.name - ); - if (current) { - $rootScope.showErrors(["Field " + ctrl.column.name + " existed!"]); - } else { - ctrl.column.priority = ctrl.additionalData.columns.length + 1; - $rootScope.isBusy = true; - var saveField = await columnService.create(ctrl.column); - $rootScope.isBusy = false; - if (saveField.success) { - ctrl.additionalData.columns.push(saveField.data); - - //reset column option - ctrl.column.title = ""; - ctrl.column.name = ""; - ctrl.column.dataType = "Text"; - $scope.$apply(); - } - } - } else { - $rootScope.showErrors(["Please add column Name"]); - } - }; - - ctrl.generateName = function (col) { - col.systemName = $rootScope.generateKeyword(col.displayName, "_", true); - }; - ctrl.showReferences = function (col) { - ctrl.colRef = col; - $("#modal-navs").modal("show"); + ctrl.default = { + title: "", + description: "", + status: "Published", + fileFolder: "Medias", + mediaFile: { + file: null, + fullPath: "", + folderName: "Media", + fileFolder: "", + fileName: "", + extension: "", + content: "", + fileBase64: "", + }, }; - ctrl.referenceCallback = function (selected) { - if (selected && selected.length) { - ctrl.colRef.reference = selected; - ctrl.colRef.referenceId = selected[0].id; + ctrl.viewmodel = angular.copy(ctrl.default); + ctrl.onInsert = function (data) { + if (ctrl.onUpdate) { + ctrl.onUpdate(); } - $("#modal-navs").modal("hide"); }; - ctrl.updateOrders = function (index) { - if (index > ctrl.dragStartIndex) { - ctrl.columns.splice(ctrl.dragStartIndex, 1); + ctrl.save = async function (data) { + $rootScope.isBusy = true; + var resp = await service.save(data); + if (resp && resp.success) { + $scope.viewmodel = resp.data; + $rootScope.showMessage("success", "success"); + $rootScope.isBusy = false; + ctrl.viewmodel = angular.copy(ctrl.default); + if (ctrl.onUpdate) { + ctrl.onUpdate(); + } + $("#modal-files .modal-body").animate({ scrollTop: "0px" }, 500); + $scope.$apply(); } else { - ctrl.columns.splice(ctrl.dragStartIndex + 1, 1); + if (resp) { + $rootScope.showErrors(resp.errors); + } + $rootScope.isBusy = false; + $scope.$apply(); } - angular.forEach(ctrl.columns, function (e, i) { - e.priority = i; - }); }; + }, + ], + bindings: { + onUpdate: "&?", + }, +}); - ctrl.dragStart = function (index) { - ctrl.dragStartIndex = index; +modules.component("mediumNews", { + templateUrl: "/mix-app/views/app-portal/components/medium-news/view.html", + controller: [ + "$rootScope", + "$http", + function ($rootScope, $http) { + var ctrl = this; + ctrl.items = []; + ctrl.init = function () { + var req = { + method: "GET", + url: + "https://api.rss2json.com/v1/api.json?rss_url=https://medium.com/feed/mixcore&api_key=qww481wpgat3g4iqvqss7spzrilkbekpxpjgrbof&t=" + + Math.floor(Date.now() / 1000), + }; + ctrl.getMediumApiResult(req); }; - ctrl.removeAttribute = function (val, index) { - $rootScope.showConfirm( - ctrl, - "removeAttributeConfirmed", - [val, index], - null, - "Remove Field", - "Deleted data will not able to recover, are you sure you want to delete this item?" - ); - }; - ctrl.removeAttributeConfirmed = async function (val, index) { - if (val.id) { - $rootScope.isBusy = true; - var result = await columnService.delete([val.id]); - if (result.success) { - ctrl.additionalData.columns.splice(index, 1); - $rootScope.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showErrors(result.errors); - $rootScope.isBusy = false; - $scope.$apply(); + ctrl.getMediumApiResult = async function (req) { + return $http(req).then( + function (resp) { + if (resp.status == "200") { + ctrl.items = resp.data.items; + } + }, + function (error) { + return { + success: false, + errors: [error.statusText || error.status], + }; } - } else { - ctrl.additionalData.columns.splice(index, 1); - } + ); }; }, ], + bindings: {}, }); app.component("mixMetadata", { @@ -12546,295 +12760,284 @@ app.component("mixMetadata", { ], }); -modules.component("mixDatabaseDataValues", { +modules.component("mixDatabaseDataFilter", { templateUrl: - "/mix-app/views/app-portal/components/mix-database-data-values/view.html", + "/mix-app/views/app-portal/components/mix-database-data-filter/view.html", bindings: { - database: "=?", - request: "=?", + query: "=", mixDatabaseName: "=?", - mixDatabaseTitle: "=?", mixDatabaseId: "=?", - relationship: "=?", - parentName: "=?", - parentId: "=?", - guidParentId: "=?", - header: "=?", - data: "=?", - canDrag: "=?", - queries: "=?", - filterType: "=?", - conjunction: "=?", - selectedList: "=?", - selectSingle: "=?", - onFilterList: "&?", - onApplyList: "&?", - onSendMail: "&?", - onUpdate: "&?", - onDuplicate: "&?", - onDelete: "&?", + selectedList: "=", + initData: "=?", + columns: "=?", + selected: "=", + callback: "&?", + save: "&?", }, controller: [ "$rootScope", "$scope", - "$location", - "$routeParams", "ngAppSettings", - "RestMixDatabasePortalService", - "MixDbService", - function ( - $rootScope, - $scope, - $location, - $routeParams, - ngAppSettings, - databaseService, - dataService - ) { + "RestMixDatabaseDataPortalService", + function ($rootScope, $scope, ngAppSettings, dataService) { var ctrl = this; - ctrl.intShowColumn = 3; - ctrl.actions = ["Delete", "SendMail"]; - ctrl.filterTypes = ["contain", "equal"]; - ctrl.conjunctions = ["Or", "And"]; - ctrl.selectedProp = null; - ctrl.mixConfigurations = $rootScope.globalSettings; - - ctrl.$onInit = async function () { - dataService.initDbName(ctrl.mixDatabaseName); + ctrl.request = angular.copy(ngAppSettings.request); + ctrl.types = ["Page", "Post"]; + ctrl.type = "Page"; + ctrl.navs = []; + ctrl.data = { items: [] }; + ctrl.goToPath = $rootScope.goToPath; + ctrl.fieldNames = { + id: ctrl.database.namingConvention == "TitleCase" ? "Id" : "id", + parentId: + ctrl.database.namingConvention == "TitleCase" + ? "ParentId" + : "parent_id", + parentDatabaseName: + ctrl.database.namingConvention == "TitleCase" + ? "ParentDatabaseName" + : "parent_database_name", + childId: + ctrl.database.namingConvention == "TitleCase" + ? "ChildId" + : "child_id", + childDatabaseName: + ctrl.database.namingConvention == "TitleCase" + ? "ChildDatabaseName" + : "child_database_name", + createdDateTime: + ctrl.database.namingConvention == "TitleCase" + ? "CreatedDateTime" + : "created_date_time", + lastModified: + ctrl.database.namingConvention == "TitleCase" + ? "LastModified" + : "last_modified", + tenantId: + ctrl.database.namingConvention == "TitleCase" + ? "TenantId" + : "tenant_id", + createdBy: + ctrl.database.namingConvention == "TitleCase" + ? "CreatedBy" + : "created_by", + modifiedBy: + ctrl.database.namingConvention == "TitleCase" + ? "ModifiedBy" + : "modified_by", + priority: + ctrl.database.namingConvention == "TitleCase" + ? "Priority" + : "priority", + status: + ctrl.database.namingConvention == "TitleCase" ? "Status" : "status", + isDeleted: + ctrl.database.namingConvention == "TitleCase" + ? "IsDeleted" + : "is_deleted", + }; + ctrl.$onInit = function () { + if (ctrl.initData) { + ctrl.data = ctrl.initData; + } else { + ctrl.loadData(); + } + }; + ctrl.loadData = async function (pageIndex) { + ctrl.isBusy = true; - if (!ctrl.selectedList) { - ctrl.selectedList = { - action: "Delete", - data: [], - }; + // ctrl.request.query = ctrl.query + ctrl.srcId; + ctrl.navs = []; + if (pageIndex !== undefined) { + ctrl.request.pageIndex = pageIndex; } - if (!ctrl.database) { - var getDatabase = await databaseService.getByName( - ctrl.mixDatabaseName - ); - if (getDatabase.success) { - ctrl.database = getDatabase.data; - } + if (ctrl.request.fromDate !== null) { + var df = new Date(ctrl.request.fromDate); + ctrl.request.fromDate = df.toISOString(); + } + if (ctrl.request.toDate !== null) { + var dt = new Date(ctrl.request.toDate); + ctrl.request.toDate = dt.toISOString(); + } + if (ctrl.mixDatabaseId) { + ctrl.request.mixDatabaseId = ctrl.mixDatabaseId; + } + if (ctrl.mixDatabaseName) { + ctrl.request.mixDatabaseName = ctrl.mixDatabaseName; + } + if (ctrl.filterType) { + ctrl.request.filterType = ctrl.filterType; } - ctrl.fieldNames = { - id: ctrl.database.namingConvention == "TitleCase" ? "Id" : "id", - parentId: - ctrl.database.namingConvention == "TitleCase" - ? "ParentId" - : "parent_id", - parentDatabaseName: - ctrl.database.namingConvention == "TitleCase" - ? "ParentDatabaseName" - : "parent_database_name", - childId: - ctrl.database.namingConvention == "TitleCase" - ? "ChildId" - : "child_id", - childDatabaseName: - ctrl.database.namingConvention == "TitleCase" - ? "ChildDatabaseName" - : "child_database_name", - createdDateTime: - ctrl.database.namingConvention == "TitleCase" - ? "CreatedDateTime" - : "created_date_time", - lastModified: - ctrl.database.namingConvention == "TitleCase" - ? "LastModified" - : "last_modified", - tenantId: - ctrl.database.namingConvention == "TitleCase" - ? "MixTenantId" - : "mix_tenant_id", - createdBy: - ctrl.database.namingConvention == "TitleCase" - ? "CreatedBy" - : "created_by", - modifiedBy: - ctrl.database.namingConvention == "TitleCase" - ? "ModifiedBy" - : "modified_by", - priority: - ctrl.database.namingConvention == "TitleCase" - ? "Priority" - : "priority", - status: - ctrl.database.namingConvention == "TitleCase" ? "Status" : "status", - isDeleted: - ctrl.database.namingConvention == "TitleCase" - ? "IsDeleted" - : "is_deleted", - }; - ctrl.request.name = ctrl.mixDatabaseName; - ctrl.request.sortBy = ctrl.fieldNames.createdDateTime; - ctrl.request.parentName = ctrl.parentName; - ctrl.request.parentId = ctrl.parentId; - ctrl.request.relationship = ctrl.relationship; - ctrl.request.guidParentId = ctrl.guidParentId; - ctrl.request.conjunction = ctrl.conjunction; - if (!ctrl.data) { - await ctrl.loadData(); + var response = await dataService.getList(ctrl.request); + if (response.success) { + ctrl.data = response.data; + ctrl.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showErrors(response.errors); + ctrl.isBusy = false; + $scope.$apply(); } - ctrl.createUrl = `/admin/mix-database-data/create?mixDatabaseId=${ - ctrl.database.id - }&mixDatabaseName=${ctrl.database.systemName}&mixDatabaseTitle=${ - ctrl.database.displayName - }&dataContentId=default&relationship=${ - ctrl.relationship || "" - }&parentId=${ctrl.parentId || ctrl.guidParentId || ""}&parentName=${ - ctrl.parentName || "" - }`; }; - ctrl.toCamelCase = (txt) => { - return txt.charAt(0).toLowerCase() + txt.substr(1); + ctrl.edit = function (nav) { + switch (ctrl.type) { + case "Page": + ctrl.goToPath(`/admin/page/details/${nav.id}`); + break; + case "Post": + ctrl.goToPath(`/admin/post/details/${nav.id}`); + break; + case "Module": + ctrl.goToPath(`/admin/module/details/${nav.id}`); + break; + } }; - ctrl.loadData = async function (pageIndex) { - if (pageIndex !== undefined) { - ctrl.request.pageIndex = pageIndex; + ctrl.onClose = function () { + ctrl.callback(); + }; + ctrl.select = function (nav) { + var current = $rootScope.findObjectByKey(ctrl.data.items, "id", nav.id); + if (!nav.isActive && ctrl.callback) { + ctrl.callback({ nav: nav }); } - dataService.initDbName(ctrl.request.mixDatabaseName); - ctrl.request.queries = []; - if (ctrl.queries) { - Object.keys(ctrl.queries).forEach((e) => { - if (ctrl.queries[e]) { - ctrl.request.queries.push({ - fieldName: e, - compareOperator: ctrl.request.compareOperator, - value: ctrl.queries[e], - }); - } + if (ctrl.isMultiple) { + current.isActive = !current.isActive; + } else { + if (!nav.isActive) { + angular.forEach(ctrl.data.items, (element) => { + element.isActive = false; + }); + } + current.isActive = !nav.isActive; + } + }; + ctrl.saveSelected = function () { + ctrl.selected = $rootScope.filterArray( + ctrl.data, + ["isActived"], + [true] + ); + setTimeout(() => { + ctrl.save().then(() => { + ctrl.loadPosts(); }); + }, 500); + }; + ctrl.limString = function (str, max) { + if (str) { + return str.length > max ? str.substring(0, max) + " ..." : str; } - var getData = await dataService.filter(ctrl.request); - ctrl.data = getData.data; - ctrl.selectedIds = ctrl.data.items.map((m) => m.id); - $scope.$apply(); }; - ctrl.select = function (item) { - if (item.isSelected) { - if (ctrl.selectSingle == "true") { - ctrl.selectedList.data.items = []; - ctrl.selectedList.data.items.push(item); + }, + ], +}); + +modules.component("mixDatabaseColumn", { + templateUrl: + "/mix-app/views/app-portal/components/mix-database-column/view.html", + bindings: { + column: "=", + }, + controller: [ + "$rootScope", + "$scope", + "RestMixDatabaseColumnPortalService", + function ($rootScope, $scope, columnService) { + var ctrl = this; + ctrl.value = {}; + ctrl.column = { + dataType: "Text", + mixDatabaseName: "sysAdditionalColumn", + mixDatabaseId: 6, + }; + ctrl.selectedCol = null; + ctrl.mixConfigurations = $rootScope.globalSettings; + ctrl.$onInit = async function () {}; + ctrl.addAttr = async function () { + if (ctrl.column.name) { + var current = $rootScope.findObjectByKey( + ctrl.additionalData.columns, + "name", + ctrl.column.name + ); + if (current) { + $rootScope.showErrors(["Field " + ctrl.column.name + " existed!"]); } else { - var current = $rootScope.findObjectByKey( - ctrl.selectedList, - "id", - item.id - ); - if (!current) { - ctrl.selectedList.data.items.push(item); + ctrl.column.priority = ctrl.additionalData.columns.length + 1; + $rootScope.isBusy = true; + var saveField = await columnService.create(ctrl.column); + $rootScope.isBusy = false; + if (saveField.success) { + ctrl.additionalData.columns.push(saveField.data); + + //reset column option + ctrl.column.title = ""; + ctrl.column.name = ""; + ctrl.column.dataType = "Text"; + $scope.$apply(); } } } else { - $rootScope.removeObject(ctrl.selectedList, item.id); + $rootScope.showErrors(["Please add column Name"]); } }; - ctrl.selectAll = function (isSelected) { - ctrl.selectedList.data.items = []; - angular.forEach(ctrl.data.items, function (e) { - e.isSelected = isSelected; - if (isSelected) { - ctrl.selectedList.data.items.push(e.id); - } - }); - }; - ctrl.filter = function (pageIndex) { - ctrl.data.items = []; - ctrl.loadData(pageIndex); + + ctrl.generateName = function (col) { + col.systemName = $rootScope.generateKeyword(col.displayName, "_", true); }; - ctrl.sendMail = async function (data) { - ctrl.onSendMail({ data: data }); + ctrl.showReferences = function (col) { + ctrl.colRef = col; + $("#modal-navs").modal("show"); }; - ctrl.apply = async function () { - ctrl.onApplyList(); + ctrl.referenceCallback = function (selected) { + if (selected && selected.length) { + ctrl.colRef.reference = selected; + ctrl.colRef.referenceId = selected[0].id; + } + $("#modal-navs").modal("hide"); }; - - ctrl.duplicate = function (data) { - ctrl.onDuplicate({ data: data }); + ctrl.updateOrders = function (index) { + if (index > ctrl.dragStartIndex) { + ctrl.columns.splice(ctrl.dragStartIndex, 1); + } else { + ctrl.columns.splice(ctrl.dragStartIndex + 1, 1); + } + angular.forEach(ctrl.columns, function (e, i) { + e.priority = i; + }); }; - ctrl.update = function (data) { - let url = `/admin/mix-database-data/details?dataContentId=${ - data.id - }&mixDatabaseName=${ctrl.request.mixDatabaseName}&mixDatabaseTitle=${ - ctrl.mixDatabaseTitle - }&guidParentId=${ctrl.guidParentId || ""}&parentId=${ - ctrl.parentId || "" - }&parentName=${ctrl.parentName || ""}`; - $location.url(url); + ctrl.dragStart = function (index) { + ctrl.dragStartIndex = index; }; - ctrl.delete = function (data) { + ctrl.removeAttribute = function (val, index) { $rootScope.showConfirm( ctrl, - "removeConfirmed", - [data.id], + "removeAttributeConfirmed", + [val, index], null, - "Remove", + "Remove Field", "Deleted data will not able to recover, are you sure you want to delete this item?" ); }; - - ctrl.removeConfirmed = async function (dataContentId) { - $rootScope.isBusy = true; - var result = await dataService.delete([dataContentId]); - if (result.success) { - if (ctrl.onDelete) { - ctrl.onDelete({ data: dataContentId }); - } - await ctrl.loadData(); - $rootScope.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showErrors(result.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - - ctrl.filterData = function (item, attributeName) { - return $rootScope.findObjectByKey( - item.data.items, - "attributeName", - attributeName - ); - }; - - ctrl.dragStart = function (index) { - ctrl.dragStartIndex = index; - ctrl.minPriority = ctrl.data.items[0].priority; - }; - ctrl.updateOrders = function (index, items) { - if (index > ctrl.dragStartIndex) { - ctrl.data.items.splice(ctrl.dragStartIndex, 1); - } else { - ctrl.data.items.splice(ctrl.dragStartIndex + 1, 1); - } - ctrl.updateDataInfos(); - }; - ctrl.updateDataInfos = async function () { - angular.forEach(ctrl.data.items, async function (e, i) { - e.priority = ctrl.minPriority + i; - var resp = await dataService.saveFields(e.id, { - priority: e.priority, - }); - if (resp && resp.success) { - $scope.activedPage = resp.data; + ctrl.removeAttributeConfirmed = async function (val, index) { + if (val.id) { + $rootScope.isBusy = true; + var result = await columnService.delete([val.id]); + if (result.success) { + ctrl.additionalData.columns.splice(index, 1); + $rootScope.isBusy = false; + $scope.$apply(); } else { - if (resp) { - $rootScope.showErrors(resp.errors); - } + $rootScope.showErrors(result.errors); + $rootScope.isBusy = false; + $scope.$apply(); } - }); - }; - - ctrl.view = function (item) { - var obj = { - columns: ctrl.database.columns, - item: item, - }; - $rootScope.preview("mix-database-data", obj, null, "modal-lg"); + } else { + ctrl.additionalData.columns.splice(index, 1); + } }; }, ], @@ -13010,49 +13213,356 @@ modules.component("mixDatabaseDataValueEditor", { } break; - default: - break; - } + default: + break; + } + }; + + ctrl.updateRefData = function (nav) { + ctrl.goToPath(`/admin/mix-database-data/details?dataContentId=${nav.data.id} + &mixDatabaseId=${nav.data.mixDatabaseId} + &parentId=${ctrl.parentId} + &parentType=${ctrl.parentType}`); + // ctrl.refDataModel = nav; + // var e = $(".pane-form-" + ctrl.mixDatabaseDataValue.column.referenceId)[0]; + // angular.element(e).triggerHandler('click'); + // $location.url('/admin/mix-database-data/details?dataContentId='+ item.id +'&mixDatabaseId=' + item.mixDatabaseId+'&parentType=' + item.parentType+'&parentId=' + item.parentId); + }; + + ctrl.removeRefData = async function (nav) { + $rootScope.showConfirm( + ctrl, + "removeRefDataConfirmed", + [nav], + null, + "Remove", + "Deleted data will not able to recover, are you sure you want to delete this item?" + ); + }; + ctrl.removeRefDataConfirmed = async function (nav) { + $rootScope.isBusy = true; + var result = await navService.delete([ + nav.parentId, + nav.parentType, + nav.id, + ]); + if (result.success) { + $rootScope.removeObjectByKey(ctrl.refData, "id", nav.id); + $rootScope.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showErros(result.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } + }; + }, + ], +}); + +modules.component("mixDatabaseDataValues", { + templateUrl: + "/mix-app/views/app-portal/components/mix-database-data-values/view.html", + bindings: { + database: "=?", + request: "=", + mixDatabaseName: "=?", + mixDatabaseTitle: "=?", + mixDatabaseId: "=?", + relationship: "=?", + parentName: "=?", + parentId: "=?", + guidParentId: "=?", + header: "=?", + data: "=?", + canDrag: "=?", + queries: "=?", + filterType: "=?", + conjunction: "=?", + selectedList: "=?", + selectSingle: "=?", + onFilterList: "&?", + onApplyList: "&?", + onSendMail: "&?", + onUpdate: "&?", + onDuplicate: "&?", + onDelete: "&?", + }, + controller: [ + "$rootScope", + "$scope", + "$location", + "$routeParams", + "ngAppSettings", + "RestMixDatabasePortalService", + "MixDbService", + function ( + $rootScope, + $scope, + $location, + $routeParams, + ngAppSettings, + databaseService, + dataService + ) { + var ctrl = this; + ctrl.intShowColumn = 3; + ctrl.actions = ["Delete", "SendMail"]; + ctrl.filterTypes = ["contain", "equal"]; + ctrl.conjunctions = ["Or", "And"]; + ctrl.selectedProp = null; + ctrl.mixConfigurations = $rootScope.globalSettings; + + ctrl.$onInit = async function () { + dataService.initDbName(ctrl.mixDatabaseName); + + if (!ctrl.selectedList) { + ctrl.selectedList = { + action: "Delete", + data: [], + }; + } + if (!ctrl.database) { + var getDatabase = await databaseService.getByName( + ctrl.mixDatabaseName + ); + if (getDatabase.success) { + ctrl.database = getDatabase.data; + } + } + + ctrl.fieldNames = { + id: ctrl.database.namingConvention == "TitleCase" ? "Id" : "id", + parentId: + ctrl.database.namingConvention == "TitleCase" + ? "ParentId" + : "parent_id", + parentDatabaseName: + ctrl.database.namingConvention == "TitleCase" + ? "ParentDatabaseName" + : "parent_database_name", + childId: + ctrl.database.namingConvention == "TitleCase" + ? "ChildId" + : "child_id", + childDatabaseName: + ctrl.database.namingConvention == "TitleCase" + ? "ChildDatabaseName" + : "child_database_name", + createdDateTime: + ctrl.database.namingConvention == "TitleCase" + ? "CreatedDateTime" + : "created_date_time", + lastModified: + ctrl.database.namingConvention == "TitleCase" + ? "LastModified" + : "last_modified", + tenantId: + ctrl.database.namingConvention == "TitleCase" + ? "TenantId" + : "tenant_id", + createdBy: + ctrl.database.namingConvention == "TitleCase" + ? "CreatedBy" + : "created_by", + modifiedBy: + ctrl.database.namingConvention == "TitleCase" + ? "ModifiedBy" + : "modified_by", + priority: + ctrl.database.namingConvention == "TitleCase" + ? "Priority" + : "priority", + status: + ctrl.database.namingConvention == "TitleCase" ? "Status" : "status", + isDeleted: + ctrl.database.namingConvention == "TitleCase" + ? "IsDeleted" + : "is_deleted", + }; + ctrl.request.name = ctrl.mixDatabaseName; + ctrl.request.sortBy = ctrl.fieldNames.id; + ctrl.request.parentName = ctrl.parentName; + ctrl.request.parentId = ctrl.parentId; + ctrl.request.relationship = ctrl.relationship; + ctrl.request.guidParentId = ctrl.guidParentId; + ctrl.request.conjunction = ctrl.conjunction; + if (!ctrl.data) { + await ctrl.loadData(); + } + ctrl.createUrl = `/admin/mix-database-data/create?mixDatabaseId=${ + ctrl.database.id + }&mixDatabaseName=${ctrl.database.systemName}&mixDatabaseTitle=${ + ctrl.database.displayName + }&dataContentId=default&relationship=${ + ctrl.relationship || "" + }&parentId=${ctrl.parentId || ctrl.guidParentId || ""}&parentName=${ + ctrl.parentName || "" + }`; + }; + ctrl.toCamelCase = (txt) => { + return txt.charAt(0).toLowerCase() + txt.substr(1); + }; + ctrl.loadData = async function (pageIndex, pagingState = null) { + $rootScope.isBusy = true; + if (pageIndex !== undefined) { + ctrl.request.pageIndex = pageIndex; + } + if (pagingState) { + ctrl.request.pagingState = pagingState; + } + dataService.initDbName(ctrl.request.mixDatabaseName); + ctrl.request.queries = []; + if (ctrl.queries) { + Object.keys(ctrl.queries).forEach((e) => { + if (ctrl.queries[e]) { + ctrl.request.queries.push({ + fieldName: e, + compareOperator: ctrl.request.compareOperator, + value: ctrl.queries[e], + }); + } + }); + } + var getData = await dataService.filter(ctrl.request); + if (getData && getData.success) { + ctrl.data = getData.data; + ctrl.selectedIds = ctrl.data.items.map((m) => m.id); + $rootScope.isBusy = false; + } else { + if (getData) { + $rootScope.showErrors(getData.errors); + } + $rootScope.isBusy = false; + } + $scope.$apply(); + }; + ctrl.select = function (item) { + if (item.isSelected) { + if (ctrl.selectSingle == "true") { + ctrl.selectedList.data.items = []; + ctrl.selectedList.data.items.push(item); + } else { + var current = $rootScope.findObjectByKey( + ctrl.selectedList, + "id", + item.id + ); + if (!current) { + ctrl.selectedList.data.items.push(item); + } + } + } else { + $rootScope.removeObject(ctrl.selectedList, item.id); + } + }; + ctrl.selectAll = function (isSelected) { + ctrl.selectedList.data.items = []; + angular.forEach(ctrl.data.items, function (e) { + e.isSelected = isSelected; + if (isSelected) { + ctrl.selectedList.data.items.push(e.id); + } + }); + }; + ctrl.filter = function (pageIndex) { + ctrl.loadData(pageIndex); + }; + ctrl.sendMail = async function (data) { + ctrl.onSendMail({ data: data }); + }; + ctrl.apply = async function () { + ctrl.onApplyList(); + }; + + ctrl.duplicate = function (data) { + ctrl.onDuplicate({ data: data }); }; - ctrl.updateRefData = function (nav) { - ctrl.goToPath(`/admin/mix-database-data/details?dataContentId=${nav.data.id} - &mixDatabaseId=${nav.data.mixDatabaseId} - &parentId=${ctrl.parentId} - &parentType=${ctrl.parentType}`); - // ctrl.refDataModel = nav; - // var e = $(".pane-form-" + ctrl.mixDatabaseDataValue.column.referenceId)[0]; - // angular.element(e).triggerHandler('click'); - // $location.url('/admin/mix-database-data/details?dataContentId='+ item.id +'&mixDatabaseId=' + item.mixDatabaseId+'&parentType=' + item.parentType+'&parentId=' + item.parentId); + ctrl.update = function (data) { + let url = `/admin/mix-database-data/details?dataContentId=${ + data.id + }&mixDatabaseName=${ctrl.request.mixDatabaseName}&mixDatabaseTitle=${ + ctrl.mixDatabaseTitle + }&guidParentId=${ctrl.guidParentId || ""}&parentId=${ + ctrl.parentId || "" + }&parentName=${ctrl.parentName || ""}`; + $location.url(url); }; - ctrl.removeRefData = async function (nav) { + ctrl.delete = function (data) { $rootScope.showConfirm( ctrl, - "removeRefDataConfirmed", - [nav], + "removeConfirmed", + [data.id], null, "Remove", "Deleted data will not able to recover, are you sure you want to delete this item?" ); }; - ctrl.removeRefDataConfirmed = async function (nav) { + + ctrl.removeConfirmed = async function (dataContentId) { $rootScope.isBusy = true; - var result = await navService.delete([ - nav.parentId, - nav.parentType, - nav.id, - ]); + ctrl.data.items = []; + var result = await dataService.delete([dataContentId]); if (result.success) { - $rootScope.removeObjectByKey(ctrl.refData, "id", nav.id); + if (ctrl.onDelete) { + ctrl.onDelete({ data: dataContentId }); + } + + await ctrl.loadData(); $rootScope.isBusy = false; $scope.$apply(); } else { - $rootScope.showErros(result.errors); + $rootScope.showErrors(result.errors); $rootScope.isBusy = false; $scope.$apply(); } }; + + ctrl.filterData = function (item, attributeName) { + return $rootScope.findObjectByKey( + item.data.items, + "attributeName", + attributeName + ); + }; + + ctrl.dragStart = function (index) { + ctrl.dragStartIndex = index; + ctrl.minPriority = ctrl.data.items[0].priority; + }; + ctrl.updateOrders = function (index, items) { + if (index > ctrl.dragStartIndex) { + ctrl.data.items.splice(ctrl.dragStartIndex, 1); + } else { + ctrl.data.items.splice(ctrl.dragStartIndex + 1, 1); + } + ctrl.updateDataInfos(); + }; + ctrl.updateDataInfos = async function () { + angular.forEach(ctrl.data.items, async function (e, i) { + e.priority = ctrl.minPriority + i; + var resp = await dataService.saveFields(e.id, { + priority: e.priority, + }); + if (resp && resp.success) { + $scope.activedPage = resp.data; + } else { + if (resp) { + $rootScope.showErrors(resp.errors); + } + } + }); + }; + + ctrl.view = function (item) { + var obj = { + columns: ctrl.database.columns, + item: item, + }; + $rootScope.preview("mix-database-data", obj, null, "modal-lg"); + }; }, ], }); @@ -13152,8 +13662,8 @@ modules.component("mixDatabaseForm", { : "last_modified", tenantId: ctrl.database.namingConvention == "TitleCase" - ? "MixTenantId" - : "mix_tenant_id", + ? "TenantId" + : "tenant_id", createdBy: ctrl.database.namingConvention == "TitleCase" ? "CreatedBy" @@ -13443,182 +13953,9 @@ modules.component("mixDatabaseForm", { ) ); mixDatabaseColumn; - ctrl.mixDataContent.data.push(attr); - } - return attr; - } - }; - }, - ], -}); - -modules.component("mixDatabaseDataFilter", { - templateUrl: - "/mix-app/views/app-portal/components/mix-database-data-filter/view.html", - bindings: { - query: "=", - mixDatabaseName: "=?", - mixDatabaseId: "=?", - selectedList: "=", - initData: "=?", - columns: "=?", - selected: "=", - callback: "&?", - save: "&?", - }, - controller: [ - "$rootScope", - "$scope", - "ngAppSettings", - "RestMixDatabaseDataPortalService", - function ($rootScope, $scope, ngAppSettings, dataService) { - var ctrl = this; - ctrl.request = angular.copy(ngAppSettings.request); - ctrl.types = ["Page", "Post"]; - ctrl.type = "Page"; - ctrl.navs = []; - ctrl.data = { items: [] }; - ctrl.goToPath = $rootScope.goToPath; - ctrl.fieldNames = { - id: ctrl.database.namingConvention == "TitleCase" ? "Id" : "id", - parentId: - ctrl.database.namingConvention == "TitleCase" - ? "ParentId" - : "parent_id", - parentDatabaseName: - ctrl.database.namingConvention == "TitleCase" - ? "ParentDatabaseName" - : "parent_database_name", - childId: - ctrl.database.namingConvention == "TitleCase" - ? "ChildId" - : "child_id", - childDatabaseName: - ctrl.database.namingConvention == "TitleCase" - ? "ChildDatabaseName" - : "child_database_name", - createdDateTime: - ctrl.database.namingConvention == "TitleCase" - ? "CreatedDateTime" - : "created_date_time", - lastModified: - ctrl.database.namingConvention == "TitleCase" - ? "LastModified" - : "last_modified", - tenantId: - ctrl.database.namingConvention == "TitleCase" - ? "MixTenantId" - : "mix_tenant_id", - createdBy: - ctrl.database.namingConvention == "TitleCase" - ? "CreatedBy" - : "created_by", - modifiedBy: - ctrl.database.namingConvention == "TitleCase" - ? "ModifiedBy" - : "modified_by", - priority: - ctrl.database.namingConvention == "TitleCase" - ? "Priority" - : "priority", - status: - ctrl.database.namingConvention == "TitleCase" ? "Status" : "status", - isDeleted: - ctrl.database.namingConvention == "TitleCase" - ? "IsDeleted" - : "is_deleted", - }; - ctrl.$onInit = function () { - if (ctrl.initData) { - ctrl.data = ctrl.initData; - } else { - ctrl.loadData(); - } - }; - ctrl.loadData = async function (pageIndex) { - ctrl.isBusy = true; - - // ctrl.request.query = ctrl.query + ctrl.srcId; - ctrl.navs = []; - if (pageIndex !== undefined) { - ctrl.request.pageIndex = pageIndex; - } - if (ctrl.request.fromDate !== null) { - var df = new Date(ctrl.request.fromDate); - ctrl.request.fromDate = df.toISOString(); - } - if (ctrl.request.toDate !== null) { - var dt = new Date(ctrl.request.toDate); - ctrl.request.toDate = dt.toISOString(); - } - if (ctrl.mixDatabaseId) { - ctrl.request.mixDatabaseId = ctrl.mixDatabaseId; - } - if (ctrl.mixDatabaseName) { - ctrl.request.mixDatabaseName = ctrl.mixDatabaseName; - } - if (ctrl.filterType) { - ctrl.request.filterType = ctrl.filterType; - } - - var response = await dataService.getList(ctrl.request); - if (response.success) { - ctrl.data = response.data; - ctrl.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showErrors(response.errors); - ctrl.isBusy = false; - $scope.$apply(); - } - }; - ctrl.edit = function (nav) { - switch (ctrl.type) { - case "Page": - ctrl.goToPath(`/admin/page/details/${nav.id}`); - break; - case "Post": - ctrl.goToPath(`/admin/post/details/${nav.id}`); - break; - case "Module": - ctrl.goToPath(`/admin/module/details/${nav.id}`); - break; - } - }; - ctrl.onClose = function () { - ctrl.callback(); - }; - ctrl.select = function (nav) { - var current = $rootScope.findObjectByKey(ctrl.data.items, "id", nav.id); - if (!nav.isActive && ctrl.callback) { - ctrl.callback({ nav: nav }); - } - if (ctrl.isMultiple) { - current.isActive = !current.isActive; - } else { - if (!nav.isActive) { - angular.forEach(ctrl.data.items, (element) => { - element.isActive = false; - }); + ctrl.mixDataContent.data.push(attr); } - current.isActive = !nav.isActive; - } - }; - ctrl.saveSelected = function () { - ctrl.selected = $rootScope.filterArray( - ctrl.data, - ["isActived"], - [true] - ); - setTimeout(() => { - ctrl.save().then(() => { - ctrl.loadPosts(); - }); - }, 500); - }; - ctrl.limString = function (str, max) { - if (str) { - return str.length > max ? str.substring(0, max) + " ..." : str; + return attr; } }; }, @@ -13803,7 +14140,7 @@ modules.component("mixDatabaseNavValues", { var ctrl = this; ctrl.selectedProp = null; ctrl.request = angular.copy(ngAppSettings.restRequest); - ctrl.request.orderBy = "Priority"; + ctrl.request.sortBy = "id"; ctrl.request.query = "{}"; ctrl.request.direction = 0; @@ -14125,268 +14462,21 @@ modules.component("mixDatabaseNavs", { }; arrNavs.push({ keys: keys, - properties: properties, - }); - }); - navService.saveProperties("portal", arrNavs).then((resp) => { - $rootScope.isBusy = false; - $scope.$apply(); - }); - }; - }, - ], -}); - -modules.component("mixDatabaseNestedDataValues", { - templateUrl: - "/mix-app/views/app-portal/components/mix-database-nested-data-values/view.html", - bindings: { - database: "=?", - fieldNames: "=?", - mixDatabaseName: "=?", - mixDatabaseTitle: "=?", - mixDatabaseId: "=?", - relationship: "=?", - parentName: "=?", - parentId: "=?", - guidParentId: "=?", - header: "=?", - data: "=?", - canDrag: "=?", - queries: "=?", - filterType: "=?", - conjunction: "=?", - selectedList: "=?", - selectSingle: "=?", - database: "=?", - onFilterList: "&?", - onApplyList: "&?", - onSendMail: "&?", - onUpdate: "&?", - onDuplicate: "&?", - onDelete: "&?", - }, - controller: [ - "$rootScope", - "$scope", - "$location", - "$routeParams", - "ngAppSettings", - "RestMixDatabasePortalService", - "MixDbService", - function ( - $rootScope, - $scope, - $location, - $routeParams, - ngAppSettings, - databaseService, - dataService - ) { - var ctrl = this; - ctrl.intShowColumn = 3; - ctrl.request = angular.copy(ngAppSettings.request); - ctrl.actions = ["Delete", "SendMail"]; - ctrl.filterTypes = ["contain", "equal"]; - ctrl.conjunctions = ["or", "and"]; - ctrl.selectedProp = null; - ctrl.mixConfigurations = $rootScope.globalSettings; - ctrl.$onInit = async function () { - dataService.initDbName(ctrl.mixDatabaseName); - ctrl.request.name = ctrl.mixDatabaseName; - ctrl.request.orderBy = ctrl.fieldNames.createdDateTime; - ctrl.request.parentName = ctrl.parentName; - ctrl.request.parentId = ctrl.parentId; - ctrl.request.relationship = ctrl.relationship; - ctrl.request.guidParentId = ctrl.guidParentId; - if (!ctrl.selectedList) { - ctrl.selectedList = { - action: "Delete", - data: [], - }; - } - if (!ctrl.database) { - var getDatabase = await databaseService.getByName( - ctrl.mixDatabaseName - ); - if (getDatabase.success) { - ctrl.database = getDatabase.data; - $scope.$apply(); - } - } - if (!ctrl.data) { - await ctrl.loadData(); - } - ctrl.createUrl = `/admin/mix-database-data/create?mixDatabaseId=${ - ctrl.database.id - }&mixDatabaseName=${ctrl.database.systemName}&mixDatabaseTitle=${ - ctrl.database.displayName - }&dataContentId=default&relationship=${ - ctrl.relationship || "" - }&parentId=${ctrl.parentId || ctrl.guidParentId || ""}&parentName=${ - ctrl.parentName || "" - }`; - $scope.$apply(); - }; - ctrl.toCamelCase = (txt) => { - return txt.charAt(0).toLowerCase() + txt.substr(1); - }; - ctrl.loadData = async function () { - dataService.initDbName(ctrl.mixDatabaseName); - ctrl.request.queries = []; - if (ctrl.queries) { - Object.keys(ctrl.queries).forEach((e) => { - if (ctrl.queries[e]) { - ctrl.request.queries.push({ - fieldName: e, - value: ctrl.queries[e], - }); - } - }); - } - var getData = await dataService.filterNestedData(ctrl.request); - ctrl.data = getData.data; - if (ctrl.request.relationship == "ManyToMany") { - ctrl.selectedIds = ctrl.data.items.map((m) => ({ - id: m.id, - dataId: m.data.id, - })); - } - $scope.$apply(); - }; - ctrl.select = function (item) { - if (item.isSelected) { - if (ctrl.selectSingle == "true") { - ctrl.selectedList.data.items = []; - ctrl.selectedList.data.items.push(item); - } else { - var current = $rootScope.findObjectByKey( - ctrl.selectedList, - "id", - item.id - ); - if (!current) { - ctrl.selectedList.data.items.push(item); - } - } - } else { - $rootScope.removeObject(ctrl.selectedList, item.id); - } - }; - ctrl.selectAll = function (isSelected) { - ctrl.selectedList.data.items = []; - angular.forEach(ctrl.data.items, function (e) { - e.isSelected = isSelected; - if (isSelected) { - ctrl.selectedList.data.items.push(e.id); - } - }); - }; - ctrl.filter = function () { - ctrl.data.items = []; - ctrl.loadData(); - }; - ctrl.sendMail = async function (data) { - ctrl.onSendMail({ data: data }); - }; - ctrl.apply = async function () { - ctrl.onApplyList(); - }; - - ctrl.duplicate = function (data) { - ctrl.onDuplicate({ data: data }); - }; - - ctrl.update = function (item) { - let url = `/admin/mix-database-data/details?dataContentId=${ - item.data.id - }&mixDatabaseName=${ctrl.mixDatabaseName}&mixDatabaseTitle=${ - ctrl.mixDatabaseTitle - }&guidParentId=${ctrl.guidParentId || ""}&parentId=${ - ctrl.parentId || "" - }&parentName=${ctrl.parentName || ""}`; - $location.url(url); - }; - - ctrl.delete = function (data) { - $rootScope.showConfirm( - ctrl, - "removeConfirmed", - [data.id], - null, - "Remove", - "Deleted data will not able to recover, are you sure you want to delete this item?" - ); - }; - - ctrl.removeConfirmed = async function (dataContentId) { - $rootScope.isBusy = true; - dataService.initDbName(ctrl.mixDatabaseName); - var result = await dataService.delete([dataContentId]); - if (result.success) { - if (ctrl.onDelete) { - ctrl.onDelete({ data: dataContentId }); - } - await ctrl.loadData(); - $rootScope.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showErrors(result.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - - ctrl.filterData = function (item, attributeName) { - return $rootScope.findObjectByKey( - item.data.items, - "attributeName", - attributeName - ); - }; - - ctrl.dragStart = function (index) { - ctrl.dragStartIndex = index; - ctrl.minPriority = ctrl.data.items[0].priority; - }; - ctrl.updateOrders = function (index, items) { - if (index > ctrl.dragStartIndex) { - ctrl.data.items.splice(ctrl.dragStartIndex, 1); - } else { - ctrl.data.items.splice(ctrl.dragStartIndex + 1, 1); - } - ctrl.updateDataInfos(); - }; - ctrl.updateDataInfos = async function () { - angular.forEach(ctrl.data.items, async function (e, i) { - e.priority = ctrl.minPriority + i; - var resp = await dataService.saveFields(e.id, { - priority: e.priority, + properties: properties, }); - if (resp && resp.success) { - $scope.activedPage = resp.data; - } else { - if (resp) { - $rootScope.showErrors(resp.errors); - } - } }); - }; - - ctrl.view = function (item) { - var obj = { - columns: ctrl.database.columns, - item: item, - }; - $rootScope.preview("mix-database-data", obj, null, "modal-lg"); + navService.saveProperties("portal", arrNavs).then((resp) => { + $rootScope.isBusy = false; + $scope.$apply(); + }); }; }, ], }); -modules.component("mixDatabaseOneToMany", { +modules.component("mixDatabaseNestedDataValues", { templateUrl: - "/mix-app/views/app-portal/components/mix-database-one-to-many/view.html", + "/mix-app/views/app-portal/components/mix-database-nested-data-values/view.html", bindings: { database: "=?", fieldNames: "=?", @@ -14441,7 +14531,7 @@ modules.component("mixDatabaseOneToMany", { ctrl.$onInit = async function () { dataService.initDbName(ctrl.mixDatabaseName); ctrl.request.name = ctrl.mixDatabaseName; - ctrl.request.orderBy = ctrl.fieldNames.createdDateTime; + ctrl.request.sortBy = ctrl.fieldNames.id; ctrl.request.parentName = ctrl.parentName; ctrl.request.parentId = ctrl.parentId; ctrl.request.relationship = ctrl.relationship; @@ -14568,7 +14658,8 @@ modules.component("mixDatabaseOneToMany", { ctrl.removeConfirmed = async function (dataContentId) { $rootScope.isBusy = true; - var result = await dataService.delete([dataContentId]); + dataService.initDbName(ctrl.mixDatabaseName); + var result = await dataService.deleteRelationship([dataContentId]); if (result.success) { if (ctrl.onDelete) { ctrl.onDelete({ data: dataContentId }); @@ -14681,7 +14772,7 @@ modules.component("mixFileUpload", { ctrl.mediaFile.extension = file.name.substring( file.name.lastIndexOf(".") ); - ctrl.mediaFile.fileStream = reader.result; + ctrl.mediaFile.fileBase64 = reader.result; } $rootScope.isBusy = false; $scope.$apply(); @@ -14707,7 +14798,7 @@ modules.component("mixFileUpload", { $rootScope.isBusy = false; $scope.$apply(); } else { - $rootScope.showErrors(['Cannot upload file']); + $rootScope.showErrors(["Cannot upload file"]); $rootScope.isBusy = false; $scope.$apply(); } @@ -14757,138 +14848,342 @@ modules.component("mixFileExtract", { } }; - ctrl.getBase64 = function (file) { - if (file !== null) { - $rootScope.isBusy = true; - var reader = new FileReader(); - reader.readAsDataURL(file); - reader.onload = function () { - if (ctrl.mediaFile) { - ctrl.mediaFile.fileName = file.name.substring( - 0, - file.name.lastIndexOf(".") - ); - ctrl.mediaFile.extension = file.name.substring( - file.name.lastIndexOf(".") - ); - ctrl.mediaFile.fileStream = reader.result; - } - $rootScope.isBusy = false; - $scope.$apply(); - }; - reader.onerror = function (error) { - $rootScope.isBusy = false; - $rootScope.showErrors([error]); - }; + ctrl.getBase64 = function (file) { + if (file !== null) { + $rootScope.isBusy = true; + var reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = function () { + if (ctrl.mediaFile) { + ctrl.mediaFile.fileName = file.name.substring( + 0, + file.name.lastIndexOf(".") + ); + ctrl.mediaFile.extension = file.name.substring( + file.name.lastIndexOf(".") + ); + ctrl.mediaFile.fileBase64 = reader.result; + } + $rootScope.isBusy = false; + $scope.$apply(); + }; + reader.onerror = function (error) { + $rootScope.isBusy = false; + $rootScope.showErrors([error]); + }; + } else { + return null; + } + }; + + ctrl.uploadFile = async function () { + if (ctrl.file) { + $rootScope.isBusy = true; + var response = await fileService.extractFile(ctrl.file, ctrl.folder); + if (response) { + if (ctrl.onSuccess) { + ctrl.onSuccess(); + } + $rootScope.showMessage("success", "success"); + $rootScope.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showErrors(["Cannot upload file"]); + $rootScope.isBusy = false; + $scope.$apply(); + } + } else { + $rootScope.showErrors(["Please choose file"]); + } + }; + }, + ], +}); + +modules.component("mixDatabaseOneToMany", { + templateUrl: + "/mix-app/views/app-portal/components/mix-database-one-to-many/view.html", + bindings: { + database: "=?", + fieldNames: "=?", + mixDatabaseName: "=?", + mixDatabaseTitle: "=?", + mixDatabaseId: "=?", + relationship: "=?", + parentName: "=?", + parentId: "=?", + guidParentId: "=?", + header: "=?", + data: "=?", + canDrag: "=?", + queries: "=?", + filterType: "=?", + conjunction: "=?", + selectedList: "=?", + selectSingle: "=?", + database: "=?", + onFilterList: "&?", + onApplyList: "&?", + onSendMail: "&?", + onUpdate: "&?", + onDuplicate: "&?", + onDelete: "&?", + }, + controller: [ + "$rootScope", + "$scope", + "$location", + "$routeParams", + "ngAppSettings", + "RestMixDatabasePortalService", + "MixDbService", + function ( + $rootScope, + $scope, + $location, + $routeParams, + ngAppSettings, + databaseService, + dataService + ) { + var ctrl = this; + ctrl.intShowColumn = 3; + ctrl.request = angular.copy(ngAppSettings.request); + ctrl.actions = ["Delete", "SendMail"]; + ctrl.filterTypes = ["contain", "equal"]; + ctrl.conjunctions = ["or", "and"]; + ctrl.selectedProp = null; + ctrl.mixConfigurations = $rootScope.globalSettings; + ctrl.$onInit = async function () { + dataService.initDbName(ctrl.mixDatabaseName); + ctrl.request.name = ctrl.mixDatabaseName; + ctrl.request.sortBy = ctrl.fieldNames.id; + ctrl.request.parentName = ctrl.parentName; + ctrl.request.parentId = ctrl.parentId; + ctrl.request.relationship = ctrl.relationship; + ctrl.request.guidParentId = ctrl.guidParentId; + if (!ctrl.selectedList) { + ctrl.selectedList = { + action: "Delete", + data: [], + }; + } + if (!ctrl.database) { + var getDatabase = await databaseService.getByName( + ctrl.mixDatabaseName + ); + if (getDatabase.success) { + ctrl.database = getDatabase.data; + $scope.$apply(); + } + } + if (!ctrl.data) { + await ctrl.loadData(); + } + ctrl.createUrl = `/admin/mix-database-data/create?mixDatabaseId=${ + ctrl.database.id + }&mixDatabaseName=${ctrl.database.systemName}&mixDatabaseTitle=${ + ctrl.database.displayName + }&dataContentId=default&relationship=${ + ctrl.relationship || "" + }&${ctrl.getParentIdColName()}=${ + ctrl.parentId || ctrl.guidParentId || "" + }&parentName=${ctrl.parentName || ""}`; + $scope.$apply(); + }; + ctrl.getParentIdColName = () => { + return ctrl.database.namingConvention == "SnakeCase" + ? `${ctrl.parentName}_id` + : `${ctrl.parentNameId}`; + }; + ctrl.toCamelCase = (txt) => { + return txt.charAt(0).toLowerCase() + txt.substr(1); + }; + ctrl.loadData = async function () { + dataService.initDbName(ctrl.mixDatabaseName); + ctrl.request.queries = []; + if (ctrl.queries) { + Object.keys(ctrl.queries).forEach((e) => { + if (ctrl.queries[e]) { + ctrl.request.queries.push({ + fieldName: e, + value: ctrl.queries[e], + }); + } + }); + } + var getData = await dataService.filterNestedData(ctrl.request); + ctrl.data = getData.data; + if (ctrl.request.relationship == "ManyToMany") { + ctrl.selectedIds = ctrl.data.items.map((m) => ({ + id: m.id, + dataId: m.data.id, + })); + } + $scope.$apply(); + }; + ctrl.select = function (item) { + if (item.isSelected) { + if (ctrl.selectSingle == "true") { + ctrl.selectedList.data.items = []; + ctrl.selectedList.data.items.push(item); + } else { + var current = $rootScope.findObjectByKey( + ctrl.selectedList, + "id", + item.id + ); + if (!current) { + ctrl.selectedList.data.items.push(item); + } + } + } else { + $rootScope.removeObject(ctrl.selectedList, item.id); + } + }; + ctrl.selectAll = function (isSelected) { + ctrl.selectedList.data.items = []; + angular.forEach(ctrl.data.items, function (e) { + e.isSelected = isSelected; + if (isSelected) { + ctrl.selectedList.data.items.push(e.id); + } + }); + }; + ctrl.filter = function () { + ctrl.data.items = []; + ctrl.loadData(); + }; + ctrl.sendMail = async function (data) { + ctrl.onSendMail({ data: data }); + }; + ctrl.apply = async function () { + ctrl.onApplyList(); + }; + + ctrl.duplicate = function (data) { + ctrl.onDuplicate({ data: data }); + }; + + ctrl.update = function (item) { + let url = `/admin/mix-database-data/details?dataContentId=${ + item.data.id + }&mixDatabaseName=${ctrl.mixDatabaseName}&mixDatabaseTitle=${ + ctrl.mixDatabaseTitle + }&guidParentId=${ctrl.guidParentId || ""}&parentId=${ + ctrl.parentId || "" + }&parentName=${ctrl.parentName || ""}`; + $location.url(url); + }; + + ctrl.delete = function (data) { + $rootScope.showConfirm( + ctrl, + "removeConfirmed", + [data.id], + null, + "Remove", + "Deleted data will not able to recover, are you sure you want to delete this item?" + ); + }; + + ctrl.removeConfirmed = async function (dataContentId) { + $rootScope.isBusy = true; + var result = await dataService.delete([dataContentId]); + if (result.success) { + if (ctrl.onDelete) { + ctrl.onDelete({ data: dataContentId }); + } + await ctrl.loadData(); + $rootScope.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showErrors(result.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } + }; + + ctrl.filterData = function (item, attributeName) { + return $rootScope.findObjectByKey( + item.data.items, + "attributeName", + attributeName + ); + }; + + ctrl.dragStart = function (index) { + ctrl.dragStartIndex = index; + ctrl.minPriority = ctrl.data.items[0].priority; + }; + ctrl.updateOrders = function (index, items) { + if (index > ctrl.dragStartIndex) { + ctrl.data.items.splice(ctrl.dragStartIndex, 1); } else { - return null; + ctrl.data.items.splice(ctrl.dragStartIndex + 1, 1); } + ctrl.updateDataInfos(); }; - - ctrl.uploadFile = async function () { - if (ctrl.file) { - $rootScope.isBusy = true; - var response = await fileService.extractFile(ctrl.file, ctrl.folder); - if (response) { - if (ctrl.onSuccess) { - ctrl.onSuccess(); - } - $rootScope.showMessage("success", "success"); - $rootScope.isBusy = false; - $scope.$apply(); + ctrl.updateDataInfos = async function () { + angular.forEach(ctrl.data.items, async function (e, i) { + e.priority = ctrl.minPriority + i; + var resp = await dataService.saveFields(e.id, { + priority: e.priority, + }); + if (resp && resp.success) { + $scope.activedPage = resp.data; } else { - $rootScope.showErrors(["Cannot upload file"]); - $rootScope.isBusy = false; - $scope.$apply(); + if (resp) { + $rootScope.showErrors(resp.errors); + } } - } else { - $rootScope.showErrors(["Please choose file"]); - } + }); + }; + + ctrl.view = function (item) { + var obj = { + columns: ctrl.database.columns, + item: item, + }; + $rootScope.preview("mix-database-data", obj, null, "modal-lg"); }; }, ], }); -modules.component("mixTemplateEditor", { +modules.component("mixSelectIcons", { templateUrl: - "/mix-app/views/app-portal/components/mix-template-editor/view.html", - bindings: { - template: "=", - folderType: "=", - isReadonly: "=?", - lineCount: "=?", - hideJs: "=?", - hideCss: "=?", - }, + "/mix-app/views/app-portal/components/mix-select-icons/mix-select-icons.html", controller: [ - "$scope", "$rootScope", - "$routeParams", - "ngAppSettings", - "AppSettingsService", - "TemplateService", - function ( - $scope, - $rootScope, - $routeParams, - ngAppSettings, - appSettingsService, - service - ) { - BaseCtrl.call( - this, - $scope, - $rootScope, - $routeParams, - ngAppSettings, - service - ); + "$scope", + "$location", + "$element", + function ($rootScope, $scope, $location, $element) { var ctrl = this; - ctrl.isNull = false; - ctrl.request = angular.copy(ngAppSettings.request); - ctrl.selectPane = function (pane) { - ctrl.activedPane = pane; - }; - ctrl.selectTemplate = function (template) { - ctrl.template = template; - $scope.$broadcast("updateContentCodeEditors", []); - }; - ctrl.new = function () { - ctrl.template.id = 0; + ctrl.limitTo = 20; + ctrl.container = $element[0].querySelector(".list-icon"); + ctrl.translate = function (keyword) { + return $rootScope.translate(keyword); }; - ctrl.init = async function () { - if (ctrl.folderType) { - var themeId = $rootScope.mixConfigurations.data.ThemeId; - ctrl.request.key = ctrl.folderType; - var resp = await service.getList(ctrl.request, [themeId]); - - if (resp && resp.success) { - ctrl.templates = resp.data.items; - if (!ctrl.template) { - ctrl.template = ctrl.templates[0]; - } - $rootScope.isBusy = false; - $scope.$apply(); - } else { - if (resp) { - $rootScope.showErrors(resp.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } - } + ctrl.showMore = () => { + if ( + ctrl.container.scrollTop >= ctrl.container.scrollHeight - 200 && + ctrl.limitTo < ctrl.options.length + ) { + ctrl.limitTo *= 2; } }; - ctrl.updateTemplateContent = function (content) { - ctrl.template.content = content; - }; - ctrl.updateStyleContent = function (content) { - ctrl.template.scripts = content; - }; - ctrl.updateScriptContent = function (content) { - ctrl.template.styles = content; + ctrl.select = function (ico) { + ctrl.data = ico.class; }; }, ], + bindings: { + data: "=", + prefix: "=", + options: "=", + }, }); "use strict"; @@ -14930,7 +15225,7 @@ app.controller("MixNavigationController", [ fileName: "", extension: "", content: "", - fileStream: "", + fileBase64: "", }, }; $scope.relatedMedias = []; @@ -14971,7 +15266,7 @@ app.controller("MixNavigationController", [ $scope.activedMedia.mediaFile.extension = file.name.substring( file.name.lastIndexOf(".") ); - $scope.activedMedia.mediaFile.fileStream = reader.result; + $scope.activedMedia.mediaFile.fileBase64 = reader.result; $rootScope.isBusy = false; $scope.$apply(); }; @@ -15012,39 +15307,86 @@ app.controller("MixNavigationController", [ }, ]); -modules.component("mixSelectIcons", { +modules.component("mixTemplateEditor", { templateUrl: - "/mix-app/views/app-portal/components/mix-select-icons/mix-select-icons.html", + "/mix-app/views/app-portal/components/mix-template-editor/view.html", + bindings: { + template: "=", + folderType: "=", + isReadonly: "=?", + lineCount: "=?", + hideJs: "=?", + hideCss: "=?", + }, controller: [ - "$rootScope", "$scope", - "$location", - "$element", - function ($rootScope, $scope, $location, $element) { + "$rootScope", + "$routeParams", + "ngAppSettings", + "AppSettingsService", + "TemplateService", + function ( + $scope, + $rootScope, + $routeParams, + ngAppSettings, + appSettingsService, + service + ) { + BaseCtrl.call( + this, + $scope, + $rootScope, + $routeParams, + ngAppSettings, + service + ); var ctrl = this; - ctrl.limitTo = 20; - ctrl.container = $element[0].querySelector(".list-icon"); - ctrl.translate = function (keyword) { - return $rootScope.translate(keyword); + ctrl.isNull = false; + ctrl.request = angular.copy(ngAppSettings.request); + ctrl.selectPane = function (pane) { + ctrl.activedPane = pane; }; - ctrl.showMore = () => { - if ( - ctrl.container.scrollTop >= ctrl.container.scrollHeight - 200 && - ctrl.limitTo < ctrl.options.length - ) { - ctrl.limitTo *= 2; + ctrl.selectTemplate = function (template) { + ctrl.template = template; + $scope.$broadcast("updateContentCodeEditors", []); + }; + ctrl.new = function () { + ctrl.template.id = 0; + }; + ctrl.init = async function () { + if (ctrl.folderType) { + var themeId = $rootScope.mixConfigurations.data.ThemeId; + ctrl.request.key = ctrl.folderType; + var resp = await service.getList(ctrl.request, [themeId]); + + if (resp && resp.success) { + ctrl.templates = resp.data.items; + if (!ctrl.template) { + ctrl.template = ctrl.templates[0]; + } + $rootScope.isBusy = false; + $scope.$apply(); + } else { + if (resp) { + $rootScope.showErrors(resp.errors); + $rootScope.isBusy = false; + $scope.$apply(); + } + } } }; - ctrl.select = function (ico) { - ctrl.data = ico.class; + ctrl.updateTemplateContent = function (content) { + ctrl.template.content = content; + }; + ctrl.updateStyleContent = function (content) { + ctrl.template.scripts = content; + }; + ctrl.updateScriptContent = function (content) { + ctrl.template.styles = content; }; }, ], - bindings: { - data: "=", - prefix: "=", - options: "=", - }, }); modules.component("mixValueEditor", { @@ -15130,277 +15472,58 @@ modules.component("mixValueEditor", { } else { ctrl.stringValue = null; } - break; - case "double": - // ctrl.stringValue = ctrl.doubleValue; - break; - case "boolean": - // ctrl.stringValue = ctrl.booleanValue; - break; - - default: - ctrl.stringValue = ctrl.doubleValue; - break; - } - }; - ctrl.updateRefData = function (item) { - $location.url( - "/admin/mix-database-data/details?dataContentId=" + - item.id + - "&mixDatabaseId=" + - item.mixDatabaseId + - "&parentType=" + - item.parentType + - "&parentId=" + - item.parentId - ); - }; - ctrl.removeRefData = async function (data) { - $rootScope.showConfirm( - ctrl, - "removeRefDataConfirmed", - [data.id], - null, - "Remove", - "Deleted data will not able to recover, are you sure you want to delete this item?" - ); - }; - ctrl.removeRefDataConfirmed = async function (dataContentId) { - $rootScope.isBusy = true; - var result = await dataService.delete(dataContentId); - if (result.success) { - $rootScope.removeObjectByKey(ctrl.refData, "id", dataContentId); - $rootScope.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showErrors(result.errors); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - }, - ], -}); - -modules.component("modalBookmark", { - templateUrl: - "/mix-app/views/app-portal/components/modal-bookmark/modal-bookmark.html", - controller: [ - "$rootScope", - "$scope", - "localStorageService", - "$routeParams", - "$location", - function ( - $rootScope, - $scope, - localStorageService, - $routeParams, - $location - ) { - var ctrl = this; - ctrl.searchText = ""; - ctrl.defaultModel = { - url: "", - title: "", - }; - ctrl.bookmarks = []; - ctrl.model = null; - ctrl.$onInit = function () { - ctrl.model = angular.copy(ctrl.defaultModel); - ctrl.getCurrentUrl(); - ctrl.bookmarks = localStorageService.get("bookmarks") || []; - }; - ctrl.goToPath = function (url) { - $rootScope.goToPath(url); - $("#dlg-bookmark").modal("hide"); - }; - ctrl.getCurrentUrl = function (url) { - url = url || $location.url(); - ctrl.model.url = url; - ctrl.model.title = url; - }; - ctrl.removeBookmark = function (url) { - $rootScope.removeObjectByKey(ctrl.bookmarks, "url", url); - localStorageService.set("bookmarks", ctrl.bookmarks); - }; - ctrl.addBookmark = function () { - var current = $rootScope.findObjectByKey( - ctrl.bookmarks, - "url", - ctrl.model.url - ); - if (current) { - current.title = ctrl.model.title; - } else { - ctrl.bookmarks.push(ctrl.model); - } - localStorageService.set("bookmarks", ctrl.bookmarks); - ctrl.model = angular.copy(ctrl.defaultModel); - }; - }, - ], -}); - -modules.component("modalHelper", { - templateUrl: - "/mix-app/views/app-portal/components/modal-helper/modal-helper.html", - bindings: { - url: "=?", - title: "=?", - }, - controller: [ - "$rootScope", - "$scope", - "localStorageService", - "$routeParams", - "$location", - "$sce", - function ( - $rootScope, - $scope, - localStorageService, - $routeParams, - $location, - $sce - ) { - var ctrl = this; - ctrl.$onInit = function () { - $("#dev-helper-modal").on("shown.bs.modal", function () { - if ($rootScope.helperUrl) { - ctrl.trustedUrl = $sce.trustAsResourceUrl($rootScope.helperUrl); - ctrl.title = "Developer Document"; - } else { - ctrl.loadHelperUrl(); - ctrl.title = "Developer Document"; - } - $rootScope.helperUrl = null; - $scope.$apply(); - }); - }; - ctrl.loadHelperUrl = function () { - var portalUrl = $location.url(); - // var portalabsUrl = $location.absUrl(); - var defaultUrl = "//docs.mixcore.org"; - ctrl.trustedUrl = $sce.trustAsResourceUrl(defaultUrl); - - if (portalUrl.startsWith("/admin")) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-administration-screens" - ); - } - if ( - portalUrl.startsWith("/admin/mix-database-data/list?mixDatabaseId=2") - ) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-navigation" - ); - } - if (portalUrl.startsWith("/admin/post")) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-writing-posts" - ); - } - if (portalUrl.startsWith("/admin/page")) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-page" - ); - } - if (portalUrl.startsWith("/admin/module")) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-module" - ); - } - if (portalUrl.startsWith("/admin/mix-database")) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-database" - ); - } - if ( - portalUrl.startsWith("/admin/mix-database-data/list?mixDatabaseId=7") - ) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-category" - ); - } - if ( - portalUrl.startsWith("/admin/mix-database-data/list?mixDatabaseId=8") - ) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-tag" - ); - } - if (portalUrl.startsWith("/admin/media")) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-media" - ); - } - if (portalUrl.startsWith("/admin/file")) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-file" - ); - } - if (portalUrl.startsWith("/admin/user")) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-user" - ); - } - if (portalUrl.startsWith("/admin/theme")) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-theme" - ); - } - if (portalUrl.startsWith("/admin/app-settings")) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-app-settings" - ); - } - if (portalUrl.startsWith("/admin/configuration")) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-configuration" - ); + break; + case "double": + // ctrl.stringValue = ctrl.doubleValue; + break; + case "boolean": + // ctrl.stringValue = ctrl.booleanValue; + break; + + default: + ctrl.stringValue = ctrl.doubleValue; + break; } - if (portalUrl.startsWith("/admin/my-profile")) { - ctrl.trustedUrl = $sce.trustAsResourceUrl( - defaultUrl + "/basic-usage-users-profile" - ); + }; + ctrl.updateRefData = function (item) { + $location.url( + "/admin/mix-database-data/details?dataContentId=" + + item.id + + "&mixDatabaseId=" + + item.mixDatabaseId + + "&parentType=" + + item.parentType + + "&parentId=" + + item.parentId + ); + }; + ctrl.removeRefData = async function (data) { + $rootScope.showConfirm( + ctrl, + "removeRefDataConfirmed", + [data.id], + null, + "Remove", + "Deleted data will not able to recover, are you sure you want to delete this item?" + ); + }; + ctrl.removeRefDataConfirmed = async function (dataContentId) { + $rootScope.isBusy = true; + var result = await dataService.delete(dataContentId); + if (result.success) { + $rootScope.removeObjectByKey(ctrl.refData, "id", dataContentId); + $rootScope.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showErrors(result.errors); + $rootScope.isBusy = false; + $scope.$apply(); } - - // switch (portalUrl) { - // case '/admin': - // default: - // ctrl.trustedUrl = $sce.trustAsResourceUrl(defaultUrl); - // break; - // } }; }, ], }); -app.component("modalCroppie", { - templateUrl: "/mix-app/views/app-portal/components/modal-croppie/view.html", - bidings: { - resolve: "<", - close: "&", - dismiss: "&", - }, - controller: function () { - var $ctrl = this; - $ctrl.fileUrl = "test"; - $ctrl.$onInit = function () { - $ctrl.file = $ctrl.resolve.file; - }; - - $ctrl.ok = function () { - $ctrl.close({ $value: $ctrl.fileUrl }); - }; - - $ctrl.cancel = function () { - $ctrl.dismiss({ $value: "cancel" }); - }; - }, -}); - modules.component("modalContentFilter", { templateUrl: "/mix-app/views/app-portal/components/modal-content-filter/modal-content-filter.html", @@ -15569,295 +15692,220 @@ modules.component("modalContentFilter", { ], }); -modules.component("modalNavMetas", { - templateUrl: "/mix-app/views/app-portal/components/modal-nav-metas/view.html", - bindings: { - header: "=", - mixDatabaseId: "=?", - mixDatabaseName: "=?", - intParentId: "=?", - guidParentId: "=?", - parentType: "=?", - type: "=?", - columnDisplay: "=?", - isOpen: "=?", - selectedList: "=?", - selectCallback: "&?", - save: "&", - }, +modules.component("modalBookmark", { + templateUrl: + "/mix-app/views/app-portal/components/modal-bookmark/modal-bookmark.html", controller: [ "$rootScope", "$scope", + "localStorageService", "$routeParams", - "ngAppSettings", - "RestMixDatabaseDataPortalService", - "RestRelatedAttributeDataPortalService", - "RestMixDatabasePortalService", + "$location", function ( $rootScope, $scope, + localStorageService, $routeParams, - ngAppSettings, - dataService, - navService, - databaseService + $location ) { var ctrl = this; - - ctrl.request = angular.copy(ngAppSettings.request); - ctrl.request.key = "readData"; - ctrl.navs = []; - - ctrl.queries = {}; - ctrl.data = { items: [] }; - ctrl.selectedValues = []; - - ctrl.$onInit = async function () { - await ctrl.loadDefaultModel(); - await ctrl.loadDefaultData(); - await ctrl.loadSelected(); - ctrl.loadData(); - ctrl.filterData(); + ctrl.searchText = ""; + ctrl.defaultModel = { + url: "", + title: "", }; - - ctrl.loadSelected = async function () { - ctrl.navRequest = angular.copy(ngAppSettings.request); - ctrl.navRequest.mixDatabaseId = ctrl.mixDatabaseId; - ctrl.navRequest.mixDatabaseName = ctrl.mixDatabaseName; - ctrl.navRequest.intParentId = ctrl.intParentId; - ctrl.navRequest.guidParentId = ctrl.guidParentId; - var getSelected = await navService.getList(ctrl.navRequest); - if (getSelected.success) { - ctrl.selectedList = getSelected.data; - ctrl.selectedValues = ctrl.selectedList.items.map( - (m) => m.dataContentId - ); - $scope.$apply(); + ctrl.bookmarks = []; + ctrl.model = null; + ctrl.$onInit = function () { + ctrl.model = angular.copy(ctrl.defaultModel); + ctrl.getCurrentUrl(); + ctrl.bookmarks = localStorageService.get("bookmarks") || []; + }; + ctrl.goToPath = function (url) { + $rootScope.goToPath(url); + $("#dlg-bookmark").modal("hide"); + }; + ctrl.getCurrentUrl = function (url) { + url = url || $location.url(); + ctrl.model.url = url; + ctrl.model.title = url; + }; + ctrl.removeBookmark = function (url) { + $rootScope.removeObjectByKey(ctrl.bookmarks, "url", url); + localStorageService.set("bookmarks", ctrl.bookmarks); + }; + ctrl.addBookmark = function () { + var current = $rootScope.findObjectByKey( + ctrl.bookmarks, + "url", + ctrl.model.url + ); + if (current) { + current.title = ctrl.model.title; + } else { + ctrl.bookmarks.push(ctrl.model); } + localStorageService.set("bookmarks", ctrl.bookmarks); + ctrl.model = angular.copy(ctrl.defaultModel); }; - ctrl.loadDefaultModel = async function () { - ctrl.request.isGroup = true; + }, + ], +}); - if (ctrl.mixDatabaseId) { - ctrl.request.mixDatabaseId = ctrl.mixDatabaseId; - } - if (ctrl.mixDatabaseName) { - ctrl.request.mixDatabaseName = ctrl.mixDatabaseName; - } - if ($routeParams.intParentId) { - ctrl.intParentId = $routeParams.intParentId; - } - if ($routeParams.parentType) { - ctrl.parentType = $routeParams.parentType; - } - ctrl.defaultNav = { - id: null, - specificulture: navService.lang, - dataContentId: null, - intParentId: ctrl.intParentId, - parentType: ctrl.parentType, - mixDatabaseId: ctrl.mixDatabaseId, - mixDatabaseName: ctrl.mixDatabaseName, - status: "Published", - childDataContent: null, - }; - if (!ctrl.columns) { - var getMixDatbase = ctrl.mixDatabaseId - ? await databaseService.getSingle([ctrl.mixDatabaseId]) - : await databaseService.getByName([ctrl.mixDatabaseName]); - if (getMixDatbase.success) { - ctrl.columns = getMixDatbase.data.columns; - ctrl.mixDatabaseId = getMixDatbase.data.id; - ctrl.mixDatabaseName = getMixDatbase.data.systemName; - ctrl.defaultNav.mixDatabaseId = getMixDatbase.data.id; - ctrl.defaultNav.mixDatabaseName = getMixDatbase.data.systemName; - $scope.$apply(); +app.component("modalCroppie", { + templateUrl: "/mix-app/views/app-portal/components/modal-croppie/view.html", + bidings: { + resolve: "<", + close: "&", + dismiss: "&", + }, + controller: function () { + var $ctrl = this; + $ctrl.fileUrl = "test"; + $ctrl.$onInit = function () { + $ctrl.file = $ctrl.resolve.file; + }; + + $ctrl.ok = function () { + $ctrl.close({ $value: $ctrl.fileUrl }); + }; + + $ctrl.cancel = function () { + $ctrl.dismiss({ $value: "cancel" }); + }; + }, +}); + +modules.component("modalHelper", { + templateUrl: + "/mix-app/views/app-portal/components/modal-helper/modal-helper.html", + bindings: { + url: "=?", + title: "=?", + }, + controller: [ + "$rootScope", + "$scope", + "localStorageService", + "$routeParams", + "$location", + "$sce", + function ( + $rootScope, + $scope, + localStorageService, + $routeParams, + $location, + $sce + ) { + var ctrl = this; + ctrl.$onInit = function () { + $("#dev-helper-modal").on("shown.bs.modal", function () { + if ($rootScope.helperUrl) { + ctrl.trustedUrl = $sce.trustAsResourceUrl($rootScope.helperUrl); + ctrl.title = "Developer Document"; + } else { + ctrl.loadHelperUrl(); + ctrl.title = "Developer Document"; } - } + $rootScope.helperUrl = null; + $scope.$apply(); + }); }; - ctrl.loadDefaultData = async function () { - var getDefault = await dataService.initData( - ctrl.mixDatabaseName || ctrl.mixDatabaseId - ); - ctrl.defaultData = getDefault.data; - if (ctrl.defaultData) { - ctrl.defaultData.mixDatabaseId = ctrl.mixDatabaseId || 0; - ctrl.defaultData.mixDatabaseName = ctrl.mixDatabaseName; - } - if (!ctrl.mixDatabaseData) { - ctrl.mixDatabaseData = angular.copy(ctrl.defaultData); - } - if (!ctrl.mixDatabaseId) { - ctrl.mixDatabaseId = ctrl.defaultData.mixDatabaseId; - } - if (!ctrl.mixDatabaseName) { - ctrl.mixDatabaseName = ctrl.defaultData.mixDatabaseName; + ctrl.loadHelperUrl = function () { + var portalUrl = $location.url(); + // var portalabsUrl = $location.absUrl(); + var defaultUrl = "//docs.mixcore.org"; + ctrl.trustedUrl = $sce.trustAsResourceUrl(defaultUrl); + + if (portalUrl.startsWith("/admin")) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-administration-screens" + ); } - }; - ctrl.isSelected = function (value, level) { - let item = $rootScope.findObjectByKey( - ctrl.selectedList.items, - "dataContentId", - value - ); - if (item) { - item.level = level; + if ( + portalUrl.startsWith("/admin/mix-database-data/list?mixDatabaseId=2") + ) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-navigation" + ); } - return ctrl.selectedValues.indexOf(value) >= 0; - }; - ctrl.reload = async function () { - ctrl.newTitle = ""; - ctrl.mixDatabaseData = angular.copy(ctrl.defaultData); - }; - ctrl.loadData = async function (pageIndex) { - ctrl.request.query = "{}"; - if (pageIndex !== undefined) { - ctrl.request.pageIndex = pageIndex; + if (portalUrl.startsWith("/admin/post")) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-writing-posts" + ); } - if (ctrl.request.fromDate !== null) { - var d = new Date(ctrl.request.fromDate); - ctrl.request.fromDate = d.toISOString(); + if (portalUrl.startsWith("/admin/page")) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-page" + ); } - if (ctrl.request.toDate !== null) { - var d = new Date(ctrl.request.toDate); - ctrl.request.toDate = d.toISOString(); + if (portalUrl.startsWith("/admin/module")) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-module" + ); } - if (ctrl.mixDatabaseId) { - ctrl.request.mixDatabaseId = ctrl.mixDatabaseId; + if (portalUrl.startsWith("/admin/mix-database")) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-database" + ); } - if (ctrl.mixDatabaseName) { - ctrl.request.mixDatabaseName = ctrl.mixDatabaseName; + if ( + portalUrl.startsWith("/admin/mix-database-data/list?mixDatabaseId=7") + ) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-category" + ); } - if (ctrl.type) { - ctrl.request.type = ctrl.type; + if ( + portalUrl.startsWith("/admin/mix-database-data/list?mixDatabaseId=8") + ) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-tag" + ); } - Object.keys(ctrl.queries).forEach((e) => { - if (ctrl.queries[e]) { - ctrl.request[e] = ctrl.queries[e]; - } - }); - ctrl.request.key = "data"; - var response = await dataService.getList(ctrl.request); - if (response.success) { - ctrl.data = response.data; - ctrl.filterData(); - ctrl.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showErrors(response.errors); - ctrl.isBusy = false; - $scope.$apply(); + if (portalUrl.startsWith("/admin/media")) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-media" + ); } - }; - ctrl.filterData = function () { - angular.forEach(ctrl.data.items, function (e) { - // Not show data if there's in selected list - e.disabled = ctrl.selectedValues.indexOf(e.id) >= 0; - }); - angular.forEach(ctrl.selectedList.items, function (e) { - var subIds = []; - e.isActived = e.isActived === undefined ? true : e.isActived; - if (e.childDataContent && e.childDataContent.data.childItems) { - angular.forEach(e.childDataContent.data.childItems, function (sub) { - sub.isActived = ctrl.selectedValues.indexOf(e.id) >= 0; - }); - subIds = e.childDataContent.data.childItems.map((m) => m.id); - } else if (e.childItems) { - subIds = e.childItems.map((m) => m.id); - } - var subData = ctrl.selectedList.items.filter( - (m) => subIds.indexOf(m.dataContentId) >= 0 + if (portalUrl.startsWith("/admin/file")) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-file" ); - angular.forEach(subData, function (s) { - s.disabled = true; - }); - }); - }; - ctrl.select = async function (dataContentId, isSelected, level) { - let idx = ctrl.selectedValues.indexOf(dataContentId); - var nav = ctrl.selectedList.items[idx]; - if (!nav) { - ctrl.selectedValues.push(dataContentId); - nav = angular.copy(ctrl.defaultNav); - nav.dataContentId = dataContentId; - nav.childDataContent = $rootScope.findObjectByKey( - ctrl.data.items, - "id", - dataContentId + } + if (portalUrl.startsWith("/admin/user")) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-user" ); - ctrl.selectedList.items.push(nav); } - nav.level = level; - if (isSelected) { - nav.isActived = true; - if (nav.intParentId) { - var saveResult = await navService.save(nav); - nav.id = saveResult.data.id; - $rootScope.showMessage("success", "success"); - ctrl.filterData(); - $scope.$apply(); - } + if (portalUrl.startsWith("/admin/theme")) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-theme" + ); } - - if (!isSelected) { - await ctrl.removeNav(idx); - if (ctrl.selectCallback) { - ctrl.selectCallback({ data: nav }); - } - return; + if (portalUrl.startsWith("/admin/app-settings")) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-app-settings" + ); } - }; - ctrl.removeNav = async function (idx) { - var nav = ctrl.selectedList.items[idx]; - ctrl.selectedValues.splice(idx, 1); - ctrl.selectedList.items.splice(idx, 1); - ctrl.filterData(); - if (nav && nav.id) { - await navService.delete([nav.id]); - $rootScope.showMessage("success", "success"); - $scope.$apply(); + if (portalUrl.startsWith("/admin/configuration")) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-configuration" + ); } - }; - ctrl.disableNavitem = function (nav, isDisable) { - nav.disabled = isDisable; - }; - ctrl.createData = function () { - if (ctrl.newTitle) { - var tmp = $rootScope.findObjectByKey( - ctrl.data.items, - "title", - ctrl.newTitle + if (portalUrl.startsWith("/admin/my-profile")) { + ctrl.trustedUrl = $sce.trustAsResourceUrl( + defaultUrl + "/basic-usage-users-profile" ); - if (!tmp) { - ctrl.isBusy = true; - ctrl.mixDatabaseData.intParentId = 0; - ctrl.mixDatabaseData.parentType = "Set"; - ctrl.mixDatabaseData.data.title = ctrl.newTitle; - ctrl.mixDatabaseData.data.slug = $rootScope.generateKeyword( - ctrl.newTitle, - "-" - ); - ctrl.mixDatabaseData.data.type = ctrl.type; - dataService.save(ctrl.mixDatabaseData).then((resp) => { - if (resp.success) { - ctrl.mixDatabaseData.id = resp.data; - ctrl.data.items.push(ctrl.mixDatabaseData); - ctrl.reload(); - ctrl.select(resp.data.id, true); - ctrl.filterData(); - ctrl.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showErrors(resp.errors); - ctrl.isBusy = false; - $scope.$apply(); - } - }); - } else { - tmp.isActived = true; - ctrl.select(tmp); - } } + + // switch (portalUrl) { + // case '/admin': + // default: + // ctrl.trustedUrl = $sce.trustAsResourceUrl(defaultUrl); + // break; + // } }; }, ], @@ -15914,7 +15962,7 @@ modules.component("modalNavDatas", { childDatabaseName: ctrl.mixDatabaseName, }; dataService.initDbName(ctrl.mixDatabaseName); - ctrl.request.orderBy = ctrl.fieldNames.createdDateTime; + ctrl.request.sortBy = ctrl.fieldNames.id; ctrl.request.name = ctrl.mixDatabaseName; ctrl.request.parentName = ctrl.parentName; ctrl.request.relationship = ctrl.relationship; @@ -16193,14 +16241,308 @@ modules.component("modalNavs", { item.isActived = true; } }; - ctrl.saveSelected = function () { - ctrl.selected = $rootScope.filterArray( - ctrl.data.items, - ["isActived"], - [true] - ); - if (ctrl.save) { - ctrl.save({ selected: ctrl.selected }); + ctrl.saveSelected = function () { + ctrl.selected = $rootScope.filterArray( + ctrl.data.items, + ["isActived"], + [true] + ); + if (ctrl.save) { + ctrl.save({ selected: ctrl.selected }); + } + }; + }, + ], +}); + +modules.component("modalNavMetas", { + templateUrl: "/mix-app/views/app-portal/components/modal-nav-metas/view.html", + bindings: { + header: "=", + mixDatabaseId: "=?", + mixDatabaseName: "=?", + intParentId: "=?", + guidParentId: "=?", + parentType: "=?", + type: "=?", + columnDisplay: "=?", + isOpen: "=?", + selectedList: "=?", + selectCallback: "&?", + save: "&", + }, + controller: [ + "$rootScope", + "$scope", + "$routeParams", + "ngAppSettings", + "RestMixDatabaseDataPortalService", + "RestRelatedAttributeDataPortalService", + "RestMixDatabasePortalService", + function ( + $rootScope, + $scope, + $routeParams, + ngAppSettings, + dataService, + navService, + databaseService + ) { + var ctrl = this; + + ctrl.request = angular.copy(ngAppSettings.request); + ctrl.request.key = "readData"; + ctrl.navs = []; + + ctrl.queries = {}; + ctrl.data = { items: [] }; + ctrl.selectedValues = []; + + ctrl.$onInit = async function () { + await ctrl.loadDefaultModel(); + await ctrl.loadDefaultData(); + await ctrl.loadSelected(); + ctrl.loadData(); + ctrl.filterData(); + }; + + ctrl.loadSelected = async function () { + ctrl.navRequest = angular.copy(ngAppSettings.request); + ctrl.navRequest.mixDatabaseId = ctrl.mixDatabaseId; + ctrl.navRequest.mixDatabaseName = ctrl.mixDatabaseName; + ctrl.navRequest.intParentId = ctrl.intParentId; + ctrl.navRequest.guidParentId = ctrl.guidParentId; + var getSelected = await navService.getList(ctrl.navRequest); + if (getSelected.success) { + ctrl.selectedList = getSelected.data; + ctrl.selectedValues = ctrl.selectedList.items.map( + (m) => m.dataContentId + ); + $scope.$apply(); + } + }; + ctrl.loadDefaultModel = async function () { + ctrl.request.isGroup = true; + + if (ctrl.mixDatabaseId) { + ctrl.request.mixDatabaseId = ctrl.mixDatabaseId; + } + if (ctrl.mixDatabaseName) { + ctrl.request.mixDatabaseName = ctrl.mixDatabaseName; + } + if ($routeParams.intParentId) { + ctrl.intParentId = $routeParams.intParentId; + } + if ($routeParams.parentType) { + ctrl.parentType = $routeParams.parentType; + } + ctrl.defaultNav = { + id: null, + specificulture: navService.lang, + dataContentId: null, + intParentId: ctrl.intParentId, + parentType: ctrl.parentType, + mixDatabaseId: ctrl.mixDatabaseId, + mixDatabaseName: ctrl.mixDatabaseName, + status: "Published", + childDataContent: null, + }; + if (!ctrl.columns) { + var getMixDatbase = ctrl.mixDatabaseId + ? await databaseService.getSingle([ctrl.mixDatabaseId]) + : await databaseService.getByName([ctrl.mixDatabaseName]); + if (getMixDatbase.success) { + ctrl.columns = getMixDatbase.data.columns; + ctrl.mixDatabaseId = getMixDatbase.data.id; + ctrl.mixDatabaseName = getMixDatbase.data.systemName; + ctrl.defaultNav.mixDatabaseId = getMixDatbase.data.id; + ctrl.defaultNav.mixDatabaseName = getMixDatbase.data.systemName; + $scope.$apply(); + } + } + }; + ctrl.loadDefaultData = async function () { + var getDefault = await dataService.initData( + ctrl.mixDatabaseName || ctrl.mixDatabaseId + ); + ctrl.defaultData = getDefault.data; + if (ctrl.defaultData) { + ctrl.defaultData.mixDatabaseId = ctrl.mixDatabaseId || 0; + ctrl.defaultData.mixDatabaseName = ctrl.mixDatabaseName; + } + if (!ctrl.mixDatabaseData) { + ctrl.mixDatabaseData = angular.copy(ctrl.defaultData); + } + if (!ctrl.mixDatabaseId) { + ctrl.mixDatabaseId = ctrl.defaultData.mixDatabaseId; + } + if (!ctrl.mixDatabaseName) { + ctrl.mixDatabaseName = ctrl.defaultData.mixDatabaseName; + } + }; + ctrl.isSelected = function (value, level) { + let item = $rootScope.findObjectByKey( + ctrl.selectedList.items, + "dataContentId", + value + ); + if (item) { + item.level = level; + } + return ctrl.selectedValues.indexOf(value) >= 0; + }; + ctrl.reload = async function () { + ctrl.newTitle = ""; + ctrl.mixDatabaseData = angular.copy(ctrl.defaultData); + }; + ctrl.loadData = async function (pageIndex) { + ctrl.request.query = "{}"; + if (pageIndex !== undefined) { + ctrl.request.pageIndex = pageIndex; + } + if (ctrl.request.fromDate !== null) { + var d = new Date(ctrl.request.fromDate); + ctrl.request.fromDate = d.toISOString(); + } + if (ctrl.request.toDate !== null) { + var d = new Date(ctrl.request.toDate); + ctrl.request.toDate = d.toISOString(); + } + if (ctrl.mixDatabaseId) { + ctrl.request.mixDatabaseId = ctrl.mixDatabaseId; + } + if (ctrl.mixDatabaseName) { + ctrl.request.mixDatabaseName = ctrl.mixDatabaseName; + } + if (ctrl.type) { + ctrl.request.type = ctrl.type; + } + Object.keys(ctrl.queries).forEach((e) => { + if (ctrl.queries[e]) { + ctrl.request[e] = ctrl.queries[e]; + } + }); + ctrl.request.key = "data"; + var response = await dataService.getList(ctrl.request); + if (response.success) { + ctrl.data = response.data; + ctrl.filterData(); + ctrl.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showErrors(response.errors); + ctrl.isBusy = false; + $scope.$apply(); + } + }; + ctrl.filterData = function () { + angular.forEach(ctrl.data.items, function (e) { + // Not show data if there's in selected list + e.disabled = ctrl.selectedValues.indexOf(e.id) >= 0; + }); + angular.forEach(ctrl.selectedList.items, function (e) { + var subIds = []; + e.isActived = e.isActived === undefined ? true : e.isActived; + if (e.childDataContent && e.childDataContent.data.childItems) { + angular.forEach(e.childDataContent.data.childItems, function (sub) { + sub.isActived = ctrl.selectedValues.indexOf(e.id) >= 0; + }); + subIds = e.childDataContent.data.childItems.map((m) => m.id); + } else if (e.childItems) { + subIds = e.childItems.map((m) => m.id); + } + var subData = ctrl.selectedList.items.filter( + (m) => subIds.indexOf(m.dataContentId) >= 0 + ); + angular.forEach(subData, function (s) { + s.disabled = true; + }); + }); + }; + ctrl.select = async function (dataContentId, isSelected, level) { + let idx = ctrl.selectedValues.indexOf(dataContentId); + var nav = ctrl.selectedList.items[idx]; + if (!nav) { + ctrl.selectedValues.push(dataContentId); + nav = angular.copy(ctrl.defaultNav); + nav.dataContentId = dataContentId; + nav.childDataContent = $rootScope.findObjectByKey( + ctrl.data.items, + "id", + dataContentId + ); + ctrl.selectedList.items.push(nav); + } + nav.level = level; + if (isSelected) { + nav.isActived = true; + if (nav.intParentId) { + var saveResult = await navService.save(nav); + nav.id = saveResult.data.id; + $rootScope.showMessage("success", "success"); + ctrl.filterData(); + $scope.$apply(); + } + } + + if (!isSelected) { + await ctrl.removeNav(idx); + if (ctrl.selectCallback) { + ctrl.selectCallback({ data: nav }); + } + return; + } + }; + ctrl.removeNav = async function (idx) { + var nav = ctrl.selectedList.items[idx]; + ctrl.selectedValues.splice(idx, 1); + ctrl.selectedList.items.splice(idx, 1); + ctrl.filterData(); + if (nav && nav.id) { + await navService.delete([nav.id]); + $rootScope.showMessage("success", "success"); + $scope.$apply(); + } + }; + ctrl.disableNavitem = function (nav, isDisable) { + nav.disabled = isDisable; + }; + ctrl.createData = function () { + if (ctrl.newTitle) { + var tmp = $rootScope.findObjectByKey( + ctrl.data.items, + "title", + ctrl.newTitle + ); + if (!tmp) { + ctrl.isBusy = true; + ctrl.mixDatabaseData.intParentId = 0; + ctrl.mixDatabaseData.parentType = "Set"; + ctrl.mixDatabaseData.data.title = ctrl.newTitle; + ctrl.mixDatabaseData.data.slug = $rootScope.generateKeyword( + ctrl.newTitle, + "-" + ); + ctrl.mixDatabaseData.data.type = ctrl.type; + dataService.save(ctrl.mixDatabaseData).then((resp) => { + if (resp.success) { + ctrl.mixDatabaseData.id = resp.data; + ctrl.data.items.push(ctrl.mixDatabaseData); + ctrl.reload(); + ctrl.select(resp.data.id, true); + ctrl.filterData(); + ctrl.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showErrors(resp.errors); + ctrl.isBusy = false; + $scope.$apply(); + } + }); + } else { + tmp.isActived = true; + ctrl.select(tmp); + } } }; }, @@ -16215,6 +16557,7 @@ modules.component("modalNavPosts", { srcId: "=", query: "=", selected: "=", + modelName: "=", save: "&", }, controller: [ @@ -16292,15 +16635,6 @@ modules.component("modalNavPosts", { ], }); -modules.component("modalPermission", { - templateUrl: - "/mix-app/views/app-portal/components/modal-permission/modal-permission.html", - controller: "PermissionController", - bindings: { - message: "=", - }, -}); - modules.component("monacoEditor", { templateUrl: "/mix-app/views/app-portal/components/monaco-editor/view.html", bindings: { @@ -16473,27 +16807,242 @@ modules.component("monacoEditor", { ctrl.isFull = !ctrl.isFull; - ctrl.editor.dispose(); + ctrl.editor.dispose(); + + // var h; + + // ctrl.editor.dispose(); + // if ($(".monaco-editor.container-code-editor.monaco-editor-full")[0]) { + // // Do something if class exists + // h = window.innerHeight; + // $( + // ".monaco-editor.container-code-editor.monaco-editor-full .code-editor" + // ).height(h); + // document.body.style.overflow = "hidden"; + // } else { + // // Do something if class does not exist + // h = ctrl.lineCount * 20; + // $(".monaco-editor .code-editor").height(h); + // document.body.style.overflow = "visible"; + // } + // ctrl.editor.layout(); + + ctrl.updateEditors(); + }; + }, + ], +}); + +modules.component("modalPermission", { + templateUrl: + "/mix-app/views/app-portal/components/modal-permission/modal-permission.html", + controller: "PermissionController", + bindings: { + message: "=", + }, +}); + +modules.component("navigators", { + templateUrl: + "/mix-app/views/app-portal/components/navigations/navigations.html", + bindings: { + modelName: "=", + parentId: "=", + associations: "=", + titleField: "=?", + + prefix: "=", + detailUrl: "=", + data: "=", + titleMaxLength: "=?", + callback: "&?", + }, + controller: [ + "$rootScope", + "$scope", + "ngAppSettings", + "$location", + function ($rootScope, $scope, ngAppSettings, $location) { + var ctrl = this; + var service; + ctrl.selected = null; + ctrl.activedIndex = null; + ctrl.$onInit = async () => { + ctrl.titleField = ctrl.titleField || "title"; + service = $rootScope.getRestService(ctrl.modelName); + ctrl.associationRequest = angular.copy(ngAppSettings.request); + ctrl.associationRequest.sortBy = "id"; + ctrl.associationRequest.direction = "Desc"; + ctrl.associationRequest.parentId = ctrl.parentId; + await ctrl.loadAssociations(); + ctrl.loadData(); + }; + ctrl.loadAssociations = async () => { + var getAssociations = await service.getList(ctrl.associationRequest); + ctrl.associations = getAssociations.data.items; + }; + ctrl.loadData = async () => { + var maxPriority = 0; + if (ctrl.associations.length > 0) { + maxPriority = + ctrl.associations[ctrl.associations.length - 1].priority || 0; + } + angular.forEach(ctrl.data, function (e, i) { + let nav = ctrl.associations.filter((m) => m.childId == e.id)[0]; + if (nav) { + if (nav.priority == undefined) { + nav.priority = maxPriority + 1; + maxPriority++; + } + e.isActived = true; + e.priority = nav.priority || 0; + } else { + e.isActived = false; + e.priority = maxPriority + 1; + maxPriority++; + } + e.isActived = nav != null; + }); + ctrl.data = $rootScope.sortArray(ctrl.data, "priority"); + }; + ctrl.select = async (obj) => { + if (obj.isActived) { + ctrl.selectItem(obj); + } else { + ctrl.removeItem(obj); + } + if (ctrl.callback) { + ctrl.callback({ associations: ctrl.associations }); + await ctrl.loadAssociations(); + } + }; + ctrl.removeItem = async (obj) => { + var nav = ctrl.associations.filter((m) => m.childId == obj.id)[0]; + $rootScope.removeObjectByKey(ctrl.associations, "childId", obj.id); + if (nav && nav.id) { + await service.delete([nav.id]); + $rootScope.showMessage("saved", "success"); + } + }; + ctrl.selectItem = async (obj) => { + var nav = { + parentId: ctrl.parentId, + childId: obj.id, + priority: obj.priority, + }; + if (ctrl.parentId) { + var result = await service.save(nav); + nav.id = result.data.id; + $rootScope.showMessage("saved", "success"); + } + ctrl.associations.push(nav); + if (ctrl.callback) { + ctrl.callback({ selected: nav }); + } + }; + ctrl.getTitle = (item) => { + return item[ctrl.titleField]; + }; + ctrl.updateOrders = async function (index) { + if (index > ctrl.dragStartIndex) { + ctrl.data.splice(ctrl.dragStartIndex, 1); + } else { + ctrl.data.splice(ctrl.dragStartIndex + 1, 1); + } + angular.forEach(ctrl.data, function (e, i) { + e.priority = ctrl.minPriority + i; + }); + ctrl.saveOrder(); + }; + ctrl.saveOrder = async () => { + angular.forEach(ctrl.data, function (e, i) { + let nav = ctrl.associations.filter((m) => m.childId == e.id)[0]; + if (nav) { + nav.priority = ctrl.data[i].priority; + } + }); + if (ctrl.parentId) { + var result = await service.saveMany(ctrl.associations); + if (result.success) { + $rootScope.showMessage("saved", "success"); + } + } + }; + ctrl.dragStart = function (index) { + ctrl.dragStartIndex = index; + ctrl.minPriority = ctrl.data[0].priority; + }; + ctrl.goToDetails = async function (nav) { + $location.url(ctrl.detailUrl + nav[ctrl.key]); + }; + }, + ], +}); + +modules.component("propertiesValue", { + templateUrl: + "/mix-app/views/app-portal/components/properties-value/view.html", + bindings: { + title: "=", + columns: "=", + properties: "=", + }, + controller: [ + "$rootScope", + "$scope", + function ($rootScope, $scope) { + var ctrl = this; + ctrl.defaultAttr = { + title: "", + name: "", + default: null, + options: [], + priority: 0, + dataType: 7, + isGroupBy: false, + isSelect: false, + isDisplay: true, + width: 3, + }; + ctrl.selectedProp = null; + ctrl.mixConfigurations = $rootScope.globalSettings; + + ctrl.$doCheck = function () { + if ( + angular.toJson(ctrl.columns) != angular.toJson(ctrl.trackedColumns) + ) { + ctrl.trackedColumns = angular.copy(ctrl.columns); + ctrl.trackedProperties = angular.copy(ctrl.properties); + ctrl.loadEditors(); + } + }.bind(ctrl); - // var h; + ctrl.loadEditors = function () { + ctrl.properties = []; + for (let i = 0; i < ctrl.columns.length; i++) { + var col = ctrl.columns[i]; + var oldObj = + $rootScope.findObjectByKey( + ctrl.trackedProperties, + "name", + col.systemName + ) || {}; - // ctrl.editor.dispose(); - // if ($(".monaco-editor.container-code-editor.monaco-editor-full")[0]) { - // // Do something if class exists - // h = window.innerHeight; - // $( - // ".monaco-editor.container-code-editor.monaco-editor-full .code-editor" - // ).height(h); - // document.body.style.overflow = "hidden"; - // } else { - // // Do something if class does not exist - // h = ctrl.lineCount * 20; - // $(".monaco-editor .code-editor").height(h); - // document.body.style.overflow = "visible"; - // } - // ctrl.editor.layout(); + ctrl.properties.push({ + title: col.displayName, + name: col.systemName, + dataType: col.dataType, + value: oldObj.value || col.defaultValue, + options: col.options, + }); + } + }; - ctrl.updateEditors(); + ctrl.addAttr = function () { + if (ctrl.columns) { + var t = angular.copy(ctrl.defaultAttr); + ctrl.columns.push(t); + } }; }, ], @@ -16541,6 +17090,46 @@ modules.component("modalTemplate", { ], }); +modules.component("portalThemeSettings", { + templateUrl: + "/mix-app/views/app-portal/components/portal-theme-settings/view.html", + bindings: { + showLink: "=", + }, + controller: [ + "$rootScope", + "$scope", + "AppSettingsServices", + function ($rootScope, $scope, appSettingsServices) { + var ctrl = this; + this.$onInit = function () { + ctrl.portalThemeSettings = + $rootScope.globalSettings.portalThemeSettings; + }; + ctrl.applyThemeSettings = function () { + $rootScope.globalSettings.portalThemeSettings = + ctrl.portalThemeSettings; + }; + ctrl.saveThemeSettings = async function () { + var resp = await appSettingsServices.saveAppSettings( + "PortalThemeSettings", + ctrl.portalThemeSettings + ); + if (resp && resp.success) { + $rootScope.showMessage("success", "success"); + $rootScope.isBusy = false; + $scope.$apply(); + } else { + if (resp) { + $rootScope.showErrors(resp.errors); + } + $scope.$apply(); + } + }; + }, + ], +}); + modules.component("propertiesStructure", { templateUrl: "/mix-app/views/app-portal/components/properties-structure/view.html", @@ -16640,242 +17229,36 @@ modules.component("propertiesStructure", { ctrl.generateName = function (col) { col.systemName = $rootScope.generateKeyword( - col.displayName, - "", - true, - true - ); - }; - ctrl.removeAttr = function (index) { - if (ctrl.columns) { - ctrl.columns.splice(index, 1); - } - }; - ctrl.dragStart = function (index) { - ctrl.dragStartIndex = index; - }; - ctrl.updateOrders = function (index) { - if (index > ctrl.dragStartIndex) { - ctrl.columns.splice(ctrl.dragStartIndex, 1); - } else { - ctrl.columns.splice(ctrl.dragStartIndex + 1, 1); - } - angular.forEach(ctrl.columns, function (e, i) { - e.priority = i; - }); - }; - }, - ], - bindings: { - header: "=", - columns: "=", - }, -}); - -modules.component("navigators", { - templateUrl: - "/mix-app/views/app-portal/components/navigations/navigations.html", - bindings: { - modelName: "=", - parentId: "=", - associations: "=", - titleField: "=?", - - prefix: "=", - detailUrl: "=", - data: "=", - titleMaxLength: "=?", - callback: "&?", - }, - controller: [ - "$rootScope", - "$scope", - "ngAppSettings", - "$location", - function ($rootScope, $scope, ngAppSettings, $location) { - var ctrl = this; - var service; - ctrl.selected = null; - ctrl.activedIndex = null; - ctrl.$onInit = async () => { - ctrl.titleField = ctrl.titleField || "title"; - service = $rootScope.getRestService(ctrl.modelName); - ctrl.associationRequest = angular.copy(ngAppSettings.request); - ctrl.associationRequest.orderBy = "Priority"; - ctrl.associationRequest.direction = "Asc"; - ctrl.associationRequest.parentId = ctrl.parentId; - await ctrl.loadAssociations(); - ctrl.loadData(); - }; - ctrl.loadAssociations = async () => { - var getAssociations = await service.getList(ctrl.associationRequest); - ctrl.associations = getAssociations.data.items; - }; - ctrl.loadData = async () => { - var maxPriority = 0; - if (ctrl.associations.length > 0) { - maxPriority = - ctrl.associations[ctrl.associations.length - 1].priority || 0; - } - angular.forEach(ctrl.data, function (e, i) { - let nav = ctrl.associations.filter((m) => m.childId == e.id)[0]; - if (nav) { - if (nav.priority == undefined) { - nav.priority = maxPriority + 1; - maxPriority++; - } - e.isActived = true; - e.priority = nav.priority || 0; - } else { - e.isActived = false; - e.priority = maxPriority + 1; - maxPriority++; - } - e.isActived = nav != null; - }); - ctrl.data = $rootScope.sortArray(ctrl.data, "priority"); - }; - ctrl.select = async (obj) => { - if (obj.isActived) { - ctrl.selectItem(obj); - } else { - ctrl.removeItem(obj); - } - if (ctrl.callback) { - ctrl.callback({ associations: ctrl.associations }); - await ctrl.loadAssociations(); - } - }; - ctrl.removeItem = async (obj) => { - var nav = ctrl.associations.filter((m) => m.childId == obj.id)[0]; - $rootScope.removeObjectByKey(ctrl.associations, "childId", obj.id); - if (nav && nav.id) { - await service.delete([nav.id]); - $rootScope.showMessage("saved", "success"); - } - }; - ctrl.selectItem = async (obj) => { - var nav = { - parentId: ctrl.parentId, - childId: obj.id, - priority: obj.priority, - }; - if (ctrl.parentId) { - var result = await service.save(nav); - nav.id = result.data.id; - $rootScope.showMessage("saved", "success"); - } - ctrl.associations.push(nav); - if (ctrl.callback) { - ctrl.callback({ selected: nav }); - } - }; - ctrl.getTitle = (item) => { - return item[ctrl.titleField]; - }; - ctrl.updateOrders = async function (index) { - if (index > ctrl.dragStartIndex) { - ctrl.data.splice(ctrl.dragStartIndex, 1); - } else { - ctrl.data.splice(ctrl.dragStartIndex + 1, 1); - } - angular.forEach(ctrl.data, function (e, i) { - e.priority = ctrl.minPriority + i; - }); - ctrl.saveOrder(); - }; - ctrl.saveOrder = async () => { - angular.forEach(ctrl.data, function (e, i) { - let nav = ctrl.associations.filter((m) => m.childId == e.id)[0]; - if (nav) { - nav.priority = ctrl.data[i].priority; - } - }); - if (ctrl.parentId) { - var result = await service.saveMany(ctrl.associations); - if (result.success) { - $rootScope.showMessage("saved", "success"); - } + col.displayName, + "", + true, + true + ); + }; + ctrl.removeAttr = function (index) { + if (ctrl.columns) { + ctrl.columns.splice(index, 1); } }; ctrl.dragStart = function (index) { ctrl.dragStartIndex = index; - ctrl.minPriority = ctrl.data[0].priority; }; - ctrl.goToDetails = async function (nav) { - $location.url(ctrl.detailUrl + nav[ctrl.key]); + ctrl.updateOrders = function (index) { + if (index > ctrl.dragStartIndex) { + ctrl.columns.splice(ctrl.dragStartIndex, 1); + } else { + ctrl.columns.splice(ctrl.dragStartIndex + 1, 1); + } + angular.forEach(ctrl.columns, function (e, i) { + e.priority = i; + }); }; }, ], -}); - -modules.component("propertiesValue", { - templateUrl: - "/mix-app/views/app-portal/components/properties-value/view.html", bindings: { - title: "=", + header: "=", columns: "=", - properties: "=", }, - controller: [ - "$rootScope", - "$scope", - function ($rootScope, $scope) { - var ctrl = this; - ctrl.defaultAttr = { - title: "", - name: "", - default: null, - options: [], - priority: 0, - dataType: 7, - isGroupBy: false, - isSelect: false, - isDisplay: true, - width: 3, - }; - ctrl.selectedProp = null; - ctrl.mixConfigurations = $rootScope.globalSettings; - - ctrl.$doCheck = function () { - if ( - angular.toJson(ctrl.columns) != angular.toJson(ctrl.trackedColumns) - ) { - ctrl.trackedColumns = angular.copy(ctrl.columns); - ctrl.trackedProperties = angular.copy(ctrl.properties); - ctrl.loadEditors(); - } - }.bind(ctrl); - - ctrl.loadEditors = function () { - ctrl.properties = []; - for (let i = 0; i < ctrl.columns.length; i++) { - var col = ctrl.columns[i]; - var oldObj = - $rootScope.findObjectByKey( - ctrl.trackedProperties, - "name", - col.systemName - ) || {}; - - ctrl.properties.push({ - title: col.displayName, - name: col.systemName, - dataType: col.dataType, - value: oldObj.value || col.defaultValue, - options: col.options, - }); - } - }; - - ctrl.addAttr = function () { - if (ctrl.columns) { - var t = angular.copy(ctrl.defaultAttr); - ctrl.columns.push(t); - } - }; - }, - ], }); modules.component("serviceHubPortal", { @@ -17048,46 +17431,6 @@ modules.component("serviceHubPortal", { ], }); -modules.component("portalThemeSettings", { - templateUrl: - "/mix-app/views/app-portal/components/portal-theme-settings/view.html", - bindings: { - showLink: "=", - }, - controller: [ - "$rootScope", - "$scope", - "AppSettingsServices", - function ($rootScope, $scope, appSettingsServices) { - var ctrl = this; - this.$onInit = function () { - ctrl.portalThemeSettings = - $rootScope.globalSettings.portalThemeSettings; - }; - ctrl.applyThemeSettings = function () { - $rootScope.globalSettings.portalThemeSettings = - ctrl.portalThemeSettings; - }; - ctrl.saveThemeSettings = async function () { - var resp = await appSettingsServices.saveAppSettings( - "PortalThemeSettings", - ctrl.portalThemeSettings - ); - if (resp && resp.success) { - $rootScope.showMessage("success", "success"); - $rootScope.isBusy = false; - $scope.$apply(); - } else { - if (resp) { - $rootScope.showErrors(resp.errors); - } - $scope.$apply(); - } - }; - }, - ], -}); - modules.component("templateEditor", { templateUrl: "/mix-app/views/app-portal/components/template-editor/templateEditor.html", @@ -17256,67 +17599,6 @@ modules.component("toastHelper", { ], }); -modules.component("urlAlias", { - templateUrl: "/mix-app/views/app-portal/components/url-alias/url-alias.html", - controller: [ - "$rootScope", - "$scope", - "UrlAliasService", - function ($rootScope, $scope, service) { - var ctrl = this; - ctrl.$onInit = function () { - ctrl.updateUrl(); - }; - ctrl.updateUrl = function () { - ctrl.url = - $rootScope.globalSettings.domain + - "/" + - $rootScope.mixConfigurations.lang + - "/" + - ctrl.urlAlias.alias; - }; - ctrl.remove = function () { - if (ctrl.urlAlias.id > 0) { - $rootScope.showConfirm( - ctrl, - "removeConfirmed", - [ctrl.urlAlias.id], - null, - "Remove", - "Deleted data will not able to recover, are you sure you want to delete this item?" - ); - } else { - if (ctrl.removeCallback) { - ctrl.removeCallback({ index: ctrl.index }); - } - } - }; - - ctrl.removeConfirmed = async function (id) { - $rootScope.isBusy = true; - var result = await service.delete(id); - if (result.success) { - if (ctrl.removeCallback) { - ctrl.removeCallback({ index: ctrl.index }); - } - $rootScope.isBusy = false; - $scope.$apply(); - } else { - $rootScope.showMessage("failed"); - $rootScope.isBusy = false; - $scope.$apply(); - } - }; - }, - ], - bindings: { - urlAlias: "=", - index: "=", - callback: "&", - removeCallback: "&", - }, -}); - app.factory("ConnectionManager", [ function () { var serviceFactory = {}; @@ -17575,7 +17857,7 @@ modules.component("videoChatHub", { var _hub, _connect = function (username, onSuccess, onFailure) { var hub = new signalR.HubConnectionBuilder() - .withUrl("/webRtcHub") + .withUrl("/videoChatHub") .withAutomaticReconnect() .configureLogging(signalR.LogLevel.Information) .build(); @@ -17617,29 +17899,14 @@ modules.component("videoChatHub", { _getUsername(); }, _getUsername = function () { - alertify.prompt( - "What is your name?", - function (e, username) { - if (e == false || username == "") { - username = "User " + Math.floor(Math.random() * 10000 + 1); - alertify.success( - "You really need a username, so we will call you... " + - username - ); - } - - // proceed to next step, get media access and start up our connection - _startSession(username); - }, - "" - ); + _startSession("User " + Math.floor(Math.random() * 10000 + 1)); }, _startSession = function (username) { ctrl.viewmodel.Username = username; // Set the selected username in the UI ctrl.viewmodel.Loading = true; // Turn on the loading indicator - $scope.$apply(); + // $scope.$apply(); // Ask the user for permissions to access the webcam and mic - getUserMedia( + navigator.mediaDevices.getUserMedia( { // Permissions to request video: true, @@ -18170,6 +18437,67 @@ app.factory("ViewModel", [ }, ]); +modules.component("urlAlias", { + templateUrl: "/mix-app/views/app-portal/components/url-alias/url-alias.html", + controller: [ + "$rootScope", + "$scope", + "UrlAliasService", + function ($rootScope, $scope, service) { + var ctrl = this; + ctrl.$onInit = function () { + ctrl.updateUrl(); + }; + ctrl.updateUrl = function () { + ctrl.url = + $rootScope.globalSettings.domain + + "/" + + $rootScope.mixConfigurations.lang + + "/" + + ctrl.urlAlias.alias; + }; + ctrl.remove = function () { + if (ctrl.urlAlias.id > 0) { + $rootScope.showConfirm( + ctrl, + "removeConfirmed", + [ctrl.urlAlias.id], + null, + "Remove", + "Deleted data will not able to recover, are you sure you want to delete this item?" + ); + } else { + if (ctrl.removeCallback) { + ctrl.removeCallback({ index: ctrl.index }); + } + } + }; + + ctrl.removeConfirmed = async function (id) { + $rootScope.isBusy = true; + var result = await service.delete(id); + if (result.success) { + if (ctrl.removeCallback) { + ctrl.removeCallback({ index: ctrl.index }); + } + $rootScope.isBusy = false; + $scope.$apply(); + } else { + $rootScope.showMessage("failed"); + $rootScope.isBusy = false; + $scope.$apply(); + } + }; + }, + ], + bindings: { + urlAlias: "=", + index: "=", + callback: "&", + removeCallback: "&", + }, +}); + !(function (t) { var e = {}; function i(n) { diff --git a/src/applications/mixcore/wwwroot/mix-app/js/app-security.min.js b/src/applications/mixcore/wwwroot/mix-app/js/app-security.min.js index 6891362db..0e41348a8 100644 --- a/src/applications/mixcore/wwwroot/mix-app/js/app-security.min.js +++ b/src/applications/mixcore/wwwroot/mix-app/js/app-security.min.js @@ -357,95 +357,65 @@ app.controller("LoginController", [ ]); "use strict"; -app.controller("ForgotPasswordController", [ - "$rootScope", +app.controller("ResetPasswordController", [ "$scope", - "ngAppSettings", - "$location", + "$rootScope", "AuthService", - function ($rootScope, $scope, ngAppSettings, $location, authService) { - if ( - authService.authentication && - authService.authentication.isAuth && - authService.authentication && - authService.authentication.isAdmin - ) { - authService.referredUrl = $location.path(); - $location.path("/admin"); - } - $scope.pageClass = "page-forgot-password"; - $scope.success = false; - $scope.viewmodel = { - email: null, + "$routeParams", + function ($scope, $rootScope, service, $routeParams) { + $scope.user = { + email: "", + password: "", + confirmPassword: "", + code: "", + }; + $scope.init = function () { + $scope.user.code = $routeParams.token; }; - - $scope.message = ""; - $scope.$on("$viewContentLoaded", function () { - $rootScope.isBusy = false; - authService.referredUrl = "/security/login"; - }); $scope.submit = async function () { - var result = await authService.forgotPassword($scope.viewmodel); - if (result.success) { - $rootScope.isBusy = false; - $scope.success = true; - $scope.$apply(); + if ($scope.password !== $scope.confirmPassword) { + $rootScope.showErrors(["Confirm Password is not matched"]); } else { - $rootScope.isBusy = false; - $rootScope.showErrors(result.errors); + $rootScope.isBusy = true; + var result = await service.resetPassword($scope.user); + if (result.success) { + $rootScope.isBusy = false; + window.location.href = "/security/login"; + } else { + if (result) { + $rootScope.showErrors(result.errors); + } + $rootScope.isBusy = false; + $scope.$apply(); + } } }; + }, +]); - $scope.authExternalProvider = function (provider) { - var redirectUri = - location.protocol + "//" + location.host + "/authcomplete.html"; +"use strict"; +app.factory("RegisterServices", [ + "$http", + "ApiService", + "CommonService", + function ($http, apiService, commonService) { + //var serviceBase = 'http://ngauthenticationapi.azurewebsites.net/'; - var externalProviderUrl = - ngAuthSettings.apiServiceBaseUri + - "api/Account/ExternalLogin?provider=" + - provider + - "&response_type=token&client_id=" + - ngAuthSettings.clientId + - "&redirect_uri=" + - redirectUri; - window.$windowScope = $scope; + var usersServiceFactory = {}; + var apiUrl = "/admin/"; + var _register = async function (user) { + var apiUrl = "/rest/auth/user/register"; + var req = { + method: "POST", + url: apiUrl, + data: JSON.stringify(user), + }; - var oauthWindow = window.open( - externalProviderUrl, - "Authenticate Account", - "location=0,status=0,width=600,height=750" - ); + return await apiService.sendRequest(req); }; - $scope.authCompletedCB = function (fragment) { - $scope.$apply(function () { - if (fragment.haslocalaccount === "False") { - authService.logOut(); - - authService.externalAuthData = { - provider: fragment.provider, - username: fragment.external_user_name, - externalAccessToken: fragment.external_access_token, - }; - - $location.path("/associate"); - } else { - //Obtain access token and redirect to orders - var externalData = { - provider: fragment.provider, - externalAccessToken: fragment.external_access_token, - }; - authService.obtainAccessToken(externalData).then( - function (response) { - $location.path("/orders"); - }, - function (err) { - $scope.message = err.error_description; - } - ); - } - }); - }; + usersServiceFactory.register = _register; + return usersServiceFactory; }, ]); @@ -514,64 +484,94 @@ app.factory("RegisterServices", [ ]); "use strict"; -app.controller("ResetPasswordController", [ - "$scope", +app.controller("ForgotPasswordController", [ "$rootScope", + "$scope", + "ngAppSettings", + "$location", "AuthService", - "$routeParams", - function ($scope, $rootScope, service, $routeParams) { - $scope.user = { - email: "", - password: "", - confirmPassword: "", - code: "", - }; - $scope.init = function () { - $scope.user.code = $routeParams.token; + function ($rootScope, $scope, ngAppSettings, $location, authService) { + if ( + authService.authentication && + authService.authentication.isAuth && + authService.authentication && + authService.authentication.isAdmin + ) { + authService.referredUrl = $location.path(); + $location.path("/admin"); + } + $scope.pageClass = "page-forgot-password"; + $scope.success = false; + $scope.viewmodel = { + email: null, }; + + $scope.message = ""; + $scope.$on("$viewContentLoaded", function () { + $rootScope.isBusy = false; + authService.referredUrl = "/security/login"; + }); $scope.submit = async function () { - if ($scope.password !== $scope.confirmPassword) { - $rootScope.showErrors(["Confirm Password is not matched"]); + var result = await authService.forgotPassword($scope.viewmodel); + if (result.success) { + $rootScope.isBusy = false; + $scope.success = true; + $scope.$apply(); } else { - $rootScope.isBusy = true; - var result = await service.resetPassword($scope.user); - if (result.success) { - $rootScope.isBusy = false; - window.location.href = "/security/login"; - } else { - if (result) { - $rootScope.showErrors(result.errors); - } - $rootScope.isBusy = false; - $scope.$apply(); - } + $rootScope.isBusy = false; + $rootScope.showErrors(result.errors); } }; - }, -]); -"use strict"; -app.factory("RegisterServices", [ - "$http", - "ApiService", - "CommonService", - function ($http, apiService, commonService) { - //var serviceBase = 'http://ngauthenticationapi.azurewebsites.net/'; + $scope.authExternalProvider = function (provider) { + var redirectUri = + location.protocol + "//" + location.host + "/authcomplete.html"; - var usersServiceFactory = {}; - var apiUrl = "/admin/"; - var _register = async function (user) { - var apiUrl = "/rest/auth/user/register"; - var req = { - method: "POST", - url: apiUrl, - data: JSON.stringify(user), - }; + var externalProviderUrl = + ngAuthSettings.apiServiceBaseUri + + "api/Account/ExternalLogin?provider=" + + provider + + "&response_type=token&client_id=" + + ngAuthSettings.clientId + + "&redirect_uri=" + + redirectUri; + window.$windowScope = $scope; - return await apiService.sendRequest(req); + var oauthWindow = window.open( + externalProviderUrl, + "Authenticate Account", + "location=0,status=0,width=600,height=750" + ); }; - usersServiceFactory.register = _register; - return usersServiceFactory; + $scope.authCompletedCB = function (fragment) { + $scope.$apply(function () { + if (fragment.haslocalaccount === "False") { + authService.logOut(); + + authService.externalAuthData = { + provider: fragment.provider, + username: fragment.external_user_name, + externalAccessToken: fragment.external_access_token, + }; + + $location.path("/associate"); + } else { + //Obtain access token and redirect to orders + var externalData = { + provider: fragment.provider, + externalAccessToken: fragment.external_access_token, + }; + authService.obtainAccessToken(externalData).then( + function (response) { + $location.path("/orders"); + }, + function (err) { + $scope.message = err.error_description; + } + ); + } + }); + }; }, ]); diff --git a/src/applications/mixcore/wwwroot/mix-app/js/app-shared.min.js b/src/applications/mixcore/wwwroot/mix-app/js/app-shared.min.js index 00202558d..a204ab974 100644 --- a/src/applications/mixcore/wwwroot/mix-app/js/app-shared.min.js +++ b/src/applications/mixcore/wwwroot/mix-app/js/app-shared.min.js @@ -36,7 +36,7 @@ appShared.constant("ngAppSettings", { pageSize: "20", pageIndex: 0, status: "Published", - orderBy: null, + sortBy: null, direction: "Desc", fromDate: null, toDate: null, @@ -49,7 +49,7 @@ appShared.constant("ngAppSettings", { pageSize: "20", pageIndex: 0, status: "Published", - orderBy: "CreatedDateTime", + sortBy: "Id", direction: "Desc", fromDate: null, toDate: null, @@ -434,7 +434,7 @@ appShared.run([ $rootScope.showErrors = function (errors) { if (errors.length) { angular.forEach(errors, function (e) { - $rootScope.showMessage(e, "danger"); + $rootScope.showMessage(e.message, "danger"); }); } else { $rootScope.showMessage("Server Errors", "danger"); @@ -908,7 +908,7 @@ appShared pageSize: "20", pageIndex: 0, status: "Published", - orderBy: "CreatedDateTime", + sortBy: "Id", direction: "Desc", fromDate: null, toDate: null, @@ -1389,6 +1389,125 @@ appShared.factory("ApiService", [ }, ]); +"use strict"; +appShared.factory("AppSettingsService", [ + "$rootScope", + "ApiService", + "CommonService", + "localStorageService", + "AppSettings", + function ( + $rootScope, + apiService, + commonService, + localStorageService, + appSettings + ) { + var factory = {}; + var _appSettings = { + lang: "", + data: null, + }; + var _fillAppSettings = async function (culture) { + this.appSettings = localStorageService.get("appSettings"); + if ( + this.appSettings && + this.appSettings.data && + this.appSettings.lang === culture + ) { + //_appSettings = appSettings; + //this.appSettings = appSettings; + + return this.appSettings; + } else { + this.appSettings = await _getappSettings(culture); + return this.appSettings; + } + }; + var _getappSettings = async function (culture) { + var appSettings = localStorageService.get("appSettings"); + if (appSettings && (!culture || appSettings.lang === culture)) { + appSettings = appSettings; + return appSettings; + } else { + appSettings = { lang: culture, data: null }; + var url = "/admin"; + if (culture) { + url += "/" + culture; + } + url += "/global-settings"; + var req = { + method: "GET", + url: url, + }; + var getData = await apiService.sendRequest(req); + if (getData.success) { + appSettings = getData.data; + localStorageService.set("appSettings", appSettings); + } + return appSettings; + } + }; + var _reset = async function (lang) { + localStorageService.remove("appSettings"); + await _getappSettings(lang); + }; + var _get = function (keyword, isWrap, defaultText) { + if ($rootScope.waitForInit()) { + if (!this.appSettings && $rootScope.globalSettings) { + $rootScope.isBusy = true; + this.fillAppSettings($rootScope.globalSettings.lang).then(function ( + response + ) { + $rootScope.isBusy = false; + return ( + response[keyword] || + defaultText || + getLinkCreateLanguage(keyword, isWrap) + ); + }); + } else { + return ( + this.appSettings[keyword] || + defaultText || + getLinkCreateLanguage(keyword, isWrap) + ); + } + } + }; + + var _getAsync = async function (keyword, defaultText) { + if (!this.appSettings && $rootScope.globalSettings) { + $rootScope.isBusy = true; + this.appSettings = await _fillAppSettings(lang); + return ( + this.appSettings[keyword] || + defaultText || + getLinkCreateLanguage(keyword, isWrap) + ); + } else { + return ( + this.appSettings[keyword] || + defaultText || + getLinkCreateLanguage(keyword, isWrap) + ); + } + }; + + var getLinkCreateLanguage = function (keyword, isWrap) { + //return '[' + keyword + ']'; + return isWrap ? "[" + keyword + "]" : keyword; + }; + + factory.getAsync = _getAsync; + factory.get = _get; + factory.reset = _reset; + factory.appSettings = _appSettings; + factory.fillAppSettings = _fillAppSettings; + return factory; + }, +]); + "use strict"; appShared.factory("AuthService", [ "$http", @@ -3129,6 +3248,50 @@ appShared.factory("RestMixDatabasePortalService", [ }, ]); +"use strict"; +appShared.factory("RestMixAssociationPortalService", [ + "BaseRestService", + function (baseService) { + var serviceFactory = Object.create(baseService); + serviceFactory.init("mix-db-association"); + + serviceFactory.getAssociation = async ( + parentDbName, + childDbName, + parentId, + childId + ) => { + var url = `${serviceFactory.prefixUrl}/${parentDbName}/${childDbName}/${ + parentId || guidParentId + }/${childId}`; + var req = { + serviceBase: serviceFactory.serviceBase, + apiVersion: serviceFactory.apiVersion, + method: "GET", + url: url, + }; + return await serviceFactory.getRestApiResult(req); + }; + serviceFactory.deleteAssociation = async ( + parentDbName, + childDbName, + parentId, + guidParentId, + childId + ) => { + var url = `${serviceFactory.prefixUrl}/${parentDbName}/${childDbName}/${parentId}/${childId}`; + var req = { + serviceBase: serviceFactory.serviceBase, + apiVersion: serviceFactory.apiVersion, + method: "DELETE", + url: url, + }; + return await serviceFactory.getRestApiResult(req); + }; + return serviceFactory; + }, +]); + "use strict"; appShared.factory("RestMixDatabaseColumnPortalService", [ "BaseRestService", @@ -3293,45 +3456,21 @@ appShared.factory("RestMixDatabaseDataPortalService", [ ]); "use strict"; -appShared.factory("RestMixAssociationPortalService", [ +appShared.factory("RestMixDatabaseDataValuePortalService", [ "BaseRestService", function (baseService) { var serviceFactory = Object.create(baseService); - serviceFactory.init("mix-db-association"); + serviceFactory.init("mix-database-data-value"); + return serviceFactory; + }, +]); - serviceFactory.getAssociation = async ( - parentDbName, - childDbName, - parentId, - childId - ) => { - var url = `${serviceFactory.prefixUrl}/${parentDbName}/${childDbName}/${ - parentId || guidParentId - }/${childId}`; - var req = { - serviceBase: serviceFactory.serviceBase, - apiVersion: serviceFactory.apiVersion, - method: "GET", - url: url, - }; - return await serviceFactory.getRestApiResult(req); - }; - serviceFactory.deleteAssociation = async ( - parentDbName, - childDbName, - parentId, - guidParentId, - childId - ) => { - var url = `${serviceFactory.prefixUrl}/${parentDbName}/${childDbName}/${parentId}/${childId}`; - var req = { - serviceBase: serviceFactory.serviceBase, - apiVersion: serviceFactory.apiVersion, - method: "DELETE", - url: url, - }; - return await serviceFactory.getRestApiResult(req); - }; +"use strict"; +appShared.factory("RestMixRelationshipPortalService", [ + "BaseRestService", + function (baseService) { + var serviceFactory = Object.create(baseService); + serviceFactory.init("mix-database-relationship"); return serviceFactory; }, ]); @@ -3356,11 +3495,23 @@ appShared.factory("RestMvcModuleDataService", [ ]); "use strict"; -appShared.factory("RestMixRelationshipPortalService", [ +appShared.factory("RestPostService", [ "BaseRestService", function (baseService) { var serviceFactory = Object.create(baseService); - serviceFactory.init("mix-database-relationship"); + serviceFactory.initService("/rest/mixcore", "post-content"); + var _filter = async function (request) { + var url = `${this.prefixUrl}/filter`; + var req = { + serviceBase: this.serviceBase, + method: "POST", + url: url, + data: request, + }; + return await this.getRestApiResult(req); + }; + // Define more service methods here + serviceFactory.filter = _filter; return serviceFactory; }, ]); @@ -3387,38 +3538,6 @@ appShared.factory("RestRelatedAttributeDataPortalService", [ }, ]); -"use strict"; -appShared.factory("RestPostService", [ - "BaseRestService", - function (baseService) { - var serviceFactory = Object.create(baseService); - serviceFactory.initService("/rest/mixcore", "post-content"); - var _filter = async function (request) { - var url = `${this.prefixUrl}/filter`; - var req = { - serviceBase: this.serviceBase, - method: "POST", - url: url, - data: request, - }; - return await this.getRestApiResult(req); - }; - // Define more service methods here - serviceFactory.filter = _filter; - return serviceFactory; - }, -]); - -"use strict"; -appShared.factory("RestMixDatabaseDataValuePortalService", [ - "BaseRestService", - function (baseService) { - var serviceFactory = Object.create(baseService); - serviceFactory.init("mix-database-data-value"); - return serviceFactory; - }, -]); - "use strict"; function BaseCtrl($scope, $rootScope, $routeParams, ngAppSettings, service) { @@ -4668,7 +4787,7 @@ appShared.controller("MvcModuleDataController", [ ngAppSettings, service ); - $scope.request.orderBy = "Priority"; + $scope.request.sortBy = "Priority"; $scope.request.direction = "Asc"; $scope.mixConfigurations = $rootScope.globalSettings; $scope.moduleContentId = null; @@ -4752,7 +4871,7 @@ appShared.controller("MvcPostController", [ service ); $scope.service = null; - $scope.request.orderBy = "Priority"; + $scope.request.sortBy = "Priority"; $scope.request.direction = "Asc"; $scope.mixConfigurations = $rootScope.globalSettings; $scope.moduleContentId = null; @@ -4794,87 +4913,6 @@ appShared.controller("MvcPostController", [ }, ]); -sharedComponents.component("addressEditor", { - templateUrl: "/mix-app/views/app-shared/components/address-editor/view.html", - bindings: { - province: "=", - provinceClass: "=?", - district: "=", - districtClass: "=?", - ward: "=", - wardClass: "=?", - }, - controller: "AddressEditorController", -}); - -sharedComponents.controller("AddressEditorController", [ - "$rootScope", - "$scope", - "ApiService", - function PortalTemplateController($rootScope, $scope, apiService) { - var ctrl = this; - ctrl.provinceEndpoint = "/rest/shared/json-data/provinces.json/true"; - ctrl.districtEndpoint = "/rest/shared/json-data/districts.json/true"; - ctrl.wardEndpoint = "/rest/shared/json-data/wards.json/true"; - ctrl.$onInit = async function () { - ctrl.provinceClass = - ctrl.provinceClass || "form-select form-control mb-3"; - ctrl.districtClass = - ctrl.districtClass || "form-select form-control mb-3"; - ctrl.wardClass = ctrl.wardClass || "form-select form-control mb-3"; - - ctrl.provinceOptions = await apiService.getApiResult({ - url: ctrl.provinceEndpoint, - }); - $scope.$apply(); - $rootScope.$watch( - () => { - return ctrl.province; - }, - async function (newVal, oldVal) { - if (newVal != oldVal || !ctrl.district) { - if (!ctrl.allDistrictOptions) { - ctrl.allDistrictOptions = await apiService.getApiResult({ - url: ctrl.districtEndpoint, - }); - ctrl.districtOptions = ctrl.allDistrictOptions.filter( - (m) => m["province"] == ctrl.province - ); - $scope.$apply(); - } else { - ctrl.districtOptions = ctrl.allDistrictOptions.filter( - (m) => m["province"] == ctrl.province - ); - } - } - } - ); - $rootScope.$watch( - () => { - return ctrl.district; - }, - async function (newVal, oldVal) { - if (newVal != oldVal) { - if (!ctrl.allWardOptions) { - ctrl.allWardOptions = await apiService.getApiResult({ - url: ctrl.wardEndpoint, - }); - ctrl.wardOptions = ctrl.allWardOptions.filter( - (m) => m["district"] == ctrl.district - ); - $scope.$apply(); - } else { - ctrl.wardOptions = ctrl.allWardOptions.filter( - (m) => m["district"] == ctrl.district - ); - } - } - } - ); - }; - }, -]); - sharedComponents.component("apiFile", { templateUrl: "/mix-app/views/app-shared/components/api-file/api-file.html", controller: [ @@ -4934,7 +4972,7 @@ sharedComponents.component("apiFile", { ctrl.postedFile.extension = file.name.substring( file.name.lastIndexOf(".") ); - ctrl.postedFile.fileStream = reader.result; + ctrl.postedFile.fileBase64 = reader.result; $rootScope.isBusy = false; $scope.$apply(); }; @@ -5063,34 +5101,87 @@ sharedComponents.component("azureStorage", { ], }); -sharedComponents.component("checkboxSwitch", { - templateUrl: "/mix-app/views/app-shared/components/checkbox-switch/view.html", - controller: [ - "$rootScope", - "$location", - function ($rootScope, $location) { - var ctrl = this; - ctrl.guid = $rootScope.generateUUID(); - ctrl.$onInit = function () { - ctrl.isSelected = ctrl.isSelected || false; - }; - ctrl.limString = function (str, max) { - if (str) { - return str.length > max ? str.substring(0, max) + " ..." : str; - } - }; - }, - ], - +sharedComponents.component("addressEditor", { + templateUrl: "/mix-app/views/app-shared/components/address-editor/view.html", bindings: { - value: "=", - isSelected: "=?", - detailUrl: "=?", - callback: "&", - description: "=", + province: "=", + provinceClass: "=?", + district: "=", + districtClass: "=?", + ward: "=", + wardClass: "=?", }, + controller: "AddressEditorController", }); +sharedComponents.controller("AddressEditorController", [ + "$rootScope", + "$scope", + "ApiService", + function PortalTemplateController($rootScope, $scope, apiService) { + var ctrl = this; + ctrl.provinceEndpoint = "/rest/shared/json-data/provinces.json/true"; + ctrl.districtEndpoint = "/rest/shared/json-data/districts.json/true"; + ctrl.wardEndpoint = "/rest/shared/json-data/wards.json/true"; + ctrl.$onInit = async function () { + ctrl.provinceClass = + ctrl.provinceClass || "form-select form-control mb-3"; + ctrl.districtClass = + ctrl.districtClass || "form-select form-control mb-3"; + ctrl.wardClass = ctrl.wardClass || "form-select form-control mb-3"; + + ctrl.provinceOptions = await apiService.getApiResult({ + url: ctrl.provinceEndpoint, + }); + $scope.$apply(); + $rootScope.$watch( + () => { + return ctrl.province; + }, + async function (newVal, oldVal) { + if (newVal != oldVal || !ctrl.district) { + if (!ctrl.allDistrictOptions) { + ctrl.allDistrictOptions = await apiService.getApiResult({ + url: ctrl.districtEndpoint, + }); + ctrl.districtOptions = ctrl.allDistrictOptions.filter( + (m) => m["province"] == ctrl.province + ); + $scope.$apply(); + } else { + ctrl.districtOptions = ctrl.allDistrictOptions.filter( + (m) => m["province"] == ctrl.province + ); + } + } + } + ); + $rootScope.$watch( + () => { + return ctrl.district; + }, + async function (newVal, oldVal) { + if (newVal != oldVal) { + if (!ctrl.allWardOptions) { + ctrl.allWardOptions = await apiService.getApiResult({ + url: ctrl.wardEndpoint, + }); + ctrl.wardOptions = ctrl.allWardOptions.filter( + (m) => m["district"] == ctrl.district + ); + $scope.$apply(); + } else { + ctrl.wardOptions = ctrl.allWardOptions.filter( + (m) => m["district"] == ctrl.district + ); + } + } + } + ); + }; + }, +]); + sharedComponents.component("barCode", { templateUrl: "/mix-app/views/app-shared/components/bar-code/view.html", bindings: { @@ -5167,6 +5258,48 @@ sharedComponents.component("barCode", { ], }); +sharedComponents.component("breadcrumbs", { + templateUrl: + "/mix-app/views/app-shared/components/breadcrumbs/breadcrumbs.html", + controller: [ + "$rootScope", + function ($rootScope) { + var ctrl = this; + }, + ], + bindings: { + breadCrumbs: "=", + }, +}); + +sharedComponents.component("checkboxSwitch", { + templateUrl: "/mix-app/views/app-shared/components/checkbox-switch/view.html", + controller: [ + "$rootScope", + "$location", + function ($rootScope, $location) { + var ctrl = this; + ctrl.guid = $rootScope.generateUUID(); + ctrl.$onInit = function () { + ctrl.isSelected = ctrl.isSelected || false; + }; + ctrl.limString = function (str, max) { + if (str) { + return str.length > max ? str.substring(0, max) + " ..." : str; + } + }; + }, + ], + + bindings: { + value: "=", + isSelected: "=?", + detailUrl: "=?", + callback: "&", + description: "=", + }, +}); + sharedComponents.component("cultures", { templateUrl: "/mix-app/views/app-shared/components/cultures/cultures.html", bindings: { @@ -5249,7 +5382,7 @@ sharedComponents.component("customFile", { ctrl.mediaFile.extension = file.name.substring( file.name.lastIndexOf(".") ); - ctrl.mediaFile.fileStream = reader.result; + ctrl.mediaFile.fileBase64 = reader.result; var media = getMedia.data; media.mediaFile = ctrl.mediaFile; var resp = await mediaService.save(media); @@ -5287,7 +5420,7 @@ sharedComponents.component("customFile", { ctrl.mediaFile.extension = file.name.substring( file.name.lastIndexOf(".") ); - ctrl.mediaFile.fileStream = reader.result; + ctrl.mediaFile.fileBase64 = reader.result; ctrl.srcUrl = reader.result; $rootScope.isBusy = false; @@ -5320,111 +5453,19 @@ sharedComponents.component("swDataPreview", { }, }); -sharedComponents.component("fbLogin", { - templateUrl: "/mix-app/views/app-shared/components/fb-login/view.html", +sharedComponents.component("mixDataTypeEditor", { + templateUrl: + "/mix-app/views/app-shared/components/data-type-editor/view.html", bindings: { - fbPageId: "=", - themeColor: "=", - inGreeting: "=", - outGreeting: "=", - loginCallback: "&?", - logoutCallback: "&?", + data: "=", + datatype: "=", + inputClass: "=?", + isShowTitle: "=?", + columnTitle: "=?", }, controller: [ - "$rootScope", - "$scope", - "$location", - function ($rootScope, $scope, $location) { - var ctrl = this; - ctrl.loginStatus = null; - ctrl.showLogin = false; - ctrl.init = function () { - // ctrl.checkLoginState(); - ctrl.showLogin = - $rootScope.globalSettings.externalLoginProviders.Facebook != ""; - }; - ctrl.translate = $rootScope.translate; - ctrl.login = function () { - FB.login( - function (response) { - ctrl.statusChangeCallback(response); - }, - { scope: "public_profile,email" } - ); - }; - ctrl.logout = function () { - FB.getLoginStatus(function (response) { - if (response.status === "connected") { - FB.logout(function (response) { - ctrl.loggedIn = false; - ctrl.profile = null; - if (ctrl.logoutCallback) { - ctrl.logoutCallback(); - } - $scope.$apply(); - }); - } - }); - }; - ctrl.getProfile = function (authResponse) { - FB.api("/me", "GET", { fields: "id,name,email" }, function (response) { - ctrl.profile = response; - ctrl.loggedIn = true; - if (ctrl.loginCallback) { - let loginData = { - userID: authResponse.userID, - email: response.email, - accessToken: authResponse.accessToken, - }; - ctrl.loginCallback({ resp: loginData }); - } - $scope.$apply(); - }); - }; - ctrl.checkLoginState = function () { - FB.getLoginStatus(function (response) { - ctrl.statusChangeCallback(response); - ctrl.loginStatus = response; - }); - }; - ctrl.statusChangeCallback = function (response) { - // Called with the results from FB.getLoginStatus(). - if (response.status === "connected") { - // Logged into your webpage and Facebook. - ctrl.getProfile(response.authResponse); - } - }; - }, - ], -}); - -sharedComponents.component("breadcrumbs", { - templateUrl: - "/mix-app/views/app-shared/components/breadcrumbs/breadcrumbs.html", - controller: [ - "$rootScope", - function ($rootScope) { - var ctrl = this; - }, - ], - bindings: { - breadCrumbs: "=", - }, -}); - -sharedComponents.component("mixDataTypeEditor", { - templateUrl: - "/mix-app/views/app-shared/components/data-type-editor/view.html", - bindings: { - data: "=", - datatype: "=", - inputClass: "=?", - isShowTitle: "=?", - columnTitle: "=?", - }, - controller: [ - "ngAppSettings", - function (ngAppSettings) { + "ngAppSettings", + function (ngAppSettings) { var ctrl = this; ctrl.icons = ngAppSettings.icons; this.dataTypes = ngAppSettings.dataTypes; @@ -5480,6 +5521,126 @@ sharedComponents.component("mixDataTypeEditor", { ], }); +"use trick"; +sharedComponents.directive("pane", function () { + return { + require: "^tabs", + restrict: "E", + transclude: true, + scope: { title: "@" }, + link: function (scope, element, attrs, tabsController) { + tabsController.addPane(scope); + }, + template: + '
' + + "
", + replace: true, + }; +}); + +sharedComponents.directive("tabs", function () { + return { + restrict: "E", + transclude: true, + scope: {}, + controller: function ($scope, $element) { + var panes = ($scope.panes = []); + + $scope.select = function (pane) { + angular.forEach(panes, function (pane) { + pane.selected = false; + }); + pane.selected = true; + }; + + this.addPane = function (pane) { + if (panes.length === 0) $scope.select(pane); + panes.push(pane); + }; + }, + templateUrl: "/mix-app/views/app-shared/components/templates/tabs.html", + replace: true, + }; +}); + +sharedComponents.component("fbLogin", { + templateUrl: "/mix-app/views/app-shared/components/fb-login/view.html", + bindings: { + fbPageId: "=", + themeColor: "=", + inGreeting: "=", + outGreeting: "=", + loginCallback: "&?", + logoutCallback: "&?", + }, + controller: [ + "$rootScope", + "$scope", + "$location", + function ($rootScope, $scope, $location) { + var ctrl = this; + ctrl.loginStatus = null; + ctrl.showLogin = false; + ctrl.init = function () { + // ctrl.checkLoginState(); + ctrl.showLogin = + $rootScope.globalSettings.externalLoginProviders.Facebook != ""; + }; + ctrl.translate = $rootScope.translate; + ctrl.login = function () { + FB.login( + function (response) { + ctrl.statusChangeCallback(response); + }, + { scope: "public_profile,email" } + ); + }; + ctrl.logout = function () { + FB.getLoginStatus(function (response) { + if (response.status === "connected") { + FB.logout(function (response) { + ctrl.loggedIn = false; + ctrl.profile = null; + if (ctrl.logoutCallback) { + ctrl.logoutCallback(); + } + $scope.$apply(); + }); + } + }); + }; + ctrl.getProfile = function (authResponse) { + FB.api("/me", "GET", { fields: "id,name,email" }, function (response) { + ctrl.profile = response; + ctrl.loggedIn = true; + if (ctrl.loginCallback) { + let loginData = { + userID: authResponse.userID, + email: response.email, + accessToken: authResponse.accessToken, + }; + ctrl.loginCallback({ resp: loginData }); + } + $scope.$apply(); + }); + }; + ctrl.checkLoginState = function () { + FB.getLoginStatus(function (response) { + ctrl.statusChangeCallback(response); + ctrl.loginStatus = response; + }); + }; + ctrl.statusChangeCallback = function (response) { + // Called with the results from FB.getLoginStatus(). + if (response.status === "connected") { + // Logged into your webpage and Facebook. + ctrl.getProfile(response.authResponse); + } + }; + }, + ], +}); + sharedComponents.component("goToTop", { templateUrl: "/mix-app/views/app-shared/components/go-to-top/view.html", controller: [ @@ -5511,6 +5672,55 @@ sharedComponents.component("goToTop", { bindings: {}, }); +(function (angular) { + appShared.component("languageSwitcher", { + templateUrl: + "/mix-app/views/app-shared/components/language-switcher/language-switcher.html", + controller: [ + "$rootScope", + "ApiService", + "TranslatorService", + function ($rootScope, apiService, translatorService) { + var ctrl = this; + ctrl.mixConfigurations = {}; + this.$onInit = function () { + ctrl.mixConfigurations = $rootScope.mixConfigurations; + if ($rootScope.globalSettings) { + ctrl.mixConfigurations.cultures = + $rootScope.globalSettings.cultures; + } + }; + + ctrl.changeLang = async function (lang, langIcon) { + ctrl.mixConfigurations.lang = lang; + ctrl.mixConfigurations.langIcon = langIcon; + // await commonService.removeSettings(); + // await commonService.removeTranslator(); + // commonService.fillSettings(lang).then(function () { + // translatorService.reset(lang).then(function () { + apiService.getAllSettings(lang).then(function (response) { + translatorService.translateUrl(lang).then(function (url) { + window.top.location = url; + }); + }); + // }); + // }); + }; + ctrl.logOut = function () { + $rootScope.logOut(); + }; + }, + ], + bindings: { + //settings: '=', + ulStyle: "=", + liStyle: "=", + aStyle: "=", + activeClass: "=", + }, + }); +})(window.angular); + sharedComponents.component("googlePay", { templateUrl: "/mix-app/views/app-shared/components/google-pay/view.html", bindings: { @@ -5662,55 +5872,6 @@ sharedComponents.component("googlePay", { ], }); -(function (angular) { - appShared.component("languageSwitcher", { - templateUrl: - "/mix-app/views/app-shared/components/language-switcher/language-switcher.html", - controller: [ - "$rootScope", - "ApiService", - "TranslatorService", - function ($rootScope, apiService, translatorService) { - var ctrl = this; - ctrl.mixConfigurations = {}; - this.$onInit = function () { - ctrl.mixConfigurations = $rootScope.mixConfigurations; - if ($rootScope.globalSettings) { - ctrl.mixConfigurations.cultures = - $rootScope.globalSettings.cultures; - } - }; - - ctrl.changeLang = async function (lang, langIcon) { - ctrl.mixConfigurations.lang = lang; - ctrl.mixConfigurations.langIcon = langIcon; - // await commonService.removeSettings(); - // await commonService.removeTranslator(); - // commonService.fillSettings(lang).then(function () { - // translatorService.reset(lang).then(function () { - apiService.getAllSettings(lang).then(function (response) { - translatorService.translateUrl(lang).then(function (url) { - window.top.location = url; - }); - }); - // }); - // }); - }; - ctrl.logOut = function () { - $rootScope.logOut(); - }; - }, - ], - bindings: { - //settings: '=', - ulStyle: "=", - liStyle: "=", - aStyle: "=", - activeClass: "=", - }, - }); -})(window.angular); - sharedComponents.component("limitString", { templateUrl: "/mix-app/views/app-shared/components/limit-string/limit-string.html", @@ -5763,48 +5924,6 @@ sharedComponents.component("limitString", { }, }); -"use trick"; -sharedComponents.directive("pane", function () { - return { - require: "^tabs", - restrict: "E", - transclude: true, - scope: { title: "@" }, - link: function (scope, element, attrs, tabsController) { - tabsController.addPane(scope); - }, - template: - '
' + - "
", - replace: true, - }; -}); - -sharedComponents.directive("tabs", function () { - return { - restrict: "E", - transclude: true, - scope: {}, - controller: function ($scope, $element) { - var panes = ($scope.panes = []); - - $scope.select = function (pane) { - angular.forEach(panes, function (pane) { - pane.selected = false; - }); - pane.selected = true; - }; - - this.addPane = function (pane) { - if (panes.length === 0) $scope.select(pane); - panes.push(pane); - }; - }, - templateUrl: "/mix-app/views/app-shared/components/templates/tabs.html", - replace: true, - }; -}); - appShared.component("loginPopup", { templateUrl: "/mix-app/views/app-shared/components/login-popup/view.html", controller: "LoginPopupController", @@ -5869,7 +5988,7 @@ appShared.component("mediaNavs", { pageSize: "10", pageIndex: 0, status: "Published", - orderBy: "CreatedDateTime", + sortBy: "Id", direction: "Desc", fromDate: null, toDate: null, @@ -5965,261 +6084,80 @@ appShared.component("mediaNavs", { }); "use strict"; -appShared.controller("MessengerController", [ +appShared.controller("MediaController", [ "$scope", "$rootScope", - "AuthService", - function ($scope, $rootScope, authService) { - $scope.user = { - loggedIn: false, - info: {}, - }; - $scope.isHide = true; - $scope.hideContact = true; - $scope.members = []; - $scope.messages = []; - $scope.message = { connection: {}, content: "" }; - $scope.request = { - uid: "", - objectType: null, - action: "", - data: {}, - room: "", - isMyself: false, - }; - $scope.loadMsgButton = function () {}; - $scope.init = function () { - var endpoints = JSON.parse(localStorage.getItem("ls.endpoints") || "{}"); - BaseHub.call(this, $scope, endpoints.Messenger); + "ngAppSettings", + "$routeParams", + "MediaService", + "ApiService", + "CommonService", + function ( + $scope, + $rootScope, + ngAppSettings, + $routeParams, + service, + apiService, + commonService + ) { + BaseCtrl.call( + this, + $scope, + $rootScope, + $routeParams, + ngAppSettings, + service + ); - authService.fillAuthData().then(() => { - $scope.user.loggedIn = true; - $scope.user.info = { - id: authService.authentication.info.id, - avatar: authService.authentication.info.userData.avatar, - name: authService.authentication.info.userName, - }; - }); - $scope.newMsgCount = 0; - $scope.messages = []; - $scope.onConnected = () => { - $scope.joinRoom("portal"); - }; - $scope.init = function () { - $scope.startConnection( - "portalHub", - authService.authentication.accessToken, - (err) => { - if ( - authService.authentication.refreshToken && - err.message.indexOf("401") >= 0 - ) { - authService.refreshToken().then(async () => { - $scope.startConnection( - "portalHub", - authService.authentication.accessToken - ); - }); - } - } - ); - }; - $("button").on("click", function () { - var text = $("#message").val(); - var hnow = new Date().getHours(); - var mnow = new Date().getMinutes(); - mnow = mnow < 10 ? "0" + mnow : mnow; - var d = hnow + ":" + mnow; + $scope.viewmodel = { + title: "", + description: "", + status: "Published", + mediaFile: { + file: null, + fullPath: "", + folderName: "Media", + fileFolder: "", + fileName: "", + extension: "", + content: "", + fileBase64: "", + }, + }; + // multipart form + $scope.formFile = null; + $scope.relatedMedias = []; - if (text.length > 0) { - $("#message").css("border", "1px solid #f4f5f9"); - $("#conversation").append( - "
  • You
    " + - text + - "
    " + - d + - "
  • " - ); - $("#message").val(""); - $(".widget-conversation").scrollTop( - $("ul li").last().position().top + $("ul li").last().height() - ); - } else { - $("#message").css("border", "1px solid #eb9f9f"); - $("#message").animate({ opacity: "0.1" }, "slow"); - $("#message").animate({ opacity: "1" }, "slow"); - $("#message").animate({ opacity: "0.1" }, "slow"); - $("#message").animate({ opacity: "1" }, "slow"); - } + $scope.init = function () { + $("#modal-files").on("shown.bs.modal", function () { + $scope.getList(); }); }; - $scope.toggle = function () { - $scope.isHide = !$scope.isHide; + $scope.getListSuccessCallback = function () { + // angular.forEach($scope.data.items, function (e) { + // e.isImage = $scope.isImage(e.fullPath); + // if (e.isImage) { + // e.fullPath = `${e.fullPath.split(".")[0]}-XXS.${ + // e.fullPath.split(".")[1] + // }`; + // } + // }); }; - $scope.toggleContact = function () { - $scope.hideContact = !$scope.hideContact; + $scope.isImage = function (url) { + return url + .toLowerCase() + .match(/([/|.|\w|\s|-])*\.(?:jpg|jpeg|gif|png|svg|webp|jfif|webp)/g); }; - $scope.sendMessage = function () { - if ($scope.user.loggedIn) { - $scope.request.data = $scope.message; - $scope.sendMessage(); - $scope.message.content = ""; - } - }; - $scope.receiveMessage = function (msg) { - //$scope.responses.splice(0, 0, msg); - switch (msg.title) { - case "MemberList": - $scope.members = msg.data; - $scope.$apply(); - break; - case "NewMember": - $scope.newMember(msg.data); - $(".widget-conversation").scrollTop = $( - ".widget-conversation" - )[0].scrollHeight; - break; - - case "NewMessage": - $scope.newMessage(msg); - break; - case "ConnectSuccess": - $scope.user.loggedIn = true; - $scope.initList(msg.data); - $scope.$apply(); - break; - - case "MemberOffline": - $scope.removeMember(msg.data); - break; - } - }; - $scope.newMember = function (member) { - var index = $scope.members.findIndex((x) => x.id === member.id); - if (index < 0) { - $scope.members.splice(0, 0, member); - } - $scope.$apply(); - }; - - $scope.initList = function (data) { - data.forEach((member) => { - var index = $scope.members.findIndex((x) => x.id === member.id); - if (index < 0) { - $scope.members.splice(0, 0, member); - } - }); - - $scope.$apply(); - }; - - $scope.removeMember = function (memberId) { - var index = $scope.members.findIndex((x) => x.id === memberId); - if (index >= 0) { - $scope.members.splice(index, 1); - } - $scope.$apply(); - }; - - $scope.newMessage = function (msg) { - $scope.messages.push(msg); - $scope.$apply(); - var objDiv = document.getElementsByClassName("widget-conversation")[0]; - objDiv.scrollTop = objDiv.scrollHeight + 20; - }; - }, -]); - -sharedComponents.component("messenger", { - templateUrl: "/mix-app/views/app-shared/components/messenger/index.html", - controller: "MessengerController", - bindings: { - message: "=", - }, -}); - -sharedComponents.component("message", { - templateUrl: "/mix-app/views/app-shared/components/message/message.html", - bindings: { - message: "=", - }, -}); - -"use strict"; -appShared.controller("MediaController", [ - "$scope", - "$rootScope", - "ngAppSettings", - "$routeParams", - "MediaService", - "ApiService", - "CommonService", - function ( - $scope, - $rootScope, - ngAppSettings, - $routeParams, - service, - apiService, - commonService - ) { - BaseCtrl.call( - this, - $scope, - $rootScope, - $routeParams, - ngAppSettings, - service - ); - - $scope.viewmodel = { - title: "", - description: "", - status: "Published", - mediaFile: { - file: null, - fullPath: "", - folderName: "Media", - fileFolder: "", - fileName: "", - extension: "", - content: "", - fileStream: "", - }, - }; - // multipart form - $scope.formFile = null; - $scope.relatedMedias = []; - - $scope.init = function () { - $("#modal-files").on("shown.bs.modal", function () { - $scope.getList(); - }); - }; - $scope.getListSuccessCallback = function () { - // angular.forEach($scope.data.items, function (e) { - // e.isImage = $scope.isImage(e.fullPath); - // if (e.isImage) { - // e.fullPath = `${e.fullPath.split(".")[0]}-XXS.${ - // e.fullPath.split(".")[1] - // }`; - // } - // }); - }; - $scope.isImage = function (url) { - return url - .toLowerCase() - .match(/([/|.|\w|\s|-])*\.(?:jpg|jpeg|gif|png|svg|webp|jfif|webp)/g); - }; - $scope.save = async function () { - var data = $scope.viewmodel; - $rootScope.isBusy = true; - if ($scope.validate) { - $scope.isValid = await $rootScope.executeFunctionByName( - "validate", - $scope.validateArgs, - $scope - ); + $scope.save = async function () { + var data = $scope.viewmodel; + $rootScope.isBusy = true; + if ($scope.validate) { + $scope.isValid = await $rootScope.executeFunctionByName( + "validate", + $scope.validateArgs, + $scope + ); } if ($scope.isValid) { var resp = await service.save( @@ -6299,7 +6237,7 @@ appShared.controller("MediaController", [ $scope.activedMedia.mediaFile.extension = file.name.substring( file.name.lastIndexOf(".") ); - $scope.activedMedia.mediaFile.fileStream = reader.result; + $scope.activedMedia.mediaFile.fileBase64 = reader.result; $rootScope.isBusy = false; $scope.$apply(); }; @@ -6446,103 +6384,310 @@ sharedComponents.component("medias", { bindings: {}, }); -sharedComponents.component("mixColumnEditor", { - templateUrl: - "/mix-app/views/app-shared/components/mix-column-editor/view.html", +sharedComponents.component("message", { + templateUrl: "/mix-app/views/app-shared/components/message/message.html", bindings: { - model: "=", - column: "=", - intParentId: "=?", - guidParentId: "=?", - isShowTitle: "=?", - inputClass: "=?", - createUrl: "=?", - updateUrl: "=?", - backUrl: "=?", - level: "=?", + message: "=", }, - controller: [ - "$rootScope", - "$scope", - "$location", - "ngAppSettings", - "$filter", - "ApiService", - function ( - $rootScope, - $scope, - $location, - ngAppSettings, - $filter, - apiService - ) { - var ctrl = this; - ctrl.jsonObj = null; - ctrl.mediaFile = {}; - ctrl.icons = ngAppSettings.icons; - ctrl.previousValue = null; - ctrl.translate = (keyword, isWrap, defaultText) => { - return $rootScope.translate(keyword, isWrap, defaultText); - }; +}); - ctrl.refData = null; - ctrl.defaultDataModel = null; +"use strict"; +appShared.controller("MessengerController", [ + "$scope", + "$rootScope", + "AuthService", + function ($scope, $rootScope, authService) { + $scope.user = { + loggedIn: false, + info: {}, + }; + $scope.isHide = true; + $scope.hideContact = true; + $scope.members = []; + $scope.messages = []; + $scope.message = { connection: {}, content: "" }; + $scope.request = { + uid: "", + objectType: null, + action: "", + data: {}, + room: "", + isMyself: false, + }; + $scope.loadMsgButton = function () {}; + $scope.init = function () { + var endpoints = JSON.parse(localStorage.getItem("ls.endpoints") || "{}"); + BaseHub.call(this, $scope, endpoints.Messenger); - ctrl.refDataModel = { - id: null, - data: null, + authService.fillAuthData().then(() => { + $scope.user.loggedIn = true; + $scope.user.info = { + id: authService.authentication.info.id, + avatar: authService.authentication.info.userData.avatar, + name: authService.authentication.info.userName, + }; + }); + $scope.newMsgCount = 0; + $scope.messages = []; + $scope.onConnected = () => { + $scope.joinRoom("portal"); }; - - ctrl.dataTypes = $rootScope.globalSettings.dataTypes; - ctrl.previousId = null; - ctrl.options = []; - ctrl.$onInit = async function () { - ctrl.column.systemName = ctrl.toCamelCase(ctrl.column.systemName); - ctrl.editor = ctrl.column.columnConfigurations.editor - ? ctrl.column.columnConfigurations.editor.toLowerCase() - : ctrl.column.dataType.toLowerCase(); - if (!ctrl.createUrl && ctrl.model && ctrl.column.referenceId) { - ctrl.buildCreateUrl(); - } - if (!ctrl.updateUrl) { - ctrl.updateUrl = "/admin/mix-database-data/details"; - } - if (ctrl.model && ctrl.column.isSelect) { - // Load options from system configutation by name if exist else load options from column configurations - if (ctrl.column.columnConfigurations.optionsConfigurationName) { - // load options if not belong to other column value - let belongTo = ctrl.column.columnConfigurations.belongTo; - let endpoint = - ctrl.column.columnConfigurations.optionsConfigurationName; - if (!belongTo) { - let options = await apiService.getApiResult({ - url: endpoint, + $scope.init = function () { + $scope.startConnection( + "portalHub", + authService.authentication.accessToken, + (err) => { + if ( + authService.authentication.refreshToken && + err.message.indexOf("401") >= 0 + ) { + authService.refreshToken().then(async () => { + $scope.startConnection( + "portalHub", + authService.authentication.accessToken + ); }); - ctrl.options = options; - } else { - // ctrl.options = options.filter( - // (m) => m[belongTo] == ctrl.model[belongTo] - // ); - $rootScope.$watch( - () => { - return ctrl.model[belongTo]; - }, - async function (newVal, oldVal) { - if (newVal != oldVal) { - if (!ctrl.allOptions) { - ctrl.allOptions = await apiService.getApiResult({ - url: endpoint, - }); - } - ctrl.options = ctrl.allOptions.filter( - (m) => m[belongTo] == ctrl.model[belongTo] - ); + } + } + ); + }; + $("button").on("click", function () { + var text = $("#message").val(); + var hnow = new Date().getHours(); + var mnow = new Date().getMinutes(); + mnow = mnow < 10 ? "0" + mnow : mnow; + var d = hnow + ":" + mnow; + + if (text.length > 0) { + $("#message").css("border", "1px solid #f4f5f9"); + $("#conversation").append( + "
  • You
    " + + text + + "
    " + + d + + "
  • " + ); + $("#message").val(""); + $(".widget-conversation").scrollTop( + $("ul li").last().position().top + $("ul li").last().height() + ); + } else { + $("#message").css("border", "1px solid #eb9f9f"); + $("#message").animate({ opacity: "0.1" }, "slow"); + $("#message").animate({ opacity: "1" }, "slow"); + $("#message").animate({ opacity: "0.1" }, "slow"); + $("#message").animate({ opacity: "1" }, "slow"); + } + }); + }; + $scope.toggle = function () { + $scope.isHide = !$scope.isHide; + }; + $scope.toggleContact = function () { + $scope.hideContact = !$scope.hideContact; + }; + $scope.sendMessage = function () { + if ($scope.user.loggedIn) { + $scope.request.data = $scope.message; + $scope.sendMessage(); + $scope.message.content = ""; + } + }; + $scope.receiveMessage = function (msg) { + //$scope.responses.splice(0, 0, msg); + switch (msg.title) { + case "MemberList": + $scope.members = msg.data; + $scope.$apply(); + break; + case "NewMember": + $scope.newMember(msg.data); + $(".widget-conversation").scrollTop = $( + ".widget-conversation" + )[0].scrollHeight; + break; + + case "NewMessage": + $scope.newMessage(msg); + break; + case "ConnectSuccess": + $scope.user.loggedIn = true; + $scope.initList(msg.data); + $scope.$apply(); + break; + + case "MemberOffline": + $scope.removeMember(msg.data); + break; + } + }; + $scope.newMember = function (member) { + var index = $scope.members.findIndex((x) => x.id === member.id); + if (index < 0) { + $scope.members.splice(0, 0, member); + } + $scope.$apply(); + }; + + $scope.initList = function (data) { + data.forEach((member) => { + var index = $scope.members.findIndex((x) => x.id === member.id); + if (index < 0) { + $scope.members.splice(0, 0, member); + } + }); + + $scope.$apply(); + }; + + $scope.removeMember = function (memberId) { + var index = $scope.members.findIndex((x) => x.id === memberId); + if (index >= 0) { + $scope.members.splice(index, 1); + } + $scope.$apply(); + }; + + $scope.newMessage = function (msg) { + $scope.messages.push(msg); + $scope.$apply(); + var objDiv = document.getElementsByClassName("widget-conversation")[0]; + objDiv.scrollTop = objDiv.scrollHeight + 20; + }; + }, +]); + +sharedComponents.component("messenger", { + templateUrl: "/mix-app/views/app-shared/components/messenger/index.html", + controller: "MessengerController", + bindings: { + message: "=", + }, +}); + +sharedComponents.component("messengerPrivate", { + templateUrl: + "/mix-app/views/app-shared/components/messenger-private/index.html", + controller: "MessengerController", + bindings: { + message: "=", + connectionId: "=", + }, +}); + +sharedComponents.component("mixColumnEditor", { + templateUrl: + "/mix-app/views/app-shared/components/mix-column-editor/view.html", + bindings: { + model: "=", + column: "=", + intParentId: "=?", + guidParentId: "=?", + isShowTitle: "=?", + inputClass: "=?", + createUrl: "=?", + updateUrl: "=?", + backUrl: "=?", + level: "=?", + }, + controller: [ + "$rootScope", + "$scope", + "$location", + "$routeParams", + "ngAppSettings", + "$filter", + "ApiService", + function ( + $rootScope, + $scope, + $location, + $routeParams, + ngAppSettings, + $filter, + apiService + ) { + var ctrl = this; + ctrl.jsonObj = null; + ctrl.mediaFile = {}; + ctrl.icons = ngAppSettings.icons; + ctrl.previousValue = null; + ctrl.translate = (keyword, isWrap, defaultText) => { + return $rootScope.translate(keyword, isWrap, defaultText); + }; + + ctrl.refData = null; + ctrl.defaultDataModel = null; + + ctrl.refDataModel = { + id: null, + data: null, + }; + + ctrl.dataTypes = $rootScope.globalSettings.dataTypes; + ctrl.previousId = null; + ctrl.options = []; + ctrl.$onInit = async function () { + ctrl.column.systemName = ctrl.toCamelCase(ctrl.column.systemName); + ctrl.editor = ctrl.column.columnConfigurations.editor + ? ctrl.column.columnConfigurations.editor.toLowerCase() + : ctrl.column.dataType.toLowerCase(); + if (!ctrl.createUrl && ctrl.model && ctrl.column.referenceId) { + ctrl.buildCreateUrl(); + } + if (!ctrl.updateUrl) { + ctrl.updateUrl = "/admin/mix-database-data/details"; + } + if (ctrl.model) { + if ($routeParams[ctrl.column.systemName]) { + ctrl.model[ctrl.column.systemName] = + $routeParams[ctrl.column.systemName]; + } + if ( + ctrl.column.dataType == "Integer" && + ctrl.model[ctrl.column.systemName] + ) { + ctrl.model[ctrl.column.systemName] = parseInt( + ctrl.model[ctrl.column.systemName] + ); + } + if (ctrl.column.isSelect) { + if (ctrl.column.columnConfigurations.optionsConfigurationName) { + // Load options from system configutation by name if exist else load options from column configurations + // load options if not belong to other column value + let belongTo = ctrl.column.columnConfigurations.belongTo; + let endpoint = + ctrl.column.columnConfigurations.optionsConfigurationName; + if (!belongTo) { + let options = await apiService.getApiResult({ + url: endpoint, + }); + ctrl.options = options; + } else { + // ctrl.options = options.filter( + // (m) => m[belongTo] == ctrl.model[belongTo] + // ); + $rootScope.$watch( + () => { + return ctrl.model[belongTo]; + }, + async function (newVal, oldVal) { + if (newVal != oldVal) { + if (!ctrl.allOptions) { + ctrl.allOptions = await apiService.getApiResult({ + url: endpoint, + }); + } + ctrl.options = ctrl.allOptions.filter( + (m) => m[belongTo] == ctrl.model[belongTo] + ); + } } - } - ); + ); + } + } else { + ctrl.options = ctrl.column.options; } - } else { - ctrl.options = ctrl.column.options; } } @@ -6572,7 +6717,7 @@ sharedComponents.component("mixColumnEditor", { ctrl.initData = async function () { setTimeout(() => { ctrl.initDefaultValue(); - switch (ctrl.column.columnConfigurations.editor.toLowerCase()) { + switch (ctrl.column.columnConfigurations.editor?.toLowerCase()) { case "datetime": case "date": case "time": @@ -6671,7 +6816,7 @@ sharedComponents.component("mixColumnEditor", { ctrl.model[ctrl.column.systemName] == null || ctrl.model[ctrl.column.systemName] == undefined ) { - switch (ctrl.column.columnConfigurations.editor.toLowerCase()) { + switch (ctrl.column.columnConfigurations.editor?.toLowerCase()) { case "datetime": case "date": case "time": @@ -6724,7 +6869,7 @@ sharedComponents.component("mixColumnEditor", { // $scope.$apply(); }; ctrl.updateValue = function () { - switch (ctrl.column.columnConfigurations.editor.toLowerCase()) { + switch (ctrl.column.columnConfigurations.editor?.toLowerCase()) { case "datetime": if (ctrl.dateObj) { ctrl.model[ctrl.column.systemName] = ctrl.dateObj.toISOString(); @@ -6752,16 +6897,6 @@ sharedComponents.component("mixColumnEditor", { ], }); -sharedComponents.component("messengerPrivate", { - templateUrl: - "/mix-app/views/app-shared/components/messenger-private/index.html", - controller: "MessengerController", - bindings: { - message: "=", - connectionId: "=", - }, -}); - sharedComponents.component("mixColumnPreview", { templateUrl: "/mix-app/views/app-shared/components/mix-column-preview/view.html", @@ -6953,7 +7088,7 @@ appShared.controller("MixDatabaseDataClientController", [ }; $scope.mixConfigurations = $rootScope.globalSettings; $scope.canDrag = - $scope.request.orderBy !== "Priority" || $scope.request.direction !== "0"; + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; $scope.init = async function () { $scope.mixDatabaseId = $routeParams.mixDatabaseId; $scope.mixDatabaseName = $routeParams.mixDatabaseName; @@ -7005,7 +7140,7 @@ appShared.controller("MixDatabaseDataClientController", [ parentId ); $scope.canDrag = - $scope.request.orderBy !== "Priority" || + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; if (resp && resp.success) { window.top.location = resp.data; @@ -7041,7 +7176,7 @@ appShared.controller("MixDatabaseDataClientController", [ parentId ); $scope.canDrag = - $scope.request.orderBy !== "Priority" || + $scope.request.sortBy !== "Priority" || $scope.request.direction !== "0"; if (response) { $scope.data = response; @@ -7134,6 +7269,30 @@ appShared.controller("MixDatabaseDataClientController", [ }, ]); +sharedComponents.component("mixDatabaseDataValuePreview", { + templateUrl: + "/mix-app/views/app-shared/components/mix-database-data-value-preview/view.html", + controller: [ + "$rootScope", + function ($rootScope) { + var ctrl = this; + ctrl.$onInit = function () { + if (ctrl.data.column && ctrl.data.column.isEncrypt) { + var encryptedData = { + key: ctrl.data.encryptKey, + data: ctrl.data.encryptValue, + }; + ctrl.data.stringValue = $rootScope.decrypt(encryptedData); + } + }; + }, + ], + bindings: { + data: "=", + width: "=", + }, +}); + sharedComponents.component("mixDatabaseFormWeb", { templateUrl: "/mix-app/views/app-shared/components/mix-database-form-web/view.html", @@ -7287,36 +7446,12 @@ sharedComponents.component("mixDateEditor", { ], }); -sharedComponents.component("mixDatabaseDataValuePreview", { - templateUrl: - "/mix-app/views/app-shared/components/mix-database-data-value-preview/view.html", +sharedComponents.component("mixLoader", { + templateUrl: "/mix-app/views/app-shared/components/mix-loader/view.html", controller: [ "$rootScope", - function ($rootScope) { - var ctrl = this; - ctrl.$onInit = function () { - if (ctrl.data.column && ctrl.data.column.isEncrypt) { - var encryptedData = { - key: ctrl.data.encryptKey, - data: ctrl.data.encryptValue, - }; - ctrl.data.stringValue = $rootScope.decrypt(encryptedData); - } - }; - }, - ], - bindings: { - data: "=", - width: "=", - }, -}); - -sharedComponents.component("mixLoader", { - templateUrl: "/mix-app/views/app-shared/components/mix-loader/view.html", - controller: [ - "$rootScope", - "$location", - function ($rootScope, $location) { + "$location", + function ($rootScope, $location) { var ctrl = this; ctrl.imageDataArray = []; ctrl.canvasCount = 10; @@ -7552,6 +7687,28 @@ sharedComponents.component("mixModuleDataTable", { }, }); +sharedComponents.component("mixSelect", { + templateUrl: "/mix-app/views/app-shared/components/mix-select/view.html", + bindings: { + options: "=", + model: "=", + allowNull: "=?", + callback: "&?", + }, + controller: [ + "$rootScope", + "$scope", + function PortalTemplateController($rootScope, $scope) { + var ctrl = this; + ctrl.onSelect = function () { + if (ctrl.callback) { + ctrl.callback({ type: ctrl.model }); + } + }; + }, + ], +}); + "use strict"; appShared.controller("ModalPostController", [ "$scope", @@ -7622,27 +7779,30 @@ sharedComponents.component("modalPosts", { }, }); -sharedComponents.component("mixSelect", { - templateUrl: "/mix-app/views/app-shared/components/mix-select/view.html", - bindings: { - options: "=", - model: "=", - allowNull: "=?", - callback: "&?", - }, - controller: [ - "$rootScope", - "$scope", - function PortalTemplateController($rootScope, $scope) { - var ctrl = this; - ctrl.onSelect = function () { - if (ctrl.callback) { - ctrl.callback({ type: ctrl.model }); - } - }; - }, - ], -}); +// sharedComponents.component('modalConfirm', { +// templateUrl: '/mix-app/views/app-shared/components/modal-confirm/modal-confirm.html', +// controller: ModalConfirmController, +// bindings: { +// message: '=' +// } +// }); +function ModalConfirmController($rootScope, $scope, $mdDialog, message) { + $scope.message = message; + $scope.executeFunctionByName = async function (functionName, args, context) { + var result = await $rootScope.executeFunctionByName( + functionName, + args, + context + ); + if (result) { + $scope.$apply(); + } + $mdDialog.hide(); + }; + $scope.closeDialog = function () { + $mdDialog.hide(); + }; +} sharedComponents.controller( "ModalCroppieController", @@ -7723,7 +7883,7 @@ sharedComponents.controller( // ctrl.media.fileFolder = ctrl.folder || "Media"; // ctrl.media.fileName = ctrl.media.mediaFile.fileName; // ctrl.media.extension = ctrl.media.mediaFile.extension; - ctrl.media.mediaFile.fileStream = ctrl.cropped.image; + ctrl.media.mediaFile.fileBase64 = ctrl.cropped.image; ctrl.media.mediaFile.folderName = ctrl.folder || "Media"; var result = await mediaService.saveFileStream(ctrl.media.mediaFile); if (result.success) { @@ -7753,8 +7913,8 @@ sharedComponents.controller( } $scope.$apply(function () { - ctrl.postedFile.fileStream = ctrl.canvas.toDataURL(); //ctx.getImageData(0, 0, 300, 350); - ctrl.imgUrl = ctrl.postedFile.fileStream.replace( + ctrl.postedFile.fileBase64 = ctrl.canvas.toDataURL(); //ctx.getImageData(0, 0, 300, 350); + ctrl.imgUrl = ctrl.postedFile.fileBase64.replace( "image/png", "image/octet-stream" ); @@ -7842,7 +8002,7 @@ sharedComponents.controller( ctrl.media.mediaFile.extension = file.name.substring( file.name.lastIndexOf(".") ); - // ctrl.postedFile.fileStream = reader.result; + // ctrl.postedFile.fileBase64 = reader.result; } var image = new Image(); image.src = reader.result; @@ -7898,130 +8058,6 @@ sharedComponents.controller( } ); -// sharedComponents.component('modalConfirm', { -// templateUrl: '/mix-app/views/app-shared/components/modal-confirm/modal-confirm.html', -// controller: ModalConfirmController, -// bindings: { -// message: '=' -// } -// }); -function ModalConfirmController($rootScope, $scope, $mdDialog, message) { - $scope.message = message; - $scope.executeFunctionByName = async function (functionName, args, context) { - var result = await $rootScope.executeFunctionByName( - functionName, - args, - context - ); - if (result) { - $scope.$apply(); - } - $mdDialog.hide(); - }; - $scope.closeDialog = function () { - $mdDialog.hide(); - }; -} - -sharedComponents.component("moduleDataPreview", { - templateUrl: - "/mix-app/views/app-shared/components/module-data-preview/module-data-preview.html", - controller: [ - "$rootScope", - function ($rootScope) { - var ctrl = this; - - ctrl.translate = $rootScope.translate; - ctrl.$onInit = () => { - if (!ctrl.datatype) { - ctrl.datatype = ctrl.data.dataType; - } - }; - }, - ], - bindings: { - data: "=", - datatype: "=?", - width: "=", - header: "=", - }, -}); - -sharedComponents.component("moduleFormEditor", { - templateUrl: - "/mix-app/views/app-shared/components/module-form-editor/view.html", - bindings: { - data: "=", - datatype: "=?", - column: "=?", - inputClass: "=", - isShowTitle: "=", - columnTitle: "=", - }, - controller: [ - "$rootScope", - "$scope", - "$filter", - "ngAppSettings", - function ($rootScope, $scope, $filter, ngAppSettings) { - var ctrl = this; - ctrl.icons = ngAppSettings.icons; - this.dataTypes = ngAppSettings.dataTypes; - ctrl.$onInit = function () { - ctrl.dataType = ctrl.datatype - ? ctrl.datatype.toLowerCase() - : ctrl.data.dataType.toLowerCase(); - ctrl.obj = null; - switch (ctrl.dataType) { - case "datetime": - case "date": - case "time": - if (ctrl.data.value) { - ctrl.obj = new Date(ctrl.data.value); - } - break; - case "boolean": - ctrl.obj = String(ctrl.data.value) == "true"; - break; - default: - if (ctrl.column && !ctrl.data.value) { - ctrl.data.value = ctrl.column.defaultValue; - ctrl.obj = ctrl.column.defaultValue; - } - break; - } - }; - ctrl.updateValue = function () { - switch (ctrl.dataType) { - case "datetime": - if (ctrl.obj) { - ctrl.data.value = ctrl.obj.toLocaleString(); - } - break; - case "date": - if (ctrl.obj) { - ctrl.data.value = ctrl.obj.toLocaleDateString(); - } - break; - case "time": - if (ctrl.obj) { - ctrl.data.value = ctrl.obj.toLocaleTimeString("en-GB"); - } - break; - - case "boolean": - ctrl.data.value = ctrl.obj.toString().toLowerCase(); - break; - default: - ctrl.data.value = ctrl.obj; - break; - } - console.log(ctrl.data.value); - }; - }, - ], -}); - "use strict"; appShared.controller("SharedModuleDataController", [ "$scope", @@ -8046,7 +8082,7 @@ appShared.controller("SharedModuleDataController", [ pageSize: "10", pageIndex: 0, status: "Published", - orderBy: "CreatedDateTime", + sortBy: "Id", direction: "Desc", fromDate: null, toDate: null, @@ -8319,6 +8355,30 @@ appShared.factory("SharedModuleDataService", [ }, ]); +sharedComponents.component("moduleDataPreview", { + templateUrl: + "/mix-app/views/app-shared/components/module-data-preview/module-data-preview.html", + controller: [ + "$rootScope", + function ($rootScope) { + var ctrl = this; + + ctrl.translate = $rootScope.translate; + ctrl.$onInit = () => { + if (!ctrl.datatype) { + ctrl.datatype = ctrl.data.dataType; + } + }; + }, + ], + bindings: { + data: "=", + datatype: "=?", + width: "=", + header: "=", + }, +}); + sharedComponents.component("moduleForm", { templateUrl: "/mix-app/views/app-shared/components/module-form/view.html", bindings: { @@ -8595,17 +8655,92 @@ sharedComponents.component("modulePreview", { }, }); -sharedComponents.component("mixPaging", { - templateUrl: "/mix-app/views/app-shared/components/paging/paging.html", +sharedComponents.component("moduleFormEditor", { + templateUrl: + "/mix-app/views/app-shared/components/module-form-editor/view.html", + bindings: { + data: "=", + datatype: "=?", + column: "=?", + inputClass: "=", + isShowTitle: "=", + columnTitle: "=", + }, controller: [ "$rootScope", - function ($rootScope) { + "$scope", + "$filter", + "ngAppSettings", + function ($rootScope, $scope, $filter, ngAppSettings) { var ctrl = this; - ctrl.loadData = function (index) { - ctrl.pagingAction({ pageIndex: index }); - }; - ctrl.range = $rootScope.range; - }, + ctrl.icons = ngAppSettings.icons; + this.dataTypes = ngAppSettings.dataTypes; + ctrl.$onInit = function () { + ctrl.dataType = ctrl.datatype + ? ctrl.datatype.toLowerCase() + : ctrl.data.dataType.toLowerCase(); + ctrl.obj = null; + switch (ctrl.dataType) { + case "datetime": + case "date": + case "time": + if (ctrl.data.value) { + ctrl.obj = new Date(ctrl.data.value); + } + break; + case "boolean": + ctrl.obj = String(ctrl.data.value) == "true"; + break; + default: + if (ctrl.column && !ctrl.data.value) { + ctrl.data.value = ctrl.column.defaultValue; + ctrl.obj = ctrl.column.defaultValue; + } + break; + } + }; + ctrl.updateValue = function () { + switch (ctrl.dataType) { + case "datetime": + if (ctrl.obj) { + ctrl.data.value = ctrl.obj.toLocaleString(); + } + break; + case "date": + if (ctrl.obj) { + ctrl.data.value = ctrl.obj.toLocaleDateString(); + } + break; + case "time": + if (ctrl.obj) { + ctrl.data.value = ctrl.obj.toLocaleTimeString("en-GB"); + } + break; + + case "boolean": + ctrl.data.value = ctrl.obj.toString().toLowerCase(); + break; + default: + ctrl.data.value = ctrl.obj; + break; + } + console.log(ctrl.data.value); + }; + }, + ], +}); + +sharedComponents.component("mixPaging", { + templateUrl: "/mix-app/views/app-shared/components/paging/paging.html", + controller: [ + "$rootScope", + function ($rootScope) { + var ctrl = this; + ctrl.loadData = function (index) { + ctrl.pagingAction({ pageIndex: index }); + }; + ctrl.range = $rootScope.range; + }, ], bindings: { data: "=", @@ -8619,51 +8754,6 @@ sharedComponents.component("mixPaging", { }, }); -"use trick"; -sharedComponents.directive("pill", function () { - return { - require: "^pills", - restrict: "E", - transclude: true, - scope: { header: "@", id: "@", icon: "@" }, - link: function (scope, element, attrs, tabsController) { - tabsController.addPane(scope); - }, - template: - '
    ' + - "
    ", - replace: true, - }; -}); - -sharedComponents.directive("pills", function () { - return { - restrict: "E", - transclude: true, - scope: { - selectCallback: "&", - }, - controller: function ($scope, $element) { - var panes = ($scope.panes = []); - - $scope.select = function (pane) { - angular.forEach(panes, function (pane) { - pane.selected = false; - }); - pane.selected = true; - this.selectCallback({ pane: pane }); - }; - - this.addPane = function (pane) { - if (panes.length === 0) $scope.select(pane); - panes.push(pane); - }; - }, - templateUrl: "/mix-app/views/app-shared/components/pills/pills.html", - replace: true, - }; -}); - sharedComponents.component("payPal", { templateUrl: "/mix-app/views/app-shared/components/pay-pal/view.html", bindings: { @@ -8747,6 +8837,51 @@ sharedComponents.component("payPal", { ], }); +"use trick"; +sharedComponents.directive("pill", function () { + return { + require: "^pills", + restrict: "E", + transclude: true, + scope: { header: "@", id: "@", icon: "@" }, + link: function (scope, element, attrs, tabsController) { + tabsController.addPane(scope); + }, + template: + '
    ' + + "
    ", + replace: true, + }; +}); + +sharedComponents.directive("pills", function () { + return { + restrict: "E", + transclude: true, + scope: { + selectCallback: "&", + }, + controller: function ($scope, $element) { + var panes = ($scope.panes = []); + + $scope.select = function (pane) { + angular.forEach(panes, function (pane) { + pane.selected = false; + }); + pane.selected = true; + this.selectCallback({ pane: pane }); + }; + + this.addPane = function (pane) { + if (panes.length === 0) $scope.select(pane); + panes.push(pane); + }; + }, + templateUrl: "/mix-app/views/app-shared/components/pills/pills.html", + replace: true, + }; +}); + sharedComponents.component("portalSearch", { templateUrl: "portal-search.html", bindings: { @@ -8794,37 +8929,28 @@ sharedComponents.component("previewImage", { }, }); -sharedComponents.component("qrCode", { - templateUrl: "/mix-app/views/app-shared/components/qr-code/view.html", +sharedComponents.component("previewPopup", { + templateUrl: + "/mix-app/views/app-shared/components/preview-popup/preview-popup.html", controller: [ - "$rootScope", - "$element", - function ($rootScope, $element) { + "$scope", + "$location", + function ($scope, $location) { var ctrl = this; - ctrl.$onInit = function () { - setTimeout(() => { - if (ctrl.model) { - ctrl.generate(); - } - }, 200); - }; - ctrl.initOutput = function () { - ctrl.element = $element[0].querySelector(".qr-output"); - ctrl.generate(); - }; - ctrl.generate = function () { - $(ctrl.element).empty(); - $(ctrl.element).qrcode(ctrl.model); + $("#dlg-preview-popup").on("hidden.bs.modal", function (e) { + ctrl.previewObject.data = null; + $scope.$apply(); + }); }; - ctrl.download = function () { - $rootScope.downloadCanvasImage(ctrl.element.querySelector("canvas")); + ctrl.goToLink = async function (link) { + $("#dlg-preview-popup").modal("hide"); + $location.path(link); }; }, ], bindings: { - model: "=", - viewOnly: "=?", + previewObject: "=", }, }); @@ -8926,28 +9052,37 @@ sharedComponents.component("quillEditor", { }, }); -sharedComponents.component("previewPopup", { - templateUrl: - "/mix-app/views/app-shared/components/preview-popup/preview-popup.html", +sharedComponents.component("qrCode", { + templateUrl: "/mix-app/views/app-shared/components/qr-code/view.html", controller: [ - "$scope", - "$location", - function ($scope, $location) { + "$rootScope", + "$element", + function ($rootScope, $element) { var ctrl = this; + ctrl.$onInit = function () { - $("#dlg-preview-popup").on("hidden.bs.modal", function (e) { - ctrl.previewObject.data = null; - $scope.$apply(); - }); + setTimeout(() => { + if (ctrl.model) { + ctrl.generate(); + } + }, 200); }; - ctrl.goToLink = async function (link) { - $("#dlg-preview-popup").modal("hide"); - $location.path(link); + ctrl.initOutput = function () { + ctrl.element = $element[0].querySelector(".qr-output"); + ctrl.generate(); + }; + ctrl.generate = function () { + $(ctrl.element).empty(); + $(ctrl.element).qrcode(ctrl.model); + }; + ctrl.download = function () { + $rootScope.downloadCanvasImage(ctrl.element.querySelector("canvas")); }; }, ], bindings: { - previewObject: "=", + model: "=", + viewOnly: "=?", }, }); @@ -9128,6 +9263,15 @@ sharedComponents.controller("ShoppingCartController", [ }, ]); +sharedComponents.component("codeEditor", { + templateUrl: "codeEditor.html", + bindings: { + product: "=", + onDelete: "&", + onUpdate: "&", + }, +}); + sharedComponents.component("serviceHub", { templateUrl: "/mix-app/views/app-shared/components/service-hub/view.html", bindings: { @@ -9312,17 +9456,66 @@ sharedComponents.component("serviceHub", { ], }); -sharedComponents.component("codeEditor", { - templateUrl: "codeEditor.html", +sharedComponents.component("starRating", { + templateUrl: + "/mix-app/views/app-shared/components/star-rating/star-rating.html", bindings: { - product: "=", - onDelete: "&", - onUpdate: "&", + ratingValue: "=", + max: "=?", // optional (default is 5) + onRatingSelect: "&?", + isReadonly: "=?", }, + controller: "StarRatingController", }); -sharedComponents.component("snowy", { - templateUrl: "/mix-app/views/app-shared/components/snowy/index.html", +appShared.controller("StarRatingController", [ + "$rootScope", + function ($rootScope) { + var ctrl = this; + ctrl.translate = function (keyword) { + return $rootScope.translate(keyword); + }; + ctrl.readonly = false; + ctrl.rateFunction = function (rating) { + console.log("Rating selected: " + rating); + }; + ctrl.init = function () { + ctrl.readonly = ctrl.isReadonly === "true"; + ctrl.stars = []; + ctrl.max = ctrl.max || 5; + for (var i = 0; i < ctrl.max; i++) { + ctrl.stars.push({ + filled: i < ctrl.ratingValue, + }); + } + }; + ctrl.toggle = function (index) { + if (ctrl.readonly === undefined || ctrl.readonly === false) { + ctrl.ratingValue = index + 1; + } + }; + ctrl.filled = function (index) { + return index < ctrl.ratingValue; + }; + }, +]); + +sharedComponents.component("statuses", { + templateUrl: "/mix-app/views/app-shared/components/statuses/statuses.html", + controller: [ + "$rootScope", + "ngAppSettings", + function ($rootScope, ngAppSettings) { + this.contentStatuses = ngAppSettings.contentStatuses; + }, + ], + bindings: { + status: "=", + }, +}); + +sharedComponents.component("snowy", { + templateUrl: "/mix-app/views/app-shared/components/snowy/index.html", controller: [ "$scope", function ($scope) { @@ -9443,50 +9636,6 @@ sharedComponents.component("snowy", { bindings: {}, }); -sharedComponents.component("starRating", { - templateUrl: - "/mix-app/views/app-shared/components/star-rating/star-rating.html", - bindings: { - ratingValue: "=", - max: "=?", // optional (default is 5) - onRatingSelect: "&?", - isReadonly: "=?", - }, - controller: "StarRatingController", -}); - -appShared.controller("StarRatingController", [ - "$rootScope", - function ($rootScope) { - var ctrl = this; - ctrl.translate = function (keyword) { - return $rootScope.translate(keyword); - }; - ctrl.readonly = false; - ctrl.rateFunction = function (rating) { - console.log("Rating selected: " + rating); - }; - ctrl.init = function () { - ctrl.readonly = ctrl.isReadonly === "true"; - ctrl.stars = []; - ctrl.max = ctrl.max || 5; - for (var i = 0; i < ctrl.max; i++) { - ctrl.stars.push({ - filled: i < ctrl.ratingValue, - }); - } - }; - ctrl.toggle = function (index) { - if (ctrl.readonly === undefined || ctrl.readonly === false) { - ctrl.ratingValue = index + 1; - } - }; - ctrl.filled = function (index) { - return index < ctrl.ratingValue; - }; - }, -]); - sharedComponents.component("mixStore", { templateUrl: "/mix-app/views/app-shared/components/store/view.html", bindings: { @@ -9533,7 +9682,7 @@ sharedComponents.component("mixStore", { ctrl.joinRoom("Theme"); }; ctrl.themeRequest = angular.copy(ngAppSettings.request); - ctrl.themeRequest.orderBy = "createdDatetime"; + ctrl.themeRequest.sortBy = "createdDatetime"; ctrl.themeRequest.mixDatabaseName = "mixcoreTheme"; ctrl.themeRequest.queries = [ { fieldName: "mixcoreVersion", value: "2.0.1" }, @@ -9672,20 +9821,6 @@ sharedComponents.component("mixStore", { ], }); -sharedComponents.component("statuses", { - templateUrl: "/mix-app/views/app-shared/components/statuses/statuses.html", - controller: [ - "$rootScope", - "ngAppSettings", - function ($rootScope, ngAppSettings) { - this.contentStatuses = ngAppSettings.contentStatuses; - }, - ], - bindings: { - status: "=", - }, -}); - "use trick"; sharedComponents.directive("pane", function () { return { @@ -9732,12 +9867,12 @@ sharedComponents.directive("tabs", function () { }); "use trick"; -sharedComponents.directive("paneV", function () { +sharedComponents.directive("paneH", function () { return { - require: "^tabs-v", + require: "^tabs-h", restrict: "E", transclude: true, - scope: { header: "@", id: "@", icon: "@", class: "@" }, + scope: { header: "@", id: "@", icon: "@" }, link: function (scope, element, attrs, tabsController) { tabsController.addPane(scope); }, @@ -9748,7 +9883,7 @@ sharedComponents.directive("paneV", function () { }; }); -sharedComponents.directive("tabsV", function () { +sharedComponents.directive("tabsH", function () { return { restrict: "E", transclude: true, @@ -9771,31 +9906,19 @@ sharedComponents.directive("tabsV", function () { panes.push(pane); }; }, - templateUrl: "/mix-app/views/app-shared/components/tabs-verticle/tabs.html", + templateUrl: + "/mix-app/views/app-shared/components/tabs-horizontal/tabs.html", replace: true, }; }); -sharedComponents.component("tags", { - templateUrl: "/mix-app/views/app-shared/components/tags/tags.html", - controller: [ - "$scope", - function ($scope) { - var ctrl = this; - }, - ], - bindings: { - input: "=", - }, -}); - "use trick"; -sharedComponents.directive("paneH", function () { +sharedComponents.directive("paneV", function () { return { - require: "^tabs-h", + require: "^tabs-v", restrict: "E", transclude: true, - scope: { header: "@", id: "@", icon: "@" }, + scope: { header: "@", id: "@", icon: "@", class: "@" }, link: function (scope, element, attrs, tabsController) { tabsController.addPane(scope); }, @@ -9806,7 +9929,7 @@ sharedComponents.directive("paneH", function () { }; }); -sharedComponents.directive("tabsH", function () { +sharedComponents.directive("tabsV", function () { return { restrict: "E", transclude: true, @@ -9829,12 +9952,24 @@ sharedComponents.directive("tabsH", function () { panes.push(pane); }; }, - templateUrl: - "/mix-app/views/app-shared/components/tabs-horizontal/tabs.html", + templateUrl: "/mix-app/views/app-shared/components/tabs-verticle/tabs.html", replace: true, }; }); +sharedComponents.component("tags", { + templateUrl: "/mix-app/views/app-shared/components/tags/tags.html", + controller: [ + "$scope", + function ($scope) { + var ctrl = this; + }, + ], + bindings: { + input: "=", + }, +}); + sharedComponents.component("tagsView", { templateUrl: "/mix-app/views/app-shared/components/tags-view/view.html", controller: [ @@ -9865,277 +10000,45 @@ sharedComponents.component("tagsView", { }, }); -sharedComponents.component("uploadCroppie", { - templateUrl: - "/mix-app/views/app-shared/components/upload-croppie/view.html?v=1", +sharedComponents.component("trumbowyg", { + templateUrl: "/mix-app/views/app-shared/components/trumbowyg/trumbowyg.html", bindings: { - header: "=", - description: "=", - src: "=", - srcUrl: "=", - h: "=?", - w: "=?", - isCrop: "=?", - frameUrl: "=?", - type: "=", - folder: "=", - auto: "=", - onDelete: "&", - onUpdate: "&", + options: " 0) { - const file = files[0]; - ctrl.mediaFile.folder = ctrl.folder ? ctrl.folder : "Media"; - ctrl.mediaFile.title = ctrl.title ? ctrl.title : ""; - ctrl.mediaFile.description = ctrl.description ? ctrl.description : ""; - ctrl.mediaFile.file = file; - ctrl.getBase64(file); - // if (file.size < 100000) { - // var msg = "Please choose a better photo (larger than 100kb)!"; - // $rootScope.showConfirm(ctrl, null, [], null, null, msg); - // } else { - // } - } - }; - - ctrl.getBase64 = function (file) { - if (file !== null) { - $rootScope.isBusy = true; - var reader = new FileReader(); - reader.readAsDataURL(file); - reader.onload = function () { - ctrl.cropped.source = null; - var index = reader.result.indexOf(",") + 1; - var base64 = reader.result.substring(index); - if (ctrl.postedFile) { - ctrl.postedFile.fileName = file.name.substring( - 0, - file.name.lastIndexOf(".") - ); - ctrl.postedFile.extension = file.name.substring( - file.name.lastIndexOf(".") - ); - // ctrl.postedFile.fileStream = reader.result; - } - var image = new Image(); - image.src = reader.result; - - image.onload = function () { - // access image size here - ctrl.loadImageSize(this.width, this.height); - }; - - ctrl.cropped.source = reader.result; - $rootScope.isBusy = false; - $scope.$apply(); - }; - reader.onerror = function (error) { - $rootScope.isBusy = false; - $rootScope.showErrors([error]); - }; - } else { - return null; - } - }; - ctrl.loadImageSize = function (w, h) { - var rto = w / h; - // ctrl.options.boundary.width = ctrl.options.boundary.height * rto; - ctrl.options.render.width = ctrl.options.render.height * rto; - if (!ctrl.rto) { - ctrl.rto = rto; - ctrl.w = w; - ctrl.h = h; - ctrl.loadViewport(); - } - $scope.$apply(); - ctrl.image_placeholder = `https://via.placeholder.com/${ctrl.options.render.width}x${ctrl.options.render.height}.png`; - }; - ctrl.loadViewport = function () { - if (ctrl.w && ctrl.h) { - ctrl.rto = ctrl.w / ctrl.h; - ctrl.options.viewport.height = ctrl.h; - ctrl.options.viewport.width = ctrl.options.viewport.height * ctrl.rto; - } - // ctrl.image_placeholder = "/mix-app/assets/img/image_placeholder.jpg"; // `https://via.placeholder.com/${ctrl.options.render.width}x${ctrl.options.render.height}.png`; - }; - }, - ], -}); - -sharedComponents.component("trumbowyg", { - templateUrl: "/mix-app/views/app-shared/components/trumbowyg/trumbowyg.html", - bindings: { - options: " 0) { + const file = files[0]; + ctrl.mediaFile.folder = ctrl.folder ? ctrl.folder : "Media"; + ctrl.mediaFile.title = ctrl.title ? ctrl.title : ""; + ctrl.mediaFile.description = ctrl.description ? ctrl.description : ""; + ctrl.mediaFile.file = file; + ctrl.getBase64(file); + // if (file.size < 100000) { + // var msg = "Please choose a better photo (larger than 100kb)!"; + // $rootScope.showConfirm(ctrl, null, [], null, null, msg); + // } else { + // } + } + }; + + ctrl.getBase64 = function (file) { + if (file !== null) { + $rootScope.isBusy = true; + var reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = function () { + ctrl.cropped.source = null; + var index = reader.result.indexOf(",") + 1; + var base64 = reader.result.substring(index); + if (ctrl.postedFile) { + ctrl.postedFile.fileName = file.name.substring( + 0, + file.name.lastIndexOf(".") + ); + ctrl.postedFile.extension = file.name.substring( + file.name.lastIndexOf(".") + ); + // ctrl.postedFile.fileBase64 = reader.result; + } + var image = new Image(); + image.src = reader.result; + + image.onload = function () { + // access image size here + ctrl.loadImageSize(this.width, this.height); + }; + + ctrl.cropped.source = reader.result; + $rootScope.isBusy = false; + $scope.$apply(); + }; + reader.onerror = function (error) { + $rootScope.isBusy = false; + $rootScope.showErrors([error]); + }; + } else { + return null; + } + }; + ctrl.loadImageSize = function (w, h) { + var rto = w / h; + // ctrl.options.boundary.width = ctrl.options.boundary.height * rto; + ctrl.options.render.width = ctrl.options.render.height * rto; + if (!ctrl.rto) { + ctrl.rto = rto; + ctrl.w = w; + ctrl.h = h; + ctrl.loadViewport(); + } + $scope.$apply(); + ctrl.image_placeholder = `https://via.placeholder.com/${ctrl.options.render.width}x${ctrl.options.render.height}.png`; + }; + ctrl.loadViewport = function () { + if (ctrl.w && ctrl.h) { + ctrl.rto = ctrl.w / ctrl.h; + ctrl.options.viewport.height = ctrl.h; + ctrl.options.viewport.width = ctrl.options.viewport.height * ctrl.rto; + } + // ctrl.image_placeholder = "/mix-app/assets/img/image_placeholder.jpg"; // `https://via.placeholder.com/${ctrl.options.render.width}x${ctrl.options.render.height}.png`; }; }, ], - bindings: { - code: "=", - hideInput: "=?", - }, }); "use strict"; @@ -10641,12 +10735,10 @@ sharedComponents.component("videoCall", { const option = document.createElement("option"); option.value = deviceInfo.deviceId; if (deviceInfo.kind === "audioinput") { - option.text = - deviceInfo.label || "microphone " + (ctrl.audioSelect.length + 1); + option.text = "microphone " + (ctrl.audioSelect.length + 1); ctrl.audioSelect.appendChild(option); } else if (deviceInfo.kind === "videoinput") { - option.text = - deviceInfo.label || "camera " + (ctrl.videoSelect.length + 1); + option.text = "camera " + (ctrl.videoSelect.length + 1); ctrl.videoSelect.appendChild(option); } else { console.log("Found another kind of device: ", deviceInfo); @@ -10689,6 +10781,47 @@ sharedComponents.component("videoCall", { }, }); +sharedComponents.component("youtubeEditor", { + templateUrl: + "/mix-app/views/app-shared/components/youtube-editor/youtube-editor.html", + controller: [ + "$rootScope", + "$scope", + "$sce", + function ($rootScope, $scope, $sce) { + var ctrl = this; + ctrl.isPlay = false; + ctrl.loadVideo = function () { + ctrl.isPlay = false; + ctrl.src = ""; + if (ctrl.code) { + ctrl.img = + "https://img.youtube.com/vi/" + ctrl.code + "/sddefault.jpg"; + } + }; + ctrl.playVideo = function () { + ctrl.isPlay = true; + ctrl.src = $sce.trustAsResourceUrl( + "https://www.youtube.com/embed/" + + ctrl.code + + "?rel=0&showinfo=0&autoplay=1" + ); + }; + ctrl.searchVideo = function () { + // search + $rootScope.preview( + "message", + "ToDo: Integrate youtube search (https://developers.google.com/youtube/v3/docs/search/list) \r\n PATH: portal-app/app/app-shared/components/youtube-editor/youtube-editor.js" + ); + }; + }, + ], + bindings: { + code: "=", + hideInput: "=?", + }, +}); + /*! * angular-loading-bar v0.9.0 * https://chieffancypants.github.io/angular-loading-bar @@ -11380,1201 +11513,294 @@ angular.module("bw.paging", []).directive("paging", function () { } }); -/*! ngTagsInput v3.2.0 License: MIT */ !(function () { - "use strict"; - var a = { - backspace: 8, - tab: 9, - enter: 13, - escape: 27, - space: 32, - up: 38, - down: 40, - left: 37, - right: 39, - delete: 46, - comma: 188, - }, - b = 9007199254740991, - c = ["text", "email", "url"], - d = angular.module("ngTagsInput", []); - d.directive("tagsInput", [ - "$timeout", - "$document", - "$window", - "$q", - "tagsInputConfig", - "tiUtil", - function (d, e, f, g, h, i) { - function j(a, b, c, d) { - var e, - f, - h, - j, - k = {}; - return ( - (e = function (b) { - return i.safeToString(b[a.displayProperty]); - }), - (f = function (b, c) { - b[a.displayProperty] = c; - }), - (h = function (b) { - var d = e(b), - f = - d && - d.length >= a.minLength && - d.length <= a.maxLength && - a.allowedTagsPattern.test(d) && - !i.findInObjectArray( - k.items, - b, - a.keyProperty || a.displayProperty - ); - return g.when(f && c({ $tag: b })).then(i.promisifyValue); - }), - (j = function (a) { - return g.when(d({ $tag: a })).then(i.promisifyValue); - }), - (k.items = []), - (k.addText = function (a) { - var b = {}; - return f(b, a), k.add(b); - }), - (k.add = function (c) { - var d = e(c); - return ( - a.replaceSpacesWithDashes && (d = i.replaceSpacesWithDashes(d)), - f(c, d), - h(c) - .then(function () { - k.items.push(c), b.trigger("tag-added", { $tag: c }); - }) - ["catch"](function () { - d && b.trigger("invalid-tag", { $tag: c }); - }) - ); - }), - (k.remove = function (a) { - var c = k.items[a]; - return j(c).then(function () { +!(function (t, e) { + "object" == typeof exports + ? (module.exports = exports = e()) + : "function" == typeof define && define.amd + ? define([], e) + : (t.CryptoJS = e()); +})(this, function () { + var h, + t, + e, + r, + i, + n, + f, + o, + s, + c, + a, + l, + d, + m, + x, + b, + H, + z, + A, + u, + p, + _, + v, + y, + g, + B, + w, + k, + S, + C, + D, + E, + R, + M, + F, + P, + W, + O, + I, + U, + K, + X, + L, + j, + N, + T, + q, + Z, + V, + G, + J, + $, + Q, + Y, + tt, + et, + rt, + it, + nt, + ot, + st, + ct, + at, + ht, + lt, + ft, + dt, + ut, + pt, + _t, + vt, + yt, + gt, + Bt, + wt, + kt, + St, + bt = + bt || + (function (l) { + var t; + if ( + ("undefined" != typeof window && window.crypto && (t = window.crypto), + !t && + "undefined" != typeof window && + window.msCrypto && + (t = window.msCrypto), + !t && + "undefined" != typeof global && + global.crypto && + (t = global.crypto), + !t && "function" == typeof require) + ) + try { + t = require("crypto"); + } catch (t) {} + function i() { + if (t) { + if ("function" == typeof t.getRandomValues) + try { + return t.getRandomValues(new Uint32Array(1))[0]; + } catch (t) {} + if ("function" == typeof t.randomBytes) + try { + return t.randomBytes(4).readInt32LE(); + } catch (t) {} + } + throw new Error( + "Native crypto module could not be used to get secure random number." + ); + } + var r = + Object.create || + function (t) { + var e; + return (n.prototype = t), (e = new n()), (n.prototype = null), e; + }; + function n() {} + var e = {}, + o = (e.lib = {}), + s = (o.Base = { + extend: function (t) { + var e = r(this); return ( - k.items.splice(a, 1), - k.clearSelection(), - b.trigger("tag-removed", { $tag: c }), - c + t && e.mixIn(t), + (e.hasOwnProperty("init") && this.init !== e.init) || + (e.init = function () { + e.$super.init.apply(this, arguments); + }), + ((e.init.prototype = e).$super = this), + e ); - }); + }, + create: function () { + var t = this.extend(); + return t.init.apply(t, arguments), t; + }, + init: function () {}, + mixIn: function (t) { + for (var e in t) t.hasOwnProperty(e) && (this[e] = t[e]); + t.hasOwnProperty("toString") && (this.toString = t.toString); + }, + clone: function () { + return this.init.prototype.extend(this); + }, }), - (k.select = function (a) { - 0 > a ? (a = k.items.length - 1) : a >= k.items.length && (a = 0), - (k.index = a), - (k.selected = k.items[a]); + f = (o.WordArray = s.extend({ + init: function (t, e) { + (t = this.words = t || []), + (this.sigBytes = null != e ? e : 4 * t.length); + }, + toString: function (t) { + return (t || a).stringify(this); + }, + concat: function (t) { + var e = this.words, + r = t.words, + i = this.sigBytes, + n = t.sigBytes; + if ((this.clamp(), i % 4)) + for (var o = 0; o < n; o++) { + var s = (r[o >>> 2] >>> (24 - (o % 4) * 8)) & 255; + e[(i + o) >>> 2] |= s << (24 - ((i + o) % 4) * 8); + } + else for (o = 0; o < n; o += 4) e[(i + o) >>> 2] = r[o >>> 2]; + return (this.sigBytes += n), this; + }, + clamp: function () { + var t = this.words, + e = this.sigBytes; + (t[e >>> 2] &= 4294967295 << (32 - (e % 4) * 8)), + (t.length = l.ceil(e / 4)); + }, + clone: function () { + var t = s.clone.call(this); + return (t.words = this.words.slice(0)), t; + }, + random: function (t) { + for (var e = [], r = 0; r < t; r += 4) e.push(i()); + return new f.init(e, t); + }, + })), + c = (e.enc = {}), + a = (c.Hex = { + stringify: function (t) { + for (var e = t.words, r = t.sigBytes, i = [], n = 0; n < r; n++) { + var o = (e[n >>> 2] >>> (24 - (n % 4) * 8)) & 255; + i.push((o >>> 4).toString(16)), i.push((15 & o).toString(16)); + } + return i.join(""); + }, + parse: function (t) { + for (var e = t.length, r = [], i = 0; i < e; i += 2) + r[i >>> 3] |= + parseInt(t.substr(i, 2), 16) << (24 - (i % 8) * 4); + return new f.init(r, e / 2); + }, }), - (k.selectPrior = function () { - k.select(--k.index); - }), - (k.selectNext = function () { - k.select(++k.index); - }), - (k.removeSelected = function () { - return k.remove(k.index); - }), - (k.clearSelection = function () { - (k.selected = null), (k.index = -1); + h = (c.Latin1 = { + stringify: function (t) { + for (var e = t.words, r = t.sigBytes, i = [], n = 0; n < r; n++) { + var o = (e[n >>> 2] >>> (24 - (n % 4) * 8)) & 255; + i.push(String.fromCharCode(o)); + } + return i.join(""); + }, + parse: function (t) { + for (var e = t.length, r = [], i = 0; i < e; i++) + r[i >>> 2] |= (255 & t.charCodeAt(i)) << (24 - (i % 4) * 8); + return new f.init(r, e); + }, }), - (k.getItems = function () { - return a.useStrings ? k.items.map(e) : k.items; + d = (c.Utf8 = { + stringify: function (t) { + try { + return decodeURIComponent(escape(h.stringify(t))); + } catch (t) { + throw new Error("Malformed UTF-8 data"); + } + }, + parse: function (t) { + return h.parse(unescape(encodeURIComponent(t))); + }, }), - k.clearSelection(), - k - ); - } - function k(a) { - return -1 !== c.indexOf(a); - } - return { - restrict: "E", - require: "ngModel", - scope: { - tags: "=ngModel", - text: "=?", - templateScope: "=?", - tagClass: "&", - onTagAdding: "&", - onTagAdded: "&", - onInvalidTag: "&", - onTagRemoving: "&", - onTagRemoved: "&", - onTagClicked: "&", - }, - replace: !1, - transclude: !0, - templateUrl: "ngTagsInput/tags-input.html", - controller: [ - "$scope", - "$attrs", - "$element", - function (a, c, d) { - (a.events = i.simplePubSub()), - h.load("tagsInput", a, c, { - template: [String, "ngTagsInput/tag-item.html"], - type: [String, "text", k], - placeholder: [String, "Add a tag"], - tabindex: [Number, null], - removeTagSymbol: [String, String.fromCharCode(215)], - replaceSpacesWithDashes: [Boolean, !0], - minLength: [Number, 3], - maxLength: [Number, b], - addOnEnter: [Boolean, !0], - addOnSpace: [Boolean, !1], - addOnComma: [Boolean, !0], - addOnBlur: [Boolean, !0], - addOnPaste: [Boolean, !1], - pasteSplitPattern: [RegExp, /,/], - allowedTagsPattern: [RegExp, /.+/], - enableEditingLastTag: [Boolean, !1], - minTags: [Number, 0], - maxTags: [Number, b], - displayProperty: [String, "text"], - keyProperty: [String, ""], - allowLeftoverText: [Boolean, !1], - addFromAutocompleteOnly: [Boolean, !1], - spellcheck: [Boolean, !0], - useStrings: [Boolean, !1], - }), - (a.tagList = new j( - a.options, - a.events, - i.handleUndefinedResult(a.onTagAdding, !0), - i.handleUndefinedResult(a.onTagRemoving, !0) - )), - (this.registerAutocomplete = function () { - d.find("input"); - return { - addTag: function (b) { - return a.tagList.add(b); - }, - getTags: function () { - return a.tagList.items; - }, - getCurrentTagText: function () { - return a.newTag.text(); - }, - getOptions: function () { - return a.options; - }, - getTemplateScope: function () { - return a.templateScope; - }, - on: function (b, c) { - return a.events.on(b, c, !0), this; - }, + u = (o.BufferedBlockAlgorithm = s.extend({ + reset: function () { + (this._data = new f.init()), (this._nDataBytes = 0); + }, + _append: function (t) { + "string" == typeof t && (t = d.parse(t)), + this._data.concat(t), + (this._nDataBytes += t.sigBytes); + }, + _process: function (t) { + var e, + r = this._data, + i = r.words, + n = r.sigBytes, + o = this.blockSize, + s = n / (4 * o), + c = + (s = t + ? l.ceil(s) + : l.max((0 | s) - this._minBufferSize, 0)) * o, + a = l.min(4 * c, n); + if (c) { + for (var h = 0; h < c; h += o) this._doProcessBlock(i, h); + (e = i.splice(0, c)), (r.sigBytes -= a); + } + return new f.init(e, a); + }, + clone: function () { + var t = s.clone.call(this); + return (t._data = this._data.clone()), t; + }, + _minBufferSize: 0, + })), + p = + ((o.Hasher = u.extend({ + cfg: s.extend(), + init: function (t) { + (this.cfg = this.cfg.extend(t)), this.reset(); + }, + reset: function () { + u.reset.call(this), this._doReset(); + }, + update: function (t) { + return this._append(t), this._process(), this; + }, + finalize: function (t) { + return t && this._append(t), this._doFinalize(); + }, + blockSize: 16, + _createHelper: function (r) { + return function (t, e) { + return new r.init(e).finalize(t); }; - }), - (this.registerTagItem = function () { - return { - getOptions: function () { - return a.options; - }, - removeTag: function (b) { - a.disabled || a.tagList.remove(b); - }, - }; - }); - }, - ], - link: function (b, c, g, h) { - var j, - k, - l = [ - a.enter, - a.comma, - a.space, - a.backspace, - a["delete"], - a.left, - a.right, - ], - m = b.tagList, - n = b.events, - o = b.options, - p = c.find("input"), - q = ["minTags", "maxTags", "allowLeftoverText"]; - (j = function () { - h.$setValidity("maxTags", m.items.length <= o.maxTags), - h.$setValidity("minTags", m.items.length >= o.minTags), - h.$setValidity( - "leftoverText", - b.hasFocus || o.allowLeftoverText ? !0 : !b.newTag.text() - ); - }), - (k = function () { - d(function () { - p[0].focus(); - }); - }), - (h.$isEmpty = function (a) { - return !a || !a.length; - }), - (b.newTag = { - text: function (a) { - return angular.isDefined(a) - ? ((b.text = a), void n.trigger("input-change", a)) - : b.text || ""; - }, - invalid: null, - }), - (b.track = function (a) { - return a[o.keyProperty || o.displayProperty]; - }), - (b.getTagClass = function (a, c) { - var d = a === m.selected; - return [ - b.tagClass({ $tag: a, $index: c, $selected: d }), - { selected: d }, - ]; - }), - b.$watch("tags", function (a) { - if (a) { - if ( - ((m.items = i.makeObjectArray(a, o.displayProperty)), - o.useStrings) - ) - return; - b.tags = m.items; - } else m.items = []; - }), - b.$watch("tags.length", function () { - j(), h.$validate(); - }), - g.$observe("disabled", function (a) { - b.disabled = a; - }), - (b.eventHandlers = { - input: { - keydown: function (a) { - n.trigger("input-keydown", a); - }, - focus: function () { - b.hasFocus || ((b.hasFocus = !0), n.trigger("input-focus")); - }, - blur: function () { - d(function () { - var a = e.prop("activeElement"), - d = a === p[0], - f = c[0].contains(a); - (d || !f) && ((b.hasFocus = !1), n.trigger("input-blur")); - }); - }, - paste: function (a) { - (a.getTextData = function () { - var b = - a.clipboardData || - (a.originalEvent && a.originalEvent.clipboardData); - return b - ? b.getData("text/plain") - : f.clipboardData.getData("Text"); - }), - n.trigger("input-paste", a); - }, - }, - host: { - click: function () { - b.disabled || k(); - }, - }, - tag: { - click: function (a) { - n.trigger("tag-clicked", { $tag: a }); - }, - }, - }), - n - .on("tag-added", b.onTagAdded) - .on("invalid-tag", b.onInvalidTag) - .on("tag-removed", b.onTagRemoved) - .on("tag-clicked", b.onTagClicked) - .on("tag-added", function () { - b.newTag.text(""); - }) - .on("tag-added tag-removed", function () { - (b.tags = m.getItems()), h.$setDirty(), k(); - }) - .on("invalid-tag", function () { - b.newTag.invalid = !0; - }) - .on("option-change", function (a) { - -1 !== q.indexOf(a.name) && j(); - }) - .on("input-change", function () { - m.clearSelection(), (b.newTag.invalid = null); - }) - .on("input-focus", function () { - c.triggerHandler("focus"), h.$setValidity("leftoverText", !0); - }) - .on("input-blur", function () { - o.addOnBlur && - !o.addFromAutocompleteOnly && - m.addText(b.newTag.text()), - c.triggerHandler("blur"), - j(); - }) - .on("input-keydown", function (c) { - var d, - e, - f, - g, - h = c.keyCode, - j = {}; - i.isModifierOn(c) || - -1 === l.indexOf(h) || - ((j[a.enter] = o.addOnEnter), - (j[a.comma] = o.addOnComma), - (j[a.space] = o.addOnSpace), - (d = !o.addFromAutocompleteOnly && j[h]), - (e = (h === a.backspace || h === a["delete"]) && m.selected), - (g = - h === a.backspace && - 0 === b.newTag.text().length && - o.enableEditingLastTag), - (f = - (h === a.backspace || h === a.left || h === a.right) && - 0 === b.newTag.text().length && - !o.enableEditingLastTag), - d - ? m.addText(b.newTag.text()) - : g - ? (m.selectPrior(), - m.removeSelected().then(function (a) { - a && b.newTag.text(a[o.displayProperty]); - })) - : e - ? m.removeSelected() - : f && - (h === a.left || h === a.backspace - ? m.selectPrior() - : h === a.right && m.selectNext()), - (d || f || e || g) && c.preventDefault()); - }) - .on("input-paste", function (a) { - if (o.addOnPaste) { - var b = a.getTextData(), - c = b.split(o.pasteSplitPattern); - c.length > 1 && - (c.forEach(function (a) { - m.addText(a); - }), - a.preventDefault()); - } - }); - }, - }; - }, - ]), - d.directive("tiTagItem", [ - "tiUtil", - function (a) { - return { - restrict: "E", - require: "^tagsInput", - template: '', - scope: { $scope: "=scope", data: "=" }, - link: function (b, c, d, e) { - var f = e.registerTagItem(), - g = f.getOptions(); - (b.$$template = g.template), - (b.$$removeTagSymbol = g.removeTagSymbol), - (b.$getDisplayText = function () { - return a.safeToString(b.data[g.displayProperty]); - }), - (b.$removeTag = function () { - f.removeTag(b.$index); - }), - b.$watch("$parent.$index", function (a) { - b.$index = a; - }); - }, - }; - }, - ]), - d.directive("autoComplete", [ - "$document", - "$timeout", - "$sce", - "$q", - "tagsInputConfig", - "tiUtil", - function (b, c, d, e, f, g) { - function h(a, b, c) { - var d, - f, - h, - i = {}; - return ( - (h = function () { - return b.tagsInput.keyProperty || b.tagsInput.displayProperty; - }), - (d = function (a, c) { - return a.filter(function (a) { - return !g.findInObjectArray(c, a, h(), function (a, c) { - return ( - b.tagsInput.replaceSpacesWithDashes && - ((a = g.replaceSpacesWithDashes(a)), - (c = g.replaceSpacesWithDashes(c))), - g.defaultComparer(a, c) - ); - }); - }); - }), - (i.reset = function () { - (f = null), - (i.items = []), - (i.visible = !1), - (i.index = -1), - (i.selected = null), - (i.query = null); - }), - (i.show = function () { - b.selectFirstMatch ? i.select(0) : (i.selected = null), - (i.visible = !0); - }), - (i.load = g.debounce(function (c, j) { - i.query = c; - var k = e.when(a({ $query: c })); - (f = k), - k.then(function (a) { - k === f && - ((a = g.makeObjectArray(a.data || a, h())), - (a = d(a, j)), - (i.items = a.slice(0, b.maxResultsToShow)), - i.items.length > 0 ? i.show() : i.reset()); - }); - }, b.debounceDelay)), - (i.selectNext = function () { - i.select(++i.index); - }), - (i.selectPrior = function () { - i.select(--i.index); - }), - (i.select = function (a) { - 0 > a ? (a = i.items.length - 1) : a >= i.items.length && (a = 0), - (i.index = a), - (i.selected = i.items[a]), - c.trigger("suggestion-selected", a); - }), - i.reset(), - i - ); - } - function i(a, b) { - var c = a.find("li").eq(b), - d = c.parent(), - e = c.prop("offsetTop"), - f = c.prop("offsetHeight"), - g = d.prop("clientHeight"), - h = d.prop("scrollTop"); - h > e - ? d.prop("scrollTop", e) - : e + f > g + h && d.prop("scrollTop", e + f - g); - } - return { - restrict: "E", - require: "^tagsInput", - scope: { source: "&", matchClass: "&" }, - templateUrl: "ngTagsInput/auto-complete.html", - controller: [ - "$scope", - "$element", - "$attrs", - function (a, b, c) { - (a.events = g.simplePubSub()), - f.load("autoComplete", a, c, { - template: [String, "ngTagsInput/auto-complete-match.html"], - debounceDelay: [Number, 100], - minLength: [Number, 3], - highlightMatchedText: [Boolean, !0], - maxResultsToShow: [Number, 10], - loadOnDownArrow: [Boolean, !1], - loadOnEmpty: [Boolean, !1], - loadOnFocus: [Boolean, !1], - selectFirstMatch: [Boolean, !0], - displayProperty: [String, ""], - }), - (a.suggestionList = new h(a.source, a.options, a.events)), - (this.registerAutocompleteMatch = function () { - return { - getOptions: function () { - return a.options; - }, - getQuery: function () { - return a.suggestionList.query; - }, - }; - }); - }, - ], - link: function (b, c, d, e) { - var f, - h = [a.enter, a.tab, a.escape, a.up, a.down], - j = b.suggestionList, - k = e.registerAutocomplete(), - l = b.options, - m = b.events; - (l.tagsInput = k.getOptions()), - (f = function (a) { - return (a && a.length >= l.minLength) || (!a && l.loadOnEmpty); - }), - (b.templateScope = k.getTemplateScope()), - (b.addSuggestionByIndex = function (a) { - j.select(a), b.addSuggestion(); - }), - (b.addSuggestion = function () { - var a = !1; - return ( - j.selected && - (k.addTag(angular.copy(j.selected)), j.reset(), (a = !0)), - a - ); - }), - (b.track = function (a) { - return a[ - l.tagsInput.keyProperty || l.tagsInput.displayProperty - ]; - }), - (b.getSuggestionClass = function (a, c) { - var d = a === j.selected; - return [ - b.matchClass({ $match: a, $index: c, $selected: d }), - { selected: d }, - ]; - }), - k - .on( - "tag-added tag-removed invalid-tag input-blur", - function () { - j.reset(); - } - ) - .on("input-change", function (a) { - f(a) ? j.load(a, k.getTags()) : j.reset(); - }) - .on("input-focus", function () { - var a = k.getCurrentTagText(); - l.loadOnFocus && f(a) && j.load(a, k.getTags()); - }) - .on("input-keydown", function (c) { - var d = c.keyCode, - e = !1; - if (!g.isModifierOn(c) && -1 !== h.indexOf(d)) - return ( - j.visible - ? d === a.down - ? (j.selectNext(), (e = !0)) - : d === a.up - ? (j.selectPrior(), (e = !0)) - : d === a.escape - ? (j.reset(), (e = !0)) - : (d === a.enter || d === a.tab) && - (e = b.addSuggestion()) - : d === a.down && - b.options.loadOnDownArrow && - (j.load(k.getCurrentTagText(), k.getTags()), - (e = !0)), - e - ? (c.preventDefault(), c.stopImmediatePropagation(), !1) - : void 0 - ); - }), - m.on("suggestion-selected", function (a) { - i(c, a); - }); - }, - }; - }, - ]), - d.directive("tiAutocompleteMatch", [ - "$sce", - "tiUtil", - function (a, b) { - return { - restrict: "E", - require: "^autoComplete", - template: '', - scope: { $scope: "=scope", data: "=" }, - link: function (c, d, e, f) { - var g = f.registerAutocompleteMatch(), - h = g.getOptions(); - (c.$$template = h.template), - (c.$index = c.$parent.$index), - (c.$highlight = function (c) { - return ( - h.highlightMatchedText && - (c = b.safeHighlight(c, g.getQuery())), - a.trustAsHtml(c) - ); - }), - (c.$getDisplayText = function () { - return b.safeToString( - c.data[h.displayProperty || h.tagsInput.displayProperty] - ); - }); - }, - }; - }, - ]), - d.directive("tiTranscludeAppend", function () { - return function (a, b, c, d, e) { - e(function (a) { - b.append(a); - }); - }; - }), - d.directive("tiAutosize", [ - "tagsInputConfig", - function (a) { - return { - restrict: "A", - require: "ngModel", - link: function (b, c, d, e) { - var f, - g, - h = a.getTextAutosizeThreshold(); - (f = angular.element('')), - f - .css("display", "none") - .css("visibility", "hidden") - .css("width", "auto") - .css("white-space", "pre"), - c.parent().append(f), - (g = function (a) { - var b, - e = a; - return ( - angular.isString(e) && 0 === e.length && (e = d.placeholder), - e && - (f.text(e), - f.css("display", ""), - (b = f.prop("offsetWidth")), - f.css("display", "none")), - c.css("width", b ? b + h + "px" : ""), - a - ); - }), - e.$parsers.unshift(g), - e.$formatters.unshift(g), - d.$observe("placeholder", function (a) { - e.$modelValue || g(a); - }); - }, - }; - }, - ]), - d.directive("tiBindAttrs", function () { - return function (a, b, c) { - a.$watch( - c.tiBindAttrs, - function (a) { - angular.forEach(a, function (a, b) { - c.$set(b, a); - }); - }, - !0 - ); - }; - }), - d.provider("tagsInputConfig", function () { - var a = {}, - b = {}, - c = 3; - (this.setDefaults = function (b, c) { - return (a[b] = c), this; - }), - (this.setActiveInterpolation = function (a, c) { - return (b[a] = c), this; - }), - (this.setTextAutosizeThreshold = function (a) { - return (c = a), this; - }), - (this.$get = [ - "$interpolate", - function (d) { - var e = {}; - return ( - (e[String] = function (a) { - return a; - }), - (e[Number] = function (a) { - return parseInt(a, 10); - }), - (e[Boolean] = function (a) { - return "true" === a.toLowerCase(); - }), - (e[RegExp] = function (a) { - return new RegExp(a); - }), - { - load: function (c, f, g, h) { - var i = function () { - return !0; - }; - (f.options = {}), - angular.forEach(h, function (h, j) { - var k, l, m, n, o, p; - (k = h[0]), - (l = h[1]), - (m = h[2] || i), - (n = e[k]), - (o = function () { - var b = a[c] && a[c][j]; - return angular.isDefined(b) ? b : l; - }), - (p = function (a) { - f.options[j] = a && m(a) ? n(a) : o(); - }), - b[c] && b[c][j] - ? g.$observe(j, function (a) { - p(a), - f.events.trigger("option-change", { - name: j, - newValue: a, - }); - }) - : p(g[j] && d(g[j])(f.$parent)); - }); - }, - getTextAutosizeThreshold: function () { - return c; - }, - } - ); - }, - ]); - }), - d.factory("tiUtil", [ - "$timeout", - "$q", - function (a, b) { - var c = {}; - return ( - (c.debounce = function (b, c) { - var d; - return function () { - var e = arguments; - a.cancel(d), - (d = a(function () { - b.apply(null, e); - }, c)); - }; - }), - (c.makeObjectArray = function (a, b) { - if (!angular.isArray(a) || 0 === a.length || angular.isObject(a[0])) - return a; - var c = []; - return ( - a.forEach(function (a) { - var d = {}; - (d[b] = a), c.push(d); - }), - c - ); - }), - (c.findInObjectArray = function (a, b, d, e) { - var f = null; - return ( - (e = e || c.defaultComparer), - a.some(function (a) { - return e(a[d], b[d]) ? ((f = a), !0) : void 0; - }), - f - ); - }), - (c.defaultComparer = function (a, b) { - return ( - c.safeToString(a).toLowerCase() === - c.safeToString(b).toLowerCase() - ); - }), - (c.safeHighlight = function (a, b) { - function d(a) { - return a.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); - } - if (((a = c.encodeHTML(a)), (b = c.encodeHTML(b)), !b)) return a; - var e = new RegExp("&[^;]+;|" + d(b), "gi"); - return a.replace(e, function (a) { - return a.toLowerCase() === b.toLowerCase() - ? "" + a + "" - : a; - }); - }), - (c.safeToString = function (a) { - return angular.isUndefined(a) || null == a - ? "" - : a.toString().trim(); - }), - (c.encodeHTML = function (a) { - return c - .safeToString(a) - .replace(/&/g, "&") - .replace(//g, ">"); - }), - (c.handleUndefinedResult = function (a, b) { - return function () { - var c = a.apply(null, arguments); - return angular.isUndefined(c) ? b : c; - }; - }), - (c.replaceSpacesWithDashes = function (a) { - return c.safeToString(a).replace(/\s/g, "-"); - }), - (c.isModifierOn = function (a) { - return a.shiftKey || a.ctrlKey || a.altKey || a.metaKey; - }), - (c.promisifyValue = function (a) { - return ( - (a = angular.isUndefined(a) ? !0 : a), b[a ? "when" : "reject"]() - ); - }), - (c.simplePubSub = function () { - var a = {}; - return { - on: function (b, c, d) { - return ( - b.split(" ").forEach(function (b) { - a[b] || (a[b] = []); - var e = d ? [].unshift : [].push; - e.call(a[b], c); - }), - this - ); - }, - trigger: function (b, d) { - var e = a[b] || []; - return ( - e.every(function (a) { - return c.handleUndefinedResult(a, !0)(d); - }), - this - ); - }, - }; - }), - c - ); - }, - ]), - d.run([ - "$templateCache", - function (a) { - a.put( - "ngTagsInput/tags-input.html", - '
    ' - ), - a.put( - "ngTagsInput/tag-item.html", - ' ' - ), - a.put( - "ngTagsInput/auto-complete.html", - '
    ' - ), - a.put( - "ngTagsInput/auto-complete-match.html", - '' - ); - }, - ]); -})(); - -!(function (t, e) { - "object" == typeof exports - ? (module.exports = exports = e()) - : "function" == typeof define && define.amd - ? define([], e) - : (t.CryptoJS = e()); -})(this, function () { - var h, - t, - e, - r, - i, - n, - f, - o, - s, - c, - a, - l, - d, - m, - x, - b, - H, - z, - A, - u, - p, - _, - v, - y, - g, - B, - w, - k, - S, - C, - D, - E, - R, - M, - F, - P, - W, - O, - I, - U, - K, - X, - L, - j, - N, - T, - q, - Z, - V, - G, - J, - $, - Q, - Y, - tt, - et, - rt, - it, - nt, - ot, - st, - ct, - at, - ht, - lt, - ft, - dt, - ut, - pt, - _t, - vt, - yt, - gt, - Bt, - wt, - kt, - St, - bt = - bt || - (function (l) { - var t; - if ( - ("undefined" != typeof window && window.crypto && (t = window.crypto), - !t && - "undefined" != typeof window && - window.msCrypto && - (t = window.msCrypto), - !t && - "undefined" != typeof global && - global.crypto && - (t = global.crypto), - !t && "function" == typeof require) - ) - try { - t = require("crypto"); - } catch (t) {} - function i() { - if (t) { - if ("function" == typeof t.getRandomValues) - try { - return t.getRandomValues(new Uint32Array(1))[0]; - } catch (t) {} - if ("function" == typeof t.randomBytes) - try { - return t.randomBytes(4).readInt32LE(); - } catch (t) {} - } - throw new Error( - "Native crypto module could not be used to get secure random number." - ); - } - var r = - Object.create || - function (t) { - var e; - return (n.prototype = t), (e = new n()), (n.prototype = null), e; - }; - function n() {} - var e = {}, - o = (e.lib = {}), - s = (o.Base = { - extend: function (t) { - var e = r(this); - return ( - t && e.mixIn(t), - (e.hasOwnProperty("init") && this.init !== e.init) || - (e.init = function () { - e.$super.init.apply(this, arguments); - }), - ((e.init.prototype = e).$super = this), - e - ); - }, - create: function () { - var t = this.extend(); - return t.init.apply(t, arguments), t; - }, - init: function () {}, - mixIn: function (t) { - for (var e in t) t.hasOwnProperty(e) && (this[e] = t[e]); - t.hasOwnProperty("toString") && (this.toString = t.toString); - }, - clone: function () { - return this.init.prototype.extend(this); - }, - }), - f = (o.WordArray = s.extend({ - init: function (t, e) { - (t = this.words = t || []), - (this.sigBytes = null != e ? e : 4 * t.length); - }, - toString: function (t) { - return (t || a).stringify(this); - }, - concat: function (t) { - var e = this.words, - r = t.words, - i = this.sigBytes, - n = t.sigBytes; - if ((this.clamp(), i % 4)) - for (var o = 0; o < n; o++) { - var s = (r[o >>> 2] >>> (24 - (o % 4) * 8)) & 255; - e[(i + o) >>> 2] |= s << (24 - ((i + o) % 4) * 8); - } - else for (o = 0; o < n; o += 4) e[(i + o) >>> 2] = r[o >>> 2]; - return (this.sigBytes += n), this; - }, - clamp: function () { - var t = this.words, - e = this.sigBytes; - (t[e >>> 2] &= 4294967295 << (32 - (e % 4) * 8)), - (t.length = l.ceil(e / 4)); - }, - clone: function () { - var t = s.clone.call(this); - return (t.words = this.words.slice(0)), t; - }, - random: function (t) { - for (var e = [], r = 0; r < t; r += 4) e.push(i()); - return new f.init(e, t); - }, - })), - c = (e.enc = {}), - a = (c.Hex = { - stringify: function (t) { - for (var e = t.words, r = t.sigBytes, i = [], n = 0; n < r; n++) { - var o = (e[n >>> 2] >>> (24 - (n % 4) * 8)) & 255; - i.push((o >>> 4).toString(16)), i.push((15 & o).toString(16)); - } - return i.join(""); - }, - parse: function (t) { - for (var e = t.length, r = [], i = 0; i < e; i += 2) - r[i >>> 3] |= - parseInt(t.substr(i, 2), 16) << (24 - (i % 8) * 4); - return new f.init(r, e / 2); - }, - }), - h = (c.Latin1 = { - stringify: function (t) { - for (var e = t.words, r = t.sigBytes, i = [], n = 0; n < r; n++) { - var o = (e[n >>> 2] >>> (24 - (n % 4) * 8)) & 255; - i.push(String.fromCharCode(o)); - } - return i.join(""); - }, - parse: function (t) { - for (var e = t.length, r = [], i = 0; i < e; i++) - r[i >>> 2] |= (255 & t.charCodeAt(i)) << (24 - (i % 4) * 8); - return new f.init(r, e); - }, - }), - d = (c.Utf8 = { - stringify: function (t) { - try { - return decodeURIComponent(escape(h.stringify(t))); - } catch (t) { - throw new Error("Malformed UTF-8 data"); - } - }, - parse: function (t) { - return h.parse(unescape(encodeURIComponent(t))); - }, - }), - u = (o.BufferedBlockAlgorithm = s.extend({ - reset: function () { - (this._data = new f.init()), (this._nDataBytes = 0); - }, - _append: function (t) { - "string" == typeof t && (t = d.parse(t)), - this._data.concat(t), - (this._nDataBytes += t.sigBytes); - }, - _process: function (t) { - var e, - r = this._data, - i = r.words, - n = r.sigBytes, - o = this.blockSize, - s = n / (4 * o), - c = - (s = t - ? l.ceil(s) - : l.max((0 | s) - this._minBufferSize, 0)) * o, - a = l.min(4 * c, n); - if (c) { - for (var h = 0; h < c; h += o) this._doProcessBlock(i, h); - (e = i.splice(0, c)), (r.sigBytes -= a); - } - return new f.init(e, a); - }, - clone: function () { - var t = s.clone.call(this); - return (t._data = this._data.clone()), t; - }, - _minBufferSize: 0, - })), - p = - ((o.Hasher = u.extend({ - cfg: s.extend(), - init: function (t) { - (this.cfg = this.cfg.extend(t)), this.reset(); - }, - reset: function () { - u.reset.call(this), this._doReset(); - }, - update: function (t) { - return this._append(t), this._process(), this; - }, - finalize: function (t) { - return t && this._append(t), this._doFinalize(); - }, - blockSize: 16, - _createHelper: function (r) { - return function (t, e) { - return new r.init(e).finalize(t); - }; - }, - _createHmacHelper: function (r) { - return function (t, e) { - return new p.HMAC.init(r, e).finalize(t); + }, + _createHmacHelper: function (r) { + return function (t, e) { + return new p.HMAC.init(r, e).finalize(t); }; }, })), @@ -15441,306 +14667,1213 @@ angular.module("bw.paging", []).directive("paging", function () { (t[e] = this._lBlock), (t[e + 1] = this._rBlock); }, - keySize: 2, - ivSize: 2, - blockSize: 2, - })); - function p(t, e) { - var r = ((this._lBlock >>> t) ^ this._rBlock) & e; - (this._rBlock ^= r), (this._lBlock ^= r << t); - } - function _(t, e) { - var r = ((this._rBlock >>> t) ^ this._lBlock) & e; - (this._lBlock ^= r), (this._rBlock ^= r << t); - } - t.DES = r._createHelper(o); - var s = (i.TripleDES = r.extend({ - _doReset: function () { - var t = this._key.words; - if (2 !== t.length && 4 !== t.length && t.length < 6) - throw new Error( - "Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192." - ); - var e = t.slice(0, 2), - r = t.length < 4 ? t.slice(0, 2) : t.slice(2, 4), - i = t.length < 6 ? t.slice(0, 2) : t.slice(4, 6); - (this._des1 = o.createEncryptor(n.create(e))), - (this._des2 = o.createEncryptor(n.create(r))), - (this._des3 = o.createEncryptor(n.create(i))); - }, - encryptBlock: function (t, e) { - this._des1.encryptBlock(t, e), - this._des2.decryptBlock(t, e), - this._des3.encryptBlock(t, e); - }, - decryptBlock: function (t, e) { - this._des3.decryptBlock(t, e), - this._des2.encryptBlock(t, e), - this._des1.decryptBlock(t, e); + keySize: 2, + ivSize: 2, + blockSize: 2, + })); + function p(t, e) { + var r = ((this._lBlock >>> t) ^ this._rBlock) & e; + (this._rBlock ^= r), (this._lBlock ^= r << t); + } + function _(t, e) { + var r = ((this._rBlock >>> t) ^ this._lBlock) & e; + (this._lBlock ^= r), (this._rBlock ^= r << t); + } + t.DES = r._createHelper(o); + var s = (i.TripleDES = r.extend({ + _doReset: function () { + var t = this._key.words; + if (2 !== t.length && 4 !== t.length && t.length < 6) + throw new Error( + "Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192." + ); + var e = t.slice(0, 2), + r = t.length < 4 ? t.slice(0, 2) : t.slice(2, 4), + i = t.length < 6 ? t.slice(0, 2) : t.slice(4, 6); + (this._des1 = o.createEncryptor(n.create(e))), + (this._des2 = o.createEncryptor(n.create(r))), + (this._des3 = o.createEncryptor(n.create(i))); + }, + encryptBlock: function (t, e) { + this._des1.encryptBlock(t, e), + this._des2.decryptBlock(t, e), + this._des3.encryptBlock(t, e); + }, + decryptBlock: function (t, e) { + this._des3.decryptBlock(t, e), + this._des2.encryptBlock(t, e), + this._des1.decryptBlock(t, e); + }, + keySize: 6, + ivSize: 2, + blockSize: 2, + })); + t.TripleDES = r._createHelper(s); + })(), + (function () { + var t = bt, + e = t.lib.StreamCipher, + r = t.algo, + i = (r.RC4 = e.extend({ + _doReset: function () { + for ( + var t = this._key, + e = t.words, + r = t.sigBytes, + i = (this._S = []), + n = 0; + n < 256; + n++ + ) + i[n] = n; + n = 0; + for (var o = 0; n < 256; n++) { + var s = n % r, + c = (e[s >>> 2] >>> (24 - (s % 4) * 8)) & 255; + o = (o + i[n] + c) % 256; + var a = i[n]; + (i[n] = i[o]), (i[o] = a); + } + this._i = this._j = 0; + }, + _doProcessBlock: function (t, e) { + t[e] ^= n.call(this); + }, + keySize: 8, + ivSize: 0, + })); + function n() { + for ( + var t = this._S, e = this._i, r = this._j, i = 0, n = 0; + n < 4; + n++ + ) { + r = (r + t[(e = (e + 1) % 256)]) % 256; + var o = t[e]; + (t[e] = t[r]), + (t[r] = o), + (i |= t[(t[e] + t[r]) % 256] << (24 - 8 * n)); + } + return (this._i = e), (this._j = r), i; + } + t.RC4 = e._createHelper(i); + var o = (r.RC4Drop = i.extend({ + cfg: i.cfg.extend({ drop: 192 }), + _doReset: function () { + i._doReset.call(this); + for (var t = this.cfg.drop; 0 < t; t--) n.call(this); + }, + })); + t.RC4Drop = e._createHelper(o); + })(), + (bt.mode.CTRGladman = + ((ot = bt.lib.BlockCipherMode.extend()), + (st = ot.Encryptor = ot.extend({ + processBlock: function (t, e) { + var r, + i = this._cipher, + n = i.blockSize, + o = this._iv, + s = this._counter; + o && ((s = this._counter = o.slice(0)), (this._iv = void 0)), + 0 === ((r = s)[0] = Et(r[0])) && (r[1] = Et(r[1])); + var c = s.slice(0); + i.encryptBlock(c, 0); + for (var a = 0; a < n; a++) t[e + a] ^= c[a]; + }, + })), + (ot.Decryptor = st), + ot)), + (at = (ct = bt).lib.StreamCipher), + (ht = ct.algo), + (lt = []), + (ft = []), + (dt = []), + (ut = ht.Rabbit = at.extend({ + _doReset: function () { + for (var t = this._key.words, e = this.cfg.iv, r = 0; r < 4; r++) + t[r] = + (16711935 & ((t[r] << 8) | (t[r] >>> 24))) | + (4278255360 & ((t[r] << 24) | (t[r] >>> 8))); + var i = (this._X = [ + t[0], + (t[3] << 16) | (t[2] >>> 16), + t[1], + (t[0] << 16) | (t[3] >>> 16), + t[2], + (t[1] << 16) | (t[0] >>> 16), + t[3], + (t[2] << 16) | (t[1] >>> 16), + ]), + n = (this._C = [ + (t[2] << 16) | (t[2] >>> 16), + (4294901760 & t[0]) | (65535 & t[1]), + (t[3] << 16) | (t[3] >>> 16), + (4294901760 & t[1]) | (65535 & t[2]), + (t[0] << 16) | (t[0] >>> 16), + (4294901760 & t[2]) | (65535 & t[3]), + (t[1] << 16) | (t[1] >>> 16), + (4294901760 & t[3]) | (65535 & t[0]), + ]); + for (r = this._b = 0; r < 4; r++) Rt.call(this); + for (r = 0; r < 8; r++) n[r] ^= i[(r + 4) & 7]; + if (e) { + var o = e.words, + s = o[0], + c = o[1], + a = + (16711935 & ((s << 8) | (s >>> 24))) | + (4278255360 & ((s << 24) | (s >>> 8))), + h = + (16711935 & ((c << 8) | (c >>> 24))) | + (4278255360 & ((c << 24) | (c >>> 8))), + l = (a >>> 16) | (4294901760 & h), + f = (h << 16) | (65535 & a); + (n[0] ^= a), + (n[1] ^= l), + (n[2] ^= h), + (n[3] ^= f), + (n[4] ^= a), + (n[5] ^= l), + (n[6] ^= h), + (n[7] ^= f); + for (r = 0; r < 4; r++) Rt.call(this); + } + }, + _doProcessBlock: function (t, e) { + var r = this._X; + Rt.call(this), + (lt[0] = r[0] ^ (r[5] >>> 16) ^ (r[3] << 16)), + (lt[1] = r[2] ^ (r[7] >>> 16) ^ (r[5] << 16)), + (lt[2] = r[4] ^ (r[1] >>> 16) ^ (r[7] << 16)), + (lt[3] = r[6] ^ (r[3] >>> 16) ^ (r[1] << 16)); + for (var i = 0; i < 4; i++) + (lt[i] = + (16711935 & ((lt[i] << 8) | (lt[i] >>> 24))) | + (4278255360 & ((lt[i] << 24) | (lt[i] >>> 8)))), + (t[e + i] ^= lt[i]); + }, + blockSize: 4, + ivSize: 2, + })), + (ct.Rabbit = at._createHelper(ut)), + (bt.mode.CTR = + ((pt = bt.lib.BlockCipherMode.extend()), + (_t = pt.Encryptor = pt.extend({ + processBlock: function (t, e) { + var r = this._cipher, + i = r.blockSize, + n = this._iv, + o = this._counter; + n && ((o = this._counter = n.slice(0)), (this._iv = void 0)); + var s = o.slice(0); + r.encryptBlock(s, 0), (o[i - 1] = (o[i - 1] + 1) | 0); + for (var c = 0; c < i; c++) t[e + c] ^= s[c]; + }, + })), + (pt.Decryptor = _t), + pt)), + (yt = (vt = bt).lib.StreamCipher), + (gt = vt.algo), + (Bt = []), + (wt = []), + (kt = []), + (St = gt.RabbitLegacy = yt.extend({ + _doReset: function () { + for ( + var t = this._key.words, + e = this.cfg.iv, + r = (this._X = [ + t[0], + (t[3] << 16) | (t[2] >>> 16), + t[1], + (t[0] << 16) | (t[3] >>> 16), + t[2], + (t[1] << 16) | (t[0] >>> 16), + t[3], + (t[2] << 16) | (t[1] >>> 16), + ]), + i = (this._C = [ + (t[2] << 16) | (t[2] >>> 16), + (4294901760 & t[0]) | (65535 & t[1]), + (t[3] << 16) | (t[3] >>> 16), + (4294901760 & t[1]) | (65535 & t[2]), + (t[0] << 16) | (t[0] >>> 16), + (4294901760 & t[2]) | (65535 & t[3]), + (t[1] << 16) | (t[1] >>> 16), + (4294901760 & t[3]) | (65535 & t[0]), + ]), + n = (this._b = 0); + n < 4; + n++ + ) + Mt.call(this); + for (n = 0; n < 8; n++) i[n] ^= r[(n + 4) & 7]; + if (e) { + var o = e.words, + s = o[0], + c = o[1], + a = + (16711935 & ((s << 8) | (s >>> 24))) | + (4278255360 & ((s << 24) | (s >>> 8))), + h = + (16711935 & ((c << 8) | (c >>> 24))) | + (4278255360 & ((c << 24) | (c >>> 8))), + l = (a >>> 16) | (4294901760 & h), + f = (h << 16) | (65535 & a); + (i[0] ^= a), + (i[1] ^= l), + (i[2] ^= h), + (i[3] ^= f), + (i[4] ^= a), + (i[5] ^= l), + (i[6] ^= h), + (i[7] ^= f); + for (n = 0; n < 4; n++) Mt.call(this); + } + }, + _doProcessBlock: function (t, e) { + var r = this._X; + Mt.call(this), + (Bt[0] = r[0] ^ (r[5] >>> 16) ^ (r[3] << 16)), + (Bt[1] = r[2] ^ (r[7] >>> 16) ^ (r[5] << 16)), + (Bt[2] = r[4] ^ (r[1] >>> 16) ^ (r[7] << 16)), + (Bt[3] = r[6] ^ (r[3] >>> 16) ^ (r[1] << 16)); + for (var i = 0; i < 4; i++) + (Bt[i] = + (16711935 & ((Bt[i] << 8) | (Bt[i] >>> 24))) | + (4278255360 & ((Bt[i] << 24) | (Bt[i] >>> 8)))), + (t[e + i] ^= Bt[i]); + }, + blockSize: 4, + ivSize: 2, + })), + (vt.RabbitLegacy = yt._createHelper(St)), + (bt.pad.ZeroPadding = { + pad: function (t, e) { + var r = 4 * e; + t.clamp(), (t.sigBytes += r - (t.sigBytes % r || r)); + }, + unpad: function (t) { + var e = t.words, + r = t.sigBytes - 1; + for (r = t.sigBytes - 1; 0 <= r; r--) + if ((e[r >>> 2] >>> (24 - (r % 4) * 8)) & 255) { + t.sigBytes = r + 1; + break; + } + }, + }), + bt + ); +}); + +/*! ngTagsInput v3.2.0 License: MIT */ !(function () { + "use strict"; + var a = { + backspace: 8, + tab: 9, + enter: 13, + escape: 27, + space: 32, + up: 38, + down: 40, + left: 37, + right: 39, + delete: 46, + comma: 188, + }, + b = 9007199254740991, + c = ["text", "email", "url"], + d = angular.module("ngTagsInput", []); + d.directive("tagsInput", [ + "$timeout", + "$document", + "$window", + "$q", + "tagsInputConfig", + "tiUtil", + function (d, e, f, g, h, i) { + function j(a, b, c, d) { + var e, + f, + h, + j, + k = {}; + return ( + (e = function (b) { + return i.safeToString(b[a.displayProperty]); + }), + (f = function (b, c) { + b[a.displayProperty] = c; + }), + (h = function (b) { + var d = e(b), + f = + d && + d.length >= a.minLength && + d.length <= a.maxLength && + a.allowedTagsPattern.test(d) && + !i.findInObjectArray( + k.items, + b, + a.keyProperty || a.displayProperty + ); + return g.when(f && c({ $tag: b })).then(i.promisifyValue); + }), + (j = function (a) { + return g.when(d({ $tag: a })).then(i.promisifyValue); + }), + (k.items = []), + (k.addText = function (a) { + var b = {}; + return f(b, a), k.add(b); + }), + (k.add = function (c) { + var d = e(c); + return ( + a.replaceSpacesWithDashes && (d = i.replaceSpacesWithDashes(d)), + f(c, d), + h(c) + .then(function () { + k.items.push(c), b.trigger("tag-added", { $tag: c }); + }) + ["catch"](function () { + d && b.trigger("invalid-tag", { $tag: c }); + }) + ); + }), + (k.remove = function (a) { + var c = k.items[a]; + return j(c).then(function () { + return ( + k.items.splice(a, 1), + k.clearSelection(), + b.trigger("tag-removed", { $tag: c }), + c + ); + }); + }), + (k.select = function (a) { + 0 > a ? (a = k.items.length - 1) : a >= k.items.length && (a = 0), + (k.index = a), + (k.selected = k.items[a]); + }), + (k.selectPrior = function () { + k.select(--k.index); + }), + (k.selectNext = function () { + k.select(++k.index); + }), + (k.removeSelected = function () { + return k.remove(k.index); + }), + (k.clearSelection = function () { + (k.selected = null), (k.index = -1); + }), + (k.getItems = function () { + return a.useStrings ? k.items.map(e) : k.items; + }), + k.clearSelection(), + k + ); + } + function k(a) { + return -1 !== c.indexOf(a); + } + return { + restrict: "E", + require: "ngModel", + scope: { + tags: "=ngModel", + text: "=?", + templateScope: "=?", + tagClass: "&", + onTagAdding: "&", + onTagAdded: "&", + onInvalidTag: "&", + onTagRemoving: "&", + onTagRemoved: "&", + onTagClicked: "&", + }, + replace: !1, + transclude: !0, + templateUrl: "ngTagsInput/tags-input.html", + controller: [ + "$scope", + "$attrs", + "$element", + function (a, c, d) { + (a.events = i.simplePubSub()), + h.load("tagsInput", a, c, { + template: [String, "ngTagsInput/tag-item.html"], + type: [String, "text", k], + placeholder: [String, "Add a tag"], + tabindex: [Number, null], + removeTagSymbol: [String, String.fromCharCode(215)], + replaceSpacesWithDashes: [Boolean, !0], + minLength: [Number, 3], + maxLength: [Number, b], + addOnEnter: [Boolean, !0], + addOnSpace: [Boolean, !1], + addOnComma: [Boolean, !0], + addOnBlur: [Boolean, !0], + addOnPaste: [Boolean, !1], + pasteSplitPattern: [RegExp, /,/], + allowedTagsPattern: [RegExp, /.+/], + enableEditingLastTag: [Boolean, !1], + minTags: [Number, 0], + maxTags: [Number, b], + displayProperty: [String, "text"], + keyProperty: [String, ""], + allowLeftoverText: [Boolean, !1], + addFromAutocompleteOnly: [Boolean, !1], + spellcheck: [Boolean, !0], + useStrings: [Boolean, !1], + }), + (a.tagList = new j( + a.options, + a.events, + i.handleUndefinedResult(a.onTagAdding, !0), + i.handleUndefinedResult(a.onTagRemoving, !0) + )), + (this.registerAutocomplete = function () { + d.find("input"); + return { + addTag: function (b) { + return a.tagList.add(b); + }, + getTags: function () { + return a.tagList.items; + }, + getCurrentTagText: function () { + return a.newTag.text(); + }, + getOptions: function () { + return a.options; + }, + getTemplateScope: function () { + return a.templateScope; + }, + on: function (b, c) { + return a.events.on(b, c, !0), this; + }, + }; + }), + (this.registerTagItem = function () { + return { + getOptions: function () { + return a.options; + }, + removeTag: function (b) { + a.disabled || a.tagList.remove(b); + }, + }; + }); + }, + ], + link: function (b, c, g, h) { + var j, + k, + l = [ + a.enter, + a.comma, + a.space, + a.backspace, + a["delete"], + a.left, + a.right, + ], + m = b.tagList, + n = b.events, + o = b.options, + p = c.find("input"), + q = ["minTags", "maxTags", "allowLeftoverText"]; + (j = function () { + h.$setValidity("maxTags", m.items.length <= o.maxTags), + h.$setValidity("minTags", m.items.length >= o.minTags), + h.$setValidity( + "leftoverText", + b.hasFocus || o.allowLeftoverText ? !0 : !b.newTag.text() + ); + }), + (k = function () { + d(function () { + p[0].focus(); + }); + }), + (h.$isEmpty = function (a) { + return !a || !a.length; + }), + (b.newTag = { + text: function (a) { + return angular.isDefined(a) + ? ((b.text = a), void n.trigger("input-change", a)) + : b.text || ""; + }, + invalid: null, + }), + (b.track = function (a) { + return a[o.keyProperty || o.displayProperty]; + }), + (b.getTagClass = function (a, c) { + var d = a === m.selected; + return [ + b.tagClass({ $tag: a, $index: c, $selected: d }), + { selected: d }, + ]; + }), + b.$watch("tags", function (a) { + if (a) { + if ( + ((m.items = i.makeObjectArray(a, o.displayProperty)), + o.useStrings) + ) + return; + b.tags = m.items; + } else m.items = []; + }), + b.$watch("tags.length", function () { + j(), h.$validate(); + }), + g.$observe("disabled", function (a) { + b.disabled = a; + }), + (b.eventHandlers = { + input: { + keydown: function (a) { + n.trigger("input-keydown", a); + }, + focus: function () { + b.hasFocus || ((b.hasFocus = !0), n.trigger("input-focus")); + }, + blur: function () { + d(function () { + var a = e.prop("activeElement"), + d = a === p[0], + f = c[0].contains(a); + (d || !f) && ((b.hasFocus = !1), n.trigger("input-blur")); + }); + }, + paste: function (a) { + (a.getTextData = function () { + var b = + a.clipboardData || + (a.originalEvent && a.originalEvent.clipboardData); + return b + ? b.getData("text/plain") + : f.clipboardData.getData("Text"); + }), + n.trigger("input-paste", a); + }, + }, + host: { + click: function () { + b.disabled || k(); + }, + }, + tag: { + click: function (a) { + n.trigger("tag-clicked", { $tag: a }); + }, + }, + }), + n + .on("tag-added", b.onTagAdded) + .on("invalid-tag", b.onInvalidTag) + .on("tag-removed", b.onTagRemoved) + .on("tag-clicked", b.onTagClicked) + .on("tag-added", function () { + b.newTag.text(""); + }) + .on("tag-added tag-removed", function () { + (b.tags = m.getItems()), h.$setDirty(), k(); + }) + .on("invalid-tag", function () { + b.newTag.invalid = !0; + }) + .on("option-change", function (a) { + -1 !== q.indexOf(a.name) && j(); + }) + .on("input-change", function () { + m.clearSelection(), (b.newTag.invalid = null); + }) + .on("input-focus", function () { + c.triggerHandler("focus"), h.$setValidity("leftoverText", !0); + }) + .on("input-blur", function () { + o.addOnBlur && + !o.addFromAutocompleteOnly && + m.addText(b.newTag.text()), + c.triggerHandler("blur"), + j(); + }) + .on("input-keydown", function (c) { + var d, + e, + f, + g, + h = c.keyCode, + j = {}; + i.isModifierOn(c) || + -1 === l.indexOf(h) || + ((j[a.enter] = o.addOnEnter), + (j[a.comma] = o.addOnComma), + (j[a.space] = o.addOnSpace), + (d = !o.addFromAutocompleteOnly && j[h]), + (e = (h === a.backspace || h === a["delete"]) && m.selected), + (g = + h === a.backspace && + 0 === b.newTag.text().length && + o.enableEditingLastTag), + (f = + (h === a.backspace || h === a.left || h === a.right) && + 0 === b.newTag.text().length && + !o.enableEditingLastTag), + d + ? m.addText(b.newTag.text()) + : g + ? (m.selectPrior(), + m.removeSelected().then(function (a) { + a && b.newTag.text(a[o.displayProperty]); + })) + : e + ? m.removeSelected() + : f && + (h === a.left || h === a.backspace + ? m.selectPrior() + : h === a.right && m.selectNext()), + (d || f || e || g) && c.preventDefault()); + }) + .on("input-paste", function (a) { + if (o.addOnPaste) { + var b = a.getTextData(), + c = b.split(o.pasteSplitPattern); + c.length > 1 && + (c.forEach(function (a) { + m.addText(a); + }), + a.preventDefault()); + } + }); }, - keySize: 6, - ivSize: 2, - blockSize: 2, - })); - t.TripleDES = r._createHelper(s); - })(), - (function () { - var t = bt, - e = t.lib.StreamCipher, - r = t.algo, - i = (r.RC4 = e.extend({ - _doReset: function () { - for ( - var t = this._key, - e = t.words, - r = t.sigBytes, - i = (this._S = []), - n = 0; - n < 256; - n++ - ) - i[n] = n; - n = 0; - for (var o = 0; n < 256; n++) { - var s = n % r, - c = (e[s >>> 2] >>> (24 - (s % 4) * 8)) & 255; - o = (o + i[n] + c) % 256; - var a = i[n]; - (i[n] = i[o]), (i[o] = a); - } - this._i = this._j = 0; - }, - _doProcessBlock: function (t, e) { - t[e] ^= n.call(this); + }; + }, + ]), + d.directive("tiTagItem", [ + "tiUtil", + function (a) { + return { + restrict: "E", + require: "^tagsInput", + template: '', + scope: { $scope: "=scope", data: "=" }, + link: function (b, c, d, e) { + var f = e.registerTagItem(), + g = f.getOptions(); + (b.$$template = g.template), + (b.$$removeTagSymbol = g.removeTagSymbol), + (b.$getDisplayText = function () { + return a.safeToString(b.data[g.displayProperty]); + }), + (b.$removeTag = function () { + f.removeTag(b.$index); + }), + b.$watch("$parent.$index", function (a) { + b.$index = a; + }); }, - keySize: 8, - ivSize: 0, - })); - function n() { - for ( - var t = this._S, e = this._i, r = this._j, i = 0, n = 0; - n < 4; - n++ - ) { - r = (r + t[(e = (e + 1) % 256)]) % 256; - var o = t[e]; - (t[e] = t[r]), - (t[r] = o), - (i |= t[(t[e] + t[r]) % 256] << (24 - 8 * n)); - } - return (this._i = e), (this._j = r), i; - } - t.RC4 = e._createHelper(i); - var o = (r.RC4Drop = i.extend({ - cfg: i.cfg.extend({ drop: 192 }), - _doReset: function () { - i._doReset.call(this); - for (var t = this.cfg.drop; 0 < t; t--) n.call(this); - }, - })); - t.RC4Drop = e._createHelper(o); - })(), - (bt.mode.CTRGladman = - ((ot = bt.lib.BlockCipherMode.extend()), - (st = ot.Encryptor = ot.extend({ - processBlock: function (t, e) { - var r, - i = this._cipher, - n = i.blockSize, - o = this._iv, - s = this._counter; - o && ((s = this._counter = o.slice(0)), (this._iv = void 0)), - 0 === ((r = s)[0] = Et(r[0])) && (r[1] = Et(r[1])); - var c = s.slice(0); - i.encryptBlock(c, 0); - for (var a = 0; a < n; a++) t[e + a] ^= c[a]; - }, - })), - (ot.Decryptor = st), - ot)), - (at = (ct = bt).lib.StreamCipher), - (ht = ct.algo), - (lt = []), - (ft = []), - (dt = []), - (ut = ht.Rabbit = at.extend({ - _doReset: function () { - for (var t = this._key.words, e = this.cfg.iv, r = 0; r < 4; r++) - t[r] = - (16711935 & ((t[r] << 8) | (t[r] >>> 24))) | - (4278255360 & ((t[r] << 24) | (t[r] >>> 8))); - var i = (this._X = [ - t[0], - (t[3] << 16) | (t[2] >>> 16), - t[1], - (t[0] << 16) | (t[3] >>> 16), - t[2], - (t[1] << 16) | (t[0] >>> 16), - t[3], - (t[2] << 16) | (t[1] >>> 16), - ]), - n = (this._C = [ - (t[2] << 16) | (t[2] >>> 16), - (4294901760 & t[0]) | (65535 & t[1]), - (t[3] << 16) | (t[3] >>> 16), - (4294901760 & t[1]) | (65535 & t[2]), - (t[0] << 16) | (t[0] >>> 16), - (4294901760 & t[2]) | (65535 & t[3]), - (t[1] << 16) | (t[1] >>> 16), - (4294901760 & t[3]) | (65535 & t[0]), - ]); - for (r = this._b = 0; r < 4; r++) Rt.call(this); - for (r = 0; r < 8; r++) n[r] ^= i[(r + 4) & 7]; - if (e) { - var o = e.words, - s = o[0], - c = o[1], - a = - (16711935 & ((s << 8) | (s >>> 24))) | - (4278255360 & ((s << 24) | (s >>> 8))), - h = - (16711935 & ((c << 8) | (c >>> 24))) | - (4278255360 & ((c << 24) | (c >>> 8))), - l = (a >>> 16) | (4294901760 & h), - f = (h << 16) | (65535 & a); - (n[0] ^= a), - (n[1] ^= l), - (n[2] ^= h), - (n[3] ^= f), - (n[4] ^= a), - (n[5] ^= l), - (n[6] ^= h), - (n[7] ^= f); - for (r = 0; r < 4; r++) Rt.call(this); - } - }, - _doProcessBlock: function (t, e) { - var r = this._X; - Rt.call(this), - (lt[0] = r[0] ^ (r[5] >>> 16) ^ (r[3] << 16)), - (lt[1] = r[2] ^ (r[7] >>> 16) ^ (r[5] << 16)), - (lt[2] = r[4] ^ (r[1] >>> 16) ^ (r[7] << 16)), - (lt[3] = r[6] ^ (r[3] >>> 16) ^ (r[1] << 16)); - for (var i = 0; i < 4; i++) - (lt[i] = - (16711935 & ((lt[i] << 8) | (lt[i] >>> 24))) | - (4278255360 & ((lt[i] << 24) | (lt[i] >>> 8)))), - (t[e + i] ^= lt[i]); + }; }, - blockSize: 4, - ivSize: 2, - })), - (ct.Rabbit = at._createHelper(ut)), - (bt.mode.CTR = - ((pt = bt.lib.BlockCipherMode.extend()), - (_t = pt.Encryptor = pt.extend({ - processBlock: function (t, e) { - var r = this._cipher, - i = r.blockSize, - n = this._iv, - o = this._counter; - n && ((o = this._counter = n.slice(0)), (this._iv = void 0)); - var s = o.slice(0); - r.encryptBlock(s, 0), (o[i - 1] = (o[i - 1] + 1) | 0); - for (var c = 0; c < i; c++) t[e + c] ^= s[c]; - }, - })), - (pt.Decryptor = _t), - pt)), - (yt = (vt = bt).lib.StreamCipher), - (gt = vt.algo), - (Bt = []), - (wt = []), - (kt = []), - (St = gt.RabbitLegacy = yt.extend({ - _doReset: function () { - for ( - var t = this._key.words, - e = this.cfg.iv, - r = (this._X = [ - t[0], - (t[3] << 16) | (t[2] >>> 16), - t[1], - (t[0] << 16) | (t[3] >>> 16), - t[2], - (t[1] << 16) | (t[0] >>> 16), - t[3], - (t[2] << 16) | (t[1] >>> 16), - ]), - i = (this._C = [ - (t[2] << 16) | (t[2] >>> 16), - (4294901760 & t[0]) | (65535 & t[1]), - (t[3] << 16) | (t[3] >>> 16), - (4294901760 & t[1]) | (65535 & t[2]), - (t[0] << 16) | (t[0] >>> 16), - (4294901760 & t[2]) | (65535 & t[3]), - (t[1] << 16) | (t[1] >>> 16), - (4294901760 & t[3]) | (65535 & t[0]), - ]), - n = (this._b = 0); - n < 4; - n++ - ) - Mt.call(this); - for (n = 0; n < 8; n++) i[n] ^= r[(n + 4) & 7]; - if (e) { - var o = e.words, - s = o[0], - c = o[1], - a = - (16711935 & ((s << 8) | (s >>> 24))) | - (4278255360 & ((s << 24) | (s >>> 8))), - h = - (16711935 & ((c << 8) | (c >>> 24))) | - (4278255360 & ((c << 24) | (c >>> 8))), - l = (a >>> 16) | (4294901760 & h), - f = (h << 16) | (65535 & a); - (i[0] ^= a), - (i[1] ^= l), - (i[2] ^= h), - (i[3] ^= f), - (i[4] ^= a), - (i[5] ^= l), - (i[6] ^= h), - (i[7] ^= f); - for (n = 0; n < 4; n++) Mt.call(this); + ]), + d.directive("autoComplete", [ + "$document", + "$timeout", + "$sce", + "$q", + "tagsInputConfig", + "tiUtil", + function (b, c, d, e, f, g) { + function h(a, b, c) { + var d, + f, + h, + i = {}; + return ( + (h = function () { + return b.tagsInput.keyProperty || b.tagsInput.displayProperty; + }), + (d = function (a, c) { + return a.filter(function (a) { + return !g.findInObjectArray(c, a, h(), function (a, c) { + return ( + b.tagsInput.replaceSpacesWithDashes && + ((a = g.replaceSpacesWithDashes(a)), + (c = g.replaceSpacesWithDashes(c))), + g.defaultComparer(a, c) + ); + }); + }); + }), + (i.reset = function () { + (f = null), + (i.items = []), + (i.visible = !1), + (i.index = -1), + (i.selected = null), + (i.query = null); + }), + (i.show = function () { + b.selectFirstMatch ? i.select(0) : (i.selected = null), + (i.visible = !0); + }), + (i.load = g.debounce(function (c, j) { + i.query = c; + var k = e.when(a({ $query: c })); + (f = k), + k.then(function (a) { + k === f && + ((a = g.makeObjectArray(a.data || a, h())), + (a = d(a, j)), + (i.items = a.slice(0, b.maxResultsToShow)), + i.items.length > 0 ? i.show() : i.reset()); + }); + }, b.debounceDelay)), + (i.selectNext = function () { + i.select(++i.index); + }), + (i.selectPrior = function () { + i.select(--i.index); + }), + (i.select = function (a) { + 0 > a ? (a = i.items.length - 1) : a >= i.items.length && (a = 0), + (i.index = a), + (i.selected = i.items[a]), + c.trigger("suggestion-selected", a); + }), + i.reset(), + i + ); + } + function i(a, b) { + var c = a.find("li").eq(b), + d = c.parent(), + e = c.prop("offsetTop"), + f = c.prop("offsetHeight"), + g = d.prop("clientHeight"), + h = d.prop("scrollTop"); + h > e + ? d.prop("scrollTop", e) + : e + f > g + h && d.prop("scrollTop", e + f - g); } + return { + restrict: "E", + require: "^tagsInput", + scope: { source: "&", matchClass: "&" }, + templateUrl: "ngTagsInput/auto-complete.html", + controller: [ + "$scope", + "$element", + "$attrs", + function (a, b, c) { + (a.events = g.simplePubSub()), + f.load("autoComplete", a, c, { + template: [String, "ngTagsInput/auto-complete-match.html"], + debounceDelay: [Number, 100], + minLength: [Number, 3], + highlightMatchedText: [Boolean, !0], + maxResultsToShow: [Number, 10], + loadOnDownArrow: [Boolean, !1], + loadOnEmpty: [Boolean, !1], + loadOnFocus: [Boolean, !1], + selectFirstMatch: [Boolean, !0], + displayProperty: [String, ""], + }), + (a.suggestionList = new h(a.source, a.options, a.events)), + (this.registerAutocompleteMatch = function () { + return { + getOptions: function () { + return a.options; + }, + getQuery: function () { + return a.suggestionList.query; + }, + }; + }); + }, + ], + link: function (b, c, d, e) { + var f, + h = [a.enter, a.tab, a.escape, a.up, a.down], + j = b.suggestionList, + k = e.registerAutocomplete(), + l = b.options, + m = b.events; + (l.tagsInput = k.getOptions()), + (f = function (a) { + return (a && a.length >= l.minLength) || (!a && l.loadOnEmpty); + }), + (b.templateScope = k.getTemplateScope()), + (b.addSuggestionByIndex = function (a) { + j.select(a), b.addSuggestion(); + }), + (b.addSuggestion = function () { + var a = !1; + return ( + j.selected && + (k.addTag(angular.copy(j.selected)), j.reset(), (a = !0)), + a + ); + }), + (b.track = function (a) { + return a[ + l.tagsInput.keyProperty || l.tagsInput.displayProperty + ]; + }), + (b.getSuggestionClass = function (a, c) { + var d = a === j.selected; + return [ + b.matchClass({ $match: a, $index: c, $selected: d }), + { selected: d }, + ]; + }), + k + .on( + "tag-added tag-removed invalid-tag input-blur", + function () { + j.reset(); + } + ) + .on("input-change", function (a) { + f(a) ? j.load(a, k.getTags()) : j.reset(); + }) + .on("input-focus", function () { + var a = k.getCurrentTagText(); + l.loadOnFocus && f(a) && j.load(a, k.getTags()); + }) + .on("input-keydown", function (c) { + var d = c.keyCode, + e = !1; + if (!g.isModifierOn(c) && -1 !== h.indexOf(d)) + return ( + j.visible + ? d === a.down + ? (j.selectNext(), (e = !0)) + : d === a.up + ? (j.selectPrior(), (e = !0)) + : d === a.escape + ? (j.reset(), (e = !0)) + : (d === a.enter || d === a.tab) && + (e = b.addSuggestion()) + : d === a.down && + b.options.loadOnDownArrow && + (j.load(k.getCurrentTagText(), k.getTags()), + (e = !0)), + e + ? (c.preventDefault(), c.stopImmediatePropagation(), !1) + : void 0 + ); + }), + m.on("suggestion-selected", function (a) { + i(c, a); + }); + }, + }; }, - _doProcessBlock: function (t, e) { - var r = this._X; - Mt.call(this), - (Bt[0] = r[0] ^ (r[5] >>> 16) ^ (r[3] << 16)), - (Bt[1] = r[2] ^ (r[7] >>> 16) ^ (r[5] << 16)), - (Bt[2] = r[4] ^ (r[1] >>> 16) ^ (r[7] << 16)), - (Bt[3] = r[6] ^ (r[3] >>> 16) ^ (r[1] << 16)); - for (var i = 0; i < 4; i++) - (Bt[i] = - (16711935 & ((Bt[i] << 8) | (Bt[i] >>> 24))) | - (4278255360 & ((Bt[i] << 24) | (Bt[i] >>> 8)))), - (t[e + i] ^= Bt[i]); + ]), + d.directive("tiAutocompleteMatch", [ + "$sce", + "tiUtil", + function (a, b) { + return { + restrict: "E", + require: "^autoComplete", + template: '', + scope: { $scope: "=scope", data: "=" }, + link: function (c, d, e, f) { + var g = f.registerAutocompleteMatch(), + h = g.getOptions(); + (c.$$template = h.template), + (c.$index = c.$parent.$index), + (c.$highlight = function (c) { + return ( + h.highlightMatchedText && + (c = b.safeHighlight(c, g.getQuery())), + a.trustAsHtml(c) + ); + }), + (c.$getDisplayText = function () { + return b.safeToString( + c.data[h.displayProperty || h.tagsInput.displayProperty] + ); + }); + }, + }; + }, + ]), + d.directive("tiTranscludeAppend", function () { + return function (a, b, c, d, e) { + e(function (a) { + b.append(a); + }); + }; + }), + d.directive("tiAutosize", [ + "tagsInputConfig", + function (a) { + return { + restrict: "A", + require: "ngModel", + link: function (b, c, d, e) { + var f, + g, + h = a.getTextAutosizeThreshold(); + (f = angular.element('')), + f + .css("display", "none") + .css("visibility", "hidden") + .css("width", "auto") + .css("white-space", "pre"), + c.parent().append(f), + (g = function (a) { + var b, + e = a; + return ( + angular.isString(e) && 0 === e.length && (e = d.placeholder), + e && + (f.text(e), + f.css("display", ""), + (b = f.prop("offsetWidth")), + f.css("display", "none")), + c.css("width", b ? b + h + "px" : ""), + a + ); + }), + e.$parsers.unshift(g), + e.$formatters.unshift(g), + d.$observe("placeholder", function (a) { + e.$modelValue || g(a); + }); + }, + }; }, - blockSize: 4, - ivSize: 2, - })), - (vt.RabbitLegacy = yt._createHelper(St)), - (bt.pad.ZeroPadding = { - pad: function (t, e) { - var r = 4 * e; - t.clamp(), (t.sigBytes += r - (t.sigBytes % r || r)); + ]), + d.directive("tiBindAttrs", function () { + return function (a, b, c) { + a.$watch( + c.tiBindAttrs, + function (a) { + angular.forEach(a, function (a, b) { + c.$set(b, a); + }); + }, + !0 + ); + }; + }), + d.provider("tagsInputConfig", function () { + var a = {}, + b = {}, + c = 3; + (this.setDefaults = function (b, c) { + return (a[b] = c), this; + }), + (this.setActiveInterpolation = function (a, c) { + return (b[a] = c), this; + }), + (this.setTextAutosizeThreshold = function (a) { + return (c = a), this; + }), + (this.$get = [ + "$interpolate", + function (d) { + var e = {}; + return ( + (e[String] = function (a) { + return a; + }), + (e[Number] = function (a) { + return parseInt(a, 10); + }), + (e[Boolean] = function (a) { + return "true" === a.toLowerCase(); + }), + (e[RegExp] = function (a) { + return new RegExp(a); + }), + { + load: function (c, f, g, h) { + var i = function () { + return !0; + }; + (f.options = {}), + angular.forEach(h, function (h, j) { + var k, l, m, n, o, p; + (k = h[0]), + (l = h[1]), + (m = h[2] || i), + (n = e[k]), + (o = function () { + var b = a[c] && a[c][j]; + return angular.isDefined(b) ? b : l; + }), + (p = function (a) { + f.options[j] = a && m(a) ? n(a) : o(); + }), + b[c] && b[c][j] + ? g.$observe(j, function (a) { + p(a), + f.events.trigger("option-change", { + name: j, + newValue: a, + }); + }) + : p(g[j] && d(g[j])(f.$parent)); + }); + }, + getTextAutosizeThreshold: function () { + return c; + }, + } + ); + }, + ]); + }), + d.factory("tiUtil", [ + "$timeout", + "$q", + function (a, b) { + var c = {}; + return ( + (c.debounce = function (b, c) { + var d; + return function () { + var e = arguments; + a.cancel(d), + (d = a(function () { + b.apply(null, e); + }, c)); + }; + }), + (c.makeObjectArray = function (a, b) { + if (!angular.isArray(a) || 0 === a.length || angular.isObject(a[0])) + return a; + var c = []; + return ( + a.forEach(function (a) { + var d = {}; + (d[b] = a), c.push(d); + }), + c + ); + }), + (c.findInObjectArray = function (a, b, d, e) { + var f = null; + return ( + (e = e || c.defaultComparer), + a.some(function (a) { + return e(a[d], b[d]) ? ((f = a), !0) : void 0; + }), + f + ); + }), + (c.defaultComparer = function (a, b) { + return ( + c.safeToString(a).toLowerCase() === + c.safeToString(b).toLowerCase() + ); + }), + (c.safeHighlight = function (a, b) { + function d(a) { + return a.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); + } + if (((a = c.encodeHTML(a)), (b = c.encodeHTML(b)), !b)) return a; + var e = new RegExp("&[^;]+;|" + d(b), "gi"); + return a.replace(e, function (a) { + return a.toLowerCase() === b.toLowerCase() + ? "" + a + "" + : a; + }); + }), + (c.safeToString = function (a) { + return angular.isUndefined(a) || null == a + ? "" + : a.toString().trim(); + }), + (c.encodeHTML = function (a) { + return c + .safeToString(a) + .replace(/&/g, "&") + .replace(//g, ">"); + }), + (c.handleUndefinedResult = function (a, b) { + return function () { + var c = a.apply(null, arguments); + return angular.isUndefined(c) ? b : c; + }; + }), + (c.replaceSpacesWithDashes = function (a) { + return c.safeToString(a).replace(/\s/g, "-"); + }), + (c.isModifierOn = function (a) { + return a.shiftKey || a.ctrlKey || a.altKey || a.metaKey; + }), + (c.promisifyValue = function (a) { + return ( + (a = angular.isUndefined(a) ? !0 : a), b[a ? "when" : "reject"]() + ); + }), + (c.simplePubSub = function () { + var a = {}; + return { + on: function (b, c, d) { + return ( + b.split(" ").forEach(function (b) { + a[b] || (a[b] = []); + var e = d ? [].unshift : [].push; + e.call(a[b], c); + }), + this + ); + }, + trigger: function (b, d) { + var e = a[b] || []; + return ( + e.every(function (a) { + return c.handleUndefinedResult(a, !0)(d); + }), + this + ); + }, + }; + }), + c + ); }, - unpad: function (t) { - var e = t.words, - r = t.sigBytes - 1; - for (r = t.sigBytes - 1; 0 <= r; r--) - if ((e[r >>> 2] >>> (24 - (r % 4) * 8)) & 255) { - t.sigBytes = r + 1; - break; - } + ]), + d.run([ + "$templateCache", + function (a) { + a.put( + "ngTagsInput/tags-input.html", + '
    ' + ), + a.put( + "ngTagsInput/tag-item.html", + ' ' + ), + a.put( + "ngTagsInput/auto-complete.html", + '
    ' + ), + a.put( + "ngTagsInput/auto-complete-match.html", + '' + ); }, - }), - bt - ); -}); + ]); +})(); var t,e;t=self,e=()=>(()=>{var t={d:(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})}};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"t",{value:!0})};var e,s={};t.r(s),t.d(s,{AbortError:()=>r,DefaultHttpClient:()=>H,HttpClient:()=>d,HttpError:()=>i,HttpResponse:()=>u,HttpTransportType:()=>F,HubConnection:()=>q,HubConnectionBuilder:()=>tt,HubConnectionState:()=>A,JsonHubProtocol:()=>Y,LogLevel:()=>e,MessageType:()=>x,NullLogger:()=>f,Subject:()=>U,TimeoutError:()=>n,TransferFormat:()=>B,VERSION:()=>p});class i extends Error{constructor(t,e){const s=new.target.prototype;super(`${t}: Status code '${e}'`),this.statusCode=e,this.__proto__=s}}class n extends Error{constructor(t="A timeout occurred."){const e=new.target.prototype;super(t),this.__proto__=e}}class r extends Error{constructor(t="An abort occurred."){const e=new.target.prototype;super(t),this.__proto__=e}}class o extends Error{constructor(t,e){const s=new.target.prototype;super(t),this.transport=e,this.errorType="UnsupportedTransportError",this.__proto__=s}}class h extends Error{constructor(t,e){const s=new.target.prototype;super(t),this.transport=e,this.errorType="DisabledTransportError",this.__proto__=s}}class c extends Error{constructor(t,e){const s=new.target.prototype;super(t),this.transport=e,this.errorType="FailedToStartTransportError",this.__proto__=s}}class a extends Error{constructor(t){const e=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=e}}class l extends Error{constructor(t,e){const s=new.target.prototype;super(t),this.innerErrors=e,this.__proto__=s}}class u{constructor(t,e,s){this.statusCode=t,this.statusText=e,this.content=s}}class d{get(t,e){return this.send({...e,method:"GET",url:t})}post(t,e){return this.send({...e,method:"POST",url:t})}delete(t,e){return this.send({...e,method:"DELETE",url:t})}getCookieString(t){return""}}!function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Information=2]="Information",t[t.Warning=3]="Warning",t[t.Error=4]="Error",t[t.Critical=5]="Critical",t[t.None=6]="None"}(e||(e={}));class f{constructor(){}log(t,e){}}f.instance=new f;const p="8.0.7";class w{static isRequired(t,e){if(null==t)throw new Error(`The '${e}' argument is required.`)}static isNotEmpty(t,e){if(!t||t.match(/^\s*$/))throw new Error(`The '${e}' argument should not be empty.`)}static isIn(t,e,s){if(!(t in e))throw new Error(`Unknown ${s} value: ${t}.`)}}class g{static get isBrowser(){return!g.isNode&&"object"==typeof window&&"object"==typeof window.document}static get isWebWorker(){return!g.isNode&&"object"==typeof self&&"importScripts"in self}static get isReactNative(){return!g.isNode&&"object"==typeof window&&void 0===window.document}static get isNode(){return"undefined"!=typeof process&&process.release&&"node"===process.release.name}}function m(t,e){let s="";return y(t)?(s=`Binary data of length ${t.byteLength}`,e&&(s+=`. Content: '${function(t){const e=new Uint8Array(t);let s="";return e.forEach((t=>{s+=`0x${t<16?"0":""}${t.toString(16)} `})),s.substr(0,s.length-1)}(t)}'`)):"string"==typeof t&&(s=`String data of length ${t.length}`,e&&(s+=`. Content: '${t}'`)),s}function y(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}async function b(t,s,i,n,r,o){const h={},[c,a]=$();h[c]=a,t.log(e.Trace,`(${s} transport) sending data. ${m(r,o.logMessageContent)}.`);const l=y(r)?"arraybuffer":"text",u=await i.post(n,{content:r,headers:{...h,...o.headers},responseType:l,timeout:o.timeout,withCredentials:o.withCredentials});t.log(e.Trace,`(${s} transport) request complete. Response status: ${u.statusCode}.`)}class v{constructor(t,e){this.i=t,this.h=e}dispose(){const t=this.i.observers.indexOf(this.h);t>-1&&this.i.observers.splice(t,1),0===this.i.observers.length&&this.i.cancelCallback&&this.i.cancelCallback().catch((t=>{}))}}class E{constructor(t){this.l=t,this.out=console}log(t,s){if(t>=this.l){const i=`[${(new Date).toISOString()}] ${e[t]}: ${s}`;switch(t){case e.Critical:case e.Error:this.out.error(i);break;case e.Warning:this.out.warn(i);break;case e.Information:this.out.info(i);break;default:this.out.log(i)}}}}function $(){let t="X-SignalR-User-Agent";return g.isNode&&(t="User-Agent"),[t,C(p,S(),g.isNode?"NodeJS":"Browser",k())]}function C(t,e,s,i){let n="Microsoft SignalR/";const r=t.split(".");return n+=`${r[0]}.${r[1]}`,n+=` (${t}; `,n+=e&&""!==e?`${e}; `:"Unknown OS; ",n+=`${s}`,n+=i?`; ${i}`:"; Unknown Runtime Version",n+=")",n}function S(){if(!g.isNode)return"";switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}function k(){if(g.isNode)return process.versions.node}function P(t){return t.stack?t.stack:t.message?t.message:`${t}`}class T extends d{constructor(e){if(super(),this.u=e,"undefined"==typeof fetch||g.isNode){const t=require;this.p=new(t("tough-cookie").CookieJar),"undefined"==typeof fetch?this.m=t("node-fetch"):this.m=fetch,this.m=t("fetch-cookie")(this.m,this.p)}else this.m=fetch.bind(function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==t.g)return t.g;throw new Error("could not find global")}());if("undefined"==typeof AbortController){const t=require;this.v=t("abort-controller")}else this.v=AbortController}async send(t){if(t.abortSignal&&t.abortSignal.aborted)throw new r;if(!t.method)throw new Error("No method defined.");if(!t.url)throw new Error("No url defined.");const s=new this.v;let o;t.abortSignal&&(t.abortSignal.onabort=()=>{s.abort(),o=new r});let h,c=null;if(t.timeout){const i=t.timeout;c=setTimeout((()=>{s.abort(),this.u.log(e.Warning,"Timeout from HTTP request."),o=new n}),i)}""===t.content&&(t.content=void 0),t.content&&(t.headers=t.headers||{},y(t.content)?t.headers["Content-Type"]="application/octet-stream":t.headers["Content-Type"]="text/plain;charset=UTF-8");try{h=await this.m(t.url,{body:t.content,cache:"no-cache",credentials:!0===t.withCredentials?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:s.signal})}catch(t){if(o)throw o;throw this.u.log(e.Warning,`Error from HTTP request. ${t}.`),t}finally{c&&clearTimeout(c),t.abortSignal&&(t.abortSignal.onabort=null)}if(!h.ok){const t=await I(h,"text");throw new i(t||h.statusText,h.status)}const a=I(h,t.responseType),l=await a;return new u(h.status,h.statusText,l)}getCookieString(t){let e="";return g.isNode&&this.p&&this.p.getCookies(t,((t,s)=>e=s.join("; "))),e}}function I(t,e){let s;switch(e){case"arraybuffer":s=t.arrayBuffer();break;case"text":default:s=t.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`)}return s}class _ extends d{constructor(t){super(),this.u=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new r):t.method?t.url?new Promise(((s,o)=>{const h=new XMLHttpRequest;h.open(t.method,t.url,!0),h.withCredentials=void 0===t.withCredentials||t.withCredentials,h.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===t.content&&(t.content=void 0),t.content&&(y(t.content)?h.setRequestHeader("Content-Type","application/octet-stream"):h.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const c=t.headers;c&&Object.keys(c).forEach((t=>{h.setRequestHeader(t,c[t])})),t.responseType&&(h.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{h.abort(),o(new r)}),t.timeout&&(h.timeout=t.timeout),h.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),h.status>=200&&h.status<300?s(new u(h.status,h.statusText,h.response||h.responseText)):o(new i(h.response||h.responseText||h.statusText,h.status))},h.onerror=()=>{this.u.log(e.Warning,`Error from HTTP request. ${h.status}: ${h.statusText}.`),o(new i(h.statusText,h.status))},h.ontimeout=()=>{this.u.log(e.Warning,"Timeout from HTTP request."),o(new n)},h.send(t.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class H extends d{constructor(t){if(super(),"undefined"!=typeof fetch||g.isNode)this.$=new T(t);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this.$=new _(t)}}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new r):t.method?t.url?this.$.send(t):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(t){return this.$.getCookieString(t)}}class D{static write(t){return`${t}${D.RecordSeparator}`}static parse(t){if(t[t.length-1]!==D.RecordSeparator)throw new Error("Message is incomplete.");const e=t.split(D.RecordSeparator);return e.pop(),e}}D.RecordSeparatorCode=30,D.RecordSeparator=String.fromCharCode(D.RecordSeparatorCode);class R{writeHandshakeRequest(t){return D.write(JSON.stringify(t))}parseHandshakeResponse(t){let e,s;if(y(t)){const i=new Uint8Array(t),n=i.indexOf(D.RecordSeparatorCode);if(-1===n)throw new Error("Message is incomplete.");const r=n+1;e=String.fromCharCode.apply(null,Array.prototype.slice.call(i.slice(0,r))),s=i.byteLength>r?i.slice(r).buffer:null}else{const i=t,n=i.indexOf(D.RecordSeparator);if(-1===n)throw new Error("Message is incomplete.");const r=n+1;e=i.substring(0,r),s=i.length>r?i.substring(r):null}const i=D.parse(e),n=JSON.parse(i[0]);if(n.type)throw new Error("Expected a handshake response from the server.");return[s,n]}}var x,A;!function(t){t[t.Invocation=1]="Invocation",t[t.StreamItem=2]="StreamItem",t[t.Completion=3]="Completion",t[t.StreamInvocation=4]="StreamInvocation",t[t.CancelInvocation=5]="CancelInvocation",t[t.Ping=6]="Ping",t[t.Close=7]="Close",t[t.Ack=8]="Ack",t[t.Sequence=9]="Sequence"}(x||(x={}));class U{constructor(){this.observers=[]}next(t){for(const e of this.observers)e.next(t)}error(t){for(const e of this.observers)e.error&&e.error(t)}complete(){for(const t of this.observers)t.complete&&t.complete()}subscribe(t){return this.observers.push(t),new v(this,t)}}class L{constructor(t,e,s){this.C=1e5,this.S=[],this.k=0,this.P=!1,this.T=1,this.I=0,this._=0,this.H=!1,this.D=t,this.R=e,this.C=s}async A(t){const e=this.D.writeMessage(t);let s=Promise.resolve();if(this.U(t)){this.k++;let t=()=>{},i=()=>{};y(e)?this._+=e.byteLength:this._+=e.length,this._>=this.C&&(s=new Promise(((e,s)=>{t=e,i=s}))),this.S.push(new N(e,this.k,t,i))}try{this.H||await this.R.send(e)}catch{this.L()}await s}N(t){let e=-1;for(let s=0;sthis.T?this.R.stop(new Error("Sequence ID greater than amount of messages we've received.")):this.T=t.sequenceId}L(){this.H=!0,this.P=!0}async B(){const t=0!==this.S.length?this.S[0].q:this.k+1;await this.R.send(this.D.writeMessage({type:x.Sequence,sequenceId:t}));const e=this.S;for(const t of e)await this.R.send(t.M);this.H=!1}X(t){null!=t||(t=new Error("Unable to reconnect to server."));for(const e of this.S)e.J(t)}U(t){switch(t.type){case x.Invocation:case x.StreamItem:case x.Completion:case x.StreamInvocation:case x.CancelInvocation:return!0;case x.Close:case x.Sequence:case x.Ping:case x.Ack:return!1}}O(){void 0===this.V&&(this.V=setTimeout((async()=>{try{this.H||await this.R.send(this.D.writeMessage({type:x.Ack,sequenceId:this.I}))}catch{}clearTimeout(this.V),this.V=void 0}),1e3))}}class N{constructor(t,e,s,i){this.M=t,this.q=e,this.j=s,this.J=i}}!function(t){t.Disconnected="Disconnected",t.Connecting="Connecting",t.Connected="Connected",t.Disconnecting="Disconnecting",t.Reconnecting="Reconnecting"}(A||(A={}));class q{static create(t,e,s,i,n,r,o){return new q(t,e,s,i,n,r,o)}constructor(t,s,i,n,r,o,h){this.K=0,this.G=()=>{this.u.log(e.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},w.isRequired(t,"connection"),w.isRequired(s,"logger"),w.isRequired(i,"protocol"),this.serverTimeoutInMilliseconds=null!=r?r:3e4,this.keepAliveIntervalInMilliseconds=null!=o?o:15e3,this.Y=null!=h?h:1e5,this.u=s,this.D=i,this.connection=t,this.Z=n,this.tt=new R,this.connection.onreceive=t=>this.et(t),this.connection.onclose=t=>this.st(t),this.it={},this.nt={},this.rt=[],this.ot=[],this.ht=[],this.ct=0,this.lt=!1,this.ut=A.Disconnected,this.dt=!1,this.ft=this.D.writeMessage({type:x.Ping})}get state(){return this.ut}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this.ut!==A.Disconnected&&this.ut!==A.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this.wt=this.gt(),this.wt}async gt(){if(this.ut!==A.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this.ut=A.Connecting,this.u.log(e.Debug,"Starting HubConnection.");try{await this.yt(),g.isBrowser&&window.document.addEventListener("freeze",this.G),this.ut=A.Connected,this.dt=!0,this.u.log(e.Debug,"HubConnection connected successfully.")}catch(t){return this.ut=A.Disconnected,this.u.log(e.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async yt(){this.bt=void 0,this.lt=!1;const t=new Promise(((t,e)=>{this.vt=t,this.Et=e}));await this.connection.start(this.D.transferFormat);try{let s=this.D.version;this.connection.features.reconnect||(s=1);const i={protocol:this.D.name,version:s};if(this.u.log(e.Debug,"Sending handshake request."),await this.$t(this.tt.writeHandshakeRequest(i)),this.u.log(e.Information,`Using HubProtocol '${this.D.name}'.`),this.Ct(),this.St(),this.kt(),await t,this.bt)throw this.bt;!!this.connection.features.reconnect&&(this.Pt=new L(this.D,this.connection,this.Y),this.connection.features.disconnected=this.Pt.L.bind(this.Pt),this.connection.features.resend=()=>{if(this.Pt)return this.Pt.B()}),this.connection.features.inherentKeepAlive||await this.$t(this.ft)}catch(t){throw this.u.log(e.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this.Ct(),this.Tt(),await this.connection.stop(t),t}}async stop(){const t=this.wt;this.connection.features.reconnect=!1,this.It=this._t(),await this.It;try{await t}catch(t){}}_t(t){if(this.ut===A.Disconnected)return this.u.log(e.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this.ut===A.Disconnecting)return this.u.log(e.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this.It;const s=this.ut;return this.ut=A.Disconnecting,this.u.log(e.Debug,"Stopping HubConnection."),this.Ht?(this.u.log(e.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this.Ht),this.Ht=void 0,this.Dt(),Promise.resolve()):(s===A.Connected&&this.Rt(),this.Ct(),this.Tt(),this.bt=t||new r("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}async Rt(){try{await this.xt(this.At())}catch{}}stream(t,...e){const[s,i]=this.Ut(e),n=this.Lt(t,e,i);let r;const o=new U;return o.cancelCallback=()=>{const t=this.Nt(n.invocationId);return delete this.it[n.invocationId],r.then((()=>this.xt(t)))},this.it[n.invocationId]=(t,e)=>{e?o.error(e):t&&(t.type===x.Completion?t.error?o.error(new Error(t.error)):o.complete():o.next(t.item))},r=this.xt(n).catch((t=>{o.error(t),delete this.it[n.invocationId]})),this.qt(s,r),o}$t(t){return this.kt(),this.connection.send(t)}xt(t){return this.Pt?this.Pt.A(t):this.$t(this.D.writeMessage(t))}send(t,...e){const[s,i]=this.Ut(e),n=this.xt(this.Mt(t,e,!0,i));return this.qt(s,n),n}invoke(t,...e){const[s,i]=this.Ut(e),n=this.Mt(t,e,!1,i);return new Promise(((t,e)=>{this.it[n.invocationId]=(s,i)=>{i?e(i):s&&(s.type===x.Completion?s.error?e(new Error(s.error)):t(s.result):e(new Error(`Unexpected message type: ${s.type}`)))};const i=this.xt(n).catch((t=>{e(t),delete this.it[n.invocationId]}));this.qt(s,i)}))}on(t,e){t&&e&&(t=t.toLowerCase(),this.nt[t]||(this.nt[t]=[]),-1===this.nt[t].indexOf(e)&&this.nt[t].push(e))}off(t,e){if(!t)return;t=t.toLowerCase();const s=this.nt[t];if(s)if(e){const i=s.indexOf(e);-1!==i&&(s.splice(i,1),0===s.length&&delete this.nt[t])}else delete this.nt[t]}onclose(t){t&&this.rt.push(t)}onreconnecting(t){t&&this.ot.push(t)}onreconnected(t){t&&this.ht.push(t)}et(t){if(this.Ct(),this.lt||(t=this.jt(t),this.lt=!0),t){const s=this.D.parseMessages(t,this.u);for(const t of s)if(!this.Pt||this.Pt.W(t))switch(t.type){case x.Invocation:this.Wt(t).catch((t=>{this.u.log(e.Error,`Invoke client method threw error: ${P(t)}`)}));break;case x.StreamItem:case x.Completion:{const s=this.it[t.invocationId];if(s){t.type===x.Completion&&delete this.it[t.invocationId];try{s(t)}catch(t){this.u.log(e.Error,`Stream callback threw error: ${P(t)}`)}}break}case x.Ping:break;case x.Close:{this.u.log(e.Information,"Close message received from server.");const s=t.error?new Error("Server returned an error on close: "+t.error):void 0;!0===t.allowReconnect?this.connection.stop(s):this.It=this._t(s);break}case x.Ack:this.Pt&&this.Pt.N(t);break;case x.Sequence:this.Pt&&this.Pt.F(t);break;default:this.u.log(e.Warning,`Invalid message type: ${t.type}.`)}}this.St()}jt(t){let s,i;try{[i,s]=this.tt.parseHandshakeResponse(t)}catch(t){const s="Error parsing handshake response: "+t;this.u.log(e.Error,s);const i=new Error(s);throw this.Et(i),i}if(s.error){const t="Server returned handshake error: "+s.error;this.u.log(e.Error,t);const i=new Error(t);throw this.Et(i),i}return this.u.log(e.Debug,"Server handshake complete."),this.vt(),i}kt(){this.connection.features.inherentKeepAlive||(this.K=(new Date).getTime()+this.keepAliveIntervalInMilliseconds,this.Tt())}St(){if(!(this.connection.features&&this.connection.features.inherentKeepAlive||(this.Ot=setTimeout((()=>this.serverTimeout()),this.serverTimeoutInMilliseconds),void 0!==this.Ft))){let t=this.K-(new Date).getTime();t<0&&(t=0),this.Ft=setTimeout((async()=>{if(this.ut===A.Connected)try{await this.$t(this.ft)}catch{this.Tt()}}),t)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async Wt(t){const s=t.target.toLowerCase(),i=this.nt[s];if(!i)return this.u.log(e.Warning,`No client method with the name '${s}' found.`),void(t.invocationId&&(this.u.log(e.Warning,`No result given for '${s}' method and invocation ID '${t.invocationId}'.`),await this.xt(this.Bt(t.invocationId,"Client didn't provide a result.",null))));const n=i.slice(),r=!!t.invocationId;let o,h,c;for(const i of n)try{const n=o;o=await i.apply(this,t.arguments),r&&o&&n&&(this.u.log(e.Error,`Multiple results provided for '${s}'. Sending error to server.`),c=this.Bt(t.invocationId,"Client provided multiple results.",null)),h=void 0}catch(t){h=t,this.u.log(e.Error,`A callback for the method '${s}' threw error '${t}'.`)}c?await this.xt(c):r?(h?c=this.Bt(t.invocationId,`${h}`,null):void 0!==o?c=this.Bt(t.invocationId,null,o):(this.u.log(e.Warning,`No result given for '${s}' method and invocation ID '${t.invocationId}'.`),c=this.Bt(t.invocationId,"Client didn't provide a result.",null)),await this.xt(c)):o&&this.u.log(e.Error,`Result given for '${s}' method but server is not expecting a result.`)}st(t){this.u.log(e.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this.ut}.`),this.bt=this.bt||t||new r("The underlying connection was closed before the hub handshake could complete."),this.vt&&this.vt(),this.Xt(t||new Error("Invocation canceled due to the underlying connection being closed.")),this.Ct(),this.Tt(),this.ut===A.Disconnecting?this.Dt(t):this.ut===A.Connected&&this.Z?this.Jt(t):this.ut===A.Connected&&this.Dt(t)}Dt(t){if(this.dt){this.ut=A.Disconnected,this.dt=!1,this.Pt&&(this.Pt.X(null!=t?t:new Error("Connection closed.")),this.Pt=void 0),g.isBrowser&&window.document.removeEventListener("freeze",this.G);try{this.rt.forEach((e=>e.apply(this,[t])))}catch(s){this.u.log(e.Error,`An onclose callback called with error '${t}' threw error '${s}'.`)}}}async Jt(t){const s=Date.now();let i=0,n=void 0!==t?t:new Error("Attempting to reconnect due to a unknown error."),r=this.zt(i++,0,n);if(null===r)return this.u.log(e.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this.Dt(t);if(this.ut=A.Reconnecting,t?this.u.log(e.Information,`Connection reconnecting because of error '${t}'.`):this.u.log(e.Information,"Connection reconnecting."),0!==this.ot.length){try{this.ot.forEach((e=>e.apply(this,[t])))}catch(s){this.u.log(e.Error,`An onreconnecting callback called with error '${t}' threw error '${s}'.`)}if(this.ut!==A.Reconnecting)return void this.u.log(e.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==r;){if(this.u.log(e.Information,`Reconnect attempt number ${i} will start in ${r} ms.`),await new Promise((t=>{this.Ht=setTimeout(t,r)})),this.Ht=void 0,this.ut!==A.Reconnecting)return void this.u.log(e.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this.yt(),this.ut=A.Connected,this.u.log(e.Information,"HubConnection reconnected successfully."),0!==this.ht.length)try{this.ht.forEach((t=>t.apply(this,[this.connection.connectionId])))}catch(t){this.u.log(e.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${t}'.`)}return}catch(t){if(this.u.log(e.Information,`Reconnect attempt failed because of error '${t}'.`),this.ut!==A.Reconnecting)return this.u.log(e.Debug,`Connection moved to the '${this.ut}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this.ut===A.Disconnecting&&this.Dt());n=t instanceof Error?t:new Error(t.toString()),r=this.zt(i++,Date.now()-s,n)}}this.u.log(e.Information,`Reconnect retries have been exhausted after ${Date.now()-s} ms and ${i} failed attempts. Connection disconnecting.`),this.Dt()}zt(t,s,i){try{return this.Z.nextRetryDelayInMilliseconds({elapsedMilliseconds:s,previousRetryCount:t,retryReason:i})}catch(i){return this.u.log(e.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${s}) threw error '${i}'.`),null}}Xt(t){const s=this.it;this.it={},Object.keys(s).forEach((i=>{const n=s[i];try{n(null,t)}catch(s){this.u.log(e.Error,`Stream 'error' callback called with '${t}' threw error: ${P(s)}`)}}))}Tt(){this.Ft&&(clearTimeout(this.Ft),this.Ft=void 0)}Ct(){this.Ot&&clearTimeout(this.Ot)}Mt(t,e,s,i){if(s)return 0!==i.length?{arguments:e,streamIds:i,target:t,type:x.Invocation}:{arguments:e,target:t,type:x.Invocation};{const s=this.ct;return this.ct++,0!==i.length?{arguments:e,invocationId:s.toString(),streamIds:i,target:t,type:x.Invocation}:{arguments:e,invocationId:s.toString(),target:t,type:x.Invocation}}}qt(t,e){if(0!==t.length){e||(e=Promise.resolve());for(const s in t)t[s].subscribe({complete:()=>{e=e.then((()=>this.xt(this.Bt(s))))},error:t=>{let i;i=t instanceof Error?t.message:t&&t.toString?t.toString():"Unknown error",e=e.then((()=>this.xt(this.Bt(s,i))))},next:t=>{e=e.then((()=>this.xt(this.Vt(s,t))))}})}}Ut(t){const e=[],s=[];for(let i=0;i0)&&(e=!1,this.Zt=await this.Yt()),this.te(t);const s=await this.Qt.send(t);return e&&401===s.statusCode&&this.Yt?(this.Zt=await this.Yt(),this.te(t),await this.Qt.send(t)):s}te(t){t.headers||(t.headers={}),this.Zt?t.headers[W.Authorization]=`Bearer ${this.Zt}`:this.Yt&&t.headers[W.Authorization]&&delete t.headers[W.Authorization]}getCookieString(t){return this.Qt.getCookieString(t)}}var F,B;!function(t){t[t.None=0]="None",t[t.WebSockets=1]="WebSockets",t[t.ServerSentEvents=2]="ServerSentEvents",t[t.LongPolling=4]="LongPolling"}(F||(F={})),function(t){t[t.Text=1]="Text",t[t.Binary=2]="Binary"}(B||(B={}));class X{constructor(){this.ee=!1,this.onabort=null}abort(){this.ee||(this.ee=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this.ee}}class J{get pollAborted(){return this.se.aborted}constructor(t,e,s){this.$=t,this.u=e,this.se=new X,this.ie=s,this.ne=!1,this.onreceive=null,this.onclose=null}async connect(t,s){if(w.isRequired(t,"url"),w.isRequired(s,"transferFormat"),w.isIn(s,B,"transferFormat"),this.re=t,this.u.log(e.Trace,"(LongPolling transport) Connecting."),s===B.Binary&&"undefined"!=typeof XMLHttpRequest&&"string"!=typeof(new XMLHttpRequest).responseType)throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,r]=$(),o={[n]:r,...this.ie.headers},h={abortSignal:this.se.signal,headers:o,timeout:1e5,withCredentials:this.ie.withCredentials};s===B.Binary&&(h.responseType="arraybuffer");const c=`${t}&_=${Date.now()}`;this.u.log(e.Trace,`(LongPolling transport) polling: ${c}.`);const a=await this.$.get(c,h);200!==a.statusCode?(this.u.log(e.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this.oe=new i(a.statusText||"",a.statusCode),this.ne=!1):this.ne=!0,this.he=this.ce(this.re,h)}async ce(t,s){try{for(;this.ne;)try{const n=`${t}&_=${Date.now()}`;this.u.log(e.Trace,`(LongPolling transport) polling: ${n}.`);const r=await this.$.get(n,s);204===r.statusCode?(this.u.log(e.Information,"(LongPolling transport) Poll terminated by server."),this.ne=!1):200!==r.statusCode?(this.u.log(e.Error,`(LongPolling transport) Unexpected response code: ${r.statusCode}.`),this.oe=new i(r.statusText||"",r.statusCode),this.ne=!1):r.content?(this.u.log(e.Trace,`(LongPolling transport) data received. ${m(r.content,this.ie.logMessageContent)}.`),this.onreceive&&this.onreceive(r.content)):this.u.log(e.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(t){this.ne?t instanceof n?this.u.log(e.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this.oe=t,this.ne=!1):this.u.log(e.Trace,`(LongPolling transport) Poll errored after shutdown: ${t.message}`)}}finally{this.u.log(e.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this.ae()}}async send(t){return this.ne?b(this.u,"LongPolling",this.$,this.re,t,this.ie):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this.u.log(e.Trace,"(LongPolling transport) Stopping polling."),this.ne=!1,this.se.abort();try{await this.he,this.u.log(e.Trace,`(LongPolling transport) sending DELETE request to ${this.re}.`);const t={},[s,n]=$();t[s]=n;const r={headers:{...t,...this.ie.headers},timeout:this.ie.timeout,withCredentials:this.ie.withCredentials};let o;try{await this.$.delete(this.re,r)}catch(t){o=t}o?o instanceof i&&(404===o.statusCode?this.u.log(e.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this.u.log(e.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this.u.log(e.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this.u.log(e.Trace,"(LongPolling transport) Stop finished."),this.ae()}}ae(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this.oe&&(t+=" Error: "+this.oe),this.u.log(e.Trace,t),this.onclose(this.oe)}}}class z{constructor(t,e,s,i){this.$=t,this.Zt=e,this.u=s,this.ie=i,this.onreceive=null,this.onclose=null}async connect(t,s){return w.isRequired(t,"url"),w.isRequired(s,"transferFormat"),w.isIn(s,B,"transferFormat"),this.u.log(e.Trace,"(SSE transport) Connecting."),this.re=t,this.Zt&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this.Zt)}`),new Promise(((i,n)=>{let r,o=!1;if(s===B.Text){if(g.isBrowser||g.isWebWorker)r=new this.ie.EventSource(t,{withCredentials:this.ie.withCredentials});else{const e=this.$.getCookieString(t),s={};s.Cookie=e;const[i,n]=$();s[i]=n,r=new this.ie.EventSource(t,{withCredentials:this.ie.withCredentials,headers:{...s,...this.ie.headers}})}try{r.onmessage=t=>{if(this.onreceive)try{this.u.log(e.Trace,`(SSE transport) data received. ${m(t.data,this.ie.logMessageContent)}.`),this.onreceive(t.data)}catch(t){return void this.le(t)}},r.onerror=t=>{o?this.le():n(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},r.onopen=()=>{this.u.log(e.Information,`SSE connected to ${this.re}`),this.ue=r,o=!0,i()}}catch(t){return void n(t)}}else n(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(t){return this.ue?b(this.u,"SSE",this.$,this.re,t,this.ie):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this.le(),Promise.resolve()}le(t){this.ue&&(this.ue.close(),this.ue=void 0,this.onclose&&this.onclose(t))}}class V{constructor(t,e,s,i,n,r){this.u=s,this.Yt=e,this.de=i,this.fe=n,this.$=t,this.onreceive=null,this.onclose=null,this.pe=r}async connect(t,s){let i;return w.isRequired(t,"url"),w.isRequired(s,"transferFormat"),w.isIn(s,B,"transferFormat"),this.u.log(e.Trace,"(WebSockets transport) Connecting."),this.Yt&&(i=await this.Yt()),new Promise(((n,r)=>{let o;t=t.replace(/^http/,"ws");const h=this.$.getCookieString(t);let c=!1;if(g.isNode||g.isReactNative){const e={},[s,n]=$();e[s]=n,i&&(e[W.Authorization]=`Bearer ${i}`),h&&(e[W.Cookie]=h),o=new this.fe(t,void 0,{headers:{...e,...this.pe}})}else i&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(i)}`);o||(o=new this.fe(t)),s===B.Binary&&(o.binaryType="arraybuffer"),o.onopen=s=>{this.u.log(e.Information,`WebSocket connected to ${t}.`),this.we=o,c=!0,n()},o.onerror=t=>{let s=null;s="undefined"!=typeof ErrorEvent&&t instanceof ErrorEvent?t.error:"There was an error with the transport",this.u.log(e.Information,`(WebSockets transport) ${s}.`)},o.onmessage=t=>{if(this.u.log(e.Trace,`(WebSockets transport) data received. ${m(t.data,this.de)}.`),this.onreceive)try{this.onreceive(t.data)}catch(t){return void this.le(t)}},o.onclose=t=>{if(c)this.le(t);else{let e=null;e="undefined"!=typeof ErrorEvent&&t instanceof ErrorEvent?t.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",r(new Error(e))}}}))}send(t){return this.we&&this.we.readyState===this.fe.OPEN?(this.u.log(e.Trace,`(WebSockets transport) sending data. ${m(t,this.de)}.`),this.we.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this.we&&this.le(void 0),Promise.resolve()}le(t){this.we&&(this.we.onclose=()=>{},this.we.onmessage=()=>{},this.we.onerror=()=>{},this.we.close(),this.we=void 0),this.u.log(e.Trace,"(WebSockets transport) socket closed."),this.onclose&&(!this.ge(t)||!1!==t.wasClean&&1e3===t.code?t instanceof Error?this.onclose(t):this.onclose():this.onclose(new Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)))}ge(t){return t&&"boolean"==typeof t.wasClean&&"number"==typeof t.code}}class K{constructor(t,s={}){var i;if(this.me=()=>{},this.features={},this.ye=1,w.isRequired(t,"url"),this.u=void 0===(i=s.logger)?new E(e.Information):null===i?f.instance:void 0!==i.log?i:new E(i),this.baseUrl=this.be(t),(s=s||{}).logMessageContent=void 0!==s.logMessageContent&&s.logMessageContent,"boolean"!=typeof s.withCredentials&&void 0!==s.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");s.withCredentials=void 0===s.withCredentials||s.withCredentials,s.timeout=void 0===s.timeout?1e5:s.timeout;let n=null,r=null;if(g.isNode){const t=require;n=t("ws"),r=t("eventsource")}g.isNode||"undefined"==typeof WebSocket||s.WebSocket?g.isNode&&!s.WebSocket&&n&&(s.WebSocket=n):s.WebSocket=WebSocket,g.isNode||"undefined"==typeof EventSource||s.EventSource?g.isNode&&!s.EventSource&&void 0!==r&&(s.EventSource=r):s.EventSource=EventSource,this.$=new O(s.httpClient||new H(this.u),s.accessTokenFactory),this.ut="Disconnected",this.dt=!1,this.ie=s,this.onreceive=null,this.onclose=null}async start(t){if(t=t||B.Binary,w.isIn(t,B,"transferFormat"),this.u.log(e.Debug,`Starting connection with transfer format '${B[t]}'.`),"Disconnected"!==this.ut)return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this.ut="Connecting",this.ve=this.yt(t),await this.ve,"Disconnecting"===this.ut){const t="Failed to start the HttpConnection before stop() was called.";return this.u.log(e.Error,t),await this.It,Promise.reject(new r(t))}if("Connected"!==this.ut){const t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this.u.log(e.Error,t),Promise.reject(new r(t))}this.dt=!0}send(t){return"Connected"!==this.ut?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this.Ee||(this.Ee=new G(this.transport)),this.Ee.send(t))}async stop(t){return"Disconnected"===this.ut?(this.u.log(e.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this.ut?(this.u.log(e.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this.It):(this.ut="Disconnecting",this.It=new Promise((t=>{this.me=t})),await this._t(t),void await this.It)}async _t(t){this.$e=t;try{await this.ve}catch(t){}if(this.transport){try{await this.transport.stop()}catch(t){this.u.log(e.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this.Ce()}this.transport=void 0}else this.u.log(e.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async yt(t){let s=this.baseUrl;this.Yt=this.ie.accessTokenFactory,this.$.Yt=this.Yt;try{if(this.ie.skipNegotiation){if(this.ie.transport!==F.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this.Se(F.WebSockets),await this.ke(s,t)}else{let e=null,i=0;do{if(e=await this.Pe(s),"Disconnecting"===this.ut||"Disconnected"===this.ut)throw new r("The connection was stopped during negotiation.");if(e.error)throw new Error(e.error);if(e.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(e.url&&(s=e.url),e.accessToken){const t=e.accessToken;this.Yt=()=>t,this.$.Zt=t,this.$.Yt=void 0}i++}while(e.url&&i<100);if(100===i&&e.url)throw new Error("Negotiate redirection limit exceeded.");await this.Te(s,this.ie.transport,e,t)}this.transport instanceof J&&(this.features.inherentKeepAlive=!0),"Connecting"===this.ut&&(this.u.log(e.Debug,"The HttpConnection connected successfully."),this.ut="Connected")}catch(t){return this.u.log(e.Error,"Failed to start the connection: "+t),this.ut="Disconnected",this.transport=void 0,this.me(),Promise.reject(t)}}async Pe(t){const s={},[n,r]=$();s[n]=r;const o=this.Ie(t);this.u.log(e.Debug,`Sending negotiation request: ${o}.`);try{const t=await this.$.post(o,{content:"",headers:{...s,...this.ie.headers},timeout:this.ie.timeout,withCredentials:this.ie.withCredentials});if(200!==t.statusCode)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${t.statusCode}'`));const e=JSON.parse(t.content);return(!e.negotiateVersion||e.negotiateVersion<1)&&(e.connectionToken=e.connectionId),e.useStatefulReconnect&&!0!==this.ie._e?Promise.reject(new a("Client didn't negotiate Stateful Reconnect but the server did.")):e}catch(t){let s="Failed to complete negotiation with the server: "+t;return t instanceof i&&404===t.statusCode&&(s+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this.u.log(e.Error,s),Promise.reject(new a(s))}}He(t,e){return e?t+(-1===t.indexOf("?")?"?":"&")+`id=${e}`:t}async Te(t,s,i,n){let o=this.He(t,i.connectionToken);if(this.De(s))return this.u.log(e.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=s,await this.ke(o,n),void(this.connectionId=i.connectionId);const h=[],a=i.availableTransports||[];let u=i;for(const i of a){const a=this.Re(i,s,n,!0===(null==u?void 0:u.useStatefulReconnect));if(a instanceof Error)h.push(`${i.transport} failed:`),h.push(a);else if(this.De(a)){if(this.transport=a,!u){try{u=await this.Pe(t)}catch(t){return Promise.reject(t)}o=this.He(t,u.connectionToken)}try{return await this.ke(o,n),void(this.connectionId=u.connectionId)}catch(t){if(this.u.log(e.Error,`Failed to start the transport '${i.transport}': ${t}`),u=void 0,h.push(new c(`${i.transport} failed: ${t}`,F[i.transport])),"Connecting"!==this.ut){const t="Failed to select transport before stop() was called.";return this.u.log(e.Debug,t),Promise.reject(new r(t))}}}}return h.length>0?Promise.reject(new l(`Unable to connect to the server with any of the available transports. ${h.join(" ")}`,h)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}Se(t){switch(t){case F.WebSockets:if(!this.ie.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new V(this.$,this.Yt,this.u,this.ie.logMessageContent,this.ie.WebSocket,this.ie.headers||{});case F.ServerSentEvents:if(!this.ie.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new z(this.$,this.$.Zt,this.u,this.ie);case F.LongPolling:return new J(this.$,this.u,this.ie);default:throw new Error(`Unknown transport: ${t}.`)}}ke(t,e){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async s=>{let i=!1;if(this.features.reconnect){try{this.features.disconnected(),await this.transport.connect(t,e),await this.features.resend()}catch{i=!0}i&&this.Ce(s)}else this.Ce(s)}:this.transport.onclose=t=>this.Ce(t),this.transport.connect(t,e)}Re(t,s,i,n){const r=F[t.transport];if(null==r)return this.u.log(e.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(!function(t,e){return!t||0!=(e&t)}(s,r))return this.u.log(e.Debug,`Skipping transport '${F[r]}' because it was disabled by the client.`),new h(`'${F[r]}' is disabled by the client.`,r);if(!(t.transferFormats.map((t=>B[t])).indexOf(i)>=0))return this.u.log(e.Debug,`Skipping transport '${F[r]}' because it does not support the requested transfer format '${B[i]}'.`),new Error(`'${F[r]}' does not support ${B[i]}.`);if(r===F.WebSockets&&!this.ie.WebSocket||r===F.ServerSentEvents&&!this.ie.EventSource)return this.u.log(e.Debug,`Skipping transport '${F[r]}' because it is not supported in your environment.'`),new o(`'${F[r]}' is not supported in your environment.`,r);this.u.log(e.Debug,`Selecting transport '${F[r]}'.`);try{return this.features.reconnect=r===F.WebSockets?n:void 0,this.Se(r)}catch(t){return t}}De(t){return t&&"object"==typeof t&&"connect"in t}Ce(t){if(this.u.log(e.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this.ut}.`),this.transport=void 0,t=this.$e||t,this.$e=void 0,"Disconnected"!==this.ut){if("Connecting"===this.ut)throw this.u.log(e.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if("Disconnecting"===this.ut&&this.me(),t?this.u.log(e.Error,`Connection disconnected with error '${t}'.`):this.u.log(e.Information,"Connection disconnected."),this.Ee&&(this.Ee.stop().catch((t=>{this.u.log(e.Error,`TransportSendQueue.stop() threw error '${t}'.`)})),this.Ee=void 0),this.connectionId=void 0,this.ut="Disconnected",this.dt){this.dt=!1;try{this.onclose&&this.onclose(t)}catch(s){this.u.log(e.Error,`HttpConnection.onclose(${t}) threw error '${s}'.`)}}}else this.u.log(e.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`)}be(t){if(0===t.lastIndexOf("https://",0)||0===t.lastIndexOf("http://",0))return t;if(!g.isBrowser)throw new Error(`Cannot resolve '${t}'.`);const s=window.document.createElement("a");return s.href=t,this.u.log(e.Information,`Normalizing '${t}' to '${s.href}'.`),s.href}Ie(t){const e=new URL(t);e.pathname.endsWith("/")?e.pathname+="negotiate":e.pathname+="/negotiate";const s=new URLSearchParams(e.searchParams);return s.has("negotiateVersion")||s.append("negotiateVersion",this.ye.toString()),s.has("useStatefulReconnect")?"true"===s.get("useStatefulReconnect")&&(this.ie._e=!0):!0===this.ie._e&&s.append("useStatefulReconnect","true"),e.search=s.toString(),e.toString()}}class G{constructor(t){this.xe=t,this.Ae=[],this.Ue=!0,this.Le=new Q,this.Ne=new Q,this.qe=this.Me()}send(t){return this.je(t),this.Ne||(this.Ne=new Q),this.Ne.promise}stop(){return this.Ue=!1,this.Le.resolve(),this.qe}je(t){if(this.Ae.length&&typeof this.Ae[0]!=typeof t)throw new Error(`Expected data to be of type ${typeof this.Ae} but was of type ${typeof t}`);this.Ae.push(t),this.Le.resolve()}async Me(){for(;;){if(await this.Le.promise,!this.Ue){this.Ne&&this.Ne.reject("Connection stopped.");break}this.Le=new Q;const t=this.Ne;this.Ne=void 0;const e="string"==typeof this.Ae[0]?this.Ae.join(""):G.We(this.Ae);this.Ae.length=0;try{await this.xe.send(e),t.resolve()}catch(e){t.reject(e)}}}static We(t){const e=t.map((t=>t.byteLength)).reduce(((t,e)=>t+e)),s=new Uint8Array(e);let i=0;for(const e of t)s.set(new Uint8Array(e),i),i+=e.byteLength;return s.buffer}}class Q{constructor(){this.promise=new Promise(((t,e)=>[this.j,this.Oe]=[t,e]))}resolve(){this.j()}reject(t){this.Oe(t)}}class Y{constructor(){this.name="json",this.version=2,this.transferFormat=B.Text}parseMessages(t,s){if("string"!=typeof t)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!t)return[];null===s&&(s=f.instance);const i=D.parse(t),n=[];for(const t of i){const i=JSON.parse(t);if("number"!=typeof i.type)throw new Error("Invalid payload.");switch(i.type){case x.Invocation:this.U(i);break;case x.StreamItem:this.Fe(i);break;case x.Completion:this.Be(i);break;case x.Ping:case x.Close:break;case x.Ack:this.Xe(i);break;case x.Sequence:this.Je(i);break;default:s.log(e.Information,"Unknown message type '"+i.type+"' ignored.");continue}n.push(i)}return n}writeMessage(t){return D.write(JSON.stringify(t))}U(t){this.ze(t.target,"Invalid payload for Invocation message."),void 0!==t.invocationId&&this.ze(t.invocationId,"Invalid payload for Invocation message.")}Fe(t){if(this.ze(t.invocationId,"Invalid payload for StreamItem message."),void 0===t.item)throw new Error("Invalid payload for StreamItem message.")}Be(t){if(t.result&&t.error)throw new Error("Invalid payload for Completion message.");!t.result&&t.error&&this.ze(t.error,"Invalid payload for Completion message."),this.ze(t.invocationId,"Invalid payload for Completion message.")}Xe(t){if("number"!=typeof t.sequenceId)throw new Error("Invalid SequenceId for Ack message.")}Je(t){if("number"!=typeof t.sequenceId)throw new Error("Invalid SequenceId for Sequence message.")}ze(t,e){if("string"!=typeof t||""===t)throw new Error(e)}}const Z={trace:e.Trace,debug:e.Debug,info:e.Information,information:e.Information,warn:e.Warning,warning:e.Warning,error:e.Error,critical:e.Critical,none:e.None};class tt{configureLogging(t){if(w.isRequired(t,"logging"),void 0!==t.log)this.logger=t;else if("string"==typeof t){const e=function(t){const e=Z[t.toLowerCase()];if(void 0!==e)return e;throw new Error(`Unknown log level: ${t}`)}(t);this.logger=new E(e)}else this.logger=new E(t);return this}withUrl(t,e){return w.isRequired(t,"url"),w.isNotEmpty(t,"url"),this.url=t,this.httpConnectionOptions="object"==typeof e?{...this.httpConnectionOptions,...e}:{...this.httpConnectionOptions,transport:e},this}withHubProtocol(t){return w.isRequired(t,"protocol"),this.protocol=t,this}withAutomaticReconnect(t){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return t?Array.isArray(t)?this.reconnectPolicy=new j(t):this.reconnectPolicy=t:this.reconnectPolicy=new j,this}withServerTimeout(t){return w.isRequired(t,"milliseconds"),this.Ve=t,this}withKeepAliveInterval(t){return w.isRequired(t,"milliseconds"),this.Ke=t,this}withStatefulReconnect(t){return void 0===this.httpConnectionOptions&&(this.httpConnectionOptions={}),this.httpConnectionOptions._e=!0,this.Y=null==t?void 0:t.bufferSize,this}build(){const t=this.httpConnectionOptions||{};if(void 0===t.logger&&(t.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const e=new K(this.url,t);return q.create(e,this.logger||f.instance,this.protocol||new Y,this.reconnectPolicy,this.Ve,this.Ke,this.Y)}}return Uint8Array.prototype.indexOf||Object.defineProperty(Uint8Array.prototype,"indexOf",{value:Array.prototype.indexOf,writable:!0}),Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:function(t,e){return new Uint8Array(Array.prototype.slice.call(this,t,e))},writable:!0}),Uint8Array.prototype.forEach||Object.defineProperty(Uint8Array.prototype,"forEach",{value:Array.prototype.forEach,writable:!0}),s})(),"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.signalR=e():t.signalR=e(); //# sourceMappingURL=signalr.min.js.map diff --git a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/filter-list/filter-list.html b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/filter-list/filter-list.html index 0e65d353b..97fb4f06b 100644 --- a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/filter-list/filter-list.html +++ b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/filter-list/filter-list.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/header-nav/headerNav.html b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/header-nav/headerNav.html index 790b4ee81..df4399025 100644 --- a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/header-nav/headerNav.html +++ b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/header-nav/headerNav.html @@ -6,7 +6,7 @@ var(--primary-color-brightness, 50%), 1 ); - -webkit-mask: url(https://mixcore-portal.vercel.app/assets/images/mixcore-logo.svg) + -webkit-mask: url(/mix-app/assets/img/svg/mixcore-logo.svg) no-repeat 50% 50%; - mask: url(https://mixcore-portal.vercel.app/assets/images/mixcore-logo.svg) - no-repeat 50% 50%;"> \ No newline at end of file + mask: url(/mix-app/assets/img/svg/mixcore-logo.svg) no-repeat 50% + 50%;"> \ No newline at end of file diff --git a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/list-mix-column/view.html b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/list-mix-column/view.html index 6a53e8340..741a1dda5 100644 --- a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/list-mix-column/view.html +++ b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/list-mix-column/view.html @@ -1 +1 @@ -

    Relationships

    Type
    Name
    Database
    \ No newline at end of file +

    Relationships

    Type
    Name
    Database
    \ No newline at end of file diff --git a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/mix-database-data-values/view.html b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/mix-database-data-values/view.html index 146367475..d455c5487 100644 --- a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/mix-database-data-values/view.html +++ b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/mix-database-data-values/view.html @@ -1 +1 @@ -
    Total items:
    \ No newline at end of file +
    Total items:
    Next
    \ No newline at end of file diff --git a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/mix-database-form/view.html b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/mix-database-form/view.html index c53baeef0..fb37497a5 100644 --- a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/mix-database-form/view.html +++ b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/mix-database-form/view.html @@ -1 +1 @@ -
    List data Search links
    {{$ctrl.translate(ref.destinateDatabaseName)}}
    Total items:
    \ No newline at end of file +
    List data Search links
    {{$ctrl.translate(ref.destinateDatabaseName)}}
    Total items:
    \ No newline at end of file diff --git a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/modal-nav-posts/modal-nav-posts.html b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/modal-nav-posts/modal-nav-posts.html index d44ec98d6..55f5cce2d 100644 --- a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/modal-nav-posts/modal-nav-posts.html +++ b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/modal-nav-posts/modal-nav-posts.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/navigations/navigations.html b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/navigations/navigations.html index fd94e3592..bfbc96538 100644 --- a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/navigations/navigations.html +++ b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/components/navigations/navigations.html @@ -1 +1 @@ -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/pages/dashboard/dashboard.html b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/pages/dashboard/dashboard.html index 37d42c26d..6e66dda86 100644 --- a/src/applications/mixcore/wwwroot/mix-app/views/app-portal/pages/dashboard/dashboard.html +++ b/src/applications/mixcore/wwwroot/mix-app/views/app-portal/pages/dashboard/dashboard.html @@ -1,3 +1,3 @@ -