Skip to content

Commit

Permalink
Merge pull request #73 from highwire/PLATFORM1-2628-QAFeedback
Browse files Browse the repository at this point in the history
QA issues Fixed
  • Loading branch information
bharathighwire committed May 10, 2024
2 parents d5b9ba6 + 4717377 commit b085d3e
Show file tree
Hide file tree
Showing 45 changed files with 968 additions and 917 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ <h2 class="lead text-muted pt-4">

<div class="row">
<div class="col-md-8">
<ng-multiselect-dropdown [placeholder]="'Filter sites...'" [settings]="dropdownSettings" [data]="sitedata"
<!-- <ng-multiselect-dropdown [placeholder]="'Filter sites...'" [settings]="dropdownSettings" [data]="sitedata"
[(ngModel)]="selectedItems" (onSelect)="onItemSelect($event)" (onSelectAll)="onSelectAll($event)">
</ng-multiselect-dropdown>
</ng-multiselect-dropdown> -->

<ng-select
[items]="sitedata"
bindLabel="title"
[(ngModel)]="selectedItems"
placeholder="Filter sites..."
(change)="onItemSelect($event)">
</ng-select>

</div>
</div>
<form class="form" class="form_list">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,12 @@ sitedata:any;
selectAllPublishers(){
var site:any= localStorage.getItem('siteData');
if(site){
this.sitedata= JSON.parse(site) ;
this.sitedata = JSON.parse(site);
if (Array.isArray(this.sitedata)) {
this.sitedata.sort((a, b) => {
return (a.title?.localeCompare(b.title)) || 0;
});
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h1 class="stat ng-binding fw-light">

<!-- articlebutton -->
<button
class="btn btn-info dropdown-toggle"
class="btn btn-info dropdown-toggle selected-caps"
type="button"
id="dropdownMenuButton1"
data-bs-toggle="dropdown"
Expand Down Expand Up @@ -106,7 +106,7 @@ <h1 class="stat ng-binding fw-light">
</div>
<!-- searchbar -->
<div class="col-md-6">
<!-- <label class="visible-xs visible-sm" for="searchBox">Search Report</label> -->
<label class="visible-xs visible-sm search-labele" for="searchBox">Search Report</label>
<div class="input-group input-integrated-button">
<input
class="form-control"
Expand Down Expand Up @@ -184,7 +184,7 @@ <h1 class="stat ng-binding fw-light">

<!-- Symbol Column -->
<ng-container matColumnDef="options">
<th mat-header-cell *matHeaderCellDef>Action</th>
<th mat-header-cell *matHeaderCellDef> &nbsp; &nbsp;Action</th>
<td mat-cell *matCellDef="let element">
<div class="btn-group">
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,24 @@ export class BookSpecificPricesComponent implements OnInit {

filterDOI(data: any) {
var self = this;
data = data.filter((entry: any) => {
return (self.hwv.doi(entry.name) || self.hwv.pisaId(entry.name) || self.hwv.isbn(entry.name) || self.hwv.resourceId(entry.name))
});
// data = data.filter((entry: any) => {
// return (self.hwv.doi(entry.name) || self.hwv.pisaId(entry.name) || self.hwv.isbn(entry.name) || self.hwv.resourceId(entry.name))
// });
this.extractPrice(data, '', '');
}
extractPrice(data: any, currencies?: any, productType?: any) {
var self = this;
var pricearray: any = [];
this.masterdata = data;

data.forEach((element: any) => {
if (element.prices && Array.isArray(element.prices) && (element.productType == 'ebook' || element.productType == 'edition')) {
element.prices.forEach((elements: any) => {
if (productType) {
if (elements.name == productType)

var name = productType === 'ebook' ? 'ebook-price' : 'chapter-price';

if (elements.name == name)
pricearray.push({
name: element.name,
productType: element.productType,
Expand Down Expand Up @@ -214,7 +218,6 @@ export class BookSpecificPricesComponent implements OnInit {
data: {
element,
prices: p,

},
});

Expand All @@ -224,7 +227,7 @@ export class BookSpecificPricesComponent implements OnInit {
}
});
}

getCurrentPrices(element?: any) {
let prices: any
prices = []
Expand Down
4 changes: 3 additions & 1 deletion src/app/books/books.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown';
import {BookFilterPipe} from '../services/bookcurrency.filter';
import { MatSortModule } from '@angular/material/sort';
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import { NgSelectModule } from '@ng-select/ng-select';
@NgModule({
declarations: [
BookDefaultPricesComponent,
Expand Down Expand Up @@ -62,7 +63,8 @@ import {MatSlideToggleModule} from '@angular/material/slide-toggle';
MatAutocompleteModule,
NgMultiSelectDropDownModule.forRoot(),
MatSortModule,
MatSlideToggleModule
MatSlideToggleModule,
NgSelectModule
],
providers: [],
})
Expand Down
2 changes: 2 additions & 0 deletions src/app/books/template/book-add/book-add.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ input:checked+.slider:before {
background-color: #A81732;
border: 0px !important;
border-radius: unset;
padding: 8px 19px;
}

.can:hover {
Expand All @@ -77,6 +78,7 @@ input:checked+.slider:before {

border: 0px !important;
border-radius: unset;
padding: 8px 19px;
}

#dropdown{
Expand Down
71 changes: 36 additions & 35 deletions src/app/books/template/book-add/book-add.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h4>View/Add/EditPrices</h4>
<table class="table">
<thead>
<tr>
<th scope="col">Price Type</th>
<th scope="col">PRICE TYPE</th>
<th scope="col">CURRENCY</th>
<th scope="col">FOR SALE</th>
<th scope="col">PRICE</th>
Expand All @@ -39,9 +39,9 @@ <h4>View/Add/EditPrices</h4>
</thead>
<tbody *ngIf="basedata.prices">
<tr *ngFor="let item of basedata.prices; let ind = index">
<th scope="col">{{ item.productType | titlecase }}</th>
<th scope="col" class="product_type">{{ item.productType | titlecase }}</th>
<td>
<select
<!-- <select
id="dropdown"
class="form-select"
aria-label="#"
Expand All @@ -50,7 +50,12 @@ <h4>View/Add/EditPrices</h4>
<option *ngFor="let curr of currency" value="{{ curr }}">
{{ curr }}
</option>
</select>
</select> -->

<input style="border-radius: 0px;background-color: #e9ecef ; border: none;" type="text"
[(ngModel)]="item.price_currency"
class="form-control" readonly>

</td>
<td>
<label class="switch">
Expand All @@ -64,48 +69,35 @@ <h4>View/Add/EditPrices</h4>
</td>
<td>
<div class="input-group mb-3">
<div
*ngIf="
item.price_amount == notForSaleLabel;
then thenBlock;
else elseBlock
"
></div>
<ng-template #thenBlock>{{ notForSaleLabel }} </ng-template>
<ng-template #elseBlock>
<span
style="border-radius: 0px; border: none"
class="input-group-text"
id="#"
>{{ item.price_currency | bookfilterPipe }}</span
>
<input
style="
border-radius: 0px;
background-color: #e9ecef;
border: none;
"
type="text"
<div *ngIf="item.price_amount==notForSaleLabel; then thenBlock else elseBlock"></div>
<ng-template #thenBlock>
<span style="border-radius: 0px; border: none;" class="input-group-text" id="#">{{ item.price_currency|bookfilterPipe}}</span>
<input style="border-radius: 0px;background-color: #fff; border: 1px solid #e9ecef;" type="text"
[(ngModel)]="item.price_amount"
class="form-control"
placeholder="{{notForSaleLabel}}" aria-label="price" aria-describedby="#">
</ng-template>
<ng-template #elseBlock>
<span style="border-radius: 0px; border: none;" class="input-group-text" id="#">{{ item.price_currency|bookfilterPipe}}</span>
<input style="border-radius: 0px;background-color: #fff; border: 1px solid #e9ecef;" type="text"
[(ngModel)]="item.price_amount"
class="form-control"
placeholder=""
aria-label="price"
aria-describedby="#"
/>
</ng-template>
placeholder="" aria-label="price" aria-describedby="#">
</ng-template>
</div>
</td>
</td>

<td>
<div class="input-group mb-3 hour">
<select
id="dropdown"
[(ngModel)]="item.price_interval"
class="form-select"
class="form-select selected-caps"
aria-label="#"
>
<option
*ngFor="let inter of accessPeriods"
value="{{ inter.value }}"
value="{{ inter.value }}" class="options-capitalize"
>
{{ inter.label }}
</option>
Expand Down Expand Up @@ -138,6 +130,15 @@ <h4>View/Add/EditPrices</h4>
</td>
</tr>
<tr>
<td><button class="btn btn-primary can" (click)="closeDialog(false)" type="button">CANCEL</button></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td> <button class="btn btn-primary mx-2 sav" type="button" (click)="update()">SAVE</button></td>
</tr>
<!-- <tr>
<td class="button_td">
<button
class="btn btn-primary can"
Expand All @@ -154,7 +155,7 @@ <h4>View/Add/EditPrices</h4>
SAVE
</button>
</td>
</tr>
</tr> -->
</tbody>
</table>
</div>
Expand Down
37 changes: 18 additions & 19 deletions src/app/books/template/book-add/book-add.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ export class BookAddComponent implements OnInit {

ngOnInit(): void {
if(this.basedata.prices[0])
this.productType=this.basedata.prices[0].productType;

//this.productType=this.basedata.prices[0].productType;
this.productType= this.capitalize(this.basedata.prices[0].productType);
this.selectAllPublishers();
this.getCurrencyList();
// this.calculateAccess()
}

capitalize(value: string): string {
if (!value) return '';
return value.charAt(0).toUpperCase() + value.slice(1);
}

calculateAccess(prices:any){
var newPrice:any=[];
var ret= true;
Expand Down Expand Up @@ -71,7 +76,7 @@ export class BookAddComponent implements OnInit {
}
onItemChange(test:any,item:any){
if(test.checked){
item.price_amount= '';
item.price_amount= item.price.amount;
}else{
item.price_amount= this.notForSaleLabel;
}
Expand All @@ -81,7 +86,6 @@ export class BookAddComponent implements OnInit {
if(currency){
this.currency= JSON.parse(currency) ;
}

}
addPrice(){
this.basedata.prices[0]
Expand All @@ -91,8 +95,8 @@ export class BookAddComponent implements OnInit {
name: this.basedata.prices[0].name,
price_name:this.basedata.prices[0].price_name,
price_amount:'',
price_currency:'',
price_interval:'',
price_currency:this.basedata.prices[0].price_currency,
price_interval:this.basedata.prices[0].showPrice_interval,
productType:this.basedata.prices[0].productType,
}

Expand All @@ -108,29 +112,24 @@ export class BookAddComponent implements OnInit {
var name = this.basedata.element.name.replace('/', '!2F')
let URL= this.base.DELETE_PRICE+ publisher +'/products/'+ name;

if(!this.calculateAccess(this.basedata.prices))
{alert('Price alreay exit.')
return
}
// if(!this.calculateAccess(this.basedata.prices)) {
// this.base.openSnackBar(3,'Price alreay exit.');
// return
// }

var prices= this.checkPricealreayexit();


var data={
corpus: null,
description: this.basedata.element.description,
identifier: this.basedata.element.identifier,
name: this.basedata.element.name,
prices: prices,
productType: this.basedata.element.productType

}
this.http.getDatawithPut(URL,data).subscribe((res:any)=>{
// alert(res);
this.closeDialog(true);
}
, err => alert('Something went wrong.')
)

})
this.base.openSnackBar(3,'Prices save successfully');
}
checkPricealreayexit(){
debugger;
Expand Down

0 comments on commit b085d3e

Please sign in to comment.