@using Indotalent.Features.Organization.Branch @using Indotalent.Features.Organization.Branch.Cqrs @using Indotalent.Shared.Utils @using MudBlazor @inject BranchService BranchService @inject ISnackbar Snackbar
Add New Branch Configure new office or warehouse location.
Branch Code Branch Name City Street Address State/Province ZIP Code Phone Email Description Other Information 1 Other Information 2 Other Information 3
Cancel @if (_processing) { Processing... } else { Create Branch }
@code { [Parameter] public EventCallback OnCancel { get; set; } [Parameter] public EventCallback OnSuccess { get; set; } private MudForm _form = default!; private CreateBranchValidator _validator = new(); private CreateBranchRequest _model = new(); private bool _processing = false; private async Task Submit() { await _form.Validate(); if (!_form.IsValid) return; _processing = true; try { var response = await BranchService.CreateBranchAsync(_model); await Task.Delay(500); if (response != null && response.IsSuccess) { Snackbar.Add("Branch created successfully", Severity.Success); await OnSuccess.InvokeAsync(); } } catch (Exception ex) { Snackbar.Add($"Error: {ex.Message}", Severity.Error); } finally { _processing = false; } } }