feat: buscar por itemFk y claimResponsibleFk
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
c02be35e1c
commit
1c6a5164d4
|
@ -23,7 +23,7 @@ module.exports = Self => {
|
|||
{
|
||||
arg: 'search',
|
||||
type: 'string',
|
||||
description: `If it's and integer searchs by id, otherwise it searchs by client name`,
|
||||
description: `If it's and number searchs by id, otherwise it searchs by client name`,
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
|
@ -34,31 +34,31 @@ module.exports = Self => {
|
|||
},
|
||||
{
|
||||
arg: 'id',
|
||||
type: 'integer',
|
||||
type: 'number',
|
||||
description: 'The claim id',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'clientFk',
|
||||
type: 'integer',
|
||||
type: 'number',
|
||||
description: 'The client id',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'claimStateFk',
|
||||
type: 'integer',
|
||||
type: 'number',
|
||||
description: 'The claim state id',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'salesPersonFk',
|
||||
type: 'integer',
|
||||
type: 'number',
|
||||
description: 'The salesPerson id',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'attenderFk',
|
||||
type: 'integer',
|
||||
type: 'number',
|
||||
description: 'The attender worker id',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
|
@ -67,6 +67,18 @@ module.exports = Self => {
|
|||
type: 'date',
|
||||
description: 'The to date filter',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'itemFk',
|
||||
type: 'number',
|
||||
description: 'The item id',
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'claimResponsibleFk',
|
||||
type: 'number',
|
||||
description: 'The claimResponsible id',
|
||||
http: {source: 'query'}
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
|
@ -100,9 +112,10 @@ module.exports = Self => {
|
|||
case 'clientName':
|
||||
return {'cl.clientName': {like: `%${value}%`}};
|
||||
case 'clientFk':
|
||||
return {'cl.clientFk': value};
|
||||
case 'id':
|
||||
case 'claimStateFk':
|
||||
case 'itemFk':
|
||||
case 'claimResponsibleFk':
|
||||
case 'priority':
|
||||
return {[`cl.${param}`]: value};
|
||||
case 'salesPersonFk':
|
||||
|
@ -123,9 +136,9 @@ module.exports = Self => {
|
|||
const stmts = [];
|
||||
|
||||
const stmt = new ParameterizedSQL(
|
||||
`SELECT *
|
||||
`SELECT *
|
||||
FROM (
|
||||
SELECT
|
||||
SELECT DISTINCT
|
||||
cl.id,
|
||||
cl.clientFk,
|
||||
c.name AS clientName,
|
||||
|
@ -135,12 +148,17 @@ module.exports = Self => {
|
|||
cl.created,
|
||||
cs.priority,
|
||||
cl.claimStateFk,
|
||||
c.salesPersonFk
|
||||
c.salesPersonFk,
|
||||
s.itemFk,
|
||||
cd.claimResponsibleFk
|
||||
FROM claim cl
|
||||
LEFT JOIN client c ON c.id = cl.clientFk
|
||||
LEFT JOIN worker w ON w.id = cl.workerFk
|
||||
LEFT JOIN worker w ON w.id = cl.workerFk
|
||||
LEFT JOIN account.user u ON u.id = w.userFk
|
||||
LEFT JOIN claimState cs ON cs.id = cl.claimStateFk ) cl`
|
||||
LEFT JOIN claimState cs ON cs.id = cl.claimStateFk
|
||||
LEFT JOIN claimBeginning cb ON cb.claimFk = cl.id
|
||||
LEFT JOIN sale s ON s.id = cb.saleFk
|
||||
LEFT JOIN claimDevelopment cd ON cd.claimFk = cl.id ) cl`
|
||||
);
|
||||
|
||||
stmt.merge(conn.makeSuffix(filter));
|
||||
|
|
|
@ -58,8 +58,28 @@
|
|||
ng-model="filter.created">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete vn-one class="dense"
|
||||
label="Item"
|
||||
url="Items/withName"
|
||||
ng-model="filter.itemFk"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
search-function="$ctrl.itemSearchFunc($search)"
|
||||
order="id DESC">
|
||||
<tpl-item>{{::id}} - {{::name}}</tpl-item>
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="filter.claimResponsibleFk"
|
||||
url="ClaimResponsibles"
|
||||
show-field="description"
|
||||
value-field="id"
|
||||
label="Responsible">
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-mt-lg">
|
||||
<vn-submit label="Search"></vn-submit>
|
||||
</vn-horizontal>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
import ngModule from '../module';
|
||||
import SearchPanel from 'core/components/searchbar/search-panel';
|
||||
|
||||
class Controller extends SearchPanel {
|
||||
itemSearchFunc($search) {
|
||||
return /^\d+$/.test($search)
|
||||
? {id: $search}
|
||||
: {name: {like: '%' + $search + '%'}};
|
||||
}
|
||||
}
|
||||
ngModule.vnComponent('vnClaimSearchPanel', {
|
||||
template: require('./index.html'),
|
||||
controller: SearchPanel
|
||||
controller: Controller
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue