Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideAnimations } from '@angular/platform-browser/animations';
import { provideRouter } from '@angular/router';

import { provideHttpClient } from '@angular/common/http';
import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes),
provideAnimations(),
provideHttpClient(),
]
};

9 changes: 9 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';

bootstrapApplication(AppComponent, {
providers: [
provideHttpClient(withInterceptorsFromDi())
]
});
14 changes: 13 additions & 1 deletion src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ import { authGuard } from './gaurds/auth.guard'
import { roleGuard } from './gaurds/role.guard';
import { VendorSignupComponent } from './components/auth-page/vendor-signup/vendor-signup.component';
import { SupplierSignupComponent } from './components/auth-page/supplier-signup/supplier-signup.component';
import { VendorComponent } from './components/vendor-page/vender/vendor.component';
import { ProductSectionComponent } from './components/vendor-page/product-section/product-section.component';
import { CartComponent } from './components/vendor-page/cart/cart.component';
import { OrderSummaryComponent } from './components/vendor-page/order-summary/order-summary.component';
import { CartSummaryComponent } from './components/vendor-page/cart-summary/cart-summary.component';
import { OrdersComponent } from './components/vendor-page/orders/orders.component';

export const routes: Routes = [
{
Expand All @@ -35,7 +41,7 @@ export const routes: Routes = [
{
path: 'dashboard',
component: DashboardLayoutComponent,
canActivate: [authGuard],
// canActivate: [authGuard],
children: [
{ path: '', component: ProfileComponent, pathMatch: 'full' }, // /dashboard
{ path: 'profile', component: ProfileComponent, pathMatch: 'full' },
Expand All @@ -51,6 +57,12 @@ export const routes: Routes = [
// { path: 'deliveries', component: DeliveriesComponent }, // /dashboard/deliveries
// { path: 'vendors', component: VendorsComponent },
{ path: 'supplier', component: SupplierDashboard, pathMatch: 'full' },
{ path: 'vendor', component: VendorComponent, pathMatch: 'full' },
{ path: 'vendor/products', component: ProductSectionComponent, pathMatch: 'full' },
{ path: 'vendor/cart', component: CartComponent, pathMatch: 'full' },
{ path: 'vendor/orders/order-details/:id', component: OrderSummaryComponent, pathMatch: 'full' },
{ path: 'vendor/cart-summery', component: CartSummaryComponent, pathMatch: 'full' },
{ path: 'vendor/orders', component: OrdersComponent, pathMatch: 'full' },
]
},
{ path: '**', redirectTo: 'home' }, // Handle 404/unknown routes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ <h3 class="text-2xl font-bold text-gray-800">
<div class="flex justify-between items-center mt-6">
<button
class="px-4 py-2 bg-yellow-500 text-white rounded-md hover:bg-yellow-600 transition font-medium"
(click)="addToCart(selectedProduct)"
>
Add to Cart
</button>
Expand All @@ -110,7 +111,7 @@ <h3 class="text-2xl font-bold text-gray-800">
<div class="relative">
<select
class="appearance-none bg-white border border-gray-300 text-gray-800 rounded-md py-1.5 pl-3 pr-8 text-sm cursor-pointer hover:border-yellow-400 focus:ring-2 focus:ring-yellow-500/20 focus:border-yellow-500 focus:outline-none transition-all"
>
>
<option value="1" class="py-2 px-4 hover:bg-yellow-50">
1
</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,15 @@ export class ProductSectionComponent {
if (e.key === 'Escape') this.closeProductModal();
};

addToCart(product: any) {
// Get existing cart items or initialize empty array
const cartItems = JSON.parse(localStorage.getItem('cart') || '[]');

// Add new product to cart
cartItems.push(product);

// Save updated cart back to localStorage
localStorage.setItem('cart', JSON.stringify(cartItems));
}

}
6 changes: 6 additions & 0 deletions src/app/components/sidebar/sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ export class SidebarComponent {
// icon: this.sanitize(`<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
// d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />`)
},
{
label: 'Vendor',
route: 'vendor',
// icon: this.sanitize(`<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
// d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />`)
},
{
label: 'Orders',
route: '/orders',
Expand Down
Empty file.
Loading