Base solution for your next web application

Activities of "alfar_re"

Great. What of the status?

Hi,

With ref to #8533, I have an additional challenge. I have a row action that needs to be displayed only when two things are right

  1. The rights to perform the action and
  2. The correct status of the record

What I mean is, I have an action called 'Approve' and the entity has an Enum called 'Status' that has the following statuses 'Active, Draft, Cancelled, Expired'. So, a new record is created then it has the status 'Draft' and it hence needs to be approved to become 'Active' and to perform some background work. My challenge then is making sure that I check that the current user has rights to 'Approve' as well as check that the status is 'Draft' so as to display the row action.

Thanks in advance.

Hi @ismcagdas,

My use case is simple. I have an entity Building an entity RentalUnits. One Building has many RentalUnits and on RentalUnit create modal there is Building as a navigation property. So, on the Building actions, I have 'Add Rental Unit' as an action which a user can use to add RentalUnits to a Building. This means that it makes sense to have the respective Building selected when the action is selected.

See Index below;

`var _createOrEditRentalUnitModal = new app.ModalManager({
			viewUrl: abp.appPath + 'App/RentalUnits/CreateOrEditModal',
			scriptUrl: abp.appPath + 'view-resources/Areas/App/Views/RentalUnits/_CreateOrEditModal.js',
			modalClass: 'CreateOrEditRentalUnitModal'
		});


     {
			text: app.localize('Add Unit'),
			action: function (data) {
			_createOrEditRentalUnitModal.open({ buildingId: data.record.building.id });
	}`

Now, I'd like to know how to make this work with the code you shared on here.

Thank you.

Hi,

I added the mapping and it worked. I guess that was the step I was missing. Thanks a gigabyte @ismcagdas.

Hi @ismcagdas,

I have looked at this and am wondering how to implement it inside actions in index.js

Hi,

Thank you. Let me try this out.

Hi,

Needing resolution on this matter. Thank you.

Hi,

Here you go.

AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.

Mapping types:
GetNumberFormatForViewDto -> NumberFormat
reos.NumberFormats.Dtos.GetNumberFormatForViewDto -> reos.NumberFormats.NumberFormat
   at lambda_method(Closure , GetNumberFormatForViewDto , NumberFormat , ResolutionContext )
   at Abp.AutoMapper.AutoMapperObjectMapper.Map[TSource,TDestination](TSource source, TDestination destination)
   at reos.Leases.LeasesAppService.GenerateNumberAsync(ModuleProfile input, Int32 tenantId) in D:\OneDrive\Projects\reos\src\reos.Application\Leases\LeasesAppService.cs:line 351
   at reos.Leases.LeasesAppService.Create(CreateOrEditLeaseDto input) in D:\OneDrive\Projects\reos\src\reos.Application\Leases\LeasesAppService.cs:line 162
   at Abp.Threading.InternalAsyncHelper.AwaitTaskWithPostActionAndFinally(Task actualReturnValue, Func`1 postAction, Action`1 finalAction)
   at reos.Leases.LeasesAppService.CreateOrEdit(CreateOrEditLeaseDto input) in D:\OneDrive\Projects\reos\src\reos.Application\Leases\LeasesAppService.cs:line 144
   at lambda_method(Closure , Object )
   at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeNextActionFilterAsync&gt;g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

Hi,

I'm getting this error on the bold line of code below

AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.

`public async Task&lt;string&gt; GenerateNumberAsync(ModuleProfile profile, int tenantId)
        {
            var numberFormat = await _numberFormatRepository.GetAll().Where(e => e.Module == profile && e.TenantId == tenantId).FirstOrDefaultAsync();

            long _current = numberFormat.Current;
            int _seed = numberFormat.Seed;
            long _new = _current + _seed;
            long? _total = 1 + numberFormat.Total;
            string _number = string.Concat(numberFormat.Prefix.Trim(), _new.ToString(), numberFormat.Postfix.Trim());
            //
            var newNumberFormat = new NumberFormats.Dtos.GetNumberFormatForViewDto()
            {
         `       NumberFormat = new NumberFormats.Dtos.NumberFormatDto
                {
                    Current = _new,
                    Total = _total,
                }
            };
######             **ObjectMapper.Map(newNumberFormat, numberFormat);**
            //
            return _number;
        }

Hi @ismcagdas,

I'm using jQuery

Showing 91 to 100 of 138 entries