OpenContactPopup(DefaultContact))">
Stilling
Navn
@@ -267,7 +244,7 @@
{
@foreach (var contact in Contacts)
{
-
+
OpenContactPopup(contact))">
@contact.JobTitle
@contact.FirstName @contact.LastName
@@ -318,7 +295,7 @@
- @if (AppInfo.Value.Rc)
+ @if (AppInfo!.Value!.Rc)
{
Kemi Dokumentation
}
@@ -333,5 +310,6 @@
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs
index 6a9e48b7..3a0f864f 100644
--- a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs
+++ b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs
@@ -72,13 +72,13 @@ public partial class AdvisorCustomerViewEditPage : IDisposable
private bool ErpEditDisabled { get; set; } = true;
private bool VatEditDisabled { get; set; } = true;
private List
Contacts { get; set; } = new();
- private VatLookupDkModal VatLookupPopup { get; set; } = new();
- private ContactDto SelectedContact { get; set; } = new();
- private ContactDto DefaultContact { get; set; } = new();
- private ContactModal ContactPopup { get; set; } = new();
private UserManagerEditView UserInfo { get; set; } = new();
private string ToggleButtonText { get; set; } = "";
private bool Kanvas { get; set; }
+ private ContactDto SelectedContact { get; set; } = new();
+ private ContactDto DefaultContact { get; set; } = new();
+ private ContactViewEditModal ContactViewPopup { get; set; } = new();
+ private VatLookupDkModal VatLookupPopup { get; set; } = new();
protected override async Task OnInitializedAsync()
{
@@ -88,6 +88,7 @@ public partial class AdvisorCustomerViewEditPage : IDisposable
// initialize default contact
DefaultContact = new ContactDto { CompanyId = CompanyId, ContactId = "", FirstName = "" };
+
// setup form context
ErpContext = new EditContext(Company);
@@ -171,16 +172,19 @@ public partial class AdvisorCustomerViewEditPage : IDisposable
Working = false;
}
+
private void ToggleErpEdit()
{
ErpEditDisabled = !ErpEditDisabled;
}
+
private void ToggleVatEdit()
{
VatEditDisabled = !VatEditDisabled;
}
+
private async Task ToggleVisibility()
{
Company.IsHidden = Company.IsHidden == 0 ? 1 : 0;
@@ -190,6 +194,7 @@ public partial class AdvisorCustomerViewEditPage : IDisposable
await CustomerRepo.UpdateCrmData(CompanyId, Company);
}
+
private async Task RequestErpUpdate()
{
if (Working)
@@ -199,10 +204,7 @@ public partial class AdvisorCustomerViewEditPage : IDisposable
Working = false;
}
- ///
- /// Fetch contacts from backend
- ///
- ///
+
private async Task FetchContacts(string companyId)
{
// load contacts
@@ -211,18 +213,13 @@ public partial class AdvisorCustomerViewEditPage : IDisposable
Contacts = Contacts.OrderBy(x => x.FirstName).ToList();
}
- ///
- /// Show Vat Lookup modal
- ///
+
private void OpenVatLookupModal()
{
VatLookupPopup.Show();
}
- ///
- /// Callback to update company properties
- ///
- ///
+
private void SelectedCompanyCallback(VirkRegInfo regInfo)
{
Logger.LogDebug("CrmCompanyView => SelectCompanyCallback => {}", JsonSerializer.Serialize(regInfo));
@@ -244,24 +241,22 @@ public partial class AdvisorCustomerViewEditPage : IDisposable
Company.VatNumber = regInfo.VatNumber;
}
- ///
- /// Open contact edit popup
- ///
- ///
+
private void OpenContactPopup(ContactDto contact)
{
// write contact to debug log
- Logger.LogDebug("CompanyView => SaveContactCallback <= {}", JsonSerializer.Serialize(contact));
+ Logger.LogDebug("CompanyView => OpenContactPopup => contact => {}", JsonSerializer.Serialize(contact));
+
// object to pass on to the popup
SelectedContact = contact;
+
+ Logger.LogDebug("CompanyView => OpenContactPopup => SelectedContact => {}", JsonSerializer.Serialize(SelectedContact));
+
// show the popup
- ContactPopup.Show();
+ ContactViewPopup.Show();
}
- ///
- /// Callback for writing contact to backend
- ///
- ///
+
private async Task WriteContactCallback(ContactDto contact)
{
Working = true;
diff --git a/Wonky.Client/Pages/CrmCustomerWorkplaceViewEditPage.razor b/Wonky.Client/Pages/CrmCustomerWorkplaceViewEditPage.razor
index d1e77113..eedebe08 100644
--- a/Wonky.Client/Pages/CrmCustomerWorkplaceViewEditPage.razor
+++ b/Wonky.Client/Pages/CrmCustomerWorkplaceViewEditPage.razor
@@ -122,7 +122,7 @@
-
+
-
@@ -177,4 +177,5 @@
}
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/Wonky.Client/Pages/CrmCustomerWorkplaceViewEditPage.razor.cs b/Wonky.Client/Pages/CrmCustomerWorkplaceViewEditPage.razor.cs
index f9ab8fc5..293f6978 100644
--- a/Wonky.Client/Pages/CrmCustomerWorkplaceViewEditPage.razor.cs
+++ b/Wonky.Client/Pages/CrmCustomerWorkplaceViewEditPage.razor.cs
@@ -55,15 +55,16 @@ public partial class CrmCustomerWorkplaceViewEditPage : IDisposable
private WorkplaceInventory WorkplaceInventory { get; set; } = new();
private List
DocViews { get; set; } = new();
private ConfirmDeleteModal ConfirmDeleteWorkplace { get; set; }
- private ConfirmDeleteModal ConfirmDeleteProduct { get; set; }
+ private ConfirmDeleteModal ConfirmDeleteVariant { get; set; }
private string DeleteMessage { get; set; } = "";
private string LinkRecipients { get; set; } = "";
private const string CopyText = "Kopier";
private const string CopyStyle = "btn btn-primary";
- private const string SuccessText = "Kopieret";
- private const string SuccessStyle = "btn btn-success";
- private string _buttonText = CopyText;
- private string _buttonStyle = CopyStyle;
+ private const string CopySuccessText = "Kopieret";
+ private const string CopySuccessStyle = "btn btn-success";
+ private string _copyButtonText = CopyText;
+ private string _copyButtonStyle = CopyStyle;
+ private DocView SelectedProduct { get; set; } = new();
protected override async Task OnInitializedAsync()
@@ -136,23 +137,26 @@ public partial class CrmCustomerWorkplaceViewEditPage : IDisposable
{
await Clipboard.CopyToClipboard(Workplace.ShortUrl);
- _buttonText = SuccessText;
- _buttonStyle = SuccessStyle;
+ _copyButtonText = CopySuccessText;
+ _copyButtonStyle = CopySuccessStyle;
StateHasChanged();
await Task.Delay(TimeSpan.FromSeconds(2));
- _buttonText = CopyText;
- _buttonStyle = CopyStyle;
+ _copyButtonText = CopyText;
+ _copyButtonStyle = CopyStyle;
}
private async Task OnSubmitUpdate()
{
Working = true;
+
await Workplaces.UpdateWorkplace(CompanyId, Workplace);
+
Working = false;
+
Toaster.ShowSuccess("Arbejdssted er opdateret");
}
@@ -160,43 +164,68 @@ public partial class CrmCustomerWorkplaceViewEditPage : IDisposable
private void OnConfirmDeleteWorkplace()
{
DeleteMessage = $"Bekræft at du sletter
{Workplace.Name} fra {Workplace.CompanyName}?
AL INFORMATION slettes og handlingen er uigenkaldelig.";
+
Logger.LogDebug("ConfirmDeleteWorkplace");
+
ConfirmDeleteWorkplace.Show();
}
-
+
private async Task RemoveWorkplace()
{
Logger.LogDebug("DeleteWorkplace");
+
Working = true;
+
await Workplaces.DeleteWorkplace(CompanyId, WorkplaceId);
+
Toaster.ShowInfo("Arbejdssted er slettet.");
+
Navigator.NavigateTo($"/advisor/customers/{CompanyId}/workplaces");
}
- private async Task OnRemoveVariant(string productId, string variantId)
+ private void OnConfirmDeleteVariant(DocView selectedProduct)
{
- // delete the apb and apv
- var product = WorkplaceInventory
- .Products.First(x => x.ProductId == productId);
- var variant = product.Variants.First(x => x.VariantId == variantId);
- Logger.LogDebug("variant => {}", JsonSerializer.Serialize(variant, new JsonSerializerOptions(JsonSerializerDefaults.Web)));
+ SelectedProduct = selectedProduct;
- foreach (var doc in variant.Docs)
+ DeleteMessage = $"Bekræft at du sletter
{selectedProduct.VariantName} fra {Workplace.CompanyName}?
AL INFORMATION slettes og handlingen er uigenkaldelig.";
+
+ Logger.LogDebug("ConfirmDeleteProduct");
+
+ ConfirmDeleteVariant.Show();
+ }
+
+
+ private async Task RemoveVariant()
+ {
+ if (Working)
{
- await WorkplaceRepo.DeleteWorkplaceDocuments(CompanyId, WorkplaceId, doc.DocumentId);
+ return;
}
+ Working = true;
+
+ var product = WorkplaceInventory
+ .Products
+ .First(x => x.ProductId == SelectedProduct.ProductId);
+
+ await WorkplaceRepo
+ .DeleteWorkplaceDocuments(CompanyId, WorkplaceId, SelectedProduct.ApbDocId, SelectedProduct.ApvDocId);
WorkplaceInventory.Products.Remove(product);
+
DocViews = GenerateDocumentListView();
+
Toaster.ShowInfo("Produkt dokumenter er slettet.");
+
+ Working = false;
}
private List GenerateDocumentListView()
{
var docViews = new List();
+
var docProducts = WorkplaceInventory.Products.OrderBy(x => x.TradingName).ToList();
foreach (var product in docProducts)
diff --git a/Wonky.Client/Shared/ContactModal.razor b/Wonky.Client/Shared/ContactViewEditModal.razor
similarity index 66%
rename from Wonky.Client/Shared/ContactModal.razor
rename to Wonky.Client/Shared/ContactViewEditModal.razor
index 8d78e3e8..6c0a53aa 100644
--- a/Wonky.Client/Shared/ContactModal.razor
+++ b/Wonky.Client/Shared/ContactViewEditModal.razor
@@ -24,54 +24,50 @@
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
- @if (string.IsNullOrWhiteSpace(Contact.ContactId))
- {
- Slet
- }
- else
- {
- Slet
- }
+ Slet
+ Afbryd
Gem
diff --git a/Wonky.Client/Shared/ContactModal.razor.cs b/Wonky.Client/Shared/ContactViewEditModal.razor.cs
similarity index 62%
rename from Wonky.Client/Shared/ContactModal.razor.cs
rename to Wonky.Client/Shared/ContactViewEditModal.razor.cs
index 5a642327..599bdb69 100644
--- a/Wonky.Client/Shared/ContactModal.razor.cs
+++ b/Wonky.Client/Shared/ContactViewEditModal.razor.cs
@@ -27,51 +27,36 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Shared;
-public partial class ContactModal
+public partial class ContactViewEditModal
{
- [Parameter] public ContactDto ParamContact { get; set; } = new();
+ // ##############################################################
+ [Inject] public ILogger Logger { get; set; }
+
+ // ##############################################################
+ [Parameter] public ContactDto SelectedContact { get; set; }
[Parameter] public string CompanyName { get; set; } = "";
- [Parameter] public ICrmContactRepository ContactRepo { get; set; }
- [Parameter] public HttpInterceptorService Interceptor { get; set; }
[Parameter] public EventCallback OnSaveClicked { get; set; }
[Parameter] public EventCallback OnDeleteClicked { get; set; }
- private ContactDto Contact { get; set; } = new();
+
+ // ##############################################################
private string _modalDisplay = "";
private bool _showBackdrop;
- private bool DisableDelete { get; set; }
- private bool FormInvalid { get; set; }
-
- protected override void OnParametersSet()
- {
- Contact = new ContactDto
- {
- CompanyId = ParamContact.CompanyId,
- ContactId = ParamContact.ContactId,
- FirstName = ParamContact.FirstName,
- LastName = ParamContact.LastName,
- JobTitle = ParamContact.JobTitle,
- PhoneDirect = ParamContact.PhoneDirect
- };
- }
-
- protected override void OnInitialized()
- {
- if (string.IsNullOrWhiteSpace(Contact.ContactId))
- DisableDelete = true;
- }
-
+
+
private void DeleteContact()
{
- OnDeleteClicked.InvokeAsync(Contact.ContactId);
+ OnDeleteClicked.InvokeAsync(SelectedContact.ContactId);
Hide();
}
+
private void SubmitContact()
{
- OnSaveClicked.InvokeAsync(Contact);
+ OnSaveClicked.InvokeAsync(SelectedContact);
Hide();
}
+
public void Show()
{
_modalDisplay = "block;";
@@ -79,11 +64,12 @@ public partial class ContactModal
StateHasChanged();
}
+
private void Hide()
{
_modalDisplay = "none;";
_showBackdrop = false;
- Contact = new ContactDto();
+ SelectedContact = new ContactDto();
StateHasChanged();
}
}
\ No newline at end of file
diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json
index 3074a5d5..e2a0bb8f 100644
--- a/Wonky.Client/wwwroot/appsettings.json
+++ b/Wonky.Client/wwwroot/appsettings.json
@@ -1,7 +1,7 @@
{
"appInfo": {
"name": "Wonky Online",
- "version": "146.2",
+ "version": "146.5",
"rc": true,
"sandBox": true,
"image": "grumpy-coder.png"