Selaa lähdekoodia

order-details

IbrahimNour 1 vuosi sitten
vanhempi
commit
e146d28ff7

+ 23 - 1
src/app/modules/orders/order-details/order-details.component.html

@@ -1 +1,23 @@
-<p>order-details works!</p>
+<section class="order-details" fxLayout="row wrap" fxLayoutAlign="start start">
+  <div class="order-details__details" fxFlex.lt-md="100" fxFlex.gt-sm="80">
+    <h4 class="bold">Vacation Order <span>Saturday 15/10/2023</span></h4>
+    <p>Subject <span>Ahmed Samir - Vacation Request</span></p>
+    <p>Hi Ayman</p>
+    <p>
+      I’d appreciate being able to take a one-week vacation during my children’s
+      spring break. The dates are 12th – 17th May. If it’s approved, I’ll be
+      able to catch up with the projects I’m currently working on, and I can get
+      a head start on any time-sensitive work due after my return. Thanks very
+      much for your consideration.
+    </p>
+  </div>
+  <div
+    class="order-details__cancel-request justfy-content-end"
+    fxFlex.lt-md="100"
+    fxFlex.gt-sm="20"
+  >
+    <button class="order-details__cancel-request__cancel-btn ptr">
+      Canccel Request
+    </button>
+  </div>
+</section>

+ 2 - 2
src/app/modules/orders/order-list/order-list.component.html

@@ -34,8 +34,8 @@
     <!-- Weight Column -->
     <ng-container matColumnDef="actions">
       <th mat-header-cell *matHeaderCellDef></th>
-      <td mat-cell *matCellDef="let element">
-        <button class="btn">View Detail</button>
+      <td mat-cell *matCellDef="let element" class="column-flex">
+        <button class="btn" (click)="onOpenDetail()">View Detail</button>
       </td>
     </ng-container>
 

+ 8 - 0
src/app/modules/orders/order-list/order-list.component.scss

@@ -23,3 +23,11 @@
   color: #e73232;
   padding: 12px 15px;
 }
+
+.column-flex {
+  display: flex;
+  height: 100%;
+  padding: 7px 0;
+  align-items: center;
+  justify-content: end;
+}

+ 10 - 0
src/app/modules/orders/order-list/order-list.component.ts

@@ -1,4 +1,5 @@
 import { Component } from '@angular/core';
+import { ActivatedRoute, Router } from '@angular/router';
 
 export interface PeriodicElement {
   order: number;
@@ -26,4 +27,13 @@ const ELEMENT_DATA: PeriodicElement[] = [
 export class OrderListComponent {
   displayedColumns: string[] = ['order', 'date', 'status', 'actions'];
   dataSource = ELEMENT_DATA;
+
+  constructor(
+    private readonly router: Router,
+    private readonly route: ActivatedRoute
+  ) {}
+
+  onOpenDetail(): void {
+    this.router.navigate(['./details'], { relativeTo: this.route });
+  }
 }

+ 5 - 1
src/app/modules/orders/orders-routing.module.ts

@@ -2,12 +2,16 @@ import { NgModule } from '@angular/core';
 import { RouterModule, Routes } from '@angular/router';
 import { OrdersComponent } from './orders.component';
 import { OrderListComponent } from './order-list/order-list.component';
+import { OrderDetailsComponent } from './order-details/order-details.component';
 
 const routes: Routes = [
   {
     path: '',
     component: OrdersComponent,
-    children: [{ path: '', component: OrderListComponent }],
+    children: [
+      { path: '', component: OrderListComponent },
+      { path: 'details', component: OrderDetailsComponent },
+    ],
   },
 ];
 

+ 38 - 0
src/app/modules/orders/orders.component.scss

@@ -5,6 +5,7 @@
       border-radius: 25px;
       padding: 20px;
       margin: 20px 0;
+      box-shadow: -2px 6px 9px #2f2c8333;
       header {
         h1 {
           font-size: 18px;
@@ -60,5 +61,42 @@
         border: 1px solid $main-blue;
       }
     }
+
+    .order-details {
+      &__details {
+        background-color: $card-color;
+        border-radius: 25px;
+        padding: 20px;
+        h4 {
+          color: $span-color;
+          font-size: 14px;
+          span {
+            color: $main-color;
+            font-weight: 16px;
+          }
+        }
+
+        p {
+          font-size: 15px;
+          color: #7b8793;
+          margin-top: 2rem;
+        }
+      }
+      &__cancel-request {
+        &__cancel-btn {
+          background-color: #b4b4b4;
+          color: #252525;
+          border: 1px solid #b4b4b4;
+          padding: 10px 30px;
+          border-radius: 10px;
+          font-size: 15px;
+          transition: all 0.5s;
+          &:hover {
+            background-color: $span-color;
+            color: $white-color;
+          }
+        }
+      }
+    }
   }
 }

+ 5 - 0
src/styles.scss

@@ -254,3 +254,8 @@ input.mat-input-element {
 .d-block {
   display: block;
 }
+
+.justfy-content-end {
+  display: flex;
+  justify-content: flex-end;
+}