Commit 86edeac7 by Félicie

Merge branch 'dev_cooperatic' into 2826-price-product

parents 8c4e7e33 04aedf66
Pipeline #2159 passed with stage
in 1 minute 30 seconds
"""Company specific data values."""
MAG_NAME = 'Cleme'
OFFICE_NAME = ''
MAX_BEGIN_HOUR = '19:00'
COMPANY_NAME = 'La Cagette'
WELCOME_ENTRANCE_MSG = 'Bienvenue à La Cagette !'
WELCOME_MAIL_SUBJECT = 'Dernière étape de votre inscription à la Cagette.'
WELCOME_MAIL_TEMPLATE = 'members/bienvenue.html'
BLOCK_SERVICE_EXCHANGE_24H_BEFORE = True
USE_NEW_MEMBERS_SPACE = True
ASSOCIATE_MEMBER_SHIFT = 429
START_DATE_FOR_POINTS_HISTORY = "2021-07-01"
START_DATE_FOR_SHIFTS_HISTORY = "2021-07-01"
COMPANY_CODE = "lacagette"
AMNISTIE_DATE= "2021-11-24 23:00:00"
DEFAULT_SHIFT_TYPE = 'standard'
SHOW_FTOP_BUTTON = False
USE_STANDARD_SHIFT = True
OPEN_ON_SUNDAY = True
FLV_CSV_NB = 4
CAP_JOURNAL_ID = 9
CAP_APPELE_NON_VERSE_ACCOUNT_ID = 529
CAP_APPELE_VERSE_ACCOUNT_ID = 8
CAP_INVOICE_LINE_ACCOUNT_ID = 8
FUNDRAISING_CAT_ID = 1
UNITE_UOM_ID = 1
PARTS_A_PRODUCT_ID = 1008
PARTS_A_PRICE_UNIT = 10.0
COOP_BARCODE_RULE_ID = 11
CHECK_PAYMENT_ID = 8
CASH_PAYMENT_ID = 18
STOCK_LOC_ID = 12
CATEG_FRUIT = 151
CATEG_LEGUME = 152
COEFF_MAG_ID = 1
LOSSES_LOC_ID = 33
LOSSES_PICKING_TYPE_ID = 10
AUTOCONSO_LOC_ID = 27
AUTOCONSO_PICKING_TYPE_ID = 7
MEALS_LOC_ID = 36
MEALS_PICKING_TYPE_ID = 16
DEFAULT_MAX_TIMESLOT_CARTS = 5
MIN_DELAY_FOR_SLOT = 4
HOURS_FOR_VALIDATION_SHOP = 3
CART_VALIDATION_BOTTOM_MSG = "Pour des raisons d'hygiène les commandes seront préparées dans des sacs en papier kraft qui vous seront facturées, 0,24€ pour les petits et 0,77€ pour les grands. Merci de votre compréhension"
SUBSCRIPTION_PAYMENT_MEANINGS = [{'code': 'cash', 'title': 'Espèces', 'journal_id': CASH_PAYMENT_ID},
{'code': 'ch', 'title': 'Chèque', 'journal_id': CHECK_PAYMENT_ID}]
EM_URL = ''
RECEPTION_MERGE_ORDERS_PSWD = 'jpsrcp'
DAV_PATH = '/shared_dir/dav/'
TOOLS_SERVER = 'http://10.203.101.242:2012'
ADMIN_IDS = [13]
BRINKS_MUST_IDENTIFY = False
SHOP_CAN_BUY = True
SHOP_OPENING = {'mar.': [{'start': '10:30', 'end': '14:00'}, {'start': '15:30', 'end': '20:00'}],
'mer.': [{'start': '10:30', 'end': '14:00'}, {'start': '15:30', 'end': '20:00'}],
'jeu.': [{'start': '10:30', 'end': '14:00'}, {'start': '15:30', 'end': '20:00'}],
'ven.': [{'start': '10:30', 'end': '14:00'}, {'start': '15:30', 'end': '20:00'}],
'sam.': [{'start': '10:30', 'end': '14:00'}, {'start': '15:30', 'end': '20:00'}]
}
#
# SHOP_OPENING = {}
SHOP_OPENING_START_DATE = '2020-06-02'
SHOP_SLOT_SIZE = 30 # minutes
SHOP_CATEGORIES = {'epicerie': {'id': 75, 'label': 'Epicerie'},
'liquide': {'id': 96, 'label': 'Liquides'},
'produits_frais': {'id': 104, 'label': 'Frais'},
'surgeles': {'id': 115, 'label': 'Surgelés'},
'bazar': {'id': 122, 'label': 'Bazar'},
'droguerie': {'id': 127, 'label': 'Droguerie Hygiène'},
'parfumerie': {'id': 133, 'label': 'Parfumerie'}}
SHOP_EXTRA_MENUS = ['shop/planning_livraison_pains.html', 'shop/combien_ca_pese.html']
SHOP_SURVEY_LINK = ''
SHOP_LIMIT_PRODUCTS = ['relatively_available', 'no_shelf']
SHOP_HEADER_IMG = "https://odoo.demo.cooperatic.fr/web/binary/company_logo?db=lacagette&company=1"
EXCLUDE_SHOP_CATEGORIES = [108]
PROMOTE_SHELFS_IDS = [68]
DISCOUNT_SHELFS_IDS = [74]
FL_SHELFS = [16, 17, 18]
VRAC_SHELFS = [20, 38]
SHIFT_EXCHANGE_DAYS_TO_HIDE = ''
SHIFT_INFO = """A la cagette, un service est une plage de trois heures un jour en particulier, par exemple : le mardi 25/09/2018 à 13h15.
<br />A l'inverse, un créneau est une plage de trois heures régulière, par exemple, tous les mardi de semaine A à 13h15."""
PB_INSTRUCTIONS = """Si j'ai un problème, que je suis désinscrit, que je veux changer de créneaux ou quoi que ce soit, merci de vous rendre dans la section \"J'ai un problème\" sur le site web de <a href=\"https://lacagette-coop.fr/?MonEspaceMembre\">La Cagette</a>"""
ENTRANCE_COME_FOR_SHOPING_MSG = "Hey coucou toi ! Cet été nous sommes plus de <strong>1000 acheteur·euses</strong> pour seulement <strong>300 coopérateur·rice·s</strong> en service. <br />Tu fais tes courses à La Cagette cet été ?<br/> Inscris-toi sur ton espace membre !"
ENTRANCE_EXTRA_BUTTONS_DISPLAY = False
ENTRANCE_EASY_SHIFT_VALIDATE = True
ENTRANCE_MISSED_SHIFT_BEGIN_MSG = """La période pendant laquelle il est possible de s'enregistrer est close.<br/>
Pour tout problème ou demande vous pouvez contacter le Bureau des Membres via les formulaires depuis votre espace membre.
"""
ENTRANCE_VALIDATE_PRESENCE_MESSAGE = """
<div class="explanations">
Ta présence a bien été validée ! Merci de te diriger au fond du magasin pour le lancement du créneau !
</div>
Ton prochain service <span class="service_verb">est prévu</span> le <span class="next_shift"></span>
"""
ENTRANCE_EASY_SHIFT_VALIDATE_MSG = """Si vous faites un service dans un comité, merci de <br/>
valider votre présence en cherchant<br/>
votre nom ou numéro ci-dessous
"""
# Members space / shifts
UNSUBSCRIBED_MSG = 'Vous êtes désincrit·e, merci de remplir <a href="">ce formulaire</a>'
UNSUBSCRIBED_FORM_LINK = ''
RECEPTION_PB = "Ici, vous pouvez signaler toute anomalie lors d'une réception, les produits non commandés, cassés ou pourris. \
Merci d'indiquer un maximum d'informations, le nom du produit et son code barre."
CONFIRME_PRESENT_BTN = 'Clique ici pour valider ta présence'
ORDERS_HELPER_METABASE_URL = ""
from django.test import SimpleTestCase
class TestUrls(SimpleTestCase):
def test_list_url_is_resolved(self):
assert 1==1
\ No newline at end of file
from django.test import SimpleTestCase
from django.test import Client
class TestUrls(SimpleTestCase):
def test_list_url_is_resolved(self):
assert 1==1
\ No newline at end of file
def testInventoryUrlIsResolved(self):
c = Client()
response = c.get('/reception/')
assert response.status_code == 200, "Inventory url is not resolved"
......@@ -773,4 +773,7 @@ $(document).ready(function() {
searchMembersForAssociate();
});
if (committees_shift_id !== "None") {
$("#shift_choice button[data-select='Volant']").text("Comités");
}
});
from django.test import SimpleTestCase
from django.test import Client
class TestUrls(SimpleTestCase):
def test_list_url_is_resolved(self):
assert 1==1
\ No newline at end of file
def testMembersUrlIsResolved(self):
c = Client()
response = c.get('/members/')
assert response.status_code == 200, "Members url is not resolved"
......@@ -87,7 +87,9 @@ def inscriptions(request, type=1):
"""
template = loader.get_template('members/inscriptions.html')
context = {'type': type, 'title': 'Inscriptions',
committees_shift_id = CagetteServices.get_committees_shift_id()
context = {
'type': type, 'title': 'Inscriptions',
'couchdb_server': settings.COUCHDB['url'],
'mag_place_string': settings.MAG_NAME,
'office_place_string': settings.OFFICE_NAME,
......@@ -104,6 +106,7 @@ def inscriptions(request, type=1):
'db': settings.COUCHDB['dbs']['member'],
'ASSOCIATE_MEMBER_SHIFT' : getattr(settings, 'ASSOCIATE_MEMBER_SHIFT', ''),
'prepa_odoo_url' : getattr(settings, 'PREPA_ODOO_URL', '/members/prepa-odoo'),
'committees_shift_id': committees_shift_id,
}
response = HttpResponse(template.render(context, request))
......
......@@ -56,7 +56,8 @@
}
/* - Order selection screen */
#new_order_area {
#new_order_area,
#existing_orders_area {
margin-bottom: 40px;
}
......@@ -167,6 +168,11 @@
border-bottom: 1px solid #004aa6;
}
#common_info_editor_container {
width: 50%;
margin: 15px auto;
}
/* -- Order data */
#order_data_container {
font-size: 1.8rem;
......@@ -177,7 +183,7 @@
}
#order_forms_container {
margin-top: 20px;
margin: 25px 0;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
......
......@@ -10,10 +10,16 @@ var suppliers_list = [],
package_qty: null,
price: null
},
qties_values = {};
qties_values = {},
clicked_order_pill = null,
userAgent = navigator.userAgent;
timerId = null,
info_editor = null;
var dbc = null,
sync = null,
fingerprint = null,
order_doc = {
_id: null,
coverage_days: null,
......@@ -27,11 +33,12 @@ var dbc = null,
selected_suppliers: [],
selected_rows: []
},
fingerprint = null;
common_info_doc_name = "common_info",
info_doc = {
_id: null,
content: ""
};
var clicked_order_pill = null;
let userAgent = navigator.userAgent;
var timerId = null;
/* - UTILS */
......@@ -125,7 +132,9 @@ function debounceFunction(func, delay = 1000) {
timerId = setTimeout(func, delay);
}
/* - PRODUCTS */
var process_new_product_qty = function(input) {
// Remove line coloring on input blur
const row = $(input).closest('tr');
......@@ -188,6 +197,7 @@ var process_new_product_qty = function(input) {
}
}
};
/**
* Add a product.
*
......@@ -2150,21 +2160,26 @@ function update_order_selection_screen() {
// Remove listener before recreating them
$(".order_pill").off();
// Reset orders data
let existing_orders_container = $("#existing_orders");
existing_orders_container.empty();
$('#new_order_name').val('');
if (result.rows.length === 0) {
if (
result.rows.length === 0
|| result.rows.length === 0 && result.rows[0].id === common_info_doc_name) {
existing_orders_container.append(`<i>Aucune commande en cours...</i>`);
} else {
for (let row of result.rows) {
if (row.id !== common_info_doc_name) {
let template = $("#templates #order_pill_template");
template.find(".pill_order_name").text(row.id);
existing_orders_container.append(template.html());
}
}
$(".order_pill").on("click", order_pill_on_click);
$(".remove_order_icon").on("click", function(e) {
......@@ -2288,6 +2303,15 @@ function init_pouchdb_sync() {
);
back();
break;
} else if (doc._id === common_info_doc_name) {
init_info_editor();
$.notify(
"Nouveau message dans le bloc d'information !",
{
globalPosition:"top right",
className: "info"
}
);
}
}
......@@ -2303,11 +2327,162 @@ function init_pouchdb_sync() {
});
}
/* - INFO AREA */
/**
* Init the Quill module (Text editor)
* @param {Object} params
*/
function quillify(params) {
info_editor = new Quill(params.id, {
modules: {
toolbar: [
[
{ header: [
1,
2,
false
] }
],
[
'bold',
'italic',
'underline'
],
[
{ 'size': [
'small',
false,
'large',
'huge'
] }
],
[
{ 'color': [] },
{ 'background': [] }
]
]
},
placeholder: "Indiquez ici un message pour le reste de l'équipe",
theme: 'snow'
});
info_editor.root.innerHTML = params.content;
}
/**
* Init object & dom for the info editor.
* Await retrieving content.
*/
async function init_info_editor() {
let info_content = await get_or_create_common_info();
// Reset info editor
info_editor = null;
$("#common_info_editor_container").empty();
$("#common_info_editor_container").append(`<div id="common_info_editor"></div>`);
// Init text editor for Info textarea
let quill_params = {
id: '#common_info_editor',
content: info_content
};
quillify(quill_params);
$("#save_common_info").on("click", function() {
if (is_time_to('save_common_info', 1000)) {
let content = $("#common_info_editor").find('.ql-editor')
.html();
if (content === "<p><br></p>") {
content = "";
}
update_common_info(content);
}
});
}
/**
* Get common info HTML content. If doc doesn't exist, create & return empty string
* @returns String HTML content | ""
*/
function get_or_create_common_info() {
// todo await async
return new Promise((resolve) => {
dbc.get(common_info_doc_name).then((doc) => {
info_doc = doc;
resolve(doc.content);
})
.catch(function (err) {
if (err.status == 404) {
// First access, create
info_doc._id = common_info_doc_name;
dbc.put(info_doc, function callback(err, result) {
if (!err) {
info_doc._rev = result.rev;
} else {
$.notify(
"Erreur lors de l'initialisation du bloc d'informations",
{
globalPosition:"top right",
className: "error"
}
);
console.log(err);
}
resolve("");
});
} else {
$.notify(
"Erreur lors de la récupération du bloc d'informations",
{
globalPosition:"top right",
className: "error"
}
);
console.log(err);
resolve("");
}
});
});
}
/**
* Update couchdb info document with textarea (HTML) content
* @param {String} content
*/
function update_common_info(content) {
info_doc.content = content;
dbc.put(info_doc, function callback(err, result) {
if (!err) {
info_doc._rev = result.rev;
$.notify(
"Bloc d'informations mis à jour",
{
globalPosition:"top right",
className: "success"
}
);
} else {
$.notify(
"Erreur lors de la mise à jour du bloc d'informations",
{
globalPosition:"top right",
className: "error"
}
);
console.log(err);
}
});
}
$(document).ready(function() {
if (coop_is_connected()) {
$('#new_order_form').show();
$('#existing_orders_area').show();
$('#common_info_area').show();
fingerprint = new Fingerprint({canvas: true}).get();
$.ajaxSetup({ headers: { "X-CSRFToken": getCookie('csrftoken') } });
......@@ -2555,6 +2730,7 @@ $(document).ready(function() {
// Order selection screen
update_order_selection_screen();
init_info_editor();
$("#new_order_form").on("submit", function(e) {
e.preventDefault();
......@@ -2585,8 +2761,6 @@ $(document).ready(function() {
$("#supplier_input").autocomplete({
source: suppliers_list.map(a => a.display_name)
});
},
error: function(data) {
err = {msg: "erreur serveur lors de la récupération des fournisseurs", ctx: 'get_suppliers'};
......@@ -2694,7 +2868,6 @@ $(document).ready(function() {
}
});
}
} else {
$('#not_connected_content').show();
}
......
from django.test import SimpleTestCase
from django.test import Client
class TestUrls(SimpleTestCase):
def test_list_url_is_resolved(self):
assert 1==1
\ No newline at end of file
def testOrdersUrlIsResolved(self):
c = Client()
response = c.get('/orders/')
assert response.status_code == 200, "Orders url is not resolved"
......@@ -53,8 +53,13 @@ function subscribe_shift(shift_t_id) {
var s_data = shift_templates[shift_t_id].data;
var shift_name = get_shift_name(s_data);
if (committees_shift_id !== undefined && committees_shift_id !== "None" && shift_name === "Volant") {
shift_name = 'des Comités'
}
let msg = 'On inscrit le membre au créneau ' + shift_name
openModal(
'On inscrit le membre au créneau ' + shift_name,
msg,
function() {
closeModal();
current_coop.shift_template = shift_templates[shift_t_id];
......@@ -327,8 +332,15 @@ function retrieve_and_draw_shift_tempates() {
$.each(shift_templates, function(i, e) {
if (e.data.type == 2 && volant == null) {
// has comitee shift
if (committees_shift_id !== undefined && committees_shift_id !== "None") {
if (e.data.id == parseInt(committees_shift_id)) {
volant = e.data.id
}
} else {
volant = e.data.id;
}
}
});
dbc.allDocs({include_docs: true, descending: true}, function(err, resp) {
......
from django.test import SimpleTestCase
class TestUrls(SimpleTestCase):
def test_list_url_is_resolved(self):
assert 1==1
\ No newline at end of file
......@@ -9,8 +9,8 @@
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint . --max-warnings 326 '**/*.js'",
"lint-fix": "eslint . --fix --max-warnings 326 '**/*.js'"
"lint": "eslint . --max-warnings 292 '**/*.js'",
"lint-fix": "eslint . --fix --max-warnings 292 '**/*.js'"
},
"repository": {
"type": "git",
......
from django.test import SimpleTestCase
from django.test import Client
class TestUrls(SimpleTestCase):
def test_list_url_is_resolved(self):
assert 1==1
\ No newline at end of file
def testProductsUrlIsResolved(self):
c = Client()
response = c.get('/products/')
assert response.status_code == 200, "Products url is not resolved"
from django.test import SimpleTestCase
from django.test import Client
class TestUrls(SimpleTestCase):
def test_list_url_is_resolved(self):
assert 1==1
\ No newline at end of file
def testReceptionUrlIsResolved(self):
c = Client()
response = c.get('/reception/')
assert response.status_code == 200 , "Reception url is not resolved"
from django.test import SimpleTestCase
from django.test import Client
class TestUrls(SimpleTestCase):
def test_list_url_is_resolved(self):
assert 1==1
\ No newline at end of file
def testSalesUrlIsResolved(self):
c = Client()
response = c.get('/sales/')
assert response.status_code == 200, "Sales url is not resolved"
from django.test import SimpleTestCase
from django.test import Client
class TestUrls(SimpleTestCase):
def test_list_url_is_resolved(self):
assert 1==1
\ No newline at end of file
def testShelfsUrlIsResolved(self):
c = Client()
response = c.get('/shelfs/')
assert response.status_code == 200, "Shelfs url is not resolved"
from django.test import SimpleTestCase
class TestUrls(SimpleTestCase):
def test_list_url_is_resolved(self):
assert 1==1
\ No newline at end of file
from django.test import SimpleTestCase
from django.test import Client
class TestUrls(SimpleTestCase):
def test_list_url_is_resolved(self):
assert 1==1
\ No newline at end of file
def testShopUrlIsResolved(self):
c = Client()
response = c.get('/shop/')
assert response.status_code == 200, "Shop url is not resolved"
from django.test import SimpleTestCase
from django.test import Client
class TestUrls(SimpleTestCase):
def test_list_url_is_resolved(self):
assert 1==1
\ No newline at end of file
def testStockUrlIsResolved(self):
c = Client()
response = c.get('/stock/')
assert response.status_code == 200, "Stock url is not resolved"
......@@ -178,9 +178,11 @@
auto_compaction: false
});
var mag_place_string = '{{mag_place_string}}';
var office_place_string = '{{office_place_string}}'
var max_begin_hour = '{{max_begin_hour}}'
var email_domain = '{{email_domain}}'
var office_place_string = '{{office_place_string}}';
var max_begin_hour = '{{max_begin_hour}}';
var email_domain = '{{email_domain}}';
var committees_shift_id = '{{committees_shift_id}}';
</script>
<script src="{% static "js/all_common.js" %}?v="></script>
<script src="{% static "js/common.js" %}?v="></script>
......
......@@ -5,12 +5,14 @@
<link rel="stylesheet" href="{% static 'css/datatables/jquery.dataTables.css' %}">
<link rel="stylesheet" href="{% static 'jquery-ui-1.12.1/jquery-ui.min.css' %}">
<link rel="stylesheet" href="{% static 'css/oders_helper_style.css' %}">
<link rel="stylesheet" href="{% static 'quill/quill.snow.css' %}">
{% endblock %}
{% block additionnal_scripts %}
<script type="text/javascript" src="{% static 'jquery-ui-1.12.1/jquery-ui.min.js' %}?v="></script>
<script type="text/javascript" src="{% static 'js/datatables/jquery.dataTables.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/notify.min.js' %}?v="></script>
<script type="text/javascript" src="{% static 'quill/quill.min.js' %}"></script>
{% endblock %}
{% block content %}
......@@ -33,6 +35,13 @@
<h2>Ou, continuer une commande en cours de création</h2>
<div id="existing_orders"></div>
</div>
<div id="common_info_area" style="display:none;">
<h2>Informations</h2>
<div id="common_info_editor_container">
<div id="common_info_editor"></div>
</div>
<button class="btn--primary" id="save_common_info">Sauvegarder</button>
</div>
</div>
<div id="main_content" class="page_content" style="display:none;">
......@@ -41,7 +50,6 @@
<i class="fas fa-arrow-left"></i>&nbsp; Retour
</button>
<div class="right_action_buttons">
<div id="actions_buttons_wrapper">
<button type="button" class='btn--primary' id="toggle_action_buttons">
<span class="button_content">
......@@ -214,7 +222,7 @@
<p class="remove_order_modal_text">
Vous vous apprêtez à <b style="color: #d9534f;">supprimer</b> cette commande en cours : <span class="remove_order_name"></span>.<br/>
</p>
<p>Êtez-vous sûr ?</p>
<p>Êtez-vous sûr.e ?</p>
<hr/>
</div>
......@@ -225,7 +233,7 @@
Les produits associés uniquement à ce fournisseur seront supprimés du tableau.<br/>
Les données renseignées dans la colonne de ce fournisseur seront perdues.
</p>
<p>Êtez-vous sûr ?</p>
<p>Êtez-vous sûr.e ?</p>
<hr/>
</div>
......@@ -251,7 +259,7 @@
<p>
L'association sera sauvegardée dès que vous aurez cliqué sur "Valider".<br/>
</p>
<p>Êtez-vous sûr ?</p>
<p>Êtez-vous sûr.e ?</p>
<hr/>
</div>
......@@ -264,7 +272,7 @@
<p>
L'association sera supprimée dès que vous aurez cliqué sur "Valider".<br/>
</p>
<p>Êtez-vous sûr ?</p>
<p>Êtez-vous sûr.e ?</p>
<hr/>
</div>
......@@ -272,7 +280,7 @@
<p>
Vous vous apprêtez à créer un inventaire de <span class="inventory_products_count"></span> produits.
</p>
<p>Êtez-vous sûr ?</p>
<p>Êtez-vous sûr.e ?</p>
<hr/>
</div>
......
......@@ -177,6 +177,12 @@
<div id="modal_FAQ_content"></div>
<div id="modal_qtiesValidated"></div>
<div id="modal_pricesValidated"></div>
<div id="modal_confirm_price_to_weight">
<h3>Confirmation du prix</h3>
<p>Est ce que le prix au kilo du produit <b><span id="product_to_verify"></span></b>
est bien <b><span id="price_to_verify"></span></b> euros/Kg ?</p>
<input type="number" name="Prix au Kilo" id="new_price_to_weight">
</div>
</div>
<br/>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment