Precision Healthcare Solutions
CLINICAL OFFICE MPAGE SUITE DEVELOPER REPORTS DESIGNER shopping_cart mail
SALES CONTACT US
TutorialsWorkflow Component1. Getting Started2. Data Retrieval3. Tabbed Menu4. Building Reusable Parts5. Information Tab6. Relationship Tab7. Provider Relationship Tab8. Final StepsFull Page MPage1. Getting Started2. User Prompts3. Custom Script - Part 14. Add a Table5. Click to View Details6. Custom Script - Part 27. Add Remaining Details8. Bonus - Deploy to DA2Third Party IntegrationExcelJS

Appointments by Resource Tutorial - Click to View Details

Our MPage is coming along nicely. Our users can select a date range and one or more resources to view appointment details for patients by resource.

Your users want more!

In this next section, we are going to add code to our table that will open a dialog containing additional appointment information when a row of data is clicked on the main table.

  1. From a command line prompt, create a new component called components\appointment-details.
    ng generate component components\appointment-details
  2. Open app.ts and import the new AppointmentDetails component.
    import { AppointmentDetails } from './components/appointment-details/appointment-details';
  3. Inject the Dialog service into a new variable called dialog.
    export class App implements OnInit {
        public MPage = inject(MPageService);
        protected customService = inject(CustomService);
        private dialog = inject(Dialog);
    
        protected tableData: WritableSignal<any[]> = signal([]);
  4. Add a new method called showDetails to your App class. This method will first load the CCL script with our chosen eventId and when the load has completed, the method will inject the AppointmentDetails component into the Dialog service, rendering it 90% of the screen width and 50% of the height. AppointmentDetails will also receive the entire content of the incoming tableRow variable as a variable called data.
    // Initiate the dialog showing the appointment details
    protected showDetails(tableRow: any) {
        this.customService.clear('eventData');
        this.customService.load({
            name: '1trn_appt_by_res:group1',
            run: 'pre',
            id: 'eventData',
            parameters: {
                action: 'load-event',
                schEventId: tableRow.schEventId
            }
        }, undefined, () => {
            const dialogRef = this.dialog.open(AppointmentDetails, {
                width: '90vw',
                minHeight: '50vh',
                data: tableRow
            });
        });
    }
    
  5. Return to app.html and add a (clickRow) property to the mpage-table. This will send the entire row contents of the row being clicked to the showDetails method.
    <mpage-table [data]="tableData()" [params]="{showToolbar: true}" (clickRow)="showDetails($event)" />
  6. Before we modify our CCL script, we are going to develop some of the appointment details component. Open appointment-details.ts. Modify the code so it matches the details shown below:
    import { DatePipe } from '@angular/common';
    import { ChangeDetectionStrategy, Component, inject, input, signal, WritableSignal } from '@angular/core';
    import { ButtonDirective, CustomService, IMenuItem, MpageIconComponent, TabbedMenuComponent } from "@clinicaloffice/mpage-developer";
    
    @Component({
      selector: 'app-appointment-details',
      imports: [ButtonDirective, MpageIconComponent, TabbedMenuComponent, DatePipe],
      templateUrl: './appointment-details.html',
      styleUrl: './appointment-details.scss',
      changeDetection: ChangeDetectionStrategy.OnPush,
      standalone: true
    })
    export class AppointmentDetails {
      public dialogRef = input<HTMLDialogElement>();
      public data = input<any>();
    
      protected customService = inject(CustomService);
      protected menuItems: IMenuItem[] = [
        { label: 'Information', idName: 'info' },
        { label: 'Details', idName: 'details' },
        { label: 'Attached Orders', idName: 'orders' }
      ];
      protected tab: WritableSignal<string> = signal('info');
    
    }
    Notes:
    • The dialogRef and data input values have been injected by the Dialog service.
    • We will be using the TabbedMenu component to display multiple sections in the dialog. The menuItems and tab variables are used for this functionality.
  7. Open appointment-details.html and add the code shown below. This code displays information from our data signal input variable (e.g. data()?.patientName) and displays a tabbed menu with the options "Information", "Details", "Attached Orders".

    At this time, we only display information passed into our data variable. After we update our CCL script, we will come back and add the rest of the information.

    <!-- Patient Name and Close Button -->
    <div class="flex flex-gap">
        <h2>{{ data()?.patientName }}</h2>
        <span class="flex-fill"></span>
        <button coButton="icon" (click)="dialogRef()?.close()">
            <mpage-icon>close</mpage-icon>
        </button>
    </div>
    
    <!-- MRN and FIN -->
    <div class="flex flex-gap">
        <span>MRN: {{ data()?.mrn }} </span>
        <span>FIN: {{ data()?.fin }} </span>
    </div>
    
    <div style="border-bottom: 1px solid grey; margin: 0.5em 0">
        <tabbed-menu [tabs]="menuItems" (clickTab)="tab.set($event.idName!)" />
    </div>
    
    <!-- Display the chosen tab -->
    @switch(tab()) {
        @case('info') {
            <h3>General Information</h3>
            <div class="flex-column flex-gap margin">
                <span>Appointment Date/Time: {{ data().appointmentDtTm | date: customService.MPage.defaultDateFormats.display.dateTimeLabel }}</span>
                <span>Appointment Type: {{ data().appointmentType }}</span>
                <span>Appointment Location: {{ data().appointmentLocation }}</span>
                <span>Appointment State: {{ data().appointmentState }}</span>
            </div>
    
            <h3>Resources</h3>
        }
    }

    When you view your MPage and click on a row, you should see something similar to the screenshot shown here.

<< Prev: 4. Add a Table
Next: 6. Custom Script - Part 2 >>
Copyright © 2026 Precision Healthcare Solutions