This commit is contained in:
Frede Hundewadt 2022-06-25 15:57:59 +02:00
parent cda4db4f51
commit d8344d4e7f
6 changed files with 30 additions and 18 deletions

View file

@ -25,9 +25,15 @@ else
} }
@code { @code {
[Parameter]public string CompanyId { get; set; } = "";
[Parameter] public int Enabled { get; set; } [Parameter] public int Enabled { get; set; }
[Parameter] public string ButtonType { get; set; } = "primary"; [Parameter] public string ButtonType { get; set; } = "primary";
[Parameter] public string ButtonText { get; set; } = "Tag Mig"; [Parameter] public string ButtonText { get; set; } = "Tag Mig";
[Parameter] public string ActionLink { get; set; } = "#"; [Parameter] public string ActionLink { get; set; } = "#";
protected override void OnParametersSet()
{
ActionLink = ActionLink.Replace("$ID$", CompanyId);
}
} }

View file

@ -17,7 +17,7 @@
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr class="bg-black bg-opacity-50 text-white">
<th scope="col">Farvekode</th> <th scope="col">Farvekode</th>
<th scope="col">Betydning</th> <th scope="col">Betydning</th>
</tr> </tr>

View file

@ -64,7 +64,11 @@
@company.City @company.City
</div> </div>
<div class="col"> <div class="col">
<ActivityButton CompanyId="@company.CompanyId" Enabled="@company.ValidVat"></ActivityButton> <ActivityButton CompanyId="@company.CompanyId"
ActionLink="/companies/$ID$/activity/new"
ButtonText="Besøg"
ButtonType="primary"
Enabled="@company.ValidVat"></ActivityButton>
</div> </div>
</div> </div>
</a> </a>

View file

@ -32,11 +32,13 @@ namespace Wonky.Client.Components
private Confirmation _confirmation = new (); private Confirmation _confirmation = new ();
private string _companyId = ""; private string _companyId = "";
private string _actionUrl = "";
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await base.OnInitializedAsync(); await base.OnInitializedAsync();
} }
private void CallConfirmationModal(string companyId) private void CallConfirmationModal(string companyId)
{ {
_companyId = companyId; _companyId = companyId;

View file

@ -357,7 +357,7 @@
<a class="btn btn-warning" href="/companies/@_company.CompanyId">Annuller</a> <a class="btn btn-warning" href="/companies/@_company.CompanyId">Annuller</a>
</div> </div>
<div class="col"> <div class="col">
<button type="button" class="btn btn-primary" @onclick="CreateActivity">Opret besøg</button> <button type="button" class="btn btn-primary" @onclick="CreateActivity" disabled="@_poFormInvalid">Opret besøg</button>
</div> </div>
</div> </div>
</div> </div>

View file

@ -64,10 +64,10 @@ public partial class ActivityVisitNew : IDisposable
private string Price = "0"; private string Price = "0";
private string Discount = "0"; private string Discount = "0";
private bool Sas; private bool Sas;
private bool InvalidActivityType { get; set; } = true; private bool InvalidActivityType = true;
private bool InvalidStatusType { get; set; } = true; private bool InvalidStatusType = true;
private bool InvalidActivity { get; set; } = true; private bool InvalidActivity = true;
private bool InvalidCanvas { get; set; } = true; private bool InvalidCanvas = true;
private bool _reportClosdd { get; set; } = false; private bool _reportClosdd { get; set; } = false;
private UserInfoView Ux { get; set; } = new(); private UserInfoView Ux { get; set; } = new();
private DateTime _workDate { get; set; } = DateTime.Now; private DateTime _workDate { get; set; } = DateTime.Now;
@ -275,16 +275,16 @@ public partial class ActivityVisitNew : IDisposable
private void HandleFieldChanged(object sender, FieldChangedEventArgs e) private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
{ {
// InvalidCanvas = InvalidActivityType; // InvalidCanvas = InvalidActivityType;
// InvalidActivity = InvalidActivityType InvalidActivity = InvalidActivityType
// || _poFormInvalid || _poFormInvalid
// || DraftStateProvider.Draft.Items.Count == 0 || DraftStateProvider.Draft.Items.Count == 0
// || (_poDraft.ActivityStatusEnum == "offer" && string.IsNullOrWhiteSpace(_poDraft.EMail)); || (_draft.ActivityStatusEnum == "offer" && string.IsNullOrWhiteSpace(_draft.EMail));
// if (InvalidCanvas || InvalidActivity) if (InvalidActivity)
// { {
// _poFormInvalid = true; _poFormInvalid = true;
// return; return;
// } }
_poFormInvalid = !_editContext.Validate(); _poFormInvalid = !_editContext.Validate();
StateHasChanged(); StateHasChanged();