Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SAMBUMBA
pasteque-server
Commits
3969207b
Commit
3969207b
authored
Feb 24, 2013
by
Cédric Houbart
Browse files
Stock move and inventory UI (need stock service)
parent
760c146b
Changes
12
Hide whitespace changes
Inline
Side-by-side
languages/default.locale
View file @
3969207b
...
...
@@ -10,6 +10,7 @@
"Unable to save changes": "Unable to save changes",
"Image": "Image",
"Quantity": "Quantity",
"Product.label": "Name",
"Product.reference": "Reference",
...
...
languages/fr-FR.locale
View file @
3969207b
...
...
@@ -10,6 +10,7 @@
"Unable to save changes": "Impossible d'enregistrer les modifications",
"Image": "Image",
"Quantity": "Quantité",
"Product.label": "Désignation",
"Product.reference": "Référence",
...
...
modules/base_stocks/actions/inventory.php
0 → 100644
View file @
3969207b
<?php
// Pastèque Web back office, Stocks module
//
// Copyright (C) 2013 Scil (http://scil.coop)
//
// This file is part of Pastèque.
//
// Pastèque is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pastèque is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pastèque. If not, see <http://www.gnu.org/licenses/>.
namespace
BaseStocks
;
$products
=
\
Pasteque\ProductsService
::
getAll
();
?>
<h1>
<?php
\
pi18n
(
"Inventory"
,
PLUGIN_NAME
);
?>
</h1>
<div
class=
"error"
>
Not supported yet
</div>
<table
cellpadding=
"0"
cellspacing=
"0"
>
<thead>
<tr>
<th></th>
<th>
<?php
\
pi18n
(
"Product.reference"
);
?>
</th>
<th>
<?php
\
pi18n
(
"Product.label"
);
?>
</th>
<th>
<?php
\
pi18n
(
"Quantity"
);
?>
</th>
</tr>
</thead>
<tbody>
<?php
$par
=
FALSE
;
foreach
(
$products
as
$product
)
{
$par
=
!
$par
;
?>
<tr
class=
"row-
<?php
echo
$par
?
'par'
:
'odd'
;
?>
"
>
<td><img
class=
"thumbnail"
src=
"?
<?php
echo
\
Pasteque\URL_ACTION_PARAM
;
?>
=img&w=product&id=
<?php
echo
$product
->
id
;
?>
"
/>
<td>
<?php
echo
$product
->
reference
;
?>
</td>
<td>
<?php
echo
$product
->
label
;
?>
</td>
<td>
???
</td>
</tr>
<?php
}
?>
</tbody>
</table>
modules/base_stocks/actions/moves.php
0 → 100644
View file @
3969207b
<?php
// Pastèque Web back office, Stocks module
//
// Copyright (C) 2013 Scil (http://scil.coop)
//
// This file is part of Pastèque.
//
// Pastèque is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pastèque is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pastèque. If not, see <http://www.gnu.org/licenses/>.
namespace
BaseStocks
;
$message
=
NULL
;
$error
=
NULL
;
if
(
isset
(
$_POST
[
'type'
]))
{
$error
=
"Not supported yet"
;
}
$categories
=
\
Pasteque\CategoriesService
::
getAll
();
$products
=
\
Pasteque\ProductsService
::
getAll
(
TRUE
);
function
catalog_category
(
$category
,
$js
)
{
echo
"<a id=
\"
category-"
.
$category
->
id
.
"
\"
class=
\"
catalog-category
\"
onClick=
\"
javascript:"
.
$js
.
"return false;
\"
>"
;
echo
"<img src=
\"
?"
.
\
Pasteque\URL_ACTION_PARAM
.
"=img&w=category&id="
.
$category
->
id
.
"
\"
/>"
;
echo
"<p>"
.
$category
->
label
.
"</p>"
;
echo
"</a>"
;
}
?>
<h1>
<?php
\
pi18n
(
"Stock move"
,
PLUGIN_NAME
);
?>
</h1>
<?php
if
(
$message
!==
NULL
)
{
echo
"<div class=
\"
message
\"
>"
.
$message
.
"</div>
\n
"
;
}
if
(
$error
!==
NULL
)
{
echo
"<div class=
\"
error
\"
>"
.
$error
.
"</div>
\n
"
;
}
?>
<form
class=
"edit"
id=
"move"
method=
"post"
>
<div
class=
"row"
>
<label
for=
"type"
>
<?php
\
pi18n
(
"Operation"
,
PLUGIN_NAME
);
?>
</label>
<select
id=
"type"
name=
"type"
>
<option
name=
"input"
>
<?php
\
pi18n
(
"Input (buy)"
,
PLUGIN_NAME
);
?>
</option>
<option
name=
"output"
>
<?php
\
pi18n
(
"Output (sell)"
,
PLUGIN_NAME
);
?>
</option>
<option
name=
"return"
>
<?php
\
pi18n
(
"Output (return to supplyer)"
,
PLUGIN_NAME
);
?>
</option>
</select>
</div>
<div
class=
"catalog-categories-container"
>
<?php
foreach
(
$categories
as
$category
)
{
catalog_category
(
$category
,
"changeCategory('"
.
$category
->
id
.
"');"
);
}
?>
</div>
<div
id=
"products"
class=
"catalog-products-container"
>
</div>
<table
cellpadding=
"0"
cellspacing=
"0"
>
<thead>
<tr>
<th></th>
<th>
<?php
\
pi18n
(
"Product.reference"
);
?>
</th>
<th>
<?php
\
pi18n
(
"Product.label"
);
?>
</th>
<th>
<?php
\
pi18n
(
"Quantity"
);
?>
</th>
<th></th>
</tr>
</thead>
<tbody
id=
"list"
>
</tbody>
</table>
<div
class=
"row actions"
>
<?php
\
Pasteque\form_send
();
?>
</div>
</form>
<script
type=
"text/javascript"
>
centerImage
=
function
(
selector
)
{
var
container
=
jQuery
(
selector
);
var
img
=
container
.
children
(
"
img
"
);
var
containerWidth
=
parseInt
(
container
.
css
(
'
width
'
));
var
containerHeight
=
parseInt
(
container
.
css
(
'
height
'
));
var
imgWidth
=
parseInt
(
img
.
css
(
'
width
'
));
var
imgHeight
=
parseInt
(
img
.
css
(
'
height
'
));
var
hOffset
=
(
containerWidth
-
imgWidth
)
/
2
;
var
vOffset
=
(
containerHeight
-
imgHeight
)
/
2
;
img
.
css
(
"
left
"
,
hOffset
+
"
px
"
);
img
.
css
(
"
top
"
,
vOffset
+
"
px
"
);
}
jQuery
().
ready
(
function
()
{
<?php
foreach
(
$categories
as
$category
)
{
echo
"
\t\t
centerImage('#category-"
.
$category
->
id
.
"');
\n
"
;
}
?>
});
var
productsByCategory
=
new
Array
();
var
products
=
new
Array
();
addProductToCat
=
function
(
product
,
category
)
{
if
(
typeof
(
productsByCategory
[
category
])
!=
'
object
'
)
{
productsByCategory
[
category
]
=
new
Array
();
}
productsByCategory
[
category
].
push
(
product
);
}
<?php
foreach
(
$products
as
$product
)
{
echo
"
\t
addProductToCat(
\"
"
.
$product
->
id
.
"
\"
,
\"
"
.
$product
->
category
->
id
.
"
\"
);
\n
"
;
echo
"
\t
products[
\"
"
.
$product
->
id
.
"
\"
] = {\"
id
\
":
\"
"
.
$product
->
id
.
"
\"
,
\"
label
\"
:
\"
"
.
$product
->
label
.
"
\"
,
\"
reference
\"
:
\"
"
.
$product
->
reference
.
"
\"
,
\"
img
\"
:
\"
?"
.
\
Pasteque\URL_ACTION_PARAM
.
"=img&w=product&id="
.
$product
->
id
.
"
\"
};
\n
"
;
}
?>
showProduct
=
function
(
productId
)
{
var
product
=
products
[
productId
];
html
=
"
<a id=
\"
product-
"
+
productId
+
"
\"
class=
\"
catalog-product
\"
onClick=
\"
javascript:addProduct('
"
+
product
[
'
id
'
]
+
"
');return false;
\"
>
"
;
html
+=
"
<img src=
\"
"
+
product
[
"
img
"
]
+
"
\"
/>
"
;
html
+=
"
<p>
"
+
product
[
'
label
'
]
+
"
</p>
"
;
html
+=
"
</a>
"
;
jQuery
(
"
#products
"
).
append
(
html
);
centerImage
(
"
#product-
"
+
productId
);
}
changeCategory
=
function
(
category
)
{
jQuery
(
"
#products
"
).
html
(
""
);
var
prdCat
=
productsByCategory
[
category
];
for
(
var
i
=
0
;
i
<
prdCat
.
length
;
i
++
)
{
showProduct
(
prdCat
[
i
]);
}
}
addProduct
=
function
(
productId
)
{
var
product
=
products
[
productId
];
if
(
jQuery
(
"
#line-
"
+
productId
).
length
>
0
)
{
// Add quantity to existing line
var
qty
=
jQuery
(
"
#line-
"
+
productId
+
"
-qty
"
);
var
currVal
=
qty
.
val
();
qty
.
val
(
parseInt
(
currVal
)
+
1
);
}
else
{
// Add line
var
html
=
"
<tr id=
\"
line-
"
+
product
[
'
id
'
]
+
"
\"
>
\n
"
;
html
+=
"
<td><img class=
\"
thumbnail
\"
src=
\"
"
+
product
[
'
img
'
]
+
"
\"
/></td>
\n
"
;
html
+=
"
<td>
"
+
product
[
'
reference
'
]
+
"
</td>
\n
"
;
html
+=
"
<td>
"
+
product
[
'
label
'
]
+
"
</td>
\n
"
;
html
+=
"
<td class=
\"
qty-cell
\"
><input class=
\"
qty
\"
id=
\"
line-
"
+
product
[
'
id
'
]
+
"
-qty
\"
type=
\"
numeric
\"
name=
\"
qty-
"
+
product
[
'
id
'
]
+
"
\"
value=
\"
1
\"
/>
\n
"
;
html
+=
"
<td><a class=
\"
btn-delete
\"
href=
\"\"
onClick=
\"
javascript:deleteLine('
"
+
product
[
'
id
'
]
+
"
');return false;
\"
>
<?php
\
pi18n
(
"Delete"
);
?>
</a></td>
\n
"
;
html
+=
"
</tr>
\n
"
;
jQuery
(
"
#list
"
).
append
(
html
);
}
}
deleteLine
=
function
(
productId
)
{
jQuery
(
"
#line-
"
+
productId
).
detach
();
}
<?php
if
(
count
(
$categories
)
>
0
)
{
echo
"
\t
changeCategory(
\"
"
.
$categories
[
0
]
->
id
.
"
\"
);
\n
"
;
}
?>
</script>
modules/base_stocks/base_stocks.php
0 → 100644
View file @
3969207b
<?php
// Pastèque Web back office, Stocks module
//
// Copyright (C) 2013 Scil (http://scil.coop)
//
// This file is part of Pastèque.
//
// Pastèque is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pastèque is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pastèque. If not, see <http://www.gnu.org/licenses/>.
namespace
BaseStocks
;
function
init
()
{
global
$MENU
;
$MENU
->
addSection
(
"stock"
,
"Stocks"
,
PLUGIN_NAME
);
$MENU
->
registerModuleEntry
(
"stock"
,
PLUGIN_NAME
,
"menu_stock_move.png"
,
"Moves"
,
"moves"
);
$MENU
->
registerModuleEntry
(
"stock"
,
PLUGIN_NAME
,
"menu_stock_inventory.png"
,
"Inventory"
,
"inventory"
);
\
Pasteque\register_i18n
(
PLUGIN_NAME
);
}
\
Pasteque\hook
(
"module_load"
,
__NAMESPACE__
.
"\init"
);
?>
modules/base_stocks/languages/default.locale
0 → 100644
View file @
3969207b
{
"Stocks": "Stocks",
"Moves": "Moves",
"Stock move": "Stock move",
"Operation": "Operation",
"Input (buy)": "Input (buy)",
"Output (sell)": "Output (sell)",
"Output (return to supplyer)": "Output (return to supplyer)",
"Inventory": "Inventory"
}
modules/base_stocks/languages/fr-FR.locale
0 → 100644
View file @
3969207b
{
"Stocks": "Stocks",
"Moves": "Mouvement",
"Stock move": "Mouvement de stock",
"Operation": "Operation",
"Input (buy)": "Entrée (achat)",
"Output (sell)": "Sortie (vente)",
"Output (return to supplyer": "Sortie (retour au fournisseur)",
"Inventory": "Inventaire"
}
modules/base_stocks/module.php
0 → 100644
View file @
3969207b
<?php
// Pastèque Web back office, Stocks module
//
// Copyright (C) 2013 Scil (http://scil.coop)
//
// This file is part of Pastèque.
//
// Pastèque is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pastèque is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pastèque. If not, see <http://www.gnu.org/licenses/>.
namespace
BaseStocks
;
const
PLUGIN_NAME
=
"base_stocks"
;
require_once
(
dirname
(
__FILE__
)
.
"/base_stocks.php"
);
?>
templates/pasteque/catalog.css
0 → 100644
View file @
3969207b
.catalog-category
,
.catalog-product
{
display
:
inline-block
;
position
:
relative
;
width
:
64px
;
height
:
64px
;
background-color
:
#DDD
;
margin
:
5px
;
}
.catalog-category
img
,
.catalog-product
img
{
position
:
absolute
;
max-width
:
64px
;
max-height
:
64px
;
}
.catalog-category
p
,
.catalog-product
p
{
position
:
absolute
;
bottom
:
0px
;
margin
:
0px
;
width
:
100%
;
background-color
:
rgba
(
255
,
255
,
255
,
0.4
);
}
.catalog-categories-container
{
float
:
left
;
height
:
360px
;
width
:
180px
;
overflow
:
scroll
;
border
:
1px
solid
#000
;
}
.catalog-products-container
{
height
:
360px
;
width
:
400px
;
margin-left
:
180px
;
overflow
:
scroll
;
border
:
1px
solid
#000
;
}
.qty-cell
{
text-align
:
center
;
}
.qty
{
width
:
2em
;
text-align
:
center
;
}
templates/pasteque/img/menu_stock_inventory.png
0 → 100644
View file @
3969207b
1.13 KB
templates/pasteque/img/menu_stock_move.png
0 → 100644
View file @
3969207b
919 Bytes
templates/pasteque/module.php
View file @
3969207b
...
...
@@ -31,6 +31,7 @@ function tpl_open() {
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<title>
<?php
\
pi18n
(
"Pastèque"
);
?>
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"templates/pasteque/style.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"templates/pasteque/catalog.css"
/>
<script
type=
"text/javascript"
src=
"templates/pasteque/js/jquery-1.9.1.min.js"
></script>
</head>
<body>
...
...
Write
Preview
Supports
Markdown
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