#779 ticket.ticketRequester
This commit is contained in:
parent
b1bb075414
commit
83b211e709
|
@ -196,7 +196,8 @@
|
|||
"url" : "/request",
|
||||
"state": "ticket.card.request",
|
||||
"component": "vn-ticket-request",
|
||||
"description": "Purchase request"
|
||||
"description": "Purchase request",
|
||||
"acl": ["salesPerson"]
|
||||
}
|
||||
],
|
||||
"menu": [
|
||||
|
|
|
@ -18,22 +18,23 @@
|
|||
vn-two
|
||||
label="Description"
|
||||
model="request.description"
|
||||
vn-acl="salesPerson">
|
||||
rule="TicketRequest.description"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Quantity"
|
||||
model="request.quantity"
|
||||
rule="TicketRequest.quantity"
|
||||
type="text">
|
||||
</vn-textfield>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
label="Atender"
|
||||
field="request.atender"
|
||||
field="request.atenderFk"
|
||||
select-fields="['id', 'name']"
|
||||
url="/client/api/Clients/activeBuyer"
|
||||
show-field="name"
|
||||
vn-acl="buyer"
|
||||
vn-focus>
|
||||
show-field="name">
|
||||
<tpl-item>{{firstName}} {{name}}</tpl-item>
|
||||
</vn-autocomplete>
|
||||
<vn-textfield
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Purchase request: Petición de compra
|
||||
Atender: Comprador
|
|
@ -11448,8 +11448,8 @@
|
|||
"integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"micromatch": "3.1.10",
|
||||
"normalize-path": "2.1.1"
|
||||
"micromatch": "^3.1.4",
|
||||
"normalize-path": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"arr-diff": {
|
||||
|
@ -11482,7 +11482,7 @@
|
|||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "1.0.0",
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
|
@ -11492,16 +11492,16 @@
|
|||
"integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"arr-flatten": "1.1.0",
|
||||
"array-unique": "0.3.2",
|
||||
"extend-shallow": "2.0.1",
|
||||
"fill-range": "4.0.0",
|
||||
"isobject": "3.0.1",
|
||||
"repeat-element": "1.1.2",
|
||||
"snapdragon": "0.8.2",
|
||||
"snapdragon-node": "2.1.1",
|
||||
"split-string": "3.1.0",
|
||||
"to-regex": "3.0.2"
|
||||
"arr-flatten": "^1.1.0",
|
||||
"array-unique": "^0.3.2",
|
||||
"extend-shallow": "^2.0.1",
|
||||
"fill-range": "^4.0.0",
|
||||
"isobject": "^3.0.1",
|
||||
"repeat-element": "^1.1.2",
|
||||
"snapdragon": "^0.8.1",
|
||||
"snapdragon-node": "^2.0.1",
|
||||
"split-string": "^3.0.2",
|
||||
"to-regex": "^3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"extend-shallow": {
|
||||
|
@ -11510,7 +11510,7 @@
|
|||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extendable": "0.1.1"
|
||||
"is-extendable": "^0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11521,19 +11521,19 @@
|
|||
"integrity": "sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"anymatch": "2.0.0",
|
||||
"async-each": "1.0.1",
|
||||
"braces": "2.3.2",
|
||||
"fsevents": "1.2.4",
|
||||
"glob-parent": "3.1.0",
|
||||
"inherits": "2.0.3",
|
||||
"is-binary-path": "1.0.1",
|
||||
"is-glob": "4.0.0",
|
||||
"lodash.debounce": "4.0.8",
|
||||
"normalize-path": "2.1.1",
|
||||
"path-is-absolute": "1.0.1",
|
||||
"readdirp": "2.1.0",
|
||||
"upath": "1.1.0"
|
||||
"anymatch": "^2.0.0",
|
||||
"async-each": "^1.0.0",
|
||||
"braces": "^2.3.0",
|
||||
"fsevents": "^1.2.2",
|
||||
"glob-parent": "^3.1.0",
|
||||
"inherits": "^2.0.1",
|
||||
"is-binary-path": "^1.0.0",
|
||||
"is-glob": "^4.0.0",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"normalize-path": "^2.1.1",
|
||||
"path-is-absolute": "^1.0.0",
|
||||
"readdirp": "^2.0.0",
|
||||
"upath": "^1.0.5"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
|
@ -11559,8 +11559,8 @@
|
|||
"integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-descriptor": "1.0.2",
|
||||
"isobject": "3.0.1"
|
||||
"is-descriptor": "^1.0.2",
|
||||
"isobject": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"expand-brackets": {
|
||||
|
@ -11569,13 +11569,13 @@
|
|||
"integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"debug": "2.6.9",
|
||||
"define-property": "0.2.5",
|
||||
"extend-shallow": "2.0.1",
|
||||
"posix-character-classes": "0.1.1",
|
||||
"regex-not": "1.0.0",
|
||||
"snapdragon": "0.8.2",
|
||||
"to-regex": "3.0.2"
|
||||
"debug": "^2.3.3",
|
||||
"define-property": "^0.2.5",
|
||||
"extend-shallow": "^2.0.1",
|
||||
"posix-character-classes": "^0.1.0",
|
||||
"regex-not": "^1.0.0",
|
||||
"snapdragon": "^0.8.1",
|
||||
"to-regex": "^3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
|
@ -11593,7 +11593,7 @@
|
|||
"integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-descriptor": "0.1.6"
|
||||
"is-descriptor": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"extend-shallow": {
|
||||
|
@ -11602,7 +11602,7 @@
|
|||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extendable": "0.1.1"
|
||||
"is-extendable": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"is-descriptor": {
|
||||
|
@ -11611,9 +11611,9 @@
|
|||
"integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-accessor-descriptor": "0.1.6",
|
||||
"is-data-descriptor": "0.1.4",
|
||||
"kind-of": "5.1.0"
|
||||
"is-accessor-descriptor": "^0.1.6",
|
||||
"is-data-descriptor": "^0.1.4",
|
||||
"kind-of": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"kind-of": {
|
||||
|
@ -11630,14 +11630,14 @@
|
|||
"integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"array-unique": "0.3.2",
|
||||
"define-property": "1.0.0",
|
||||
"expand-brackets": "2.1.4",
|
||||
"extend-shallow": "2.0.1",
|
||||
"fragment-cache": "0.2.1",
|
||||
"regex-not": "1.0.0",
|
||||
"snapdragon": "0.8.2",
|
||||
"to-regex": "3.0.2"
|
||||
"array-unique": "^0.3.2",
|
||||
"define-property": "^1.0.0",
|
||||
"expand-brackets": "^2.1.4",
|
||||
"extend-shallow": "^2.0.1",
|
||||
"fragment-cache": "^0.2.1",
|
||||
"regex-not": "^1.0.0",
|
||||
"snapdragon": "^0.8.1",
|
||||
"to-regex": "^3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"define-property": {
|
||||
|
@ -11646,7 +11646,7 @@
|
|||
"integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-descriptor": "1.0.2"
|
||||
"is-descriptor": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"extend-shallow": {
|
||||
|
@ -11655,7 +11655,7 @@
|
|||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extendable": "0.1.1"
|
||||
"is-extendable": "^0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11666,10 +11666,10 @@
|
|||
"integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"extend-shallow": "2.0.1",
|
||||
"is-number": "3.0.0",
|
||||
"repeat-string": "1.6.1",
|
||||
"to-regex-range": "2.1.1"
|
||||
"extend-shallow": "^2.0.1",
|
||||
"is-number": "^3.0.0",
|
||||
"repeat-string": "^1.6.1",
|
||||
"to-regex-range": "^2.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"extend-shallow": {
|
||||
|
@ -11678,7 +11678,7 @@
|
|||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extendable": "0.1.1"
|
||||
"is-extendable": "^0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11690,8 +11690,8 @@
|
|||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"nan": "2.11.1",
|
||||
"node-pre-gyp": "0.10.0"
|
||||
"nan": "^2.9.2",
|
||||
"node-pre-gyp": "^0.10.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"abbrev": {
|
||||
|
@ -12218,8 +12218,8 @@
|
|||
"integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-glob": "3.1.0",
|
||||
"path-dirname": "1.0.2"
|
||||
"is-glob": "^3.1.0",
|
||||
"path-dirname": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-glob": {
|
||||
|
@ -12228,7 +12228,7 @@
|
|||
"integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extglob": "2.1.1"
|
||||
"is-extglob": "^2.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12245,7 +12245,7 @@
|
|||
"integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"kind-of": "3.2.2"
|
||||
"kind-of": "^3.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"kind-of": {
|
||||
|
@ -12254,7 +12254,7 @@
|
|||
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-buffer": "1.1.6"
|
||||
"is-buffer": "^1.1.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12271,7 +12271,7 @@
|
|||
"integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"kind-of": "3.2.2"
|
||||
"kind-of": "^3.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"kind-of": {
|
||||
|
@ -12280,7 +12280,7 @@
|
|||
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-buffer": "1.1.6"
|
||||
"is-buffer": "^1.1.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12297,7 +12297,7 @@
|
|||
"integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-extglob": "2.1.1"
|
||||
"is-extglob": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"is-number": {
|
||||
|
@ -12306,7 +12306,7 @@
|
|||
"integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"kind-of": "3.2.2"
|
||||
"kind-of": "^3.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"kind-of": {
|
||||
|
@ -12315,7 +12315,7 @@
|
|||
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-buffer": "1.1.6"
|
||||
"is-buffer": "^1.1.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12344,19 +12344,19 @@
|
|||
"integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"arr-diff": "4.0.0",
|
||||
"array-unique": "0.3.2",
|
||||
"braces": "2.3.2",
|
||||
"define-property": "2.0.2",
|
||||
"extend-shallow": "3.0.2",
|
||||
"extglob": "2.0.4",
|
||||
"fragment-cache": "0.2.1",
|
||||
"kind-of": "6.0.2",
|
||||
"nanomatch": "1.2.13",
|
||||
"object.pick": "1.3.0",
|
||||
"regex-not": "1.0.0",
|
||||
"snapdragon": "0.8.2",
|
||||
"to-regex": "3.0.2"
|
||||
"arr-diff": "^4.0.0",
|
||||
"array-unique": "^0.3.2",
|
||||
"braces": "^2.3.1",
|
||||
"define-property": "^2.0.2",
|
||||
"extend-shallow": "^3.0.2",
|
||||
"extglob": "^2.0.4",
|
||||
"fragment-cache": "^0.2.1",
|
||||
"kind-of": "^6.0.2",
|
||||
"nanomatch": "^1.2.9",
|
||||
"object.pick": "^1.3.0",
|
||||
"regex-not": "^1.0.0",
|
||||
"snapdragon": "^0.8.1",
|
||||
"to-regex": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"minimatch": {
|
||||
|
@ -12365,7 +12365,7 @@
|
|||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "1.1.11"
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"nan": {
|
||||
|
@ -12381,17 +12381,17 @@
|
|||
"integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"arr-diff": "4.0.0",
|
||||
"array-unique": "0.3.2",
|
||||
"define-property": "2.0.2",
|
||||
"extend-shallow": "3.0.2",
|
||||
"fragment-cache": "0.2.1",
|
||||
"is-windows": "1.0.2",
|
||||
"kind-of": "6.0.2",
|
||||
"object.pick": "1.3.0",
|
||||
"regex-not": "1.0.0",
|
||||
"snapdragon": "0.8.2",
|
||||
"to-regex": "3.0.2"
|
||||
"arr-diff": "^4.0.0",
|
||||
"array-unique": "^0.3.2",
|
||||
"define-property": "^2.0.2",
|
||||
"extend-shallow": "^3.0.2",
|
||||
"fragment-cache": "^0.2.1",
|
||||
"is-windows": "^1.0.2",
|
||||
"kind-of": "^6.0.2",
|
||||
"object.pick": "^1.3.0",
|
||||
"regex-not": "^1.0.0",
|
||||
"snapdragon": "^0.8.1",
|
||||
"to-regex": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"normalize-path": {
|
||||
|
@ -12400,7 +12400,7 @@
|
|||
"integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"remove-trailing-separator": "1.1.0"
|
||||
"remove-trailing-separator": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"semver": {
|
||||
|
@ -12415,7 +12415,7 @@
|
|||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "3.0.0"
|
||||
"has-flag": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"to-regex": {
|
||||
|
@ -12424,10 +12424,10 @@
|
|||
"integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"define-property": "2.0.2",
|
||||
"extend-shallow": "3.0.2",
|
||||
"regex-not": "1.0.2",
|
||||
"safe-regex": "1.1.0"
|
||||
"define-property": "^2.0.2",
|
||||
"extend-shallow": "^3.0.2",
|
||||
"regex-not": "^1.0.2",
|
||||
"safe-regex": "^1.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"regex-not": {
|
||||
|
@ -12436,8 +12436,8 @@
|
|||
"integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"extend-shallow": "3.0.2",
|
||||
"safe-regex": "1.1.0"
|
||||
"extend-shallow": "^3.0.2",
|
||||
"safe-regex": "^1.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22870,8 +22870,8 @@
|
|||
"integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-fullwidth-code-point": "2.0.0",
|
||||
"strip-ansi": "4.0.0"
|
||||
"is-fullwidth-code-point": "^2.0.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"strip-ansi": {
|
||||
|
@ -22880,7 +22880,7 @@
|
|||
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-regex": "3.0.0"
|
||||
"ansi-regex": "^3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,24 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.activeBuyer = async filter => {
|
||||
let sqlWhere = '';
|
||||
let sqlLimit = '';
|
||||
let sqlOffset = '';
|
||||
let params = [];
|
||||
|
||||
if (filter.where) {
|
||||
if (filter.where.firstName) {
|
||||
sqlWhere = `AND (worker.firstName LIKE ? OR worker.name LIKE ?)`;
|
||||
let search = where.firstName.like;
|
||||
params.push(search);
|
||||
params.push(search);
|
||||
}
|
||||
if (filter.where.id) {
|
||||
sqlWhere = `AND worker.id = ?`;
|
||||
params.push(filter.where.id);
|
||||
}
|
||||
}
|
||||
|
||||
if (filter.limit) {
|
||||
sqlLimit = `LIMIT ?`;
|
||||
params.push(filter.limit);
|
||||
|
@ -38,8 +52,8 @@ module.exports = Self => {
|
|||
FROM vn.worker
|
||||
JOIN account.user user ON user.id = worker.userFk
|
||||
JOIN account.role role ON role.name = 'buyer'
|
||||
JOIN account.roleRole inheritance ON inheritance.role = user.role AND inheritance.inheritsFrom = role.id
|
||||
WHERE user.active IS TRUE
|
||||
JOIN account.roleRole inheritance ON inheritance.role = user.role AND inheritance.inheritsFrom = role.id
|
||||
WHERE user.active IS TRUE ${sqlWhere}
|
||||
ORDER BY worker.firstName ASC
|
||||
${sqlLimit} ${sqlOffset}`;
|
||||
|
||||
|
|
|
@ -20,10 +20,24 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.activeSalesPerson = async filter => {
|
||||
let sqlWhere = '';
|
||||
let sqlLimit = '';
|
||||
let sqlOffset = '';
|
||||
let params = [];
|
||||
|
||||
if (filter.where) {
|
||||
if (filter.where.firstName) {
|
||||
sqlWhere = `AND (worker.firstName LIKE ? OR worker.name LIKE ?)`;
|
||||
let search = where.firstName.like;
|
||||
params.push(search);
|
||||
params.push(search);
|
||||
}
|
||||
if (filter.where.id) {
|
||||
sqlWhere = `AND worker.id = ?`;
|
||||
params.push(filter.where.id);
|
||||
}
|
||||
}
|
||||
|
||||
if (filter.limit) {
|
||||
sqlLimit = `LIMIT ?`;
|
||||
params.push(filter.limit);
|
||||
|
@ -38,8 +52,8 @@ module.exports = Self => {
|
|||
FROM vn.worker
|
||||
JOIN account.user user ON user.id = worker.userFk
|
||||
JOIN account.role role ON role.name = 'salesPerson'
|
||||
JOIN account.roleRole inheritance ON inheritance.role = user.role AND inheritance.inheritsFrom = role.id
|
||||
WHERE user.active IS TRUE
|
||||
JOIN account.roleRole inheritance ON inheritance.role = user.role AND inheritance.inheritsFrom = role.id
|
||||
WHERE user.active IS TRUE ${sqlWhere}
|
||||
ORDER BY worker.firstName ASC
|
||||
${sqlLimit} ${sqlOffset}`;
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
const LoopBackContext = require('loopback-context');
|
||||
|
||||
module.exports = function(Self) {
|
||||
Self.observe('before save', async function(ctx) {
|
||||
if (ctx.isNewInstance) {
|
||||
const loopBackContext = LoopBackContext.getCurrentContext();
|
||||
let filter = {where: {userFk: loopBackContext.active.accessToken.userId}};
|
||||
let worker = await Self.app.models.Worker.findOne(filter);
|
||||
|
||||
ctx.instance.requesterFk = worker.id;
|
||||
}
|
||||
});
|
||||
};
|
|
@ -13,19 +13,25 @@
|
|||
"description": "Identifier"
|
||||
},
|
||||
"description": {
|
||||
"type": "String"
|
||||
"type": "String",
|
||||
"required": true
|
||||
},
|
||||
"created": {
|
||||
"type": "Date"
|
||||
},
|
||||
"quantity": {
|
||||
"type": "Number"
|
||||
"type": "Number",
|
||||
"required": true
|
||||
},
|
||||
"price": {
|
||||
"type": "Number"
|
||||
},
|
||||
"isOk": {
|
||||
"type": "Boolean"
|
||||
},
|
||||
"atenderFk": {
|
||||
"type": "Number",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
Loading…
Reference in New Issue