Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head Something is wrong with the build of this commit
Details
gitea/salix/pipeline/head Something is wrong with the build of this commit
Details
This commit is contained in:
commit
16cdc419ea
|
@ -82,13 +82,13 @@ module.exports = Self => {
|
|||
const args = ctx.args;
|
||||
let teamIds = [];
|
||||
|
||||
if (worker.collegues().length && ctx.args.myTeam) {
|
||||
if (worker.collegues().length && args.myTeam) {
|
||||
worker.collegues().forEach(collegue => {
|
||||
teamIds.push(collegue.collegueFk);
|
||||
});
|
||||
}
|
||||
|
||||
if (worker.collegues().length === 0 && ctx.args.myTeam) {
|
||||
if (worker.collegues().length === 0 && args.myTeam) {
|
||||
worker = await Self.app.models.Worker.findOne({
|
||||
fields: ['id'],
|
||||
where: {userFk: ctx.req.accessToken.userId}
|
||||
|
@ -96,9 +96,9 @@ module.exports = Self => {
|
|||
teamIds = [worker && worker.id];
|
||||
}
|
||||
|
||||
if (ctx.args && ctx.args.myTeam)
|
||||
ctx.args.teamIds = teamIds;
|
||||
let where = buildFilter(ctx.args, (param, value) => {
|
||||
if (args && args.myTeam)
|
||||
args.teamIds = teamIds;
|
||||
let where = buildFilter(args, (param, value) => {
|
||||
switch (param) {
|
||||
case 'search':
|
||||
return /^\d+$/.test(value)
|
||||
|
@ -106,7 +106,6 @@ module.exports = Self => {
|
|||
: {or: [
|
||||
{'c.name': {like: `%${value}%`}}
|
||||
]};
|
||||
// return {'o.id': value};
|
||||
case 'from':
|
||||
return {'o.date_send': {gte: value}};
|
||||
case 'to':
|
||||
|
@ -125,6 +124,8 @@ module.exports = Self => {
|
|||
return {'o.confirmed': value ? 1 : 0};
|
||||
case 'myTeam':
|
||||
return {'c.salesPersonFk': {inq: teamIds}};
|
||||
case 'showEmpty':
|
||||
return {'o.total': {neq: value}};
|
||||
case 'id':
|
||||
param = `o.${param}`;
|
||||
return {[param]: value};
|
||||
|
@ -164,7 +165,7 @@ module.exports = Self => {
|
|||
LEFT JOIN account.user u ON u.id = wk.userFk
|
||||
LEFT JOIN company co ON co.id = o.company_id`);
|
||||
|
||||
if (ctx.args && ctx.args.ticketFk) {
|
||||
if (args && args.ticketFk) {
|
||||
stmt.merge({
|
||||
sql: `LEFT JOIN orderTicket ort ON ort.orderFk = o.id`
|
||||
});
|
||||
|
@ -186,13 +187,6 @@ module.exports = Self => {
|
|||
`SELECT f.*, ot.*
|
||||
FROM tmp.filter f
|
||||
LEFT JOIN tmp.orderTotal ot ON ot.orderFk = f.id`);
|
||||
const filterWhere = {};
|
||||
|
||||
if (args && args.showEmpty === false)
|
||||
filterWhere.total = {neq: 0};
|
||||
|
||||
stmt.merge(conn.makeWhere(filterWhere));
|
||||
|
||||
const orderIndex = stmts.push(stmt) - 1;
|
||||
|
||||
stmts.push(`
|
||||
|
|
|
@ -3,7 +3,7 @@ import ModuleMain from 'salix/components/module-main';
|
|||
|
||||
export default class Order extends ModuleMain {
|
||||
$postLink() {
|
||||
// this.filter = {showEmpty: false};
|
||||
this.filter = {showEmpty: false};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,11 +76,11 @@
|
|||
triple-state="true"
|
||||
ng-model="filter.isConfirmed">
|
||||
</vn-check>
|
||||
<!-- <vn-check
|
||||
<vn-check
|
||||
vn-one
|
||||
label="Show empty"
|
||||
ng-model="filter.showEmpty">
|
||||
</vn-check> -->
|
||||
</vn-check>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-mt-lg">
|
||||
<vn-submit label="Search"></vn-submit>
|
||||
|
|
Loading…
Reference in New Issue