remove application sort, order by name, increase comment width

This commit is contained in:
Shaun Chyxion 2018-02-23 14:08:30 +08:00
parent 268ccb19b4
commit bc3a90d9b1
11 changed files with 68 additions and 35 deletions

View File

@ -62,6 +62,7 @@ public class CustomerController
SORT_COLS.put(Customer.SALESPERSON, "customer.salesperson");
SORT_COLS.put("sumYtdSales", Customer.SUM_YTD_SALES);
SORT_COLS.put("status", "prop.sort");
SORT_COLS.put("application", "application_names");
}
private static final Map<String, String> CRITERION_COLS;

View File

@ -1,6 +1,5 @@
package com.pudonghot.ambition.crm.controller;
import java.util.List;
import javax.validation.Valid;
import com.alibaba.fastjson.JSONArray;
import me.chyxion.tigon.mybatis.Search;
@ -38,7 +37,7 @@ public class CustomerPropertyController
@RequestParam(value = "start", defaultValue = "0")
final int start,
@Min(1)
@Max(512)
@Max(2048)
@RequestParam(value = "limit", defaultValue = "16")
final int limit,
@NotNull
@ -58,20 +57,20 @@ public class CustomerPropertyController
return listViewModels(search, start, limit, strSearch, null);
}
@RequestMapping("/list-for-select")
public List<ViewModel<CustomerProperty>> listForSelect(
@NotNull
@RequestParam("type")
final CustomerProperty.Type type,
@RequestParam(value = "enabled", required = false)
final String enabled) {
final Search search = new Search(CustomerProperty.TYPE, type)
.asc(CustomerProperty.SORT);
@RequestMapping("/app-list")
public ListResult<ViewModel<CustomerProperty>> applist(
@RequestParam(value = "enabled", required = false)
final String enabled,
@RequestParam(value = "search", required = false)
final String strSearch) {
final Search search = new Search(CustomerProperty.TYPE,
CustomerProperty.Type.APPLICATION)
.asc(CustomerProperty.NAME);
if (StringUtils.isNotBlank(enabled)) {
search.eq(CustomerProperty.ENABLED,
Boolean.parseBoolean(enabled));
search.eq(CustomerProperty.ENABLED, Boolean.parseBoolean(enabled));
}
return queryService.listViewModels(search);
return listViewModels(search, null, null, strSearch, null);
}
@RequiresRoles(User.ROLE_ADMIN)

View File

@ -84,7 +84,7 @@ public class CustomerServiceSupport
customerPropertyMapper.list(
new Search(CustomerProperty.TYPE,
CustomerProperty.Type.APPLICATION)
.asc(CustomerProperty.SORT)));
.asc(CustomerProperty.NAME)));
}
return viewModel;
@ -126,7 +126,7 @@ public class CustomerServiceSupport
result.setAttr("applicationList", customerPropertyMapper.list(
new Search(CustomerProperty.TYPE,
CustomerProperty.Type.APPLICATION)
.asc(CustomerProperty.SORT)));
.asc(CustomerProperty.NAME)));
return result;
}

View File

@ -179,13 +179,21 @@
where customer_id = customer.id
and enabled = 1) count_ytd_sales,
<!-- applications -->
(select group_concat(p.id order by p.sort separator ',')
<!-- application ids -->
(select group_concat(p.id order by p.name separator ',')
from crm_customer_application a
join crm_customer_property p
on a.property_id = p.id
where a.customer_id = customer.id
group by a.customer_id) applications
group by a.customer_id) applications,
<!-- applications names -->
(select group_concat(p.name order by p.name separator ',')
from crm_customer_application a
join crm_customer_property p
on a.property_id = p.id
where a.customer_id = customer.id
group by a.customer_id) application_names
from <include refid="table" /> customer
</sql>

View File

@ -3,7 +3,7 @@ import CustomerPropertyListRoute from './../customer-property/list';
export default CustomerPropertyListRoute.extend({
breadcrumbs: [{text: 'Customer Application'}],
extraParams() {
return {type: 'APPLICATION'};
model(params) {
return this.get('store').ajaxGet('customer-property/app-list', params);
}
});

View File

@ -22,14 +22,14 @@ export default BaseEditRoute.extend({
Ember.addObserver(model, 'applicationsArray', function() {
Ember.Logger.info('Model application changed: ', model);
model.applications = model.applicationsArray.join(',');
me.get('service').update(model, true);
// me.get('service').update(model, true);
});
Ember.addObserver(model, 'status', function() {
Ember.Logger.info('Model status changed: ', model);
if (model.status) {
model.applications = model.applicationsArray.join(',');
me.get('service').update(model, true);
// me.get('service').update(model, true);
}
});
Ember.set(model, 'userAccounts', Ember.get(model, 'users').mapBy('account').join(', '));
@ -54,6 +54,15 @@ export default BaseEditRoute.extend({
else {
me.transitionTo('customer.list', 1);
}
}
},
update() {
const me = this;
me.get('dialog').confirm('Are you sure to update?', () => {
me.get('service').update(me.get('controller.model'), false).then(() => {
me.get('message').alert('Update successfully');
me.send('backToList');
});
});
}
}
});

View File

