fix: hotfix create order from customer
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Javier Segarra 2024-11-12 10:43:05 +01:00
parent 307179cb9d
commit 96301f8a0b
2 changed files with 13 additions and 5 deletions

View File

@ -70,10 +70,18 @@ export default class App {
if (this.logger.$params.q) { if (this.logger.$params.q) {
let tableValue = this.logger.$params.q; let tableValue = this.logger.$params.q;
const q = JSON.parse(tableValue); if (Array.isArray(tableValue)) {
if (typeof q === 'number') const [key, param1, param2] = tableValue;
tableValue = JSON.stringify({id: tableValue}); const payload = key === 'createForm'
newRoute = newRoute.concat(`?table=${tableValue}`); ? {[param1]: param2}
: {[key]: param1};
newRoute += `?${key}=${JSON.stringify(payload)}`;
} else {
const q = JSON.parse(tableValue);
if (typeof q === 'number')
tableValue = JSON.stringify({id: tableValue});
newRoute = newRoute.concat(`?table=${tableValue}`);
}
} else if (!hasId && this.logger.$params.id && newRoute.indexOf(this.logger.$params.id) < 0) } else if (!hasId && this.logger.$params.id && newRoute.indexOf(this.logger.$params.id) < 0)
newRoute = newRoute.concat(`${this.logger.$params.id}`); newRoute = newRoute.concat(`${this.logger.$params.id}`);

View File

@ -99,7 +99,7 @@
<div ng-transclude="btnThree"> <div ng-transclude="btnThree">
<vn-quick-link <vn-quick-link
tooltip="New order" tooltip="New order"
state="['order.create', {clientFk: $ctrl.id}]" state="['order.index', {q: ['createForm', 'clientFk', $ctrl.id]}]"
icon="icon-basketadd"> icon="icon-basketadd">
</vn-quick-link> </vn-quick-link>
</div> </div>