built v.0.7

This commit is contained in:
Frede Hundewadt 2022-06-13 14:49:37 +02:00
parent f4ba3ef83b
commit f05548a075
13 changed files with 147 additions and 79 deletions

View file

@ -1,15 +1,13 @@
@if (Enabled == 1) @if (Enabled == 1)
{ {
<a type="button" class="btn btn-success" href="/company/@CompanyId/activity">Opret Besøg</a> <a type="button" class="btn btn-success" href="/company/@CompanyId/activity">Besøg</a>
} }
else else
{ {
<a type="button" class="btn btn-outline-secondary disabled" aria-disabled="true">Opret Besøg</a> <a type="button" class="btn btn-outline-secondary disabled" aria-disabled="true">Besøg</a>
} }
@code { @code {
[Parameter] public string CompanyId { get; set; } = ""; [Parameter] public string CompanyId { get; set; } = "";
[Parameter]public int Enabled { get; set; } [Parameter]public int Enabled { get; set; }
} }

View file

@ -53,6 +53,7 @@ public partial class Home : IDisposable
private async Task FetchActivities(string workDate) private async Task FetchActivities(string workDate)
{ {
_workDate = workDate;
Activities = new List<ReportActivityDto>(); Activities = new List<ReportActivityDto>();
Activities = await ActivityRepo.GetActivities(workDate); Activities = await ActivityRepo.GetActivities(workDate);
} }

View file

@ -15,5 +15,9 @@
// //
*@ *@
<input id="search-input" type="text" class="form-control" placeholder="Søg ..." <div class="input-group">
<input id="search-input" type="text" class="form-control" placeholder="Søg ..." aria-described-by="search-addon"
@bind-value="@SearchTerm" @bind-value:event="oninput" @onkeyup="OnSearchChanged"/> @bind-value="@SearchTerm" @bind-value:event="oninput" @onkeyup="OnSearchChanged"/>
<span class="input-group-text" id="search-addon"><i class="oi oi-delete" @onclick="ClearSearch"></i></span>
</div>

View file

