Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5e087462
Commit
5e087462
authored
Jul 07, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the summary section
parent
5d53332b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
80 deletions
+43
-80
ee/app/assets/javascripts/subscriptions/buy_minutes/components/order_summary.vue
...ts/subscriptions/buy_minutes/components/order_summary.vue
+20
-55
ee/app/assets/javascripts/subscriptions/buy_minutes/components/order_summary/summary_details.vue
.../buy_minutes/components/order_summary/summary_details.vue
+16
-16
ee/app/assets/javascripts/subscriptions/buy_minutes/utils.js
ee/app/assets/javascripts/subscriptions/buy_minutes/utils.js
+7
-9
No files found.
ee/app/assets/javascripts/subscriptions/buy_minutes/components/order_summary.vue
View file @
5e087462
<
script
>
import
{
GlIcon
,
GlCollapse
,
GlCollapseToggleDirective
}
from
'
@gitlab/ui
'
;
import
stateQuery
from
'
ee/subscriptions/graphql/queries/state.query.graphql
'
;
import
{
TAX_RATE
,
NEW_GROUP
}
from
'
ee/subscriptions/new/constants
'
;
import
{
TAX_RATE
}
from
'
ee/subscriptions/new/constants
'
;
import
formattingMixins
from
'
ee/subscriptions/new/formatting_mixins
'
;
import
{
sprintf
,
s__
}
from
'
~/locale
'
;
import
SummaryDetails
from
'
./order_summary/summary_details.vue
'
;
...
...
@@ -17,8 +17,8 @@ export default {
},
mixins
:
[
formattingMixins
],
props
:
{
plan
s
:
{
type
:
Array
,
plan
:
{
type
:
Object
,
required
:
true
,
},
},
...
...
@@ -27,12 +27,8 @@ export default {
query
:
stateQuery
,
manual
:
true
,
result
({
data
})
{
this
.
subscription
=
data
.
subscription
;
this
.
namespaces
=
data
.
namespaces
;
this
.
isSetupForCompany
=
data
.
isSetupForCompany
;
this
.
fullName
=
data
.
fullName
;
this
.
customer
=
data
.
customer
;
this
.
selectedPlanId
=
data
.
selectedPlanId
;
this
.
subscription
=
data
.
subscription
;
},
},
},
...
...
@@ -40,22 +36,16 @@ export default {
return
{
subscription
:
{},
namespaces
:
[],
isSetupForCompany
:
false
,
isBottomSummaryVisible
:
false
,
fullName
:
null
,
customer
:
{},
selectedPlanId
:
null
,
};
},
mounted
()
{},
computed
:
{
selectedPlan
()
{
return
this
.
plans
.
find
((
plan
)
=>
plan
.
id
===
this
.
selectedPlanId
);
},
selectedPlanPrice
()
{
return
this
.
selectedP
lan
.
pricePerYear
;
return
this
.
p
lan
.
pricePerYear
;
},
selectedGroup
()
{
return
this
.
namespaces
.
find
((
group
)
=>
group
.
id
===
this
.
subscription
.
namespaceId
);
return
this
.
namespaces
.
find
((
group
)
=>
group
.
id
===
+
this
.
subscription
.
namespaceId
);
},
totalExVat
()
{
return
this
.
subscription
.
quantity
*
this
.
selectedPlanPrice
;
...
...
@@ -66,46 +56,21 @@ export default {
totalAmount
()
{
return
this
.
totalExVat
+
this
.
vat
;
},
users
Present
()
{
quantity
Present
()
{
return
this
.
subscription
.
quantity
>
0
;
},
isGroupSelected
()
{
return
this
.
subscription
.
namespaceId
&&
this
.
subscription
.
namespaceId
!==
NEW_GROUP
;
},
isSelectedGroupPresent
()
{
return
(
this
.
isGroupSelected
&&
this
.
namespaces
.
some
((
namespace
)
=>
namespace
.
id
===
this
.
subscription
.
namespaceId
)
);
},
name
()
{
if
(
this
.
isSetupForCompany
&&
this
.
customer
.
company
)
{
return
this
.
customer
.
company
;
}
if
(
this
.
isGroupSelected
&&
this
.
isSelectedGroupPresent
)
{
return
this
.
selectedGroup
.
name
;
}
if
(
this
.
isSetupForCompany
)
{
return
s__
(
'
Checkout|Your organization
'
);
}
return
this
.
fullName
;
namespaceName
()
{
return
this
.
selectedGroup
.
name
;
},
titleWithName
()
{
return
sprintf
(
this
.
$options
.
i18n
.
title
,
{
name
:
this
.
name
});
return
sprintf
(
this
.
$options
.
i18n
.
title
,
{
name
:
this
.
name
spaceName
});
},
isVisible
()
{
return
(
!
this
.
$apollo
.
loading
&&
(
!
this
.
isGroupSelected
||
this
.
isSelectedGroupPresent
)
&&
this
.
selectedPlan
);
return
!
this
.
$apollo
.
loading
;
},
},
i18n
:
{
title
:
s__
(
"
Checkout|%{name}'s
GitLab subscription
"
),
title
:
s__
(
"
Checkout|%{name}'s
CI minutes
"
),
},
taxRate
:
TAX_RATE
,
};
...
...
@@ -123,18 +88,18 @@ export default {
<gl-icon
v-else
name=
"chevron-right"
/>
<div>
{{
titleWithName
}}
</div>
</div>
<div
class=
"gl-ml-3"
>
{{
formatAmount
(
totalAmount
,
users
Present
)
}}
</div>
<div
class=
"gl-ml-3"
>
{{
formatAmount
(
totalAmount
,
quantity
Present
)
}}
</div>
</h4>
</div>
<gl-collapse
id=
"summary-details"
v-model=
"isBottomSummaryVisible"
>
<summary-details
:vat=
"vat"
:total-ex-vat=
"totalExVat"
:
users-present=
"users
Present"
:selected-plan-text=
"
selectedP
lan.name"
:
quantity-present=
"quantity
Present"
:selected-plan-text=
"
p
lan.name"
:selected-plan-price=
"selectedPlanPrice"
:total-amount=
"totalAmount"
:
number-of-users
=
"subscription.quantity"
:
quantity
=
"subscription.quantity"
:tax-rate=
"$options.taxRate"
/>
</gl-collapse>
...
...
@@ -148,11 +113,11 @@ export default {
<summary-details
:vat=
"vat"
:total-ex-vat=
"totalExVat"
:
users-present=
"users
Present"
:selected-plan-text=
"
selectedP
lan.name"
:
quantity-present=
"quantity
Present"
:selected-plan-text=
"
p
lan.name"
:selected-plan-price=
"selectedPlanPrice"
:total-amount=
"totalAmount"
:
number-of-users
=
"subscription.quantity"
:
quantity
=
"subscription.quantity"
:tax-rate=
"$options.taxRate"
/>
</div>
...
...
ee/app/assets/javascripts/subscriptions/buy_minutes/components/order_summary/summary_details.vue
View file @
5e087462
...
...
@@ -13,10 +13,6 @@ export default {
type
:
Number
,
required
:
true
,
},
usersPresent
:
{
type
:
Boolean
,
required
:
true
,
},
selectedPlanText
:
{
type
:
String
,
required
:
true
,
...
...
@@ -29,7 +25,7 @@ export default {
type
:
Number
,
required
:
true
,
},
numberOfUsers
:
{
quantity
:
{
type
:
Number
,
required
:
true
,
},
...
...
@@ -38,6 +34,10 @@ export default {
required
:
false
,
default
:
null
,
},
purchaseHasExpiration
:
{
type
:
Boolean
,
required
:
false
,
},
},
data
()
{
return
{
...
...
@@ -51,8 +51,8 @@ export default {
},
i18n
:
{
selectedPlanText
:
s__
(
'
Checkout|%{selectedPlanText} plan
'
),
numberOfUsers
:
s__
(
'
Checkout|(x%{numberOfUsers
})
'
),
pricePerU
serPerYear
:
s__
(
'
Checkout|$%{selectedPlanPrice} per user
per year
'
),
quantity
:
s__
(
'
Checkout|(x%{quantity
})
'
),
pricePerU
nitPerYear
:
s__
(
'
Checkout|$%{selectedPlanPrice} per pack
per year
'
),
dates
:
s__
(
'
Checkout|%{startDate} - %{endDate}
'
),
subtotal
:
s__
(
'
Checkout|Subtotal
'
),
tax
:
s__
(
'
Checkout|Tax
'
),
...
...
@@ -65,20 +65,20 @@ export default {
<div
class=
"d-flex justify-content-between bold gl-mt-3 gl-mb-3"
>
<div
class=
"js-selected-plan"
>
{{
sprintf
(
$options
.
i18n
.
selectedPlanText
,
{
selectedPlanText
}
)
}}
<
span
v
-
if
=
"
usersPresent
"
class
=
"
js-number-of-users
"
>
{{
sprintf
(
$options
.
i18n
.
numberOfUsers
,
{
numberOfUsers
}
)
<
span
v
-
if
=
"
quantity > 0
"
class
=
"
js-quantity
"
>
{{
sprintf
(
$options
.
i18n
.
quantity
,
{
quantity
}
)
}}
<
/span
>
<
/div
>
<
div
class
=
"
js-amount
"
>
{{
formatAmount
(
totalExVat
,
usersPresent
)
}}
<
/div
>
<
div
class
=
"
js-amount
"
>
{{
formatAmount
(
totalExVat
,
quantity
>
0
)
}}
<
/div
>
<
/div
>
<
div
class
=
"
text-secondary js-per-u
ser
"
>
<
div
class
=
"
text-secondary js-per-u
nit
"
>
{{
sprintf
(
$options
.
i18n
.
pricePerU
ser
PerYear
,
{
sprintf
(
$options
.
i18n
.
pricePerU
nit
PerYear
,
{
selectedPlanPrice
:
selectedPlanPrice
.
toLocaleString
(),
}
)
}}
<
/div
>
<
div
class
=
"
text-secondary js-dates
"
>
<
div
v
-
if
=
"
purchaseHasExpiration
"
class
=
"
text-secondary js-dates
"
>
{{
sprintf
(
$options
.
i18n
.
dates
,
{
startDate
:
formatDate
(
startDate
),
...
...
@@ -90,17 +90,17 @@ export default {
<
div
class
=
"
border-bottom gl-mt-3 gl-mb-3
"
><
/div
>
<
div
class
=
"
d-flex justify-content-between text-secondary
"
>
<
div
>
{{
$options
.
i18n
.
subtotal
}}
<
/div
>
<
div
class
=
"
js-total-ex-vat
"
>
{{
formatAmount
(
totalExVat
,
usersPresent
)
}}
<
/div
>
<
div
class
=
"
js-total-ex-vat
"
>
{{
formatAmount
(
totalExVat
,
quantity
>
0
)
}}
<
/div
>
<
/div
>
<
div
class
=
"
d-flex justify-content-between text-secondary
"
>
<
div
>
{{
$options
.
i18n
.
tax
}}
<
/div
>
<
div
class
=
"
js-vat
"
>
{{
formatAmount
(
vat
,
usersPresent
)
}}
<
/div
>
<
div
class
=
"
js-vat
"
>
{{
formatAmount
(
vat
,
quantity
>
0
)
}}
<
/div
>
<
/div
>
<
/div
>
<
div
class
=
"
border-bottom gl-mt-3 gl-mb-3
"
><
/div
>
<
div
class
=
"
d-flex justify-content-between bold gl-font-lg
"
>
<
div
>
{{
$options
.
i18n
.
total
}}
<
/div
>
<
div
class
=
"
js-total-amount
"
>
{{
formatAmount
(
totalAmount
,
usersPresent
)
}}
<
/div
>
<
div
class
=
"
js-total-amount
"
>
{{
formatAmount
(
totalAmount
,
quantity
>
0
)
}}
<
/div
>
<
/div
>
<
/div
>
<
/template
>
ee/app/assets/javascripts/subscriptions/buy_minutes/utils.js
View file @
5e087462
import
{
STEPS
}
from
'
ee/subscriptions/constants
'
;
import
stateQuery
from
'
ee/subscriptions/graphql/queries/state.query.graphql
'
;
import
{
convertObjectPropsToCamelCase
,
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
function
arrayToGraphqlArray
(
arr
,
typename
)
{
return
Array
.
from
(
arr
,
(
item
)
=>
{
...
...
@@ -11,23 +11,21 @@ function arrayToGraphqlArray(arr, typename) {
}
export
function
writeInitialDataToApolloCache
(
apolloProvider
,
dataset
)
{
const
{
groupData
,
n
ewUser
,
setupForCompany
,
fullName
,
planId
=
null
}
=
dataset
;
const
{
groupData
,
n
amespaceId
,
planId
=
null
}
=
dataset
;
// eslint-disable-next-line @gitlab/require-i18n-strings
const
namespaces
=
arrayToGraphqlArray
(
JSON
.
parse
(
groupData
),
'
Namespace
'
);
const
isNewUser
=
parseBoolean
(
newUser
);
const
isSetupForCompany
=
parseBoolean
(
setupForCompany
)
||
!
isNewUser
;
apolloProvider
.
clients
.
defaultClient
.
cache
.
writeQuery
({
query
:
stateQuery
,
data
:
{
isNewUser
,
isSetupForCompany
,
namespaces
,
fullName
,
isNewUser
:
false
,
fullName
:
null
,
isSetupForCompany
:
false
,
selectedPlanId
:
planId
,
namespaces
,
subscription
:
{
quantity
:
1
,
namespaceId
:
null
,
namespaceId
,
// eslint-disable-next-line @gitlab/require-i18n-strings
__typename
:
'
Subscription
'
,
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment