Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "jdavis01"

Got it figured out... Here is the code that works..

Create Modal

_labRequestService.createOrEdit(labRequest
).done(function (data) {
                 abp.notify.info(app.localize('SavedSuccessfully'));
                 _modalManager.close();

                 abp.event.trigger('app.createOrEditLabRequestModalSaved', { id: data });
}).always(function () {
                 _modalManager.setBusy(false);
});

Event subscription and action

//Event Bus Registration

        abp.event.on('app.createOrEditLabRequestModalSaved',
            function (data) {

                if (data !== -1) {
                    // View lab request for print
                    _viewLabRequestModal.open({ id: data.id });
                }


            });

I I have from the MVC project folder.

dnard82, thanks for the answer. I have tried to return just a number both from the Create() method and the modal. The Id value never gets passed through the event bus back to the subscribers.

here is the CreateOrEdit and Create methods

public async Task<int> CreateOrEdit(CreateOrEditLabRequestDto input)
         {
            int labRequestId;

            if(input.Id == null){
                labRequestId = await Create(input);
			}
			else{
                await Update(input);
                labRequestId = -1;
			}

            return labRequestId;
            ;
         }
         
 [AbpAuthorize(AppPermissions.Pages_LabRequest_Create)]
		 private async Task<int> Create(CreateOrEditLabRequestDto input)
         {
            var labRequest = ObjectMapper.Map<LabRequest>(input);

			
			if (AbpSession.TenantId != null)
			{
				labRequest.TenantId = (int?) AbpSession.TenantId;
			}
		

            await _labRequestRepository.InsertAndGetIdAsync(labRequest);

            return labRequest.Id;

         }

I will keep working on this for now and post back if I find a solution

Answer

Here is how I solved this issue for me.. Seems a bit hacky, but working on a better solution

https://support.aspnetzero.com/QA/Questions/7192

Answer

So I ended up getting the print modal feature to work by doing the following..

Created a partial view ModalFooterWithPrintAndClose then added the class save-button to the print button

<div class="modal-footer">
    <!-- Using the Save Button until I can determine how use print-button -->
    <button type="button" id="PrintModalButton" class="btn btn-secondary save-button"><i class="fa fa-save"></i> <span>@L("Print")</span></button>
    <button type="button" class="btn btn-primary close-button" data-dismiss="modal">@L("Cancel")</button>


</div>

Added the Print and Close partial view to all modals that needed printing

@await Html.PartialAsync("~/Areas/App/Views/Common/Modals/_ModalFooterWithPrintAndClose.cshtml")

Modified my ViewModal.js file to add the print functionality into the save fucntion

 this.save = function () {           
            $('.modal-body').printThis({
                loadCSS: "metronic/common/css/invoice-1.css"
            });
        };      

This works for now, seems like a hack. I am still looking for a more permanent solution on how to register a button click event on a modal in this framework.

Answer

So I created a separate modal footer called _ModalWithPrintAndClose.cshtml as shown

<div class="modal-footer">
    <!-- Using the Save Button until I can determine how use print-button -->
    <button type="button" id="PrintModalButton" class="btn btn-secondary print-button"><i class="fa fa-save"></i> <span>@L("Print")</span></button>
    <button type="button" class="btn btn-primary close-button" data-dismiss="modal">@L("Cancel")</button>


</div>

Added it to the Modal

@await Html.PartialAsync("~/Areas/App/Views/Common/Modals/_ModalFooterWithPrintAndClose.cshtml")

Implemented the onOpen as you demonstrated

var modalOptions = {};

        var onOpen = function () {
            $('#PrintModalButton').click(function () {
                $('.modal-content').printThis();

            });

        };

        var onClose = function () { };

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

Here is a hack that seems to be working for now, but seems a bit unstable... I use the same modal-footer partial view and change the  class on the print button to include save-button, This code within the modal script fileworks and allows me to print

<br>

(function ($) {

    app.modals.ViewLabRequestModal = function () {

        var _modalManager;

        this.init = function (modalManager) {
            _modalManager = modalManager;

            var modal = _modalManager.getModal();
        };

        this.save = function () {
            //TODO: Add option afterPrint and call abpnotification
            $('.modal-content').printThis({
                     loadCSS: "metronic/themes/theme11/css/style.bundle.css"
            });
        };
    }; 
})(jQuery);

Thoughts?

Answer

Thanks for the explaination..

Answer

Ok so the install page is loading, but not sure which account and password to use

Under the connection string there is no field to enter a user name associated with the password, so is it the SA account ?

I havent seen this behavior in version 6.8 MVC & JQUERY.

Is it possible they corrected the issue?

Ismcagdas, The site is an internal intranet site for employees only sonit would have to be a remote meeting

Showing 11 to 20 of 39 entries