logo issue fixed

This commit is contained in:
bitbucket 2023-04-06 17:53:06 +05:30
parent 3c6360d127
commit 6c7cce1508
11 changed files with 188 additions and 20031 deletions

19962
ng-seed/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,11 @@ export class TokenInterceptor implements HttpInterceptor {
let authReq:any; // get the token from local storage let authReq:any; // get the token from local storage
if(token != '' && token != undefined && token != null){ if(token != '' && token != undefined && token != null){
authReq = req.clone({ authReq = req.clone({
headers: req.headers.set('x-access-token', token).set('Content-Type', 'application/json') setHeaders: {
// 'Authorization': environment.authorization,
'x-access-token': token
}
// headers: req.headers.set('x-access-token', token).set('Content-Type', 'multipart/form-data')
}); });
}else{ }else{
authReq = req; authReq = req;

View File

@ -22,12 +22,17 @@ export class AddBusinessComponent implements OnInit {
local_data:any; local_data:any;
url: string | ArrayBuffer; url: string | ArrayBuffer;
imageViewStatus: boolean = false; imageViewStatus: boolean = false;
formData: any=[];
selectedFiles: any;
currentFileUpload: any;
constructor(private router: Router,private formBuilder: FormBuilder, constructor(private router: Router,private formBuilder: FormBuilder,
public dialogRef: MatDialogRef<AddBusinessComponent>, public dialogRef: MatDialogRef<AddBusinessComponent>,
@Optional() @Inject(MAT_DIALOG_DATA) public data: UsersData) { @Optional() @Inject(MAT_DIALOG_DATA) public data: UsersData) {
console.log(data); console.log(data);
this.local_data = {...data}; this.local_data = {...data};
console.log(this.local_data)
this.action = this.local_data.action; this.action = this.local_data.action;
this.formData= new FormData();
} }
get f(){ get f(){
return this.form.controls; return this.form.controls;
@ -42,6 +47,8 @@ export class AddBusinessComponent implements OnInit {
} }
onSelectFile(event) { onSelectFile(event) {
console.log(event.target.files[0]) console.log(event.target.files[0])
const file = event.target.files[0];
if(event != null){ if(event != null){
this.imageViewStatus = true this.imageViewStatus = true
} }
@ -55,6 +62,14 @@ export class AddBusinessComponent implements OnInit {
console.log(this.url) console.log(this.url)
} }
} }
// this.formData=[];
this.formData.append('image', file, file.name);
console.log(this.currentFileUpload)
// this.formData.append('file', file, file.name);
} }
close() { close() {
this.dialogRef.close(); this.dialogRef.close();
@ -86,9 +101,25 @@ export class AddBusinessComponent implements OnInit {
submit(){ submit(){
let tmp = this.form.value let tmp = this.form.value
tmp.id = this.local_data.id tmp.id = this.local_data.id
this.dialogRef.close({event:this.action,data:tmp}); console.log(tmp)
console.log(this.form.value); // this.formData.append('image', this.currentFileUpload);
console.log(this.action,this.local_data) // console.log(this.formData.getAll('image'));
if(this.action == 'Update'){
this.formData.append('id', tmp.id);
this.formData.append('busId', this.local_data.busId);
}
this.formData.append('email', tmp.email);
this.formData.append('contactNo', tmp.contactNo);
this.formData.append('busName', tmp.busName);
this.formData.append('address', tmp.address);
this.formData.append('state', tmp.state);
this.formData.append('city', tmp.city);
console.log(this.formData)
this.dialogRef.close({event:this.action,data:this.formData});
// console.log(this.form.value);
// console.log(this.action,this.local_data)
} }
} }

View File

@ -16,12 +16,12 @@
<ng-container matColumnDef="id"> <ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef class="font-color"> S.NO </th> <th mat-header-cell *matHeaderCellDef class="font-color"> S.NO </th>
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.id}} </td> <td mat-cell *matCellDef="let element; let i = index;" class="element-spc"> {{i+1}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="logo"> <ng-container matColumnDef="logo">
<th mat-header-cell *matHeaderCellDef class="font-color"> Logo </th> <th mat-header-cell *matHeaderCellDef class="font-color"> Logo </th>
<td mat-cell *matCellDef="let element"> <img [src]="element.logo" /> </td> <td mat-cell *matCellDef="let element"> <img [src]="image_view(element.logo)" /> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="name"> <ng-container matColumnDef="name">

View File

@ -9,6 +9,7 @@ import { DialogBoxComponent } from 'app/appoinment/appoinments/dialog-box/dialog
import Swal from 'sweetalert2/dist/sweetalert2.js'; import Swal from 'sweetalert2/dist/sweetalert2.js';
import { AddBusinessComponent } from '../add-business/add-business.component'; import { AddBusinessComponent } from '../add-business/add-business.component';
import { BusinessService } from '../business-service/business.service'; import { BusinessService } from '../business-service/business.service';
import { environment } from 'environments/environment';
export interface UsersData { export interface UsersData {
@ -47,7 +48,7 @@ export class BusinessListComponent implements OnInit {
@ViewChild(MatTable,{static:true}) table: MatTable<any>; @ViewChild(MatTable,{static:true}) table: MatTable<any>;
@ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatPaginator) paginator: MatPaginator;
businessList: any; businessList: any;
private apiUrl = environment.apiEndpoint;
constructor(private notifierService: NotifierService,private router:Router,public dialog: MatDialog,public _bus:BusinessService) {} constructor(private notifierService: NotifierService,private router:Router,public dialog: MatDialog,public _bus:BusinessService) {}
@ -60,6 +61,7 @@ export class BusinessListComponent implements OnInit {
//this._pd.getTabStatusPdDetails(this.tabStatus) //this._pd.getTabStatusPdDetails(this.tabStatus)
this._bus.getBusinessListDetails().subscribe(res => { this._bus.getBusinessListDetails().subscribe(res => {
if (res.status == 200) { if (res.status == 200) {
console.log(res.data)
this.businessList = res.data; this.businessList = res.data;
} }
} }
@ -110,6 +112,7 @@ export class BusinessListComponent implements OnInit {
}) })
} }
openDialog(action,obj) { openDialog(action,obj) {
console.log(obj)
obj.action = action; obj.action = action;
const dialogRef = this.dialog.open(AddBusinessComponent, { const dialogRef = this.dialog.open(AddBusinessComponent, {
width: '30%', width: '30%',
@ -131,20 +134,20 @@ export class BusinessListComponent implements OnInit {
let formValue = [] let formValue = []
if(result.event == 'Add'){ if(result.event == 'Add'){
console.log('add') console.log('add')
let addFormData = { // let addFormData = {
address: row_obj.address, // address: row_obj.address,
image:row_obj.logo, // image:row_obj.logo,
// busId: 'abc123', // // busId: 'abc123',
city: row_obj.city, // city: row_obj.city,
busName: row_obj.busName, // busName: row_obj.busName,
email: row_obj.email, // email: row_obj.email,
contactNo: row_obj.contactNo, // contactNo: row_obj.contactNo,
// pincode: row_obj.pincode, // // pincode: row_obj.pincode,
state: row_obj.state , // state: row_obj.state ,
createdBy:row_obj.createdBy // createdBy:row_obj.createdBy
// workingHrsJson: row_obj.workingHrsJson // // workingHrsJson: row_obj.workingHrsJson
}; // };
formValue.push(addFormData); formValue.push(row_obj);
}else if(result.event == 'Update'){ }else if(result.event == 'Update'){
console.log('Update',row_obj) console.log('Update',row_obj)
row_obj.image = row_obj.logo row_obj.image = row_obj.logo
@ -226,4 +229,9 @@ export class BusinessListComponent implements OnInit {
// console.log(this.dataSource) // console.log(this.dataSource)
// } // }
image_view(image){
return this.apiUrl+'imageViewer?img_name='+image;
}
} }

View File

@ -20,11 +20,19 @@ export class BusinessService {
} }
addFormDetails(addParams:any): Observable<any> { addFormDetails(addParams:any): Observable<any> {
return this._http.post(this.apiUrl + 'createBusinessDetails', addParams) return this._http.post(this.apiUrl + 'createBusinessDetails', addParams)
// .pipe( // .pipe(
// catchError(this.handleError('role', [])) // catchError(this.handleError('role', []))
// ) // )
} }
img_name(img_name:any): Observable<any> {
return this._http.get(this.apiUrl + 'imageViewer?img_name=', img_name)
// .pipe(
// catchError(this.handleError('role', []))
// )
}
private handleError<T>(operation = 'operation', result?: T) { private handleError<T>(operation = 'operation', result?: T) {
return (error: any): Observable<T> => { return (error: any): Observable<T> => {

View File

@ -7,7 +7,7 @@
<form [formGroup]="form" (ngSubmit)="submit()"> <form [formGroup]="form" (ngSubmit)="submit()">
<mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane"> <mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane">
<mat-label>Business</mat-label> <mat-label>Business</mat-label>
<input placeholder="Name" matInput formControlName="businessselect" readonly> <input placeholder="Name" matInput formControlName="businessselect" >
<mat-error *ngIf="myError('businessselect', 'required')">Username is required</mat-error> <mat-error *ngIf="myError('businessselect', 'required')">Username is required</mat-error>
<mat-error *ngIf="myError('businessselect', 'maxlength')">Limit exceed</mat-error> <mat-error *ngIf="myError('businessselect', 'maxlength')">Limit exceed</mat-error>
</mat-form-field> </mat-form-field>
@ -61,22 +61,25 @@
<mat-error *ngIf="myError('password', 'required')">Password is required</mat-error> <mat-error *ngIf="myError('password', 'required')">Password is required</mat-error>
<mat-error *ngIf="myError('password', 'maxlength')">Limit exceed</mat-error> <mat-error *ngIf="myError('password', 'maxlength')">Limit exceed</mat-error>
</mat-form-field> </mat-form-field>
<img *ngIf="imageViewStatus == true" class="image mb-2" [src]="url" height="50" width="50">
<input type='file' (change)="onSelectFile($event)" formControlName="logo">
<!-- <mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane"> <!-- <mat-form-field appearance="outline" *ngIf="action != 'Delete'; else elseTemplate" class="mat-pane">
<input placeholder="ConfirmPassword" matInput formControlName="confirmPassword"> <input placeholder="ConfirmPassword" matInput formControlName="confirmPassword">
<mat-error *ngIf="myError('confirmPassword', 'required')">confirmPassword is required</mat-error> <mat-error *ngIf="myError('confirmPassword', 'required')">confirmPassword is required</mat-error>
<mat-error *ngIf="myError('confirmPassword', 'maxlength')">Limit exceed</mat-error> <mat-error *ngIf="myError('confirmPassword', 'maxlength')">Limit exceed</mat-error>
</mat-form-field> --> </mat-form-field> -->
<div mat-dialog-actions>
<button mat-button type="submit" class="mat-green" mat-raised-button >{{action}}</button>
<button mat-button (click)="closeDialog()" >Cancel</button>
</div>
</form> </form>
</div> </div>
</ng-scrollbar> </ng-scrollbar>
<ng-template #elseTemplate> <ng-template #elseTemplate>
Sure to delete <b>{{local_data.name}}</b>? Sure to delete <b>{{local_data.name}}</b>?
</ng-template><br> </ng-template><br>
<div mat-dialog-actions>
<button mat-button (click)="doAction()" class="mat-green" mat-raised-button >{{action}}</button>
<button mat-button (click)="closeDialog()" >Cancel</button>
</div>
</mat-card> </mat-card>

View File

@ -24,12 +24,15 @@ export class AddUserComponent implements OnInit {
url: string | ArrayBuffer; url: string | ArrayBuffer;
businessList: any; businessList: any;
public role = [{'name':'BADMIN'},{'name':'PRACTITIONER'},{'name':'FRONTDESK'}] public role = [{'name':'BADMIN'},{'name':'PRACTITIONER'},{'name':'FRONTDESK'}]
imageViewStatus: boolean;
formData:any=[];
constructor(private router: Router,private formBuilder: FormBuilder, constructor(private router: Router,private formBuilder: FormBuilder,
public dialogRef: MatDialogRef<AddUserComponent>, public dialogRef: MatDialogRef<AddUserComponent>,
@Optional() @Inject(MAT_DIALOG_DATA) public data: UsersData,public _bus:BusinessService) { @Optional() @Inject(MAT_DIALOG_DATA) public data: UsersData,public _bus:BusinessService) {
console.log(data); console.log(data);
this.local_data = {...data}; this.local_data = {...data};
this.action = this.local_data.action; this.action = this.local_data.action;
this.formData= new FormData();
this.getBusinessList() this.getBusinessList()
} }
@ -61,15 +64,7 @@ export class AddUserComponent implements OnInit {
closeDialog(){ closeDialog(){
this.dialogRef.close({event:'Cancel'}); this.dialogRef.close({event:'Cancel'});
} }
onSelectFile(event) {
if (event.target.files && event.target.files[0]) {
var reader = new FileReader();
reader.readAsDataURL(event.target.files[0]);
reader.onload = (event) => {
this.url = event.target.result;
}
}
}
close() { close() {
this.dialogRef.close(); this.dialogRef.close();
} }
@ -85,6 +80,7 @@ export class AddUserComponent implements OnInit {
'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,63}$', '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,63}$',
),]), ),]),
password: new FormControl('', [Validators.required, Validators.minLength(6)]), password: new FormControl('', [Validators.required, Validators.minLength(6)]),
logo: new FormControl('', null),
// confirmPassword: new FormControl('', [Validators.required, Validators.minLength(6)]), // confirmPassword: new FormControl('', [Validators.required, Validators.minLength(6)]),
createdBy:new FormControl(userrole,[Validators.required]), createdBy:new FormControl(userrole,[Validators.required]),
}); });
@ -96,13 +92,75 @@ export class AddUserComponent implements OnInit {
doAction(){ doAction(){
let tmp = this.form.value let tmp = this.form.value
tmp.id = this.local_data.id tmp.id = this.local_data.id
console.log(this.formData.getAll('image'));
if(this.action == 'Update'){
this.formData.append('id', tmp.id);
this.formData.append('busId', this.local_data.busId);
}
this.formData.append('userName', tmp.userName);
this.formData.append('password', tmp.password);
this.formData.append('role', tmp.role);
this.formData.append('email', tmp.email);
this.formData.append('contactNo', tmp.contactNo);
this.formData.append('confirmPassword', tmp.password);
// tmp.confirmPassword = this.local_data.confirmPassword // tmp.confirmPassword = this.local_data.confirmPassword
this.dialogRef.close({event:this.action,data:tmp}); this.dialogRef.close({event:this.action,data: this.formData});
console.log(this.form.value); console.log( this.formData,this.form.value);
console.log(this.action,this.local_data) console.log(this.action,this.local_data)
} }
submit(){ submit(){
console.log(this.form.value); console.log(this.form.value);
let tmp = this.form.value
tmp.id = this.local_data.id
console.log(this.formData.getAll('image'));
if(this.action == 'Update'){
this.formData.append('id', tmp.id);
this.formData.append('busId', this.local_data.busId);
}
this.formData.append('userName', tmp.userName);
this.formData.append('password', tmp.password);
this.formData.append('role', tmp.role);
this.formData.append('email', tmp.email);
this.formData.append('contactNo', tmp.contactNo);
this.formData.append('confirmPassword', tmp.password);
// tmp.confirmPassword = this.local_data.confirmPassword
this.dialogRef.close({event:this.action,data: this.formData});
console.log( this.formData,this.form.value);
console.log(this.action,this.local_data)
}
onSelectFile(event) {
console.log(event.target.files[0])
const file = event.target.files[0];
if(event != null){
this.imageViewStatus = true
}
if (event.target.files && event.target.files[0]) {
var reader = new FileReader();
reader.readAsDataURL(event.target.files[0]);
reader.onload = (event) => {
this.url = event.target.result;
console.log(this.url)
}
}
// this.formData= new FormData();
// this.formData=[];
this.formData.append('image', file, file.name);
// this.formData.append('file', file, file.name);
} }
} }

View File

@ -26,17 +26,20 @@
<th mat-header-cell *matHeaderCellDef class="font-color"> S.No</th> <th mat-header-cell *matHeaderCellDef class="font-color"> S.No</th>
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.id}} </td> <td mat-cell *matCellDef="let element" class="element-spc"> {{element.id}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="logo">
<th mat-header-cell *matHeaderCellDef class="font-color"> Logo </th>
<td mat-cell *matCellDef="let element"> <img [src]="image_view(element.logo)" /> </td>
</ng-container>
<ng-container matColumnDef="role"> <ng-container matColumnDef="role">
<th mat-header-cell *matHeaderCellDef class="font-color"> Role </th> <th mat-header-cell *matHeaderCellDef class="font-color"> Role </th>
<td mat-cell *matCellDef="let element"> {{element.role}} </td> <td mat-cell *matCellDef="let element"> {{element.role}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="logo"> <!-- <ng-container matColumnDef="logo">
<th mat-header-cell *matHeaderCellDef class="font-color"> Logo </th> <th mat-header-cell *matHeaderCellDef class="font-color"> Logo </th>
<td mat-cell *matCellDef="let element"> <img [src]="element.logo" /> </td> <td mat-cell *matCellDef="let element"> <img [src]="element.logo" /> </td>
</ng-container> </ng-container>
-->
<ng-container matColumnDef="Username"> <ng-container matColumnDef="Username">
<th mat-header-cell *matHeaderCellDef class="font-color"> User Name </th> <th mat-header-cell *matHeaderCellDef class="font-color"> User Name </th>
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.userName}} </td> <td mat-cell *matCellDef="let element" class="element-spc"> {{element.userName}} </td>

View File

@ -7,6 +7,7 @@ import { NotifierService } from 'angular-notifier';
import Swal from 'sweetalert2/dist/sweetalert2.js'; import Swal from 'sweetalert2/dist/sweetalert2.js';
import { AddUserComponent } from '../add-user/add-user.component'; import { AddUserComponent } from '../add-user/add-user.component';
import { UserService } from '../user-service/user.service'; import { UserService } from '../user-service/user.service';
import { environment } from 'environments/environment';
export interface UsersData { export interface UsersData {
id: number; id: number;
@ -42,13 +43,13 @@ const ELEMENT_DATA: UsersData[] = [
}) })
export class UserListComponent implements OnInit { export class UserListComponent implements OnInit {
push: any; push: any;
displayedColumns: string[] = ['id', 'role', 'Username', 'Password', 'mobile_no', 'email', 'action']; displayedColumns: string[] = ['id','logo', 'role', 'Username', 'Password', 'mobile_no', 'email', 'action'];
dataSource: any; dataSource: any;
addFormData: any; addFormData: any;
public usersList:any = new MatTableDataSource(); public usersList:any = new MatTableDataSource();
@ViewChild(MatTable,{static:true}) table: MatTable<any>; @ViewChild(MatTable,{static:true}) table: MatTable<any>;
@ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatPaginator) paginator: MatPaginator;
private apiUrl = environment.apiEndpoint;
constructor(private notifierService: NotifierService,public dialog: MatDialog, public _use:UserService) { constructor(private notifierService: NotifierService,public dialog: MatDialog, public _use:UserService) {
let open_go_admin = localStorage.getItem('go_admin') let open_go_admin = localStorage.getItem('go_admin')
if(open_go_admin == '0'){ if(open_go_admin == '0'){
@ -161,31 +162,31 @@ export class UserListComponent implements OnInit {
let formValue = [] let formValue = []
if(result.event == 'Add'){ if(result.event == 'Add'){
console.log('add') console.log('add')
let addFormData = { // let addFormData = {
// logo: row_obj.logo, // // logo: row_obj.logo,
// id: row_obj.id, // // id: row_obj.id,
busId:row_obj.businessselect, // busId:row_obj.businessselect,
userName: row_obj.userName, // userName: row_obj.userName,
contactNo: row_obj.contactNo, // contactNo: row_obj.contactNo,
password: row_obj.password, // password: row_obj.password,
email: row_obj.email, // email: row_obj.email,
role: row_obj.role, // role: row_obj.role,
createdBy:row_obj.createdBy // createdBy:row_obj.createdBy
}; // };
formValue.push(addFormData); formValue.push(row_obj);
}else if(result.event == 'Update'){ }else if(result.event == 'Update'){
console.log('Update') console.log('Update')
let updatevalue = { // let updatevalue = {
id: row_obj.id, // id: row_obj.id,
busId:row_obj.businessselect, // busId:row_obj.businessselect,
userName: row_obj.userName, // userName: row_obj.userName,
contactNo: row_obj.contactNo, // contactNo: row_obj.contactNo,
password: row_obj.password, // password: row_obj.password,
email: row_obj.email, // email: row_obj.email,
role: row_obj.role, // role: row_obj.role,
createdBy:row_obj.createdBy // createdBy:row_obj.createdBy
} // }
formValue.push(updatevalue); formValue.push(row_obj);
} }
else if(result == 'Delete'){ else if(result == 'Delete'){
console.log('delete') console.log('delete')
@ -259,5 +260,8 @@ export class UserListComponent implements OnInit {
// console.log(this.dataSource) // console.log(this.dataSource)
// } // }
image_view(image){
return this.apiUrl+'imageViewer?img_name='+image;
}
} }

View File

@ -7,8 +7,8 @@ export const environment = {
production: false, production: false,
environmentName: 'Testing Environment',//Localhost Environment. environmentName: 'Testing Environment',//Localhost Environment.
// apiEndpoint:'http://venbainfotech.com:5000/api/', // apiEndpoint:'http://venbainfotech.com:5000/api/',
// apiEndpoint:'http://192.168.1.20:8080/api/', apiEndpoint:'http://192.168.1.20:8080/api/',
apiEndpoint:'https://api.venbait.in/api/', // apiEndpoint:'https://api.venbait.in/api/',
firebase: { firebase: {
apiKey: "AIzaSyBVPQ6C7cg5l8I-o7WSmmXdioMa4C0ZKNM", apiKey: "AIzaSyBVPQ6C7cg5l8I-o7WSmmXdioMa4C0ZKNM",