Skip to content

Commit

Permalink
added provider form request endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
user authored and user committed Mar 5, 2024
1 parent b44134a commit d7228d9
Show file tree
Hide file tree
Showing 16 changed files with 119 additions and 37 deletions.
6 changes: 6 additions & 0 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,9 @@
47. fixed. -->




<!-- drop down for terminals in terminal request form -->
<!-- Terminal names not serial no -->
<!-- in terminal deactivate, include serial number for identification-->
<!-- Refund transaction form should show a drop down of terminals than an input field -->
14 changes: 13 additions & 1 deletion src/app/components/auth/signup/signup.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ export class SignupComponent {
showConfirmPassword: boolean = false;
password:string = "password";
confirmPassword:string = "password";
message:string = "";


constructor( private http: HttpClient,
private formBuilder: FormBuilder,
private authService: AuthService,
private router: Router,
private toast: NgToastService

) {
this.myform = new FormGroup({
firstName: new FormControl('', [Validators.required]),
Expand Down Expand Up @@ -105,7 +109,12 @@ resetFormInputs() {
// }
// }


showSuccessResponse(message: string, header: string, duration: number) {
this.toast.success({ detail: message, summary: header, duration: duration });
}
showErrorResponse(message: string, header: string, duration: number) {
this.toast.error({ detail: message, summary: header, duration: duration });
}

onSubmit(user: any): void {
if (this.myform.valid) {
Expand All @@ -114,6 +123,9 @@ onSubmit(user: any): void {
next: (response) => {
console.log("response =>>>>", response);
// this.resetFormInputs();
this.message = response?.response;
this.showSuccessResponse(this.message, "Login", 3000);

this.myform.markAsPristine(); // Reset form state
this.myform.markAsUntouched(); // Reset form state
this.router.navigate(['login']);
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/auth/singin/singin.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

</form>

<p class="font-[DM Sans] text-[#707EAE] py-[1rem]">Not registered yet? <a href="#" class="font-[700] text-[#4318FF] no-underline text-right">Create an Account</a></p>
<p class="font-[DM Sans] text-[#707EAE] py-[1rem]">Not registered yet? <a href="/signup" class="font-[700] text-[#4318FF] no-underline text-right">Create an Account</a></p>

</div>

Expand Down
10 changes: 5 additions & 5 deletions src/app/components/dashboard/analytic/analytic.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h2 class="text-[#15192C] font-[600] text-[27px] leading-[33px]">Analysis Overvi
<div class="grid lg:grid-cols-4 grid-cols-1 gap-[2rem]">
<div class="bg-[#fff] rounded-[11px] pb-[1rem] p-[2rem] grid gap-[1rem]">
<div class="text-[#A1A0BD] lg:text-[18px]">Total Income</div>
<p class="leading-[35px] font-[800] color-[#000] text-[29px]">N {{analyticsOverview?.totalIncome}}
<p class="leading-[35px] font-[800] color-[#000] text-[29px]"> {{analyticsOverview?.totalIncome}}
<span></span>
</p>
<div class="bg-[#DCF5E8] rounded-[19px] text-[#4FD18B] w-fit h-fit flex justify-center p-[1rem] gap-[1rem]">
Expand All @@ -31,7 +31,7 @@ <h2 class="text-[#15192C] font-[600] text-[27px] leading-[33px]">Analysis Overvi

<div class="bg-[#fff] rounded-[11px] pb-[1rem] p-[2rem] grid gap-[1rem]">
<div class="text-[#A1A0BD] lg:text-[18px]">Total Transactions</div>
<p class="leading-[35px] font-[800] color-[#000] text-[29px]">{{analyticsOverview?.terminal}}</p>
<p class="leading-[35px] font-[800] color-[#000] text-[29px]">{{analyticsOverview?.totalTransaction}}</p>
<div class="bg-[#F5DCDC] rounded-[19px] text-[#D14F4F] w-fit h-fit flex justify-center p-[1rem] gap-[1rem]">
<div class="flex justify-center">
<!-- <img src="/assets/images/graphArrowDown.png" alt=""> -->
Expand All @@ -42,7 +42,7 @@ <h2 class="text-[#15192C] font-[600] text-[27px] leading-[33px]">Analysis Overvi
</div>
<div class="bg-[#fff] rounded-[11px] pb-[1rem] p-[2rem] grid gap-[1rem]">
<div class="text-[#A1A0BD] lg:text-[18px] ">Total Terminals</div>
<p class="leading-[35px] font-[800] color-[#000] text-[29px]">{{analyticsOverview?.totalTransaction}}</p>
<p class="leading-[35px] font-[800] color-[#000] text-[29px]">{{analyticsOverview?.terminal}}</p>
<div class="bg-[#DCF5E8] rounded-[19px] text-[#4FD18B] w-fit h-fit flex justify-center p-[1rem] gap-[1rem]">
<div class="flex justify-center">
<!-- <img src="/assets/images/graphArrowUp.png" alt=""> -->
Expand Down Expand Up @@ -135,7 +135,7 @@ <h2 class="text-[#15192C] font-[600] text-[27px] leading-[33px]">Analysis Overvi
</div>
</th>
<th scope="col" class="p-[2rem]">
Payment Id
Terminal Name
</th>
<th scope="col" class="p-[2rem]">
Status
Expand Down Expand Up @@ -163,7 +163,7 @@ <h2 class="text-[#15192C] font-[600] text-[27px] leading-[33px]">Analysis Overvi
</div>
</td>
<th scope="row" class="p-[2rem] font-medium text-gray-900 whitespace-nowrap">
{{terminal.paymentId}}
{{terminal.name}}
</th>
<td class="p-[1rem]">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</div>
</td>
<td scope="row" class="p-[2rem] font-medium text-gray-900 whitespace-nowrap">
{{terminal.terminal}}
{{terminal.location}}

</td>

Expand All @@ -52,7 +52,7 @@
</div>
</td>
<td class="p-[2rem]">
{{terminal.activationDate}}
{{terminal.invoiceDate}}
</td>
<td class="p-[1rem]">
<div *ngIf=" terminal.status === 'Deactived' "
Expand All @@ -65,11 +65,11 @@
</div>
</td>
<td class="p-[2rem]">
<div (click)="toggleTerminalActiveState(terminal.action)" *ngIf=" terminal.action === 'Activate' "
<div (click)="toggleTerminalActiveState(terminal.location)" *ngIf=" terminal.status === 'Activate' "
class="bg-[#F3F0FF] cursor-pointer p-[1rem] py-[0.5rem] flex items-center justify-center w-[120px] gap-[1rem] rounded-[4px]">
<span class="text-[#7535FD] font-[700]">{{terminal.action}}</span>
</div>
<div (click)="toggleTerminalActiveState(terminal.action)" *ngIf=" terminal.action === 'Deactivate' "
<div (click)="toggleTerminalActiveState(terminal.location)" *ngIf=" terminal.status === 'Deactivate' "
class="bg-[#E7EAEE] cursor-pointer px-[1rem] py-[1rem] flex items-center justify-center w-[120px] gap-[1rem] rounded-[4px]">
<span class="text-[#64748B]">{{terminal.action}}</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div>
<div class="bg-[#fff] rounded-[2px] mt-[50px] md:w-[50%]">
<h1 class="p-[2rem] border-b">Terminal Request Form</h1>
<h1 class="p-[2rem] border-b">Refund Transaction Form</h1>
<form [formGroup]="terminalRequestForm" (ngSubmit)="onSubmit(terminalRequestForm.value)"
class="grid gap-[2rem] p-[2rem]">
<div class="flex gap-[2rem] w-[100%]">
Expand Down Expand Up @@ -84,7 +84,7 @@ <h1 class="p-[2rem] border-b">Terminal Request Form</h1>
[ngClass]="{'has-error': !formData['disputedAMount'].valid && formData['disputedAMount'].touched}">
<div>
<label class="leading-[22px] text-[#212B36] font-[500]" for="">
Customer's disputedAMount</label>
Customer's disputed amount</label>
</div>
<div class="border-none "
*ngIf="formData['disputedAMount'].touched && formData['disputedAMount'].errors">
Expand Down Expand Up @@ -124,11 +124,20 @@ <h1 class="p-[2rem] border-b">Terminal Request Form</h1>
The Name of Terminal is not valid
</div>
</div>
<div class="border rounded-[4px] border-[#E2E8F0] p-[1.5rem]">

<input class="outline-none w-[100%]" type="text" placeholder="Enter customer's first name"
name="nameOfTerminal" formControlName="nameOfTerminal">

<div class="border border-[#E2E8F0] md:col-span-2 col-span-1 p-[2rem] py-[0.5rem] bg-[#fff] rounded-[4px]">
<select id="countries" formControlName="nameOfTerminal" name="nameOfTerminal"
class=" outline-none text-[#4B5563] text-[14px] leading-[150%] text-[ #4B5563] rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 ">
<option>
<span>Select Provider</span>
</option>
<option value={{provider.providerName}} *ngFor="let provider of providerList">{{provider.providerName}}</option>
</select>
</div>



</div>

<div class="w-full"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ export class NewRefundFormComponent {
selectedFile: any | null = null;
imagePreview: any = "";

providerList : any[] = [];

ngOnInit() {
this.bodyText = 'This text can be updated in modal 1';
this.getProviders();
}


constructor(
private modalService: ModalService,
Expand Down Expand Up @@ -69,11 +76,6 @@ export class NewRefundFormComponent {

onFileSelected(event: Event): void {
const inputElement = event.target as HTMLInputElement;
console.log("==========")

console.log(inputElement)

console.log("===========")

const file: File | null = inputElement.files ? inputElement.files[0] : null;

Expand Down Expand Up @@ -160,9 +162,7 @@ export class NewRefundFormComponent {
}
}

ngOnInit() {
this.bodyText = 'This text can be updated in modal 1';
}


openModal(id: string) {
this.modalService.open(id);
Expand All @@ -176,4 +176,17 @@ export class NewRefundFormComponent {
this.showModal = !this.showModal;
}

getProviders(){
this.terminalService.getProviders().subscribe({
next: (response: any) => {
console.log(response);
this.providerList = response;
},
error: (items: any) => {
console.log(items)

}
})
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,21 @@ <h1 class="p-[2rem] border-b">Terminal Request Form</h1>
The Name of Terminal is not valid
</div>
</div>
<div class="border rounded-[4px] border-[#E2E8F0] p-[1.5rem]">
<!-- <div class="border rounded-[4px] border-[#E2E8F0] p-[1.5rem]">
<input class="outline-none w-[100%]" type="text" placeholder="Enter operator's first name" name="nameOfTerminal" formControlName="nameOfTerminal">
</div> -->

<div class="border border-[#E2E8F0] md:col-span-2 col-span-1 p-[2rem] py-[0.5rem] bg-[#fff] rounded-[4px]">
<select id="countries" formControlName="nameOfTerminal" name="nameOfTerminal"
class=" outline-none text-[#4B5563] text-[14px] leading-[150%] text-[ #4B5563] rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 ">
<option selected>
<span>Select Provider</span>
</option>
<option value={{provider.providerName}} *ngFor="let provider of providerList">{{provider.providerName}}</option>
</select>
</div>

</div>

<div class="w-full" [ngClass]="{'has-error': !formData['operatorsPhoneNumber'].valid && formData['operatorsPhoneNumber'].touched}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export class NewterminalrequestComponent {
showModal = false;
terminalRequestForm: FormGroup;
apiResponse: any;
providerList : any[] = [];



constructor(
Expand Down Expand Up @@ -94,6 +96,8 @@ export class NewterminalrequestComponent {

ngOnInit() {
this.bodyText = 'This text can be updated in modal 1';
this.getProviders();

}

openModal(id: string) {
Expand All @@ -108,5 +112,18 @@ export class NewterminalrequestComponent {
this.showModal = !this.showModal;
}

getProviders(){
this.terminalService.getProviders().subscribe({
next: (response: any) => {
console.log(response);
this.providerList = response;
},
error: (items: any) => {
console.log(items)

}
})
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@
</div>
</td>
<td scope="row" class="p-[2rem] font-medium text-gray-900 whitespace-nowrap">
{{terminal.terminal}}
{{terminal.nameOfTerminal}}
</td>
<td class="p-[2rem]">
<div class="flex items-center gap-[1rem]">
{{terminal.operator}}
{{terminal.operatorsFirstName}}
</div>
</td>
<td class="p-[2rem]">
{{terminal.activationDate}}
{{terminal.requestedDates}}
</td>
<td class="p-[1rem]">
<div *ngIf=" terminal.status === 'Deactived' "
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="mb-[2rem]">
<h1 class="font-[700] text-[30px] leading-[41px] text-[#191D23]">Manage Terminal</h1>
<h1 class="font-[700] text-[30px] leading-[41px] text-[#191D23]">Refund Transaction</h1>
<p class="18px leading-[25px] text-[#64748B]">Manage your terminals, request new terminals & disactivate terminals
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/dashboard/sidenav/nav-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const navbarData: INavbarData[] = [
{
routeLink: 'analytic',
icon: 'fas fa-chart-line',
label: 'Analytic'
label: 'Transactions'
},
{
routeLink: 'manage-terminal',
Expand Down
1 change: 1 addition & 0 deletions src/app/components/dashboard/sidenav/sidenav.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@ export class SidenavComponent implements OnInit {

logOut(): void {
UtilService.clearStorage();
this.router.navigate(["/login"])
}
}
1 change: 0 additions & 1 deletion src/app/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ export class AuthService {
return this.http.get<any>(this.singupUrl);
}


}


Expand Down
20 changes: 18 additions & 2 deletions src/app/services/terminal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ export class TerminalService {
}


getProviders(): Observable<any> {
const headers = new HttpHeaders({
'Content-Type': 'application/json',
'Authorization': `Bearer ${TokenService.getToken()}`
});
return this.http.post<any>(`${baseURL}api/v1/provider/fetch`, {body:{}} );
}



terminalRefundRequest(userDetails:any){
console.log("hello world");
Expand All @@ -59,8 +68,15 @@ export class TerminalService {
return this.http.get<any>('assets/data/terminalData.json');
}

getActionTerminals(): Observable<any>{
return this.http.get<any>('assets/data/actionTerminal.json');
// getActionTerminals(): Observable<any>{
// return this.http.get<any>('assets/data/actionTerminal.json');
// }
getActionTerminals(){
const headers = new HttpHeaders({
'Content-Type': 'application/json',
'Authorization': `Bearer ${TokenService.getToken()}`
});
return this.http.post<any>(`${baseURL}api/v1/customer/terminals`,{},{ headers:headers });
}


Expand Down
6 changes: 2 additions & 4 deletions src/app/services/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// export class util {
// baseURl = "https://de24-105-113-87-159.ngrok-free.app"
// }


export const baseURL = "https://addd-105-113-104-240.ngrok-free.app/";

export const baseURL = "https://7054-102-89-46-75.ngrok-free.app/";

0 comments on commit d7228d9

Please sign in to comment.