update col show

This commit is contained in:
Shaun Chyxion 2017-07-24 23:51:46 +08:00
parent 09befa7c9c
commit 10d54372c9
27 changed files with 95 additions and 68 deletions

View File

@ -92,9 +92,11 @@ public class CustomerServiceSupport
final String strYears = model.getYears();
final String strYtdSales = model.getYtdSales();
String[] years = null;
if (StringUtils.isNotBlank(strYears) &&
StringUtils.isNotBlank(strYtdSales)) {
final String[] years = strYears.split("\\s*,\\s*");
years = strYears.split("\\s*,\\s*");
final String[] sales = strYtdSales.split("\\s*,\\s*");
ytdSales = new ArrayList<>(years.length);
int i = 0;
@ -105,6 +107,8 @@ public class CustomerServiceSupport
ytdSales.add(ytdSale);
}
}
viewModel.setAttr("years", years != null ? years : new String[0]);
viewModel.setAttr("ytdSales", ytdSales != null ?
ytdSales : Collections.emptyList());
List<ViewModel<CustomerIssue>> recentIssues = customerIssueService.listViewModels(

View File

@ -1,10 +1,10 @@
# Server
server.port=8088
server.port=80
# MySQL
datasource.host=127.0.0.1
datasource.port=43306
datasource.port=3306
datasource.database-name=ambition_crm
datasource.username=root
datasource.password=696@2^~)oZ@^#*Q

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Properties>
<Property name="log.level">DEBUG</Property>
<Property name="log.dir">.logs</Property>
<Property name="log.level">INFO</Property>
<Property name="log.dir">/data/program/logs/${project.artifactId}</Property>
<Property name="pattern">%-d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%t][%c{1}] %m%n</Property>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%highlight{%-d{yyyy-MM-dd HH:mm:ss,SSS}}{FATAL=magenta, ERROR=magenta, WARN=magenta, INFO=magenta, DEBUG=magenta, TRACE=magenta} %highlight{%-5p}{FATAL=red blink, ERROR=red, WARN=yellow bold, INFO=black, DEBUG=green bold, TRACE=blue} [%t][%highlight{%c{1.}}{FATAL=cyan, ERROR=cyan, WARN=cyan, INFO=cyan, DEBUG=cyan, TRACE=cyan}] %m%n"/>
<PatternLayout pattern="${pattern}" />
</Console>
<RollingFile name="File"
fileName="${log.dir}/${project.artifactId}.log"
@ -32,7 +32,6 @@
</Logger>
<Root level="${log.level}" additivity="false">
<AppenderRef ref="File" level="${log.level}" />
<AppenderRef ref="Console" level="${log.level}" />
</Root>
</Loggers>
</Configuration>

View File

@ -1,4 +1,4 @@
# EChat-ota
# Ambition CRM
This README outlines the details of collaborating on this Ember application.
A short introduction of this app could easily go here.

View File