@ -19,24 +19,34 @@ using Timer = System.Timers.Timer;
namespace Wonky.Client.Components namespace Wonky.Client.Components
{ {
public partial class SearchComponent public partial class SearchPhrase
{ {
private Timer _timer = new(); private Timer _timer = new();
private string? SearchTerm { get; set; } private string SearchTerm { get; set; } = "";
[Parameter] public EventCallback<string?> OnChanged { get; set; } [Parameter] public EventCallback<string> OnChanged { get; set; }
[Parameter] public string? SavedSearch { get; set; } [Parameter] public string SavedSearch { get; set; } = "";
protected override void OnParametersSet()
{
if (!string.IsNullOrWhiteSpace(SavedSearch))
SearchTerm = SavedSearch;
}
protected override void OnInitialized() protected override void OnInitialized()
{ {
if (string.IsNullOrWhiteSpace(SavedSearch)) return; if(!string.IsNullOrWhiteSpace(SavedSearch))
SearchTerm = SavedSearch; OnSearchChanged();
OnChanged.InvokeAsync(SearchTerm);
//SearchChanged();
} }
private void ClearSearch()
{
SavedSearch = "";
SearchTerm = "";
OnChanged.InvokeAsync(SearchTerm);
}
private void OnSearchChanged() private void OnSearchChanged()
{ {
_timer = new Timer(500); _timer = new Timer(750);
_timer.Elapsed += OnTimerElapsed; _timer.Elapsed += OnTimerElapsed;
_timer.AutoReset = false; _timer.AutoReset = false;
_timer.Enabled = true; _timer.Enabled = true;

View file

@ -26,8 +26,8 @@ public partial class WorkDateComponent : IDisposable
private async Task OnDateChanged(ChangeEventArgs e) private async Task OnDateChanged(ChangeEventArgs e)
{ {
var val = $"{DateOnly.Parse(e.Value?.ToString()!):yyyy-MM-dd}"; var val = $"{DateOnly.Parse(e.Value?.ToString()!):yyyy-MM-dd}";
await OnChanged.InvokeAsync(val);
await UserPrefs.SetWorkDate(DateTime.Parse(val)); await UserPrefs.SetWorkDate(DateTime.Parse(val));
await OnChanged.InvokeAsync(val);
} }
private void ProfileServiceOnOnChange(Preferences newPreferences) private void ProfileServiceOnOnChange(Preferences newPreferences)

View file

@ -23,27 +23,29 @@
<div class="container"> <div class="container">
<div class="row mb-3"> <div class="row mb-3">
<div class="col"> <div class="col-md-3">
<CompanySearchDropdown OnChanged="SetSearchCol"/> <CompanySearchDropdown OnChanged="SetSearchCol"/>
</div> </div>
<div class="col"> <div class="col-md-3">
<SearchPhrase OnChanged="SetSearchPhrase"/> <SearchPhrase SavedSearch="@_savedSearch" OnChanged="SetSearchPhrase"/>
</div> </div>
<div class="col"> <div class="col-md-3">
<CompanySortDropdown OnChanged="SetSortCol"/> <CompanySortDropdown OnChanged="SetSortCol"/>
</div> </div>
<div class="col-md-2"> <div class="col-md-3">
<PageSizeDropdown OnChanged="SetPageSize"></PageSizeDropdown> <PageSizeDropdown OnChanged="SetPageSize"></PageSizeDropdown>
</div> </div>
<div class="col">
<a class="btn btn-success mb-1" href="/company/create">Opret kunde</a>
</div>
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<div class="col"> <div class="col-md-6">
<Pagination MetaData="MetaData" Spread="2" SelectedPage="SelectedPage"></Pagination> <Pagination MetaData="MetaData" Spread="2" SelectedPage="SelectedPage"></Pagination>
</div> </div>
<div class="col-md-3">
</div>
<div class="col-md-3">
<a class="btn btn-success" href="/company/create">Opret kunde</a>
</div>
</div> </div>
<CompanyTable Companies="Companies" OnDelete="DeleteCompany"></CompanyTable> <CompanyTable Companies="Companies" OnDelete="DeleteCompany"></CompanyTable>

View file

@ -36,6 +36,7 @@ namespace Wonky.Client.Pages
public MetaData? MetaData { get; set; } = new(); public MetaData? MetaData { get; set; } = new();
private CompanyPagingParams _paging = new(); private CompanyPagingParams _paging = new();
private Preferences _preferences { get; set; } = new(); private Preferences _preferences { get; set; } = new();
private string _savedSearch { get; set; } = "";
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
@ -45,7 +46,10 @@ namespace Wonky.Client.Pages
_paging.SearchColumn = _preferences.CompanySearch; _paging.SearchColumn = _preferences.CompanySearch;
_paging.PageSize = Convert.ToInt32(_preferences.PageSize); _paging.PageSize = Convert.ToInt32(_preferences.PageSize);
// _savedSearch = string.IsNullOrWhiteSpace(_preferences.CompanyFilterPhrase)
? "" : _preferences.CompanyFilterPhrase;
_paging.SearchTerm = _savedSearch;
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent(); Interceptor.RegisterBeforeSendEvent();
// get companies // get companies
@ -76,6 +80,8 @@ namespace Wonky.Client.Pages
private async Task SetSearchPhrase(string searchTerm) private async Task SetSearchPhrase(string searchTerm)
{ {
if(string.IsNullOrWhiteSpace(searchTerm))
await UserPrefService.SetCompanyFilterPhrase("");
Companies = new List<CompanyDto>(); Companies = new List<CompanyDto>();
_paging.PageNumber = 1; _paging.PageNumber = 1;
_paging.SearchTerm = searchTerm; _paging.SearchTerm = searchTerm;

View file

@ -162,13 +162,16 @@
<div class="card-footer"> <div class="card-footer">
<div class="row"> <div class="row">
<div class="col col-md-2"> <div class="col col-md-2">
<button type="button" class="btn btn-warning">SKJUL</button> <button type="button" class="btn btn-warning">Fjern</button>
</div> </div>
<div class="col col-md-2"> <div class="col col-md-2">
<button type="button" class="btn btn-danger">SLET</button> <button type="button" class="btn btn-danger">Slet</button>
</div> </div>
<div class="col col-md-2"> <div class="col col-md-2">
<button type="submit" class="btn btn-success">GEM</button> <button type="submit" class="btn btn-success">Gem</button>
</div>
<div class="col col-md-2">
<a class="btn btn-primary" href="/company/@CompanyId">Til Oversigt</a>
</div> </div>
<div class="col col-md-2"> <div class="col col-md-2">
<a class="btn btn-primary" href="/company/@CompanyId">Tilbage</a> <a class="btn btn-primary" href="/company/@CompanyId">Tilbage</a>

View file

@ -139,7 +139,7 @@
<ItemSearchDropdown OnChanged="SetSearchCol"/> <ItemSearchDropdown OnChanged="SetSearchCol"/>
</div> </div>
<div class="col"> <div class="col">
<SearchComponent OnChanged="SetSearchPhrase"/> <SearchPhrase OnChanged="SetSearchPhrase"/>
</div> </div>
<div class="col"> <div class="col">
<ItemSortDropdown OnChanged="SetSortCol"/> <ItemSortDropdown OnChanged="SetSortCol"/>
@ -361,13 +361,15 @@
</div> </div>
</div> </div>
<div class="row mt-2 mb-2"> <div class="row mt-2 mb-2">
<div class="col-md-6"></div> <div class="col-md-2">
<a class="btn btn-primary" href="/companies">Til Oversigt</a>
</div>
<div class="col-md-2"> <div class="col-md-2">
<a class="btn btn-primary" href="/company/@NgCompany.CompanyId">Tilbage</a> <a class="btn btn-primary" href="/company/@NgCompany.CompanyId">Tilbage</a>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
@* <button type="submit" class="btn btn-success" disabled="@InvalidActivity">Gem</button> *@ @* <button type="submit" class="btn btn-success" disabled="@InvalidActivity">Gem</button> *@
<button type="button" class="btn btn-success" @onclick="CreateActivity">OK</button> <button type="button" class="btn btn-success" @onclick="CreateActivity">Opret besøg</button>
</div> </div>
</div> </div>
</EditForm> </EditForm>

View file

@ -89,44 +89,57 @@
</table> </table>
@if (!_reportDto.DayTypeEnum.ToLower().Contains("leave")) @if (!_reportDto.DayTypeEnum.ToLower().Contains("leave"))
{ {
<div class="form-group row mb-1">
<label for="supervisedBy" class="col-form-label col-md-2">Supervisor</label>
<div class="col-md-4">
<InputText id="supervisedBy" class="form-control" @bind-Value="_reportDto.SupervisedBy"/>
<ValidationMessage For="@(() => _reportDto.SupervisedBy)" />
</div>
<label for="description" class="col-form-label col-md-2">Beskrivelse</label>
<div class="col-md-4">
<InputTextArea id="description" class="form-control" @bind-Value="_reportDto.Description"/>
<ValidationMessage For="@(() => _reportDto.Description)" />
</div>
</div>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th scope="col">Km Morgen</th> <th scope="col" style="width:60%">Tekst</th>
<th scope="col">Km Aften</th> <th scope="col">Medkørende Supervisor</th>
<th scope="col">Km Kørt</th> </tr>
<th scope="col">Km Privat</th> </thead>
<tbody>
<tr>
<td>
<InputTextArea id="description" class="form-control" @bind-Value="_reportDto.Description"/>
<ValidationMessage For="@(() => _reportDto.Description)" />
</td>
<td>
<InputText id="supervisedBy" class="form-control" @bind-Value="_reportDto.SupervisedBy"/>
<ValidationMessage For="@(() => _reportDto.SupervisedBy)" />
</td>
</tr>
</tbody>
</table>
<table class="table">
<thead>
<tr>
<th scope="col">Km morgen</th>
<th scope="col">Km aften</th>
<th scope="col">Km kørt</th>
<th scope="col">Km privat</th>
<th scope="col">Md privat</th>
<th scope="col">Md total</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td> <td>
<InputNumber class="form-control" @bind-Value="_reportDto.Figures.KmMorning" disabled="@_noFigures" /> <InputNumber class="form-control" @bind-Value="_reportDto.Figures.KmMorning" disabled="@_noFigures" />
<ValidationMessage For="@(() => _reportDto.Figures.KmMorning)" />
</td> </td>
<td> <td>
<InputNumber class="form-control" @bind-Value="_reportDto.Figures.KmEvening" disabled="@_noFigures" /> <InputNumber class="form-control" @bind-Value="_reportDto.Figures.KmEvening" disabled="@_noFigures" />
<ValidationMessage For="@(() => _reportDto.Figures.KmEvening)" />
</td> </td>
<td> <td>
<InputNumber class="form-control" @bind-Value="_reportDto.Figures.Distance" readonly="" /> <InputNumber class="form-control" @bind-Value="_reportDto.Figures.Distance" readonly />
</td> </td>
<td> <td>
<InputNumber class="form-control" @bind-Value="_reportDto.Figures.DistancePrivate" disabled="@_noFigures"/> <InputNumber class="form-control" @bind-Value="_reportDto.Figures.DistancePrivate" disabled="@_noFigures"/>
<ValidationMessage For="@(() => _reportDto.Figures.DistancePrivate)" /> </td>
<td>
<InputNumber class="form-control" @bind-Value="_reportDto.Figures.DistancePrivateMonth" readonly/>
</td>
<td>
<InputNumber class="form-control" @bind-Value="_reportDto.Figures.DistanceMonth" readonly/>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -150,14 +163,14 @@
<td>@activity.Company.Name - @activity.Company.ZipCity</td> <td>@activity.Company.Name - @activity.Company.ZipCity</td>
<td>@activity.Demo</td> <td>@activity.Demo</td>
<td>@activity.SalesResume</td> <td>@activity.SalesResume</td>
<td>@activity.OrderAmount</td> <td class="align-content-end">@activity.OrderAmount</td>
</tr> </tr>
} }
<tr> <tr>
<td></td> <td></td>
<td></td> <td></td>
<td>Total</td> <td>Total</td>
<td>@_reportDto.Figures.TotalTurnover</td> <td class="align-content-end">@_reportDto.Figures.TotalTurnover</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -173,7 +186,7 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>*</td> <td></td>
<th scope="col">Besøg</th> <th scope="col">Besøg</th>
<th scope="col">Demo</th> <th scope="col">Demo</th>
<th scope="col">Salg</th> <th scope="col">Salg</th>
@ -184,7 +197,7 @@
<th scope="col">Beløb</th> <th scope="col">Beløb</th>
</tr> </tr>
<tr> <tr>
<th scope="row"></th> <th scope="row">N</th>
<td>@_reportDto.Figures.NewVisitCount</td> <td>@_reportDto.Figures.NewVisitCount</td>
<td>@_reportDto.Figures.NewDemoCount</td> <td>@_reportDto.Figures.NewDemoCount</td>
<td>@_reportDto.Figures.NewSaleCount</td> <td>@_reportDto.Figures.NewSaleCount</td>
@ -192,19 +205,46 @@
<td>@_reportDto.Figures.NewVisitCountMonth</td> <td>@_reportDto.Figures.NewVisitCountMonth</td>
<td>@_reportDto.Figures.NewDemoCountMonth</td> <td>@_reportDto.Figures.NewDemoCountMonth</td>
<td>@_reportDto.Figures.NewSaleCountMonth</td> <td>@_reportDto.Figures.NewSaleCountMonth</td>
<td></td> <td>@_reportDto.Figures.NewTurnoverMonth</td>
</tr> </tr>
<tr>
<th scope="row">R</th>
<td>@_reportDto.Figures.RecallVisitCount</td>
<td>@_reportDto.Figures.RecallDemoCount</td>
<td>@_reportDto.Figures.RecallSaleCount</td>
<td>@_reportDto.Figures.RecallTurnover</td>
<td>@_reportDto.Figures.RecallVisitCountMonth</td>
<td>@_reportDto.Figures.RecallDemoCountMonth</td>
<td>@_reportDto.Figures.RecallSaleCountMonth</td>
<td>@_reportDto.Figures.RecallTurnoverMonth</td>
</tr>
<tr>
<th scope="row">SAS</th>
<td></td>
<td></td>
<td>@_reportDto.Figures.SasCount</td>
<td>@_reportDto.Figures.SasTurnover</td>
<td></td>
<td></td>
<td>@_reportDto.Figures.SasCountMonth</td>
<td>@_reportDto.Figures.SasTurnoverMonth</td>
</tr>
<tr>
<th scope="row">TOTAL</th>
<td>@(_reportDto.Figures.NewVisitCount + _reportDto.Figures.RecallVisitCount)</td>
<td>@(_reportDto.Figures.NewDemoCount + _reportDto.Figures.RecallDemoCount)</td>
<td>@(_reportDto.Figures.NewSaleCount + _reportDto.Figures.RecallSaleCount + _reportDto.Figures. SasCount)</td>
<td>@(_reportDto.Figures.NewTurnover + _reportDto.Figures.RecallTurnover + _reportDto.Figures.SasTurnover)</td>
<td>@(_reportDto.Figures.NewVisitCountMonth + _reportDto.Figures.RecallVisitCountMonth)</td>
<td>@(_reportDto.Figures.NewDemoCountMonth + _reportDto.Figures.RecallDemoCountMonth)</td>
<td>@(_reportDto.Figures.NewSaleCountMonth + _reportDto.Figures.RecallSaleCountMonth + _reportDto.Figures. SasCountMonth)</td>
<td>@(_reportDto.Figures.NewTurnoverMonth + _reportDto.Figures.RecallTurnoverMonth + _reportDto.Figures.SasTurnoverMonth)</td>
</tr>
</tbody> </tbody>
</table> </table>
} }
</div> </div>
</div> </div>
</EditForm> </EditForm>
<div>workDate: @_workDate</div>
<div>tsIn: @_timestampIn</div>
<div>tsOut: @_timestampOut</div>
<div>checkIn: @_reportDto.CheckIn</div>
<div>checkOut: @_reportDto.CheckOut</div>
<div>leaveBegin: @_leaveBegin</div>
<div>leaveEnd: @_leaveEnd</div>

View file

@ -18,12 +18,12 @@
}, },
"appInfo": { "appInfo": {
"name": "Wonky Client", "name": "Wonky Client",
"version": "0.6.2", "version": "0.7",
"isBeta": true, "isBeta": true,
"image": "grumpy-coder.png" "image": "grumpy-coder.png"
}, },
"apiConfig": { "apiConfig": {
"baseAddress": "https://dev.innotec.dk", "baseAddress": "https://staging.innotec.dk",
"tokenPath": "token", "tokenPath": "token",
"userInfo": "api/auth/userinfo", "userInfo": "api/auth/userinfo",
"customerEndpoint": "api/v2/crm/companies", "customerEndpoint": "api/v2/crm/companies",

View file

@ -4,13 +4,13 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest"> <link rel="manifest" href="site.webmanifest" crossorigin="use-credentials">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"> <link rel="mask-icon" href="safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c"> <meta name="msapplication-TileColor" content="#ffaa00">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#000">
<title>Wonky Online</title> <title>Wonky Online</title>
<base href="/" /> <base href="/" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">

View file

@ -1,6 +1,8 @@
{ {
"name": "", "$schema": "https://json.schemastore.org/web-manifest-combined.json",
"short_name": "", "name": "Innotec Webapp",
"short_name": "Innotec Webapp",
"description": "Innotec Web CRM",
"icons": [ "icons": [
{ {
"src": "/android-chrome-192x192.png", "src": "/android-chrome-192x192.png",
@ -13,7 +15,7 @@
"type": "image/png" "type": "image/png"
} }
], ],
"theme_color": "#ffffff", "theme_color": "#ffaa00",
"background_color": "#ffffff", "background_color": "#000",
"display": "standalone" "display": "standalone"
} }