@ -64,21 +64,21 @@
<span class="menu-text"> Customer Status </span>
{{/link-to}}
</li>
{{/if}}
<li>
{{#link-to 'customer-application.list' 1}}
<i class="menu-icon fa fa-cube blue"></i>
<span class="menu-text"> Customer Application </span>
{{/link-to}}
</li>
{{#if ajax.user.admin}}
<li>
{{#link-to 'import-record.list' 1}}
<i class="menu-icon fa fa-th-list blue"></i>
<span class="menu-text"> Import Records </span>
{{/link-to}}
</li>
{{!--fa-archive--}}
{{/if}}
<!-- end -->
</ul><!-- /.nav-list -->
<!-- #section:basics/sidebar.layout.minimize -->

View File

@ -1,5 +1,6 @@
{{#main-content}}
<div class="widget-box transparent">
{{#if ajax.user.admin}}
{{#grid-header}}
<li>
{{#link-to 'customer-application.create'}}
@ -8,6 +9,9 @@
{{/link-to}}
</li>
{{/grid-header}}
{{else}}
{{grid-header}}
{{/if}}
<div class="widget-body">
<!-- #section:custom/scrollbar -->
@ -26,10 +30,12 @@
<i class="ace-icon fa fa-exchange bigger-110 hidden-480"></i>
Enabled
</th>
{{#if ajax.user.admin}}
<th>
<i class="ace-icon fa fa-cogs bigger-110 hidden-480"></i>
Settings
</th>
{{/if}}
</tr>
</thead>
@ -40,17 +46,23 @@
{{it.name}}
</td>
<td>
{{editable-cell model=it field='note'}}
{{#if ajax.user.admin}}
{{editable-cell model=it field='note'}}
{{else}}
{{it.note}}
{{/if}}
</td>
<td>
{{status-cell model=it enabledText='TRUE' disabledText='FALSE'}}
</td>
{{#if ajax.user.admin}}
<td>
<div class="hidden-sm hidden-xs btn-group">
{{status-toggle-button model=it}}
{{#link-to 'customer-application.edit' it.id class='btn btn-xs btn-info' title='Edit'}}
<i class="ace-icon fa fa-pencil bigger-120"></i>
{{/link-to}}
{{!--
{{#if (not-eq model.data.firstObject.id it.id)}}
<button class="btn btn-xs btn-purple" title="Move Up" {{action (route-action 'moveUp' it)}}>
<i class="ace-icon fa fa-arrow-up bigger-120"></i>
@ -61,6 +73,7 @@
<i class="ace-icon fa fa-arrow-down bigger-120"></i>
</button>
{{/if}}
--}}
</div>
<div class="hidden-md hidden-lg">
<div class="inline pos-rel">
@ -73,6 +86,7 @@
<li>
{{status-toggle-button model=it iconOnly=true}}
</li>
{{!--
<li>
{{#link-to 'customer-status.edit' it.id class='tooltip-info' data-rel='tooltip' title='Edit'}}
<span class="blue">
@ -92,16 +106,18 @@
</a>
{{/if}}
</li>
--}}
</ul>
</div>
</div>
</td>
{{/if}}
</tr>
{{/each}}
</tbody>
</table>
</div>
{{pagination-bar}}
{{!pagination-bar}}
</div>
</div>
{{/main-content}}

View File

@ -65,7 +65,7 @@
{{sortable-th name='sumYtdSales' text='Sales(3Yrs)' style='min-width: 126px;'}}
{{/if}}
{{#if tableOptions.showIssue1}}
<th>
<th style="min-width: 168px;">
{{th-filter name='issue' text='Comment' label='Comment Filter' options=model.issueOptions}}
</th>
{{/if}}
@ -76,14 +76,14 @@
<th>Comment 3</th>
{{/if}}
{{#if tableOptions.showApplication}}
<th>
{{#sortable-th name='application' style='min-width: 138px;'}}
{{th-filter name='application'
text='Application'
label='Application Filter'
options=model.applicationList
value-field='id'
text-field='name'}}
</th>
{{/sortable-th}}
{{/if}}
{{#if tableOptions.showStatus}}
{{#sortable-th name='status' style='min-width: 96px;'}}
@ -222,7 +222,7 @@
</td>
{{/if}}
{{#if tableOptions.showApplication}}
<td>
<td style="max-width: 96px; white-space: initial;">
{{#each (str-split it.applications) as |a|}}
{{option-text model.applicationList a 'id' 'name'}}
{{/each}}

View File

@ -9,7 +9,7 @@
<div class="widget-body">
<div class="widget-main">
<div class="row">
<div class="col-xs-5 col-sm-5">
<div class="col-xs-6 col-sm-6">
<div class="control-group">
{{ace-checkbox label='ID' value=model.tableOptions.showId}}
{{ace-checkbox label='YTD Sales' value=model.tableOptions.showYtdSale}}
@ -20,7 +20,7 @@
{{ace-checkbox label='Region' value=model.tableOptions.showRegion}}
</div>
</div>
<div class="col-xs-5 col-sm-5">
<div class="col-xs-6 col-sm-6 no-padding">
<div class="control-group">
{{ace-checkbox label='Name' value=model.tableOptions.showName}}
{{ace-checkbox label='Comment' value=model.tableOptions.showIssue1}}

View File

@ -146,6 +146,6 @@
</div>
{{/form-input}}
<hr />
{{form-footer-buttons no-submit=true on-goback=(route-action 'backToList')}}
{{form-footer-buttons on-goback=(route-action 'backToList') on-submit=(route-action 'update')}}
{{/form-content}}
{{outlet}}