diff --git a/src/ElectronicPharmacy/ElectronicPharmacy.csproj b/src/ElectronicPharmacy/ElectronicPharmacy.csproj
index 47d2d62..ba8999f 100644
--- a/src/ElectronicPharmacy/ElectronicPharmacy.csproj
+++ b/src/ElectronicPharmacy/ElectronicPharmacy.csproj
@@ -189,6 +189,12 @@
HF_Registration.cs
+
+ Form
+
+
+ HF_Settings.cs
+
Form
diff --git a/src/ElectronicPharmacy/Form1.UiShell.cs b/src/ElectronicPharmacy/Form1.UiShell.cs
index 5c6a08d..649dff5 100644
--- a/src/ElectronicPharmacy/Form1.UiShell.cs
+++ b/src/ElectronicPharmacy/Form1.UiShell.cs
@@ -27,6 +27,7 @@ namespace Электронная_Фармация
private Panel _documentHost;
private Panel _statusFooter;
private Label _lblCurrentUser;
+ private ModernButton _btnSettings;
private ContextMenuStrip _directoryMenu;
private ContextMenuStrip _documentTabMenu;
private ToolStripMenuItem _documentCloseTabMenuItem;
@@ -83,10 +84,20 @@ namespace Электронная_Фармация
{
Name = "lblCurrentUser",
Dock = DockStyle.Fill,
- TextAlign = ContentAlignment.MiddleRight,
+ TextAlign = ContentAlignment.MiddleLeft,
AutoEllipsis = true,
Tag = "muted"
};
+ _btnSettings = new ModernButton
+ {
+ Name = "btnSettings",
+ Dock = DockStyle.Right,
+ Width = 150,
+ Margin = new Padding(0),
+ Text = "Настройки"
+ };
+ _btnSettings.Click += (_, __) => OpenSettingsDialog();
+ _statusFooter.Controls.Add(_btnSettings);
_statusFooter.Controls.Add(_lblCurrentUser);
Controls.Add(_loadingOverlay);
diff --git a/src/ElectronicPharmacy/Form1.cs b/src/ElectronicPharmacy/Form1.cs
index 5128c97..c929301 100644
--- a/src/ElectronicPharmacy/Form1.cs
+++ b/src/ElectronicPharmacy/Form1.cs
@@ -589,6 +589,16 @@ namespace Электронная_Фармация
}
}
+ private void OpenSettingsDialog()
+ {
+ var settingsForm = new HF_Settings();
+ UiThemeHelper.ApplyToControlTree(settingsForm);
+ if (settingsForm.ShowDialog(this) == DialogResult.OK)
+ {
+ RefreshCurrentUserStatus();
+ }
+ }
+
private async void tsBtnSentData_Click(object sender, EventArgs e)
{
DialogResult drUpdateData = UiDialogs.ConfirmYesNoCancel("Будут отправлены все сохранённые заказы. Вы уверены?", "Отправка заказов", this);
diff --git a/src/ElectronicPharmacy/HelpForms/HF_Registration.Designer.cs b/src/ElectronicPharmacy/HelpForms/HF_Registration.Designer.cs
index 3447438..2480064 100644
--- a/src/ElectronicPharmacy/HelpForms/HF_Registration.Designer.cs
+++ b/src/ElectronicPharmacy/HelpForms/HF_Registration.Designer.cs
@@ -38,11 +38,6 @@
this.checkTokenGained = new System.Windows.Forms.CheckBox();
this.panel1 = new System.Windows.Forms.Panel();
this.label3 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.txtApiUrl = new Elfisa.UI.Controls.ModernTextBox();
- this.labelExportPath = new System.Windows.Forms.Label();
- this.txtInvoiceExportPath = new Elfisa.UI.Controls.ModernTextBox();
- this.btnBrowseExportPath = new Elfisa.UI.Controls.ModernButton();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
@@ -82,55 +77,9 @@
this.txtPassword.Size = new System.Drawing.Size(375, 34);
this.txtPassword.TabIndex = 3;
//
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Font = new System.Drawing.Font("Segoe UI", 12F);
- this.label5.Location = new System.Drawing.Point(23, 225);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(103, 28);
- this.label5.TabIndex = 11;
- this.label5.Text = "URL API";
- //
- // txtApiUrl
- //
- this.txtApiUrl.Font = new System.Drawing.Font("Segoe UI", 12F);
- this.txtApiUrl.Location = new System.Drawing.Point(132, 225);
- this.txtApiUrl.Name = "txtApiUrl";
- this.txtApiUrl.Size = new System.Drawing.Size(271, 34);
- this.txtApiUrl.TabIndex = 12;
- //
- // labelExportPath
- //
- this.labelExportPath.AutoSize = true;
- this.labelExportPath.Font = new System.Drawing.Font("Segoe UI", 12F);
- this.labelExportPath.Location = new System.Drawing.Point(23, 272);
- this.labelExportPath.Name = "labelExportPath";
- this.labelExportPath.Size = new System.Drawing.Size(280, 28);
- this.labelExportPath.TabIndex = 13;
- this.labelExportPath.Text = "Папка экспорта накладных";
- //
- // txtInvoiceExportPath
- //
- this.txtInvoiceExportPath.Font = new System.Drawing.Font("Segoe UI", 10F);
- this.txtInvoiceExportPath.Location = new System.Drawing.Point(28, 304);
- this.txtInvoiceExportPath.Name = "txtInvoiceExportPath";
- this.txtInvoiceExportPath.Size = new System.Drawing.Size(320, 30);
- this.txtInvoiceExportPath.TabIndex = 14;
- //
- // btnBrowseExportPath
- //
- this.btnBrowseExportPath.Font = new System.Drawing.Font("Segoe UI Semibold", 10F, System.Drawing.FontStyle.Bold);
- this.btnBrowseExportPath.Location = new System.Drawing.Point(354, 304);
- this.btnBrowseExportPath.Name = "btnBrowseExportPath";
- this.btnBrowseExportPath.Size = new System.Drawing.Size(49, 30);
- this.btnBrowseExportPath.TabIndex = 15;
- this.btnBrowseExportPath.Text = "...";
- this.btnBrowseExportPath.Click += new System.EventHandler(this.btnBrowseExportPath_Click);
- //
// btnConfirmRegistration
//
- this.btnConfirmRegistration.Location = new System.Drawing.Point(188, 356);
+ this.btnConfirmRegistration.Location = new System.Drawing.Point(188, 244);
this.btnConfirmRegistration.Name = "btnConfirmRegistration";
this.btnConfirmRegistration.Size = new System.Drawing.Size(215, 43);
this.btnConfirmRegistration.TabIndex = 5;
@@ -139,7 +88,7 @@
//
// btnCloseThis
//
- this.btnCloseThis.Location = new System.Drawing.Point(28, 356);
+ this.btnCloseThis.Location = new System.Drawing.Point(28, 244);
this.btnCloseThis.Name = "btnCloseThis";
this.btnCloseThis.Size = new System.Drawing.Size(125, 43);
this.btnCloseThis.TabIndex = 6;
@@ -151,7 +100,7 @@
this.checkTokenGained.AutoCheck = false;
this.checkTokenGained.AutoSize = true;
this.checkTokenGained.Font = new System.Drawing.Font("Segoe UI", 12F);
- this.checkTokenGained.Location = new System.Drawing.Point(28, 420);
+ this.checkTokenGained.Location = new System.Drawing.Point(28, 304);
this.checkTokenGained.Name = "checkTokenGained";
this.checkTokenGained.Size = new System.Drawing.Size(171, 32);
this.checkTokenGained.TabIndex = 7;
@@ -186,12 +135,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(436, 420);
- this.Controls.Add(this.btnBrowseExportPath);
- this.Controls.Add(this.txtInvoiceExportPath);
- this.Controls.Add(this.labelExportPath);
- this.Controls.Add(this.txtApiUrl);
- this.Controls.Add(this.label5);
+ this.ClientSize = new System.Drawing.Size(436, 300);
this.Controls.Add(this.panel1);
this.Controls.Add(this.checkTokenGained);
this.Controls.Add(this.btnCloseThis);
@@ -224,10 +168,5 @@
private System.Windows.Forms.CheckBox checkTokenGained;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Label label5;
- private Elfisa.UI.Controls.ModernTextBox txtApiUrl;
- private System.Windows.Forms.Label labelExportPath;
- private Elfisa.UI.Controls.ModernTextBox txtInvoiceExportPath;
- private Elfisa.UI.Controls.ModernButton btnBrowseExportPath;
}
}
diff --git a/src/ElectronicPharmacy/HelpForms/HF_Registration.cs b/src/ElectronicPharmacy/HelpForms/HF_Registration.cs
index 74cc942..cf06cb1 100644
--- a/src/ElectronicPharmacy/HelpForms/HF_Registration.cs
+++ b/src/ElectronicPharmacy/HelpForms/HF_Registration.cs
@@ -25,27 +25,6 @@ namespace Электронная_Фармация.HelpForms
Close();
}
- private void btnBrowseExportPath_Click(object sender, EventArgs e)
- {
- using (var dialog = new FolderBrowserDialog())
- {
- dialog.Description = "Выберите папку для экспорта накладных";
- dialog.ShowNewFolderButton = true;
- if (!string.IsNullOrWhiteSpace(txtInvoiceExportPath.Text)
- && System.IO.Directory.Exists(txtInvoiceExportPath.Text.Trim()))
- {
- dialog.SelectedPath = txtInvoiceExportPath.Text.Trim();
- }
-
- if (dialog.ShowDialog(this) == DialogResult.OK)
- {
- txtInvoiceExportPath.Text = dialog.SelectedPath;
- AppConfig.SetInvoiceExportPath(dialog.SelectedPath);
- ToastNotification.ShowSuccess("Папка экспорта накладных сохранена");
- }
- }
- }
-
private async void btnConfirmRegistration_Click(object sender, EventArgs e)
{
btnConfirmRegistration.Enabled = false;
@@ -56,12 +35,9 @@ namespace Электронная_Фармация.HelpForms
if (strLogin.Length > 0 && strPassword.Length > 0)
{
- // Адрес API берём из поля и сохраняем ДО входа: иначе логин уходит
- // на старый сохранённый/дефолтный адрес, а не на введённый пользователем.
- string apiUrl = txtApiUrl.Text.Trim();
- Settings.Default.ApiBaseUrl = apiUrl;
- AppConfig.SetInvoiceExportPath(txtInvoiceExportPath.Text);
- Settings.Default.Save();
+ string apiUrl = string.IsNullOrWhiteSpace(Settings.Default.ApiBaseUrl)
+ ? AppConfig.DefaultApiBaseUrl
+ : Settings.Default.ApiBaseUrl;
LoginRequest loginRequest = new LoginRequest();
loginRequest.Username = strLogin.Trim();
@@ -78,7 +54,6 @@ namespace Электронная_Фармация.HelpForms
Settings.Default.stringPassword = strPassword;
Settings.Default.stringToken = token;
Settings.Default.ApiBaseUrl = client.BaseUrl;
- AppConfig.SetInvoiceExportPath(txtInvoiceExportPath.Text);
Settings.Default.Save();
AppDebugLog.Info("Auth", $"Авторизация успешна. token={AppDebugLog.MaskToken(token)}");
@@ -124,11 +99,6 @@ namespace Электронная_Фармация.HelpForms
WindowChromeHelper.ApplyDialogChrome(this, panel1, label3);
txtLogin.Text = login;
txtPassword.Text = password;
- txtApiUrl.Text = string.IsNullOrWhiteSpace(Settings.Default.ApiBaseUrl)
- ? AppConfig.DefaultApiBaseUrl
- : Settings.Default.ApiBaseUrl;
- txtInvoiceExportPath.Text = AppConfig.InvoiceExportPath;
-
checkTokenGained.Checked = doWeHaveAToken.Length > 0;
}
}
diff --git a/src/ElectronicPharmacy/HelpForms/HF_Settings.Designer.cs b/src/ElectronicPharmacy/HelpForms/HF_Settings.Designer.cs
new file mode 100644
index 0000000..d61c6aa
--- /dev/null
+++ b/src/ElectronicPharmacy/HelpForms/HF_Settings.Designer.cs
@@ -0,0 +1,192 @@
+namespace Электронная_Фармация.HelpForms
+{
+ partial class HF_Settings
+ {
+ private System.ComponentModel.IContainer components = null;
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ private void InitializeComponent()
+ {
+ this.panelHeader = new System.Windows.Forms.Panel();
+ this.lblTitle = new System.Windows.Forms.Label();
+ this.lblHint = new System.Windows.Forms.Label();
+ this.lblLocationId = new System.Windows.Forms.Label();
+ this.txtLocationId = new Elfisa.UI.Controls.ModernTextBox();
+ this.lblApiUrl = new System.Windows.Forms.Label();
+ this.txtApiUrl = new Elfisa.UI.Controls.ModernTextBox();
+ this.lblInvoiceExportPath = new System.Windows.Forms.Label();
+ this.txtInvoiceExportPath = new Elfisa.UI.Controls.ModernTextBox();
+ this.btnBrowseExportPath = new Elfisa.UI.Controls.ModernButton();
+ this.btnCancel = new Elfisa.UI.Controls.ModernButton();
+ this.btnSave = new Elfisa.UI.Controls.ModernButton();
+ this.panelHeader.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // panelHeader
+ //
+ this.panelHeader.Controls.Add(this.lblTitle);
+ this.panelHeader.Dock = System.Windows.Forms.DockStyle.Top;
+ this.panelHeader.Location = new System.Drawing.Point(0, 0);
+ this.panelHeader.Name = "panelHeader";
+ this.panelHeader.Size = new System.Drawing.Size(560, 56);
+ this.panelHeader.TabIndex = 0;
+ //
+ // lblTitle
+ //
+ this.lblTitle.Font = new System.Drawing.Font("Segoe UI Semibold", 13.8F, System.Drawing.FontStyle.Bold);
+ this.lblTitle.ForeColor = System.Drawing.Color.White;
+ this.lblTitle.Location = new System.Drawing.Point(12, 10);
+ this.lblTitle.Name = "lblTitle";
+ this.lblTitle.Size = new System.Drawing.Size(520, 36);
+ this.lblTitle.TabIndex = 0;
+ this.lblTitle.Text = "Настройки";
+ this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // lblHint
+ //
+ this.lblHint.Font = new System.Drawing.Font("Segoe UI", 10F);
+ this.lblHint.Location = new System.Drawing.Point(24, 72);
+ this.lblHint.Name = "lblHint";
+ this.lblHint.Size = new System.Drawing.Size(512, 46);
+ this.lblHint.TabIndex = 1;
+ this.lblHint.Text = "Здесь можно задать торговую точку, адрес API и папку для экспорта накладных.";
+ //
+ // lblLocationId
+ //
+ this.lblLocationId.AutoSize = true;
+ this.lblLocationId.Font = new System.Drawing.Font("Segoe UI", 11F);
+ this.lblLocationId.Location = new System.Drawing.Point(24, 124);
+ this.lblLocationId.Name = "lblLocationId";
+ this.lblLocationId.Size = new System.Drawing.Size(100, 25);
+ this.lblLocationId.TabIndex = 2;
+ this.lblLocationId.Text = "Location ID";
+ //
+ // txtLocationId
+ //
+ this.txtLocationId.Font = new System.Drawing.Font("Segoe UI", 11F);
+ this.txtLocationId.Location = new System.Drawing.Point(28, 152);
+ this.txtLocationId.Name = "txtLocationId";
+ this.txtLocationId.Size = new System.Drawing.Size(508, 32);
+ this.txtLocationId.TabIndex = 3;
+ //
+ // lblApiUrl
+ //
+ this.lblApiUrl.AutoSize = true;
+ this.lblApiUrl.Font = new System.Drawing.Font("Segoe UI", 11F);
+ this.lblApiUrl.Location = new System.Drawing.Point(24, 196);
+ this.lblApiUrl.Name = "lblApiUrl";
+ this.lblApiUrl.Size = new System.Drawing.Size(127, 25);
+ this.lblApiUrl.TabIndex = 4;
+ this.lblApiUrl.Text = "Адрес сервера";
+ //
+ // txtApiUrl
+ //
+ this.txtApiUrl.Font = new System.Drawing.Font("Segoe UI", 11F);
+ this.txtApiUrl.Location = new System.Drawing.Point(28, 224);
+ this.txtApiUrl.Name = "txtApiUrl";
+ this.txtApiUrl.Size = new System.Drawing.Size(508, 32);
+ this.txtApiUrl.TabIndex = 5;
+ //
+ // lblInvoiceExportPath
+ //
+ this.lblInvoiceExportPath.AutoSize = true;
+ this.lblInvoiceExportPath.Font = new System.Drawing.Font("Segoe UI", 11F);
+ this.lblInvoiceExportPath.Location = new System.Drawing.Point(24, 268);
+ this.lblInvoiceExportPath.Name = "lblInvoiceExportPath";
+ this.lblInvoiceExportPath.Size = new System.Drawing.Size(228, 25);
+ this.lblInvoiceExportPath.TabIndex = 6;
+ this.lblInvoiceExportPath.Text = "Папка экспорта накладных";
+ //
+ // txtInvoiceExportPath
+ //
+ this.txtInvoiceExportPath.Font = new System.Drawing.Font("Segoe UI", 11F);
+ this.txtInvoiceExportPath.Location = new System.Drawing.Point(28, 296);
+ this.txtInvoiceExportPath.Name = "txtInvoiceExportPath";
+ this.txtInvoiceExportPath.Size = new System.Drawing.Size(448, 32);
+ this.txtInvoiceExportPath.TabIndex = 7;
+ //
+ // btnBrowseExportPath
+ //
+ this.btnBrowseExportPath.Font = new System.Drawing.Font("Segoe UI Semibold", 10F, System.Drawing.FontStyle.Bold);
+ this.btnBrowseExportPath.Location = new System.Drawing.Point(487, 296);
+ this.btnBrowseExportPath.Name = "btnBrowseExportPath";
+ this.btnBrowseExportPath.Size = new System.Drawing.Size(49, 32);
+ this.btnBrowseExportPath.TabIndex = 8;
+ this.btnBrowseExportPath.Text = "...";
+ this.btnBrowseExportPath.Click += new System.EventHandler(this.btnBrowseExportPath_Click);
+ //
+ // btnCancel
+ //
+ this.btnCancel.Location = new System.Drawing.Point(28, 356);
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size(140, 40);
+ this.btnCancel.TabIndex = 9;
+ this.btnCancel.Text = "Отмена";
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // btnSave
+ //
+ this.btnSave.Location = new System.Drawing.Point(364, 356);
+ this.btnSave.Name = "btnSave";
+ this.btnSave.Size = new System.Drawing.Size(172, 40);
+ this.btnSave.TabIndex = 10;
+ this.btnSave.Text = "Сохранить";
+ this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
+ //
+ // HF_Settings
+ //
+ this.AcceptButton = this.btnSave;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.btnCancel;
+ this.ClientSize = new System.Drawing.Size(560, 420);
+ this.Controls.Add(this.btnSave);
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.btnBrowseExportPath);
+ this.Controls.Add(this.txtInvoiceExportPath);
+ this.Controls.Add(this.lblInvoiceExportPath);
+ this.Controls.Add(this.txtApiUrl);
+ this.Controls.Add(this.lblApiUrl);
+ this.Controls.Add(this.txtLocationId);
+ this.Controls.Add(this.lblLocationId);
+ this.Controls.Add(this.lblHint);
+ this.Controls.Add(this.panelHeader);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "HF_Settings";
+ this.ShowIcon = false;
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Load += new System.EventHandler(this.HF_Settings_Load);
+ this.panelHeader.ResumeLayout(false);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Panel panelHeader;
+ private System.Windows.Forms.Label lblTitle;
+ private System.Windows.Forms.Label lblHint;
+ private System.Windows.Forms.Label lblLocationId;
+ private Elfisa.UI.Controls.ModernTextBox txtLocationId;
+ private System.Windows.Forms.Label lblApiUrl;
+ private Elfisa.UI.Controls.ModernTextBox txtApiUrl;
+ private System.Windows.Forms.Label lblInvoiceExportPath;
+ private Elfisa.UI.Controls.ModernTextBox txtInvoiceExportPath;
+ private Elfisa.UI.Controls.ModernButton btnBrowseExportPath;
+ private Elfisa.UI.Controls.ModernButton btnCancel;
+ private Elfisa.UI.Controls.ModernButton btnSave;
+ }
+}
diff --git a/src/ElectronicPharmacy/HelpForms/HF_Settings.cs b/src/ElectronicPharmacy/HelpForms/HF_Settings.cs
new file mode 100644
index 0000000..2448d09
--- /dev/null
+++ b/src/ElectronicPharmacy/HelpForms/HF_Settings.cs
@@ -0,0 +1,95 @@
+using System;
+using System.Windows.Forms;
+using Elfisa.UI.Helpers;
+using Elfisa.UI.Theming;
+using Электронная_Фармация.Classes;
+using Электронная_Фармация.Properties;
+
+namespace Электронная_Фармация.HelpForms
+{
+ public partial class HF_Settings : Form
+ {
+ public HF_Settings()
+ {
+ InitializeComponent();
+ Shown += (_, __) => WindowChromeHelper.ApplyTitleBarTheme(this, ThemeManager.Colors);
+ }
+
+ private void HF_Settings_Load(object sender, EventArgs e)
+ {
+ UiThemeHelper.ApplyToControlTree(this);
+ WindowChromeHelper.ApplyDialogChrome(this, panelHeader, lblTitle);
+
+ txtLocationId.Text = AppConfig.LocationId;
+ txtApiUrl.Text = string.IsNullOrWhiteSpace(Settings.Default.ApiBaseUrl)
+ ? AppConfig.DefaultApiBaseUrl
+ : Settings.Default.ApiBaseUrl;
+ txtInvoiceExportPath.Text = AppConfig.InvoiceExportPath;
+ }
+
+ private void btnBrowseExportPath_Click(object sender, EventArgs e)
+ {
+ using (var dialog = new FolderBrowserDialog())
+ {
+ dialog.Description = "Выберите папку для экспорта накладных";
+ dialog.ShowNewFolderButton = true;
+ if (!string.IsNullOrWhiteSpace(txtInvoiceExportPath.Text) &&
+ System.IO.Directory.Exists(txtInvoiceExportPath.Text.Trim()))
+ {
+ dialog.SelectedPath = txtInvoiceExportPath.Text.Trim();
+ }
+
+ if (dialog.ShowDialog(this) == DialogResult.OK)
+ {
+ txtInvoiceExportPath.Text = dialog.SelectedPath;
+ }
+ }
+ }
+
+ private void btnSave_Click(object sender, EventArgs e)
+ {
+ var locationId = (txtLocationId.Text ?? string.Empty).Trim();
+ var apiUrl = AppConfig.NormalizeApiBaseUrl(txtApiUrl.Text.Trim());
+ var invoiceExportPath = (txtInvoiceExportPath.Text ?? string.Empty).Trim();
+
+ if (string.IsNullOrWhiteSpace(locationId))
+ {
+ UiDialogs.ShowError("Укажите Location ID торговой точки.", "Настройки", this);
+ txtLocationId.Focus();
+ return;
+ }
+
+ if (string.IsNullOrWhiteSpace(apiUrl))
+ {
+ UiDialogs.ShowError("Укажите адрес API сервера.", "Настройки", this);
+ txtApiUrl.Focus();
+ return;
+ }
+
+ if (!string.IsNullOrWhiteSpace(invoiceExportPath) &&
+ !System.IO.Directory.Exists(invoiceExportPath))
+ {
+ UiDialogs.ShowError("Указанная папка для накладных не существует.", "Настройки", this);
+ txtInvoiceExportPath.Focus();
+ return;
+ }
+
+ AppConfig.SetLocationId(locationId);
+ Settings.Default.ApiBaseUrl = apiUrl;
+ AppConfig.SetInvoiceExportPath(invoiceExportPath);
+ Settings.Default.Save();
+
+ AppDebugLog.Info("Settings", $"Настройки сохранены. ApiBaseUrl={apiUrl}, LocationId={locationId}, InvoiceExportPath={invoiceExportPath}");
+ ToastNotification.ShowSuccess("Настройки сохранены");
+
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+
+ private void btnCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ }
+}