sort salary temp
This commit is contained in:
parent
f033205e1d
commit
968d5f6dad
1 changed files with 21 additions and 6 deletions
|
|
@ -311,7 +311,9 @@ export class ProfileSalaryTempController extends Controller {
|
||||||
orgRevisionId: findRevision.id,
|
orgRevisionId: findRevision.id,
|
||||||
})
|
})
|
||||||
.andWhere(
|
.andWhere(
|
||||||
statusCheckEdit != undefined && statusCheckEdit != null && statusCheckEdit.toUpperCase() != "ALL"
|
statusCheckEdit != undefined &&
|
||||||
|
statusCheckEdit != null &&
|
||||||
|
statusCheckEdit.toUpperCase() != "ALL"
|
||||||
? "profile.statusCheckEdit = :statusCheckEdit"
|
? "profile.statusCheckEdit = :statusCheckEdit"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
|
|
@ -568,9 +570,11 @@ export class ProfileSalaryTempController extends Controller {
|
||||||
// await this.salaryRepo.remove(salary);
|
// await this.salaryRepo.remove(salary);
|
||||||
// let salaryOld = await this.salaryOldRepo.find({
|
// let salaryOld = await this.salaryOldRepo.find({
|
||||||
// where: { profileId: profileId },
|
// where: { profileId: profileId },
|
||||||
|
// order: { order: "ASC" },
|
||||||
// });
|
// });
|
||||||
// salaryOld.forEach((item: any) => {
|
// salaryOld.forEach((item: any) => {
|
||||||
// item.salaryId = item.id;
|
// item.salaryId = item.id;
|
||||||
|
// item.order = i + 1;
|
||||||
// });
|
// });
|
||||||
// let salaryNew = salaryOld.map(({ id, ...rest }: ProfileSalary) => ({
|
// let salaryNew = salaryOld.map(({ id, ...rest }: ProfileSalary) => ({
|
||||||
// ...rest,
|
// ...rest,
|
||||||
|
|
@ -590,9 +594,11 @@ export class ProfileSalaryTempController extends Controller {
|
||||||
// await this.salaryRepo.remove(salary);
|
// await this.salaryRepo.remove(salary);
|
||||||
// let salaryOld = await this.salaryOldRepo.find({
|
// let salaryOld = await this.salaryOldRepo.find({
|
||||||
// where: { profileEmployeeId: profileId },
|
// where: { profileEmployeeId: profileId },
|
||||||
|
// order: { order: "ASC" },
|
||||||
// });
|
// });
|
||||||
// salaryOld.forEach((item: any) => {
|
// salaryOld.forEach((item: any) => {
|
||||||
// item.salaryId = item.id;
|
// item.salaryId = item.id;
|
||||||
|
// item.order = i + 1;
|
||||||
// });
|
// });
|
||||||
// let salaryNew = salaryOld.map(({ id, ...rest }: ProfileSalary) => ({
|
// let salaryNew = salaryOld.map(({ id, ...rest }: ProfileSalary) => ({
|
||||||
// ...rest,
|
// ...rest,
|
||||||
|
|
@ -649,9 +655,11 @@ export class ProfileSalaryTempController extends Controller {
|
||||||
if (salary.length <= 0) {
|
if (salary.length <= 0) {
|
||||||
let salaryOld = await this.salaryOldRepo.find({
|
let salaryOld = await this.salaryOldRepo.find({
|
||||||
where: { profileId: profileId },
|
where: { profileId: profileId },
|
||||||
|
order: { order: "ASC" },
|
||||||
});
|
});
|
||||||
salaryOld.forEach((item: any) => {
|
salaryOld.forEach((item: any, i) => {
|
||||||
item.salaryId = item.id;
|
item.salaryId = item.id;
|
||||||
|
item.order = i + 1;
|
||||||
});
|
});
|
||||||
let salaryNew = salaryOld.map(({ id, ...rest }: ProfileSalary) => ({
|
let salaryNew = salaryOld.map(({ id, ...rest }: ProfileSalary) => ({
|
||||||
...rest,
|
...rest,
|
||||||
|
|
@ -672,7 +680,12 @@ export class ProfileSalaryTempController extends Controller {
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return new HttpSuccess(salary);
|
return new HttpSuccess(
|
||||||
|
salary.map((item) => ({
|
||||||
|
...item,
|
||||||
|
status: item.isDelete == true ? "DELETE" : item.isEdit == true ? "EDIT" : "PENDING",
|
||||||
|
})),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
const salary = await this.salaryRepo.find({
|
const salary = await this.salaryRepo.find({
|
||||||
where: { profileEmployeeId: profileId },
|
where: { profileEmployeeId: profileId },
|
||||||
|
|
@ -681,9 +694,11 @@ export class ProfileSalaryTempController extends Controller {
|
||||||
if (salary.length <= 0) {
|
if (salary.length <= 0) {
|
||||||
let salaryOld = await this.salaryOldRepo.find({
|
let salaryOld = await this.salaryOldRepo.find({
|
||||||
where: { profileEmployeeId: profileId },
|
where: { profileEmployeeId: profileId },
|
||||||
|
order: { order: "ASC" },
|
||||||
});
|
});
|
||||||
salaryOld.forEach((item: any) => {
|
salaryOld.forEach((item: any, i) => {
|
||||||
item.salaryId = item.id;
|
item.salaryId = item.id;
|
||||||
|
item.order = i + 1;
|
||||||
});
|
});
|
||||||
let salaryNew = salaryOld.map(({ id, ...rest }: ProfileSalary) => ({
|
let salaryNew = salaryOld.map(({ id, ...rest }: ProfileSalary) => ({
|
||||||
...rest,
|
...rest,
|
||||||
|
|
@ -728,7 +743,7 @@ export class ProfileSalaryTempController extends Controller {
|
||||||
if (type.toLocaleUpperCase() == "OFFICER") {
|
if (type.toLocaleUpperCase() == "OFFICER") {
|
||||||
const salary = await this.salaryRepo.find({
|
const salary = await this.salaryRepo.find({
|
||||||
where: { profileId: profileId, isDelete: false },
|
where: { profileId: profileId, isDelete: false },
|
||||||
order: { order: "ASC" }
|
order: { order: "ASC" },
|
||||||
});
|
});
|
||||||
if (!salary) {
|
if (!salary) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
|
|
@ -742,7 +757,7 @@ export class ProfileSalaryTempController extends Controller {
|
||||||
} else {
|
} else {
|
||||||
const salary = await this.salaryRepo.find({
|
const salary = await this.salaryRepo.find({
|
||||||
where: { profileEmployeeId: profileId, isDelete: false },
|
where: { profileEmployeeId: profileId, isDelete: false },
|
||||||
order: { order: "ASC" }
|
order: { order: "ASC" },
|
||||||
});
|
});
|
||||||
if (!salary) {
|
if (!salary) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue