diff --git a/app/app/components/submit-modal.js b/app/app/components/submit-modal.js index 05d93b5..c07e68a 100644 --- a/app/app/components/submit-modal.js +++ b/app/app/components/submit-modal.js @@ -8,6 +8,7 @@ import mutation from 'cuf/gql/mutations/company'; const fields = [ 'address1', 'address2', + 'teaser', 'body', 'city', 'country', @@ -21,6 +22,15 @@ const fields = [ 'zip', 'sectionIds', 'logo', + 'numberOfEmployees', + 'trainingInformation', + 'yearsInOperation', + 'salesRegion', + 'servicesProvided', + 'salesChannels', + 'productSummary', + 'serviceInformation', + 'warrantyInformation', ]; const filterModel = (model = {}) => { diff --git a/app/app/controllers/display/company.js b/app/app/controllers/display/company.js index 43a2406..d9e3fd0 100644 --- a/app/app/controllers/display/company.js +++ b/app/app/controllers/display/company.js @@ -1,6 +1,63 @@ import Controller from '@ember/controller'; import { computed } from '@ember/object'; +const fields = [ + [ + { label: 'Name', key: 'name' } + ], + [ + { label: 'Address 1', key: 'address1', class: 'col-md-4' }, + { label: 'Address 2', key: 'address2', class: 'col-md-4' }, + { label: 'City', key: 'city', class: 'col-md-4' }, + ], + [ + { label: 'State', key: 'state', class: 'col-md-4' }, + { label: 'Zip/Postal Code', key: 'zip', class: 'col-md-4' }, + { label: 'Country', key: 'country', class: 'col-md-4' }, + ], + [ + { label: 'Phone Number', key: 'phone', class: 'col-md-4' }, + { label: 'Phone (Toll-free)', key: 'tollfree', class: 'col-md-4' }, + { label: 'Fax Number', key: 'fax', class: 'col-md-4' }, + ], + [ + { label: 'Website', key: 'website', class: 'col-md-6' }, + { label: 'Email Address', key: 'email', class: 'col-md-6' }, + ], + [ + { label: 'Teaser', key: 'teaser', type: 'long' }, + ], + [ + { label: 'Description', key: 'body', type: 'long' }, + ], +]; + +const extra = [ + [ + { label: 'Number of employees', key: 'numberOfEmployees', class: 'col-md-6' }, + { label: 'Years in operation', key: 'yearsInOperation', class: 'col-md-6' }, + ], + [ + { label: 'Sales regions', key: 'salesRegion', class: 'col-md-6' }, + { label: 'Sales channels', key: 'salesChannels', class: 'col-md-6' }, + ], + [ + { label: 'Product summary', key: 'productSummary', type: 'long' }, + ], + [ + { label: 'Training information', key: 'trainingInformation', type: 'long' }, + ], + [ + { label: 'Services provided', key: 'servicesProvided', type: 'long' }, + ], + [ + { label: 'Warranty information', key: 'warrantyInformation', type: 'long' }, + ], + [ + { label: 'Service information', key: 'serviceInformation', type: 'long' }, + ], +]; + export default Controller.extend({ // Merges contacts into a single array contacts: computed('model.{salesContacts,listingContacts,publicContacts}.[]', function() { @@ -15,83 +72,12 @@ export default Controller.extend({ }), // Determines display order, labels, and visibility/type of updateable fields - fields: [ // eslint-disable-line ember/avoid-leaking-state-in-ember-objects - [ - { - label: 'Name', - key: 'name', - } - ], - [ - { - label: 'Address 1', - key: 'address1', - class: 'col-md-4', - }, - { - label: 'Address 2', - key: 'address2', - class: 'col-md-4', - }, - { - label: 'City', - key: 'city', - class: 'col-md-4', - }, - ], - [ - { - label: 'State', - key: 'state', - class: 'col-md-4', - }, - { - label: 'Zip/Postal Code', - key: 'zip', - class: 'col-md-4', - }, - { - label: 'Country', - key: 'country', - class: 'col-md-4', - }, - ], - [ - { - label: 'Phone Number', - key: 'phone', - class: 'col-md-4', - }, - { - label: 'Phone (Toll-free)', - key: 'tollfree', - class: 'col-md-4', - }, - { - label: 'Fax Number', - key: 'fax', - class: 'col-md-4', - }, - ], - [ - { - label: 'Website', - key: 'website', - class: 'col-md-6', - }, - { - label: 'Email Address', - key: 'email', - class: 'col-md-6', - }, - ], - [ - { - label: 'Description', - key: 'body', - type: 'long', - }, - ], - ], -}); + fields: null, + extra: null, + init() { + this._super(); + this.set('fields', fields); + this.set('extra', extra); + }, +}); diff --git a/app/app/gql/queries/company.graphql b/app/app/gql/queries/company.graphql index e8f5706..da46722 100644 --- a/app/app/gql/queries/company.graphql +++ b/app/app/gql/queries/company.graphql @@ -1,6 +1,7 @@ query PlatformContentHash($input: Base4PlatformContentQueryHash!) { base4PlatformContentHash(input: $input) { name + teaser hash type body @@ -27,6 +28,17 @@ query PlatformContentHash($input: Base4PlatformContentQueryHash!) { fax website email + + numberOfEmployees + trainingInformation + yearsInOperation + salesRegion + servicesProvided + salesChannels + productSummary + serviceInformation + warrantyInformation + # sections { # name # children { diff --git a/app/app/styles/app.scss b/app/app/styles/app.scss index 4a21d6b..667f472 100644 --- a/app/app/styles/app.scss +++ b/app/app/styles/app.scss @@ -49,3 +49,7 @@ body.transitioning { border: 1px solid rgb(24, 188, 156); border-right: none; } + +.froala-editor-container { + min-width: 100%; +} diff --git a/app/app/templates/display/company/edit/fields.hbs b/app/app/templates/display/company/edit/fields.hbs index 906d0e1..2a986f9 100644 --- a/app/app/templates/display/company/edit/fields.hbs +++ b/app/app/templates/display/company/edit/fields.hbs @@ -1,7 +1,16 @@ {{#each fields as |row|}} -
- {{#each row as |field|}} - {{ edit-field field=field value=(get model field.key)}} - {{/each}} -
+
+ {{#each row as |field|}} + {{ edit-field field=field value=(get model field.key)}} + {{/each}} +
{{/each}} +{{#if config.isPmmi}} + {{#each extra as |row|}} +
+ {{#each row as |field|}} + {{ edit-field field=field value=(get model field.key)}} + {{/each}} +
+ {{/each}} +{{/if}} diff --git a/app/app/templates/display/company/review/fields.hbs b/app/app/templates/display/company/review/fields.hbs index 52aa794..e986fbb 100644 --- a/app/app/templates/display/company/review/fields.hbs +++ b/app/app/templates/display/company/review/fields.hbs @@ -24,3 +24,31 @@ {{/each}} {{/each}} +{{#if config.isPmmi}} + {{#each extra as |row|}} +
+ {{#each row as |field|}} +
+
+ +
+ {{#if (eq field.type "long")}} +
+ {{ froala-editor content=(get model.submission.payload field.key) options=options }} +
+ {{else}} +
+ {{ get model.submission.payload field.key }} +
+ {{/if}} + {{#unless (eq (get model.company field.key) (get model.submission.payload field.key))}} + {{ copyable-text value=(get model.submission.payload field.key)}} + {{/unless}} +
+ {{ field.helpText }} +
+
+ {{/each}} +
+ {{/each}} +{{/if}} diff --git a/graph/src/definitions/index.js b/graph/src/definitions/index.js index 7ad2ad2..a8fb81f 100644 --- a/graph/src/definitions/index.js +++ b/graph/src/definitions/index.js @@ -85,6 +85,17 @@ module.exports = gql` email: String body: String + teaser: String + numberOfEmployees: String + trainingInformation: String + yearsInOperation: String + salesRegion: String + servicesProvided: String + salesChannels: String + productSummary: String + serviceInformation: String + warrantyInformation: String + # contacts: [ContactPayloadInput] sectionIds: [Int!] # images: [ImagePayloadInput]