From d3d964cff63061ff33f7d498afaeff5a4301c43e Mon Sep 17 00:00:00 2001 From: Shaun Chyxion Date: Sat, 5 Aug 2017 14:53:36 +0800 Subject: [PATCH] update tooltip --- .gitignore | 1 + .../support/CustomerServiceSupport.java | 5 +- web/.eslintrc.js | 13 ++++ web/app/components/grid-header.js | 3 +- web/app/components/reload-btn.js | 1 + web/app/components/status-toggle-button.js | 17 ++++- web/app/routes/customer/list.js | 2 +- web/app/routes/login.js | 1 - web/app/templates/components/grid-header.hbs | 18 +++-- web/app/templates/components/search-box.hbs | 10 ++- web/app/templates/customer-status/list.hbs | 14 ++-- web/app/templates/customer/list.hbs | 66 +++++++++++-------- web/app/templates/customer/show.hbs | 5 +- web/app/templates/user/list.hbs | 16 ++--- web/ember-cli-build.js | 2 +- web/run | 5 +- 16 files changed, 115 insertions(+), 64 deletions(-) create mode 100644 web/.eslintrc.js diff --git a/.gitignore b/.gitignore index 26d5f30..f5a5cbd 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ !.editorconfig !.ember-cli !.jshintrc +!.eslintrc.js !.travis.yml !.watchmanconfig !.gitignore diff --git a/server/crm/src/main/java/com/pudonghot/ambition/crm/service/support/CustomerServiceSupport.java b/server/crm/src/main/java/com/pudonghot/ambition/crm/service/support/CustomerServiceSupport.java index 5f4986e..4b015c3 100644 --- a/server/crm/src/main/java/com/pudonghot/ambition/crm/service/support/CustomerServiceSupport.java +++ b/server/crm/src/main/java/com/pudonghot/ambition/crm/service/support/CustomerServiceSupport.java @@ -111,7 +111,10 @@ public class CustomerServiceSupport viewModel.setAttr("years", years != null ? years : new String[0]); viewModel.setAttr("ytdSales", ytdSales != null ? ytdSales : Collections.emptyList()); - List> recentIssues = customerIssueService.listViewModels( + + // recent 3 issues + List> recentIssues = + customerIssueService.listViewModels( new Search(CustomerYearToDateSale.CUSTOMER_ID, model.getId()) .eq(CustomerYearToDateSale.ENABLED, true) .desc(CustomerYearToDateSale.DATE_CREATED) diff --git a/web/.eslintrc.js b/web/.eslintrc.js new file mode 100644 index 0000000..2873e2f --- /dev/null +++ b/web/.eslintrc.js @@ -0,0 +1,13 @@ +module.exports = { + root: true, + parserOptions: { + ecmaVersion: 2017, + sourceType: 'module' + }, + extends: 'eslint:recommended', + env: { + browser: true + }, + rules: { + } +}; diff --git a/web/app/components/grid-header.js b/web/app/components/grid-header.js index 7a8566c..d67ed90 100644 --- a/web/app/components/grid-header.js +++ b/web/app/components/grid-header.js @@ -1,5 +1,6 @@ import Ember from 'ember'; export default Ember.Component.extend({ - classNames: ['widget-header'] + classNames: ['widget-header'], + dropdownMenu: true }); diff --git a/web/app/components/reload-btn.js b/web/app/components/reload-btn.js index 54c29ae..ab3ff0a 100644 --- a/web/app/components/reload-btn.js +++ b/web/app/components/reload-btn.js @@ -6,6 +6,7 @@ export default BaseComponent.extend({ tagName: 'a', classNames: ['cursor-pointer'], attributeBindings: ['title'], + 'data-rel': 'tooltip', title: 'Reload', click() { this.get('route').refresh(); diff --git a/web/app/components/status-toggle-button.js b/web/app/components/status-toggle-button.js index c5f401f..3e3440a 100644 --- a/web/app/components/status-toggle-button.js +++ b/web/app/components/status-toggle-button.js @@ -3,16 +3,24 @@ import BaseComponent from './base-component'; export default BaseComponent.extend({ tagName: 'a', - attributeBindings: ['title', 'role', 'rel'], + attributeBindings: ['title', 'role', 'data-rel'], role: 'button', - rel: 'tooltip', + 'data-rel': 'tooltip', enabledText: 'Enable', disabledText: 'Disable', + enabledOp: 'enable', + disabledOp: 'disable', enabled: Ember.computed.alias('model.enabled'), title: Ember.computed('enabled', function() { let me = this; return this.get('enabled') ? me.get('disabledText') : me.get('enabledText'); }), + op: Ember.computed('enabled', function() { + let me = this; + return this.get('enabled') ? + me.get('disabledOp') || me.get('disabledText') + : me.get('enabledOp') || me.get('enabledText'); + }), iconSizeClass: 'bigger-120', didReceiveAttrs() { let me = this; @@ -27,6 +35,11 @@ export default BaseComponent.extend({ 'iconOnly::btn-xs']); } }, + didInsertElement() { + let me = this; + me._super(...arguments); + me.$().tooltip(); + }, click() { let me = this; me.dialog.confirm('Are you sure to ' + me.get('title') + ' row?', () => { diff --git a/web/app/routes/customer/list.js b/web/app/routes/customer/list.js index fa27ad6..21f00cb 100644 --- a/web/app/routes/customer/list.js +++ b/web/app/routes/customer/list.js @@ -18,7 +18,7 @@ const cols = ['showId', 'showIssue3', ]; const config = { - showAll: true, + showAll: false, showAllChanged: Ember.observer('showAll', function() { let me = this; if (!me.get('lock')) { diff --git a/web/app/routes/login.js b/web/app/routes/login.js index 3964674..f634eba 100644 --- a/web/app/routes/login.js +++ b/web/app/routes/login.js @@ -13,7 +13,6 @@ export default Ember.Route.extend({ me.get('ajax').doPost('auth/login', model, function(user) { Ember.Logger.debug(`User ${user} Loggedin`); - Ember.$.sessionStorage.set('user', user); me.set('ajax.user', user); me.message.alert('Sign in successfully'); me.transitionTo('index'); diff --git a/web/app/templates/components/grid-header.hbs b/web/app/templates/components/grid-header.hbs index 98c5bb7..eed323e 100644 --- a/web/app/templates/components/grid-header.hbs +++ b/web/app/templates/components/grid-header.hbs @@ -1,13 +1,17 @@
{{#if hasBlock}} -
- - - - -
+ {{/if}} {{/if}} {{reload-btn}}
diff --git a/web/app/templates/components/search-box.hbs b/web/app/templates/components/search-box.hbs index e25a19a..ff1f476 100644 --- a/web/app/templates/components/search-box.hbs +++ b/web/app/templates/components/search-box.hbs @@ -4,6 +4,14 @@ placeholder="Search ..." value=searchText insert-newline='search' + focus-out='search' }} - \ No newline at end of file + +{{!-- + +--}} \ No newline at end of file diff --git a/web/app/templates/customer-status/list.hbs b/web/app/templates/customer-status/list.hbs index 3742d5a..b55efcc 100644 --- a/web/app/templates/customer-status/list.hbs +++ b/web/app/templates/customer-status/list.hbs @@ -17,7 +17,7 @@ Name - + Remark @@ -38,7 +38,7 @@ {{it.name}} - + {{editable-cell model=it field='note'}} @@ -72,7 +72,6 @@
  • {{status-toggle-button model=it iconOnly=true}}
  • -
  • {{#link-to 'customer-status.edit' it.id class='tooltip-info' data-rel='tooltip' title='Edit'}} @@ -80,17 +79,16 @@ {{/link-to}}
  • -
  • {{#if (not-eq model.data.firstObject.id it.id)}} - + {{/if}} {{#if (not-eq model.data.lastObject.id it.id)}} - + {{/if}}
  • diff --git a/web/app/templates/customer/list.hbs b/web/app/templates/customer/list.hbs index d984eeb..c6501ec 100644 --- a/web/app/templates/customer/list.hbs +++ b/web/app/templates/customer/list.hbs @@ -1,26 +1,36 @@ {{#main-content}}
    - {{#grid-header}} - {{#if ajax.user.admin}} -
  • - {{#link-to 'customer.import'}} - - Import Customers + {{#grid-header dropdownMenu=false}} +
    + {{#link-to 'customer.list.advanced-query' data-rel="tooltip" title='Advanced Query'}} + {{/link-to}} -
  • -
  • - {{#link-to 'customer-ytd-sale.import'}} - - Import Sales Data - {{/link-to}} -
  • - {{/if}} -
  • - {{#link-to 'customer.list.advanced-query'}} - - Advanced Query - {{/link-to}} -
  • + + + + +
    {{/grid-header}}
    @@ -36,7 +46,7 @@ Name {{/if}} {{#if tableOptions.showDateAdded}} - {{sortable-th name='dateAdded' text='Added'}} + {{sortable-th name='dateAdded' text='Added' class='hidden-480'}} {{/if}} {{#if tableOptions.showYears}} Years @@ -60,7 +70,7 @@ {{sortable-th name='region' text='Region' class='hidden-480'}} {{/if}} {{#if tableOptions.showSalesperson}} - {{sortable-th name='salesperson' text='Salesperson'}} + {{sortable-th name='salesperson' text='Salesperson' class='hidden-480'}} {{/if}} {{#if tableOptions.showStatus}} Status @@ -97,7 +107,7 @@ {{/if}} {{#if tableOptions.showDateAdded}} - + {{date-cell value=it.dateAdded format='D/M/YYYY'}} {{/if}} @@ -156,17 +166,17 @@ {{/if}} {{#if tableOptions.showSalesperson}} - + {{it.salesperson}} {{/if}} {{#if tableOptions.showStatus}} - + {{it.statusText}} {{/if}} {{#if tableOptions.showIssue1}} - + {{#if it.issue1}}
    {{it.issue1.issue}} @@ -184,7 +194,7 @@ {{/if}} {{#if tableOptions.showIssue2}} - + {{#if it.issue2}}
    {{it.issue2.issue}} @@ -199,7 +209,7 @@ {{/if}} {{#if tableOptions.showIssue3}} - + {{#if it.issue3}}
    {{it.issue3.issue}} diff --git a/web/app/templates/customer/show.hbs b/web/app/templates/customer/show.hbs index 492c305..c08de5d 100644 --- a/web/app/templates/customer/show.hbs +++ b/web/app/templates/customer/show.hbs @@ -42,7 +42,7 @@ Name - + Name(EN) @@ -52,7 +52,6 @@ {{log model.users}} {{#each model.users as |u|}} - {{log u}} {{u.employeeId}} @@ -62,7 +61,7 @@ {{u.name}} - + {{u.enName}} diff --git a/web/app/templates/user/list.hbs b/web/app/templates/user/list.hbs index 501d985..4000bfd 100644 --- a/web/app/templates/user/list.hbs +++ b/web/app/templates/user/list.hbs @@ -15,11 +15,11 @@ {{sortable-th name='employeeId' text='Employee ID'}} - {{sortable-th name='account' text='Account'}} + {{sortable-th name='account' text='Account' class="hidden-480"}} Name - {{sortable-th name='enName' text='Name(EN)'}} + {{sortable-th name='enName' text='Name(EN)' class="hidden-480"}} Admin @@ -27,7 +27,7 @@ Remark - + Status @@ -44,13 +44,13 @@ {{it.employeeId}} - + {{it.account}} {{it.name}} - + {{it.enName}} @@ -59,13 +59,13 @@ {{editable-cell model=it field='note'}} - + {{status-cell model=it field='enabled' enabledText='ACTIVE' disabledText='BLOCKED'}} diff --git a/web/ember-cli-build.js b/web/ember-cli-build.js index 726774f..4e61d37 100644 --- a/web/ember-cli-build.js +++ b/web/ember-cli-build.js @@ -62,7 +62,7 @@ module.exports = function(defaults) { importVendor(app, 'bower_components/bootbox/bootbox.js'); importVendor(app, 'bower_components/validate/validate.js'); - importVendor(app, 'bower_components/jquery-storage-api/jquery.storageapi.min.js'); + // FueUX importVendor(app, 'bower_components/fuelux/js/spinbox.js'); importVendor(app, 'bower_components/fuelux/js/tree.js'); diff --git a/web/run b/web/run index ec5b62e..51be143 100755 --- a/web/run +++ b/web/run @@ -1,2 +1,3 @@ -# ember s --proxy http://127.0.0.1:8088/ -ember s --proxy http://101.236.35.13/ +rm -rf tmp dist +ember s --proxy http://127.0.0.1:8088/ +# ember s --proxy http://101.236.35.13/