Working on complete task
This commit is contained in:
@@ -80,15 +80,16 @@ app.get("/", (req,res)=>{
|
||||
res.send("Server Ran Properly")
|
||||
})
|
||||
|
||||
app.get("/api/backup", async (req,res)=>{
|
||||
const allBackup = await BackupModel.find({ deleted: { $ne: true} }).sort({ projectName: 'asc' })
|
||||
res.send(allBackup)
|
||||
})
|
||||
|
||||
app.get("/api/update", async (req,res)=>{
|
||||
const allUpdate = await UpdateModel.find({}).sort({ Date: 'asc' })
|
||||
res.status(200).send(allUpdate);
|
||||
})
|
||||
|
||||
app.get("/api/backup", async (req,res)=>{
|
||||
const allBackup = await BackupModel.find({ deleted: { $ne: true} }).sort({ projectName: 'asc' })
|
||||
res.send(allBackup)
|
||||
})
|
||||
|
||||
app.post("/api/update/add", async (req,res)=>{
|
||||
const {Date, Details, Reference, Remarks, Sales, Handler, Status, deleted} = req.body;
|
||||
@@ -110,6 +111,16 @@ app.post("/api/update/add", async (req,res)=>{
|
||||
})
|
||||
})
|
||||
|
||||
app.post("/api/update/complete", async(req,res)=>{
|
||||
const id = req.body.id;
|
||||
const status = req.body.Status;
|
||||
const update = await BackupModel.findOneAndUpdate({_id: id},{ Status: status })
|
||||
console.log(update)
|
||||
if (update) {
|
||||
res.send(update)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const PORT = 3000;
|
||||
app.listen(PORT,()=>{
|
||||
|
||||
@@ -1,4 +1,31 @@
|
||||
<page-title title="Shift Update"></page-title>
|
||||
<div class="container">
|
||||
<page-title title="Shift Update"></page-title>
|
||||
<app-input-form [fields]="tableHeaderList" (formValues)="addUpdate($event)"
|
||||
(clicked)="onClick()"></app-input-form>
|
||||
<app-table [tableHeaders]="tableHeaderList" [rowDataList]="updateDataList" (complete)="completeTask($event)" (delete)="deleteTask($event)"></app-table>
|
||||
<div class="table-container">
|
||||
<div class="table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th *ngFor="let tableHeader of tableHeaderList">{{tableHeader}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let updateData of updateDataList; let i = index" (click)="toggleRow(i)">
|
||||
<td>{{updateData.Date}}</td>
|
||||
<td>{{updateData.Details | shorten:getRowNumber(i)}}</td>
|
||||
<td>{{updateData.Remarks | shorten:getRowNumber(i)}}</td>
|
||||
<td>{{updateData.Sales_Concern}}</td>
|
||||
<td>{{updateData.Reference | shorten:getRowNumber(i)}}</td>
|
||||
<td>{{updateData.Handler}}</td>
|
||||
<td>{{updateData.Status}}</td>
|
||||
<td class="actions"><button (click)="onComplete(updateData)" class="complete"><i class="bi bi-check-lg"></i></button><button (click)="onDelete()" class="delete"><i class="bi bi-x-lg"></i></button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <app-table [tableHeaders]="tableHeaderList" [rowDataList]="updateDataList" (complete)="completeTask($event)" (delete)="deleteTask($event)"></app-table> -->
|
||||
@@ -0,0 +1,96 @@
|
||||
@import './../../../shared/scss/colors.scss';
|
||||
|
||||
.table-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
|
||||
.table{
|
||||
padding: 0rem 2rem;
|
||||
}
|
||||
|
||||
table {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
table, tr, td {
|
||||
border-collapse: collapse;
|
||||
border: none;
|
||||
}
|
||||
|
||||
th{
|
||||
color: $txt-heading-color;
|
||||
font-size: 1.5rem;
|
||||
padding-bottom: 3rem;
|
||||
position:sticky;
|
||||
}
|
||||
|
||||
tbody tr {
|
||||
transition: all 0.3s
|
||||
}
|
||||
|
||||
tbody tr:hover {
|
||||
transform: scale(1.01);
|
||||
background-color: rgba($hover-color,0.5);
|
||||
border-collapse: collapse;
|
||||
border: none;
|
||||
}
|
||||
|
||||
td:first-child{
|
||||
border-radius: 1rem 0rem 0rem 1rem;
|
||||
padding-left: 2rem;
|
||||
}
|
||||
|
||||
td:nth-child(3){
|
||||
transition: color 0.09s ease-in-out;
|
||||
}
|
||||
td:last-child{
|
||||
border-radius: 0rem 1rem 1rem 0rem;
|
||||
padding-right: 2rem;
|
||||
}
|
||||
|
||||
td:nth-child(3):active {
|
||||
color: rgb(168, 168, 168);
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background-color: rgba(0,0,0,0.03);
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 0.7rem 1.5rem;
|
||||
-webkit-user-select: none; /* Safari */
|
||||
-ms-user-select: none; /* IE 10 and IE 11 */
|
||||
user-select: none; /* Standard syntax */
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.complete{
|
||||
background-color: $txt-heading-color;
|
||||
border: none;
|
||||
height: 2rem;
|
||||
width: 2.5rem;
|
||||
border-radius: 10px;
|
||||
&:hover {
|
||||
background-color: darken($txt-heading-color, 20);
|
||||
}
|
||||
}
|
||||
|
||||
.delete {
|
||||
background-color: $danger;
|
||||
border: none;
|
||||
height: 2rem;
|
||||
width: 2.5rem;
|
||||
border-radius: 10px;
|
||||
margin-top: 5px;
|
||||
&:hover {
|
||||
background-color: darken($danger, 20);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
import { TableComponent } from '../../../shared/components/table/table.component';
|
||||
import { UpdateService } from './update.service';
|
||||
import { TitleComponent } from '../../../shared/components/title/title.component';
|
||||
import { InputFormComponent } from "../../../shared/components/input-form/input-form.component";
|
||||
import { Update } from '../../../shared/model/update.model';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ShortenPipe } from '../../../shared/pipe/shorten.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'app-shift-update',
|
||||
standalone: true,
|
||||
imports: [TableComponent, TitleComponent, InputFormComponent],
|
||||
imports: [TitleComponent, InputFormComponent, CommonModule, ShortenPipe],
|
||||
templateUrl: './shift-update.component.html',
|
||||
styleUrl: './shift-update.component.scss',
|
||||
providers: [UpdateService]
|
||||
@@ -28,21 +29,12 @@ export class ShiftUpdateComponent implements OnInit, OnDestroy {
|
||||
this.updateDataList = update;
|
||||
console.log(this.updateDataList.keys)
|
||||
});
|
||||
console.log(this.completeTask)
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.updateListSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
completeTask(event: string) {
|
||||
//
|
||||
}
|
||||
|
||||
deleteTask(event: boolean) {
|
||||
//
|
||||
}
|
||||
|
||||
addUpdate(newUpdate:any){
|
||||
this.updateService.addUpdate(newUpdate);
|
||||
}
|
||||
@@ -51,4 +43,22 @@ export class ShiftUpdateComponent implements OnInit, OnDestroy {
|
||||
this.updateDataList = update;
|
||||
})
|
||||
}
|
||||
|
||||
expandRowIndex: number | null = null;
|
||||
|
||||
toggleRow(index: number){
|
||||
this.expandRowIndex = this.expandRowIndex === index ? null : index;
|
||||
}
|
||||
getRowNumber(index: number): number {
|
||||
return this.expandRowIndex === index ? 15000 : 75;
|
||||
}
|
||||
|
||||
onComplete(update: Update){
|
||||
update.Status = "completed";
|
||||
this.updateService.updateStatus(update)
|
||||
}
|
||||
|
||||
onDelete() {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { sample_update } from "./sample_update";
|
||||
import { Observable } from "rxjs";
|
||||
import { Update } from "../../../shared/model/update.model";
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { UPDATE_ADD_URL, UPDATE_GET_URL } from "../../../shared/constants/backend";
|
||||
import { UPDATE_ADD_URL, UPDATE_COMPLETE_URL, UPDATE_GET_URL } from "../../../shared/constants/backend";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -23,5 +23,11 @@ export class UpdateService{
|
||||
console.log(log)
|
||||
})
|
||||
}
|
||||
|
||||
updateStatus(newUpdate: Update) {
|
||||
this.httpClient.post(UPDATE_COMPLETE_URL,newUpdate).subscribe((res)=>{
|
||||
console.log(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,4 +2,5 @@ const MAIN_URL = "http://localhost:3000/api"
|
||||
|
||||
export const BACKUP_GET_URL = `${MAIN_URL}/backup`;
|
||||
export const UPDATE_GET_URL = `${MAIN_URL}/update`;
|
||||
export const UPDATE_ADD_URL = `${UPDATE_GET_URL}/add`
|
||||
export const UPDATE_ADD_URL = `${UPDATE_GET_URL}/add`;
|
||||
export const UPDATE_COMPLETE_URL = `${UPDATE_GET_URL}/complete`
|
||||
@@ -91,4 +91,22 @@ export const all_tools: Tool[] = [
|
||||
userName: "core.system@intercloud.com.bd",
|
||||
password: "mBSrdN&I/d90"
|
||||
},
|
||||
{
|
||||
name: "Backup Portal RDP",
|
||||
url: "baas.brilliant.com.bd",
|
||||
userName: "administrator",
|
||||
password: "kjferi_lfbDSNQK@#346"
|
||||
},
|
||||
{
|
||||
name: "Backup Portal main RDP",
|
||||
url: "backup.brilliant.com.bd",
|
||||
userName: "administrator",
|
||||
password: "kjferi_lfbDSNQK@#346"
|
||||
},
|
||||
{
|
||||
name: "Remote VPN Password",
|
||||
url: "103.248.13.66:10443",
|
||||
userName: "mosiur.rahman",
|
||||
password: "Hgd%4st#4d"
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user