Announcement

Collapse
No announcement yet.

Remove Set Held and Set Not Held from meeting modal

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Remove Set Held and Set Not Held from meeting modal

    Can anyone tell me how to remove Set Held and Set Not Held from meeting modal?
    Click image for larger version

Name:	image.png
Views:	235
Size:	23.2 KB
ID:	100883

    Thanks

  • #2


    look on doc, how make a custom handler for hide this action button
    never try but must work

    Crazy, many front-end specialist and no respond

    Comment


    • dnaoverride
      dnaoverride commented
      Editing a comment
      Thanks will try out

  • #3
    You can create a custom modal view for the meeting, copy the existing one and just remove the setHeld and setNotHeld methods, follow steps below:

    1 - create a file under custom\Espo\Custom\Resources\metadata\clientDefs\M eeting.json and paste the code below (if you have already the custom file just use the code for the view):

    PHP Code:
    {
        
    "modalViews": {
            
    "detail":"custom:views/meeting/modals/detail"
        
    }
    }
    ​ 

    2 - create the custom modal view under client\custom\custom\src\views\meeting\modals\deta il.js (create those folders if they don't exist), below the code:
    PHP Code:
    define('custom:views/meeting/modals/detail', ['views/modals/detail''lib!moment'],
        function (
    Depmoment) {

        return 
    Dep.extend({

            
    duplicateActiontrue,

            
    setupAfterModelCreated: function () {
                
    Dep.prototype.setupAfterModelCreated.call(this);

                
    let buttonData this.getAcceptanceButtonData();

                
    this.addButton({
                    
    name'setAcceptanceStatus',
                    
    htmlbuttonData.html,
                    
    hiddenthis.hasAcceptanceStatusButton(),
                    
    stylebuttonData.style,
                    
    className'btn-text',
                    
    pullLefttrue,
                }, 
    'cancel');


                
    this.addDropdownItem({
                    
    name'sendInvitations',
                    
    textthis.translate('Send Invitations''labels''Meeting'),
                    
    hidden: !this.isSendInvitationsToBeDisplayed(),
                });

                
    this.initAcceptanceStatus();

                
    this.on('switch-model', (modelpreviousModel) => {
                    
    this.stopListening(previousModel'sync');
                    
    this.initAcceptanceStatus();
                });

                
    this.on('after:save', () => {
                    if (
    this.hasAcceptanceStatusButton()) {
                        
    this.showAcceptanceButton();
                    } else {
                        
    this.hideAcceptanceButton();
                    }

                    if (
    this.isSendInvitationsToBeDisplayed()) {
                        
    this.showActionItem('sendInvitations');
                    } else {
                        
    this.hideActionItem('sendInvitations');
                    }
                });

                
    this.listenTo(this.model'sync', () => {
                    if (
    this.isSendInvitationsToBeDisplayed()) {
                        
    this.showActionItem('sendInvitations');

                        return;
                    }

                    
    this.hideActionItem('sendInvitations');
                });

                
    this.listenTo(this.model'after:save', () => {
                    if (
    this.isSendInvitationsToBeDisplayed()) {
                        
    this.showActionItem('sendInvitations');

                        return;
                    }

                    
    this.hideActionItem('sendInvitations');
                });
            },

            
    controlRecordButtonsVisibility: function () {
                
    Dep.prototype.controlRecordButtonsVisibility.call(this);
            },

            
    hasSetStatusButton: function () {

            },

            
    initAcceptanceStatus: function () {
                if (
    this.hasAcceptanceStatusButton()) {
                    
    this.showAcceptanceButton();
                } else {
                    
    this.hideAcceptanceButton();
                }

                
    this.listenTo(this.model'sync', () => {
                    if (
    this.hasAcceptanceStatusButton()) {
                        
    this.showAcceptanceButton();
                    } else {
                        
    this.hideAcceptanceButton();
                    }
                });
            },

            
    getAcceptanceButtonData: function () {
                
    let acceptanceStatus this.model.getLinkMultipleColumn('users''status'this.getUser().id);

                
    let text;
                
    let style 'default';

                
    let iconHtml null;

                if (
    acceptanceStatus && acceptanceStatus !== 'None') {
                    
    text this.getLanguage().translateOption(acceptanceStatus'acceptanceStatus'this.model.entityType);

                    
    style this.getMetadata()
                        .
    get(['entityDefs'this.model.entityType,
                            
    'fields''acceptanceStatus''style'acceptanceStatus]);

                    if (
    style) {
                        
    let iconClass = ({
                            
    'success''fas fa-check-circle',
                            
    'danger''fas fa-times-circle',
                            
    'warning''fas fa-question-circle',
                        })[
    style];

                        
    iconHtml = $('<span>')
                            .
    addClass(iconClass)
                            .
    addClass('text-' style)
                            .
    get(0).outerHTML;
                    }
                } else {
                    
    text typeof acceptanceStatus !== 'undefined' ?
                        
    this.translate('Acceptance''labels''Meeting') :
                        
    ' ';
                }

                
    let html this.getHelper().escapeString(text);

                if (
    iconHtml) {
                    
    html iconHtml ' ' html;
                }

                return {
                    
    stylestyle,
                    
    texttext,
                    
    htmlhtml,
                };
            },

            
    showAcceptanceButton: function () {
                
    this.showActionItem('setAcceptanceStatus');

                if (!
    this.isRendered()) {
                    
    this.once('after:render'this.showAcceptanceButtonthis);

                    return;
                }

                
    let data this.getAcceptanceButtonData();

                
    let $button this.$el.find('.modal-footer [data-name="setAcceptanceStatus"]');

                
    $button.html(data.html);

                
    $button.removeClass('btn-default');
                
    $button.removeClass('btn-success');
                
    $button.removeClass('btn-warning');
                
    $button.removeClass('btn-info');
                
    $button.removeClass('btn-primary');
                
    $button.removeClass('btn-danger');
                
    $button.addClass('btn-' data.style);
            },

            
    hideAcceptanceButton: function () {
                
    this.hideActionItem('setAcceptanceStatus');
            },

            
    hasAcceptanceStatusButton: function () {
                if (!
    this.model.has('status')) {
                    return 
    false;
                }

                if (!
    this.model.has('usersIds')) {
                    return 
    false;
                }

                if (~[
    'Held''Not Held'].indexOf(this.model.get('status'))) {
                    return 
    false;
                }

                if (!~
    this.model.getLinkMultipleIdList('users').indexOf(this.getUser().id)) {
                    return 
    false;
                }
                return 
    true;
            },

            
    actionSetAcceptanceStatus: function () {
                
    this.createView('dialog''crm:views/meeting/modals/acceptance-status', {
                    
    modelthis.model,
                }, (
    view) => {
                    
    view.render();

                    
    this.listenTo(view'set-status', (status) => {
                        
    this.hideAcceptanceButton();

                        
    Espo.Ajax.postRequest(this.model.entityType '/action/setAcceptanceStatus', {
                            
    idthis.model.id,
                            
    statusstatus,
                        }).
    then(() => {
                            
    this.model.fetch()
                                .
    then(() => {
                                    
    setTimeout(() => {
                                        
    this.$el.find(`button[data-name="setAcceptanceStatus"]`).focus();
                                    }, 
    50)
                                });
                        });
                    });
                });
            },

            
    isSendInvitationsToBeDisplayed: function () {
                if (~[
    'Held''Not Held'].indexOf(this.model.get('status'))) {
                    return 
    false;
                }

                
    let dateEnd this.model.get('dateEnd');

                if (
                    
    dateEnd &&
                    
    this.getDateTime().toMoment(dateEnd).isBefore(moment.now())
                ) {
                    return 
    false;
                }

                if (!
    this.getAcl().checkModel(this.model'edit')) {
                    return 
    false;
                }

                
    let userIdList this.model.getLinkMultipleIdList('users');
                
    let contactIdList this.model.getLinkMultipleIdList('contacts');
                
    let leadIdList this.model.getLinkMultipleIdList('leads');

                if (!
    contactIdList.length && !leadIdList.length && !userIdList.length) {
                    return 
    false;
                }

                return 
    true;
            },

            
    actionSendInvitations: function () {
                
    Espo.Ui.notify(' ... ');

                
    this.createView('dialog''crm:views/meeting/modals/send-invitations', {
                    
    modelthis.model,
                }).
    then(view => {
                    
    Espo.Ui.notify(false);

                    
    view.render();

                    
    this.listenToOnce(view'sent', () => this.model.fetch());
                });
            },
        });
    }); 

    After that just clear the cache and rebuild the system.

    I hope this helps
    Rabii
    Web Dev

    Comment


    • #4
      Thanks rabii, beer on me.
      Modal actually have to be created in client\custom\src\views\meeting\modals not in client\custom\custom\src\views\meeting\modals figured it out and now it works like a charm.


      Following on that same principle apply to meeting record list?

      Click image for larger version

Name:	image.png
Views:	199
Size:	32.9 KB
ID:	100983
      ​​​​​​​Override default view from src folder in custom folder?

      Comment


      • #5
        You are welcome, correct follow same principle to override list. This is a safe upgrade way.
        Rabii
        Web Dev

        Comment


        • #6
          Thank you Rabii, but what if I want to remove set held in another entity such as the one in opportunity > activity as in the picture below?

          Comment


          • llen
            llen commented
            Editing a comment
            Thank you very much for your help. you're the best

          • rabii
            rabii commented
            Editing a comment
            you are welcome

          • llen
            llen commented
            Editing a comment
            Um Hello again Rabii I hope you are always happy and healthy. I want to ask again about the problem above. But I have a new case, namely I display a list of activities on the Home dashboard. How can I delete the held and not held sets? Because I am confused about what recordView/view should I modify if it is in the home dashboard

        • #7
          I want to ask again about the problem above. But I have a new case, namely I display a list of activities on the Home dashboard. How can I delete the held and not held sets? Because I am confused about what recordView/view should I modify if it is in the home dashboard

          Comment


          • #8
            Hey llen

            Same concept you need to create a custom view for the dashlet and provide a custom rowActionView follow steps below and it should work:

            1 - Create a file under custom\Espo\Custom\Resources\metadata\dashlets\Act ivities.json and paste the code below:
            PHP Code:
            {
                
            "view""custom:views/dashlets/activities"
            }​ 


            2 - Create the custom dashlet view under client\custom\src\views\dashlets\activities.js and assign the custom rowActionView, below the code:
            PHP Code:
            define('custom:views/dashlets/activities', ['crm:views/dashlets/activities'], function(Dep) {
                
                return 
            Dep.extend({

                    
            rowActionsView'custom:views/record/row-actions/activities-dashlet'    

                
            });
            });
            ​ 


            3 - Create the custom rowActionView under client\custom\src\views\record\row-actions\activities-dashlet.js and paste the code below:​
            PHP Code:
            define('custom:views/record/row-actions/activities-dashlet', ['views/record/row-actions/view-and-edit'], function (Dep) {

                return 
            Dep.extend({

                    
            getActionList: function () {
                        var 
            actionList Dep.prototype.getActionList.call(this);

                        var 
            scope this.model.entityType;

                        
            actionList.forEach((item) => {
                            
            item.data item.data || {};
                            
            item.data.scope this.model.entityType;
                        });

                        if (
            scope === 'Task') {
                            if (
                                
            this.options.acl.edit &&
                                ![
            'Completed''Canceled'].includes(this.model.get('status'))
                                ) {
                                
            actionList.push({
                                    
            action'setCompleted',
                                    
            label'Complete',
                                    
            data: {
                                        
            idthis.model.id
                                    
            }
                                });
                            }
                        }

                        if (
            this.options.acl.edit) {
                            
            actionList.push({
                                
            action'quickRemove',
                                
            label'Remove',
                                
            data: {
                                    
            idthis.model.id,
                                    
            scopethis.model.entityType
                                
            }
                            });
                        }

                        return 
            actionList;
                    },
                });
            });
            ​ 


            Clear cache and rebuild and now the dashlet activities won't have set held and Not set held option on the row actions of both meetings and calls. Task will still have Complete as you can see from the code above.

            I hope this helps
            Rabii
            Web Dev

            Comment


            • #9
              thank you very much rabii , your help is very helpful to me. your the best

              Comment


              • rabii
                rabii commented
                Editing a comment
                you are welcome
            Working...
            X