Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
soko
Project
Project
Details
Activity
Releases
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
bitsoko services
soko
Commits
b1c583c7
Commit
b1c583c7
authored
Dec 08, 2018
by
gaseema.n
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inventory update
parent
1b740bfd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
47 deletions
+63
-47
index.html
index.html
+2
-2
inventory.js
js/inventory.js
+61
-10
products.js
js/products.js
+0
-35
No files found.
index.html
View file @
b1c583c7
...
...
@@ -1515,8 +1515,8 @@
</div>
<div
class=
"col s12"
>
<div
class=
"row"
>
<div
class=
"
autocomplete"
style=
"width: 90%; display: block; margin: 20px auto;
"
>
<input
id=
"check-prod-input"
type=
"text"
name=
"myCountry"
placeholder=
"Add Sponsored Products"
class=
"sponsoredPrd"
>
<div
class=
"
inventoryItemsToAdd
"
>
</div>
</div>
<div
class=
"row sprndProd"
></div>
...
...
js/inventory.js
View file @
b1c583c7
...
...
@@ -15,22 +15,19 @@ function sponpProdNamesInput() {
var
inputVal
=
$
(
"#check-prod-input"
).
val
();
var
fetchedData
=
doFetch
({
action
:
'getAllProducts'
,
data
:
inputVal
,
data
:
''
,
filter
:
'sponsored'
}).
then
(
function
(
e
)
{
var
dat
=
{}
var
itemDat
=
new
Array
();
sponProds
=
e
.
products
;
for
(
var
iii
in
e
.
products
)
{
var
nm
=
e
.
products
[
iii
].
name
+
" - "
+
e
.
products
[
iii
].
price
;
var
icn
=
e
.
products
[
iii
].
icon
;
var
itemName
=
e
.
products
[
iii
].
name
//var id = e.users[iii].id;
dat
[
nm
]
=
icn
;
itemDat
.
push
(
itemName
)
$
(
'.inventoryItemsToAdd'
).
html
(
''
);
for
(
var
iii
in
sponProds
)
{
var
itemName
=
sponProds
[
iii
].
name
;
var
itemPrice
=
sponProds
[
iii
].
price
;
var
itemId
=
sponProds
[
iii
].
id
;
$
(
'.inventoryItemsToAdd'
).
append
(
'<form action="#"> <p> <label> <input class="inventoryItems" type="checkbox" pid="'
+
itemId
+
'" id="inventoryItem'
+
itemId
+
'"/> <span>'
+
itemName
+
'</span> </label> </p></form>'
);
}
autocomplete
(
document
.
getElementById
(
"check-prod-input"
),
itemDat
);
});
}
...
...
@@ -62,3 +59,57 @@ function inventoryOrder(prid) {
})
}
}
$
(
document
).
on
(
'click touchstart'
,
'.inventoryItems'
,
function
(
e
)
{
var
getId
=
$
(
this
).
attr
(
'pid'
);
var
isChecked
=
$
(
'#inventoryItem'
+
getId
).
prop
(
'checked'
);
console
.
log
(
getId
)
console
.
log
(
isChecked
)
if
(
isChecked
==
true
){
M
.
toast
({
html
:
'Adding item to inventory'
,
classes
:
'spnsrdTst'
,
displayLength
:
10000
})
doFetch
({
action
:
'addSponsoredProduct'
,
store
:
localStorage
.
getItem
(
'soko-active-store'
),
do
:
'add'
,
id
:
getId
}).
then
(
function
(
e
)
{
if
(
e
.
status
==
'ok'
)
{
$
(
".spnsrdTst"
).
remove
();
$
(
'#spnsrdModal'
).
modal
(
'close'
);
M
.
toast
({
html
:
'Item added to inventory successfully'
,
displayLength
:
3000
})
}
else
{}
});
}
else
{
M
.
toast
({
html
:
'Removing item from inventory'
,
classes
:
'spnsrdTst'
,
displayLength
:
10000
})
doFetch
({
action
:
'addSponsoredProduct'
,
store
:
localStorage
.
getItem
(
'soko-active-store'
),
do
:
'remove'
,
id
:
getId
}).
then
(
function
(
e
)
{
if
(
e
.
status
==
'ok'
)
{
$
(
".spnsrdTst"
).
remove
();
$
(
'#spnsrdModal'
).
modal
(
'close'
);
M
.
toast
({
html
:
'Item removed successfully'
,
displayLength
:
3000
})
}
else
{}
});
}
})
js/products.js
View file @
b1c583c7
...
...
@@ -171,41 +171,6 @@ $(document).on('touchstart click', '#noSponsoredBtn', function(event) {
$
(
"#rmvSpnsrdProd"
).
hide
();
});
$
(
'#spnsrdModal'
).
on
(
'click'
,
$
(
'.autocomplete-items div'
),
function
()
{
var
value
=
$
(
'#check-prod-input'
).
val
();
if
(
value
!=
''
)
{
var
sponsoredProduct
=
value
;
for
(
var
i
in
sponProds
)
{
var
name
=
sponProds
[
i
].
name
;
var
id
=
sponProds
[
i
].
id
;
var
price
=
sponProds
[
i
].
price
;
if
(
sponsoredProduct
==
name
)
{
M
.
toast
({
html
:
'Adding sponsored product'
,
classes
:
'spnsrdTst'
,
displayLength
:
10000
})
doFetch
({
action
:
'addSponsoredProduct'
,
store
:
localStorage
.
getItem
(
'soko-active-store'
),
do
:
'add'
,
id
:
id
}).
then
(
function
(
e
)
{
if
(
e
.
status
==
'ok'
)
{
$
(
".spnsrdTst"
).
remove
();
$
(
'#spnsrdModal'
).
modal
(
'close'
);
M
.
toast
({
html
:
'Sponsored product added successfully'
,
displayLength
:
3000
})
}
else
{}
});
}
}
}
});
var
prodUID
;
function
productsUpdater
()
{
...
...
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