Skip to content

Slow rendering #27

Description

@devotox
{{#paper-data-table class='flex flex-100' sortProp='fullName' sortDir='asc' selectable=true as |table|}}
    {{#table.head as |head|}}
        {{#head.column checkbox=true}}
            {{#paper-checkbox disabled=true onChange=null}}{{/paper-checkbox}}
        {{/head.column}}
        {{#head.column sortProp='fullName' }}Name{{/head.column}}

        {{#if (not-eq search.profileType 'patient')}}
            {{#head.column sortProp='email' }}Email{{/head.column}}
        {{/if}}

        {{#head.column sortProp='timestampCreated' numeric=true}}Date Created{{/head.column}}

        {{#if (eq search.profileType 'patient')}}
            {{#head.column sortProp='dataOrigin' }}Data Origin{{/head.column}}
        {{/if}}

        {{#if (eq search.profileType 'account')}}
            {{#head.column sortProp='emailVerified' }}Verified{{/head.column}}
            {{#head.column sortProp='accountType' }}Account Type{{/head.column}}
        {{/if}}

        {{#if (or (eq search.profileType 'specialist') (eq search.profileType 'practice'))}}
            {{#head.column sortProp='isSubscribedToBooking' }}Has Booking{{/head.column}}
            {{#head.column sortProp='status' }}Status{{/head.column}}
        {{/if}}
    {{/table.head}}
    {{#table.body as |body|}}
        {{#each (sort-by table.sortDesc currentPage) as |profile|}}
            {{#body.row edit=true as |row|}}
                {{#row.cell checkbox=true}}
                    {{#paper-checkbox value=profile.checked onChange=(action (mut profile.checked)) }}
                    {{/paper-checkbox}}
                {{/row.cell}}

                {{#row.cell}}
                    {{#paper-button iconButton=true onClick=(transition-to (concat 'profiles.' search.profileType '.edit') profile) }}
                        {{paper-icon 'exit to app'}}
                    {{/paper-button}}
                    {{titleize profile.fullName}}
                {{/row.cell}}

                {{#if (not-eq search.profileType 'patient')}}

                    {{#row.cell edit=true as |cell|}}

                        {{#paper-button iconButton=true onClick=cell.toggleEdit}}
                            {{paper-icon 'visibility'}}
                        {{/paper-button}}

                        {{truncate profile.email 25}}

                        {{#if cell.showEdit}}
                            {{#paper-dialog focusOnOpen=false origin=dialogOrigin fullscreen=fullscreen clickOutsideToClose=true onClose=cell.toggleEdit}}

                                {{#paper-dialog-content}}
                                    {{profile.email}}
                                {{/paper-dialog-content}}

                                {{#paper-dialog-actions class='layout-row' }}
                                    {{#paper-button primary=true onClick=cell.toggleEdit}}
                                        Close
                                    {{/paper-button}}
                                {{/paper-dialog-actions}}

                            {{/paper-dialog}}
                        {{/if}}

                    {{/row.cell}}
                {{/if}}

                {{#row.cell numeric=true}}
                    {{format-date profile.timestampCreated format='ddd, MMM Do, YYYY h:mm a' }}
                {{/row.cell}}

                {{#if (eq search.profileType 'patient')}}
                    {{#row.cell}}
                        {{profile.dataOrigin}}
                    {{/row.cell}}
                {{/if}}

                {{#if (eq search.profileType 'account')}}
                    {{#row.cell checkbox=true}}
                        {{#paper-checkbox value=profile.emailVerified onChange=(queue (action (mut profile.emailVerified)) (route-action 'updateVerified' profile))}}
                        {{/paper-checkbox}}
                    {{/row.cell}}

                    {{#row.cell class='layout-row layout-wrap flex-100 layout-align-space-around-center' edit=true as |cell| }}
                        {{titleize profile.accountType}}
                        {{#paper-button iconButton=true onClick=cell.toggleEdit}}
                            {{paper-icon 'edit'}}
                        {{/paper-button}}

                        {{#if cell.showEdit}}
                            {{#cell.edit-dialog onClose=cell.toggleEdit}}
                                {{#paper-select options=(get editStatuses search.profileType) label='Status' selected=profile.accountType class='layout-fill' onChange=(queue (action cell.toggleEdit) (action (mut profile.accountType)) (route-action 'updateAccountType' profile)) as |accountType|}}
                                    {{titleize accountType}}
                                {{/paper-select}}
                            {{/cell.edit-dialog}}
                        {{/if}}
                    {{/row.cell}}
                {{/if}}

                {{#if (or (eq search.profileType 'specialist') (eq search.profileType 'practice'))}}
                    {{#row.cell edit=true as |cell| }}
                        {{titleize (concat '' profile.isSubscribedToBooking)}}
                        {{#paper-button iconButton=true onClick=cell.toggleEdit}}
                            {{paper-icon 'edit'}}
                        {{/paper-button}}

                        {{#if cell.showEdit}}
                            {{#cell.edit-dialog onClose=cell.toggleEdit}}
                                {{#paper-select options=(array true false) label='Status' selected=profile.isSubscribedToBooking class='layout-fill' onChange=(queue (action cell.toggleEdit) (action (mut profile.isSubscribedToBooking)) (route-action 'updateBooking' profile)) as |isSubscribedToBooking|}}
                                    {{titleize (concat '' isSubscribedToBooking)}}
                                {{/paper-select}}
                            {{/cell.edit-dialog}}
                        {{/if}}
                    {{/row.cell}}

                    {{#row.cell class='layout-row layout-wrap flex-100 layout-align-space-around-center' edit=true as |cell| }}
                        {{titleize profile.status}}
                        {{#paper-button iconButton=true onClick=cell.toggleEdit}}
                            {{paper-icon 'edit'}}
                        {{/paper-button}}

                        {{#if cell.showEdit}}
                            {{#cell.edit-dialog onClose=cell.toggleEdit}}
                                {{#paper-select options=(get editStatuses search.profileType) label='Status' selected=profile.status class='layout-fill' onChange=(queue (action cell.toggleEdit) (action (mut profile.status)) (route-action 'updateStatus' profile)) as |status|}}
                                    {{titleize status}}
                                {{/paper-select}}
                            {{/cell.edit-dialog}}
                        {{/if}}
                    {{/row.cell}}
                {{/if}}

            {{/body.row}}
        {{/each}}
    {{/table.body}}
{{/paper-data-table}}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions