Skip to content

Commit d5d03f6

Browse files
committed
PC-107: create items with single parameters is_open, is_fixed, is_selectable_options
1 parent b8f0be0 commit d5d03f6

4 files changed

Lines changed: 24 additions & 27 deletions

File tree

app/assets/stylesheets/application/form_group.scss

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
right: 12px;
3737
}
3838
}
39-
4039
}
4140

4241
.pc-item-input.price {
@@ -75,7 +74,7 @@
7574
.form-control {
7675
padding-left: 24px;
7776
border: 1.3px solid $secondary;
78-
color: $dark
77+
color: $dark;
7978
}
8079

8180
.pc-suffix-right {
@@ -84,17 +83,16 @@
8483
}
8584

8685
::placeholder {
87-
color: $dark
86+
color: $dark;
8887
}
8988
}
9089

9190
.pc-item-input.tier {
9291
.form-select {
93-
border: 1px solid red;
94-
//padding: 7px 12px;
95-
max-width: 200px !important;
92+
padding: 7px 12px;
93+
width: 200px;
94+
border: 1px solid $primary;
9695
border-radius: 4px;
97-
//color: $dark;
9896
}
9997
}
10098

@@ -103,7 +101,7 @@
103101
.form-control {
104102
padding-right: 24px;
105103
border: 1.3px solid $primary;
106-
color: $dark
104+
color: $dark;
107105
}
108106

109107
.pc-suffix-right {
@@ -112,7 +110,7 @@
112110
}
113111

114112
::placeholder {
115-
color: $dark
113+
color: $dark;
116114
}
117115
}
118116

@@ -188,7 +186,6 @@
188186
}
189187
}
190188

191-
192189
// Hide spin for input with type = 'number'
193190
.nospin::-webkit-outer-spin-button,
194191
.nospin::-webkit-inner-spin-button {

app/javascript/components/pages/ItemsPricing.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const initItemsData = [
1313
name: 'Fixed price',
1414
description: '',
1515
category_id: 16,
16-
fixed_parameters: {Price: '2500'},
16+
fixed_parameters: { Price: '2500' },
1717
pricing_options: {},
1818
is_disabled: false,
1919
is_fixed: true,
@@ -31,7 +31,7 @@ const initItemsData = [
3131
name: 'Open parameter',
3232
description: '',
3333
category_id: 16,
34-
fixed_parameters: {Price: '2500'},
34+
fixed_parameters: { Price: '2500' },
3535
pricing_options: {},
3636
is_disabled: false,
3737
is_fixed: false,
@@ -113,7 +113,7 @@ const initItemsData = [
113113
]
114114

115115
export const ItemsPricing = () => {
116-
const {navigate, queryParams, location} = useAppHooks()
116+
const { navigate, queryParams, location } = useAppHooks()
117117

118118
const [selectedCategories, setSelectedCategories] = useState([])
119119
const [expandedAccordions, setExpandedAccordions] = useState([]) // array of IDs
@@ -132,7 +132,7 @@ export const ItemsPricing = () => {
132132
setIsShowDeleteModal(true)
133133
}
134134
const handleToggle = (id) => {
135-
setExpandedAccordions((prev) => (prev.includes(id) ? prev.filter(item => item !== id) : [...prev, id]))
135+
setExpandedAccordions((prev) => (prev.includes(id) ? prev.filter((item) => item !== id) : [...prev, id]))
136136
}
137137
const handleConfirmDeleteCategory = () => {
138138
setSelectedCategories(prev => prev.filter(category => category.id !== categoryIdToDelete))
@@ -146,7 +146,7 @@ export const ItemsPricing = () => {
146146
setIsShowDeleteModal(false)
147147
}
148148

149-
const expandAll = () => setExpandedAccordions(selectedCategories.map(category => category.id))
149+
const expandAll = () => setExpandedAccordions(selectedCategories.map((category) => category.id))
150150
const collapseAll = () => setExpandedAccordions([])
151151
const handleDownload = () => {
152152
// await fetchQuotes.update(quoteId, {
@@ -160,7 +160,7 @@ export const ItemsPricing = () => {
160160
return (
161161
<Container className={'wrapper pt-10 pb-8'}>
162162
<section className={'mb-12 px-8'}>
163-
<QuoteCreation currentStepId={currentStepId}/>
163+
<QuoteCreation currentStepId={currentStepId} />
164164

165165
{/* Items & Pricing dashboard*/}
166166
<ItemsPricingTopBar
@@ -202,7 +202,7 @@ export const ItemsPricing = () => {
202202
setIsNotesShow={setIsNotesShow}
203203
notesIcon={notesIcon}
204204
>
205-
<ItemTotalPrice itemData={item.attributes} className={'mb-4'}/>
205+
<ItemTotalPrice itemData={item.attributes} className={''} />
206206

207207
{isNotesShow && (
208208
<PcItemFormGroup label={'Notes'} itemType={'notes'}>
@@ -245,7 +245,7 @@ export const ItemsPricing = () => {
245245
</section>
246246

247247
{/*Modal for confirm delete/cancel category*/}
248-
<DeleteItemModal/>
248+
<DeleteItemModal />
249249
<DeleteItemModal
250250
show={isShowDeleteModal}
251251
onHide={handleCancelDeleteCategory}

app/javascript/components/shared/ItemTotalPrice.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,28 @@ export const ItemTotalPrice = ({
3838
useEffect(() => {
3939
const discountValue = Number(discount)
4040
const baseValue = isItemOpen
41-
? Number(openParamValue)
42-
: isItemSelectableOptions
43-
? Number(selectableValue)
44-
: fixedValue
41+
? Number(openParamValue)
42+
: isItemSelectableOptions
43+
? Number(selectableValue)
44+
: fixedValue
4545
const calculatedValue = baseValue - (baseValue * discountValue) / 100
4646

4747
setDiscounted(discountValue > 0 ? calculatedValue : baseValue)
4848
}, [discount, fixedValue, openParamValue, selectableValue, isItemOpen, isItemSelectableOptions])
4949

5050
return (
51-
<div className={`px-0 ${className}`}>
51+
<div className={`d-flex flex-column gap-3 px-0 ${className}`}>
5252
<Row className={'g-3 justify-content-end'}>
5353
{isItemFixed && (
5454
<Col sm={'auto'}>
5555
<PcItemFormGroup itemType={itemTypeOne} label={labelOne}>
56-
<PcItemInputControl itemType={itemTypeOne} value={fixedValue}/>
56+
<PcItemInputControl itemType={itemTypeOne} value={fixedValue} />
5757
</PcItemFormGroup>
5858
</Col>
5959
)}
6060
<Col sm={'auto'}>
6161
<PcItemFormGroup itemType={itemTypeTwo} label={labelTwo}>
62-
<PcItemInputControl itemType={itemTypeTwo} value={formatPrice(discounted)}/>
62+
<PcItemInputControl itemType={itemTypeTwo} value={formatPrice(discounted)} />
6363
</PcItemFormGroup>
6464
</Col>
6565
</Row>

config/database.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
default: &default
22
adapter: postgresql
33
encoding: unicode
4-
username: fsdev
5-
password: fsdev
4+
username: postgres
5+
password:
66
pool: <%= ENV.fetch('RAILS_MAX_THREADS') { 5 } %>
77

88
development:

0 commit comments

Comments
 (0)