Commit c712d60a by DESKTOP-HF0LVOG\myhr
parents 1e4baed0 a564c62c
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {NgbModal, ModalDismissReasons} from '@ng-bootstrap/ng-bootstrap'; import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap';
interface Country { interface EquirmentModel {
id?: number; id: number;
equip: string;
name: string; name: string;
sdate: string; desc: string;
edate: string; type: string;
pic: string;
} }
const COUNTRIES: Country[] = [
{
equip: 'string',
name: 'ray',
sdate: 'string',
edate: 'string'
}
];
@Component({ @Component({
selector: 'app-equipment', selector: 'app-equipment',
templateUrl: './equipment.component.html', templateUrl: './equipment.component.html',
...@@ -27,17 +17,48 @@ const COUNTRIES: Country[] = [ ...@@ -27,17 +17,48 @@ const COUNTRIES: Country[] = [
export class EquipmentComponent implements OnInit { export class EquipmentComponent implements OnInit {
page = 1; page = 1;
pageSize = 10; pageSize = 10;
collectionSize = COUNTRIES.length;
countries: Country[];
closeResult = ''; closeResult = '';
listEquirment: EquirmentModel[] = [
{
id: 1,
name: "จอคอมพิวเตอร์",
desc: "หน้าจอขนาด 22 นิ้ว",
type: "it",
pic: "assets\img\mo1.jpg"
},
{
id: 2,
name: "เมาส์",
desc: "...",
type: "it",
pic: "assets\img\mou.jpg"
},
{
id: 3,
name: "โน๊ตบุ๊ค",
desc: "หน้าจอขนาด 20 นิ้ว",
type: "it",
pic: "assets\img\notebook.jpg"
},
{
id: 4,
name: "คีย์บอร์ด",
desc: "...",
type: "it",
pic: "assets\img\keyboard.png"
}
]
collectionSize = this.listEquirment.length;
constructor(private modalService: NgbModal) { } constructor(private modalService: NgbModal) { }
ngOnInit(): void { ngOnInit(): void {
} }
open(content) { open(content) {
this.modalService.open(content, {ariaLabelledBy: 'modal-basic-title'}).result.then((result) => { this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then((result) => {
this.closeResult = `Closed with: ${result}`; this.closeResult = `Closed with: ${result}`;
}, (reason) => { }, (reason) => {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
...@@ -54,8 +75,8 @@ export class EquipmentComponent implements OnInit { ...@@ -54,8 +75,8 @@ export class EquipmentComponent implements OnInit {
} }
} }
refreshCountries() { refreshCountries() {
this.countries = COUNTRIES this.listEquirment = this.listEquirment
.map((country, i) => ({ id: i + 1, ...country })) .map((item, i) => ({ id: i + 1, ...item }))
.slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize); .slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize);
} }
} }
\ No newline at end of file
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