Announcement

Collapse
No announcement yet.

QuoteItem fields readonly after selected

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

  • QuoteItem fields readonly after selected

    In Quoteitems, when item has been selected from the scope, "name" input becomes readonly. I want to make quantity, listprice, and unitprice readonly when item has been selected.

    //name.js
    Code:
    
    
    
    
    
     [COLOR=#7a7a43]handleNameAvailability[/COLOR]: [COLOR=#000080][B]function [/B][/COLOR]() {     [COLOR=#000080][B]if [/B][/COLOR]([COLOR=#000080][B]this[/B][/COLOR].[COLOR=#660e7a][B]model[/B][/COLOR].[COLOR=#7a7a43]get[/COLOR]([COLOR=#008000][B]'productId'[/B][/COLOR])) {         [COLOR=#000080][B]this[/B][/COLOR].[COLOR=#660e7a][B]$element[/B][/COLOR].[COLOR=#7a7a43]attr[/COLOR]([COLOR=#008000][B]'readonly'[/B][/COLOR][COLOR=#cc7832], [/COLOR][COLOR=#000080][B]true[/B][/COLOR])[COLOR=#cc7832]; [/COLOR][COLOR=#660e7a][B]$[/B][/COLOR]([COLOR=#008000][B]".field-listPrice"[/B][/COLOR]).[COLOR=#7a7a43]find[/COLOR]([COLOR=#008000][B]'input[name="listPrice"]'[/B][/COLOR]).[COLOR=#7a7a43]attr[/COLOR]([COLOR=#008000][B]'readonly'[/B][/COLOR][COLOR=#cc7832],[/COLOR][COLOR=#000080][B]true[/B][/COLOR])[COLOR=#cc7832]; [/COLOR][COLOR=#660e7a][B]$[/B][/COLOR]([COLOR=#008000][B]".field-unitPrice"[/B][/COLOR]).[COLOR=#7a7a43]find[/COLOR]([COLOR=#008000][B]'input[name="unitPrice"]'[/B][/COLOR]).[COLOR=#7a7a43]attr[/COLOR]([COLOR=#008000][B]'readonly'[/B][/COLOR][COLOR=#cc7832],[/COLOR][COLOR=#000080][B]true[/B][/COLOR])[COLOR=#cc7832]; [/COLOR][COLOR=#660e7a][B]$[/B][/COLOR]([COLOR=#008000][B]".field-quantity"[/B][/COLOR]).[COLOR=#7a7a43]find[/COLOR]([COLOR=#008000][B]'input[name="quantity"]'[/B][/COLOR]).[COLOR=#7a7a43]attr[/COLOR]([COLOR=#008000][B]'readonly'[/B][/COLOR][COLOR=#cc7832],[/COLOR][COLOR=#000080][B]true[/B][/COLOR])[COLOR=#cc7832]; [/COLOR]}
    Quantity, listprice, and unitprice changes to readonly="true" when items exist and i'm another adding another one. When I update/save, and then i go back to add a item, the fields are no longer readonly.

  • #2
    PHP Code:
      chrisMethod: function(){     if(!!this.model.get('productId')){         $(".field-listPrice").find('input[name="listPrice"]').attr('readonly',true);         $(".field-unitPrice").find('input[name="unitPrice"]').attr('readonly',true);         $(".field-quantity").find('input[name="quantity"]').attr('readonly',true);     } } 
    Try the code above as well, fields doesn't stay readonly after save and adding an item after another.

    Comment


    • #3
      client/modules/advanced/src/views/quote/record/item.js

      PHP Code:
                  this.createView('listPrice''Advanced:QuoteItem.Fields.UnitPrice', {
                      
      modelthis.model,
                      
      defs: {
                          
      name'listPrice',
                      },
                      
      modethis.mode,
                      
      elthis.options.el ' .field-listPrice',
                      
      inlineEditDisabledtrue
                      
      readOnly: true // this
                  
      }, function (view) {
                      
      this.listenTo(view'change', function () {
                          
      setTimeout(function () {
                              
      this.trigger('change');
                          }.
      bind(this), 50);
                      }, 
      this);
                  }.
      bind(this)); 

      Comment


      • #4
        yuri If I want to get a template, as far writing the directory, is this correct?

        Code:
        var getTemp = this.getTemplate().get('clientDefs.res.templates.fields.float');
        The directory is, clientDefs/res/templates/fields/float/edit.tpl

        Comment


        • #5
          No.

          You can use regular ajax call to get template content.

          Comment


          • #6
            Please advise on how to make the Quote Item (Item List) read-only when the quote gets approved?

            Comment

            Working...
            X