Compare commits
No commits in common. "main" and "v.1.0.0" have entirely different histories.
226
.gitignore
vendored
226
.gitignore
vendored
@ -1,226 +0,0 @@
|
||||
# The following command works for downloading when using Git for Windows:
|
||||
# curl -LOf http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
|
||||
#
|
||||
# Download this file using PowerShell v3 under Windows with the following comand:
|
||||
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
|
||||
#
|
||||
# or wget:
|
||||
# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
# build folder is nowadays used for build scripts and should not be ignored
|
||||
#build/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
modulesbin/
|
||||
tempbin/
|
||||
|
||||
# EPiServer Site file (VPP)
|
||||
AppData/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# vim
|
||||
*.txt~
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Temp files when opening LibreOffice on ubuntu
|
||||
.~lock.*
|
||||
|
||||
# svn
|
||||
.svn
|
||||
|
||||
# CVS - Source Control
|
||||
**/CVS/
|
||||
|
||||
# Remainings from resolving conflicts in Source Control
|
||||
*.orig
|
||||
|
||||
# SQL Server files
|
||||
**/App_Data/*.mdf
|
||||
**/App_Data/*.ldf
|
||||
**/App_Data/*.sdf
|
||||
|
||||
|
||||
#LightSwitch generated files
|
||||
GeneratedArtifacts/
|
||||
_Pvt_Extensions/
|
||||
ModelManifest.xml
|
||||
|
||||
# =========================
|
||||
# Windows detritus
|
||||
# =========================
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# OS generated files #
|
||||
Icon?
|
||||
|
||||
# Mac desktop service store files
|
||||
.DS_Store
|
||||
|
||||
# SASS Compiler cache
|
||||
.sass-cache
|
||||
|
||||
# Visual Studio 2014 CTP
|
||||
**/*.sln.ide
|
||||
|
||||
# Visual Studio temp something
|
||||
.vs/
|
||||
|
||||
# dotnet stuff
|
||||
project.lock.json
|
||||
|
||||
# VS 2015+
|
||||
*.vc.vc.opendb
|
||||
*.vc.db
|
||||
|
||||
# Rider
|
||||
.idea/
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/
|
||||
|
||||
# Output folder used by Webpack or other FE stuff
|
||||
**/node_modules/*
|
||||
**/wwwroot/*
|
||||
|
||||
# SpecFlow specific
|
||||
*.feature.cs
|
||||
*.feature.xlsx.*
|
||||
*.Specs_*.html
|
||||
|
||||
# UWP Projects
|
||||
AppPackages/
|
||||
|
||||
#####
|
||||
# End of core ignore list, below put you custom 'per project' settings (patterns or path)
|
||||
#####
|
@ -1,25 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.33424.131
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Companies", "Companies\Companies.csproj", "{B8F7A02C-9FB7-4601-B999-2B6E879AEDD3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B8F7A02C-9FB7-4601-B999-2B6E879AEDD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B8F7A02C-9FB7-4601-B999-2B6E879AEDD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B8F7A02C-9FB7-4601-B999-2B6E879AEDD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B8F7A02C-9FB7-4601-B999-2B6E879AEDD3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {09C7375D-EA16-4BF7-AD54-1FEBD3966240}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -1,66 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>disable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
||||
<TypeScriptTarget>ES2016</TypeScriptTarget>
|
||||
<TypeScriptJSXEmit>None</TypeScriptJSXEmit>
|
||||
<TypeScriptModuleKind>None</TypeScriptModuleKind>
|
||||
<TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
|
||||
<TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
|
||||
<TypeScriptRemoveComments>True</TypeScriptRemoveComments>
|
||||
<TypeScriptOutFile />
|
||||
<TypeScriptOutDir>ScriptsAndCss/JsScripts</TypeScriptOutDir>
|
||||
<TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
|
||||
<TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
|
||||
<TypeScriptSourceMap>False</TypeScriptSourceMap>
|
||||
<TypeScriptMapRoot />
|
||||
<TypeScriptSourceRoot></TypeScriptSourceRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<TypeScriptTarget>ES2016</TypeScriptTarget>
|
||||
<TypeScriptJSXEmit>None</TypeScriptJSXEmit>
|
||||
<TypeScriptModuleKind>None</TypeScriptModuleKind>
|
||||
<TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
|
||||
<TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
|
||||
<TypeScriptRemoveComments>True</TypeScriptRemoveComments>
|
||||
<TypeScriptOutFile />
|
||||
<TypeScriptOutDir>ScriptsAndCss/JsScripts</TypeScriptOutDir>
|
||||
<TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
|
||||
<TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
|
||||
<TypeScriptSourceMap>False</TypeScriptSourceMap>
|
||||
<TypeScriptMapRoot />
|
||||
<TypeScriptSourceRoot></TypeScriptSourceRoot>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<TypeScriptCompile Remove="node_modules\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="ScriptsAndCss\TypeScripts\details.ts" />
|
||||
<None Remove="ScriptsAndCss\TypeScripts\main.ts" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="ScriptsAndCss\JsScripts\" />
|
||||
<Folder Include="ScriptsAndCss\Combined\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.9" />
|
||||
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.1.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<TypeScriptCompile Include="ScriptsAndCss\TypeScripts\main.ts" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ActiveDebugProfile>http</ActiveDebugProfile>
|
||||
<ShouldLintTypeScript>True</ShouldLintTypeScript>
|
||||
<Controller_SelectedScaffolderID>MvcControllerWithActionsScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
|
||||
<NameOfLastUsedPublishProfile>D:\RiskStrategyTask\Companies\Companies\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<TypeScriptCompile Update="ScriptsAndCss\TypeScripts\main.ts">
|
||||
<SubType>Code</SubType>
|
||||
</TypeScriptCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,452 +0,0 @@
|
||||
using Companies.Data.Ajax;
|
||||
using Companies.Data.Home;
|
||||
using Companies.Services;
|
||||
using Extensions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
/// <summary>
|
||||
/// Контроллер API и оболочки JS
|
||||
/// </summary>
|
||||
[Route("[controller]/[action]")]
|
||||
public class AjaxController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Экземпляр контекста БД
|
||||
/// </summary>
|
||||
private DatabaseContext AppDb;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="dbContext">Контекст работы с БД</param>
|
||||
public AjaxController(DatabaseContext dbContext)
|
||||
{
|
||||
AppDb = dbContext;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получить информацию о компании
|
||||
/// </summary>
|
||||
/// <param name="сompanyInfoRequest">Тело</param>
|
||||
/// <returns>CompanyInfo</returns>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[HttpPost]
|
||||
[Consumes("application/json")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> GetCompanyInfo([FromBody] CompanyInfoRequest сompanyInfoRequest)
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var info = await AppDb.Companies.FirstOrDefaultAsync((res) => res.Id == сompanyInfoRequest.IdCompany);
|
||||
//возвращаем в JSON
|
||||
return info.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получить информацию о сотруднике компании
|
||||
/// </summary>
|
||||
/// <param name="getEmployeeRequest">Тело</param>
|
||||
/// <returns>CompanyEmployees</returns>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[HttpPost]
|
||||
[Consumes("application/json")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> GetEmployee([FromBody] GetEmployeeRequest getEmployeeRequest)
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var info = await AppDb.CompanyEmployees.FirstOrDefaultAsync((res) => res.Id == getEmployeeRequest.IdEmployee);
|
||||
//возвращаем в JSON
|
||||
return info.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получить информацию о списке событий
|
||||
/// </summary>
|
||||
/// <returns>List-OrderHistory</returns>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[HttpPost]
|
||||
[Consumes("application/json")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> GetOrdersHistory()
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var info = await AppDb.HistoryOrder.OrderByDescending((it) => it.Id).Take(20).ToListAsync();
|
||||
//возвращаем в JSON
|
||||
return info.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получить информацию о Notes
|
||||
/// </summary>
|
||||
/// <returns>List-CompanyNotes</returns>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[HttpPost]
|
||||
[Consumes("application/json")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> GetNotes()
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var info = await AppDb.CompanyNotes.OrderByDescending((it) => it.Id).Take(20).ToListAsync();
|
||||
//возвращаем в JSON
|
||||
return info.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получить информацию о участниках
|
||||
/// </summary>
|
||||
/// <returns>List-OrderHistory</returns>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[HttpPost]
|
||||
[Consumes("application/json")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> GetEmployees()
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var info = await AppDb.CompanyEmployees.OrderByDescending((it) => it.Id).Take(20).ToListAsync();
|
||||
//возвращаем в JSON
|
||||
return info.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создать employees в компании
|
||||
/// </summary>
|
||||
/// <param name="employeesRequest">Список employees (id не имеет значения, главное по возрастанию)(2013-01-08 - формат даты)</param>
|
||||
/// <returns>bool</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(bool), 200)]
|
||||
[ProducesResponseType(404)]
|
||||
[ProducesResponseType(401)]
|
||||
[ProducesResponseType(500)]
|
||||
public async Task<IActionResult> CreateEmployees([FromBody] CreateEmployeesRequest employeesRequest)
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var res = await AppDb.CreateEmployees(employeesRequest.CompanyEmployees);
|
||||
//возвращаем в JSON
|
||||
return res.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создать notes в компании
|
||||
/// </summary>
|
||||
/// <param name="notesRequest">Список notes (id не имеет значения, главное по возрастанию)</param>
|
||||
/// <returns>bool</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(bool), 200)]
|
||||
[ProducesResponseType(404)]
|
||||
[ProducesResponseType(401)]
|
||||
[ProducesResponseType(500)]
|
||||
public async Task<IActionResult> CreateNotes([FromBody] CreateNotesRequest notesRequest)
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var res = await AppDb.CreateNotes(notesRequest.CompanyNotes);
|
||||
//возвращаем в JSON
|
||||
return res.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удалить notes в компании
|
||||
/// </summary>
|
||||
/// <param name="notesRequest">Список notes (id не имеет значения, главное по возрастанию)</param>
|
||||
/// <returns>bool</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(bool), 200)]
|
||||
[ProducesResponseType(404)]
|
||||
[ProducesResponseType(401)]
|
||||
[ProducesResponseType(500)]
|
||||
public async Task<IActionResult> DeleteNotes([FromBody] DeleteNotesRequest notesRequest)
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var res = await AppDb.DeleteNotes(notesRequest.CompanyNotesIds);
|
||||
//возвращаем в JSON
|
||||
return res.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удалить employees в компании
|
||||
/// </summary>
|
||||
/// <param name="employeesRequest">Список employees (id не имеет значения, главное по возрастанию)</param>
|
||||
/// <returns>bool</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(bool), 200)]
|
||||
[ProducesResponseType(404)]
|
||||
[ProducesResponseType(401)]
|
||||
[ProducesResponseType(500)]
|
||||
public async Task<IActionResult> DeleteEmployees([FromBody] DeleteEmployeesRequest employeesRequest)
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var res = await AppDb.DeleteEmployees(employeesRequest.CompanyEmployeesIds);
|
||||
//возвращаем в JSON
|
||||
return res.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создать событие в компании
|
||||
/// </summary>
|
||||
/// <param name="companyHistoryRequest">Список событий (id не имеет значения, главное по возрастанию)</param>
|
||||
/// <returns>bool</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(bool), 200)]
|
||||
[ProducesResponseType(404)]
|
||||
[ProducesResponseType(401)]
|
||||
[ProducesResponseType(500)]
|
||||
public async Task<IActionResult> CreateOrderHistory([FromBody]CompanyHistoryRequest companyHistoryRequest)
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var res = await AppDb.CreateOrderHistory(companyHistoryRequest.OrderHistoryList);
|
||||
//возвращаем в JSON
|
||||
return res.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Генерировать базу данных в папке
|
||||
/// </summary>
|
||||
/// <returns>bool</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(bool), 200)]
|
||||
[ProducesResponseType(404)]
|
||||
[ProducesResponseType(401)]
|
||||
[ProducesResponseType(500)]
|
||||
public async Task<IActionResult> GenerateTables()
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
await AppDb.GenerateFileDb();
|
||||
//возвращаем в JSON
|
||||
return "Complete!".SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Генерировать таблицу компаний
|
||||
/// </summary>
|
||||
/// <returns>bool</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(bool), 200)]
|
||||
[ProducesResponseType(404)]
|
||||
[ProducesResponseType(401)]
|
||||
[ProducesResponseType(500)]
|
||||
public async Task<IActionResult> GenerateCompanies()
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var res = await AppDb.GenerateCompanies();
|
||||
//возвращаем в JSON
|
||||
return res.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удалить все компании
|
||||
/// </summary>
|
||||
/// <returns>bool</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(bool), 200)]
|
||||
[ProducesResponseType(404)]
|
||||
[ProducesResponseType(401)]
|
||||
[ProducesResponseType(500)]
|
||||
public async Task<IActionResult> DeleteAllCompanies()
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var res = await AppDb.DeleteAllCompanies();
|
||||
//возвращаем в JSON
|
||||
return res.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удалить все события Orders History компании
|
||||
/// </summary>
|
||||
/// <returns>bool</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(bool), 200)]
|
||||
[ProducesResponseType(404)]
|
||||
[ProducesResponseType(401)]
|
||||
[ProducesResponseType(500)]
|
||||
public async Task<IActionResult> DeleteAllOrdersHistory()
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var res = await AppDb.DeleteAllOrdersHistory();
|
||||
//возвращаем в JSON
|
||||
return res.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Удалить все события Notes
|
||||
/// </summary>
|
||||
/// <returns>bool</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(bool), 200)]
|
||||
[ProducesResponseType(404)]
|
||||
[ProducesResponseType(401)]
|
||||
[ProducesResponseType(500)]
|
||||
public async Task<IActionResult> DeleteAllNotes()
|
||||
{
|
||||
try
|
||||
{ //проверяем входящие данные
|
||||
if (!ModelState.IsValid) return BadRequest("bad request data");
|
||||
//получаем данные из бд
|
||||
var res = await AppDb.DeleteAllNotes();
|
||||
//возвращаем в JSON
|
||||
return res.SuccessResponse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return BadRequest("failed"); //отдаем BadRequest
|
||||
}
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
using Companies.Data.Home;
|
||||
using Companies.Models;
|
||||
using Companies.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Models;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Companies.Controllers;
|
||||
|
||||
[Route("[action]")]
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private DatabaseContext AppDb;
|
||||
|
||||
public HomeController(DatabaseContext dbContext)
|
||||
{
|
||||
AppDb = dbContext;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Главная страница
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[HttpGet]
|
||||
[Route("/")]
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
try
|
||||
{
|
||||
var companies = await AppDb.Companies.ToListAsync();
|
||||
return View(new HomeViewModel() {
|
||||
Companies = companies
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return StatusCode(404);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Метод вывода информации о компании
|
||||
/// </summary>
|
||||
/// <param name="id">ID компании</param>
|
||||
/// <returns>Детализация</returns>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[HttpGet]
|
||||
[Route("/Details/{id}")]
|
||||
public async Task<IActionResult> Details(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var info = await AppDb.Companies.FirstOrDefaultAsync((res) => res.Id == id);
|
||||
|
||||
return View(new HomeViewModel
|
||||
{
|
||||
DetailsCompany = new DetailsCompany() { CompanyInfo = info }
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return StatusCode(404);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Страница ошибки
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[HttpGet]
|
||||
[Route("/error")]
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
using Companies.Data.Home;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Companies.Data.Ajax
|
||||
{
|
||||
/// <summary>
|
||||
/// Запрос данных о компании
|
||||
/// </summary>
|
||||
public class CompanyInfoRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Идентификатор команды
|
||||
/// </summary>
|
||||
[JsonPropertyName("idCompany")]
|
||||
public int IdCompany { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Запрос данных о сотруднике компании
|
||||
/// </summary>
|
||||
public class GetEmployeeRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Идентификатор команды
|
||||
/// </summary>
|
||||
[JsonPropertyName("id")]
|
||||
public int IdEmployee { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Параметры для создания order в History компании
|
||||
/// </summary>
|
||||
public class CompanyHistoryRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Список параметров
|
||||
/// </summary>
|
||||
[JsonPropertyName("OrderHistoryList")]
|
||||
public List<OrderHistory> OrderHistoryList { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Параметры для создания Notes компании
|
||||
/// </summary>
|
||||
public class CreateNotesRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Список Notes
|
||||
/// </summary>
|
||||
[JsonPropertyName("NotesList")]
|
||||
public List<CompanyNotes> CompanyNotes { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Параметры для создания Employees компании
|
||||
/// </summary>
|
||||
public class CreateEmployeesRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Список Employees
|
||||
/// </summary>
|
||||
[JsonPropertyName("EmployeesList")]
|
||||
public List<CompanyEmployees> CompanyEmployees { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Параметры для удаления Notes компании
|
||||
/// </summary>
|
||||
public class DeleteNotesRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Список Notes
|
||||
/// </summary>
|
||||
[JsonPropertyName("ids")]
|
||||
public List<int> CompanyNotesIds { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Параметры для удаления Employees компании
|
||||
/// </summary>
|
||||
public class DeleteEmployeesRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Список Notes
|
||||
/// </summary>
|
||||
[JsonPropertyName("ids")]
|
||||
public List<int> CompanyEmployeesIds { get; set; }
|
||||
}
|
||||
}
|
@ -1,143 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Companies.Data.Home;
|
||||
|
||||
/// <summary>
|
||||
/// Компания
|
||||
/// </summary>
|
||||
public class CompanyInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Идентификатор
|
||||
/// </summary>
|
||||
[JsonPropertyName("Id")]
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// Название
|
||||
/// </summary>
|
||||
[JsonPropertyName("Name")]
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Адрес
|
||||
/// </summary>
|
||||
[JsonPropertyName("Address")]
|
||||
public string Address { get; set; }
|
||||
/// <summary>
|
||||
/// Город
|
||||
/// </summary>
|
||||
[JsonPropertyName("City")]
|
||||
public string City { get; set; }
|
||||
/// <summary>
|
||||
/// Штат
|
||||
/// </summary>
|
||||
[JsonPropertyName("State")]
|
||||
public string State { get; set; }
|
||||
/// <summary>
|
||||
/// Телефон
|
||||
/// </summary>
|
||||
[JsonPropertyName("Phone")]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Корректность данных
|
||||
/// </summary>
|
||||
[JsonPropertyName("IsValid")]
|
||||
public bool IsValid => Id != 0 && !string.IsNullOrEmpty(Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Краткая история магазинов
|
||||
/// </summary>
|
||||
public class OrderHistory
|
||||
{
|
||||
/// <summary>
|
||||
/// Идентификатор
|
||||
/// </summary>
|
||||
[JsonPropertyName("Id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата события
|
||||
/// </summary>
|
||||
[JsonPropertyName("OrderDate")]
|
||||
public string OrderDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Город события
|
||||
/// </summary>
|
||||
[JsonPropertyName("StoreCity")]
|
||||
public string StoreCity { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notes компании
|
||||
/// </summary>
|
||||
public class CompanyNotes
|
||||
{
|
||||
/// <summary>
|
||||
/// Идентификатор
|
||||
/// </summary>
|
||||
[JsonPropertyName("Id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата события
|
||||
/// </summary>
|
||||
[JsonPropertyName("Employee")]
|
||||
public string Employee { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Employees компании
|
||||
/// </summary>
|
||||
public class CompanyEmployees
|
||||
{
|
||||
/// <summary>
|
||||
/// Идентификатор
|
||||
/// </summary>
|
||||
[JsonPropertyName("Id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имя
|
||||
/// </summary>
|
||||
[JsonPropertyName("FirstName")]
|
||||
public string FirstName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Фамилия
|
||||
/// </summary>
|
||||
[JsonPropertyName("LastName")]
|
||||
public string LastName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Пол
|
||||
/// </summary>
|
||||
[JsonPropertyName("Title")]
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// День рождения
|
||||
/// </summary>
|
||||
[JsonPropertyName("BirthDate")]
|
||||
public string BirthDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Должность
|
||||
/// </summary>
|
||||
[JsonPropertyName("Position")]
|
||||
public string Position { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Полная информация о компании
|
||||
/// </summary>
|
||||
public class DetailsCompany
|
||||
{
|
||||
/// <summary>
|
||||
/// Основная информация
|
||||
/// </summary>
|
||||
public CompanyInfo CompanyInfo { get; set; }
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
namespace Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Класс вспомогательных методов для авторизации
|
||||
/// </summary>
|
||||
public static class AuthExt
|
||||
{
|
||||
/// <summary>
|
||||
/// Название куки сессии пользователя
|
||||
/// </summary>
|
||||
public const string NameSessionCookie = ".Usr.Session";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Разрушает сессию пользователя
|
||||
/// </summary>
|
||||
/// <param name="httpContext">HttpContext запроса</param>
|
||||
public static void DestroyUserSession(this HttpContext httpContext)
|
||||
{
|
||||
try
|
||||
{
|
||||
httpContext.Session.Clear();//очищаем сессию пользователя
|
||||
//удаляем куку сессии
|
||||
httpContext.Response.Cookies.Delete(NameSessionCookie);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Класс вспомогательных методов для работы с JSON
|
||||
/// </summary>
|
||||
public static class JsonExt
|
||||
{
|
||||
/// <summary>
|
||||
/// Объект в JSON строку
|
||||
/// </summary>
|
||||
/// <param name="data">Входящий объект</param>
|
||||
/// <param name="jsonConverter">Кастомный конвертер</param>
|
||||
/// <returns>Строка JSON</returns>
|
||||
public static string SerializeToJson(this object data, JsonConverter jsonConverter = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (data == null) return string.Empty;//проверяем входящие данные
|
||||
//создаем объект настроек сериализации
|
||||
var jsonSerializerOptions = new JsonSerializerOptions
|
||||
{
|
||||
AllowTrailingCommas = true,
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
Converters =
|
||||
{
|
||||
new JsonStringEnumConverter(JsonNamingPolicy.CamelCase, false)
|
||||
}
|
||||
};
|
||||
if (jsonConverter != null)//если задан кастомный конвертер
|
||||
{ //добавляем кастомный конвертер
|
||||
jsonSerializerOptions.Converters.Add(jsonConverter);
|
||||
} //сериализуем объект в строку JSON и отдаем ее
|
||||
return JsonSerializer.Serialize(data, jsonSerializerOptions);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return string.Empty;//отдаем пустую строку
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Форматирует объект в ответ с JSON строкой в теле
|
||||
/// </summary>
|
||||
/// <param name="data">Входящий объект</param>
|
||||
/// <param name="jsonConverter">Кастомный конвертер</param>
|
||||
/// <returns>Результат ответа</returns>
|
||||
public static ContentResult SuccessResponse(this object data, JsonConverter jsonConverter = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new ContentResult //создаем контент ответа
|
||||
{
|
||||
Content = data.SerializeToJson(jsonConverter),
|
||||
ContentType = "application/json",
|
||||
StatusCode = 200
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
return null; //отдаем null
|
||||
}
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/// <binding BeforeBuild='all' ProjectOpened='watch' /> //запускает задачу наблюдения при открытии проекта, все задачи перед билдом (выбирается в меню Task Runner)
|
||||
module.exports = function (grunt) {
|
||||
grunt.initConfig({
|
||||
clean: ["wwwroot/css/*", "wwwroot/js/app.min.js", "ScriptsAndCss/Combined/*"], //очистка файлов какие папки/файлы очищать
|
||||
concat: {
|
||||
js: { //объединение JS
|
||||
src: [
|
||||
"ScriptsAndCss/JsScripts/**/*.js"
|
||||
], //сюда можно писать файлы для объединения через запятую
|
||||
dest: "ScriptsAndCss/Combined/combined.js" //расположение объединенного файла
|
||||
},
|
||||
css: { //объединение CSS
|
||||
src: ["ScriptsAndCss/CssFiles/main.css"], //сюда можно писать файлы для объединения через запятую
|
||||
dest: "ScriptsAndCss/Combined/combined.css" //расположение объединенного файла
|
||||
}
|
||||
},
|
||||
uglify: { //сжатие JS
|
||||
js: {
|
||||
src: ["ScriptsAndCss/Combined/combined.js"], //какой файл сжимать
|
||||
dest: "wwwroot/js/app.min.js" //сжатый выходной файл
|
||||
}
|
||||
},
|
||||
cssmin: { //сжатие CSS
|
||||
css: {
|
||||
src: ["ScriptsAndCss/Combined/combined.css"], //какой файл сжимать
|
||||
dest: "wwwroot/css/app.min.css" //сжатый выходной файл
|
||||
}
|
||||
},
|
||||
watch: { //наблюдение за изменениями
|
||||
files: ["ScriptsAndCss/JsScripts/*.js",
|
||||
"ScriptsAndCss/CssFiles/*.css",
|
||||
"ScriptsAndCss/TypeScripts/*.ts"], //за изменением каких файлов наблюдаем
|
||||
tasks: ["all"] //какую задачу запускаем
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks("grunt-contrib-clean"); //для очистки файлов
|
||||
grunt.loadNpmTasks("grunt-contrib-concat"); //для объединения JS и CSS
|
||||
grunt.loadNpmTasks("grunt-contrib-uglify"); //для сжатия JS
|
||||
grunt.loadNpmTasks("grunt-contrib-cssmin"); //для сжатия CSS
|
||||
grunt.registerTask("all", ["clean", "concat", "uglify", "cssmin"]); //общая задача
|
||||
grunt.loadNpmTasks("grunt-contrib-watch"); //для наблюдения за изменениями в файлах
|
||||
};
|
@ -1,55 +0,0 @@
|
||||
using Microsoft.AspNetCore.Antiforgery;
|
||||
|
||||
namespace Middleware;
|
||||
|
||||
/// <summary>
|
||||
/// Обработчик службы против подделки запросов
|
||||
/// </summary>
|
||||
public class AntiforgeryMiddleware
|
||||
{
|
||||
/// <summary>
|
||||
/// Делегат на передачу действия следующему в роутере
|
||||
/// </summary>
|
||||
private RequestDelegate Next { get; }
|
||||
|
||||
/// <summary>
|
||||
/// API для настройки функций против подделки
|
||||
/// </summary>
|
||||
private IAntiforgery Antiforgery { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="next">Делегат на передачу действия следующему в роутере</param>
|
||||
/// <param name="antiforgery">API для настройки функций против подделки</param>
|
||||
public AntiforgeryMiddleware(RequestDelegate next, IAntiforgery antiforgery)
|
||||
{
|
||||
Next = next;
|
||||
Antiforgery = antiforgery;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Асинхронный обработчик запроса
|
||||
/// </summary>
|
||||
/// <param name="context">Контекст запроса</param>
|
||||
public async Task InvokeAsync(HttpContext context)
|
||||
{
|
||||
try
|
||||
{ //генерируем токен против подделки запросов
|
||||
var tokens = Antiforgery.GetAndStoreTokens(context);
|
||||
//устанавливаем токен в куку
|
||||
context.Response.Cookies.Append("CSRF-TOKEN", tokens.RequestToken ?? string.Empty,
|
||||
new CookieOptions { HttpOnly = false });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine(ex.Message);
|
||||
#endif
|
||||
}
|
||||
finally
|
||||
{ //передаем управление на следующий метод в роутере(вывод/перенаправление ошибки)
|
||||
await Next.Invoke(context);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
namespace Companies.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using Companies.Data.Home;
|
||||
|
||||
namespace Models;
|
||||
|
||||
/// <summary>
|
||||
/// Модель для передачи в View
|
||||
/// </summary>
|
||||
public class HomeViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Список компаний
|
||||
/// </summary>
|
||||
public List<CompanyInfo> Companies { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Компания детализации
|
||||
/// </summary>
|
||||
public DetailsCompany DetailsCompany { get; set; }
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
using Companies.Services;
|
||||
using Extensions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Middleware;
|
||||
using System.Reflection;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
var connection = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||
// Configure Database
|
||||
builder.Services.AddDbContext<DatabaseContext>(options =>
|
||||
options.UseSqlite(connection));
|
||||
//êîíôèãóðàöèÿ ïîëèòèêè êóê
|
||||
builder.Services.Configure<CookiePolicyOptions>(options =>
|
||||
{
|
||||
options.CheckConsentNeeded = _ => false; //ïîëèòèêè ñîãëàñèÿ íå îöåíèâàþòñÿ
|
||||
options.MinimumSameSitePolicy = SameSiteMode.None; //çàïðåò ïåðåîïðåäåëåíèÿ çíà÷åíèé cookie
|
||||
options.Secure = CookieSecurePolicy.Always; //ôàéëû cookie äîëæíû áûòü áåçîïàñíûìè
|
||||
});
|
||||
builder.Services.AddSession(options =>//êîíôèãóðèðóåì ïàðàìåòðû ñåññèè
|
||||
{
|
||||
options.Cookie.Name = AuthExt.NameSessionCookie; //ñòàâèì íàçâàíèå êóêó ñåññèè
|
||||
options.IdleTimeout = TimeSpan.FromMinutes(10); //âðåìÿ õðàíåíèÿ ñåññèè ïðè áåçäåéñòâèè
|
||||
options.Cookie.HttpOnly = true; //äîñòóï òîëüêî ñ ñåðâåðà
|
||||
options.Cookie.IsEssential = true; //íóæåí ëè ôàéë cookie äëÿ ðàáîòû (true-ïðîâåðêè ïîëèòèêè ñîãëàñèÿ ïðîïóñêàþòñÿ)
|
||||
});
|
||||
builder.Services.AddAntiforgery(options =>//íàñòðîéêè ñëóæáû ïðîòèâ ïîääåëêè çàïðîñîâ
|
||||
{
|
||||
options.HeaderName = "X-CSRF-TOKEN";
|
||||
});
|
||||
|
||||
builder.Services.AddControllersWithViews();// Add services to the container.
|
||||
|
||||
builder.Services.AddCors(); //äîáàâëÿåì ïîëèòèêó CORS
|
||||
|
||||
//äîáàâëÿåì Swagger
|
||||
builder.Services.AddSwaggerGen(options =>
|
||||
{
|
||||
//ïèøåì îïöèè Swagger
|
||||
options.SwaggerDoc("v1", new OpenApiInfo
|
||||
{
|
||||
Version = "1.0.1",
|
||||
Title = "REST API Strategy Risk",
|
||||
Description = "Òåñòîâîâå çàäàíèå",
|
||||
Contact = new OpenApiContact
|
||||
{
|
||||
Name = "Nikolay",
|
||||
Email = "dvurechensky_pro@mail.ru",
|
||||
}
|
||||
});
|
||||
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
||||
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
|
||||
options.IncludeXmlComments(xmlPath);
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Äîêóìåíòàöèÿ");
|
||||
c.RoutePrefix = "docs";
|
||||
});
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
else
|
||||
{
|
||||
//app.UseHttpsRedirection();
|
||||
}
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseCookiePolicy(); //èñïîëüçîâàòü ïîëèòèêó êóêè
|
||||
|
||||
app.UseSession(); //èñïîëüçîâàòü ñåññèè
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseMiddleware<AntiforgeryMiddleware>(); //îáðàáîò÷èê ñëóæáû ïðîòèâ ïîääåëêè çàïðîñîâ
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseCors(options =>//èñïîëüçóåì CORS ñ ëþáûõ õîñòîâ
|
||||
{
|
||||
options.SetIsOriginAllowed(_ => true)
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader()
|
||||
.AllowCredentials();
|
||||
});
|
||||
|
||||
#pragma warning disable ASP0014
|
||||
app.UseEndpoints(endpoints =>//ìàðøðóòèçàöèÿ
|
||||
{
|
||||
endpoints.MapDefaultControllerRoute();//äåôîëòíûé ðîóòåð
|
||||
endpoints.MapControllers();//äëÿ ìàðøðóòèçàöèè åñëè èñïîëüçóþòñÿ àòðèáóòû
|
||||
});
|
||||
#pragma warning restore ASP0014
|
||||
|
||||
app.Run();
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<DeleteExistingFiles>false</DeleteExistingFiles>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<PublishUrl>bin\Release\net7.0\publish\</PublishUrl>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<_PublishTargetUrl>D:\RiskStrategyTask\Companies\Companies\bin\Release\net7.0\publish\</_PublishTargetUrl>
|
||||
<History>True|2023-07-29T23:35:59.8093777Z;True|2023-07-30T02:35:56.8923953+03:00;True|2023-07-30T01:57:20.5137941+03:00;True|2023-07-30T01:31:59.9567073+03:00;True|2023-07-30T01:28:11.5087746+03:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -1,37 +0,0 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:39713",
|
||||
"sslPort": 44318
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5132",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7084;http://localhost:5132",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,246 +0,0 @@
|
||||
|
||||
|
||||
html {
|
||||
font-size: 16px;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
|
||||
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
|
||||
}
|
||||
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 93%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.content_companies {
|
||||
border: 3px solid black;
|
||||
padding: 0 20px 40px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.header {
|
||||
width: 1000px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
}
|
||||
.header.mini{
|
||||
width: 330px;
|
||||
}
|
||||
|
||||
.header.mini h4 {
|
||||
min-height: 20px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.header.details {
|
||||
width: 85%;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.header.details h4 {
|
||||
padding-right: 25px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.header .header_btns {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.header .header_btns svg {
|
||||
cursor: pointer;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.header .header_btns svg .mini_btn {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.group {
|
||||
margin: 10px 20px 20px 0;
|
||||
padding-bottom: 20px;
|
||||
max-width: 330px;
|
||||
border-top: 1px solid #D5D5D5;
|
||||
border-bottom: 1px solid #d5d5d5;
|
||||
}
|
||||
|
||||
.group.two {
|
||||
max-width: 600px
|
||||
}
|
||||
|
||||
.data {
|
||||
width: 1000px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
align-content: center;
|
||||
}
|
||||
.data.row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.data.row.empo {
|
||||
width: 97%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
align-content: flex-start;
|
||||
justify-content: flex-start;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.data.row.empo .group {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.data.row.empo .group:first-child {
|
||||
margin: 0px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.data.mini {
|
||||
width: 330px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2,0fr);
|
||||
grid-gap: 10px;
|
||||
font-size: 18px;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.data.mini input {
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #d5d5d5;
|
||||
font-size: 20px;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
overflow: hidden;
|
||||
width: 741%;
|
||||
}
|
||||
|
||||
.data.table {
|
||||
width: 100%;
|
||||
max-height: 330px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.data.table::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.data.table table {
|
||||
cursor: default;
|
||||
width: 330px;
|
||||
max-height: 330px;
|
||||
font-size: 18px;
|
||||
white-space: nowrap;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.data.table table thead tr {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.data.table table thead tr td {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.data.table table tbody tr td {
|
||||
padding: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.data table {
|
||||
width: 1000px;
|
||||
border-collapse: collapse;
|
||||
border: 2px solid #EBEBEB;
|
||||
}
|
||||
|
||||
.data table thead {
|
||||
color: #B3A9AC;
|
||||
}
|
||||
|
||||
.data table thead tr td {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.data table tbody tr a {
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.data table tbody tr td {
|
||||
padding: 5px;
|
||||
border-bottom-color: white;
|
||||
}
|
||||
|
||||
.table-scroll-body {
|
||||
max-height: 280px;
|
||||
overflow-x: auto;
|
||||
margin-top: 0px;
|
||||
border-bottom: 1px solid #EBEBEB;
|
||||
}
|
||||
|
||||
.table-scroll table {
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.table-scroll thead td {
|
||||
text-align: left;
|
||||
padding: 10px 15px;
|
||||
border-top: 1px solid #EBEBEB;
|
||||
border-left: 1px solid #EBEBEB;
|
||||
border-right: 1px solid #EBEBEB;
|
||||
}
|
||||
|
||||
.table-scroll tbody td {
|
||||
text-align: left;
|
||||
border-left: 1px solid #EBEBEB;
|
||||
border-right: 1px solid #EBEBEB;
|
||||
padding: 10px 15px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.table-scroll-body table tbody.tnotes tr td:first-child {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Стили для скролла */
|
||||
::-webkit-scrollbar {
|
||||
width: 1px;
|
||||
}
|
||||
|
||||
|
||||
.element {
|
||||
}
|
@ -1,755 +0,0 @@
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Класс Ajax запросов
|
||||
*/
|
||||
class Ajax {
|
||||
/**
|
||||
* Конструктор
|
||||
* @param path - Путь запроса
|
||||
* @param cookies - экземпляр класса работы с куками
|
||||
*/
|
||||
constructor(path, cookies) {
|
||||
this.requestUrl = `/ajax/${path}`; //присваиваем URL запроса
|
||||
this.cookies = cookies; //присваиваем экземпляр класса работы с куками
|
||||
this.xhttp = new XMLHttpRequest(); //инициализируем xhttp
|
||||
}
|
||||
/**
|
||||
* Метод отправляет ajax запрос
|
||||
* @param dataObject - Объект данных запроса
|
||||
*/
|
||||
sendRequest(dataObject = null) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return new Promise(resolve => {
|
||||
try { //получаем защитный токен
|
||||
const csrfToken = this.cookies.getCookie("CSRF-TOKEN");
|
||||
//добавляем параметры асинхронного запроса
|
||||
this.xhttp.open("POST", this.requestUrl, true);
|
||||
this.xhttp.onreadystatechange = () => {
|
||||
//проверяем готовность ответа
|
||||
if (this.xhttp.readyState !== 4)
|
||||
return;
|
||||
//проверяем успешен или нет ответ
|
||||
if (this.xhttp.status !== 200) {
|
||||
resolve(""); //вызываем промис с пустой строкой
|
||||
return; //не продолжаем
|
||||
} //вызываем промис с текстом ответа
|
||||
resolve(this.xhttp.responseText);
|
||||
};
|
||||
this.xhttp.onerror = () => {
|
||||
//выводим ошибку на консоль
|
||||
console.error("ERROR: ", "Bad response");
|
||||
resolve(""); //вызываем промис с пустой строкой
|
||||
}; //подставляем в заголовки защитный токен
|
||||
this.xhttp.setRequestHeader("X-CSRF-TOKEN", csrfToken);
|
||||
if (dataObject == null) { //отправляем запрос в зависимости задан объект данных или нет
|
||||
this.xhttp.send(); //запрос без данных
|
||||
}
|
||||
else { //ставим заголовок что это json данные
|
||||
this.xhttp.setRequestHeader("Content-type", "application/json");
|
||||
this.xhttp.send(JSON.stringify(dataObject)); //запрос с данными
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.error("ERROR: ", e); //выводим ошибку на консоль
|
||||
resolve(""); //вызываем промис с пустой строкой
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=ajax.js.map
|
||||
/**
|
||||
* Класс работы с куками
|
||||
*/
|
||||
class Cookies {
|
||||
/**
|
||||
* Метод получает значение куки по имени
|
||||
* @param cookieName - название куки
|
||||
* @return - значение куки
|
||||
*/
|
||||
getCookie(cookieName) {
|
||||
const name = cookieName + "=";
|
||||
const decodedCookie = decodeURIComponent(document.cookie);
|
||||
const ca = decodedCookie.split(";");
|
||||
for (let i = 0; i < ca.length; i++) {
|
||||
let c = ca[i];
|
||||
while (c.charAt(0) === " ") {
|
||||
c = c.substring(1);
|
||||
}
|
||||
if (c.indexOf(name) === 0) {
|
||||
return c.substring(name.length, c.length);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
/**
|
||||
* Метод устанавливает куку
|
||||
* @param name - имя куки
|
||||
* @param value - значение куки
|
||||
*/
|
||||
setCookie(name, value) {
|
||||
const date = new Date(); //создаем переменную даты
|
||||
//устанавливаем дату плюс месяц
|
||||
date.setTime(date.getTime() + 30 * 24 * 60 * 60 * 1000);
|
||||
//устанавливаем куку
|
||||
document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + date.toUTCString() + ";path=/;secure";
|
||||
}
|
||||
/**
|
||||
* Метод удаляет куку по имени
|
||||
* @param name - имя куки
|
||||
*/
|
||||
removeCookie(name) {
|
||||
document.cookie = name + "=;Max-Age=-99999999;";
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=cookies.js.map
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Класс детализации компании
|
||||
*/
|
||||
class Details {
|
||||
/**
|
||||
* Конструктор
|
||||
*/
|
||||
constructor(utilities, cookies, id) {
|
||||
this.cookies = cookies;
|
||||
this.utilities = utilities;
|
||||
this.IdCompany = id;
|
||||
this.EmployeeInputFirst = document.getElementById("employee_fisrt");
|
||||
this.EmployeeInputLast = document.getElementById("employee_last");
|
||||
this.EmployeeInputTitle = document.getElementById("employee_title");
|
||||
this.EmployeeInputBirthDate = document.getElementById("employee_date");
|
||||
this.EmployeeInputPos = document.getElementById("employee_pos");
|
||||
var updateHistoryBtn = document.getElementById("update_history_action");
|
||||
if (updateHistoryBtn !== null) {
|
||||
updateHistoryBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () { return yield this.generateHistory(); }));
|
||||
}
|
||||
var updateNotesBtn = document.getElementById("update_notes_action");
|
||||
if (updateNotesBtn !== null) {
|
||||
updateNotesBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () { return yield this.generateNotes(); }));
|
||||
}
|
||||
var updateEmployeesBtn = document.getElementById("update_employees_action");
|
||||
if (updateEmployeesBtn !== null) {
|
||||
updateEmployeesBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () { return yield this.generateEmployees(); }));
|
||||
}
|
||||
var removeNotesBtn = document.getElementById("remove_notes_action");
|
||||
if (removeNotesBtn !== null) {
|
||||
removeNotesBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () {
|
||||
yield this.removeNotes();
|
||||
yield this.generateNotes();
|
||||
}));
|
||||
}
|
||||
var removeEmployeesBtn = document.getElementById("remove_employees_action");
|
||||
if (removeEmployeesBtn !== null) {
|
||||
removeEmployeesBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () {
|
||||
yield this.removeEmployees();
|
||||
yield this.generateEmployees();
|
||||
}));
|
||||
}
|
||||
var addNotesBtn = document.getElementById("add_notes_action");
|
||||
if (addNotesBtn !== null) {
|
||||
addNotesBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () { return window.open("/docs"); }));
|
||||
}
|
||||
var addEmployeesBtn = document.getElementById("add_employees_action");
|
||||
if (addEmployeesBtn !== null) {
|
||||
addEmployeesBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () { return window.open("/docs"); }));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Метод запускает страницу детализации
|
||||
*/
|
||||
startDetailsLogic() {
|
||||
console.log("Start Loading Company: " + this.IdCompany.toString());
|
||||
this.generateInfo()
|
||||
.then(() => {
|
||||
console.log("-> action Generate Info ok");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("-> error: " + error);
|
||||
});
|
||||
this.generateHistory()
|
||||
.then(() => {
|
||||
console.log("-> action Generate History ok");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("-> error: " + error);
|
||||
});
|
||||
this.generateNotes()
|
||||
.then(() => {
|
||||
console.log("-> action Generate Notes ok");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("-> error: " + error);
|
||||
});
|
||||
this.generateEmployees()
|
||||
.then(() => {
|
||||
console.log("-> action Generate Employees ok");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("-> error: " + error);
|
||||
});
|
||||
}
|
||||
/*
|
||||
<tr>
|
||||
<td>John < /td>
|
||||
< td > Heart < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>Olivia < /td>
|
||||
< td > Peyton < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>Robert < /td>
|
||||
< td > Reagan < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>Cynthia < /td>
|
||||
< td > Stanwick < /td>
|
||||
< /tr>
|
||||
*/
|
||||
/**
|
||||
* Загрузка блока Employees
|
||||
*/
|
||||
generateEmployees() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
this.EmployeeInputFirst.value = "";
|
||||
this.EmployeeInputLast.value = "";
|
||||
this.EmployeeInputTitle.value = "";
|
||||
this.EmployeeInputBirthDate.value = "";
|
||||
this.EmployeeInputPos.value = "";
|
||||
var notesBlock = document.getElementById("employees_block");
|
||||
notesBlock.innerHTML = '';
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("GetEmployees", this.cookies);
|
||||
//отправляем запрос
|
||||
const response = yield ajax.sendRequest();
|
||||
console.log(response);
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
var first = 0;
|
||||
dataResponse.forEach((trData) => {
|
||||
var tr = document.createElement("tr");
|
||||
tr.id = trData.Id;
|
||||
var td_first = document.createElement("td");
|
||||
var td_last = document.createElement("td");
|
||||
tr.appendChild(td_first);
|
||||
tr.appendChild(td_last);
|
||||
td_first.innerText = trData.FirstName;
|
||||
td_last.innerText = trData.LastName;
|
||||
tr.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () {
|
||||
if (tr.classList.contains("remove")) {
|
||||
tr.classList.remove("remove");
|
||||
tr.setAttribute("style", "background: #ffffff;");
|
||||
}
|
||||
else {
|
||||
tr.classList.add("remove");
|
||||
tr.setAttribute("style", "background: #e3e3e3;");
|
||||
}
|
||||
yield this.getInfoEmployee(Number(trData.Id));
|
||||
}));
|
||||
notesBlock.appendChild(tr);
|
||||
if (first == 0) {
|
||||
this.getInfoEmployee(Number(trData.Id));
|
||||
}
|
||||
first++;
|
||||
});
|
||||
});
|
||||
}
|
||||
removeEmployees() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var notesBlock = document.getElementById("employees_block");
|
||||
var remEls = Array.from(notesBlock.getElementsByClassName('remove'));
|
||||
var ids = [];
|
||||
remEls.forEach((el) => {
|
||||
ids.push(Number(el.id));
|
||||
});
|
||||
const dataRequest = {
|
||||
"ids": ids
|
||||
};
|
||||
if (ids.length > 0) {
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("DeleteEmployees", this.cookies);
|
||||
//отправляем запрос
|
||||
yield ajax.sendRequest(dataRequest);
|
||||
}
|
||||
});
|
||||
}
|
||||
getInfoEmployee(id) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const dataRequest = {
|
||||
"id": id
|
||||
};
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("GetEmployee", this.cookies);
|
||||
//отправляем запрос
|
||||
var response = yield ajax.sendRequest(dataRequest);
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
console.log(dataResponse);
|
||||
this.EmployeeInputFirst.value = dataResponse.FirstName;
|
||||
this.EmployeeInputLast.value = dataResponse.LastName;
|
||||
this.EmployeeInputTitle.value = dataResponse.Title;
|
||||
this.EmployeeInputBirthDate.value = dataResponse.BirthDate;
|
||||
this.EmployeeInputPos.value = dataResponse.Position;
|
||||
});
|
||||
}
|
||||
/*
|
||||
<tr>
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>*/
|
||||
/**
|
||||
* Загрузка блока Notes
|
||||
*/
|
||||
generateNotes() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var notesBlock = document.getElementById("notes_block");
|
||||
notesBlock.innerHTML = '';
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("GetNotes", this.cookies);
|
||||
//отправляем запрос
|
||||
const response = yield ajax.sendRequest();
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
dataResponse.forEach((trData) => {
|
||||
var tr = document.createElement("tr");
|
||||
var td_id = document.createElement("td");
|
||||
var td_emplo = document.createElement("td");
|
||||
tr.appendChild(td_id);
|
||||
tr.appendChild(td_emplo);
|
||||
td_id.innerText = trData.Id;
|
||||
td_emplo.innerText = trData.Employee;
|
||||
tr.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () {
|
||||
if (tr.classList.contains("remove")) {
|
||||
tr.classList.remove("remove");
|
||||
tr.setAttribute("style", "background: #ffffff;");
|
||||
}
|
||||
else {
|
||||
tr.classList.add("remove");
|
||||
tr.setAttribute("style", "background: #e3e3e3;");
|
||||
}
|
||||
}));
|
||||
notesBlock.appendChild(tr);
|
||||
});
|
||||
});
|
||||
}
|
||||
removeNotes() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var notesBlock = document.getElementById("notes_block");
|
||||
var remEls = Array.from(notesBlock.getElementsByClassName('remove'));
|
||||
var ids = [];
|
||||
remEls.forEach((el) => {
|
||||
var id = el.children[0].innerHTML;
|
||||
ids.push(Number(id));
|
||||
});
|
||||
const dataRequest = {
|
||||
"ids": ids
|
||||
};
|
||||
if (ids.length > 0) {
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("DeleteNotes", this.cookies);
|
||||
//отправляем запрос
|
||||
yield ajax.sendRequest(dataRequest);
|
||||
}
|
||||
});
|
||||
}
|
||||
/*@*
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>*@*/
|
||||
/**
|
||||
* Загрузка блока History
|
||||
*/
|
||||
generateHistory() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
console.log("Start Loading Orders History Company: " + this.IdCompany.toString());
|
||||
var historyBlock = document.getElementById("history_block");
|
||||
historyBlock.innerHTML = '';
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("GetOrdersHistory", this.cookies);
|
||||
//отправляем запрос
|
||||
const response = yield ajax.sendRequest();
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
dataResponse.forEach((trData) => {
|
||||
var tr = document.createElement("tr");
|
||||
var td_date = document.createElement("td");
|
||||
var td_store = document.createElement("td");
|
||||
tr.appendChild(td_date);
|
||||
tr.appendChild(td_store);
|
||||
td_date.innerText = trData.OrderDate;
|
||||
td_store.innerText = trData.StoreCity;
|
||||
historyBlock.appendChild(tr);
|
||||
});
|
||||
});
|
||||
}
|
||||
/*
|
||||
<label>ID: </label>
|
||||
< input type = "number" value = "1" readonly />
|
||||
<label>Name: </label>
|
||||
< input type = "text" value = "Super Mart of the West" readonly />
|
||||
<label>Address: </label>
|
||||
< input type = "text" value = "702 SW 8th Street" readonly />
|
||||
<label>City: </label>
|
||||
< input type = "text" value = "Bentonville" readonly />
|
||||
<label>State: </label>
|
||||
< input type = "text" value = "Arkansas" readonly />
|
||||
*/
|
||||
/**
|
||||
* Загрузка блока Info
|
||||
*/
|
||||
generateInfo() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
console.log("Start Loading Info Company: " + this.IdCompany.toString());
|
||||
var infoBlock = document.getElementById("info_block");
|
||||
var labelId = document.createElement("label");
|
||||
labelId.innerText = "ID:";
|
||||
var inputId = document.createElement("input");
|
||||
inputId.type = "number";
|
||||
inputId.setAttribute('readonly', '');
|
||||
var labelName = document.createElement("label");
|
||||
labelName.innerText = "Name:";
|
||||
var inputName = document.createElement("input");
|
||||
inputName.type = "text";
|
||||
inputName.setAttribute('readonly', '');
|
||||
var labelAddress = document.createElement("label");
|
||||
labelAddress.innerText = "Address:";
|
||||
var inputAddress = document.createElement("input");
|
||||
inputAddress.type = "text";
|
||||
inputAddress.setAttribute('readonly', '');
|
||||
var labelCity = document.createElement("label");
|
||||
labelCity.innerText = "City:";
|
||||
var inputCity = document.createElement("input");
|
||||
inputCity.type = "text";
|
||||
inputCity.setAttribute('readonly', '');
|
||||
var labelState = document.createElement("label");
|
||||
labelState.innerText = "State:";
|
||||
var inputState = document.createElement("input");
|
||||
inputState.type = "text";
|
||||
inputState.setAttribute('readonly', '');
|
||||
/*append elements*/
|
||||
infoBlock.appendChild(labelId);
|
||||
infoBlock.appendChild(inputId);
|
||||
infoBlock.appendChild(labelName);
|
||||
infoBlock.appendChild(inputName);
|
||||
infoBlock.appendChild(labelAddress);
|
||||
infoBlock.appendChild(inputAddress);
|
||||
infoBlock.appendChild(labelCity);
|
||||
infoBlock.appendChild(inputCity);
|
||||
infoBlock.appendChild(labelState);
|
||||
infoBlock.appendChild(inputState);
|
||||
const dataRequest = {
|
||||
"idCompany": Number(this.IdCompany)
|
||||
};
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("getCompanyInfo", this.cookies);
|
||||
//отправляем запрос
|
||||
const response = yield ajax.sendRequest(dataRequest);
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
if (dataResponse.IsValid) {
|
||||
/*Start load data*/
|
||||
inputId.value = dataResponse.Id;
|
||||
inputName.value = dataResponse.Name;
|
||||
inputAddress.value = dataResponse.Address;
|
||||
inputCity.value = dataResponse.City;
|
||||
inputState.value = dataResponse.State;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=details.js.map
|
||||
class Index {
|
||||
/**
|
||||
* Конструктор
|
||||
*/
|
||||
constructor() {
|
||||
console.log("Load Main Page");
|
||||
var addCompanyBtn = document.getElementById("add_company_action");
|
||||
console.log(addCompanyBtn);
|
||||
addCompanyBtn.addEventListener("click", () => window.open("/docs"));
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
(() => {
|
||||
//по загрузке страницы
|
||||
window.addEventListener("load", () => {
|
||||
//создаем экземпляр класса утилит
|
||||
const utilities = new Utilities();
|
||||
//создаем экземпляр класса кук
|
||||
const cookies = new Cookies();
|
||||
//получаем текущий URL
|
||||
const currentUrl = new URL(document.location.href);
|
||||
//получаем путь из URL
|
||||
const pathname = currentUrl.pathname.toLowerCase();
|
||||
//разбиваем пути URL на части
|
||||
const partsPath = pathname.split("/");
|
||||
switch (partsPath[1]) { //смотрим путь URL
|
||||
case "":
|
||||
{
|
||||
console.log("Index Load");
|
||||
new Index();
|
||||
}
|
||||
break;
|
||||
case "details": //страница детализации
|
||||
{ //создаем класс авторизации кабинета
|
||||
console.log("Details Load");
|
||||
const id = partsPath[2];
|
||||
const detailsScene = new Details(utilities, cookies, id);
|
||||
//запускаем главную сцену
|
||||
detailsScene.startDetailsLogic();
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
})();
|
||||
//# sourceMappingURL=main.js.map
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Класс вспомогательных методов
|
||||
*/
|
||||
class Utilities {
|
||||
/**
|
||||
* Метод проверяет строку на пустоту
|
||||
* @param value - проверяемая строка
|
||||
* @return - true:строка пуста, false:строка не пуста
|
||||
*/
|
||||
isEmpty(value) {
|
||||
if (value == null)
|
||||
return true; //проверяем строку на null
|
||||
if (value === "")
|
||||
return true; //проверяем строку на пустоту
|
||||
return false; //отдаем строка не пуста
|
||||
}
|
||||
/**
|
||||
* Метод проверяет валидность Email
|
||||
* @param email - email
|
||||
* @return - true:yes, false:no
|
||||
*/
|
||||
isValidEmail(email) {
|
||||
if (this.isEmpty(email))
|
||||
return false; //проверяем Email на пустоту
|
||||
//паттерн проверки валидности Email
|
||||
const pattern = /^([a-z0-9_.-])+@[a-z0-9-]+\.([a-z]{2,4}\.)?[a-z]{2,4}$/i;
|
||||
return pattern.test(email); //проверяем валидность Email и отдаем результат
|
||||
}
|
||||
/**
|
||||
* Метод делает асинхронную задержку
|
||||
* @param mlsec - размер задержки в миллисекундах
|
||||
*/
|
||||
doDelay(mlsec) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve(null); //оповещаем промис
|
||||
}, mlsec);
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Метод отдаем ширину окна браузера
|
||||
* @returns - ширина окна браузера
|
||||
*/
|
||||
get getWidh() {
|
||||
//отдаем максимальную ширину
|
||||
return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
||||
}
|
||||
/**
|
||||
* Метод отдает высоту окна браузера
|
||||
* @returns - высота окна браузера
|
||||
*/
|
||||
get getHeight() {
|
||||
//отдаем максимальную высоту
|
||||
return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
||||
}
|
||||
/**
|
||||
* Метод генерирует случайное число в заданном диапазоне
|
||||
* @param min - минимальное число
|
||||
* @param max - максимальное число
|
||||
*/
|
||||
getRandomInt(min, max) {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
/**
|
||||
* Метод копирует текст в буфер обмена
|
||||
* @param value - текст для копирования в буфер
|
||||
* @param element - элемент вызывающий действие копирования
|
||||
*/
|
||||
copyValueToBuffer(value, element) {
|
||||
try {
|
||||
const coord = element.getBoundingClientRect(); //получаем координаты кнопки
|
||||
//получаем расстояние сколько проскроллено сверху
|
||||
const scrolled = window.pageYOffset || document.documentElement.scrollTop;
|
||||
//получаем iOs ли устройство
|
||||
const iOsDevice = navigator.userAgent.match(/ipad|iphone/i);
|
||||
//создаем textarea
|
||||
const textArea = document.createElement("textarea");
|
||||
//ставим что textarea только для чтения
|
||||
textArea.readOnly = true;
|
||||
//ставим textarea отступ сверху на величину скролла + координаты кнопки что бы экран не прыгал
|
||||
textArea.style.top = `${Math.round(scrolled + coord.top)}px`;
|
||||
//подставляем невидимый класс
|
||||
textArea.classList.add("text_copy");
|
||||
//подставляем текст в textarea
|
||||
textArea.value = value;
|
||||
//добавляем textarea в DOM
|
||||
document.body.appendChild(textArea);
|
||||
//делаем textarea в фокус
|
||||
textArea.focus();
|
||||
//проверяем iOs устройство
|
||||
if (iOsDevice) {
|
||||
const editable = textArea.contentEditable;
|
||||
const readOnly = textArea.readOnly;
|
||||
textArea.contentEditable = "true";
|
||||
textArea.readOnly = false;
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(textArea);
|
||||
const selection = window.getSelection();
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
textArea.setSelectionRange(0, 999999);
|
||||
textArea.contentEditable = editable;
|
||||
textArea.readOnly = readOnly;
|
||||
}
|
||||
else {
|
||||
textArea.select(); //делаем textarea выбранной
|
||||
} //выполняем команду по копированию в буфер обмена
|
||||
const resultCopy = document.execCommand("copy");
|
||||
document.body.removeChild(textArea); //удаляем textarea
|
||||
return resultCopy; //отдаем результат копирования
|
||||
}
|
||||
catch (e) {
|
||||
console.error("Error: ", e); //выводим ошибку на консоль
|
||||
return false; //возвращаем что данные не скопированы
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Метод получает текущую дату в строковом значении
|
||||
*/
|
||||
getCurrentDate() {
|
||||
const date = new Date(); //получаем текущую дату
|
||||
const nowDay = date.getDate(); //получаем текущий день
|
||||
const nowMonth = date.getMonth() + 1; //получаем текущий месяц
|
||||
let forFullDay = ""; //добавка для полного дня с нулем
|
||||
if (nowDay < 10) { //проверяем если день менее 10
|
||||
forFullDay = "0"; //пишем ноль в добавку
|
||||
}
|
||||
let forFullMonth = ""; //добавка для полного месяца
|
||||
if (nowMonth < 10) { //проверяем если месяц менее 10
|
||||
forFullMonth = "0"; //пишем ноль в добавку
|
||||
}
|
||||
return `${forFullDay}${nowDay}.${forFullMonth}${nowMonth}.${date.getFullYear()}`;
|
||||
}
|
||||
/**
|
||||
* Метод генерирует UIID
|
||||
*/
|
||||
generateUuid() {
|
||||
var d = new Date().getTime();
|
||||
var d2 = ((typeof performance !== "undefined") && performance.now && (performance.now() * 1000)) || 0;
|
||||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
|
||||
var r = Math.random() * 16;
|
||||
if (d > 0) {
|
||||
r = (d + r) % 16 | 0;
|
||||
d = Math.floor(d / 16);
|
||||
}
|
||||
else {
|
||||
r = (d2 + r) % 16 | 0;
|
||||
d2 = Math.floor(d2 / 16);
|
||||
}
|
||||
return (c === "x" ? r : (r & 0x3 | 0x8)).toString(16);
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=utilities.js.map
|
@ -1,246 +0,0 @@
|
||||
|
||||
|
||||
html {
|
||||
font-size: 16px;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
|
||||
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
|
||||
}
|
||||
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 93%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.content_companies {
|
||||
border: 3px solid black;
|
||||
padding: 0 20px 40px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.header {
|
||||
width: 1000px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
}
|
||||
.header.mini{
|
||||
width: 330px;
|
||||
}
|
||||
|
||||
.header.mini h4 {
|
||||
min-height: 20px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.header.details {
|
||||
width: 85%;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.header.details h4 {
|
||||
padding-right: 25px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.header .header_btns {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.header .header_btns svg {
|
||||
cursor: pointer;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.header .header_btns svg .mini_btn {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.group {
|
||||
margin: 10px 20px 20px 0;
|
||||
padding-bottom: 20px;
|
||||
max-width: 330px;
|
||||
border-top: 1px solid #D5D5D5;
|
||||
border-bottom: 1px solid #d5d5d5;
|
||||
}
|
||||
|
||||
.group.two {
|
||||
max-width: 600px
|
||||
}
|
||||
|
||||
.data {
|
||||
width: 1000px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
align-content: center;
|
||||
}
|
||||
.data.row {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.data.row.empo {
|
||||
width: 97%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
align-content: flex-start;
|
||||
justify-content: flex-start;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.data.row.empo .group {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.data.row.empo .group:first-child {
|
||||
margin: 0px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.data.mini {
|
||||
width: 330px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2,0fr);
|
||||
grid-gap: 10px;
|
||||
font-size: 18px;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.data.mini input {
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #d5d5d5;
|
||||
font-size: 20px;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
overflow: hidden;
|
||||
width: 741%;
|
||||
}
|
||||
|
||||
.data.table {
|
||||
width: 100%;
|
||||
max-height: 330px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.data.table::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.data.table table {
|
||||
cursor: default;
|
||||
width: 330px;
|
||||
max-height: 330px;
|
||||
font-size: 18px;
|
||||
white-space: nowrap;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.data.table table thead tr {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.data.table table thead tr td {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.data.table table tbody tr td {
|
||||
padding: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.data table {
|
||||
width: 1000px;
|
||||
border-collapse: collapse;
|
||||
border: 2px solid #EBEBEB;
|
||||
}
|
||||
|
||||
.data table thead {
|
||||
color: #B3A9AC;
|
||||
}
|
||||
|
||||
.data table thead tr td {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.data table tbody tr a {
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.data table tbody tr td {
|
||||
padding: 5px;
|
||||
border-bottom-color: white;
|
||||
}
|
||||
|
||||
.table-scroll-body {
|
||||
max-height: 280px;
|
||||
overflow-x: auto;
|
||||
margin-top: 0px;
|
||||
border-bottom: 1px solid #EBEBEB;
|
||||
}
|
||||
|
||||
.table-scroll table {
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.table-scroll thead td {
|
||||
text-align: left;
|
||||
padding: 10px 15px;
|
||||
border-top: 1px solid #EBEBEB;
|
||||
border-left: 1px solid #EBEBEB;
|
||||
border-right: 1px solid #EBEBEB;
|
||||
}
|
||||
|
||||
.table-scroll tbody td {
|
||||
text-align: left;
|
||||
border-left: 1px solid #EBEBEB;
|
||||
border-right: 1px solid #EBEBEB;
|
||||
padding: 10px 15px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.table-scroll-body table tbody.tnotes tr td:first-child {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Стили для скролла */
|
||||
::-webkit-scrollbar {
|
||||
width: 1px;
|
||||
}
|
||||
|
||||
|
||||
.element {
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Класс Ajax запросов
|
||||
*/
|
||||
class Ajax {
|
||||
/**
|
||||
* Конструктор
|
||||
* @param path - Путь запроса
|
||||
* @param cookies - экземпляр класса работы с куками
|
||||
*/
|
||||
constructor(path, cookies) {
|
||||
this.requestUrl = `/ajax/${path}`; //присваиваем URL запроса
|
||||
this.cookies = cookies; //присваиваем экземпляр класса работы с куками
|
||||
this.xhttp = new XMLHttpRequest(); //инициализируем xhttp
|
||||
}
|
||||
/**
|
||||
* Метод отправляет ajax запрос
|
||||
* @param dataObject - Объект данных запроса
|
||||
*/
|
||||
sendRequest(dataObject = null) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return new Promise(resolve => {
|
||||
try { //получаем защитный токен
|
||||
const csrfToken = this.cookies.getCookie("CSRF-TOKEN");
|
||||
//добавляем параметры асинхронного запроса
|
||||
this.xhttp.open("POST", this.requestUrl, true);
|
||||
this.xhttp.onreadystatechange = () => {
|
||||
//проверяем готовность ответа
|
||||
if (this.xhttp.readyState !== 4)
|
||||
return;
|
||||
//проверяем успешен или нет ответ
|
||||
if (this.xhttp.status !== 200) {
|
||||
resolve(""); //вызываем промис с пустой строкой
|
||||
return; //не продолжаем
|
||||
} //вызываем промис с текстом ответа
|
||||
resolve(this.xhttp.responseText);
|
||||
};
|
||||
this.xhttp.onerror = () => {
|
||||
//выводим ошибку на консоль
|
||||
console.error("ERROR: ", "Bad response");
|
||||
resolve(""); //вызываем промис с пустой строкой
|
||||
}; //подставляем в заголовки защитный токен
|
||||
this.xhttp.setRequestHeader("X-CSRF-TOKEN", csrfToken);
|
||||
if (dataObject == null) { //отправляем запрос в зависимости задан объект данных или нет
|
||||
this.xhttp.send(); //запрос без данных
|
||||
}
|
||||
else { //ставим заголовок что это json данные
|
||||
this.xhttp.setRequestHeader("Content-type", "application/json");
|
||||
this.xhttp.send(JSON.stringify(dataObject)); //запрос с данными
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.error("ERROR: ", e); //выводим ошибку на консоль
|
||||
resolve(""); //вызываем промис с пустой строкой
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=ajax.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"ajax.js","sourceRoot":"","sources":["../TypeScripts/ajax.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;GAEG;AACH,MAAM,IAAI;IAiBN;;;;OAIG;IACH,YAAY,IAAY,EAAE,OAAgB;QACtC,IAAI,CAAC,UAAU,GAAG,SAAS,IAAI,EAAE,CAAC,CAAC,yBAAyB;QAC5D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,8CAA8C;QACtE,IAAI,CAAC,KAAK,GAAG,IAAI,cAAc,EAAE,CAAC,CAAC,sBAAsB;IAC7D,CAAC;IAED;;;OAGG;IACG,WAAW,CAAC,aAAqB,IAAI;;YACvC,OAAO,IAAI,OAAO,CAAS,OAAO,CAAC,EAAE;gBACjC,IAAI,EAAE,yBAAyB;oBAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;oBACvD,0CAA0C;oBAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;oBAC/C,IAAI,CAAC,KAAK,CAAC,kBAAkB,GAAG,GAAG,EAAE;wBACjC,6BAA6B;wBAC7B,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC;4BAAE,OAAO;wBACxC,iCAAiC;wBACjC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE;4BAC3B,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,kCAAkC;4BAC/C,OAAO,CAAC,eAAe;yBAC1B,CAAC,kCAAkC;wBACpC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;oBACrC,CAAC,CAAC;oBACF,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,EAAE;wBACtB,2BAA2B;wBAC3B,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;wBACzC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,kCAAkC;oBACnD,CAAC,CAAC,CAAC,wCAAwC;oBAC3C,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;oBACvD,IAAI,UAAU,IAAI,IAAI,EAAE,EAAE,6DAA6D;wBACnF,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,mBAAmB;qBACzC;yBAAM,EAAE,sCAAsC;wBAC3C,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;wBAChE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,kBAAkB;qBAClE;iBACJ;gBAAC,OAAO,CAAC,EAAE;oBACR,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,2BAA2B;oBACxD,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,kCAAkC;iBAClD;YACL,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;CACJ"}
|
@ -1,45 +0,0 @@
|
||||
/**
|
||||
* Класс работы с куками
|
||||
*/
|
||||
class Cookies {
|
||||
/**
|
||||
* Метод получает значение куки по имени
|
||||
* @param cookieName - название куки
|
||||
* @return - значение куки
|
||||
*/
|
||||
getCookie(cookieName) {
|
||||
const name = cookieName + "=";
|
||||
const decodedCookie = decodeURIComponent(document.cookie);
|
||||
const ca = decodedCookie.split(";");
|
||||
for (let i = 0; i < ca.length; i++) {
|
||||
let c = ca[i];
|
||||
while (c.charAt(0) === " ") {
|
||||
c = c.substring(1);
|
||||
}
|
||||
if (c.indexOf(name) === 0) {
|
||||
return c.substring(name.length, c.length);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
/**
|
||||
* Метод устанавливает куку
|
||||
* @param name - имя куки
|
||||
* @param value - значение куки
|
||||
*/
|
||||
setCookie(name, value) {
|
||||
const date = new Date(); //создаем переменную даты
|
||||
//устанавливаем дату плюс месяц
|
||||
date.setTime(date.getTime() + 30 * 24 * 60 * 60 * 1000);
|
||||
//устанавливаем куку
|
||||
document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + date.toUTCString() + ";path=/;secure";
|
||||
}
|
||||
/**
|
||||
* Метод удаляет куку по имени
|
||||
* @param name - имя куки
|
||||
*/
|
||||
removeCookie(name) {
|
||||
document.cookie = name + "=;Max-Age=-99999999;";
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=cookies.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"cookies.js","sourceRoot":"","sources":["../TypeScripts/cookies.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO;IAET;;;;OAIG;IACH,SAAS,CAAC,UAAkB;QACxB,MAAM,IAAI,GAAQ,UAAU,GAAG,GAAG,CAAC;QACnC,MAAM,aAAa,GAAG,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC1D,MAAM,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAChC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;YACd,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;gBACxB,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;aACtB;YACD,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;gBAEvB,OAAO,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;aAC7C;SACJ;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,IAAY,EAAE,KAAa;QACjC,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,CAAC,yBAAyB;QAClD,+BAA+B;QAC/B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QACxD,oBAAoB;QACpB,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,GAAG,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,GAAG,gBAAgB,CAAC;IACnH,CAAC;IAED;;;OAGG;IACH,YAAY,CAAC,IAAY;QACrB,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,sBAAsB,CAAC;IACpD,CAAC;CACJ"}
|
@ -1,430 +0,0 @@
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Класс детализации компании
|
||||
*/
|
||||
class Details {
|
||||
/**
|
||||
* Конструктор
|
||||
*/
|
||||
constructor(utilities, cookies, id) {
|
||||
this.cookies = cookies;
|
||||
this.utilities = utilities;
|
||||
this.IdCompany = id;
|
||||
this.EmployeeInputFirst = document.getElementById("employee_fisrt");
|
||||
this.EmployeeInputLast = document.getElementById("employee_last");
|
||||
this.EmployeeInputTitle = document.getElementById("employee_title");
|
||||
this.EmployeeInputBirthDate = document.getElementById("employee_date");
|
||||
this.EmployeeInputPos = document.getElementById("employee_pos");
|
||||
var updateHistoryBtn = document.getElementById("update_history_action");
|
||||
if (updateHistoryBtn !== null) {
|
||||
updateHistoryBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () { return yield this.generateHistory(); }));
|
||||
}
|
||||
var updateNotesBtn = document.getElementById("update_notes_action");
|
||||
if (updateNotesBtn !== null) {
|
||||
updateNotesBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () { return yield this.generateNotes(); }));
|
||||
}
|
||||
var updateEmployeesBtn = document.getElementById("update_employees_action");
|
||||
if (updateEmployeesBtn !== null) {
|
||||
updateEmployeesBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () { return yield this.generateEmployees(); }));
|
||||
}
|
||||
var removeNotesBtn = document.getElementById("remove_notes_action");
|
||||
if (removeNotesBtn !== null) {
|
||||
removeNotesBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () {
|
||||
yield this.removeNotes();
|
||||
yield this.generateNotes();
|
||||
}));
|
||||
}
|
||||
var removeEmployeesBtn = document.getElementById("remove_employees_action");
|
||||
if (removeEmployeesBtn !== null) {
|
||||
removeEmployeesBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () {
|
||||
yield this.removeEmployees();
|
||||
yield this.generateEmployees();
|
||||
}));
|
||||
}
|
||||
var addNotesBtn = document.getElementById("add_notes_action");
|
||||
if (addNotesBtn !== null) {
|
||||
addNotesBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () { return window.open("/docs"); }));
|
||||
}
|
||||
var addEmployeesBtn = document.getElementById("add_employees_action");
|
||||
if (addEmployeesBtn !== null) {
|
||||
addEmployeesBtn.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () { return window.open("/docs"); }));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Метод запускает страницу детализации
|
||||
*/
|
||||
startDetailsLogic() {
|
||||
console.log("Start Loading Company: " + this.IdCompany.toString());
|
||||
this.generateInfo()
|
||||
.then(() => {
|
||||
console.log("-> action Generate Info ok");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("-> error: " + error);
|
||||
});
|
||||
this.generateHistory()
|
||||
.then(() => {
|
||||
console.log("-> action Generate History ok");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("-> error: " + error);
|
||||
});
|
||||
this.generateNotes()
|
||||
.then(() => {
|
||||
console.log("-> action Generate Notes ok");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("-> error: " + error);
|
||||
});
|
||||
this.generateEmployees()
|
||||
.then(() => {
|
||||
console.log("-> action Generate Employees ok");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("-> error: " + error);
|
||||
});
|
||||
}
|
||||
/*
|
||||
<tr>
|
||||
<td>John < /td>
|
||||
< td > Heart < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>Olivia < /td>
|
||||
< td > Peyton < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>Robert < /td>
|
||||
< td > Reagan < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>Cynthia < /td>
|
||||
< td > Stanwick < /td>
|
||||
< /tr>
|
||||
*/
|
||||
/**
|
||||
* Загрузка блока Employees
|
||||
*/
|
||||
generateEmployees() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
this.EmployeeInputFirst.value = "";
|
||||
this.EmployeeInputLast.value = "";
|
||||
this.EmployeeInputTitle.value = "";
|
||||
this.EmployeeInputBirthDate.value = "";
|
||||
this.EmployeeInputPos.value = "";
|
||||
var notesBlock = document.getElementById("employees_block");
|
||||
notesBlock.innerHTML = '';
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("GetEmployees", this.cookies);
|
||||
//отправляем запрос
|
||||
const response = yield ajax.sendRequest();
|
||||
console.log(response);
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
var first = 0;
|
||||
dataResponse.forEach((trData) => {
|
||||
var tr = document.createElement("tr");
|
||||
tr.id = trData.Id;
|
||||
var td_first = document.createElement("td");
|
||||
var td_last = document.createElement("td");
|
||||
tr.appendChild(td_first);
|
||||
tr.appendChild(td_last);
|
||||
td_first.innerText = trData.FirstName;
|
||||
td_last.innerText = trData.LastName;
|
||||
tr.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () {
|
||||
if (tr.classList.contains("remove")) {
|
||||
tr.classList.remove("remove");
|
||||
tr.setAttribute("style", "background: #ffffff;");
|
||||
}
|
||||
else {
|
||||
tr.classList.add("remove");
|
||||
tr.setAttribute("style", "background: #e3e3e3;");
|
||||
}
|
||||
yield this.getInfoEmployee(Number(trData.Id));
|
||||
}));
|
||||
notesBlock.appendChild(tr);
|
||||
if (first == 0) {
|
||||
this.getInfoEmployee(Number(trData.Id));
|
||||
}
|
||||
first++;
|
||||
});
|
||||
});
|
||||
}
|
||||
removeEmployees() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var notesBlock = document.getElementById("employees_block");
|
||||
var remEls = Array.from(notesBlock.getElementsByClassName('remove'));
|
||||
var ids = [];
|
||||
remEls.forEach((el) => {
|
||||
ids.push(Number(el.id));
|
||||
});
|
||||
const dataRequest = {
|
||||
"ids": ids
|
||||
};
|
||||
if (ids.length > 0) {
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("DeleteEmployees", this.cookies);
|
||||
//отправляем запрос
|
||||
yield ajax.sendRequest(dataRequest);
|
||||
}
|
||||
});
|
||||
}
|
||||
getInfoEmployee(id) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const dataRequest = {
|
||||
"id": id
|
||||
};
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("GetEmployee", this.cookies);
|
||||
//отправляем запрос
|
||||
var response = yield ajax.sendRequest(dataRequest);
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
console.log(dataResponse);
|
||||
this.EmployeeInputFirst.value = dataResponse.FirstName;
|
||||
this.EmployeeInputLast.value = dataResponse.LastName;
|
||||
this.EmployeeInputTitle.value = dataResponse.Title;
|
||||
this.EmployeeInputBirthDate.value = dataResponse.BirthDate;
|
||||
this.EmployeeInputPos.value = dataResponse.Position;
|
||||
});
|
||||
}
|
||||
/*
|
||||
<tr>
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>*/
|
||||
/**
|
||||
* Загрузка блока Notes
|
||||
*/
|
||||
generateNotes() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var notesBlock = document.getElementById("notes_block");
|
||||
notesBlock.innerHTML = '';
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("GetNotes", this.cookies);
|
||||
//отправляем запрос
|
||||
const response = yield ajax.sendRequest();
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
dataResponse.forEach((trData) => {
|
||||
var tr = document.createElement("tr");
|
||||
var td_id = document.createElement("td");
|
||||
var td_emplo = document.createElement("td");
|
||||
tr.appendChild(td_id);
|
||||
tr.appendChild(td_emplo);
|
||||
td_id.innerText = trData.Id;
|
||||
td_emplo.innerText = trData.Employee;
|
||||
tr.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () {
|
||||
if (tr.classList.contains("remove")) {
|
||||
tr.classList.remove("remove");
|
||||
tr.setAttribute("style", "background: #ffffff;");
|
||||
}
|
||||
else {
|
||||
tr.classList.add("remove");
|
||||
tr.setAttribute("style", "background: #e3e3e3;");
|
||||
}
|
||||
}));
|
||||
notesBlock.appendChild(tr);
|
||||
});
|
||||
});
|
||||
}
|
||||
removeNotes() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var notesBlock = document.getElementById("notes_block");
|
||||
var remEls = Array.from(notesBlock.getElementsByClassName('remove'));
|
||||
var ids = [];
|
||||
remEls.forEach((el) => {
|
||||
var id = el.children[0].innerHTML;
|
||||
ids.push(Number(id));
|
||||
});
|
||||
const dataRequest = {
|
||||
"ids": ids
|
||||
};
|
||||
if (ids.length > 0) {
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("DeleteNotes", this.cookies);
|
||||
//отправляем запрос
|
||||
yield ajax.sendRequest(dataRequest);
|
||||
}
|
||||
});
|
||||
}
|
||||
/*@*
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>*@*/
|
||||
/**
|
||||
* Загрузка блока History
|
||||
*/
|
||||
generateHistory() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
console.log("Start Loading Orders History Company: " + this.IdCompany.toString());
|
||||
var historyBlock = document.getElementById("history_block");
|
||||
historyBlock.innerHTML = '';
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("GetOrdersHistory", this.cookies);
|
||||
//отправляем запрос
|
||||
const response = yield ajax.sendRequest();
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
dataResponse.forEach((trData) => {
|
||||
var tr = document.createElement("tr");
|
||||
var td_date = document.createElement("td");
|
||||
var td_store = document.createElement("td");
|
||||
tr.appendChild(td_date);
|
||||
tr.appendChild(td_store);
|
||||
td_date.innerText = trData.OrderDate;
|
||||
td_store.innerText = trData.StoreCity;
|
||||
historyBlock.appendChild(tr);
|
||||
});
|
||||
});
|
||||
}
|
||||
/*
|
||||
<label>ID: </label>
|
||||
< input type = "number" value = "1" readonly />
|
||||
<label>Name: </label>
|
||||
< input type = "text" value = "Super Mart of the West" readonly />
|
||||
<label>Address: </label>
|
||||
< input type = "text" value = "702 SW 8th Street" readonly />
|
||||
<label>City: </label>
|
||||
< input type = "text" value = "Bentonville" readonly />
|
||||
<label>State: </label>
|
||||
< input type = "text" value = "Arkansas" readonly />
|
||||
*/
|
||||
/**
|
||||
* Загрузка блока Info
|
||||
*/
|
||||
generateInfo() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
console.log("Start Loading Info Company: " + this.IdCompany.toString());
|
||||
var infoBlock = document.getElementById("info_block");
|
||||
var labelId = document.createElement("label");
|
||||
labelId.innerText = "ID:";
|
||||
var inputId = document.createElement("input");
|
||||
inputId.type = "number";
|
||||
inputId.setAttribute('readonly', '');
|
||||
var labelName = document.createElement("label");
|
||||
labelName.innerText = "Name:";
|
||||
var inputName = document.createElement("input");
|
||||
inputName.type = "text";
|
||||
inputName.setAttribute('readonly', '');
|
||||
var labelAddress = document.createElement("label");
|
||||
labelAddress.innerText = "Address:";
|
||||
var inputAddress = document.createElement("input");
|
||||
inputAddress.type = "text";
|
||||
inputAddress.setAttribute('readonly', '');
|
||||
var labelCity = document.createElement("label");
|
||||
labelCity.innerText = "City:";
|
||||
var inputCity = document.createElement("input");
|
||||
inputCity.type = "text";
|
||||
inputCity.setAttribute('readonly', '');
|
||||
var labelState = document.createElement("label");
|
||||
labelState.innerText = "State:";
|
||||
var inputState = document.createElement("input");
|
||||
inputState.type = "text";
|
||||
inputState.setAttribute('readonly', '');
|
||||
/*append elements*/
|
||||
infoBlock.appendChild(labelId);
|
||||
infoBlock.appendChild(inputId);
|
||||
infoBlock.appendChild(labelName);
|
||||
infoBlock.appendChild(inputName);
|
||||
infoBlock.appendChild(labelAddress);
|
||||
infoBlock.appendChild(inputAddress);
|
||||
infoBlock.appendChild(labelCity);
|
||||
infoBlock.appendChild(inputCity);
|
||||
infoBlock.appendChild(labelState);
|
||||
infoBlock.appendChild(inputState);
|
||||
const dataRequest = {
|
||||
"idCompany": Number(this.IdCompany)
|
||||
};
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("getCompanyInfo", this.cookies);
|
||||
//отправляем запрос
|
||||
const response = yield ajax.sendRequest(dataRequest);
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
if (dataResponse.IsValid) {
|
||||
/*Start load data*/
|
||||
inputId.value = dataResponse.Id;
|
||||
inputName.value = dataResponse.Name;
|
||||
inputAddress.value = dataResponse.Address;
|
||||
inputCity.value = dataResponse.City;
|
||||
inputState.value = dataResponse.State;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=details.js.map
|
File diff suppressed because one or more lines are too long
@ -1,12 +0,0 @@
|
||||
class Index {
|
||||
/**
|
||||
* Конструктор
|
||||
*/
|
||||
constructor() {
|
||||
console.log("Load Main Page");
|
||||
var addCompanyBtn = document.getElementById("add_company_action");
|
||||
console.log(addCompanyBtn);
|
||||
addCompanyBtn.addEventListener("click", () => window.open("/docs"));
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../TypeScripts/index.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK;IACP;;MAEE;IACF;QACI,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC9B,IAAI,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;QAClE,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC3B,aAAa,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACxE,CAAC;CACJ"}
|
@ -1,33 +0,0 @@
|
||||
(() => {
|
||||
//по загрузке страницы
|
||||
window.addEventListener("load", () => {
|
||||
//создаем экземпляр класса утилит
|
||||
const utilities = new Utilities();
|
||||
//создаем экземпляр класса кук
|
||||
const cookies = new Cookies();
|
||||
//получаем текущий URL
|
||||
const currentUrl = new URL(document.location.href);
|
||||
//получаем путь из URL
|
||||
const pathname = currentUrl.pathname.toLowerCase();
|
||||
//разбиваем пути URL на части
|
||||
const partsPath = pathname.split("/");
|
||||
switch (partsPath[1]) { //смотрим путь URL
|
||||
case "":
|
||||
{
|
||||
console.log("Index Load");
|
||||
new Index();
|
||||
}
|
||||
break;
|
||||
case "details": //страница детализации
|
||||
{ //создаем класс авторизации кабинета
|
||||
console.log("Details Load");
|
||||
const id = partsPath[2];
|
||||
const detailsScene = new Details(utilities, cookies, id);
|
||||
//запускаем главную сцену
|
||||
detailsScene.startDetailsLogic();
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
})();
|
||||
//# sourceMappingURL=main.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["../TypeScripts/main.ts"],"names":[],"mappings":"AAAA,CAAC,GAAG,EAAE;IACF,sBAAsB;IACtB,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE;QACjC,iCAAiC;QACjC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;QAClC,8BAA8B;QAC9B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;QAC9B,sBAAsB;QACtB,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnD,sBAAsB;QACtB,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QACnD,6BAA6B;QAC7B,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtC,QAAQ,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,kBAAkB;YACtC,KAAK,EAAE;gBACH;oBACI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;oBAC1B,IAAI,KAAK,EAAE,CAAC;iBACf;gBACD,MAAM;YACV,KAAK,SAAS,EAAE,sBAAsB;gBAClC,EAAI,oCAAoC;oBACpC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;oBAC5B,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;oBACxB,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;oBACzD,yBAAyB;oBACzB,YAAY,CAAC,iBAAiB,EAAE,CAAC;iBACpC;gBACD,MAAM;SACb;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,EAAE,CAAC"}
|
@ -1,167 +0,0 @@
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Класс вспомогательных методов
|
||||
*/
|
||||
class Utilities {
|
||||
/**
|
||||
* Метод проверяет строку на пустоту
|
||||
* @param value - проверяемая строка
|
||||
* @return - true:строка пуста, false:строка не пуста
|
||||
*/
|
||||
isEmpty(value) {
|
||||
if (value == null)
|
||||
return true; //проверяем строку на null
|
||||
if (value === "")
|
||||
return true; //проверяем строку на пустоту
|
||||
return false; //отдаем строка не пуста
|
||||
}
|
||||
/**
|
||||
* Метод проверяет валидность Email
|
||||
* @param email - email
|
||||
* @return - true:yes, false:no
|
||||
*/
|
||||
isValidEmail(email) {
|
||||
if (this.isEmpty(email))
|
||||
return false; //проверяем Email на пустоту
|
||||
//паттерн проверки валидности Email
|
||||
const pattern = /^([a-z0-9_.-])+@[a-z0-9-]+\.([a-z]{2,4}\.)?[a-z]{2,4}$/i;
|
||||
return pattern.test(email); //проверяем валидность Email и отдаем результат
|
||||
}
|
||||
/**
|
||||
* Метод делает асинхронную задержку
|
||||
* @param mlsec - размер задержки в миллисекундах
|
||||
*/
|
||||
doDelay(mlsec) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve(null); //оповещаем промис
|
||||
}, mlsec);
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Метод отдаем ширину окна браузера
|
||||
* @returns - ширина окна браузера
|
||||
*/
|
||||
get getWidh() {
|
||||
//отдаем максимальную ширину
|
||||
return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
||||
}
|
||||
/**
|
||||
* Метод отдает высоту окна браузера
|
||||
* @returns - высота окна браузера
|
||||
*/
|
||||
get getHeight() {
|
||||
//отдаем максимальную высоту
|
||||
return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
||||
}
|
||||
/**
|
||||
* Метод генерирует случайное число в заданном диапазоне
|
||||
* @param min - минимальное число
|
||||
* @param max - максимальное число
|
||||
*/
|
||||
getRandomInt(min, max) {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
/**
|
||||
* Метод копирует текст в буфер обмена
|
||||
* @param value - текст для копирования в буфер
|
||||
* @param element - элемент вызывающий действие копирования
|
||||
*/
|
||||
copyValueToBuffer(value, element) {
|
||||
try {
|
||||
const coord = element.getBoundingClientRect(); //получаем координаты кнопки
|
||||
//получаем расстояние сколько проскроллено сверху
|
||||
const scrolled = window.pageYOffset || document.documentElement.scrollTop;
|
||||
//получаем iOs ли устройство
|
||||
const iOsDevice = navigator.userAgent.match(/ipad|iphone/i);
|
||||
//создаем textarea
|
||||
const textArea = document.createElement("textarea");
|
||||
//ставим что textarea только для чтения
|
||||
textArea.readOnly = true;
|
||||
//ставим textarea отступ сверху на величину скролла + координаты кнопки что бы экран не прыгал
|
||||
textArea.style.top = `${Math.round(scrolled + coord.top)}px`;
|
||||
//подставляем невидимый класс
|
||||
textArea.classList.add("text_copy");
|
||||
//подставляем текст в textarea
|
||||
textArea.value = value;
|
||||
//добавляем textarea в DOM
|
||||
document.body.appendChild(textArea);
|
||||
//делаем textarea в фокус
|
||||
textArea.focus();
|
||||
//проверяем iOs устройство
|
||||
if (iOsDevice) {
|
||||
const editable = textArea.contentEditable;
|
||||
const readOnly = textArea.readOnly;
|
||||
textArea.contentEditable = "true";
|
||||
textArea.readOnly = false;
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(textArea);
|
||||
const selection = window.getSelection();
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
textArea.setSelectionRange(0, 999999);
|
||||
textArea.contentEditable = editable;
|
||||
textArea.readOnly = readOnly;
|
||||
}
|
||||
else {
|
||||
textArea.select(); //делаем textarea выбранной
|
||||
} //выполняем команду по копированию в буфер обмена
|
||||
const resultCopy = document.execCommand("copy");
|
||||
document.body.removeChild(textArea); //удаляем textarea
|
||||
return resultCopy; //отдаем результат копирования
|
||||
}
|
||||
catch (e) {
|
||||
console.error("Error: ", e); //выводим ошибку на консоль
|
||||
return false; //возвращаем что данные не скопированы
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Метод получает текущую дату в строковом значении
|
||||
*/
|
||||
getCurrentDate() {
|
||||
const date = new Date(); //получаем текущую дату
|
||||
const nowDay = date.getDate(); //получаем текущий день
|
||||
const nowMonth = date.getMonth() + 1; //получаем текущий месяц
|
||||
let forFullDay = ""; //добавка для полного дня с нулем
|
||||
if (nowDay < 10) { //проверяем если день менее 10
|
||||
forFullDay = "0"; //пишем ноль в добавку
|
||||
}
|
||||
let forFullMonth = ""; //добавка для полного месяца
|
||||
if (nowMonth < 10) { //проверяем если месяц менее 10
|
||||
forFullMonth = "0"; //пишем ноль в добавку
|
||||
}
|
||||
return `${forFullDay}${nowDay}.${forFullMonth}${nowMonth}.${date.getFullYear()}`;
|
||||
}
|
||||
/**
|
||||
* Метод генерирует UIID
|
||||
*/
|
||||
generateUuid() {
|
||||
var d = new Date().getTime();
|
||||
var d2 = ((typeof performance !== "undefined") && performance.now && (performance.now() * 1000)) || 0;
|
||||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
|
||||
var r = Math.random() * 16;
|
||||
if (d > 0) {
|
||||
r = (d + r) % 16 | 0;
|
||||
d = Math.floor(d / 16);
|
||||
}
|
||||
else {
|
||||
r = (d2 + r) % 16 | 0;
|
||||
d2 = Math.floor(d2 / 16);
|
||||
}
|
||||
return (c === "x" ? r : (r & 0x3 | 0x8)).toString(16);
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=utilities.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../TypeScripts/utilities.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;GAEG;AACH,MAAM,SAAS;IAEX;;;;OAIG;IACH,OAAO,CAAC,KAAa;QACjB,IAAI,KAAK,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC,CAAC,0BAA0B;QAC1D,IAAI,KAAK,KAAK,EAAE;YAAE,OAAO,IAAI,CAAC,CAAC,6BAA6B;QAC5D,OAAO,KAAK,CAAC,CAAC,wBAAwB;IAC1C,CAAC;IAGD;;;;OAIG;IACH,YAAY,CAAC,KAAa;QACtB,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC,CAAC,4BAA4B;QACnE,mCAAmC;QACnC,MAAM,OAAO,GAAG,yDAAyD,CAAC;QAC1E,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,+CAA+C;IAC/E,CAAC;IAED;;;MAGE;IACI,OAAO,CAAC,KAAa;;YACvB,OAAO,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;gBAC/B,UAAU,CAAC,GAAG,EAAE;oBACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB;gBACrC,CAAC,EAAE,KAAK,CAAC,CAAC;YACd,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;IAED;;;OAGG;IACH,IAAI,OAAO;QACP,4BAA4B;QAC5B,OAAO,MAAM,CAAC,UAAU,IAAI,QAAQ,CAAC,eAAe,CAAC,WAAW,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC;IAClG,CAAC;IAED;;;OAGG;IACH,IAAI,SAAS;QACT,4BAA4B;QAC5B,OAAO,MAAM,CAAC,WAAW,IAAI,QAAQ,CAAC,eAAe,CAAC,YAAY,IAAI,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;IACrG,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,GAAW,EAAE,GAAW;QACjC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IAC7D,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,KAAa,EAAE,OAAY;QAEzC,IAAI;YACA,MAAM,KAAK,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC,4BAA4B;YAC3E,iDAAiD;YACjD,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,IAAI,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC;YAC1E,4BAA4B;YAC5B,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;YAC5D,kBAAkB;YAClB,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACpD,uCAAuC;YACvC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;YACzB,8FAA8F;YAC9F,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;YAC7D,6BAA6B;YAC7B,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACpC,8BAA8B;YAC9B,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;YACvB,0BAA0B;YAC1B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YACpC,0BAA0B;YAC1B,QAAQ,CAAC,KAAK,EAAE,CAAC;YACjB,0BAA0B;YAC1B,IAAI,SAAS,EAAE;gBACX,MAAM,QAAQ,GAAG,QAAQ,CAAC,eAAe,CAAC;gBAC1C,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;gBACnC,QAAQ,CAAC,eAAe,GAAG,MAAM,CAAC;gBAClC,QAAQ,CAAC,QAAQ,GAAG,KAAK,CAAC;gBAC1B,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;gBACrC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;gBACnC,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;gBACxC,SAAS,CAAC,eAAe,EAAE,CAAC;gBAC5B,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBAC1B,QAAQ,CAAC,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;gBACtC,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC;gBACpC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;aAChC;iBAAM;gBACH,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,2BAA2B;aACjD,CAAC,iDAAiD;YACnD,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAChD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,kBAAkB;YACvD,OAAO,UAAU,CAAC,CAAC,8BAA8B;SAEpD;QAAC,OAAO,CAAC,EAAE;YACR,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,2BAA2B;YACxD,OAAO,KAAK,CAAC,CAAC,sCAAsC;SACvD;IACL,CAAC;IAED;;OAEG;IACH,cAAc;QACV,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,CAAC,uBAAuB;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,uBAAuB;QACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,wBAAwB;QAC9D,IAAI,UAAU,GAAG,EAAE,CAAC,CAAC,iCAAiC;QACtD,IAAI,MAAM,GAAG,EAAE,EAAE,EAAE,8BAA8B;YAC7C,UAAU,GAAG,GAAG,CAAC,CAAC,sBAAsB;SAC3C;QACD,IAAI,YAAY,GAAG,EAAE,CAAC,CAAC,4BAA4B;QACnD,IAAI,QAAQ,GAAG,EAAE,EAAE,EAAE,+BAA+B;YAChD,YAAY,GAAG,GAAG,CAAC,CAAC,sBAAsB;SAC7C;QACD,OAAO,GAAG,UAAU,GAAG,MAAM,IAAI,YAAY,GAAG,QAAQ,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;IACrF,CAAC;IAED;;OAEG;IACH,YAAY;QACR,IAAI,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,WAAW,KAAK,WAAW,CAAC,IAAI,WAAW,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QACtG,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE;YAC/D,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC;YAC3B,IAAI,CAAC,GAAG,CAAC,EAAE;gBACP,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACrB,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;aAC1B;iBAAM;gBACH,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACtB,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;aAC5B;YACD,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
|
@ -1,70 +0,0 @@
|
||||
/**
|
||||
* Класс Ajax запросов
|
||||
*/
|
||||
class Ajax {
|
||||
|
||||
/**
|
||||
* URL запроса
|
||||
*/
|
||||
private readonly requestUrl: string;
|
||||
|
||||
/**
|
||||
* Экземпляр класса работы с куками
|
||||
*/
|
||||
private readonly cookies: Cookies;
|
||||
|
||||
/**
|
||||
* Переменная xhttp запросов
|
||||
*/
|
||||
private readonly xhttp: XMLHttpRequest;
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
* @param path - Путь запроса
|
||||
* @param cookies - экземпляр класса работы с куками
|
||||
*/
|
||||
constructor(path: string, cookies: Cookies) {
|
||||
this.requestUrl = `/ajax/${path}`; //присваиваем URL запроса
|
||||
this.cookies = cookies; //присваиваем экземпляр класса работы с куками
|
||||
this.xhttp = new XMLHttpRequest(); //инициализируем xhttp
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод отправляет ajax запрос
|
||||
* @param dataObject - Объект данных запроса
|
||||
*/
|
||||
async sendRequest(dataObject: object = null): Promise<string> {
|
||||
return new Promise<string>(resolve => {
|
||||
try { //получаем защитный токен
|
||||
const csrfToken = this.cookies.getCookie("CSRF-TOKEN");
|
||||
//добавляем параметры асинхронного запроса
|
||||
this.xhttp.open("POST", this.requestUrl, true);
|
||||
this.xhttp.onreadystatechange = () => { //получение ответа на запрос
|
||||
//проверяем готовность ответа
|
||||
if (this.xhttp.readyState !== 4) return;
|
||||
//проверяем успешен или нет ответ
|
||||
if (this.xhttp.status !== 200) {
|
||||
resolve(""); //вызываем промис с пустой строкой
|
||||
return; //не продолжаем
|
||||
} //вызываем промис с текстом ответа
|
||||
resolve(this.xhttp.responseText);
|
||||
};
|
||||
this.xhttp.onerror = () => { //ошибки запроса
|
||||
//выводим ошибку на консоль
|
||||
console.error("ERROR: ", "Bad response");
|
||||
resolve(""); //вызываем промис с пустой строкой
|
||||
}; //подставляем в заголовки защитный токен
|
||||
this.xhttp.setRequestHeader("X-CSRF-TOKEN", csrfToken);
|
||||
if (dataObject == null) { //отправляем запрос в зависимости задан объект данных или нет
|
||||
this.xhttp.send(); //запрос без данных
|
||||
} else { //ставим заголовок что это json данные
|
||||
this.xhttp.setRequestHeader("Content-type", "application/json");
|
||||
this.xhttp.send(JSON.stringify(dataObject)); //запрос с данными
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("ERROR: ", e); //выводим ошибку на консоль
|
||||
resolve(""); //вызываем промис с пустой строкой
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/**
|
||||
* Класс работы с куками
|
||||
*/
|
||||
class Cookies {
|
||||
|
||||
/**
|
||||
* Метод получает значение куки по имени
|
||||
* @param cookieName - название куки
|
||||
* @return - значение куки
|
||||
*/
|
||||
getCookie(cookieName: string): string {
|
||||
const name: any = cookieName + "=";
|
||||
const decodedCookie = decodeURIComponent(document.cookie);
|
||||
const ca = decodedCookie.split(";");
|
||||
for (let i = 0; i < ca.length; i++) {
|
||||
let c = ca[i];
|
||||
while (c.charAt(0) === " ") {
|
||||
c = c.substring(1);
|
||||
}
|
||||
if (c.indexOf(name) === 0) {
|
||||
|
||||
return c.substring(name.length, c.length);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод устанавливает куку
|
||||
* @param name - имя куки
|
||||
* @param value - значение куки
|
||||
*/
|
||||
setCookie(name: string, value: string): void {
|
||||
const date = new Date(); //создаем переменную даты
|
||||
//устанавливаем дату плюс месяц
|
||||
date.setTime(date.getTime() + 30 * 24 * 60 * 60 * 1000);
|
||||
//устанавливаем куку
|
||||
document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + date.toUTCString() + ";path=/;secure";
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод удаляет куку по имени
|
||||
* @param name - имя куки
|
||||
*/
|
||||
removeCookie(name: string): void {
|
||||
document.cookie = name + "=;Max-Age=-99999999;";
|
||||
}
|
||||
}
|
@ -1,503 +0,0 @@
|
||||
/**
|
||||
* Класс детализации компании
|
||||
*/
|
||||
class Details {
|
||||
/**
|
||||
* Экземпляр класса кук
|
||||
*/
|
||||
private readonly cookies: Cookies;
|
||||
|
||||
/**
|
||||
* Экземпляр класса утилит
|
||||
*/
|
||||
private readonly utilities: Utilities;
|
||||
|
||||
/**
|
||||
* Идентификатор загружаемой компании
|
||||
*/
|
||||
private EmployeeInputFirst: HTMLInputElement;
|
||||
|
||||
/**
|
||||
* Идентификатор загружаемой компании
|
||||
*/
|
||||
private EmployeeInputLast: HTMLInputElement;
|
||||
/**
|
||||
* Идентификатор загружаемой компании
|
||||
*/
|
||||
private EmployeeInputTitle: HTMLInputElement;
|
||||
/**
|
||||
* Идентификатор загружаемой компании
|
||||
*/
|
||||
private EmployeeInputBirthDate: HTMLInputElement;
|
||||
/**
|
||||
* Идентификатор загружаемой компании
|
||||
*/
|
||||
private EmployeeInputPos: HTMLInputElement;
|
||||
|
||||
/**
|
||||
* Идентификатор загружаемой компании
|
||||
*/
|
||||
private IdCompany: String;
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
*/
|
||||
constructor(utilities: Utilities, cookies: Cookies, id: String) {
|
||||
this.cookies = cookies;
|
||||
this.utilities = utilities;
|
||||
this.IdCompany = id;
|
||||
|
||||
this.EmployeeInputFirst = document.getElementById("employee_fisrt") as HTMLInputElement;
|
||||
this.EmployeeInputLast = document.getElementById("employee_last") as HTMLInputElement;
|
||||
this.EmployeeInputTitle = document.getElementById("employee_title") as HTMLInputElement;
|
||||
this.EmployeeInputBirthDate = document.getElementById("employee_date") as HTMLInputElement;
|
||||
this.EmployeeInputPos = document.getElementById("employee_pos") as HTMLInputElement;
|
||||
|
||||
var updateHistoryBtn = document.getElementById("update_history_action");
|
||||
if (updateHistoryBtn !== null) {
|
||||
updateHistoryBtn.addEventListener("click", async () => await this.generateHistory());
|
||||
}
|
||||
|
||||
var updateNotesBtn = document.getElementById("update_notes_action");
|
||||
if (updateNotesBtn !== null) {
|
||||
updateNotesBtn.addEventListener("click", async () => await this.generateNotes());
|
||||
}
|
||||
|
||||
var updateEmployeesBtn = document.getElementById("update_employees_action");
|
||||
if (updateEmployeesBtn !== null) {
|
||||
updateEmployeesBtn.addEventListener("click", async () => await this.generateEmployees());
|
||||
}
|
||||
|
||||
var removeNotesBtn = document.getElementById("remove_notes_action");
|
||||
if (removeNotesBtn !== null) {
|
||||
removeNotesBtn.addEventListener("click", async () => {
|
||||
await this.removeNotes();
|
||||
await this.generateNotes();
|
||||
});
|
||||
}
|
||||
|
||||
var removeEmployeesBtn = document.getElementById("remove_employees_action");
|
||||
if (removeEmployeesBtn !== null) {
|
||||
removeEmployeesBtn.addEventListener("click", async () => {
|
||||
await this.removeEmployees();
|
||||
await this.generateEmployees();
|
||||
});
|
||||
}
|
||||
|
||||
var addNotesBtn = document.getElementById("add_notes_action");
|
||||
if (addNotesBtn !== null) {
|
||||
addNotesBtn.addEventListener("click", async () => window.open("/docs"));
|
||||
}
|
||||
|
||||
var addEmployeesBtn = document.getElementById("add_employees_action");
|
||||
if (addEmployeesBtn !== null) {
|
||||
addEmployeesBtn.addEventListener("click", async () => window.open("/docs"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод запускает страницу детализации
|
||||
*/
|
||||
startDetailsLogic(): void {
|
||||
console.log("Start Loading Company: " + this.IdCompany.toString());
|
||||
this.generateInfo()
|
||||
.then(() => {
|
||||
console.log("-> action Generate Info ok");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("-> error: " + error);
|
||||
});
|
||||
|
||||
this.generateHistory()
|
||||
.then(() => {
|
||||
console.log("-> action Generate History ok");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("-> error: " + error);
|
||||
});
|
||||
|
||||
this.generateNotes()
|
||||
.then(() => {
|
||||
console.log("-> action Generate Notes ok");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("-> error: " + error);
|
||||
});
|
||||
|
||||
this.generateEmployees()
|
||||
.then(() => {
|
||||
console.log("-> action Generate Employees ok");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("-> error: " + error);
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
<tr>
|
||||
<td>John < /td>
|
||||
< td > Heart < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>Olivia < /td>
|
||||
< td > Peyton < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>Robert < /td>
|
||||
< td > Reagan < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>Cynthia < /td>
|
||||
< td > Stanwick < /td>
|
||||
< /tr>
|
||||
*/
|
||||
/**
|
||||
* Загрузка блока Employees
|
||||
*/
|
||||
private async generateEmployees(): Promise<void> {
|
||||
this.EmployeeInputFirst.value = "";
|
||||
this.EmployeeInputLast.value = "";
|
||||
this.EmployeeInputTitle.value = "";
|
||||
this.EmployeeInputBirthDate.value = "";
|
||||
this.EmployeeInputPos.value = "";
|
||||
|
||||
var notesBlock = document.getElementById("employees_block");
|
||||
notesBlock.innerHTML = '';
|
||||
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("GetEmployees", this.cookies);
|
||||
//отправляем запрос
|
||||
const response = await ajax.sendRequest();
|
||||
console.log(response);
|
||||
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
|
||||
var first = 0;
|
||||
|
||||
dataResponse.forEach((trData) => {
|
||||
var tr = document.createElement("tr");
|
||||
tr.id = trData.Id;
|
||||
var td_first = document.createElement("td");
|
||||
var td_last = document.createElement("td");
|
||||
tr.appendChild(td_first);
|
||||
tr.appendChild(td_last);
|
||||
td_first.innerText = trData.FirstName;
|
||||
td_last.innerText = trData.LastName;
|
||||
tr.addEventListener("click", async () => {
|
||||
if (tr.classList.contains("remove")) {
|
||||
tr.classList.remove("remove");
|
||||
tr.setAttribute("style", "background: #ffffff;");
|
||||
} else {
|
||||
tr.classList.add("remove");
|
||||
tr.setAttribute("style", "background: #e3e3e3;");
|
||||
}
|
||||
await this.getInfoEmployee(Number(trData.Id));
|
||||
});
|
||||
notesBlock.appendChild(tr);
|
||||
|
||||
if (first == 0) {
|
||||
this.getInfoEmployee(Number(trData.Id));
|
||||
}
|
||||
first++;
|
||||
});
|
||||
}
|
||||
|
||||
private async removeEmployees(): Promise<void> {
|
||||
var notesBlock = document.getElementById("employees_block");
|
||||
|
||||
var remEls = Array.from(notesBlock.getElementsByClassName('remove'))
|
||||
|
||||
var ids = [];
|
||||
|
||||
remEls.forEach((el) => {
|
||||
ids.push(Number(el.id));
|
||||
})
|
||||
|
||||
const dataRequest = { //создаем объект запроса
|
||||
"ids": ids
|
||||
};
|
||||
|
||||
if (ids.length > 0) {
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("DeleteEmployees", this.cookies);
|
||||
//отправляем запрос
|
||||
await ajax.sendRequest(dataRequest);
|
||||
}
|
||||
}
|
||||
|
||||
private async getInfoEmployee(id: Number): Promise<void> {
|
||||
const dataRequest = { //создаем объект запроса
|
||||
"id": id
|
||||
};
|
||||
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("GetEmployee", this.cookies);
|
||||
//отправляем запрос
|
||||
var response = await ajax.sendRequest(dataRequest);
|
||||
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
|
||||
console.log(dataResponse);
|
||||
|
||||
this.EmployeeInputFirst.value = dataResponse.FirstName;
|
||||
this.EmployeeInputLast.value = dataResponse.LastName;
|
||||
this.EmployeeInputTitle.value = dataResponse.Title;
|
||||
this.EmployeeInputBirthDate.value = dataResponse.BirthDate;
|
||||
this.EmployeeInputPos.value = dataResponse.Position;
|
||||
}
|
||||
|
||||
/*
|
||||
<tr>
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>
|
||||
< tr >
|
||||
<td>35703 < /td>
|
||||
< td > Todd Hoffman < /td>
|
||||
< /tr>*/
|
||||
/**
|
||||
* Загрузка блока Notes
|
||||
*/
|
||||
private async generateNotes(): Promise<void> {
|
||||
var notesBlock = document.getElementById("notes_block");
|
||||
notesBlock.innerHTML = '';
|
||||
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("GetNotes", this.cookies);
|
||||
//отправляем запрос
|
||||
const response = await ajax.sendRequest();
|
||||
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
|
||||
dataResponse.forEach((trData) => {
|
||||
var tr = document.createElement("tr");
|
||||
var td_id = document.createElement("td");
|
||||
var td_emplo = document.createElement("td");
|
||||
tr.appendChild(td_id);
|
||||
tr.appendChild(td_emplo);
|
||||
td_id.innerText = trData.Id;
|
||||
td_emplo.innerText = trData.Employee;
|
||||
tr.addEventListener("click", async () => {
|
||||
if (tr.classList.contains("remove")) {
|
||||
tr.classList.remove("remove");
|
||||
tr.setAttribute("style", "background: #ffffff;");
|
||||
} else {
|
||||
tr.classList.add("remove");
|
||||
tr.setAttribute("style", "background: #e3e3e3;");
|
||||
}
|
||||
});
|
||||
notesBlock.appendChild(tr);
|
||||
});
|
||||
}
|
||||
|
||||
private async removeNotes(): Promise<void> {
|
||||
var notesBlock = document.getElementById("notes_block");
|
||||
|
||||
var remEls = Array.from(notesBlock.getElementsByClassName('remove'))
|
||||
|
||||
var ids = [];
|
||||
|
||||
remEls.forEach((el) => {
|
||||
var id = el.children[0].innerHTML;
|
||||
ids.push(Number(id));
|
||||
})
|
||||
|
||||
const dataRequest = { //создаем объект запроса
|
||||
"ids": ids
|
||||
};
|
||||
|
||||
if (ids.length > 0) {
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("DeleteNotes", this.cookies);
|
||||
//отправляем запрос
|
||||
await ajax.sendRequest(dataRequest);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*@*
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>*@*/
|
||||
/**
|
||||
* Загрузка блока History
|
||||
*/
|
||||
private async generateHistory(): Promise<void> {
|
||||
console.log("Start Loading Orders History Company: " + this.IdCompany.toString());
|
||||
|
||||
var historyBlock = document.getElementById("history_block");
|
||||
historyBlock.innerHTML = '';
|
||||
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("GetOrdersHistory", this.cookies);
|
||||
//отправляем запрос
|
||||
const response = await ajax.sendRequest();
|
||||
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
|
||||
dataResponse.forEach((trData) => {
|
||||
var tr = document.createElement("tr");
|
||||
var td_date = document.createElement("td");
|
||||
var td_store = document.createElement("td");
|
||||
tr.appendChild(td_date);
|
||||
tr.appendChild(td_store);
|
||||
td_date.innerText = trData.OrderDate;
|
||||
td_store.innerText = trData.StoreCity;
|
||||
historyBlock.appendChild(tr);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
<label>ID: </label>
|
||||
< input type = "number" value = "1" readonly />
|
||||
<label>Name: </label>
|
||||
< input type = "text" value = "Super Mart of the West" readonly />
|
||||
<label>Address: </label>
|
||||
< input type = "text" value = "702 SW 8th Street" readonly />
|
||||
<label>City: </label>
|
||||
< input type = "text" value = "Bentonville" readonly />
|
||||
<label>State: </label>
|
||||
< input type = "text" value = "Arkansas" readonly />
|
||||
*/
|
||||
/**
|
||||
* Загрузка блока Info
|
||||
*/
|
||||
private async generateInfo(): Promise<void> {
|
||||
console.log("Start Loading Info Company: " + this.IdCompany.toString());
|
||||
|
||||
var infoBlock = document.getElementById("info_block");
|
||||
|
||||
var labelId = document.createElement("label");
|
||||
labelId.innerText = "ID:";
|
||||
|
||||
var inputId = document.createElement("input");
|
||||
inputId.type = "number";
|
||||
inputId.setAttribute('readonly', '');
|
||||
|
||||
var labelName = document.createElement("label");
|
||||
labelName.innerText = "Name:";
|
||||
|
||||
var inputName = document.createElement("input");
|
||||
inputName.type = "text";
|
||||
inputName.setAttribute('readonly', '');
|
||||
|
||||
var labelAddress = document.createElement("label");
|
||||
labelAddress.innerText = "Address:";
|
||||
|
||||
var inputAddress = document.createElement("input");
|
||||
inputAddress.type = "text";
|
||||
inputAddress.setAttribute('readonly', '');
|
||||
|
||||
var labelCity = document.createElement("label");
|
||||
labelCity.innerText = "City:";
|
||||
|
||||
var inputCity = document.createElement("input");
|
||||
inputCity.type = "text";
|
||||
inputCity.setAttribute('readonly', '');
|
||||
|
||||
var labelState = document.createElement("label");
|
||||
labelState.innerText = "State:";
|
||||
|
||||
var inputState = document.createElement("input");
|
||||
inputState.type = "text";
|
||||
inputState.setAttribute('readonly', '');
|
||||
|
||||
/*append elements*/
|
||||
infoBlock.appendChild(labelId);
|
||||
infoBlock.appendChild(inputId);
|
||||
infoBlock.appendChild(labelName);
|
||||
infoBlock.appendChild(inputName);
|
||||
infoBlock.appendChild(labelAddress);
|
||||
infoBlock.appendChild(inputAddress);
|
||||
infoBlock.appendChild(labelCity);
|
||||
infoBlock.appendChild(inputCity);
|
||||
infoBlock.appendChild(labelState);
|
||||
infoBlock.appendChild(inputState);
|
||||
|
||||
const dataRequest = { //создаем объект запроса
|
||||
"idCompany": Number(this.IdCompany)
|
||||
};
|
||||
//создаем экземпляр Ajax
|
||||
const ajax = new Ajax("getCompanyInfo", this.cookies);
|
||||
//отправляем запрос
|
||||
const response = await ajax.sendRequest(dataRequest);
|
||||
|
||||
//проверяем ответ
|
||||
if (this.utilities.isEmpty(response)) {
|
||||
document.location.href = "/error"; //редиректим на страницу ошибки
|
||||
return; //не продолжаем
|
||||
}
|
||||
//десериализуем ответ из JSON
|
||||
const dataResponse = JSON.parse(response);
|
||||
if (dataResponse.IsValid) {
|
||||
/*Start load data*/
|
||||
inputId.value = dataResponse.Id;
|
||||
inputName.value = dataResponse.Name;
|
||||
inputAddress.value = dataResponse.Address;
|
||||
inputCity.value = dataResponse.City;
|
||||
inputState.value = dataResponse.State;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
class Index {
|
||||
/**
|
||||
* Конструктор
|
||||
*/
|
||||
constructor() {
|
||||
console.log("Load Main Page");
|
||||
var addCompanyBtn = document.getElementById("add_company_action");
|
||||
console.log(addCompanyBtn);
|
||||
addCompanyBtn.addEventListener("click", () => window.open("/docs"));
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
(() => {
|
||||
//по загрузке страницы
|
||||
window.addEventListener("load", () => {
|
||||
//создаем экземпляр класса утилит
|
||||
const utilities = new Utilities();
|
||||
//создаем экземпляр класса кук
|
||||
const cookies = new Cookies();
|
||||
//получаем текущий URL
|
||||
const currentUrl = new URL(document.location.href);
|
||||
//получаем путь из URL
|
||||
const pathname = currentUrl.pathname.toLowerCase();
|
||||
//разбиваем пути URL на части
|
||||
const partsPath = pathname.split("/");
|
||||
switch (partsPath[1]) { //смотрим путь URL
|
||||
case "":
|
||||
{
|
||||
console.log("Index Load");
|
||||
new Index();
|
||||
}
|
||||
break;
|
||||
case "details": //страница детализации
|
||||
{ //создаем класс авторизации кабинета
|
||||
console.log("Details Load");
|
||||
const id = partsPath[2];
|
||||
const detailsScene = new Details(utilities, cookies, id);
|
||||
//запускаем главную сцену
|
||||
detailsScene.startDetailsLogic();
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
})();
|
@ -1,161 +0,0 @@
|
||||
/**
|
||||
* Класс вспомогательных методов
|
||||
*/
|
||||
class Utilities {
|
||||
|
||||
/**
|
||||
* Метод проверяет строку на пустоту
|
||||
* @param value - проверяемая строка
|
||||
* @return - true:строка пуста, false:строка не пуста
|
||||
*/
|
||||
isEmpty(value: string): boolean {
|
||||
if (value == null) return true; //проверяем строку на null
|
||||
if (value === "") return true; //проверяем строку на пустоту
|
||||
return false; //отдаем строка не пуста
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Метод проверяет валидность Email
|
||||
* @param email - email
|
||||
* @return - true:yes, false:no
|
||||
*/
|
||||
isValidEmail(email: string): boolean {
|
||||
if (this.isEmpty(email)) return false; //проверяем Email на пустоту
|
||||
//паттерн проверки валидности Email
|
||||
const pattern = /^([a-z0-9_.-])+@[a-z0-9-]+\.([a-z]{2,4}\.)?[a-z]{2,4}$/i;
|
||||
return pattern.test(email); //проверяем валидность Email и отдаем результат
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод делает асинхронную задержку
|
||||
* @param mlsec - размер задержки в миллисекундах
|
||||
*/
|
||||
async doDelay(mlsec: number): Promise<void> {
|
||||
return new Promise<void>(resolve => {
|
||||
setTimeout(() => { //делаем задержку
|
||||
resolve(null); //оповещаем промис
|
||||
}, mlsec);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод отдаем ширину окна браузера
|
||||
* @returns - ширина окна браузера
|
||||
*/
|
||||
get getWidh(): number {
|
||||
//отдаем максимальную ширину
|
||||
return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод отдает высоту окна браузера
|
||||
* @returns - высота окна браузера
|
||||
*/
|
||||
get getHeight(): number {
|
||||
//отдаем максимальную высоту
|
||||
return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод генерирует случайное число в заданном диапазоне
|
||||
* @param min - минимальное число
|
||||
* @param max - максимальное число
|
||||
*/
|
||||
getRandomInt(min: number, max: number) {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод копирует текст в буфер обмена
|
||||
* @param value - текст для копирования в буфер
|
||||
* @param element - элемент вызывающий действие копирования
|
||||
*/
|
||||
copyValueToBuffer(value: string, element: any): boolean {
|
||||
|
||||
try {
|
||||
const coord = element.getBoundingClientRect(); //получаем координаты кнопки
|
||||
//получаем расстояние сколько проскроллено сверху
|
||||
const scrolled = window.pageYOffset || document.documentElement.scrollTop;
|
||||
//получаем iOs ли устройство
|
||||
const iOsDevice = navigator.userAgent.match(/ipad|iphone/i);
|
||||
//создаем textarea
|
||||
const textArea = document.createElement("textarea");
|
||||
//ставим что textarea только для чтения
|
||||
textArea.readOnly = true;
|
||||
//ставим textarea отступ сверху на величину скролла + координаты кнопки что бы экран не прыгал
|
||||
textArea.style.top = `${Math.round(scrolled + coord.top)}px`;
|
||||
//подставляем невидимый класс
|
||||
textArea.classList.add("text_copy");
|
||||
//подставляем текст в textarea
|
||||
textArea.value = value;
|
||||
//добавляем textarea в DOM
|
||||
document.body.appendChild(textArea);
|
||||
//делаем textarea в фокус
|
||||
textArea.focus();
|
||||
//проверяем iOs устройство
|
||||
if (iOsDevice) {
|
||||
const editable = textArea.contentEditable;
|
||||
const readOnly = textArea.readOnly;
|
||||
textArea.contentEditable = "true";
|
||||
textArea.readOnly = false;
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(textArea);
|
||||
const selection = window.getSelection();
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
textArea.setSelectionRange(0, 999999);
|
||||
textArea.contentEditable = editable;
|
||||
textArea.readOnly = readOnly;
|
||||
} else {
|
||||
textArea.select(); //делаем textarea выбранной
|
||||
} //выполняем команду по копированию в буфер обмена
|
||||
const resultCopy = document.execCommand("copy");
|
||||
document.body.removeChild(textArea); //удаляем textarea
|
||||
return resultCopy; //отдаем результат копирования
|
||||
|
||||
} catch (e) {
|
||||
console.error("Error: ", e); //выводим ошибку на консоль
|
||||
return false; //возвращаем что данные не скопированы
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод получает текущую дату в строковом значении
|
||||
*/
|
||||
getCurrentDate(): string {
|
||||
const date = new Date(); //получаем текущую дату
|
||||
const nowDay = date.getDate(); //получаем текущий день
|
||||
const nowMonth = date.getMonth() + 1; //получаем текущий месяц
|
||||
let forFullDay = ""; //добавка для полного дня с нулем
|
||||
if (nowDay < 10) { //проверяем если день менее 10
|
||||
forFullDay = "0"; //пишем ноль в добавку
|
||||
}
|
||||
let forFullMonth = ""; //добавка для полного месяца
|
||||
if (nowMonth < 10) { //проверяем если месяц менее 10
|
||||
forFullMonth = "0"; //пишем ноль в добавку
|
||||
}
|
||||
return `${forFullDay}${nowDay}.${forFullMonth}${nowMonth}.${date.getFullYear()}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод генерирует UIID
|
||||
*/
|
||||
generateUuid() {
|
||||
var d = new Date().getTime();
|
||||
var d2 = ((typeof performance !== "undefined") && performance.now && (performance.now() * 1000)) || 0;
|
||||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
|
||||
var r = Math.random() * 16;
|
||||
if (d > 0) {
|
||||
r = (d + r) % 16 | 0;
|
||||
d = Math.floor(d / 16);
|
||||
} else {
|
||||
r = (d2 + r) % 16 | 0;
|
||||
d2 = Math.floor(d2 / 16);
|
||||
}
|
||||
return (c === "x" ? r : (r & 0x3 | 0x8)).toString(16);
|
||||
});
|
||||
}
|
||||
}
|
@ -1,305 +0,0 @@
|
||||
using Companies.Data.Home;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Companies.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Контекст работы с БД
|
||||
/// </summary>
|
||||
public class DatabaseContext : DbContext
|
||||
{
|
||||
/// <summary>
|
||||
/// Инициализация таблицы компаний
|
||||
/// </summary>
|
||||
public DbSet<CompanyInfo> Companies => Set<CompanyInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация таблицы истории событий компаний
|
||||
/// </summary>
|
||||
public DbSet<OrderHistory> HistoryOrder => Set<OrderHistory>();
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация таблицы Notes компаний
|
||||
/// </summary>
|
||||
public DbSet<CompanyNotes> CompanyNotes => Set<CompanyNotes>();
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация таблицы Employees компаний
|
||||
/// </summary>
|
||||
public DbSet<CompanyEmployees> CompanyEmployees => Set<CompanyEmployees>();
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="options"></param>
|
||||
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { }
|
||||
|
||||
public async Task GenerateFileDb()
|
||||
{
|
||||
Console.WriteLine($"Create db");
|
||||
await Database.EnsureDeletedAsync();
|
||||
await Database.EnsureCreatedAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Генерировать базовую таблицу
|
||||
/// </summary>
|
||||
public async Task<bool> GenerateCompanies()
|
||||
{
|
||||
try
|
||||
{
|
||||
var c1 = new List<CompanyInfo>()
|
||||
{
|
||||
new CompanyInfo { Id = 1,
|
||||
Name = "Super Mart of the West",
|
||||
City = "Bentonville",
|
||||
State = "Arkansas",
|
||||
Address = "",
|
||||
Phone = "(800) 555-2797" },
|
||||
new CompanyInfo { Id = 2,
|
||||
Name = "Electronics Depot",
|
||||
City = "Atlanta",
|
||||
State = "Georgia",
|
||||
Address = "",
|
||||
Phone = "(800) 595-3232" },
|
||||
new CompanyInfo { Id = 3,
|
||||
Name = "K&S Music",
|
||||
City = "Minneapolis",
|
||||
State = "Minnesota",
|
||||
Address = "",
|
||||
Phone = "(612) 304-6073" },
|
||||
new CompanyInfo { Id = 4,
|
||||
Name = "Tom's Club",
|
||||
City = "Issaquah",
|
||||
State = "Washington",
|
||||
Address = "",
|
||||
Phone = "(800) 955-2292" },
|
||||
new CompanyInfo { Id = 5,
|
||||
Name = "E-Mart",
|
||||
City = "Hoffman Estates",
|
||||
State = "illinois",
|
||||
Address = "",
|
||||
Phone = "(847) 286-2500" },
|
||||
};
|
||||
await Companies.AddRangeAsync(c1);
|
||||
await SaveChangesAsync();
|
||||
Console.WriteLine("Save db Complete!");
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
return await Task.FromResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удалить все данные таблицы компаний
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> DeleteAllCompanies()
|
||||
{
|
||||
try
|
||||
{
|
||||
RemoveRange(Companies);
|
||||
await SaveChangesAsync();
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
return await Task.FromResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удалить все данные таблицы компаний
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> DeleteAllNotes()
|
||||
{
|
||||
try
|
||||
{
|
||||
RemoveRange(CompanyNotes);
|
||||
await SaveChangesAsync();
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
return await Task.FromResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удалить все данные таблицы компаний
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> DeleteAllOrdersHistory()
|
||||
{
|
||||
try
|
||||
{
|
||||
RemoveRange(HistoryOrder);
|
||||
await SaveChangesAsync();
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
return await Task.FromResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание элемента истории
|
||||
/// </summary>
|
||||
/// <param name="orders">Список событий</param>
|
||||
public async Task<bool> CreateOrderHistory(List<OrderHistory> orders)
|
||||
{
|
||||
try
|
||||
{
|
||||
var countOrders = await HistoryOrder.ToListAsync();
|
||||
var count = countOrders.Count;
|
||||
|
||||
foreach (var order in orders)
|
||||
{
|
||||
count++;
|
||||
order.Id = count;
|
||||
}
|
||||
|
||||
await HistoryOrder.AddRangeAsync(orders);
|
||||
await SaveChangesAsync();
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
return await Task.FromResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление элемента(ов) Notes
|
||||
/// </summary>
|
||||
/// <param name="notes">Список событий</param>
|
||||
public async Task<bool> DeleteNotes(List<int> notes)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach(var note in notes)
|
||||
{
|
||||
var notesEl = CompanyNotes
|
||||
.Where(o => o.Id == note)
|
||||
.FirstOrDefault();
|
||||
|
||||
CompanyNotes.Remove(notesEl);
|
||||
await SaveChangesAsync();
|
||||
}
|
||||
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
return await Task.FromResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление элемента(ов) Employees
|
||||
/// </summary>
|
||||
/// <param name="employees">Список участников</param>
|
||||
public async Task<bool> DeleteEmployees(List<int> employees)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var note in employees)
|
||||
{
|
||||
var empoEl = CompanyEmployees
|
||||
.Where(o => o.Id == note)
|
||||
.FirstOrDefault();
|
||||
|
||||
CompanyEmployees.Remove(empoEl);
|
||||
await SaveChangesAsync();
|
||||
}
|
||||
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
return await Task.FromResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание элемента(ов) Notes
|
||||
/// </summary>
|
||||
/// <param name="notes">Список событий</param>
|
||||
public async Task<bool> CreateNotes(List<CompanyNotes> notes)
|
||||
{
|
||||
try
|
||||
{
|
||||
var countOrders = await CompanyNotes.ToListAsync();
|
||||
var count = countOrders.Count;
|
||||
|
||||
foreach (var order in notes)
|
||||
{
|
||||
count++;
|
||||
order.Id = count;
|
||||
}
|
||||
|
||||
await CompanyNotes.AddRangeAsync(notes);
|
||||
await SaveChangesAsync();
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
return await Task.FromResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание элемента(ов) Employees
|
||||
/// </summary>
|
||||
/// <param name="employees">Список участников</param>
|
||||
public async Task<bool> CreateEmployees(List<CompanyEmployees> employees)
|
||||
{
|
||||
try
|
||||
{
|
||||
var countOrders = await CompanyEmployees.ToListAsync();
|
||||
var count = countOrders.Count;
|
||||
|
||||
foreach (var order in employees)
|
||||
{
|
||||
count++;
|
||||
order.Id = count;
|
||||
}
|
||||
|
||||
await CompanyEmployees.AddRangeAsync(employees);
|
||||
await SaveChangesAsync();
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
return await Task.FromResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание файла БД
|
||||
/// </summary>
|
||||
/// <param name="optionsBuilder">Опции</param>
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
var dir = Path.GetDirectoryName(Environment.ProcessPath);
|
||||
var path = Path.Combine(dir, "application.db");
|
||||
Console.WriteLine("DatabasePath: " + path);
|
||||
optionsBuilder.UseSqlite("Data Source=" + path);
|
||||
optionsBuilder.LogTo(Console.WriteLine, new[] { RelationalEventId.CommandExecuted });
|
||||
}
|
||||
}
|
@ -1,248 +0,0 @@
|
||||
@using Models
|
||||
@model HomeViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Details - " + @Model.DetailsCompany.CompanyInfo.Name;
|
||||
}
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="content_companies">
|
||||
<div class="header details">
|
||||
<h4>Company details</h4>
|
||||
<label>@Model.DetailsCompany.CompanyInfo.Name</label>
|
||||
</div>
|
||||
<div class="data row">
|
||||
<div class="group">
|
||||
<div class="header mini">
|
||||
<h4>Info</h4>
|
||||
<div class="header_btns">
|
||||
<div class="mini_btn" title="Загружено">
|
||||
<svg>
|
||||
<use xlink:href="#check_icon"></use>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data mini" id="info_block">
|
||||
@* <label>ID:</label>
|
||||
<input type="number" value="1" readonly />
|
||||
<label>Name:</label>
|
||||
<input type="text" value="Super Mart of the West" readonly />
|
||||
<label>Address:</label>
|
||||
<input type="text" value="702 SW 8th Street" readonly />
|
||||
<label>City:</label>
|
||||
<input type="text" value="Bentonville" readonly />
|
||||
<label>State:</label>
|
||||
<input type="text" value="Arkansas" readonly />*@
|
||||
</div>
|
||||
</div>
|
||||
<div class="group">
|
||||
<div class="header mini">
|
||||
<h4>History</h4>
|
||||
<div class="header_btns">
|
||||
<div class="mini_btn" title="Обновить" id="update_history_action">
|
||||
<svg>
|
||||
<use xlink:href="#update_icon"></use>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data table">
|
||||
<div class="table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Order Date</td>
|
||||
<td>Store City</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="table-scroll-body">
|
||||
<table>
|
||||
<tbody id="history_block">
|
||||
@* <tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11/12/2013</td>
|
||||
<td>Las Vegas</td>
|
||||
</tr>*@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group">
|
||||
<div class="header mini">
|
||||
<h4>Notes</h4>
|
||||
<div class="header_btns">
|
||||
<div class="mini_btn" title="Добавить" id="add_notes_action">
|
||||
<svg>
|
||||
<use xlink:href="#plus_btn"></use>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="mini_btn" title="Удалить" id="remove_notes_action">
|
||||
<svg>
|
||||
<use xlink:href="#trash_icon"></use>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="mini_btn" title="Обновить" id="update_notes_action">
|
||||
<svg>
|
||||
<use xlink:href="#update_icon"></use>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data table">
|
||||
<div class="table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Invoice Number</td>
|
||||
<td>Employee</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="table-scroll-body">
|
||||
<table>
|
||||
<tbody class="tnotes" id="notes_block">
|
||||
@* <tr>
|
||||
<td>35703</td>
|
||||
<td>Todd Hoffman</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>35703</td>
|
||||
<td>Todd Hoffman</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>35703</td>
|
||||
<td>Todd Hoffman</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>35703</td>
|
||||
<td>Todd Hoffman</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>35703</td>
|
||||
<td>Todd Hoffman</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>35703</td>
|
||||
<td>Todd Hoffman</td>
|
||||
</tr>*@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data row empo">
|
||||
<div class="group">
|
||||
<div class="header mini">
|
||||
<h4>Employers</h4>
|
||||
<div class="header_btns">
|
||||
<div class="mini_btn" title="Добавить" id="add_employees_action">
|
||||
<svg>
|
||||
<use xlink:href="#plus_btn"></use>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="mini_btn" title="Редактировать" id="edit_employees_action">
|
||||
<svg>
|
||||
<use xlink:href="#pen_btn"></use>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="mini_btn" title="Обновить" id="update_employees_action">
|
||||
<svg>
|
||||
<use xlink:href="#update_icon"></use>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data table">
|
||||
<div class="table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>First Name</td>
|
||||
<td>Last Name</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="table-scroll-body">
|
||||
<table>
|
||||
<tbody id="employees_block">
|
||||
@* <tr>
|
||||
<td>John</td>
|
||||
<td>Heart</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Olivia</td>
|
||||
<td>Peyton</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Robert</td>
|
||||
<td>Reagan</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cynthia</td>
|
||||
<td>Stanwick</td>
|
||||
</tr>*@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group">
|
||||
<div class="header mini">
|
||||
<h4> </h4>
|
||||
<div class="header_btns">
|
||||
<div class="mini_btn" title="Добавить" id="add_action">
|
||||
<svg>
|
||||
<use xlink:href="#pen_btn"></use>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="mini_btn" title="Удалить" id="remove_employees_action">
|
||||
<svg>
|
||||
<use xlink:href="#trash_icon"></use>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data mini">
|
||||
<label>First Name:</label>
|
||||
<input type="text" id="employee_fisrt" value=""/>
|
||||
<label>Last Name:</label>
|
||||
<input type="text" id="employee_last" value="" />
|
||||
<label>Title:</label>
|
||||
<input type="text" id="employee_title" value="" />
|
||||
<label>Birth Date:</label>
|
||||
<input type="date" id="employee_date" value=""
|
||||
required />
|
||||
<label>Position:</label>
|
||||
<input type="text" id="employee_pos" value="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
@ -1,50 +0,0 @@
|
||||
@using Models
|
||||
@model HomeViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Companies";
|
||||
}
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="content_companies">
|
||||
<div class="header">
|
||||
<h4>Companies</h4>
|
||||
<div class="header_btns">
|
||||
<div class="mini_btn" title="Добавить" id="add_company_action">
|
||||
<svg>
|
||||
<use xlink:href="#plus_btn"></use>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="mini_btn" title="Редактировать" id="edit_action">
|
||||
<svg>
|
||||
<use xlink:href="#pen_btn"></use>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data">
|
||||
<table border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Company Name</td>
|
||||
<td>City</td>
|
||||
<td>State</td>
|
||||
<td>Phone</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach(var c in Model.Companies)
|
||||
{
|
||||
<tr>
|
||||
<td><a href="/details/@c.Id" target="_blank">@c.Name</a></td>
|
||||
<td>@c.City</td>
|
||||
<td>@c.State</td>
|
||||
<td>@c.Phone</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
@ -1,25 +0,0 @@
|
||||
@model ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
@ -1,49 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"]</title>
|
||||
<link rel="stylesheet" href="~/css/app.min.css" rel="stylesheet" />
|
||||
<script src="~/js/app.min.js"></script>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
<!--Start svg icons-->
|
||||
<div class="hidden">
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<symbol width="25" height="25" fill="currentColor" class="bi bi-plus-lg" viewBox="0 0 16 16" id="plus_btn">
|
||||
<path fill-rule="evenodd" d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2Z" />
|
||||
</symbol>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" >
|
||||
<symbol width="20" height="20" fill="currentColor" class="bi bi-pencil-fill" viewBox="0 0 16 16" id="pen_btn">
|
||||
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708l-3-3zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207l6.5-6.5zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.499.499 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11l.178-.178z" />
|
||||
</symbol>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<symbol width="25" height="25" fill="currentColor" class="bi bi-check-lg" viewBox="0 0 16 16" id="check_icon">
|
||||
<path d="M12.736 3.97a.733.733 0 0 1 1.047 0c.286.289.29.756.01 1.05L7.88 12.01a.733.733 0 0 1-1.065.02L3.217 8.384a.757.757 0 0 1 0-1.06.733.733 0 0 1 1.047 0l3.052 3.093 5.4-6.425a.247.247 0 0 1 .02-.022Z" />
|
||||
</symbol>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<symbol width="25" height="25" fill="currentColor" class="bi bi-arrow-repeat" viewBox="0 0 16 16" id="update_icon">
|
||||
<path d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41zm-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9z" />
|
||||
<path fill-rule="evenodd" d="M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5.002 5.002 0 0 0 8 3zM3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9H3.1z" />
|
||||
</symbol>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<symbol width="25" height="25" fill="currentColor" class="bi bi-check-lg" viewBox="0 0 16 16" id="trash_icon">
|
||||
<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z" />
|
||||
</symbol>
|
||||
</svg>
|
||||
</div>
|
||||
<!--End svg icons-->
|
||||
</body>
|
||||
</html>
|
@ -1,2 +0,0 @@
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
@ -1,3 +0,0 @@
|
||||
@using Companies
|
||||
@using Companies.Models
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@ -1,3 +0,0 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
Binary file not shown.
@ -1,8 +0,0 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
12
Companies/Companies/node_modules/.bin/esparse
generated
vendored
12
Companies/Companies/node_modules/.bin/esparse
generated
vendored
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../esprima/bin/esparse.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../esprima/bin/esparse.js" "$@"
|
||||
fi
|
17
Companies/Companies/node_modules/.bin/esparse.cmd
generated
vendored
17
Companies/Companies/node_modules/.bin/esparse.cmd
generated
vendored
@ -1,17 +0,0 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\esprima\bin\esparse.js" %*
|
28
Companies/Companies/node_modules/.bin/esparse.ps1
generated
vendored
28
Companies/Companies/node_modules/.bin/esparse.ps1
generated
vendored
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
Companies/Companies/node_modules/.bin/esvalidate
generated
vendored
12
Companies/Companies/node_modules/.bin/esvalidate
generated
vendored
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../esprima/bin/esvalidate.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../esprima/bin/esvalidate.js" "$@"
|
||||
fi
|
17
Companies/Companies/node_modules/.bin/esvalidate.cmd
generated
vendored
17
Companies/Companies/node_modules/.bin/esvalidate.cmd
generated
vendored
@ -1,17 +0,0 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\esprima\bin\esvalidate.js" %*
|
28
Companies/Companies/node_modules/.bin/esvalidate.ps1
generated
vendored
28
Companies/Companies/node_modules/.bin/esvalidate.ps1
generated
vendored
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
Companies/Companies/node_modules/.bin/grunt
generated
vendored
12
Companies/Companies/node_modules/.bin/grunt
generated
vendored
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../grunt/bin/grunt" "$@"
|
||||
else
|
||||
exec node "$basedir/../grunt/bin/grunt" "$@"
|
||||
fi
|
17
Companies/Companies/node_modules/.bin/grunt.cmd
generated
vendored
17
Companies/Companies/node_modules/.bin/grunt.cmd
generated
vendored
@ -1,17 +0,0 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\grunt\bin\grunt" %*
|
28
Companies/Companies/node_modules/.bin/grunt.ps1
generated
vendored
28
Companies/Companies/node_modules/.bin/grunt.ps1
generated
vendored
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../grunt/bin/grunt" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../grunt/bin/grunt" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../grunt/bin/grunt" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../grunt/bin/grunt" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
Companies/Companies/node_modules/.bin/js-yaml
generated
vendored
12
Companies/Companies/node_modules/.bin/js-yaml
generated
vendored
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../js-yaml/bin/js-yaml.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../js-yaml/bin/js-yaml.js" "$@"
|
||||
fi
|
17
Companies/Companies/node_modules/.bin/js-yaml.cmd
generated
vendored
17
Companies/Companies/node_modules/.bin/js-yaml.cmd
generated
vendored
@ -1,17 +0,0 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\js-yaml\bin\js-yaml.js" %*
|
28
Companies/Companies/node_modules/.bin/js-yaml.ps1
generated
vendored
28
Companies/Companies/node_modules/.bin/js-yaml.ps1
generated
vendored
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
Companies/Companies/node_modules/.bin/mkdirp
generated
vendored
12
Companies/Companies/node_modules/.bin/mkdirp
generated
vendored
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||
fi
|
17
Companies/Companies/node_modules/.bin/mkdirp.cmd
generated
vendored
17
Companies/Companies/node_modules/.bin/mkdirp.cmd
generated
vendored
@ -1,17 +0,0 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %*
|
28
Companies/Companies/node_modules/.bin/mkdirp.ps1
generated
vendored
28
Companies/Companies/node_modules/.bin/mkdirp.ps1
generated
vendored
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
Companies/Companies/node_modules/.bin/nopt
generated
vendored
12
Companies/Companies/node_modules/.bin/nopt
generated
vendored
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../nopt/bin/nopt.js" "$@"
|
||||
fi
|
17
Companies/Companies/node_modules/.bin/nopt.cmd
generated
vendored
17
Companies/Companies/node_modules/.bin/nopt.cmd
generated
vendored
@ -1,17 +0,0 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nopt\bin\nopt.js" %*
|
28
Companies/Companies/node_modules/.bin/nopt.ps1
generated
vendored
28
Companies/Companies/node_modules/.bin/nopt.ps1
generated
vendored
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../nopt/bin/nopt.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
Companies/Companies/node_modules/.bin/resolve
generated
vendored
12
Companies/Companies/node_modules/.bin/resolve
generated
vendored
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../resolve/bin/resolve" "$@"
|
||||
else
|
||||
exec node "$basedir/../resolve/bin/resolve" "$@"
|
||||
fi
|
17
Companies/Companies/node_modules/.bin/resolve.cmd
generated
vendored
17
Companies/Companies/node_modules/.bin/resolve.cmd
generated
vendored
@ -1,17 +0,0 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\resolve\bin\resolve" %*
|
28
Companies/Companies/node_modules/.bin/resolve.ps1
generated
vendored
28
Companies/Companies/node_modules/.bin/resolve.ps1
generated
vendored
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../resolve/bin/resolve" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../resolve/bin/resolve" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../resolve/bin/resolve" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../resolve/bin/resolve" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
Companies/Companies/node_modules/.bin/rimraf
generated
vendored
12
Companies/Companies/node_modules/.bin/rimraf
generated
vendored
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../rimraf/bin.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../rimraf/bin.js" "$@"
|
||||
fi
|
17
Companies/Companies/node_modules/.bin/rimraf.cmd
generated
vendored
17
Companies/Companies/node_modules/.bin/rimraf.cmd
generated
vendored
@ -1,17 +0,0 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rimraf\bin.js" %*
|
28
Companies/Companies/node_modules/.bin/rimraf.ps1
generated
vendored
28
Companies/Companies/node_modules/.bin/rimraf.ps1
generated
vendored
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../rimraf/bin.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
Companies/Companies/node_modules/.bin/uglifyjs
generated
vendored
12
Companies/Companies/node_modules/.bin/uglifyjs
generated
vendored
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../uglify-js/bin/uglifyjs" "$@"
|
||||
else
|
||||
exec node "$basedir/../uglify-js/bin/uglifyjs" "$@"
|
||||
fi
|
17
Companies/Companies/node_modules/.bin/uglifyjs.cmd
generated
vendored
17
Companies/Companies/node_modules/.bin/uglifyjs.cmd
generated
vendored
@ -1,17 +0,0 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\uglify-js\bin\uglifyjs" %*
|
28
Companies/Companies/node_modules/.bin/uglifyjs.ps1
generated
vendored
28
Companies/Companies/node_modules/.bin/uglifyjs.ps1
generated
vendored
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
12
Companies/Companies/node_modules/.bin/which
generated
vendored
12
Companies/Companies/node_modules/.bin/which
generated
vendored
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../which/bin/which" "$@"
|
||||
else
|
||||
exec node "$basedir/../which/bin/which" "$@"
|
||||
fi
|
17
Companies/Companies/node_modules/.bin/which.cmd
generated
vendored
17
Companies/Companies/node_modules/.bin/which.cmd
generated
vendored
@ -1,17 +0,0 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\which\bin\which" %*
|
28
Companies/Companies/node_modules/.bin/which.ps1
generated
vendored
28
Companies/Companies/node_modules/.bin/which.ps1
generated
vendored
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../which/bin/which" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../which/bin/which" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../which/bin/which" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../which/bin/which" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
1639
Companies/Companies/node_modules/.package-lock.json
generated
vendored
1639
Companies/Companies/node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
46
Companies/Companies/node_modules/abbrev/LICENSE
generated
vendored
46
Companies/Companies/node_modules/abbrev/LICENSE
generated
vendored
@ -1,46 +0,0 @@
|
||||
This software is dual-licensed under the ISC and MIT licenses.
|
||||
You may use this software under EITHER of the following licenses.
|
||||
|
||||
----------
|
||||
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
----------
|
||||
|
||||
Copyright Isaac Z. Schlueter and Contributors
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
23
Companies/Companies/node_modules/abbrev/README.md
generated
vendored
23
Companies/Companies/node_modules/abbrev/README.md
generated
vendored
@ -1,23 +0,0 @@
|
||||
# abbrev-js
|
||||
|
||||
Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
|
||||
|
||||
Usage:
|
||||
|
||||
var abbrev = require("abbrev");
|
||||
abbrev("foo", "fool", "folding", "flop");
|
||||
|
||||
// returns:
|
||||
{ fl: 'flop'
|
||||
, flo: 'flop'
|
||||
, flop: 'flop'
|
||||
, fol: 'folding'
|
||||
, fold: 'folding'
|
||||
, foldi: 'folding'
|
||||
, foldin: 'folding'
|
||||
, folding: 'folding'
|
||||
, foo: 'foo'
|
||||
, fool: 'fool'
|
||||
}
|
||||
|
||||
This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
|
61
Companies/Companies/node_modules/abbrev/abbrev.js
generated
vendored
61
Companies/Companies/node_modules/abbrev/abbrev.js
generated
vendored
@ -1,61 +0,0 @@
|
||||
module.exports = exports = abbrev.abbrev = abbrev
|
||||
|
||||
abbrev.monkeyPatch = monkeyPatch
|
||||
|
||||
function monkeyPatch () {
|
||||
Object.defineProperty(Array.prototype, 'abbrev', {
|
||||
value: function () { return abbrev(this) },
|
||||
enumerable: false, configurable: true, writable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(Object.prototype, 'abbrev', {
|
||||
value: function () { return abbrev(Object.keys(this)) },
|
||||
enumerable: false, configurable: true, writable: true
|
||||
})
|
||||
}
|
||||
|
||||
function abbrev (list) {
|
||||
if (arguments.length !== 1 || !Array.isArray(list)) {
|
||||
list = Array.prototype.slice.call(arguments, 0)
|
||||
}
|
||||
for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
|
||||
args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
|
||||
}
|
||||
|
||||
// sort them lexicographically, so that they're next to their nearest kin
|
||||
args = args.sort(lexSort)
|
||||
|
||||
// walk through each, seeing how much it has in common with the next and previous
|
||||
var abbrevs = {}
|
||||
, prev = ""
|
||||
for (var i = 0, l = args.length ; i < l ; i ++) {
|
||||
var current = args[i]
|
||||
, next = args[i + 1] || ""
|
||||
, nextMatches = true
|
||||
, prevMatches = true
|
||||
if (current === next) continue
|
||||
for (var j = 0, cl = current.length ; j < cl ; j ++) {
|
||||
var curChar = current.charAt(j)
|
||||
nextMatches = nextMatches && curChar === next.charAt(j)
|
||||
prevMatches = prevMatches && curChar === prev.charAt(j)
|
||||
if (!nextMatches && !prevMatches) {
|
||||
j ++
|
||||
break
|
||||
}
|
||||
}
|
||||
prev = current
|
||||
if (j === cl) {
|
||||
abbrevs[current] = current
|
||||
continue
|
||||
}
|
||||
for (var a = current.substr(0, j) ; j <= cl ; j ++) {
|
||||
abbrevs[a] = current
|
||||
a += current.charAt(j)
|
||||
}
|
||||
}
|
||||
return abbrevs
|
||||
}
|
||||
|
||||
function lexSort (a, b) {
|
||||
return a === b ? 0 : a > b ? 1 : -1
|
||||
}
|
21
Companies/Companies/node_modules/abbrev/package.json
generated
vendored
21
Companies/Companies/node_modules/abbrev/package.json
generated
vendored
@ -1,21 +0,0 @@
|
||||
{
|
||||
"name": "abbrev",
|
||||
"version": "1.1.1",
|
||||
"description": "Like ruby's abbrev module, but in js",
|
||||
"author": "Isaac Z. Schlueter <i@izs.me>",
|
||||
"main": "abbrev.js",
|
||||
"scripts": {
|
||||
"test": "tap test.js --100",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"postpublish": "git push origin --all; git push origin --tags"
|
||||
},
|
||||
"repository": "http://github.com/isaacs/abbrev-js",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"tap": "^10.1"
|
||||
},
|
||||
"files": [
|
||||
"abbrev.js"
|
||||
]
|
||||
}
|
345
Companies/Companies/node_modules/ansi-styles/index.d.ts
generated
vendored
345
Companies/Companies/node_modules/ansi-styles/index.d.ts
generated
vendored
@ -1,345 +0,0 @@
|
||||
declare type CSSColor =
|
||||
| 'aliceblue'
|
||||
| 'antiquewhite'
|
||||
| 'aqua'
|
||||
| 'aquamarine'
|
||||
| 'azure'
|
||||
| 'beige'
|
||||
| 'bisque'
|
||||
| 'black'
|
||||
| 'blanchedalmond'
|
||||
| 'blue'
|
||||
| 'blueviolet'
|
||||
| 'brown'
|
||||
| 'burlywood'
|
||||
| 'cadetblue'
|
||||
| 'chartreuse'
|
||||
| 'chocolate'
|
||||
| 'coral'
|
||||
| 'cornflowerblue'
|
||||
| 'cornsilk'
|
||||
| 'crimson'
|
||||
| 'cyan'
|
||||
| 'darkblue'
|
||||
| 'darkcyan'
|
||||
| 'darkgoldenrod'
|
||||
| 'darkgray'
|
||||
| 'darkgreen'
|
||||
| 'darkgrey'
|
||||
| 'darkkhaki'
|
||||
| 'darkmagenta'
|
||||
| 'darkolivegreen'
|
||||
| 'darkorange'
|
||||
| 'darkorchid'
|
||||
| 'darkred'
|
||||
| 'darksalmon'
|
||||
| 'darkseagreen'
|
||||
| 'darkslateblue'
|
||||
| 'darkslategray'
|
||||
| 'darkslategrey'
|
||||
| 'darkturquoise'
|
||||
| 'darkviolet'
|
||||
| 'deeppink'
|
||||
| 'deepskyblue'
|
||||
| 'dimgray'
|
||||
| 'dimgrey'
|
||||
| 'dodgerblue'
|
||||
| 'firebrick'
|
||||
| 'floralwhite'
|
||||
| 'forestgreen'
|
||||
| 'fuchsia'
|
||||
| 'gainsboro'
|
||||
| 'ghostwhite'
|
||||
| 'gold'
|
||||
| 'goldenrod'
|
||||
| 'gray'
|
||||
| 'green'
|
||||
| 'greenyellow'
|
||||
| 'grey'
|
||||
| 'honeydew'
|
||||
| 'hotpink'
|
||||
| 'indianred'
|
||||
| 'indigo'
|
||||
| 'ivory'
|
||||
| 'khaki'
|
||||
| 'lavender'
|
||||
| 'lavenderblush'
|
||||
| 'lawngreen'
|
||||
| 'lemonchiffon'
|
||||
| 'lightblue'
|
||||
| 'lightcoral'
|
||||
| 'lightcyan'
|
||||
| 'lightgoldenrodyellow'
|
||||
| 'lightgray'
|
||||
| 'lightgreen'
|
||||
| 'lightgrey'
|
||||
| 'lightpink'
|
||||
| 'lightsalmon'
|
||||
| 'lightseagreen'
|
||||
| 'lightskyblue'
|
||||
| 'lightslategray'
|
||||
| 'lightslategrey'
|
||||
| 'lightsteelblue'
|
||||
| 'lightyellow'
|
||||
| 'lime'
|
||||
| 'limegreen'
|
||||
| 'linen'
|
||||
| 'magenta'
|
||||
| 'maroon'
|
||||
| 'mediumaquamarine'
|
||||
| 'mediumblue'
|
||||
| 'mediumorchid'
|
||||
| 'mediumpurple'
|
||||
| 'mediumseagreen'
|
||||
| 'mediumslateblue'
|
||||
| 'mediumspringgreen'
|
||||
| 'mediumturquoise'
|
||||
| 'mediumvioletred'
|
||||
| 'midnightblue'
|
||||
| 'mintcream'
|
||||
| 'mistyrose'
|
||||
| 'moccasin'
|
||||
| 'navajowhite'
|
||||
| 'navy'
|
||||
| 'oldlace'
|
||||
| 'olive'
|
||||
| 'olivedrab'
|
||||
| 'orange'
|
||||
| 'orangered'
|
||||
| 'orchid'
|
||||
| 'palegoldenrod'
|
||||
| 'palegreen'
|
||||
| 'paleturquoise'
|
||||
| 'palevioletred'
|
||||
| 'papayawhip'
|
||||
| 'peachpuff'
|
||||
| 'peru'
|
||||
| 'pink'
|
||||
| 'plum'
|
||||
| 'powderblue'
|
||||
| 'purple'
|
||||
| 'rebeccapurple'
|
||||
| 'red'
|
||||
| 'rosybrown'
|
||||
| 'royalblue'
|
||||
| 'saddlebrown'
|
||||
| 'salmon'
|
||||
| 'sandybrown'
|
||||
| 'seagreen'
|
||||
| 'seashell'
|
||||
| 'sienna'
|
||||
| 'silver'
|
||||
| 'skyblue'
|
||||
| 'slateblue'
|
||||
| 'slategray'
|
||||
| 'slategrey'
|
||||
| 'snow'
|
||||
| 'springgreen'
|
||||
| 'steelblue'
|
||||
| 'tan'
|
||||
| 'teal'
|
||||
| 'thistle'
|
||||
| 'tomato'
|
||||
| 'turquoise'
|
||||
| 'violet'
|
||||
| 'wheat'
|
||||
| 'white'
|
||||
| 'whitesmoke'
|
||||
| 'yellow'
|
||||
| 'yellowgreen';
|
||||
|
||||
declare namespace ansiStyles {
|
||||
interface ColorConvert {
|
||||
/**
|
||||
The RGB color space.
|
||||
|
||||
@param red - (`0`-`255`)
|
||||
@param green - (`0`-`255`)
|
||||
@param blue - (`0`-`255`)
|
||||
*/
|
||||
rgb(red: number, green: number, blue: number): string;
|
||||
|
||||
/**
|
||||
The RGB HEX color space.
|
||||
|
||||
@param hex - A hexadecimal string containing RGB data.
|
||||
*/
|
||||
hex(hex: string): string;
|
||||
|
||||
/**
|
||||
@param keyword - A CSS color name.
|
||||
*/
|
||||
keyword(keyword: CSSColor): string;
|
||||
|
||||
/**
|
||||
The HSL color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param saturation - (`0`-`100`)
|
||||
@param lightness - (`0`-`100`)
|
||||
*/
|
||||
hsl(hue: number, saturation: number, lightness: number): string;
|
||||
|
||||
/**
|
||||
The HSV color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param saturation - (`0`-`100`)
|
||||
@param value - (`0`-`100`)
|
||||
*/
|
||||
hsv(hue: number, saturation: number, value: number): string;
|
||||
|
||||
/**
|
||||
The HSV color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param whiteness - (`0`-`100`)
|
||||
@param blackness - (`0`-`100`)
|
||||
*/
|
||||
hwb(hue: number, whiteness: number, blackness: number): string;
|
||||
|
||||
/**
|
||||
Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
|
||||
*/
|
||||
ansi(ansi: number): string;
|
||||
|
||||
/**
|
||||
Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||
*/
|
||||
ansi256(ansi: number): string;
|
||||
}
|
||||
|
||||
interface CSPair {
|
||||
/**
|
||||
The ANSI terminal control sequence for starting this style.
|
||||
*/
|
||||
readonly open: string;
|
||||
|
||||
/**
|
||||
The ANSI terminal control sequence for ending this style.
|
||||
*/
|
||||
readonly close: string;
|
||||
}
|
||||
|
||||
interface ColorBase {
|
||||
readonly ansi: ColorConvert;
|
||||
readonly ansi256: ColorConvert;
|
||||
readonly ansi16m: ColorConvert;
|
||||
|
||||
/**
|
||||
The ANSI terminal control sequence for ending this color.
|
||||
*/
|
||||
readonly close: string;
|
||||
}
|
||||
|
||||
interface Modifier {
|
||||
/**
|
||||
Resets the current color chain.
|
||||
*/
|
||||
readonly reset: CSPair;
|
||||
|
||||
/**
|
||||
Make text bold.
|
||||
*/
|
||||
readonly bold: CSPair;
|
||||
|
||||
/**
|
||||
Emitting only a small amount of light.
|
||||
*/
|
||||
readonly dim: CSPair;
|
||||
|
||||
/**
|
||||
Make text italic. (Not widely supported)
|
||||
*/
|
||||
readonly italic: CSPair;
|
||||
|
||||
/**
|
||||
Make text underline. (Not widely supported)
|
||||
*/
|
||||
readonly underline: CSPair;
|
||||
|
||||
/**
|
||||
Inverse background and foreground colors.
|
||||
*/
|
||||
readonly inverse: CSPair;
|
||||
|
||||
/**
|
||||
Prints the text, but makes it invisible.
|
||||
*/
|
||||
readonly hidden: CSPair;
|
||||
|
||||
/**
|
||||
Puts a horizontal line through the center of the text. (Not widely supported)
|
||||
*/
|
||||
readonly strikethrough: CSPair;
|
||||
}
|
||||
|
||||
interface ForegroundColor {
|
||||
readonly black: CSPair;
|
||||
readonly red: CSPair;
|
||||
readonly green: CSPair;
|
||||
readonly yellow: CSPair;
|
||||
readonly blue: CSPair;
|
||||
readonly cyan: CSPair;
|
||||
readonly magenta: CSPair;
|
||||
readonly white: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly gray: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly grey: CSPair;
|
||||
|
||||
readonly blackBright: CSPair;
|
||||
readonly redBright: CSPair;
|
||||
readonly greenBright: CSPair;
|
||||
readonly yellowBright: CSPair;
|
||||
readonly blueBright: CSPair;
|
||||
readonly cyanBright: CSPair;
|
||||
readonly magentaBright: CSPair;
|
||||
readonly whiteBright: CSPair;
|
||||
}
|
||||
|
||||
interface BackgroundColor {
|
||||
readonly bgBlack: CSPair;
|
||||
readonly bgRed: CSPair;
|
||||
readonly bgGreen: CSPair;
|
||||
readonly bgYellow: CSPair;
|
||||
readonly bgBlue: CSPair;
|
||||
readonly bgCyan: CSPair;
|
||||
readonly bgMagenta: CSPair;
|
||||
readonly bgWhite: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGray: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGrey: CSPair;
|
||||
|
||||
readonly bgBlackBright: CSPair;
|
||||
readonly bgRedBright: CSPair;
|
||||
readonly bgGreenBright: CSPair;
|
||||
readonly bgYellowBright: CSPair;
|
||||
readonly bgBlueBright: CSPair;
|
||||
readonly bgCyanBright: CSPair;
|
||||
readonly bgMagentaBright: CSPair;
|
||||
readonly bgWhiteBright: CSPair;
|
||||
}
|
||||
}
|
||||
|
||||
declare const ansiStyles: {
|
||||
readonly modifier: ansiStyles.Modifier;
|
||||
readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
|
||||
readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
|
||||
readonly codes: ReadonlyMap<number, number>;
|
||||
} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;
|
||||
|
||||
export = ansiStyles;
|
163
Companies/Companies/node_modules/ansi-styles/index.js
generated
vendored
163
Companies/Companies/node_modules/ansi-styles/index.js
generated
vendored
@ -1,163 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const wrapAnsi16 = (fn, offset) => (...args) => {
|
||||
const code = fn(...args);
|
||||
return `\u001B[${code + offset}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi256 = (fn, offset) => (...args) => {
|
||||
const code = fn(...args);
|
||||
return `\u001B[${38 + offset};5;${code}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi16m = (fn, offset) => (...args) => {
|
||||
const rgb = fn(...args);
|
||||
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||
};
|
||||
|
||||
const ansi2ansi = n => n;
|
||||
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||
|
||||
const setLazyProperty = (object, property, get) => {
|
||||
Object.defineProperty(object, property, {
|
||||
get: () => {
|
||||
const value = get();
|
||||
|
||||
Object.defineProperty(object, property, {
|
||||
value,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
return value;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
};
|
||||
|
||||
/** @type {typeof import('color-convert')} */
|
||||
let colorConvert;
|
||||
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
||||
if (colorConvert === undefined) {
|
||||
colorConvert = require('color-convert');
|
||||
}
|
||||
|
||||
const offset = isBackground ? 10 : 0;
|
||||
const styles = {};
|
||||
|
||||
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
||||
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
|
||||
if (sourceSpace === targetSpace) {
|
||||
styles[name] = wrap(identity, offset);
|
||||
} else if (typeof suite === 'object') {
|
||||
styles[name] = wrap(suite[targetSpace], offset);
|
||||
}
|
||||
}
|
||||
|
||||
return styles;
|
||||
};
|
||||
|
||||
function assembleStyles() {
|
||||
const codes = new Map();
|
||||
const styles = {
|
||||
modifier: {
|
||||
reset: [0, 0],
|
||||
// 21 isn't widely supported and 22 does the same thing
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29]
|
||||
},
|
||||
color: {
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
|
||||
// Bright color
|
||||
blackBright: [90, 39],
|
||||
redBright: [91, 39],
|
||||
greenBright: [92, 39],
|
||||
yellowBright: [93, 39],
|
||||
blueBright: [94, 39],
|
||||
magentaBright: [95, 39],
|
||||
cyanBright: [96, 39],
|
||||
whiteBright: [97, 39]
|
||||
},
|
||||
bgColor: {
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
|
||||
// Bright color
|
||||
bgBlackBright: [100, 49],
|
||||
bgRedBright: [101, 49],
|
||||
bgGreenBright: [102, 49],
|
||||
bgYellowBright: [103, 49],
|
||||
bgBlueBright: [104, 49],
|
||||
bgMagentaBright: [105, 49],
|
||||
bgCyanBright: [106, 49],
|
||||
bgWhiteBright: [107, 49]
|
||||
}
|
||||
};
|
||||
|
||||
// Alias bright black as gray (and grey)
|
||||
styles.color.gray = styles.color.blackBright;
|
||||
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
||||
styles.color.grey = styles.color.blackBright;
|
||||
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
||||
|
||||
for (const [groupName, group] of Object.entries(styles)) {
|
||||
for (const [styleName, style] of Object.entries(group)) {
|
||||
styles[styleName] = {
|
||||
open: `\u001B[${style[0]}m`,
|
||||
close: `\u001B[${style[1]}m`
|
||||
};
|
||||
|
||||
group[styleName] = styles[styleName];
|
||||
|
||||
codes.set(style[0], style[1]);
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, groupName, {
|
||||
value: group,
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, 'codes', {
|
||||
value: codes,
|
||||
enumerable: false
|
||||
});
|
||||
|
||||
styles.color.close = '\u001B[39m';
|
||||
styles.bgColor.close = '\u001B[49m';
|
||||
|
||||
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
|
||||
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
|
||||
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
|
||||
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
|
||||
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
|
||||
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
// Make the export immutable
|
||||
Object.defineProperty(module, 'exports', {
|
||||
enumerable: true,
|
||||
get: assembleStyles
|
||||
});
|
9
Companies/Companies/node_modules/ansi-styles/license
generated
vendored
9
Companies/Companies/node_modules/ansi-styles/license
generated
vendored
@ -1,9 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
56
Companies/Companies/node_modules/ansi-styles/package.json
generated
vendored
56
Companies/Companies/node_modules/ansi-styles/package.json
generated
vendored
@ -1,56 +0,0 @@
|
||||
{
|
||||
"name": "ansi-styles",
|
||||
"version": "4.3.0",
|
||||
"description": "ANSI escape codes for styling strings in the terminal",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/ansi-styles",
|
||||
"funding": "https://github.com/chalk/ansi-styles?sponsor=1",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd",
|
||||
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/color-convert": "^1.9.0",
|
||||
"ava": "^2.3.0",
|
||||
"svg-term-cli": "^2.1.1",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.25.3"
|
||||
}
|
||||
}
|
152
Companies/Companies/node_modules/ansi-styles/readme.md
generated
vendored
152
Companies/Companies/node_modules/ansi-styles/readme.md
generated
vendored
@ -1,152 +0,0 @@
|
||||
# ansi-styles [](https://travis-ci.org/chalk/ansi-styles)
|
||||
|
||||
> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||
|
||||
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
||||
|
||||
<img src="screenshot.svg" width="900">
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install ansi-styles
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const style = require('ansi-styles');
|
||||
|
||||
console.log(`${style.green.open}Hello world!${style.green.close}`);
|
||||
|
||||
|
||||
// Color conversion between 16/256/truecolor
|
||||
// NOTE: If conversion goes to 16 colors or 256 colors, the original color
|
||||
// may be degraded to fit that color palette. This means terminals
|
||||
// that do not support 16 million colors will best-match the
|
||||
// original color.
|
||||
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
|
||||
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
|
||||
console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Each style has an `open` and `close` property.
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(Not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(Not widely supported)*
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `blackBright` (alias: `gray`, `grey`)
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
## Advanced usage
|
||||
|
||||
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
||||
|
||||
- `style.modifier`
|
||||
- `style.color`
|
||||
- `style.bgColor`
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.color.green.open);
|
||||
```
|
||||
|
||||
Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.codes.get(36));
|
||||
//=> 39
|
||||
```
|
||||
|
||||
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
|
||||
|
||||
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
|
||||
|
||||
The following color spaces from `color-convert` are supported:
|
||||
|
||||
- `rgb`
|
||||
- `hex`
|
||||
- `keyword`
|
||||
- `hsl`
|
||||
- `hsv`
|
||||
- `hwb`
|
||||
- `ansi`
|
||||
- `ansi256`
|
||||
|
||||
To use these, call the associated conversion function with the intended output, for example:
|
||||
|
||||
```js
|
||||
style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
|
||||
style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
|
||||
|
||||
style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
|
||||
style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
|
||||
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
## For enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
185
Companies/Companies/node_modules/argparse/CHANGELOG.md
generated
vendored
185
Companies/Companies/node_modules/argparse/CHANGELOG.md
generated
vendored
@ -1,185 +0,0 @@
|
||||
1.0.10 / 2018-02-15
|
||||
------------------
|
||||
|
||||
- Use .concat instead of + for arrays, #122.
|
||||
|
||||
|
||||
1.0.9 / 2016-09-29
|
||||
------------------
|
||||
|
||||
- Rerelease after 1.0.8 - deps cleanup.
|
||||
|
||||
|
||||
1.0.8 / 2016-09-29
|
||||
------------------
|
||||
|
||||
- Maintenance (deps bump, fix node 6.5+ tests, coverage report).
|
||||
|
||||
|
||||
1.0.7 / 2016-03-17
|
||||
------------------
|
||||
|
||||
- Teach `addArgument` to accept string arg names. #97, @tomxtobin.
|
||||
|
||||
|
||||
1.0.6 / 2016-02-06
|
||||
------------------
|
||||
|
||||
- Maintenance: moved to eslint & updated CS.
|
||||
|
||||
|
||||
1.0.5 / 2016-02-05
|
||||
------------------
|
||||
|
||||
- Removed lodash dependency to significantly reduce install size.
|
||||
Thanks to @mourner.
|
||||
|
||||
|
||||
1.0.4 / 2016-01-17
|
||||
------------------
|
||||
|
||||
- Maintenance: lodash update to 4.0.0.
|
||||
|
||||
|
||||
1.0.3 / 2015-10-27
|
||||
------------------
|
||||
|
||||
- Fix parse `=` in args: `--examplepath="C:\myfolder\env=x64"`. #84, @CatWithApple.
|
||||
|
||||
|
||||
1.0.2 / 2015-03-22
|
||||
------------------
|
||||
|
||||
- Relaxed lodash version dependency.
|
||||
|
||||
|
||||
1.0.1 / 2015-02-20
|
||||
------------------
|
||||
|
||||
- Changed dependencies to be compatible with ancient nodejs.
|
||||
|
||||
|
||||
1.0.0 / 2015-02-19
|
||||
------------------
|
||||
|
||||
- Maintenance release.
|
||||
- Replaced `underscore` with `lodash`.
|
||||
- Bumped version to 1.0.0 to better reflect semver meaning.
|
||||
- HISTORY.md -> CHANGELOG.md
|
||||
|
||||
|
||||
0.1.16 / 2013-12-01
|
||||
-------------------
|
||||
|
||||
- Maintenance release. Updated dependencies and docs.
|
||||
|
||||
|
||||
0.1.15 / 2013-05-13
|
||||
-------------------
|
||||
|
||||
- Fixed #55, @trebor89
|
||||
|
||||
|
||||
0.1.14 / 2013-05-12
|
||||
-------------------
|
||||
|
||||
- Fixed #62, @maxtaco
|
||||
|
||||
|
||||
0.1.13 / 2013-04-08
|
||||
-------------------
|
||||
|
||||
- Added `.npmignore` to reduce package size
|
||||
|
||||
|
||||
0.1.12 / 2013-02-10
|
||||
-------------------
|
||||
|
||||
- Fixed conflictHandler (#46), @hpaulj
|
||||
|
||||
|
||||
0.1.11 / 2013-02-07
|
||||
-------------------
|
||||
|
||||
- Multiple bugfixes, @hpaulj
|
||||
- Added 70+ tests (ported from python), @hpaulj
|
||||
- Added conflictHandler, @applepicke
|
||||
- Added fromfilePrefixChar, @hpaulj
|
||||
|
||||
|
||||
0.1.10 / 2012-12-30
|
||||
-------------------
|
||||
|
||||
- Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion)
|
||||
support, thanks to @hpaulj
|
||||
- Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj
|
||||
|
||||
|
||||
0.1.9 / 2012-12-27
|
||||
------------------
|
||||
|
||||
- Fixed option dest interferens with other options (issue #23), thanks to @hpaulj
|
||||
- Fixed default value behavior with `*` positionals, thanks to @hpaulj
|
||||
- Improve `getDefault()` behavior, thanks to @hpaulj
|
||||
- Imrove negative argument parsing, thanks to @hpaulj
|
||||
|
||||
|
||||
0.1.8 / 2012-12-01
|
||||
------------------
|
||||
|
||||
- Fixed parser parents (issue #19), thanks to @hpaulj
|
||||
- Fixed negative argument parse (issue #20), thanks to @hpaulj
|
||||
|
||||
|
||||
0.1.7 / 2012-10-14
|
||||
------------------
|
||||
|
||||
- Fixed 'choices' argument parse (issue #16)
|
||||
- Fixed stderr output (issue #15)
|
||||
|
||||
|
||||
0.1.6 / 2012-09-09
|
||||
------------------
|
||||
|
||||
- Fixed check for conflict of options (thanks to @tomxtobin)
|
||||
|
||||
|
||||
0.1.5 / 2012-09-03
|
||||
------------------
|
||||
|
||||
- Fix parser #setDefaults method (thanks to @tomxtobin)
|
||||
|
||||
|
||||
0.1.4 / 2012-07-30
|
||||
------------------
|
||||
|
||||
- Fixed pseudo-argument support (thanks to @CGamesPlay)
|
||||
- Fixed addHelp default (should be true), if not set (thanks to @benblank)
|
||||
|
||||
|
||||
0.1.3 / 2012-06-27
|
||||
------------------
|
||||
|
||||
- Fixed formatter api name: Formatter -> HelpFormatter
|
||||
|
||||
|
||||
0.1.2 / 2012-05-29
|
||||
------------------
|
||||
|
||||
- Added basic tests
|
||||
- Removed excess whitespace in help
|
||||
- Fixed error reporting, when parcer with subcommands
|
||||
called with empty arguments
|
||||
|
||||
|
||||
0.1.1 / 2012-05-23
|
||||
------------------
|
||||
|
||||
- Fixed line wrapping in help formatter
|
||||
- Added better error reporting on invalid arguments
|
||||
|
||||
|
||||
0.1.0 / 2012-05-16
|
||||
------------------
|
||||
|
||||
- First release.
|
21
Companies/Companies/node_modules/argparse/LICENSE
generated
vendored
21
Companies/Companies/node_modules/argparse/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (C) 2012 by Vitaly Puzrin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
257
Companies/Companies/node_modules/argparse/README.md
generated
vendored
257
Companies/Companies/node_modules/argparse/README.md
generated
vendored
@ -1,257 +0,0 @@
|
||||
argparse
|
||||
========
|
||||
|
||||
[](http://travis-ci.org/nodeca/argparse)
|
||||
[](https://www.npmjs.org/package/argparse)
|
||||
|
||||
CLI arguments parser for node.js. Javascript port of python's
|
||||
[argparse](http://docs.python.org/dev/library/argparse.html) module
|
||||
(original version 3.2). That's a full port, except some very rare options,
|
||||
recorded in issue tracker.
|
||||
|
||||
**NB. Difference with original.**
|
||||
|
||||
- Method names changed to camelCase. See [generated docs](http://nodeca.github.com/argparse/).
|
||||
- Use `defaultValue` instead of `default`.
|
||||
- Use `argparse.Const.REMAINDER` instead of `argparse.REMAINDER`, and
|
||||
similarly for constant values `OPTIONAL`, `ZERO_OR_MORE`, and `ONE_OR_MORE`
|
||||
(aliases for `nargs` values `'?'`, `'*'`, `'+'`, respectively), and
|
||||
`SUPPRESS`.
|
||||
|
||||
|
||||
Example
|
||||
=======
|
||||
|
||||
test.js file:
|
||||
|
||||
```javascript
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||
var parser = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp:true,
|
||||
description: 'Argparse example'
|
||||
});
|
||||
parser.addArgument(
|
||||
[ '-f', '--foo' ],
|
||||
{
|
||||
help: 'foo bar'
|
||||
}
|
||||
);
|
||||
parser.addArgument(
|
||||
[ '-b', '--bar' ],
|
||||
{
|
||||
help: 'bar foo'
|
||||
}
|
||||
);
|
||||
parser.addArgument(
|
||||
'--baz',
|
||||
{
|
||||
help: 'baz bar'
|
||||
}
|
||||
);
|
||||
var args = parser.parseArgs();
|
||||
console.dir(args);
|
||||
```
|
||||
|
||||
Display help:
|
||||
|
||||
```
|
||||
$ ./test.js -h
|
||||
usage: example.js [-h] [-v] [-f FOO] [-b BAR] [--baz BAZ]
|
||||
|
||||
Argparse example
|
||||
|
||||
Optional arguments:
|
||||
-h, --help Show this help message and exit.
|
||||
-v, --version Show program's version number and exit.
|
||||
-f FOO, --foo FOO foo bar
|
||||
-b BAR, --bar BAR bar foo
|
||||
--baz BAZ baz bar
|
||||
```
|
||||
|
||||
Parse arguments:
|
||||
|
||||
```
|
||||
$ ./test.js -f=3 --bar=4 --baz 5
|
||||
{ foo: '3', bar: '4', baz: '5' }
|
||||
```
|
||||
|
||||
More [examples](https://github.com/nodeca/argparse/tree/master/examples).
|
||||
|
||||
|
||||
ArgumentParser objects
|
||||
======================
|
||||
|
||||
```
|
||||
new ArgumentParser({parameters hash});
|
||||
```
|
||||
|
||||
Creates a new ArgumentParser object.
|
||||
|
||||
**Supported params:**
|
||||
|
||||
- ```description``` - Text to display before the argument help.
|
||||
- ```epilog``` - Text to display after the argument help.
|
||||
- ```addHelp``` - Add a -h/–help option to the parser. (default: true)
|
||||
- ```argumentDefault``` - Set the global default value for arguments. (default: null)
|
||||
- ```parents``` - A list of ArgumentParser objects whose arguments should also be included.
|
||||
- ```prefixChars``` - The set of characters that prefix optional arguments. (default: ‘-‘)
|
||||
- ```formatterClass``` - A class for customizing the help output.
|
||||
- ```prog``` - The name of the program (default: `path.basename(process.argv[1])`)
|
||||
- ```usage``` - The string describing the program usage (default: generated)
|
||||
- ```conflictHandler``` - Usually unnecessary, defines strategy for resolving conflicting optionals.
|
||||
|
||||
**Not supported yet**
|
||||
|
||||
- ```fromfilePrefixChars``` - The set of characters that prefix files from which additional arguments should be read.
|
||||
|
||||
|
||||
Details in [original ArgumentParser guide](http://docs.python.org/dev/library/argparse.html#argumentparser-objects)
|
||||
|
||||
|
||||
addArgument() method
|
||||
====================
|
||||
|
||||
```
|
||||
ArgumentParser.addArgument(name or flag or [name] or [flags...], {options})
|
||||
```
|
||||
|
||||
Defines how a single command-line argument should be parsed.
|
||||
|
||||
- ```name or flag or [name] or [flags...]``` - Either a positional name
|
||||
(e.g., `'foo'`), a single option (e.g., `'-f'` or `'--foo'`), an array
|
||||
of a single positional name (e.g., `['foo']`), or an array of options
|
||||
(e.g., `['-f', '--foo']`).
|
||||
|
||||
Options:
|
||||
|
||||
- ```action``` - The basic type of action to be taken when this argument is encountered at the command line.
|
||||
- ```nargs```- The number of command-line arguments that should be consumed.
|
||||
- ```constant``` - A constant value required by some action and nargs selections.
|
||||
- ```defaultValue``` - The value produced if the argument is absent from the command line.
|
||||
- ```type``` - The type to which the command-line argument should be converted.
|
||||
- ```choices``` - A container of the allowable values for the argument.
|
||||
- ```required``` - Whether or not the command-line option may be omitted (optionals only).
|
||||
- ```help``` - A brief description of what the argument does.
|
||||
- ```metavar``` - A name for the argument in usage messages.
|
||||
- ```dest``` - The name of the attribute to be added to the object returned by parseArgs().
|
||||
|
||||
Details in [original add_argument guide](http://docs.python.org/dev/library/argparse.html#the-add-argument-method)
|
||||
|
||||
|
||||
Action (some details)
|
||||
================
|
||||
|
||||
ArgumentParser objects associate command-line arguments with actions.
|
||||
These actions can do just about anything with the command-line arguments associated
|
||||
with them, though most actions simply add an attribute to the object returned by
|
||||
parseArgs(). The action keyword argument specifies how the command-line arguments
|
||||
should be handled. The supported actions are:
|
||||
|
||||
- ```store``` - Just stores the argument’s value. This is the default action.
|
||||
- ```storeConst``` - Stores value, specified by the const keyword argument.
|
||||
(Note that the const keyword argument defaults to the rather unhelpful None.)
|
||||
The 'storeConst' action is most commonly used with optional arguments, that
|
||||
specify some sort of flag.
|
||||
- ```storeTrue``` and ```storeFalse``` - Stores values True and False
|
||||
respectively. These are special cases of 'storeConst'.
|
||||
- ```append``` - Stores a list, and appends each argument value to the list.
|
||||
This is useful to allow an option to be specified multiple times.
|
||||
- ```appendConst``` - Stores a list, and appends value, specified by the
|
||||
const keyword argument to the list. (Note, that the const keyword argument defaults
|
||||
is None.) The 'appendConst' action is typically used when multiple arguments need
|
||||
to store constants to the same list.
|
||||
- ```count``` - Counts the number of times a keyword argument occurs. For example,
|
||||
used for increasing verbosity levels.
|
||||
- ```help``` - Prints a complete help message for all the options in the current
|
||||
parser and then exits. By default a help action is automatically added to the parser.
|
||||
See ArgumentParser for details of how the output is created.
|
||||
- ```version``` - Prints version information and exit. Expects a `version=`
|
||||
keyword argument in the addArgument() call.
|
||||
|
||||
Details in [original action guide](http://docs.python.org/dev/library/argparse.html#action)
|
||||
|
||||
|
||||
Sub-commands
|
||||
============
|
||||
|
||||
ArgumentParser.addSubparsers()
|
||||
|
||||
Many programs split their functionality into a number of sub-commands, for
|
||||
example, the svn program can invoke sub-commands like `svn checkout`, `svn update`,
|
||||
and `svn commit`. Splitting up functionality this way can be a particularly good
|
||||
idea when a program performs several different functions which require different
|
||||
kinds of command-line arguments. `ArgumentParser` supports creation of such
|
||||
sub-commands with `addSubparsers()` method. The `addSubparsers()` method is
|
||||
normally called with no arguments and returns an special action object.
|
||||
This object has a single method `addParser()`, which takes a command name and
|
||||
any `ArgumentParser` constructor arguments, and returns an `ArgumentParser` object
|
||||
that can be modified as usual.
|
||||
|
||||
Example:
|
||||
|
||||
sub_commands.js
|
||||
```javascript
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||
var parser = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp:true,
|
||||
description: 'Argparse examples: sub-commands',
|
||||
});
|
||||
|
||||
var subparsers = parser.addSubparsers({
|
||||
title:'subcommands',
|
||||
dest:"subcommand_name"
|
||||
});
|
||||
|
||||
var bar = subparsers.addParser('c1', {addHelp:true});
|
||||
bar.addArgument(
|
||||
[ '-f', '--foo' ],
|
||||
{
|
||||
action: 'store',
|
||||
help: 'foo3 bar3'
|
||||
}
|
||||
);
|
||||
var bar = subparsers.addParser(
|
||||
'c2',
|
||||
{aliases:['co'], addHelp:true}
|
||||
);
|
||||
bar.addArgument(
|
||||
[ '-b', '--bar' ],
|
||||
{
|
||||
action: 'store',
|
||||
type: 'int',
|
||||
help: 'foo3 bar3'
|
||||
}
|
||||
);
|
||||
|
||||
var args = parser.parseArgs();
|
||||
console.dir(args);
|
||||
|
||||
```
|
||||
|
||||
Details in [original sub-commands guide](http://docs.python.org/dev/library/argparse.html#sub-commands)
|
||||
|
||||
|
||||
Contributors
|
||||
============
|
||||
|
||||
- [Eugene Shkuropat](https://github.com/shkuropat)
|
||||
- [Paul Jacobson](https://github.com/hpaulj)
|
||||
|
||||
[others](https://github.com/nodeca/argparse/graphs/contributors)
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
Copyright (c) 2012 [Vitaly Puzrin](https://github.com/puzrin).
|
||||
Released under the MIT license. See
|
||||
[LICENSE](https://github.com/nodeca/argparse/blob/master/LICENSE) for details.
|
||||
|
||||
|
3
Companies/Companies/node_modules/argparse/index.js
generated
vendored
3
Companies/Companies/node_modules/argparse/index.js
generated
vendored
@ -1,3 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./lib/argparse');
|
146
Companies/Companies/node_modules/argparse/lib/action.js
generated
vendored
146
Companies/Companies/node_modules/argparse/lib/action.js
generated
vendored
@ -1,146 +0,0 @@
|
||||
/**
|
||||
* class Action
|
||||
*
|
||||
* Base class for all actions
|
||||
* Do not call in your code, use this class only for inherits your own action
|
||||
*
|
||||
* Information about how to convert command line strings to Javascript objects.
|
||||
* Action objects are used by an ArgumentParser to represent the information
|
||||
* needed to parse a single argument from one or more strings from the command
|
||||
* line. The keyword arguments to the Action constructor are also all attributes
|
||||
* of Action instances.
|
||||
*
|
||||
* ##### Allowed keywords:
|
||||
*
|
||||
* - `store`
|
||||
* - `storeConstant`
|
||||
* - `storeTrue`
|
||||
* - `storeFalse`
|
||||
* - `append`
|
||||
* - `appendConstant`
|
||||
* - `count`
|
||||
* - `help`
|
||||
* - `version`
|
||||
*
|
||||
* Information about action options see [[Action.new]]
|
||||
*
|
||||
* See also [original guide](http://docs.python.org/dev/library/argparse.html#action)
|
||||
*
|
||||
**/
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
// Constants
|
||||
var c = require('./const');
|
||||
|
||||
|
||||
/**
|
||||
* new Action(options)
|
||||
*
|
||||
* Base class for all actions. Used only for inherits
|
||||
*
|
||||
*
|
||||
* ##### Options:
|
||||
*
|
||||
* - `optionStrings` A list of command-line option strings for the action.
|
||||
* - `dest` Attribute to hold the created object(s)
|
||||
* - `nargs` The number of command-line arguments that should be consumed.
|
||||
* By default, one argument will be consumed and a single value will be
|
||||
* produced.
|
||||
* - `constant` Default value for an action with no value.
|
||||
* - `defaultValue` The value to be produced if the option is not specified.
|
||||
* - `type` Cast to 'string'|'int'|'float'|'complex'|function (string). If
|
||||
* None, 'string'.
|
||||
* - `choices` The choices available.
|
||||
* - `required` True if the action must always be specified at the command
|
||||
* line.
|
||||
* - `help` The help describing the argument.
|
||||
* - `metavar` The name to be used for the option's argument with the help
|
||||
* string. If None, the 'dest' value will be used as the name.
|
||||
*
|
||||
* ##### nargs supported values:
|
||||
*
|
||||
* - `N` (an integer) consumes N arguments (and produces a list)
|
||||
* - `?` consumes zero or one arguments
|
||||
* - `*` consumes zero or more arguments (and produces a list)
|
||||
* - `+` consumes one or more arguments (and produces a list)
|
||||
*
|
||||
* Note: that the difference between the default and nargs=1 is that with the
|
||||
* default, a single value will be produced, while with nargs=1, a list
|
||||
* containing a single value will be produced.
|
||||
**/
|
||||
var Action = module.exports = function Action(options) {
|
||||
options = options || {};
|
||||
this.optionStrings = options.optionStrings || [];
|
||||
this.dest = options.dest;
|
||||
this.nargs = typeof options.nargs !== 'undefined' ? options.nargs : null;
|
||||
this.constant = typeof options.constant !== 'undefined' ? options.constant : null;
|
||||
this.defaultValue = options.defaultValue;
|
||||
this.type = typeof options.type !== 'undefined' ? options.type : null;
|
||||
this.choices = typeof options.choices !== 'undefined' ? options.choices : null;
|
||||
this.required = typeof options.required !== 'undefined' ? options.required : false;
|
||||
this.help = typeof options.help !== 'undefined' ? options.help : null;
|
||||
this.metavar = typeof options.metavar !== 'undefined' ? options.metavar : null;
|
||||
|
||||
if (!(this.optionStrings instanceof Array)) {
|
||||
throw new Error('optionStrings should be an array');
|
||||
}
|
||||
if (typeof this.required !== 'undefined' && typeof this.required !== 'boolean') {
|
||||
throw new Error('required should be a boolean');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Action#getName -> String
|
||||
*
|
||||
* Tells action name
|
||||
**/
|
||||
Action.prototype.getName = function () {
|
||||
if (this.optionStrings.length > 0) {
|
||||
return this.optionStrings.join('/');
|
||||
} else if (this.metavar !== null && this.metavar !== c.SUPPRESS) {
|
||||
return this.metavar;
|
||||
} else if (typeof this.dest !== 'undefined' && this.dest !== c.SUPPRESS) {
|
||||
return this.dest;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Action#isOptional -> Boolean
|
||||
*
|
||||
* Return true if optional
|
||||
**/
|
||||
Action.prototype.isOptional = function () {
|
||||
return !this.isPositional();
|
||||
};
|
||||
|
||||
/**
|
||||
* Action#isPositional -> Boolean
|
||||
*
|
||||
* Return true if positional
|
||||
**/
|
||||
Action.prototype.isPositional = function () {
|
||||
return (this.optionStrings.length === 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Action#call(parser, namespace, values, optionString) -> Void
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Call the action. Should be implemented in inherited classes
|
||||
*
|
||||
* ##### Example
|
||||
*
|
||||
* ActionCount.prototype.call = function (parser, namespace, values, optionString) {
|
||||
* namespace.set(this.dest, (namespace[this.dest] || 0) + 1);
|
||||
* };
|
||||
*
|
||||
**/
|
||||
Action.prototype.call = function () {
|
||||
throw new Error('.call() not defined');// Not Implemented error
|
||||
};
|
53
Companies/Companies/node_modules/argparse/lib/action/append.js
generated
vendored
53
Companies/Companies/node_modules/argparse/lib/action/append.js
generated
vendored
@ -1,53 +0,0 @@
|
||||
/*:nodoc:*
|
||||
* class ActionAppend
|
||||
*
|
||||
* This action stores a list, and appends each argument value to the list.
|
||||
* This is useful to allow an option to be specified multiple times.
|
||||
* This class inherided from [[Action]]
|
||||
*
|
||||
**/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var Action = require('../action');
|
||||
|
||||
// Constants
|
||||
var c = require('../const');
|
||||
|
||||
/*:nodoc:*
|
||||
* new ActionAppend(options)
|
||||
* - options (object): options hash see [[Action.new]]
|
||||
*
|
||||
* Note: options.nargs should be optional for constants
|
||||
* and more then zero for other
|
||||
**/
|
||||
var ActionAppend = module.exports = function ActionAppend(options) {
|
||||
options = options || {};
|
||||
if (this.nargs <= 0) {
|
||||
throw new Error('nargs for append actions must be > 0; if arg ' +
|
||||
'strings are not supplying the value to append, ' +
|
||||
'the append const action may be more appropriate');
|
||||
}
|
||||
if (!!this.constant && this.nargs !== c.OPTIONAL) {
|
||||
throw new Error('nargs must be OPTIONAL to supply const');
|
||||
}
|
||||
Action.call(this, options);
|
||||
};
|
||||
util.inherits(ActionAppend, Action);
|
||||
|
||||
/*:nodoc:*
|
||||
* ActionAppend#call(parser, namespace, values, optionString) -> Void
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Call the action. Save result in namespace object
|
||||
**/
|
||||
ActionAppend.prototype.call = function (parser, namespace, values) {
|
||||
var items = (namespace[this.dest] || []).slice();
|
||||
items.push(values);
|
||||
namespace.set(this.dest, items);
|
||||
};
|
47
Companies/Companies/node_modules/argparse/lib/action/append/constant.js
generated
vendored
47
Companies/Companies/node_modules/argparse/lib/action/append/constant.js
generated
vendored
@ -1,47 +0,0 @@
|
||||
/*:nodoc:*
|
||||
* class ActionAppendConstant
|
||||
*
|
||||
* This stores a list, and appends the value specified by
|
||||
* the const keyword argument to the list.
|
||||
* (Note that the const keyword argument defaults to null.)
|
||||
* The 'appendConst' action is typically useful when multiple
|
||||
* arguments need to store constants to the same list.
|
||||
*
|
||||
* This class inherited from [[Action]]
|
||||
**/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var Action = require('../../action');
|
||||
|
||||
/*:nodoc:*
|
||||
* new ActionAppendConstant(options)
|
||||
* - options (object): options hash see [[Action.new]]
|
||||
*
|
||||
**/
|
||||
var ActionAppendConstant = module.exports = function ActionAppendConstant(options) {
|
||||
options = options || {};
|
||||
options.nargs = 0;
|
||||
if (typeof options.constant === 'undefined') {
|
||||
throw new Error('constant option is required for appendAction');
|
||||
}
|
||||
Action.call(this, options);
|
||||
};
|
||||
util.inherits(ActionAppendConstant, Action);
|
||||
|
||||
/*:nodoc:*
|
||||
* ActionAppendConstant#call(parser, namespace, values, optionString) -> Void
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Call the action. Save result in namespace object
|
||||
**/
|
||||
ActionAppendConstant.prototype.call = function (parser, namespace) {
|
||||
var items = [].concat(namespace[this.dest] || []);
|
||||
items.push(this.constant);
|
||||
namespace.set(this.dest, items);
|
||||
};
|
40
Companies/Companies/node_modules/argparse/lib/action/count.js
generated
vendored
40
Companies/Companies/node_modules/argparse/lib/action/count.js
generated
vendored
@ -1,40 +0,0 @@
|
||||
/*:nodoc:*
|
||||
* class ActionCount
|
||||
*
|
||||
* This counts the number of times a keyword argument occurs.
|
||||
* For example, this is useful for increasing verbosity levels
|
||||
*
|
||||
* This class inherided from [[Action]]
|
||||
*
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var Action = require('../action');
|
||||
|
||||
/*:nodoc:*
|
||||
* new ActionCount(options)
|
||||
* - options (object): options hash see [[Action.new]]
|
||||
*
|
||||
**/
|
||||
var ActionCount = module.exports = function ActionCount(options) {
|
||||
options = options || {};
|
||||
options.nargs = 0;
|
||||
|
||||
Action.call(this, options);
|
||||
};
|
||||
util.inherits(ActionCount, Action);
|
||||
|
||||
/*:nodoc:*
|
||||
* ActionCount#call(parser, namespace, values, optionString) -> Void
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Call the action. Save result in namespace object
|
||||
**/
|
||||
ActionCount.prototype.call = function (parser, namespace) {
|
||||
namespace.set(this.dest, (namespace[this.dest] || 0) + 1);
|
||||
};
|
47
Companies/Companies/node_modules/argparse/lib/action/help.js
generated
vendored
47
Companies/Companies/node_modules/argparse/lib/action/help.js
generated
vendored
@ -1,47 +0,0 @@
|
||||
/*:nodoc:*
|
||||
* class ActionHelp
|
||||
*
|
||||
* Support action for printing help
|
||||
* This class inherided from [[Action]]
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var Action = require('../action');
|
||||
|
||||
// Constants
|
||||
var c = require('../const');
|
||||
|
||||
/*:nodoc:*
|
||||
* new ActionHelp(options)
|
||||
* - options (object): options hash see [[Action.new]]
|
||||
*
|
||||
**/
|
||||
var ActionHelp = module.exports = function ActionHelp(options) {
|
||||
options = options || {};
|
||||
if (options.defaultValue !== null) {
|
||||
options.defaultValue = options.defaultValue;
|
||||
} else {
|
||||
options.defaultValue = c.SUPPRESS;
|
||||
}
|
||||
options.dest = (options.dest !== null ? options.dest : c.SUPPRESS);
|
||||
options.nargs = 0;
|
||||
Action.call(this, options);
|
||||
|
||||
};
|
||||
util.inherits(ActionHelp, Action);
|
||||
|
||||
/*:nodoc:*
|
||||
* ActionHelp#call(parser, namespace, values, optionString)
|
||||
* - parser (ArgumentParser): current parser
|
||||
* - namespace (Namespace): namespace for output data
|
||||
* - values (Array): parsed values
|
||||
* - optionString (Array): input option string(not parsed)
|
||||
*
|
||||
* Print help and exit
|
||||
**/
|
||||
ActionHelp.prototype.call = function (parser) {
|
||||
parser.printHelp();
|
||||
parser.exit();
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user