Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ecommerce
Commits
cd0ccf78
Commit
cd0ccf78
authored
Jun 14, 2016
by
Vedran Karačić
Committed by
GitHub
Jun 14, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #795 from edx/vkaracic/coupon-ui-fixes
Coupon UI bug fixes.
parents
a3381454
b76e4bab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
30 deletions
+30
-30
ecommerce/static/js/views/coupon_form_view.js
+13
-13
ecommerce/static/templates/coupon_form.html
+17
-17
No files found.
ecommerce/static/js/views/coupon_form_view.js
View file @
cd0ccf78
...
@@ -101,15 +101,7 @@ define([
...
@@ -101,15 +101,7 @@ define([
}
}
},
},
'input[name=benefit_type]'
:
{
'input[name=benefit_type]'
:
{
observe
:
'benefit_type'
,
observe
:
'benefit_type'
onGet
:
function
(
val
)
{
if
(
val
===
'Percentage'
)
{
return
val
;
}
else
if
(
val
===
'Absolute'
)
{
return
'Absolute'
;
}
return
''
;
}
},
},
'.benefit-addon'
:
{
'.benefit-addon'
:
{
observe
:
'benefit_type'
,
observe
:
'benefit_type'
,
...
@@ -204,7 +196,7 @@ define([
...
@@ -204,7 +196,7 @@ define([
},
},
changeUpperLimitForBenefitValue
:
function
()
{
changeUpperLimitForBenefitValue
:
function
()
{
var
is_benefit_percentage
=
this
.
$el
.
find
(
'[name=
code_type]
'
).
val
()
===
'Percentage'
,
var
is_benefit_percentage
=
this
.
$el
.
find
(
'[name=
benefit_type]:checked
'
).
val
()
===
'Percentage'
,
max_value
=
is_benefit_percentage
?
'100'
:
''
;
max_value
=
is_benefit_percentage
?
'100'
:
''
;
this
.
$el
.
find
(
'[name=benefit_value]'
).
attr
(
'max'
,
max_value
);
this
.
$el
.
find
(
'[name=benefit_value]'
).
attr
(
'max'
,
max_value
);
...
@@ -255,19 +247,27 @@ define([
...
@@ -255,19 +247,27 @@ define([
}
}
},
},
// Hiding a field should change the field's value to a default one.
hideField
:
function
(
field_name
,
value
)
{
var
field
=
this
.
$el
.
find
(
field_name
);
this
.
formGroup
(
field_name
).
addClass
(
this
.
hiddenClass
);
field
.
val
(
value
);
field
.
trigger
(
'change'
);
},
toggleVoucherTypeField
:
function
()
{
toggleVoucherTypeField
:
function
()
{
var
voucherType
=
this
.
model
.
get
(
'voucher_type'
);
var
voucherType
=
this
.
model
.
get
(
'voucher_type'
);
if
(
!
this
.
editing
)
{
if
(
!
this
.
editing
)
{
this
.
emptyCodeField
();
this
.
emptyCodeField
();
}
}
// When creating a O
nce by multiple customers
code show the usage number field.
// When creating a O
NCE_PER_CUSTOMER or MULTI_USE
code show the usage number field.
if
(
voucherType
!==
'Single use'
)
{
if
(
voucherType
!==
'Single use'
)
{
if
(
this
.
model
.
get
(
'coupon_type'
)
===
'Discount code'
)
{
if
(
this
.
model
.
get
(
'coupon_type'
)
===
'Discount code'
)
{
this
.
formGroup
(
'[name=code]'
).
removeClass
(
this
.
hiddenClass
);
this
.
formGroup
(
'[name=code]'
).
removeClass
(
this
.
hiddenClass
);
}
}
this
.
formGroup
(
'[name=max_uses]'
).
removeClass
(
this
.
hiddenClass
);
this
.
formGroup
(
'[name=max_uses]'
).
removeClass
(
this
.
hiddenClass
);
}
else
{
}
else
{
this
.
formGroup
(
'[name=max_uses]'
).
addClass
(
this
.
hiddenClass
);
this
.
hideField
(
'[name=max_uses]'
,
1
);
}
}
// The only time we allow for a generation of multiple codes is
// The only time we allow for a generation of multiple codes is
...
@@ -275,7 +275,7 @@ define([
...
@@ -275,7 +275,7 @@ define([
if
(
voucherType
===
'Single use'
)
{
if
(
voucherType
===
'Single use'
)
{
this
.
formGroup
(
'[name=quantity]'
).
removeClass
(
this
.
hiddenClass
);
this
.
formGroup
(
'[name=quantity]'
).
removeClass
(
this
.
hiddenClass
);
}
else
{
}
else
{
this
.
formGroup
(
'[name=quantity]'
).
addClass
(
this
.
hiddenClass
);
this
.
hideField
(
'[name=quantity]'
,
1
);
}
}
},
},
...
...
ecommerce/static/templates/coupon_form.html
View file @
cd0ccf78
...
@@ -4,17 +4,17 @@
...
@@ -4,17 +4,17 @@
<div
class=
"fields col-md-6"
>
<div
class=
"fields col-md-6"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"title"
><
%=
gettext
('
Coupon
Name
')
%
>
*
</label>
<label
for=
"title"
><
%=
gettext
('
Coupon
Name
')
%
>
*
</label>
<input
type=
"text"
class=
"form-control"
name=
"title"
maxlength=
"30"
>
<input
id=
"title"
type=
"text"
class=
"form-control"
name=
"title"
maxlength=
"30"
>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"code_type"
><
%=
gettext
('
Code
Type
')
%
></label>
<label
for=
"code_type"
><
%=
gettext
('
Code
Type
')
%
></label>
<select
class=
"form-control"
name=
"code_type"
></select>
<select
id=
"code_type"
class=
"form-control"
name=
"code_type"
></select>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"category"
><
%=
gettext
('
Category
')
%
>
*
</label>
<label
for=
"category"
><
%=
gettext
('
Category
')
%
>
*
</label>
<select
class=
"form-control"
name=
"category"
></select>
<select
id=
"category"
class=
"form-control"
name=
"category"
></select>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
<label
for=
"start_date"
><
%=
gettext
('
Valid
from
')
%
>
*
</label>
<label
for=
"start_date"
><
%=
gettext
('
Valid
from
')
%
>
*
</label>
<div
class=
"input-group"
>
<div
class=
"input-group"
>
<div
class=
"input-group-addon"
><i
class=
"fa fa-calendar"
aria-hidden=
"true"
></i></div>
<div
class=
"input-group-addon"
><i
class=
"fa fa-calendar"
aria-hidden=
"true"
></i></div>
<input
placeholder=
"<%- gettext('YYYY-MM-DDTHH:mm:ss') %>"
class=
"form-control add-pikaday"
name=
"start_date"
>
<input
id=
"start_date"
placeholder=
"<%- gettext('YYYY-MM-DDTHH:mm:ss') %>"
class=
"form-control add-pikaday"
name=
"start_date"
>
</div>
</div>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
<label
for=
"end_date"
><
%=
gettext
('
Valid
until
')
%
>
*
</label>
<label
for=
"end_date"
><
%=
gettext
('
Valid
until
')
%
>
*
</label>
<div
class=
"input-group"
>
<div
class=
"input-group"
>
<div
class=
"input-group-addon"
><i
class=
"fa fa-calendar"
aria-hidden=
"true"
></i></div>
<div
class=
"input-group-addon"
><i
class=
"fa fa-calendar"
aria-hidden=
"true"
></i></div>
<input
placeholder=
"<%- gettext('YYYY-MM-DDTHH:mm:ss') %>"
class=
"form-control add-pikaday"
name=
"end_date"
>
<input
id=
"end_date"
placeholder=
"<%- gettext('YYYY-MM-DDTHH:mm:ss') %>"
class=
"form-control add-pikaday"
name=
"end_date"
>
</div>
</div>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
...
@@ -39,25 +39,25 @@
...
@@ -39,25 +39,25 @@
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"voucher_type"
><
%=
gettext
('
Usage
Limitations
')
%
></label>
<label
for=
"voucher_type"
><
%=
gettext
('
Usage
Limitations
')
%
></label>
<select
class=
"form-control"
name=
"voucher_type"
></select>
<select
id=
"voucher_type"
class=
"form-control"
name=
"voucher_type"
></select>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"code"
><
%=
gettext
('
Code
')
%
></label>
<label
for=
"code"
><
%=
gettext
('
Code
')
%
></label>
<input
type=
"text"
class=
"form-control"
name=
"code"
placeholder=
"<%= gettext('optional') %>"
>
<input
id=
"code"
type=
"text"
class=
"form-control"
name=
"code"
placeholder=
"<%= gettext('optional') %>"
>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"quantity"
><
%=
gettext
('
Number
of
Codes
')
%
></label>
<label
for=
"quantity"
><
%=
gettext
('
Number
of
Codes
')
%
></label>
<input
type=
"number"
step=
"1"
class=
"form-control"
name=
"quantity"
value=
"1"
min=
"1"
>
<input
id=
"quantity"
type=
"number"
step=
"1"
class=
"form-control"
name=
"quantity"
value=
"1"
min=
"1"
>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"max_uses"
><
%=
gettext
('
Maximum
Number
of
Uses
')
%
></label>
<label
for=
"max_uses"
><
%=
gettext
('
Maximum
Number
of
Uses
')
%
></label>
<input
type=
"number"
step=
"1"
class=
"form-control"
name=
"max_uses"
value=
"1"
min=
"1"
>
<input
id=
"max_uses"
type=
"number"
step=
"1"
class=
"form-control"
name=
"max_uses"
value=
"1"
min=
"1"
>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
<label
for=
"benefit_value"
><
%=
gettext
('
Discount
Value
')
%
>
*
</label>
<label
for=
"benefit_value"
><
%=
gettext
('
Discount
Value
')
%
>
*
</label>
<div
class=
"input-group"
>
<div
class=
"input-group"
>
<div
class=
"benefit-addon input-group-addon"
></div>
<div
class=
"benefit-addon input-group-addon"
></div>
<input
type=
"number"
step=
"0.01"
min=
"0"
class=
"form-control benefit_value"
name=
"benefit_value"
>
<input
id=
"benefit_value"
type=
"number"
step=
"0.01"
min=
"0"
class=
"form-control benefit_value"
name=
"benefit_value"
>
</div>
</div>
<div
class=
"form-inline benefit-type"
>
<div
class=
"form-inline benefit-type"
>
<input
id=
"benefit_percent"
type=
"radio"
name=
"benefit_type"
value=
"Percentage"
>
<input
id=
"benefit_percent"
type=
"radio"
name=
"benefit_type"
value=
"Percentage"
>
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"client"
><
%=
gettext
('
Client
')
%
>
*
</label>
<label
for=
"client"
><
%=
gettext
('
Client
')
%
>
*
</label>
<input
type=
"text"
class=
"form-control"
name=
"client"
maxlength=
"50"
>
<input
id=
"client"
type=
"text"
class=
"form-control"
name=
"client"
maxlength=
"50"
>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
...
@@ -86,7 +86,7 @@
...
@@ -86,7 +86,7 @@
<label
for=
"price"
><
%=
gettext
('
Total
to
Invoice
to
Client
')
%
></label>
<label
for=
"price"
><
%=
gettext
('
Total
to
Invoice
to
Client
')
%
></label>
<div
class=
"input-group"
>
<div
class=
"input-group"
>
<div
class=
"input-group-addon"
>
$
</div>
<div
class=
"input-group-addon"
>
$
</div>
<input
type=
"number"
step=
"0.01"
min=
"0"
class=
"form-control"
name=
"price"
>
<input
id=
"price"
type=
"number"
step=
"0.01"
min=
"0"
class=
"form-control"
name=
"price"
>
</div>
</div>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
...
@@ -94,7 +94,7 @@
...
@@ -94,7 +94,7 @@
<label
for=
"total_value"
><
%=
gettext
('
Total
Value
of
Coupon
')
%
></label>
<label
for=
"total_value"
><
%=
gettext
('
Total
Value
of
Coupon
')
%
></label>
<div
class=
"input-group"
>
<div
class=
"input-group"
>
<div
class=
"input-group-addon"
>
$
</div>
<div
class=
"input-group-addon"
>
$
</div>
<input
type=
"number"
step=
"0.01"
min=
"0"
class=
"form-control"
name=
"total_value"
disabled
>
<input
id=
"total_value"
type=
"number"
step=
"0.01"
min=
"0"
class=
"form-control"
name=
"total_value"
disabled
>
</div>
</div>
<p
class=
"help-block"
><
%=
gettext
('
Number
of
coupon
codes
X
unit
price
per
seat
')
%
></p>
<p
class=
"help-block"
><
%=
gettext
('
Number
of
coupon
codes
X
unit
price
per
seat
')
%
></p>
</div>
</div>
...
@@ -112,17 +112,17 @@
...
@@ -112,17 +112,17 @@
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"course_id"
><
%=
gettext
('
Course
ID
')
%
>
*
</label>
<label
for=
"course_id"
><
%=
gettext
('
Course
ID
')
%
>
*
</label>
<input
type=
"text"
class=
"form-control"
name=
"course_id"
>
<input
id=
"course_id"
type=
"text"
class=
"form-control"
name=
"course_id"
>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"seat_type"
><
%=
gettext
('
Seat
Type
')
%
>
*
</label>
<label
for=
"seat_type"
><
%=
gettext
('
Seat
Type
')
%
>
*
</label>
<select
class=
"form-control"
name=
"seat_type"
></select>
<select
id=
"seat_type"
class=
"form-control"
name=
"seat_type"
></select>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
<div
class=
"form-group catalog-query"
>
<div
class=
"form-group catalog-query"
>
<label
for=
"catalog_query"
><
%=
gettext
('
Valid
for:
')
%
>
*
</label>
<label
for=
"catalog_query"
><
%=
gettext
('
Valid
for:
')
%
>
*
</label>
<textarea
class=
"form-control"
name=
"catalog_query"
rows=
"10"
></textarea>
<textarea
id=
"catalog_query"
class=
"form-control"
name=
"catalog_query"
rows=
"10"
></textarea>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
<div
class=
"form-group course-seat-types"
>
<div
class=
"form-group course-seat-types"
>
...
@@ -138,7 +138,7 @@
...
@@ -138,7 +138,7 @@
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"note"
><
%=
gettext
('
Note
')
%
></label>
<label
for=
"note"
><
%=
gettext
('
Note
')
%
></label>
<input
type=
"text"
class=
"form-control"
name=
"note"
maxlength=
"100"
>
<input
id=
"note"
type=
"text"
class=
"form-control"
name=
"note"
maxlength=
"100"
>
<p
class=
"help-block"
></p>
<p
class=
"help-block"
></p>
</div>
</div>
</div>
</div>
...
...
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