| @@ -20,4 +20,5 @@ | |||||
| <section class="malls"> | <section class="malls"> | ||||
| <app-malls></app-malls> | <app-malls></app-malls> | ||||
| <app-vendors></app-vendors> | |||||
| </section> | </section> | ||||
| @@ -13,8 +13,6 @@ | |||||
| <div class="upfold-content"> | <div class="upfold-content"> | ||||
| <h5> {{malls.mall_name}}</h5> | <h5> {{malls.mall_name}}</h5> | ||||
| <p>{{malls.description}}</p> | <p>{{malls.description}}</p> | ||||
| {{showModal}} | |||||
| <div> | <div> | ||||
| <span *ngIf='malls.outlet.length > 0'>Outlets: {{malls.outlet.length}}</span> | <span *ngIf='malls.outlet.length > 0'>Outlets: {{malls.outlet.length}}</span> | ||||
| <span *ngIf='malls.outlet.length === 0'>Outlets: 0</span> | <span *ngIf='malls.outlet.length === 0'>Outlets: 0</span> | ||||
| @@ -26,7 +24,7 @@ | |||||
| </li> | </li> | ||||
| </div> | </div> | ||||
| <div class="popUp"> | |||||
| <div class="popUp" *ngIf='showModal === true'> | |||||
| <div class="popup-box"> | <div class="popup-box"> | ||||
| <ul class="input-list"> | <ul class="input-list"> | ||||
| <h4>Mall Details:</h4> | <h4>Mall Details:</h4> | ||||
| @@ -34,31 +32,31 @@ | |||||
| <div class="mallDetails"> | <div class="mallDetails"> | ||||
| <li> | <li> | ||||
| <label>Name:</label> | <label>Name:</label> | ||||
| <input type="text" [(ngModel)]="newMall.mall_name" required> | |||||
| <input type="text" [(ngModel)]="newMall.mall_name"> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Description:</label> | <label>Description:</label> | ||||
| <input type="text" [(ngModel)]='newMall.description' required> | |||||
| <input type="text" [(ngModel)]='newMall.description'> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Image:</label> | <label>Image:</label> | ||||
| <input type="text" [(ngModel)]='newMall.image_url' required> | |||||
| <input type="text" [(ngModel)]='newMall.image_url'> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Address:</label> | <label>Address:</label> | ||||
| <input type="text" [(ngModel)]='newMall.mall_address' required> | |||||
| <input type="text" [(ngModel)]='newMall.mall_address'> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Mall Distance:</label> | <label>Mall Distance:</label> | ||||
| <input type="number" [(ngModel)]='newMall.mall_distance' required> | |||||
| <input type="number" [(ngModel)]='newMall.mall_distance'> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Rating:</label> | <label>Rating:</label> | ||||
| <input type="number" [(ngModel)]='newMall.rating' required> | |||||
| <input type="number" [(ngModel)]='newMall.rating'> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Offers Count:</label> | <label>Offers Count:</label> | ||||
| <input type="number" [(ngModel)]='newMall.offers_count' required> | |||||
| <input type="number" [(ngModel)]='newMall.offers_count'> | |||||
| </li> | </li> | ||||
| </div> | </div> | ||||
| @@ -66,19 +64,19 @@ | |||||
| <div class="addDetails"> | <div class="addDetails"> | ||||
| <li> | <li> | ||||
| <label>Created By</label> | <label>Created By</label> | ||||
| <input type="text" [(ngModel)]="newMall.advertisement.createdBy" required> | |||||
| <input type="text" [(ngModel)]="newMall.advertisement[0].createdBy"> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Image</label> | <label>Image</label> | ||||
| <input type="text" [(ngModel)]="newMall.advertisement.image" required> | |||||
| <input type="text" [(ngModel)]="newMall.advertisement[0].image"> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Type</label> | <label>Type</label> | ||||
| <input type="text" [(ngModel)]="newMall.advertisement.type" required> | |||||
| <input type="text" [(ngModel)]="newMall.advertisement[0].type"> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Updated By</label> | <label>Updated By</label> | ||||
| <input type="text" [(ngModel)]="newMall.advertisement.updatedBy" required> | |||||
| <input type="text" [(ngModel)]="newMall.advertisement[0].updatedBy"> | |||||
| </li> | </li> | ||||
| </div> | </div> | ||||
| @@ -86,38 +84,46 @@ | |||||
| <div class="outletdistance"> | <div class="outletdistance"> | ||||
| <li> | <li> | ||||
| <label>Outlet Name</label> | <label>Outlet Name</label> | ||||
| <input type="text" [(ngModel)]="newMall.outlet.outlet_name" required> | |||||
| <input type="text" [(ngModel)]="newMall.outlet[0].outlet_name"> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Description</label> | <label>Description</label> | ||||
| <input type="text" [(ngModel)]="newMall.outlet.description" required> | |||||
| <input type="text" [(ngModel)]="newMall.outlet[0].description"> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Outlet Timings</label> | <label>Outlet Timings</label> | ||||
| <input type="text" [(ngModel)]="newMall.outlet.outlet_timing" required> | |||||
| <input type="text" [(ngModel)]="newMall.outlet[0].outlet_timing"> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Image</label> | <label>Image</label> | ||||
| <input type="text" [(ngModel)]="newMall.outlet.image_url" required> | |||||
| <input type="text" [(ngModel)]="newMall.outlet[0].image_url"> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Outlet GST</label> | <label>Outlet GST</label> | ||||
| <input type="number" [(ngModel)]="newMall.outlet.outlet_Gst" required> | |||||
| <input type="number" [(ngModel)]="newMall.outlet[0].outlet_Gst"> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Outlet Type</label> | <label>Outlet Type</label> | ||||
| <input type="text" [(ngModel)]="newMall.outlet.outlet_type" required> | |||||
| <input type="text" [(ngModel)]="newMall.outlet[0].outlet_type"> | |||||
| </li> | </li> | ||||
| <li> | <li> | ||||
| <label>Rating</label> | <label>Rating</label> | ||||
| <input type="number" [(ngModel)]="newMall.outlet.rating" required> | |||||
| <input type="number" [(ngModel)]="newMall.outlet[0].rating"> | |||||
| </li> | </li> | ||||
| </div> | </div> | ||||
| </ul> | </ul> | ||||
| <div class="action-buttons"> | <div class="action-buttons"> | ||||
| <button class="rect-button cancel" (click)="showModal = false">Cancel</button> | <button class="rect-button cancel" (click)="showModal = false">Cancel</button> | ||||
| <button class="rect-button" (click)="addMall()">Add</button> | |||||
| <button class="rect-button" [ngClass]='{disable: ((newMall.mall_name.length && newMall.mall_address.length && | |||||
| newMall.image_url.length && | |||||
| newMall.advertisement[0].createdBy && | |||||
| newMall.advertisement[0].image.length && | |||||
| newMall.advertisement[0].type && | |||||
| newMall.outlet[0].outlet_name && | |||||
| newMall.outlet[0].image_url) === 0)}' (click)="addMall()" [disabled]='(newMall.mall_name.length && newMall.mall_address.length && newMall.image_url.length && | |||||
| newMall.advertisement[0].createdBy.length && newMall.advertisement[0].image.length && newMall.advertisement[0].type.length && | |||||
| newMall.outlet[0].outlet_name.length && newMall.outlet[0].image_url.length) === 0'>Add</button> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -181,6 +181,11 @@ | |||||
| border: 2px solid var(--brand-blue); | border: 2px solid var(--brand-blue); | ||||
| color: var(--brand-blue); | color: var(--brand-blue); | ||||
| } | } | ||||
| &.disable { | |||||
| cursor: not-allowed; | |||||
| filter: grayscale(1); | |||||
| } | |||||
| } | } | ||||
| li { | li { | ||||
| @@ -17,68 +17,75 @@ export class MallsComponent implements OnInit { | |||||
| tempMalls: any = []; | tempMalls: any = []; | ||||
| showModal: boolean = false; | showModal: boolean = false; | ||||
| toggleAdd: boolean = false; | |||||
| newMall: { | newMall: { | ||||
| advertisement: { | |||||
| adv_type: true, | |||||
| createdBy: string, | |||||
| createdOn: string, | |||||
| image: string, | |||||
| soft_delete: true, | |||||
| type: string, | |||||
| updatedBy: string, | |||||
| updatedOn: string, | |||||
| }, | |||||
| advertisement: [ | |||||
| { | |||||
| adv_type: true, | |||||
| createdBy: string, | |||||
| createdOn: string, | |||||
| image: string, | |||||
| soft_delete: true, | |||||
| type: string, | |||||
| updatedBy: string, | |||||
| updatedOn: string, | |||||
| } | |||||
| ], | |||||
| description: string, | description: string, | ||||
| image_url: string, | image_url: string, | ||||
| is_bookmarked: true, | is_bookmarked: true, | ||||
| mall_address: string, | mall_address: string, | ||||
| mall_distance: number, | |||||
| mall_distance: 0, | |||||
| mall_name: string, | mall_name: string, | ||||
| offers_count: number, | |||||
| outlet: { | |||||
| description: string, | |||||
| image_url: string, | |||||
| is_bookmarked: true, | |||||
| outlet_Gst: 0, | |||||
| outlet_id: 0, | |||||
| outlet_name: string, | |||||
| outlet_timing: string, | |||||
| outlet_type: string, | |||||
| rating: number, | |||||
| }, | |||||
| rating: number, | |||||
| offers_count: 0, | |||||
| outlet: [ | |||||
| { | |||||
| description: string, | |||||
| image_url: string, | |||||
| is_bookmarked: true, | |||||
| outlet_Gst: number, | |||||
| outlet_id: number, | |||||
| outlet_name: string, | |||||
| outlet_timing: string, | |||||
| outlet_type: string, | |||||
| rating: number | |||||
| } | |||||
| ], | |||||
| rating: 0, | |||||
| soft_delete: true | soft_delete: true | ||||
| } = { | } = { | ||||
| advertisement: { | |||||
| adv_type: true, | |||||
| createdBy: '', | |||||
| createdOn: '', | |||||
| image: '', | |||||
| soft_delete: true, | |||||
| type: '', | |||||
| updatedBy: '', | |||||
| updatedOn: '', | |||||
| }, | |||||
| description: '', | |||||
| image_url: '', | |||||
| advertisement: [ | |||||
| { | |||||
| adv_type: true, | |||||
| createdBy: "", | |||||
| createdOn: "2021-10-26T12:19:53.071Z", | |||||
| image: "", | |||||
| soft_delete: true, | |||||
| type: "", | |||||
| updatedBy: "", | |||||
| updatedOn: "2021-10-26T12:19:53.071Z" | |||||
| } | |||||
| ], | |||||
| description: "", | |||||
| image_url: "", | |||||
| is_bookmarked: true, | is_bookmarked: true, | ||||
| mall_address: '', | |||||
| mall_address: "", | |||||
| mall_distance: 0, | mall_distance: 0, | ||||
| mall_name: '', | |||||
| mall_name: "", | |||||
| offers_count: 0, | offers_count: 0, | ||||
| outlet: { | |||||
| description: '', | |||||
| image_url: '', | |||||
| is_bookmarked: true, | |||||
| outlet_Gst: 0, | |||||
| outlet_id: 0, | |||||
| outlet_name: '', | |||||
| outlet_timing: '', | |||||
| outlet_type: '', | |||||
| rating: 0, | |||||
| }, | |||||
| outlet: [ | |||||
| { | |||||
| description: "", | |||||
| image_url: "", | |||||
| is_bookmarked: true, | |||||
| outlet_Gst: 0, | |||||
| outlet_id: 0, | |||||
| outlet_name: "", | |||||
| outlet_timing: "2021-10-26T12:19:53.071Z", | |||||
| outlet_type: "", | |||||
| rating: 0 | |||||
| } | |||||
| ], | |||||
| rating: 0, | rating: 0, | ||||
| soft_delete: true | soft_delete: true | ||||
| } | } | ||||
| @@ -90,7 +97,6 @@ export class MallsComponent implements OnInit { | |||||
| ngOnInit() { | ngOnInit() { | ||||
| this.getAllMalls() | this.getAllMalls() | ||||
| console.log(this.currentTime) | |||||
| } | } | ||||
| getAllMalls() { | getAllMalls() { | ||||
| @@ -103,7 +109,6 @@ export class MallsComponent implements OnInit { | |||||
| this.tempMalls = arrayofMalls; | this.tempMalls = arrayofMalls; | ||||
| localStorage.allMalls = JSON.stringify(arrayofMalls) | localStorage.allMalls = JSON.stringify(arrayofMalls) | ||||
| console.log(this.allMalls) | |||||
| }, (error) => { | }, (error) => { | ||||
| console.log("Error getting Malls", error) | console.log("Error getting Malls", error) | ||||
| }) | }) | ||||
| @@ -120,6 +125,15 @@ export class MallsComponent implements OnInit { | |||||
| } | } | ||||
| addMall() { | addMall() { | ||||
| this.mallService.addNewMall(this.newMall).then(response => { | |||||
| alert("Mall Added Successfully") | |||||
| this.showModal = false; | |||||
| console.log(response) | |||||
| }, () => { | |||||
| console.log("Error Adding New Mall") | |||||
| }) | |||||
| console.log(this.newMall) | console.log(this.newMall) | ||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1 @@ | |||||
| @import '../commonCard'; | |||||
| @@ -0,0 +1,25 @@ | |||||
| import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |||||
| import { VendorsComponent } from './vendors.component'; | |||||
| describe('VendorsComponent', () => { | |||||
| let component: VendorsComponent; | |||||
| let fixture: ComponentFixture<VendorsComponent>; | |||||
| beforeEach(async(() => { | |||||
| TestBed.configureTestingModule({ | |||||
| declarations: [ VendorsComponent ] | |||||
| }) | |||||
| .compileComponents(); | |||||
| })); | |||||
| beforeEach(() => { | |||||
| fixture = TestBed.createComponent(VendorsComponent); | |||||
| component = fixture.componentInstance; | |||||
| fixture.detectChanges(); | |||||
| }); | |||||
| it('should create', () => { | |||||
| expect(component).toBeTruthy(); | |||||
| }); | |||||
| }); | |||||
| @@ -0,0 +1,23 @@ | |||||
| import { Component, OnInit } from '@angular/core'; | |||||
| import { VendorService } from 'src/app/services/vendor.service'; | |||||
| @Component({ | |||||
| selector: 'app-vendors', | |||||
| templateUrl: './vendors.component.html', | |||||
| styleUrls: ['./vendors.component.scss'] | |||||
| }) | |||||
| export class VendorsComponent implements OnInit { | |||||
| constructor(private vendorService: VendorService) { } | |||||
| vendorInfo: any | |||||
| ngOnInit() { | |||||
| this.getVendorInfo() | |||||
| } | |||||
| getVendorInfo(){ | |||||
| } | |||||
| } | |||||
| @@ -34,6 +34,7 @@ import { NotificaitonComponent } from './admin/notificaiton/notificaiton.compone | |||||
| import { SupportTicketsComponent } from './admin/support-tickets/support-tickets.component'; | import { SupportTicketsComponent } from './admin/support-tickets/support-tickets.component'; | ||||
| import { QueriesComponent } from './admin/queries/queries.component'; | import { QueriesComponent } from './admin/queries/queries.component'; | ||||
| import { MallsComponent } from './admin/malls/malls.component'; | import { MallsComponent } from './admin/malls/malls.component'; | ||||
| import { VendorsComponent } from './admin/vendors/vendors.component'; | |||||
| @NgModule({ | @NgModule({ | ||||
| declarations: [ | declarations: [ | ||||
| @@ -54,7 +55,8 @@ import { MallsComponent } from './admin/malls/malls.component'; | |||||
| NotificaitonComponent, | NotificaitonComponent, | ||||
| SupportTicketsComponent, | SupportTicketsComponent, | ||||
| QueriesComponent, | QueriesComponent, | ||||
| MallsComponent | |||||
| MallsComponent, | |||||
| VendorsComponent | |||||
| ], | ], | ||||
| imports: [ | imports: [ | ||||
| BrowserModule, | BrowserModule, | ||||
| @@ -35,4 +35,17 @@ export class MallsService { | |||||
| return await this.http.get(URL + '/api/maioraservice/mall/v1/latitude/' + latitude + '/longitude/' + longitude + '/check/', httpOptions).toPromise(); | return await this.http.get(URL + '/api/maioraservice/mall/v1/latitude/' + latitude + '/longitude/' + longitude + '/check/', httpOptions).toPromise(); | ||||
| } | } | ||||
| async addNewMall(newMall: any) { | |||||
| const httpOptions = { | |||||
| headers: new HttpHeaders({ | |||||
| 'Access-Control-Allow-Origin': '*', | |||||
| 'Content-Type': 'application/json', | |||||
| 'Authorization': 'Bearer ' + localStorage.token | |||||
| }) | |||||
| }; | |||||
| return await this.http.post(URL + '/api/maioraservice/Mall/v1/create/', newMall, httpOptions).toPromise(); | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,12 @@ | |||||
| import { TestBed } from '@angular/core/testing'; | |||||
| import { VendorService } from './vendor.service'; | |||||
| describe('VendorService', () => { | |||||
| beforeEach(() => TestBed.configureTestingModule({})); | |||||
| it('should be created', () => { | |||||
| const service: VendorService = TestBed.get(VendorService); | |||||
| expect(service).toBeTruthy(); | |||||
| }); | |||||
| }); | |||||
| @@ -0,0 +1,24 @@ | |||||
| import { HttpClient, HttpHeaders } from '@angular/common/http'; | |||||
| import { Injectable } from '@angular/core'; | |||||
| import { URL } from '../data/url'; | |||||
| @Injectable({ | |||||
| providedIn: 'root' | |||||
| }) | |||||
| export class VendorService { | |||||
| constructor(private http: HttpClient) { } | |||||
| async getAllVendors() { | |||||
| const httpOptions = { | |||||
| headers: new HttpHeaders({ | |||||
| 'Access-Control-Allow-Origin': '*', | |||||
| 'Content-Type': 'application/json', | |||||
| 'Authorization': 'Bearer ' + localStorage.token | |||||
| }) | |||||
| }; | |||||
| return await this.http.get(URL + "/api/maioraservice/vendor/getallVendorsInfo", httpOptions).toPromise() | |||||
| } | |||||
| } | |||||