Commit 4d1f4a91 by Ooh-Ao

history

parent 73acfaa5
...@@ -43,7 +43,8 @@ ...@@ -43,7 +43,8 @@
<div class="flex items-center mb-4"> <div class="flex items-center mb-4">
<div> <div>
<p class="text-[.9375rem] font-semibold mb-2"><a href="javascript:void(0);">{{item.equipment.equipmentName}}</a></p> <p class="text-[.9375rem] font-semibold mb-2"><a
href="javascript:void(0);">{{item.equipment.equipmentName}}</a></p>
<p class="text-[0.75rem] text-[#8c9097] dark:text-white/50 mb-0">S/N# {{item.equipment.serialNumber}}</p> <p class="text-[0.75rem] text-[#8c9097] dark:text-white/50 mb-0">S/N# {{item.equipment.serialNumber}}</p>
<p class="text-[0.75rem] text-[#8c9097] dark:text-white/50 mb-0">STOCK# {{item.peId}}</p> <p class="text-[0.75rem] text-[#8c9097] dark:text-white/50 mb-0">STOCK# {{item.peId}}</p>
</div> </div>
...@@ -73,7 +74,7 @@ ...@@ -73,7 +74,7 @@
class="ti-btn ti-btn-sm ti-btn-warning me-[0.375rem]"> class="ti-btn ti-btn-sm ti-btn-warning me-[0.375rem]">
<i class="ri-store-line"></i> <i class="ri-store-line"></i>
</button> </button>
<button type="button" aria-label="button" <button data-hs-overlay="#modal-stock-his" (click)="viewHisStock(item);" type="button" aria-label="button"
class="ti-btn ti-btn-sm ti-btn-danger me-0"><i class="ri-time-line"></i></button> class="ti-btn ti-btn-sm ti-btn-danger me-0"><i class="ri-time-line"></i></button>
</div> </div>
</div> </div>
...@@ -187,7 +188,8 @@ ...@@ -187,7 +188,8 @@
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out">
<div class="ti-modal-content"> <div class="ti-modal-content">
<div class="ti-modal-header"> <div class="ti-modal-header">
<h6 class="modal-title text-[1rem] font-semibold text-defaulttextcolor" id="mail-ComposeLabel">การยืม/ข้อมูลอุปกรณ์ <h6 class="modal-title text-[1rem] font-semibold text-defaulttextcolor" id="mail-ComposeLabel">
การยืม/ข้อมูลอุปกรณ์
</h6> </h6>
<button type="button" class="hs-dropdown-toggle !text-[1rem] !font-semibold !text-defaulttextcolor" <button type="button" class="hs-dropdown-toggle !text-[1rem] !font-semibold !text-defaulttextcolor"
data-hs-overlay="#modal-stock"> data-hs-overlay="#modal-stock">
...@@ -250,3 +252,88 @@ ...@@ -250,3 +252,88 @@
</div> </div>
</div> </div>
</div> </div>
<!-- Start:: New Deal -->
<div id="modal-stock-his" class="hs-overlay hidden ti-modal" *ngIf="selectModel">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto">
<div class="ti-modal-content">
<div class="ti-modal-header">
<h6 class="modal-title text-[1rem] font-semibold text-defaulttextcolor" id="mail-ComposeLabel">
ประวัติการทำรายการ
</h6>
<button type="button" class="hs-dropdown-toggle !text-[1rem] !font-semibold !text-defaulttextcolor"
data-hs-overlay="#modal-stock-his">
<span class="sr-only">Close</span>
<i class="ri-close-line"></i>
</button>
</div>
<div class="ti-modal-body px-4">
<div class="table-responsive mb-4">
<table class="table whitespace-nowrap table-bordered min-w-full">
<thead>
<tr>
<th scope="col" class="text-start">พนักงาน</th>
<th scope="col" class="text-start">จำนวน</th>
<th scope="col" class="text-start">วันที่ยืม</th>
<th scope="col" class="text-start">วันที่คืน</th>
<th scope="col" class="text-start">สถานะ</th>
<th scope="col" class="text-start">ผู้อนุมัติ</th>
<th scope="col" class="text-start"></th>
</tr>
</thead>
<tbody>
@for(product of hisList;track product.peId){
<tr class="product-list">
<td>
<div class="flex items-center">
<div class="me-2">
<!-- <span class="avatar avatar-md avatar-rounded">
<img src={{product.img}} alt="">
</span> -->
</div>
<div class="font-semibold">
{{product.memberId}}
</div>
</div>
</td>
<td>{{product.quantity_borrowed}}</td>
<td>{{product.created_at}}</td>
<td>{{product.returned_date}}</td>
<td> {{product.status}}</td>
<td> {{product.approved_by}}</td>
<!-- <td>
<span class="badge bg-light text-default"> {{product.category}}</span>
</td>
<td>{{product.price}}</td>
<td>{{product.stock}}</td>
<td>{{product.gender}}</td>
<td>{{product.seller}}</td>
<td> {{product.published}}</td> -->
<td>
<!-- <div class="flex flex-row items-center !gap-2 text-[0.9375rem]">
<a aria-label="anchor" routerLink="/pages/ecommerce/editproducts"
class="ti-btn ti-btn-wave !gap-0 !m-0 !h-[1.75rem] !w-[1.75rem] text-[0.8rem] bg-info/10 text-info hover:bg-info hover:text-white hover:border-info"><i
class="ri-pencil-line"></i></a>
<a aria-label="anchor" href="javascript:void(0);" (click)="click(product.id)"
class="ti-btn ti-btn-wave product-btn !gap-0 !m-0 !h-[1.75rem] !w-[1.75rem] text-[0.8rem] bg-danger/10 text-danger hover:bg-danger hover:text-white hover:border-danger"><i
class="ri-delete-bin-line"></i></a>
</div> -->
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
<div class="ti-modal-footer">
<button #closeModalStock type="button" class="hs-dropdown-toggle ti-btn ti-btn-light align-middle"
data-hs-overlay="#modal-stock-his">
ปิด
</button>
</div>
</div>
</div>
</div>
...@@ -72,7 +72,8 @@ export class AdminProjectEquirementComponent { ...@@ -72,7 +72,8 @@ export class AdminProjectEquirementComponent {
_searchTerm = ""; _searchTerm = "";
isEdit = false; isEdit = false;
empList: ProjectMemberModel[] = [] empList: ProjectMemberModel[] = []
constructor(private http: HttpClient, private eqService: EquipmentService, public translate: TranslateService, private tokenService: TokenService, private projectEquipmentService: ProjectEquipmentService, private borrowTransactionsService: BorrowTransactionsService,private projectMemberService: ProjectMemberService) { hisList: BorrowTransactionsModel[] = []
constructor(private http: HttpClient, private eqService: EquipmentService, public translate: TranslateService, private tokenService: TokenService, private projectEquipmentService: ProjectEquipmentService, private borrowTransactionsService: BorrowTransactionsService, private projectMemberService: ProjectMemberService) {
this.projectId = this.tokenService.getSelectCompany().projectId!; this.projectId = this.tokenService.getSelectCompany().projectId!;
} }
...@@ -160,6 +161,12 @@ export class AdminProjectEquirementComponent { ...@@ -160,6 +161,12 @@ export class AdminProjectEquirementComponent {
// this.selectStock.action = "INBOUND" // this.selectStock.action = "INBOUND"
} }
viewHisStock(item: ProjectEquipmentModel) {
this.borrowTransactionsService.search(item.peId).subscribe(result => {
this.hisList = result
})
}
// save() { // save() {
// console.log(this.selectModel) // console.log(this.selectModel)
// swal({ // swal({
...@@ -225,16 +232,16 @@ export class AdminProjectEquirementComponent { ...@@ -225,16 +232,16 @@ export class AdminProjectEquirementComponent {
.then((willDelete: any) => { .then((willDelete: any) => {
if (willDelete) { if (willDelete) {
this.borrowTransactionsService.save({ this.borrowTransactionsService.save({
"peId" : this.selectModel.peId, "peId": this.selectModel.peId,
"quantity_borrowed": this.borrowSelect.quantity_borrowed, "quantity_borrowed": this.borrowSelect.quantity_borrowed,
"status": "approved", "status": "approved",
"memberId": this.borrowSelect.memberId, "memberId": this.borrowSelect.memberId,
"approved_by" : this.tokenService.getUser().member.memberId "approved_by": this.tokenService.getUser().member.memberId
}).subscribe(result => { }).subscribe(result => {
swal("Save Success!!", "บันทึกข้อมูลสำเร็จ", "success"); swal("Save Success!!", "บันทึกข้อมูลสำเร็จ", "success");
this.ngOnInit() this.ngOnInit()
this.closeModalStock?.nativeElement.click() this.closeModalStock?.nativeElement.click()
},(error: any)=>{ }, (error: any) => {
swal("Fail!!", error.error.detail, "info"); swal("Fail!!", error.error.detail, "info");
}) })
} }
......
...@@ -9,6 +9,7 @@ export class BorrowTransactionsModel extends BaseModel { ...@@ -9,6 +9,7 @@ export class BorrowTransactionsModel extends BaseModel {
created_at: string; created_at: string;
peId: string; peId: string;
memberId: string; memberId: string;
approved_by: string;
constructor(data?: Partial<BorrowTransactionsModel>, translateService?: TranslateService) { constructor(data?: Partial<BorrowTransactionsModel>, translateService?: TranslateService) {
super(data, translateService); super(data, translateService);
...@@ -17,5 +18,7 @@ export class BorrowTransactionsModel extends BaseModel { ...@@ -17,5 +18,7 @@ export class BorrowTransactionsModel extends BaseModel {
this.quantity_borrowed = data?.quantity_borrowed ?? 0; this.quantity_borrowed = data?.quantity_borrowed ?? 0;
this.status = data?.status ?? ''; this.status = data?.status ?? '';
this.returned_date = data?.returned_date ?? '' this.returned_date = data?.returned_date ?? ''
this.memberId = data?.memberId ?? ''
this.approved_by = data?.approved_by ?? ''
} }
} }
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'; import { HttpClient, HttpParams } from '@angular/common/http';
import { map, tap, switchMap, filter, reduce } from "rxjs/operators"; import { map, tap, switchMap, filter, reduce } from "rxjs/operators";
import { BorrowTransactionsModel } from '../models/borrow-transactions'; import { BorrowTransactionsModel } from '../models/borrow-transactions';
import { environment } from '../../../environments/environment'; import { environment } from '../../../environments/environment';
...@@ -47,6 +47,17 @@ export class BorrowTransactionsService { ...@@ -47,6 +47,17 @@ export class BorrowTransactionsService {
}>(this.apiBaseUrl + "/" + body.borrowId); }>(this.apiBaseUrl + "/" + body.borrowId);
} }
search(peId: string, memberId?: string) {
const params = new HttpParams()
.set('peId', peId)
.set('memberId', memberId!)
return this.http.get<BorrowTransactionsModel[]>(`${this.apiBaseUrl}/search/borrow`, { params })
.pipe(
map((e) => e.map((e) => new BorrowTransactionsModel(e)))
);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment