Git Product home page Git Product logo

Comments (1)

eileenmcnaughton avatar eileenmcnaughton commented on August 21, 2024

OK - I have it editable with xeditable. I am finding that to improve it I need a js save function to use rather than a directive as I want to use 'onPreSave' to do a form rather than field by field

  <div ng-if="!options.contact_id">
    {{ts('No contact id provided')}}
  </div>
  <div ng-if="options.contact_id"
       afform-api3="['Contact', 'getsingle', {id: options.contact_id, return: 'first_name,last_name,email, middle_name, display_name, contact_type'}]"
       afform-api3-ctrl="contact">
    <form name="basicContact"
      onaftersave="crmApi4('Contact','update', {
        'where' :[['id','=', options.contact_id]],
        'values' : {
          last_name: contact['result'].last_name,
          first_name: contact['result'].first_name,
          middle_name: contact['result'].middle_name,
          email: contact['result'].email
        }
     })"
     onhide="contact.refresh()"
     editable-form crm-ui-id-scope>
    <h1 class="basic-contact-heading" ng-show="!contact['result'].display_name">{{options.display_name}}</h1>
    <div><h1 class="basic-contact-heading" ng-bind="contact['result'].display_name">{{contact['result'].display_name}}</h1></div>
    <div>
    </div>
    <div><strong class="basic-contact-field">{{ ts('First Name') }}</strong>: <span editable-text="contact['result'].first_name">{{contact['result'].first_name || ".."}}</span></div>
    <div><strong class="basic-contact-field">{{ ts('Middle Name') }}</strong>:<a href='#' editable-text="contact['result'].middle_name">{{contact['result'].middle_name || ".."}}</a></div>
    <div><strong class="basic-contact-field">{{ ts('Last Name') }}</strong>: <span editable-text="contact['result'].last_name">{{contact['result'].last_name || ".."}}</span></div>

    <div><strong class="basic-contact-field">{{ts('Primary Email')}}</strong>: <span editable-text="contact['result'].email">{{contact['result'].email || ".."}}</span></div>
    <div><strong class="basic-contact-field">{{ts('Contact ID')}}</strong>: <a target="_blank" ng-if="options.contact_url" href="{{options.contact_url}}{{contact['result'].contact_id}}">{{contact['result'].id}}</a></div>

    <p></p>

    <div class="buttons">
      <!-- button to show form -->
      <button type="button" class="btn btn-default" ng-click="basicContact.$show()" ng-show="!basicContact.$visible">
        Edit
      </button>
      <!-- buttons to submit / cancel form -->
      <span ng-show="basicContact.$visible">
        <button ng-disabled="basicContact.$waiting" class="btn btn-secondary">{{ts('Save')}}</button>
        <button type="button" class="btn btn-default" ng-disabled="basicContact.$waiting" ng-click="basicContact.$cancel()">
          Cancel
        </button>
      </span>
    </div>
  <div ng-if="options.contact_id"
       afform-api3="['Contribution', 'get', {contact_id: options.contact_id, 'sequential': 1, return : 'receive_date', options: {limit: 1, sort: 'receive_date DESC'}}]"
       afform-api3-ctrl="contribution">
    <div ng-show="contribution.result.values[0]"><div>{{ ts('Last Contributed on')}}</div><div></div><strong>{{contribution.result.values[0].receive_date}}</strong></div></div>
  </form>
</div>


from afform.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.