@ -43,7 +43,7 @@ export default BaseComponent.extend({
me.set('isUpdating', false);
}
else {
me.dialog.confirm('确认要更新吗?', () => {
me.dialog.confirm('Are you sure to update?', () => {
service.update(model, true);
me.set('isUpdating', false);
},

View File

@ -44,7 +44,7 @@ export default BaseComponent.extend({
save() {
let me = this;
if (!me.validate()) {
me.dialog.confirm('确认要提交吗?', () => {
me.dialog.confirm('Are you sure to submit?', () => {
me.postData().then((m) => {
Ember.Logger.info('Post Model Result: ', m);
// write back
@ -82,7 +82,7 @@ export default BaseComponent.extend({
alertMessage() {
let me = this;
me.message.alert(me.get('successMsg') ||
(me.isCreate() ? '创建成功' : '更新成功'));
(me.isCreate() ? 'Created successfully' : 'Updated successfully'));
},
getModel() {
return this.get('route.controller.model');

View File

@ -3,6 +3,7 @@ import Ember from 'ember';
export default Ember.Component.extend({
elementId: 'main-container',
classNames: ['main-container'],
sidebarCollapsed: false,
didInsertElement() {
let me = this;
// Ember.$('body').removeClass().addClass('login-layout blur-login');

View File

@ -7,9 +7,12 @@ export default BaseComponent.extend({
role: 'button',
rel: 'tooltip',
href: 'javascript:;',
enabledText: 'Enable',
disabledText: 'Disable',
enabled: Ember.computed.alias('model.enabled'),
title: Ember.computed('enabled', function() {
return this.get('enabled') ? '禁用' : '启用';
let me = this;
return this.get('enabled') ? me.get('disabledText') : me.get('enabledText');
}),
iconSizeClass: 'bigger-120',
didReceiveAttrs() {
@ -27,7 +30,7 @@ export default BaseComponent.extend({
},
click() {
let me = this;
me.dialog.confirm('确认要' + me.get('title') + '状态么?', () => {
me.dialog.confirm('Are you sure to ' + me.get('title') + ' row?', () => {
let model = me.get('model');
Ember.set(model, 'enabled', !me.get('enabled'));
let params = me.get('params');

View File

@ -28,7 +28,7 @@ export default BaseComponent.extend({
me.ajax.doPost(false, 'auth/logout', () => {
me.set('user', null);
Ember.$.sessionStorage.set('user', null);
me.get('message').alert('注销成功');
me.get('message').alert('Sign out successfully');
me.get('router').transitionTo('login');
});
}

View File

@ -36,7 +36,7 @@ export default Ember.Mixin.create({
Object.keys(m).forEach((prop) => {
Ember.set(model, prop, m[prop]);
});
me.get('message').alert('更新成功');
me.get('message').alert('Updated successfully');
})
}
return p;

View File

@ -30,7 +30,9 @@ Router.map(function() {
this.route('edit', {path: '/:id/edit'}, function() {
this.route('customer-status-select', {path: '/customer-status-select/:page'});
});
this.route('show', {path: '/:id/show'});
this.route('show', {path: '/:id/show'}, function() {
this.route('customer-status-select', {path: '/customer-status-select/:page'});
});
});
this.route('customer-ytd-sale', function() {

View File

@ -4,7 +4,7 @@ import BaseListRoute from './../base-list';
const cols = ['showId',
'showName',
'showDateAdded',
'showYear',
'showYears',
'showYtdSale',
'showCountryCode',
'showState',
@ -39,16 +39,16 @@ const config = {
me.set('lock', false);
me.set('countOfShowing', cols.filter(col => {
return me[col];
}).length);
}).length + 1);
}))
};
cols.forEach((col) => {
config[col] = !['showYear', 'showCountryCode', 'showState', 'showCity'].includes(col);
config[col] = !['showCountryCode', 'showState', 'showCity'].includes(col);
});
config.countOfShowing = cols.filter(col => {
return config[col];
}).length;
}).length + 1;
const TableOptions = Ember.Object.extend(config);

View File

@ -3,8 +3,13 @@ import BaseEditRoute from '../base-edit';
export default BaseEditRoute.extend({
afterModel(model) {
this.set('breadcrumbs',
let me = this;
me.set('breadcrumbs',
[{route: 'customer.list', params: 1, text: 'Customers'},
{text: 'Show Customer [' + model.id + ']'}]);
Ember.addObserver(model, 'status', function() {
Ember.Logger.info('Model Status Changed: ', model);
me.get('service').update(model, true);
});
}
});

View File

@ -15,7 +15,7 @@ export default Ember.Route.extend({
Ember.Logger.debug(`User ${user} Loggedin`);
Ember.$.sessionStorage.set('user', user);
me.set('ajax.user', user);
me.message.alert('登录成功');
me.message.alert('Sign in successfully');
// Log the user in, then reattempt previous transition if it exists.
let prevTransition = me.get('prevTransition');
if (prevTransition) {

View File

@ -9,7 +9,7 @@ export default Ember.Service.extend({
message: msg,
buttons: {
danger: {
label: '关闭',
label: 'Close',
className: 'btn-danger',
callback: fnClose || Ember.$.noop
}
@ -21,12 +21,12 @@ export default Ember.Service.extend({
message: msg,
buttons: {
success: {
label: '确定',
label: 'OK',
className: 'btn-success',
callback: fnYes
},
danger: {
label: '取消',
label: 'Cancel',
className: 'btn-danger',
callback: fnNo || Ember.$.noop
}

View File

@ -13,7 +13,7 @@
{{outlet}}
{{else}}
{{top-navbar}}
{{#main-container}}
{{#main-container sidebarCollapsed=true}}
{{outlet}}
{{/main-container}}
{{/if}}

View File

@ -19,7 +19,7 @@
rel="tooltip"
title=selectText}}
<i class="ace-icon {{if isFaBtnIcon 'fa' 'glyphicon'}} {{btnIcon}} bigger-110"></i>
选择
Select
{{/link-to}}
</span>
</div>

View File

@ -1,5 +1,5 @@
<!-- #section:basics/sidebar -->
<div id="sidebar" class="sidebar responsive">
<div id="sidebar" class="sidebar responsive {{if sidebarCollapsed 'menu-min'}}">
<div class="sidebar-shortcuts" id="sidebar-shortcuts">
{{#if ajax.user.admin}}
@ -35,7 +35,7 @@
<li class="">
{{#link-to 'user.list' 1}}
<i class="menu-icon fa fa-user blue"></i>
<span class="menu-text"> User </span>
<span class="menu-text"> Users </span>
{{/link-to}}
</li>
{{/if}}
@ -43,7 +43,7 @@
<li class="">
{{#link-to 'customer.list' 1}}
<i class="menu-icon fa fa-address-book-o blue"></i>
<span class="menu-text"> Customer </span>
<span class="menu-text"> Customers </span>
{{/link-to}}
</li>
{{#if ajax.user.admin}}

View File

@ -6,10 +6,11 @@
<div class="modal-footer no-margin-top">
<button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">
<i class="ace-icon fa fa-times"></i>
取消
Cancel
</button>
<button type="button" class="btn btn-sm btn-primary" {{action (if submit submit (route-action 'submit'))}}>
<i class="ace-icon fa fa-check"></i>
确定</button>
OK
</button>
</div>
{{/modal-frame}}

View File

@ -309,14 +309,14 @@
<li>
{{#link-to 'user.update-password'}}
<i class="ace-icon fa fa-cog"></i>
修改密码
Change Password
{{/link-to}}
</li>
<li>
{{#link-to 'user.profile'}}
<i class="ace-icon fa fa-user"></i>
个人信息
Profile
{{/link-to}}
</li>
@ -325,7 +325,7 @@
<li>
<a href="#" {{action 'logout'}}>
<i class="ace-icon fa fa-power-off"></i>
注销登录
Sign Out
</a>
</li>
</ul>

View File

@ -11,7 +11,7 @@
<div class="widget-body">
<!-- #section:custom/scrollbar -->
<div class="widget-main no-padding">
<table class="table table-striped table-bordered table-hover dataTable">
<table class="table table-striped table-bordered table-hover dataTable" style="border: 1px solid #ddd;">
<thead class="thin-border-bottom">
<tr>
<th>

View File

@ -1,12 +1,12 @@
{{#form-content}}
{{form-input name='id' label='客户编号' readonly='readonly'}}
{{form-input name='name' label='客户名称' readonly='readonly'}}
{{form-input name='countryCode' label='国家编号' readonly='readonly'}}
{{form-input name='state' label='省份' readonly='readonly'}}
{{form-input name='city' label='城市' readonly='readonly'}}
{{form-input name='id' label='Customer ID' readonly='readonly'}}
{{form-input name='name' label='Name' readonly='readonly'}}
{{form-input name='countryCode' label='Country Code' readonly='readonly'}}
{{form-input name='state' label='State' readonly='readonly'}}
{{form-input name='city' label='City' readonly='readonly'}}
{{form-input name='ms' label='MS' readonly='readonly'}}
{{form-input name='region' label='地区' readonly='readonly'}}
{{form-input name='salesperson' label='销售' readonly='readonly'}}
{{form-input name='region' label='Region' readonly='readonly'}}
{{form-input name='salesperson' label='Salesperson' readonly='readonly'}}
{{form-input type='hidden' name='enabled'}}
{{form-input-modal-select
@ -14,7 +14,7 @@
idField='status'
nameField='statusText'
btnIcon='fa-file-image-o'
label='客户状态'}}
label='Status'}}
<hr />
{{form-footer-buttons type='update'}}
{{/form-content}}

View File

@ -26,7 +26,7 @@
<div class="widget-body">
<!-- #section:custom/scrollbar -->
<div class="widget-main no-padding">
<table class="table table-striped table-bordered table-hover dataTable">
<table class="table table-striped table-bordered table-hover dataTable" style="border: 1px solid #ddd;">
<thead class="thin-border-bottom">
<tr>
{{#if tableOptions.showId}}
@ -38,7 +38,7 @@
{{#if tableOptions.showDateAdded}}
<th>Added</th>
{{/if}}
{{#if tableOptions.showYear}}
{{#if tableOptions.showYears}}
<th>Years</th>
{{/if}}
{{#if tableOptions.showYtdSale}}
@ -101,27 +101,33 @@
{{date-cell value=it.dateAdded format='D/M/YYYY'}}
</td>
{{/if}}
{{#if tableOptions.showYear}}
{{#if tableOptions.showYears}}
<td>
{{it.years}}
{{#if (eq it.years.length 1)}}
{{it.years.firstObject}}
{{else if (gt it.years.length 1)}}
{{it.years.firstObject}}-{{it.years.lastObject}}
{{/if}}
</td>
{{/if}}
{{#if tableOptions.showYtdSale}}
<td>
{{#if it.sumYtdSales}}
{{#if it.expand}}
<a style="cursor: pointer;" {{action (route-action 'collapseYtdSales' it)}}>
<span class="ui-icon ace-icon fa fa-minus center bigger-110 blue">
</span>
</a>
{{else}}
<a style="cursor: pointer;" {{action (route-action 'expandYtdSales' it)}}>
<span class="ui-icon ace-icon fa fa-plus center bigger-110 blue">
</span>
</a>
<div>
{{#if it.sumYtdSales}}
{{#if it.expand}}
<a style="cursor: pointer;" {{action (route-action 'collapseYtdSales' it)}}>
<span class="ui-icon ace-icon fa fa-minus center bigger-110 blue">
</span>
</a>
{{else}}
<a style="cursor: pointer;" {{action (route-action 'expandYtdSales' it)}}>
<span class="ui-icon ace-icon fa fa-plus center bigger-110 blue">
</span>
</a>
{{/if}}
{{/if}}
{{/if}}
{{number-us it.sumYtdSales}}
</div>
</td>
{{/if}}
{{#if tableOptions.showCountryCode}}

View File

@ -14,6 +14,7 @@
<div class="control-group">
{{ace-checkbox label='ID' value=model.tableOptions.showId}}
{{ace-checkbox label='Name' value=model.tableOptions.showName}}
{{ace-checkbox label='Years' value=model.tableOptions.showYears}}
{{ace-checkbox label='Date Added' value=model.tableOptions.showDateAdded}}
{{ace-checkbox label='YTD Sales' value=model.tableOptions.showYtdSale}}
{{ace-checkbox label='Country' value=model.tableOptions.showCountryCode}}

View File

@ -8,7 +8,12 @@
{{form-input type='show' name='region' label='Region'}}
{{form-input type='show' name='salesperson' label='Salesperson'}}
{{form-input type='show' name='statusText' label='Status'}}
{{form-input-modal-select
listRoute='customer.show.customer-status-select'
idField='status'
nameField='statusText'
btnIcon='fa-file-image-o'
label='Status'}}
{{!form-input-enabled}}
{{!form-input name='note' label='备注'}}
@ -16,7 +21,7 @@
<div class="widget-box transparent">
<div class="widget-header widget-header-small">
<div class="widget-toolbar action-buttons">
{{#link-to 'customer-issue.create' model.id title='新建'}}
{{#link-to 'customer-issue.create' model.id title='Create'}}
<i class="ace-icon fa fa-file-text-o blue"></i>
{{/link-to}}
</div>
@ -66,8 +71,5 @@
</div>
</div>
{{/form-input}}
{{!--<hr />--}}
{{!form-footer-buttons type='update'}}
{{/form-content}}
{{outlet}}

View File

@ -11,7 +11,7 @@
<div class="widget-body">
<!-- #section:custom/scrollbar -->
<div class="widget-main no-padding">
<table class="table table-striped table-bordered table-hover dataTable">
<table class="table table-striped table-bordered table-hover dataTable" style="border: 1px solid #ddd;">
<thead class="thin-border-bottom">
<tr>
{{sortable-th name='employeeId' text='Employee ID'}}
@ -64,7 +64,7 @@
</td>
<td>
<div class="hidden-sm hidden-xs btn-group">
{{status-toggle-button model=it}}
{{status-toggle-button model=it enabledText='active' disabledText='block'}}
{{#link-to 'user.edit' it.id class='btn btn-xs btn-info' title='Edit User'}}
<i class="ace-icon fa fa-pencil bigger-120"></i>
{{/link-to}}
@ -78,7 +78,7 @@
<ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">
<li>
{{status-toggle-button model=it iconOnly=true}}
{{status-toggle-button model=it iconOnly=true enabledText='active' disabledText='block'}}
</li>
<li>

View File

@ -15,6 +15,7 @@ get_real_path() {
eval "$2"="'$f'"
}
currDir=$(pwd)
get_real_path "$0" prg_path
echo "Script Path [$prg_path]"
@ -26,4 +27,6 @@ popd > /dev/null
# ember build
targetPath="$PROJECT_HOME/server/crm/src/main/resources/static"
rm -rf "$targetPath"
cd "$PROJECT_HOME/web"
ember b -prod -o "$targetPath"
cd "$currDir"