Browse Source

Intégration Souke

feature/souke
Guillaume Bourgeois 7 months ago
parent
commit
c3cf69c195
23 changed files with 2331 additions and 2127 deletions
  1. +1
    -1
      backend/web/js/backend.js
  2. +1063
    -1065
      backend/web/js/vuejs/distribution-index.js
  3. +287
    -288
      backend/web/js/vuejs/document-form.js
  4. +75
    -74
      backend/web/js/vuejs/producer-update.js
  5. +132
    -129
      backend/web/js/vuejs/report-index.js
  6. +24
    -23
      backend/web/js/vuejs/setting-form.js
  7. +38
    -35
      backend/web/js/vuejs/subscription-form.js
  8. +12
    -12
      backend/web/js/vuejs/user-form.js
  9. +70
    -42
      common/web/css/screen.css
  10. +8
    -3
      common/web/js/common.js
  11. +45
    -21
      common/web/sass/_common.scss
  12. +4
    -4
      domain/Producer/Producer/ProducerRepository.php
  13. +2
    -2
      frontend/controllers/SiteController.php
  14. +2
    -2
      frontend/views/layouts/main.php
  15. +71
    -91
      frontend/views/site/index.php
  16. +55
    -55
      frontend/views/site/producer.php
  17. +291
    -215
      frontend/web/css/screen.css
  18. +8
    -2
      frontend/web/js/frontend.js
  19. BIN
      frontend/web/js/leaflet/images/marker-icon-souke.png
  20. BIN
      frontend/web/js/leaflet/images/marker-icon.back.png
  21. BIN
      frontend/web/js/leaflet/images/marker-icon.png
  22. +30
    -9
      frontend/web/sass/_responsive.scss
  23. +113
    -54
      frontend/web/sass/screen.scss

+ 1
- 1
backend/web/js/backend.js View File

function opendistrib_dropdown_producers() { function opendistrib_dropdown_producers() {


$('.producer-menu .dropdown-toggle').click(function () { $('.producer-menu .dropdown-toggle').click(function () {
$('.producer-menu .search-producer').focus();
setTimeout(function() { $('.producer-menu .search-producer').focus(); }, 100);
}); });


$('.producer-menu .search-producer').keyup(function () { $('.producer-menu .search-producer').keyup(function () {

+ 1063
- 1065
backend/web/js/vuejs/distribution-index.js
File diff suppressed because it is too large
View File


+ 287
- 288
backend/web/js/vuejs/document-form.js View File

termes. termes.
*/ */


var app = new Vue({
el: '#app-document-form',
data: {
taxRateProducer: null,
document: [],
deliveryNoteCreateArray: [],
deliveryNoteUpdateArray: [],
deliveryNoteAddId: 0,
ordersCreateArray: [],
ordersUpdateArray: [],
orderAddId: 0,
idDocument: 0,
typeDocument: '',
idUser: '',
productsArray: [],
productAddId: 0,
productAddPrice: '',
productAddQuantity: 1,
ordersArray: [],
invoiceUrl: null,
total: 0,
total_with_tax: 0
},
mounted: function () {
this.init();
},
methods: {
formatPrice: formatPrice,
init: function () {
var app = this;
var selector = '#app-document-form';
if($(selector).length) {
var app = new Vue({
el: selector,
data: {
taxRateProducer: null,
document: [],
deliveryNoteCreateArray: [],
deliveryNoteUpdateArray: [],
deliveryNoteAddId: 0,
ordersCreateArray: [],
ordersUpdateArray: [],
orderAddId: 0,
idDocument: 0,
typeDocument: '',
idUser: '',
productsArray: [],
productAddId: 0,
productAddPrice: '',
productAddQuantity: 1,
ordersArray: [],
invoiceUrl: null,
total: 0,
total_with_tax: 0
},
mounted: function () {
this.init();
},
methods: {
formatPrice: formatPrice,
init: function () {
var app = this;


if (this.getDocumentId()) {
if (this.getDocumentId()) {


axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-init", {
params: {
idDocument: this.getDocumentId(),
classDocument: this.getDocumentClass()
}
})
.then(function (response) {
if (response.data.return == 'success') {
app.document = response.data.document;
app.taxRateProducer = response.data.tax_rate_producer;
app.idUser = response.data.id_user;
app.productsArray = response.data.products;
app.ordersArray = response.data.orders;
app.invoiceUrl = response.data.invoice_url;
app.total = response.data.total;
app.total_with_tax = response.data.total_with_tax;
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-init", {
params: {
idDocument: this.getDocumentId(),
classDocument: this.getDocumentClass()
}
})
.then(function (response) {
if (response.data.return == 'success') {
app.document = response.data.document;
app.taxRateProducer = response.data.tax_rate_producer;
app.idUser = response.data.id_user;
app.productsArray = response.data.products;
app.ordersArray = response.data.orders;
app.invoiceUrl = response.data.invoice_url;
app.total = response.data.total;
app.total_with_tax = response.data.total_with_tax;


if (app.idUser > 0) {
app.changeUser();
if (app.idUser > 0) {
app.changeUser();
}
} }
}
});
} else {
$('.select2-document-form').on('select2:select', function (e) {
var idUser = e.params.data.id;
app.idUser = idUser;
app.changeUser();
}); });
}
else {
$('.select2-document-form').on('select2:select', function (e) {
var idUser = e.params.data.id;
app.idUser = idUser;
app.changeUser();
});
}
},
getProductById: function(idProduct) {
var app = this;
}
},
getProductById: function (idProduct) {
var app = this;


for(var i = 0; i <= Object.keys(this.productsArray).length + 1 ; i++) {
if(app.productsArray[i] && app.productsArray[i].id == idProduct) {
return app.productsArray[i];
for (var i = 0; i <= Object.keys(this.productsArray).length + 1; i++) {
if (app.productsArray[i] && app.productsArray[i].id == idProduct) {
return app.productsArray[i];
}
} }
}


return false;
},
getDocumentId: function () {
var documentId = $('#app-document-form').attr('data-id-document');
return documentId;
},
getDocumentClass: function () {
var documentClass = $('#app-document-form').attr('data-class-document');
return documentClass;
},
getProductOrderPrice: function (productOrder) {
var documentClass = this.getDocumentClass();
var price = 0;
if (documentClass == 'DeliveryNote' || documentClass == 'Invoice') {
price = productOrder.invoice_price;
if (isNaN(price) || price === null) {
return false;
},
getDocumentId: function () {
var documentId = $('#app-document-form').attr('data-id-document');
return documentId;
},
getDocumentClass: function () {
var documentClass = $('#app-document-form').attr('data-class-document');
return documentClass;
},
getProductOrderPrice: function (productOrder) {
var documentClass = this.getDocumentClass();
var price = 0;
if (documentClass == 'DeliveryNote' || documentClass == 'Invoice') {
price = productOrder.invoice_price;
if (isNaN(price) || price === null) {
price = productOrder.price;
}
} else {
price = productOrder.price; price = productOrder.price;
} }
} else {
price = productOrder.price;
}


return price;
},
changeUser: function () {
var app = this;
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-user-infos", {
params: {
idUser: app.idUser,
classDocument: app.getDocumentClass(),
idDocument: app.getDocumentId(),
typeAction: $('#type-action').val(),
}
})
.then(function (response) {
if (response.data.return == 'success') {
Vue.set(app.document, 'address', response.data.address);
app.deliveryNoteCreateArray = response.data.delivery_note_create_array;
app.deliveryNoteUpdateArray = response.data.delivery_note_update_array;
app.ordersCreateArray = response.data.orders_create_array;
app.ordersUpdateArray = response.data.orders_update_array;
} else {
app.document.address = '';
return price;
},
changeUser: function () {
var app = this;
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-user-infos", {
params: {
idUser: app.idUser,
classDocument: app.getDocumentClass(),
idDocument: app.getDocumentId(),
typeAction: $('#type-action').val(),
} }
setTimeout("opendistrib_check_all_checkboxes();", 500);
});
},
deleteDeliveryNoteFromInvoice: function(event) {
var app = this;
var idDeliveryNote = event.currentTarget.getAttribute('data-id');
})
.then(function (response) {
if (response.data.return == 'success') {
Vue.set(app.document, 'address', response.data.address);
app.deliveryNoteCreateArray = response.data.delivery_note_create_array;
app.deliveryNoteUpdateArray = response.data.delivery_note_update_array;
app.ordersCreateArray = response.data.orders_create_array;
app.ordersUpdateArray = response.data.orders_update_array;
} else {
app.document.address = '';
}
setTimeout("opendistrib_check_all_checkboxes();", 500);
});
},
deleteDeliveryNoteFromInvoice: function (event) {
var app = this;
var idDeliveryNote = event.currentTarget.getAttribute('data-id');


axios.get(UrlManager.getBaseUrlAbsolute() + "invoice/ajax-delete-delivery-note", {
params: {
idInvoice: app.getDocumentId(),
idDeliveryNote: idDeliveryNote
}
})
.then(function (response) {
appAlerts.alertResponse(response);
app.init();
});
},
submitDeliveryNoteAddToInvoice: function() {
var app = this;
axios.get(UrlManager.getBaseUrlAbsolute() + "invoice/ajax-add-delivery-note", {
params: {
idInvoice: this.getDocumentId(),
idDeliveryNote: app.deliveryNoteAddId,
}
})
.then(function (response) {
appAlerts.alertResponse(response);
app.deliveryNoteAddId = 0;
app.init();
});
},
submitOrderAddToDocument: function() {
var app = this;
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-add-order", {
params: {
idDocument: this.getDocumentId(),
classDocument: this.getDocumentClass(),
idOrder: app.orderAddId
}
})
.then(function (response) {
appAlerts.alertResponse(response);
app.orderAddId = 0;
app.init();
});
},
submitOrderIgnoreWhenInvoicing: function() {
var app = this;
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-ignore-order-when-invoicing", {
params: {
idDocument: this.getDocumentId(),
classDocument: this.getDocumentClass(),
idOrder: app.orderAddId
}
})
.then(function (response) {
appAlerts.alertResponse(response);
app.orderAddId = 0;
app.init();
});
},
deleteOrderFromDocument: function() {
var app = this;
var idOrder = event.currentTarget.getAttribute('data-id');
axios.get(UrlManager.getBaseUrlAbsolute() + "invoice/ajax-delete-delivery-note", {
params: {
idInvoice: app.getDocumentId(),
idDeliveryNote: idDeliveryNote
}
})
.then(function (response) {
appAlerts.alertResponse(response);
app.init();
});
},
submitDeliveryNoteAddToInvoice: function () {
var app = this;
axios.get(UrlManager.getBaseUrlAbsolute() + "invoice/ajax-add-delivery-note", {
params: {
idInvoice: this.getDocumentId(),
idDeliveryNote: app.deliveryNoteAddId,
}
})
.then(function (response) {
appAlerts.alertResponse(response);
app.deliveryNoteAddId = 0;
app.init();
});
},
submitOrderAddToDocument: function () {
var app = this;
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-add-order", {
params: {
idDocument: this.getDocumentId(),
classDocument: this.getDocumentClass(),
idOrder: app.orderAddId
}
})
.then(function (response) {
appAlerts.alertResponse(response);
app.orderAddId = 0;
app.init();
});
},
submitOrderIgnoreWhenInvoicing: function () {
var app = this;
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-ignore-order-when-invoicing", {
params: {
idDocument: this.getDocumentId(),
classDocument: this.getDocumentClass(),
idOrder: app.orderAddId
}
})
.then(function (response) {
appAlerts.alertResponse(response);
app.orderAddId = 0;
app.init();
});
},
deleteOrderFromDocument: function () {
var app = this;
var idOrder = event.currentTarget.getAttribute('data-id');


axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-delete-order", {
params: {
idDocument: app.getDocumentId(),
classDocument: this.getDocumentClass(),
idOrder: idOrder
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-delete-order", {
params: {
idDocument: app.getDocumentId(),
classDocument: this.getDocumentClass(),
idOrder: idOrder
}
})
.then(function (response) {
appAlerts.alertResponse(response);
app.init();
});
},
getStepProductAdd: function () {
var step = parseInt(this.getProductById(this.productAddId).step);
if (!step) {
step = 1;
} }
})
.then(function (response) {
appAlerts.alertResponse(response);
app.init();
});
},
getStepProductAdd: function () {
var step = parseInt(this.getProductById(this.productAddId).step);
if(!step) {
step = 1;
}


return step;
},
changeProductAdd: function (event) {
var idProduct = event.currentTarget.value;
this.productAddId = idProduct;
this.productAddPrice = this.getBestProductPrice(idProduct, this.getStepProductAdd());
this.productAddQuantity = this.getStepProductAdd();
},
getBestProductPrice: function (idProduct, theQuantity) {
var product = this.getProductById(idProduct);
return step;
},
changeProductAdd: function (event) {
var idProduct = event.currentTarget.value;
this.productAddId = idProduct;
this.productAddPrice = this.getBestProductPrice(idProduct, this.getStepProductAdd());
this.productAddQuantity = this.getStepProductAdd();
},
getBestProductPrice: function (idProduct, theQuantity) {
var product = this.getProductById(idProduct);


var thePrice = 9999;
var pricesArray = product.prices;
var unitCoefficient = product.unit_coefficient;
var thePrice = 9999;
var pricesArray = product.prices;
var unitCoefficient = product.unit_coefficient;


if(pricesArray && unitCoefficient) {
if (theQuantity) {
theQuantity = theQuantity / unitCoefficient;
}
if (pricesArray && unitCoefficient) {
if (theQuantity) {
theQuantity = theQuantity / unitCoefficient;
}


for (var i = 0; i < pricesArray.length; i++) {
if(pricesArray[i]) {
var price = pricesArray[i].price;
var fromQuantity = pricesArray[i].from_quantity;
for (var i = 0; i < pricesArray.length; i++) {
if (pricesArray[i]) {
var price = pricesArray[i].price;
var fromQuantity = pricesArray[i].from_quantity;


if (price < thePrice && fromQuantity <= theQuantity) {
thePrice = price;
if (price < thePrice && fromQuantity <= theQuantity) {
thePrice = price;
}
} }
} }
} }
}


if (thePrice == 9999) {
return 0;
}
else {
return thePrice;
}
},
changeQuantityProductAdd: function (quantity) {
var step = this.getStepProductAdd();
quantity = quantity * step;
this.productAddQuantity += quantity;
if (this.productAddQuantity < 1) {
this.productAddQuantity = step;
}
this.productAddPrice = this.getBestProductPrice(app.productAddId, this.productAddQuantity);
},
submitProductAdd: function () {
var app = this;
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-add-product", {
params: {
idDocument: this.getDocumentId(),
classDocument: this.getDocumentClass(),
idProduct: app.productAddId,
quantity: app.productAddQuantity,
price: app.productAddPrice,
if (thePrice == 9999) {
return 0;
} else {
return thePrice;
} }
})
.then(function (response) {
appAlerts.alertResponse(response);
app.productAddId = 0;
app.init();
});
},
deleteProductOrder: function (idProductOrder) {
var app = this;
result = confirm("Êtes-vous sûr de vouloir supprimer ce produit ? Cela le supprimera également de la commande à laquelle il est lié.");
if(result) {
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-delete-product-order", {
},
changeQuantityProductAdd: function (quantity) {
var step = this.getStepProductAdd();
quantity = quantity * step;
this.productAddQuantity += quantity;
if (this.productAddQuantity < 1) {
this.productAddQuantity = step;
}
this.productAddPrice = this.getBestProductPrice(app.productAddId, this.productAddQuantity);
},
submitProductAdd: function () {
var app = this;
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-add-product", {
params: { params: {
idProductOrder: idProductOrder
idDocument: this.getDocumentId(),
classDocument: this.getDocumentClass(),
idProduct: app.productAddId,
quantity: app.productAddQuantity,
price: app.productAddPrice,
} }
}) })
.then(function (response) { .then(function (response) {
appAlerts.alertResponse(response); appAlerts.alertResponse(response);
app.productAddId = 0;
app.init(); app.init();
}); });
}
},
formatProductAddPrice: function () {
this.productAddPrice = Number(this.productAddPrice).toFixed(2).replace(',', '.');
if (isNaN(this.productAddPrice)) {
this.productAddPrice = 0;
}
},
formatProductAddQuantity: function () {
this.productAddQuantity = parseInt(this.productAddQuantity);
if (isNaN(this.productAddQuantity)) {
this.productAddQuantity = 1;
}
},
showProductOrderInvoicePriceButtonApply: function(event) {
if(event.key == 'Enter') {
this.updateProductOrderInvoicePrice(event);
}
else {
var idProductOrder = event.currentTarget.getAttribute('data-id-product-order');
$('#product-order-invoice-price-button-apply-'+idProductOrder).show();
}
},
updateProductOrderInvoicePrice: function (event) {
var idProductOrder = event.currentTarget.getAttribute('data-id-product-order');
var invoicePrice = $('#input-product-order-invoice-price-'+idProductOrder).val();
},
deleteProductOrder: function (idProductOrder) {
var app = this;
result = confirm("Êtes-vous sûr de vouloir supprimer ce produit ? Cela le supprimera également de la commande à laquelle il est lié.");


axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-update-product-order-invoice-price", {
params: {
idProductOrder: idProductOrder,
invoicePrice: invoicePrice
if (result) {
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-delete-product-order", {
params: {
idProductOrder: idProductOrder
}
})
.then(function (response) {
appAlerts.alertResponse(response);
app.init();
});
} }
})
.then(function (response) {
appAlerts.alertResponse(response);
$('#input-product-order-invoice-price-'+idProductOrder).val(response.data.datas.invoice_price);
$('#product-order-invoice-price-button-apply-'+idProductOrder).hide();
app.init();
});
}
}
});
},
formatProductAddPrice: function () {
this.productAddPrice = Number(this.productAddPrice).toFixed(2).replace(',', '.');
if (isNaN(this.productAddPrice)) {
this.productAddPrice = 0;
}
},
formatProductAddQuantity: function () {
this.productAddQuantity = parseInt(this.productAddQuantity);
if (isNaN(this.productAddQuantity)) {
this.productAddQuantity = 1;
}
},
showProductOrderInvoicePriceButtonApply: function (event) {
if (event.key == 'Enter') {
this.updateProductOrderInvoicePrice(event);
} else {
var idProductOrder = event.currentTarget.getAttribute('data-id-product-order');
$('#product-order-invoice-price-button-apply-' + idProductOrder).show();
}
},
updateProductOrderInvoicePrice: function (event) {
var idProductOrder = event.currentTarget.getAttribute('data-id-product-order');
var invoicePrice = $('#input-product-order-invoice-price-' + idProductOrder).val();


axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-update-product-order-invoice-price", {
params: {
idProductOrder: idProductOrder,
invoicePrice: invoicePrice
}
})
.then(function (response) {
appAlerts.alertResponse(response);
$('#input-product-order-invoice-price-' + idProductOrder).val(response.data.datas.invoice_price);
$('#product-order-invoice-price-button-apply-' + idProductOrder).hide();
app.init();
});
}
}
});
}



+ 75
- 74
backend/web/js/vuejs/producer-update.js View File

termes. termes.
*/ */


var app = new Vue({
el: '#app-producer-update',
data() {
return Object.assign({
currentSection: this.getInitialSection(),
sectionsArray: [
{
name: 'general',
nameDisplay: 'Général',
isAdminSection: 0
},
{
name: 'prise-commande',
nameDisplay: 'Commandes',
isAdminSection: 0
},
{
name: 'exports',
nameDisplay: 'Exports',
isAdminSection: 0
},
{
name: 'credit-payment',
nameDisplay: 'Crédit',
isAdminSection: 0
},
{
name: 'facturation',
nameDisplay: 'Facturation',
isAdminSection: 0
},
{
name: 'abonnements',
nameDisplay: 'Abonnements',
isAdminSection: 0
},
{
name: 'tableau-bord',
nameDisplay: 'Tableau de bord',
isAdminSection: 0
},
{
name: 'infos',
nameDisplay: 'Informations légales',
isAdminSection: 0
},
{
name: 'logiciels-caisse',
nameDisplay: 'Logiciels de caisse',
isAdminSection: 1
},
{
name: 'software',
nameDisplay: 'Opendistrib',
isAdminSection: 0
}
]
}, window.appInitValues);
},
methods: {
changeSection: function(section) {
this.currentSection = section.name ;
var selector = '#app-producer-update';
if($(selector).length) {
var app = new Vue({
el: selector,
data() {
return Object.assign({
currentSection: this.getInitialSection(),
sectionsArray: [
{
name: 'general',
nameDisplay: 'Général',
isAdminSection: 0
},
{
name: 'prise-commande',
nameDisplay: 'Commandes',
isAdminSection: 0
},
{
name: 'exports',
nameDisplay: 'Exports',
isAdminSection: 0
},
{
name: 'credit-payment',
nameDisplay: 'Crédit',
isAdminSection: 0
},
{
name: 'facturation',
nameDisplay: 'Facturation',
isAdminSection: 0
},
{
name: 'abonnements',
nameDisplay: 'Abonnements',
isAdminSection: 0
},
{
name: 'tableau-bord',
nameDisplay: 'Tableau de bord',
isAdminSection: 0
},
{
name: 'infos',
nameDisplay: 'Informations légales',
isAdminSection: 0
},
{
name: 'logiciels-caisse',
nameDisplay: 'Logiciels de caisse',
isAdminSection: 1
},
{
name: 'software',
nameDisplay: 'Opendistrib',
isAdminSection: 0
}
]
}, window.appInitValues);
}, },
getInitialSection: function() {
var hash = window.location.hash.substring(1);
if(hash && hash.length) {
return hash;
methods: {
changeSection: function (section) {
this.currentSection = section.name;
},
getInitialSection: function () {
var hash = window.location.hash.substring(1);
if (hash && hash.length) {
return hash;
}

return 'general';
} }
},
mounted: function () {


return 'general';
} }
},
mounted: function() {

}
});


});
}

+ 132
- 129
backend/web/js/vuejs/report-index.js View File



var app = new Vue({
el: '#app-report-index',
data: {
loading: true,
showLoading: true,
showReport: false,
tableReport: [],
currentSection: 'users',
sections: [
{
name: 'Utilisateurs',
id: 'users',
icon: 'fa-users',
var selector = '#app-report-index';
if($(selector).length) {
var app = new Vue({
el: selector,
data: {
loading: true,
showLoading: true,
showReport: false,
tableReport: [],
currentSection: 'users',
sections: [
{
name: 'Utilisateurs',
id: 'users',
icon: 'fa-users',
},
{
name: 'Points de vente',
id: 'points-sale',
icon: 'fa-map-marker',
},
{
name: 'Distributions',
id: 'distributions',
icon: 'fa-calendar',
}
],
termSearchUser: '',
usersArray: [],
pointsSaleArray: [],
distributionYearsArray: [],
distributionYear: null,
distributionsByMonthArray: []
},
mounted: function () {
this.init();
},
methods: {
init: function () {
var app = this;
axios.get("ajax-init", {params: {}})
.then(function (response) {
app.usersArray = response.data.usersArray;
app.pointsSaleArray = response.data.pointsSaleArray;
app.distributionYearsArray = response.data.distributionYearsArray;
app.distributionYear = app.distributionYearsArray[app.distributionYearsArray.length - 1];
app.distributionsByMonthArray = response.data.distributionsByMonthArray;

app.loading = false;
app.showLoading = false;
});
}, },
{
name: 'Points de vente',
id: 'points-sale',
icon: 'fa-map-marker',
changeSection: function (section) {
this.currentSection = section.id;
}, },
{
name: 'Distributions',
id: 'distributions',
icon: 'fa-calendar',
}
],
termSearchUser: '',
usersArray: [],
pointsSaleArray: [],
distributionYearsArray: [],
distributionYear: null,
distributionsByMonthArray: []
},
mounted: function() {
this.init() ;
},
methods: {
init: function() {
var app = this ;
axios.get("ajax-init",{params: {}})
.then(function(response) {
app.usersArray = response.data.usersArray ;
app.pointsSaleArray = response.data.pointsSaleArray ;
app.distributionYearsArray = response.data.distributionYearsArray ;
app.distributionYear = app.distributionYearsArray[app.distributionYearsArray.length - 1] ;
app.distributionsByMonthArray = response.data.distributionsByMonthArray ;
app.loading = false ;
app.showLoading = false ;
});
},
changeSection: function(section) {
this.currentSection = section.id ;
},
countUsers: function() {
var count = 0 ;
for(var i = 0; i < this.usersArray.length; i++) {
if(this.usersArray[i].checked) {
count ++ ;
countUsers: function () {
var count = 0;
for (var i = 0; i < this.usersArray.length; i++) {
if (this.usersArray[i].checked) {
count++;
}
} }
}
return count ;
},
countPointsSale: function() {
var count = 0 ;
for(var i = 0; i < this.pointsSaleArray.length; i++) {
if(this.pointsSaleArray[i].checked) {
count ++ ;
return count;
},
countPointsSale: function () {
var count = 0;
for (var i = 0; i < this.pointsSaleArray.length; i++) {
if (this.pointsSaleArray[i].checked) {
count++;
}
} }
}
return count ;
},
countDistributions: function() {
var count = 0 ;
for(var i in this.distributionsByMonthArray) {
for(var j = 0; j < this.distributionsByMonthArray[i].distributions.length; j++) {
if(this.distributionsByMonthArray[i].distributions[j].checked) {
count ++ ;
return count;
},
countDistributions: function () {
var count = 0;
for (var i in this.distributionsByMonthArray) {
for (var j = 0; j < this.distributionsByMonthArray[i].distributions.length; j++) {
if (this.distributionsByMonthArray[i].distributions[j].checked) {
count++;
}
} }
} }
}
return count ;
},
countDistributionsByMonth: function(month) {
var count = 0 ;
for(var j = 0; j < this.distributionsByMonthArray[month].distributions.length; j++) {
if(this.distributionsByMonthArray[month].distributions[j].checked) {
count ++ ;
return count;
},
countDistributionsByMonth: function (month) {
var count = 0;
for (var j = 0; j < this.distributionsByMonthArray[month].distributions.length; j++) {
if (this.distributionsByMonthArray[month].distributions[j].checked) {
count++;
}
} }
}
return count ;
},
selectDistributions: function(month) {
var countDistributions = this.countDistributionsByMonth(month) ;
for(var j = 0; j < this.distributionsByMonthArray[month].distributions.length; j++) {
Vue.set(this.distributionsByMonthArray[month].distributions[j], 'checked', countDistributions ? false : true);
}
this.reportChange();
},
generateReport: function() {
var app = this ;
app.showLoading = true ;
var data = new FormData();
var idsUsersArray = [] ;
for(var i = 0; i < app.usersArray.length; i++) {
if(app.usersArray[i].checked) {
idsUsersArray.push(app.usersArray[i].user_id) ;
return count;
},
selectDistributions: function (month) {
var countDistributions = this.countDistributionsByMonth(month);
for (var j = 0; j < this.distributionsByMonthArray[month].distributions.length; j++) {
Vue.set(this.distributionsByMonthArray[month].distributions[j], 'checked', countDistributions ? false : true);
} }
}
var idsPointsSaleArray = [] ;
for(var i = 0; i < app.pointsSaleArray.length; i++) {
if(app.pointsSaleArray[i].checked) {
idsPointsSaleArray.push(app.pointsSaleArray[i].id) ;
this.reportChange();
},
generateReport: function () {
var app = this;
app.showLoading = true;

var data = new FormData();
var idsUsersArray = [];
for (var i = 0; i < app.usersArray.length; i++) {
if (app.usersArray[i].checked) {
idsUsersArray.push(app.usersArray[i].user_id);
}
} }
}
var idsDistributionsArray = [] ;
for(var i in this.distributionsByMonthArray) {
for(var j = 0; j < this.distributionsByMonthArray[i].distributions.length; j++) {
if(this.distributionsByMonthArray[i].distributions[j].checked) {
idsDistributionsArray.push(app.distributionsByMonthArray[i].distributions[j].id) ;
var idsPointsSaleArray = [];
for (var i = 0; i < app.pointsSaleArray.length; i++) {
if (app.pointsSaleArray[i].checked) {
idsPointsSaleArray.push(app.pointsSaleArray[i].id);
} }
} }
}


data.append('users', idsUsersArray);
data.append('pointsSale', idsPointsSaleArray);
data.append('distributions', idsDistributionsArray);
axios.post("ajax-report",data)
.then(function(response) {
app.tableReport = response.data ;
app.showLoading = false ;
app.showReport = true ;
});
},
reportChange: function() {
this.showReport = false;
var idsDistributionsArray = [];
for (var i in this.distributionsByMonthArray) {
for (var j = 0; j < this.distributionsByMonthArray[i].distributions.length; j++) {
if (this.distributionsByMonthArray[i].distributions[j].checked) {
idsDistributionsArray.push(app.distributionsByMonthArray[i].distributions[j].id);
}
}
}

data.append('users', idsUsersArray);
data.append('pointsSale', idsPointsSaleArray);
data.append('distributions', idsDistributionsArray);

axios.post("ajax-report", data)
.then(function (response) {
app.tableReport = response.data;
app.showLoading = false;
app.showReport = true;
});

},
reportChange: function () {
this.showReport = false;
}
} }
}
});
});
}

+ 24
- 23
backend/web/js/vuejs/setting-form.js View File

termes. termes.
*/ */


var app = new Vue({
el: '#app-setting-admin',
data() {
return Object.assign({
currentSection: null,
sectionsArray: []
}, window.appInitValues);
},
methods: {
changeSection: function(section) {
this.currentSection = section.name ;
var selector = '#app-setting-admin';
if($(selector).length) {
var app = new Vue({
el: selector,
data() {
return Object.assign({
currentSection: null,
sectionsArray: []
}, window.appInitValues);
}, },
getInitialSection: function() {
var hash = window.location.hash.substring(1);
if(hash && hash.length) {
return hash;
methods: {
changeSection: function (section) {
this.currentSection = section.name;
},
getInitialSection: function () {
var hash = window.location.hash.substring(1);
if (hash && hash.length) {
return hash;
}
return this.sectionsArray[0].name;
} }
return this.sectionsArray[0].name;
},
mounted: function () {
this.currentSection = this.getInitialSection();
} }
},
mounted: function() {
this.currentSection = this.getInitialSection();
}
});


});
}

+ 38
- 35
backend/web/js/vuejs/subscription-form.js View File

termes. termes.
*/ */


var app = new Vue({
el: '#app-subscription-form',
data: {
showLoading: false,
loading: true,
products: []
},
mounted: function() {
this.init() ;
this.loading = false ;
},
methods: {
init: function() {
var app = this ;
this.showLoading = true ;
axios.get("ajax-infos",{params: {idSubscription: $('#subscriptionform-id').val()}})
.then(function(response) {
app.products = response.data.products ;
app.showLoading = false ;
}) ;
var selector = '#app-subscription-form';
if($(selector).length) {
var app = new Vue({
el: selector,
data: {
showLoading: false,
loading: true,
products: []
}, },
changeQuantityProductSubscription: function(increase, product) {
var step = product.step ? parseFloat(product.step) : 1 ;
if(!product.quantity) product.quantity = 0 ;
var quantity = parseFloat(product.quantity) ;
if(!increase) {
step = -step ;
}
if(quantity + step >= 0) {
product.quantity = quantity + step ;

mounted: function () {
this.init();
this.loading = false;
},

methods: {
init: function () {
var app = this;
this.showLoading = true;

axios.get("ajax-infos", {params: {idSubscription: $('#subscriptionform-id').val()}})
.then(function (response) {
app.products = response.data.products;
app.showLoading = false;
});
},
changeQuantityProductSubscription: function (increase, product) {
var step = product.step ? parseFloat(product.step) : 1;
if (!product.quantity) product.quantity = 0;
var quantity = parseFloat(product.quantity);
if (!increase) {
step = -step;
}
if (quantity + step >= 0) {
product.quantity = quantity + step;
}
if (!product.quantity) product.quantity = '';
} }
if(!product.quantity) product.quantity = '' ;
} }
}
});
});
}

+ 12
- 12
backend/web/js/vuejs/user-form.js View File

termes. termes.
*/ */


var app = new Vue({
el: '#app-user-form',
data: {
type: $('#user-type').val(),
},
mounted: function() {
},
methods: {
}
});
var selector = '#app-user-form';
if($(selector).length) {
var app = new Vue({
el: selector,
data: {
type: $('#user-type').val(),
},
mounted: function () {
},
methods: {}
});
}

+ 70
- 42
common/web/css/screen.css View File

font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
/* line 4, ../sass/_common.scss */
/* line 5, ../sass/_common.scss */
#main .btn-primary,
#main .btn-secondary {
font-family: 'worksans_semibold';
}
/* line 9, ../sass/_common.scss */
#main .btn-primary .bi,
#main .btn-secondary .bi {
margin-right: 5px;
}
/* line 14, ../sass/_common.scss */
#main .btn-primary { #main .btn-primary {
background-color: #ee6f42; background-color: #ee6f42;
border: solid 1px #ee6f42; border: solid 1px #ee6f42;
color: white; color: white;
} }
/* line 9, ../sass/_common.scss */
/* line 19, ../sass/_common.scss */
#main .btn-primary:hover, #main .btn-primary:active, #main .btn-primary:focus { #main .btn-primary:hover, #main .btn-primary:active, #main .btn-primary:focus {
background-color: #ec5d2b; background-color: #ec5d2b;
border: solid 1px #ee6f42; border: solid 1px #ee6f42;
color: white; color: white;
} }
/* line 16, ../sass/_common.scss */
/* line 26, ../sass/_common.scss */
#main .btn-secondary { #main .btn-secondary {
color: black; color: black;
background-color: #f4efe8; background-color: #f4efe8;
border: 0px none;
border: solid 1px #f4efe8;
} }
/* line 21, ../sass/_common.scss */
/* line 31, ../sass/_common.scss */
#main .btn-secondary:hover, #main .btn-secondary:focus, #main .btn-secondary.active { #main .btn-secondary:hover, #main .btn-secondary:focus, #main .btn-secondary.active {
background-color: #ece4d8; background-color: #ece4d8;
border: 0px none;
border: solid 1px #ece4d8;
color: black; color: black;
} }
/* line 28, ../sass/_common.scss */
/* line 38, ../sass/_common.scss */
#main .alert-information { #main .alert-information {
padding: 20px; padding: 20px;
margin-bottom: 20px; margin-bottom: 20px;
border-radius: 0px !important; border-radius: 0px !important;
} }


/* line 39, ../sass/_common.scss */
/* line 49, ../sass/_common.scss */
.float-left { .float-left {
float: left; float: left;
} }


/* line 43, ../sass/_common.scss */
/* line 53, ../sass/_common.scss */
.float-right { .float-right {
float: right; float: right;
} }


/* Navigation utilisateur en haut du site */ /* Navigation utilisateur en haut du site */
/* line 48, ../sass/_common.scss */
/* line 58, ../sass/_common.scss */
.container-nav-user-top { .container-nav-user-top {
position: relative; position: relative;
} }
/* line 51, ../sass/_common.scss */
/* line 61, ../sass/_common.scss */
.container-nav-user-top .nav-user-top { .container-nav-user-top .nav-user-top {
position: absolute; position: absolute;
top: 0px; top: 0px;
background-color: white; background-color: white;
z-index: 100; z-index: 100;
} }
/* line 58, ../sass/_common.scss */
/* line 68, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar { .container-nav-user-top .nav-user-top .navbar {
-moz-border-radius: 0px; -moz-border-radius: 0px;
-webkit-border-radius: 0px; -webkit-border-radius: 0px;
margin: 0px; margin: 0px;
min-height: 0px; min-height: 0px;
} }
/* line 65, ../sass/_common.scss */
/* line 75, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar ul { .container-nav-user-top .nav-user-top .navbar ul {
position: relative; position: relative;
left: -10px; left: -10px;
} }
/* line 69, ../sass/_common.scss */
/* line 79, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar ul li { .container-nav-user-top .nav-user-top .navbar ul li {
padding-left: 5px; padding-left: 5px;
} }
/* line 72, ../sass/_common.scss */
/* line 82, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar ul li a.nav-link { .container-nav-user-top .nav-user-top .navbar ul li a.nav-link {
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
color: black; color: black;
font-size: 16px; font-size: 16px;
} }
/* line 81, ../sass/_common.scss */
/* line 91, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar ul li a.nav-link:hover, .container-nav-user-top .nav-user-top .navbar ul li a.nav-link:focus, .container-nav-user-top .nav-user-top .navbar ul li a.nav-link.active { .container-nav-user-top .nav-user-top .navbar ul li a.nav-link:hover, .container-nav-user-top .nav-user-top .navbar ul li a.nav-link:focus, .container-nav-user-top .nav-user-top .navbar ul li a.nav-link.active {
background: none; background: none;
color: #ee6f42; color: #ee6f42;
} }
/* line 86, ../sass/_common.scss */
/* line 96, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar ul li a.nav-link .bi { .container-nav-user-top .nav-user-top .navbar ul li a.nav-link .bi {
color: #ee6f42; color: #ee6f42;
font-size: 16px; font-size: 16px;
position: relative; position: relative;
top: 1px; top: 1px;
} }
/* line 96, ../sass/_common.scss */
/* line 106, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar ul li .dropdown-menu a { .container-nav-user-top .nav-user-top .navbar ul li .dropdown-menu a {
padding: 2px 20px; padding: 2px 20px;
} }
/* line 99, ../sass/_common.scss */
/* line 109, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar ul li .dropdown-menu a:hover, .container-nav-user-top .nav-user-top .navbar ul li .dropdown-menu a:focus { .container-nav-user-top .nav-user-top .navbar ul li .dropdown-menu a:hover, .container-nav-user-top .nav-user-top .navbar ul li .dropdown-menu a:focus {
background-color: #ece4d8; background-color: #ece4d8;
} }
/* line 109, ../sass/_common.scss */
/* line 118, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .dropdown-menu {
z-index: 9999;
}
/* line 120, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .dropdown-menu .divider.dropdown-header { .container-nav-user-top .nav-user-top .dropdown-menu .divider.dropdown-header {
padding: 0px; padding: 0px;
} }


@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
/* line 120, ../sass/_common.scss */
.nav-user-top .navbar ul {
float: right;
/* line 130, ../sass/_common.scss */
.container-nav-user-top {
padding: 0px;
}
/* line 133, ../sass/_common.scss */
.container-nav-user-top .nav-user-top {
position: relative;
}
/* line 137, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar ul {
width: 100%;
display: block;
margin-right: 0px; margin-right: 0px;
text-align: center;
}
/* line 143, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar ul li {
display: inline-block;
} }
/* line 125, ../sass/_common.scss */
.nav-user-top .navbar .link-text {
/* line 148, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar .link-text {
display: none; display: none;
} }
/* line 129, ../sass/_common.scss */
.nav-user-top .navbar .dropdown-menu {
/* line 152, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar .dropdown-menu {
position: absolute; position: absolute;
right: 5%; right: 5%;
left: auto; left: auto;
-webkit-box-shadow: 0px 0px 4px gray; -webkit-box-shadow: 0px 0px 4px gray;
box-shadow: 0px 0px 4px gray; box-shadow: 0px 0px 4px gray;
} }
/* line 138, ../sass/_common.scss */
.nav-user-top .navbar .dropdown-menu li a {
/* line 161, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar .dropdown-menu li a {
padding-left: 15px; padding-left: 15px;
} }
} }
/* Block de date */ /* Block de date */
/* line 148, ../sass/_common.scss */
/* line 172, ../sass/_common.scss */
.block-date { .block-date {
margin: 0px auto; margin: 0px auto;
padding-top: 0px; padding-top: 0px;
text-align: center; text-align: center;
} }
/* line 153, ../sass/_common.scss */
/* line 177, ../sass/_common.scss */
.block-date .day { .block-date .day {
text-transform: capitalize; text-transform: capitalize;
line-height: 15px; line-height: 15px;
font-size: 13px; font-size: 13px;
text-transform: uppercase; text-transform: uppercase;
} }
/* line 160, ../sass/_common.scss */
/* line 184, ../sass/_common.scss */
.block-date .num { .block-date .num {
font-size: 30px; font-size: 30px;
line-height: 35px; line-height: 35px;
font-weight: bold; font-weight: bold;
} }
/* line 166, ../sass/_common.scss */
/* line 190, ../sass/_common.scss */
.block-date .month { .block-date .month {
text-transform: uppercase; text-transform: uppercase;
line-height: 15px; line-height: 15px;
} }


/* Page d'erreur */ /* Page d'erreur */
/* line 176, ../sass/_common.scss */
/* line 200, ../sass/_common.scss */
#main #content .site-error .col-lg-6 { #main #content .site-error .col-lg-6 {
margin: 0px auto; margin: 0px auto;
float: none; float: none;
} }
/* line 182, ../sass/_common.scss */
/* line 206, ../sass/_common.scss */
#main #content .site-error .panel .panel-body { #main #content .site-error .panel .panel-body {
padding-bottom: 0px; padding-bottom: 0px;
} }
/* line 186, ../sass/_common.scss */
/* line 210, ../sass/_common.scss */
#main #content .site-error .panel h2 { #main #content .site-error .panel h2 {
text-transform: none; text-transform: none;
font-size: 25px; font-size: 25px;
margin-top: 0px; margin-top: 0px;
margin-bottom: 0px; margin-bottom: 0px;
} }
/* line 194, ../sass/_common.scss */
/* line 218, ../sass/_common.scss */
#main #content .site-error .alert { #main #content .site-error .alert {
padding-bottom: 5px; padding-bottom: 5px;
} }
/* line 197, ../sass/_common.scss */
/* line 221, ../sass/_common.scss */
#main #content .site-error .alert h2 { #main #content .site-error .alert h2 {
margin-top: 5px; margin-top: 5px;
} }
/* line 201, ../sass/_common.scss */
/* line 225, ../sass/_common.scss */
#main #content .site-error .alert p { #main #content .site-error .alert p {
margin-bottom: 15px; margin-bottom: 15px;
} }
/* line 205, ../sass/_common.scss */
/* line 229, ../sass/_common.scss */
#main #content .site-error .alert .btn { #main #content .site-error .alert .btn {
text-decoration: none; text-decoration: none;
} }


/* Paiement */ /* Paiement */
/* line 216, ../sass/_common.scss */
/* line 240, ../sass/_common.scss */
.payment-detail-remaining-surplus { .payment-detail-remaining-surplus {
font-size: 13px; font-size: 13px;
color: gray; color: gray;
} }
/* line 220, ../sass/_common.scss */
/* line 244, ../sass/_common.scss */
.payment-detail-remaining-surplus strong { .payment-detail-remaining-surplus strong {
font-weight: bold; font-weight: bold;
} }

+ 8
- 3
common/web/js/common.js View File

}); });


function opendistrib_dropdown_tooltip() { function opendistrib_dropdown_tooltip() {
if($('.dropdown-toggle').length) {
if($('.dropdown-bs-toggle').length) {
//$('.dropdown-toggle').dropdown() ; //$('.dropdown-toggle').dropdown() ;
} }


if($('[data-toggle="tooltip"]').length) {
//$('[data-toggle="tooltip"]').tooltip() ;
if($('[data-bs-toggle="tooltip"]').length) {
// $('[data-bs-toggle="tooltip"]').tooltip() ;
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl);
})

} }
} }



+ 45
- 21
common/web/sass/_common.scss View File

@import "compass"; @import "compass";


#main { #main {

.btn-primary,
.btn-secondary {
font-family: 'worksans_semibold';

.bi {
margin-right: 5px;
}
}

.btn-primary { .btn-primary {
background-color: $color-primary; background-color: $color-primary;
border: solid 1px $color-primary; border: solid 1px $color-primary;
.btn-secondary { .btn-secondary {
color: black; color: black;
background-color: $color-gray-light; background-color: $color-gray-light;
border: 0px none;
border: solid 1px $color-gray-light;


&:hover, &:focus, &.active { &:hover, &:focus, &.active {
background-color: $color-gray; background-color: $color-gray;
border: 0px none;
border: solid 1px $color-gray;
color: black; color: black;
} }
} }
} }


.dropdown-menu { .dropdown-menu {
z-index: 9999;
.divider.dropdown-header { .divider.dropdown-header {
padding: 0px; padding: 0px;
} }
} }


@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
.nav-user-top {
.navbar {
ul {
float: right;
margin-right: 0px;
}


.link-text {
display: none;
}
.container-nav-user-top {
padding: 0px;


.dropdown-menu {
position: absolute;
right: 5%;
left: auto;
border: 1px solid #ddd;
background: #fff;
@include box-shadow(0px 0px 4px gray);
.nav-user-top {
position: relative;


li {
a {
padding-left: 15px;
.navbar {
ul {
width: 100%;
display: block;
margin-right: 0px;
text-align: center;

li {
display: inline-block;
}
}

.link-text {
display: none;
}

.dropdown-menu {
position: absolute;
right: 5%;
left: auto;
border: 1px solid #ddd;
background: #fff;
@include box-shadow(0px 0px 4px gray);

li {
a {
padding-left: 15px;
}
} }
} }
} }

+ 4
- 4
domain/Producer/Producer/ProducerRepository.php View File

->findOne(); ->findOne();
} }


public function queryProducersActive()
public function queryProducersActive(string $orderByField = 'producer.name', string $orderByDirection = 'ASC')
{ {
return $this->createQuery() return $this->createQuery()
->filterIsActive() ->filterIsActive()
->orderBy('producer.name ASC');
->orderBy($orderByField.' '.$orderByDirection);
} }


/** /**
$this->producerSolver->getConfig('credit_functioning'); $this->producerSolver->getConfig('credit_functioning');
} }


public function findProducersActive()
public function findProducersActive(string $orderByField = 'producer.name', string $orderByDirection = 'ASC')
{ {
return $this->queryProducersActive()->find();
return $this->queryProducersActive($orderByField, $orderByDirection)->find();
} }


public function countProducersActiveWithTurnover(): int public function countProducersActiveWithTurnover(): int

+ 2
- 2
frontend/controllers/SiteController.php View File

public function actionIndex() public function actionIndex()
{ {
$dataProviderProducers = new ActiveDataProvider([ $dataProviderProducers = new ActiveDataProvider([
'query' => $this->getProducerModule()->queryProducersActive()->query(),
'query' => $this->getProducerModule()->queryProducersActive('producer.date_creation', 'DESC')->query(),
'pagination' => [ 'pagination' => [
'pageSize' => 100, 'pageSize' => 100,
], ],


return $this->render('index', [ return $this->render('index', [
'dataProviderProducers' => $dataProviderProducers, 'dataProviderProducers' => $dataProviderProducers,
'producersArray' => $this->getProducerModule()->findProducersActive()
'producersArray' => $this->getProducerModule()->findProducersActive('producer.date_creation', 'DESC')
]); ]);
} }



+ 2
- 2
frontend/views/layouts/main.php View File

<a id="link-home" class="" href="<?= $this->getUrlManager()->createUrl('site/index'); ?>"> <a id="link-home" class="" href="<?= $this->getUrlManager()->createUrl('site/index'); ?>">
<img src="<?= $this->getUrlManager()->baseUrl ?>/img/souke.png" alt="Souke"/> <img src="<?= $this->getUrlManager()->baseUrl ?>/img/souke.png" alt="Souke"/>
</a> </a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
</div> </div>
<div id="w0-collapse" class="collapse navbar-collapse">
<div id="main-navbar" class="collapse navbar-collapse">
<?php <?php
echo Nav::widget([ echo Nav::widget([
'encodeLabels' => false, 'encodeLabels' => false,

+ 71
- 91
frontend/views/site/index.php View File

?> ?>


<div class="site-producers"> <div class="site-producers">
<div class="row">
<div class="col-md-6 col-sm-12" id="wrapper-producers-list">
<div id="producers-list">
<div id="producer-search">
<div class="form-group has-feedback">
<input type="text" class="form-control input-lg" placeholder="Recherche par nom, commune ou code postal">
<span class="glyphicon glyphicon-search form-control-feedback"></span>
</div>
</div>
<div class="alert alert-warning alert-no-results">
Aucun producteur ne correspond à votre recherche.
</div>
<?php foreach($producersArray as $producer): ?>
<div class="panel panel-default panel-producer">
<div class="panel-body">
<div class="<?= $producer->logo ? 'col-md-8 col-sm-8' : 'col-md-12'; ?>">
<h2><?= Html::encode($producer->name) ?></h2>
<p class="producer-type"><?= Html::encode($producer->type) ?></p>
<p class="producer-location">
<?php if($producer->latitude && $producer->longitude): ?>
<?= Html::a('<span class="glyphicon glyphicon-map-marker"></span> '.Html::encode($producer->postcode.' '.$producer->city),'javascript:void(0);', ['class' => 'btn btn-default view-producer', 'data-id' => $producer->id]);?>
<?php else: ?>
<span class="glyphicon glyphicon-map-marker"></span>
<span class="location"><?= Html::encode($producer->postcode.' '.$producer->city); ?></span>
<?php endif; ?>

<?php if($producer->website): ?>
<a href="<?= Html::encode($producer->website); ?>" target="_blank" class="btn btn-default">
<span class="glyphicon glyphicon-globe"></span>
Site web
</a>
<?php endif; ?>
</p>
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-6 col-sm-12" id="wrapper-producers-list">
<div id="producers-list">
<div id="producer-search">
<div class="input-group">
<span class="input-group-text" id="basic-addon1">
<i class="bi bi-search"></i>
</span>
<input type="text" class="form-control input-lg" placeholder="Recherche par nom, commune ou code postal">
</div>
</div>
<div class="alert alert-warning alert-no-results">
Aucun producteur ne correspond à votre recherche.
</div> </div>
<?php if($producer->logo): ?>
<div class="col-md-4 col-sm-4">
<div class="logo"<?php if (!is_null($producer->background_color_logo) && strlen($producer->background_color_logo)): ?> style="background-color:<?= Html::encode($producer->background_color_logo); ?>"<?php endif; ?>>
<img class="img-logo"
src="<?= Yii::$app->urlManagerProducer->getHostInfo() . '/' . Yii::$app->urlManagerProducer->baseUrl; ?>/uploads/<?= $producer->logo; ?>"
alt="Logo <?= Html::encode($producer->name) ?>">
<?php foreach($producersArray as $producer): ?>
<?php $this->getLogic()->setProducerContext($producer); ?>
<div class="panel panel-default panel-producer">
<div class="panel-body">
<div class="row">
<div class="<?= $producer->logo ? 'col-md-8 col-sm-8' : 'col-md-12'; ?>">
<h2>
<?= Html::a(Html::encode($producer->name),Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index', 'slug_producer' => $producer->slug]), ['class' => 'producer-link']) ; ?>

<?php if($userCurrent): ?>
<?php if($userProducerModule->isProducerBookmarked($userCurrent)): ?>
<?= Html::a('<i class="bi bi-heart-fill"></i>', ['bookmark/remove', 'idProducer' => $producer->id], ['class' => 'btn-bookmark', 'data-bs-toggle' => 'tooltip', 'data-bs-placement' => 'top', 'data-bs-original-title' => 'Supprimer de ma liste de producteurs']) ; ?>
<?php else: ?>
<?= Html::a('<i class="bi bi-heart"></i>', ['bookmark/add', 'idProducer' => $producer->id], ['class' => 'btn-bookmark', 'data-bs-toggle' => 'tooltip', 'data-bs-placement' => 'top', 'data-bs-original-title' => 'Ajouter à ma liste de producteurs']) ; ?>
<?php endif; ?>
<?php endif; ?>
</h2>
<p class="producer-type">
<?= Html::encode($producer->type) ?>
</p>
</div>
<?php if($producer->logo): ?>
<div class="col-md-4 col-sm-4">
<div class="logo"<?php if (!is_null($producer->background_color_logo) && strlen($producer->background_color_logo)): ?> style="background-color:<?= Html::encode($producer->background_color_logo); ?>"<?php endif; ?>>
<img class="img-logo"
src="<?= Yii::$app->urlManagerProducer->getHostInfo() . '/' . Yii::$app->urlManagerProducer->baseUrl; ?>/uploads/<?= $producer->logo; ?>"
alt="Logo <?= Html::encode($producer->name) ?>">
</div>
</div>
<?php endif; ?>
</div>
</div>
<div class="panel-footer">
<div class="row g-0">
<?php
$columnWidth = $producer->website ? 4 : 6;
?>
<div class="col-md-<?= $columnWidth ?>">
<?= Html::a('<i class="bi bi-geo-alt-fill"></i> '.Html::encode($producer->postcode.' '.$producer->city),'javascript:void(0);', ['class' => 'btn btn-secondary view-producer', 'data-id' => $producer->id, 'title' => Html::encode($producer->postcode.' '.$producer->city)]);?>
</div>
<?php if($producer->website): ?>
<div class="col-md-<?= $columnWidth ?>">
<a href="<?= (strpos($producer->website, 'http') === false ? 'https://' : '').Html::encode($producer->website); ?>" target="_blank" class="btn btn-secondary">
<i class="bi bi-box-arrow-up-right"></i> Site web
</a>
</div>
<?php endif; ?>
<div class="col-md-<?= $columnWidth ?>">
<?= Html::a('<i class="bi bi-shop"></i> Visiter',Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index', 'slug_producer' => $producer->slug]), ['class'=>'btn btn-primary float-right']) ; ?>
</div>
</div>
</div> </div>
</div> </div>
<?php endif; ?>
</div>
<div class="panel-footer">
<?= Html::a('Visiter',Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index', 'slug_producer' => $producer->slug]), ['class'=>'btn btn-primary float-right']) ; ?>

<?php if($userCurrent): ?>
<?php $this->getLogic()->setProducerContext($producer); ?>
<?php if($userProducerModule->isProducerBookmarked($userCurrent)): ?>
<?= Html::a('<span class="glyphicon glyphicon-star"></span>', ['bookmark/remove', 'idProducer' => $producer->id], ['class'=>'btn btn-default', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'data-original-title' => 'Supprimer de ma liste de producteurs']) ; ?>
<?php else: ?>
<?= Html::a('<span class="glyphicon glyphicon-star-empty"></span>', ['bookmark/add', 'idProducer' => $producer->id], ['class'=>'btn btn-default', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'data-original-title' => 'Ajouter à ma liste de producteurs']) ; ?>
<?php endif; ?>
<?php endif; ?>
<div class="clr"></div>
<?php endforeach; ?>
</div> </div>
</div> </div>
<?php endforeach; ?>
<div class="col-md-6 col-sm-12" id="wrapper-producers-map">
<div id="producers-map"></div>
</div>
</div> </div>
</div>
<div class="col-md-6 col-sm-12" id="wrapper-producers-map">
<div id="producers-map"></div>
<div class="clr"></div>
</div> </div>
</div> </div>
<div class="clr"></div>
<?php
/*
GridView::widget([
'dataProvider' => $dataProviderProducers,
'summary' => '',
'columns' => [
[
'attribute' => 'name',
],
[
'attribute' => 'type',
],
[
'label' => 'Localisation',
'value' => function($model) {
return $model->city. ' ('.$model->postcode.')' ;
}
],
[
'label' => 'Lien',
'format' => 'raw',
'value' => function($model) {
$iconLock = (strlen($model->code)) ? ' <span class="glyphicon glyphicon-lock"></span>' : '' ;
$html = Html::a('Visiter',Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index', 'slug_producer' => $model->slug]), ['class'=>'btn btn-primary']) ;
$html .= $iconLock ;
return $html ;
}
],
]
]);
*/
?>

</div> </div>

+ 55
- 55
frontend/views/site/producer.php View File

<div class="alert alert-warning"> <div class="alert alert-warning">
Veuillez vous identifier pour accéder à l'espace du producteur <strong><?= Html::encode($producer->name); ?></strong>. Veuillez vous identifier pour accéder à l'espace du producteur <strong><?= Html::encode($producer->name); ?></strong>.
</div> </div>
<div class="col-md-6">
<div class="panel panel-primary" id="login">
<div class="panel-heading">
<h2 class="panel-title">
<span class="glyphicon glyphicon-log-in"></span>
Connexion
</h2>
</div>
<div class="panel-body">
<?php if(isset($producer) && $producerModule->isDemo($producer)) : ?>
<div class="alert alert-warning">
<p>Merci d'utiliser les identifiants suivants pour vous connecter à l'espace de démonstration :</p>
Identifiant : <strong>demo@opendistrib.net</strong><br>
Mot de passe : <strong>opendistrib</strong>

<div class="row">
<div class="col-md-6">
<div class="panel panel-primary panel-padding-large" id="login">
<div class="panel-heading">
<h2 class="panel-title">Connexion</h2>
</div>
<div class="panel-body">
<?php if(isset($producer) && $producerModule->isDemo($producer)) : ?>
<div class="alert alert-warning">
<p>Merci d'utiliser les identifiants suivants pour vous connecter à l'espace de démonstration :</p>
Identifiant : <strong>demo@opendistrib.net</strong><br>
Mot de passe : <strong>opendistrib</strong>
</div>
<?php endif; ?>
<?php $form = ActiveForm::begin(['id' => 'login-form','enableClientValidation'=> false]); ?>
<?= $form->field($loginForm, 'email') ?>
<?= $form->field($loginForm, 'password')->passwordInput() ?>
<?= $form->field($loginForm, 'rememberMe')->checkbox() ?>
<p>
Si vous avez oublié votre mot de passe, vous pouvez le <?= Html::a('réinitialiser', ['site/request-password-reset']) ?>.
</p>
<div class="form-group form-buttons">
<?= Html::submitButton('<i class="bi bi-box-arrow-in-right"></i> Connexion', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
</div> </div>
<?php endif; ?>
<?php $form = ActiveForm::begin(['id' => 'login-form','enableClientValidation'=> false]); ?>
<?= $form->field($loginForm, 'email') ?>
<?= $form->field($loginForm, 'password')->passwordInput() ?>
<?= $form->field($loginForm, 'rememberMe')->checkbox() ?>
<p>
Si vous avez oublié votre mot de passe, vous pouvez le <?= Html::a('réinitialiser', ['site/request-password-reset']) ?>.
</p>
<div class="form-group">
<?= Html::submitButton('Connexion', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
<?php ActiveForm::end(); ?>
</div> </div>
<?php ActiveForm::end(); ?>
</div> </div>
</div> </div>
</div>


<div class="col-md-6">
<div class="panel panel-primary" id="signup">
<div class="panel-heading">
<h2 class="panel-title">
<span class="glyphicon glyphicon-user"></span>
Inscription
</h2>
</div>
<div class="panel-body">
<?php $form = ActiveForm::begin(['id' => 'form-signup','enableClientValidation'=> false]); ?>
<?= $form->field($signupForm, 'email') ?>
<?= $form->field($signupForm, 'password')->passwordInput() ?>
<?= $form->field($signupForm, 'lastname') ?>
<?= $form->field($signupForm, 'name') ?>
<?= $form->field($signupForm, 'phone') ?>
<?= $form->field($signupForm, 'newsletter')->checkbox() ?>
<?php if(strlen($producer->code)): ?>
<?= $form->field($signupForm, 'code',[
'inputTemplate' => '<div class="input-group"><span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>{input}</div>',
])
->label('Code du producteur')
->hint('Renseignez-vous auprès de votre producteur pour qu\'il vous fournisse le code d\'accès') ; ?>
<?php endif; ?>
<?= $form->field($signupForm, 'verifyCode')->widget(\yii\captcha\Captcha::className(), [
'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
]) ?>
<div class="form-group" id="boutons-inscrire">
<?= Html::submitButton("S'inscrire", ['class' => 'btn btn-primary', 'name' => 'signup-button']) ?>
<div class="col-md-6">
<div class="panel panel-primary panel-padding-large" id="signup">
<div class="panel-heading">
<h2 class="panel-title">
<span class="glyphicon glyphicon-user"></span>
Inscription
</h2>
</div>
<div class="panel-body">
<?php $form = ActiveForm::begin(['id' => 'form-signup','enableClientValidation'=> false]); ?>
<?= $form->field($signupForm, 'email') ?>
<?= $form->field($signupForm, 'password')->passwordInput() ?>
<?= $form->field($signupForm, 'lastname') ?>
<?= $form->field($signupForm, 'name') ?>
<?= $form->field($signupForm, 'phone') ?>
<?= $form->field($signupForm, 'newsletter')->checkbox() ?>
<?php if(strlen($producer->code)): ?>
<?= $form->field($signupForm, 'code',[
'inputTemplate' => '<div class="input-group"><span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>{input}</div>',
])
->label('Code du producteur')
->hint('Renseignez-vous auprès de votre producteur pour qu\'il vous fournisse le code d\'accès') ; ?>
<?php endif; ?>
<?= $form->field($signupForm, 'verifyCode')->widget(\yii\captcha\Captcha::className(), [
'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
]) ?>
<div class="form-group form-buttons" id="boutons-inscrire">
<?= Html::submitButton("<i class=\"bi bi-person-plus\"></i> S'inscrire", ['class' => 'btn btn-primary', 'name' => 'signup-button']) ?>
</div>
<?php ActiveForm::end(); ?>
</div> </div>
<?php ActiveForm::end(); ?>
</div> </div>
</div> </div>
</div> </div>

+ 291
- 215
frontend/web/css/screen.css
File diff suppressed because it is too large
View File


+ 8
- 2
frontend/web/js/frontend.js View File

var app = this; var app = this;
if($('#producers-map').length > 0) { if($('#producers-map').length > 0) {
app.map = L.map('producers-map').setView([46.5471789, 2.534168], 6); app.map = L.map('producers-map').setView([46.5471789, 2.534168], 6);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {

/* Tiles :
- Classique : https://tile.openstreetmap.org/{z}/{x}/{y}.png
- Humanitarian : https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png
*/

L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
maxZoom: 19, maxZoom: 19,
attribution: '© OpenStreetMap' attribution: '© OpenStreetMap'
}).addTo(app.map); }).addTo(app.map);
for(var i = 0; i < producers.length ; i++) { for(var i = 0; i < producers.length ; i++) {
if(producers[i].latitude && producers[i].longitude) { if(producers[i].latitude && producers[i].longitude) {
app.mapMarkers[producers[i].id] = L.marker([producers[i].latitude, producers[i].longitude]) app.mapMarkers[producers[i].id] = L.marker([producers[i].latitude, producers[i].longitude])
.bindPopup('<div class="popup-producer"><div class="name">'+producers[i].name+'</div><div class="type">'+producers[i].type+'</div><div class="address"><span class="glyphicon glyphicon-map-marker"></span>'+producers[i].address+'</div><div class="link"><a href="'+producers[i].link+'" class="btn btn-primary btn-sm">Visiter</a></div></div>')
.bindPopup('<div class="popup-producer"><div class="name">'+producers[i].name+'</div><div class="type">'+producers[i].type+'</div><div class="address"><span class="glyphicon glyphicon-map-marker"></span>'+producers[i].address+'</div><div class="link"><a href="'+producers[i].link+'" class="btn btn-primary btn-sm"><i class="bi bi-shop"></i> Visiter</a></div></div>')
.addTo(app.map); .addTo(app.map);
} }
} }

BIN
frontend/web/js/leaflet/images/marker-icon-souke.png View File

Before After
Width: 50  |  Height: 67  |  Size: 2.5KB

BIN
frontend/web/js/leaflet/images/marker-icon.back.png View File

Before After
Width: 25  |  Height: 41  |  Size: 1.4KB

BIN
frontend/web/js/leaflet/images/marker-icon.png View File

Before After
Width: 25  |  Height: 41  |  Size: 1.4KB Width: 25  |  Height: 41  |  Size: 9.5KB

+ 30
- 9
frontend/web/sass/_responsive.scss View File



#header { #header {
position: relative; position: relative;
text-align: center;

#the-header {
width: 100%;
}


#link-home { #link-home {
padding-left: 15px; padding-left: 15px;
position: relative;
top: 0px;
display: inline-block;
}

.navbar-toggler {
position: absolute;
top: 0px;
right: 0px;
} }


.navbar-collapse { .navbar-collapse {


nav { nav {
width: 100%; width: 100%;
height: auto;


ul {
.collapse {
position: relative; position: relative;
display: block;
float: none;
margin-top: 0px;
border: 0px none;
padding-bottom: 20px;
top: 0px;
left: 0px;


li {
ul {
position: relative;
display: block; display: block;
float: none; float: none;
margin-top: 0px;
border: 0px none;
padding-bottom: 20px;


a {
li {
display: block; display: block;
padding: 10px;
float: none;

a {
display: block;
padding: 10px;
}
} }
} }
} }

+ 113
- 54
frontend/web/sass/screen.scss View File



.panel { .panel {
background-color: white; background-color: white;
@include box-shadow(0px 0px 15px $color-gray);
@include box-shadow(0px 0px 15px #d5d5d5);


&.panel-padding-large { &.panel-padding-large {
.panel-heading { .panel-heading {
padding: 50px 50px 20px 50px;
padding: 50px 50px 0px 50px;
} }
.panel-body { .panel-body {
padding: 50px; padding: 50px;


.panel-body { .panel-body {
background-color: white; background-color: white;
padding: 20px;
padding: 30px 20px;


p { p {
padding-bottom: 10px; padding-bottom: 10px;
} }


&.panel-default { &.panel-default {
border: solid 1px #e0e0e0;


.panel-heading { .panel-heading {
border-bottom: 0px none; border-bottom: 0px none;
.site-producers { .site-producers {


#producers-list { #producers-list {

#producer-search { #producer-search {
padding-bottom: 15px;
margin-bottom: 30px;
@include box-shadow(0px 0px 15px #d5d5d5);

.input-group-text {
padding: 20px;
background-color: $color-gray-light;
color: $color-primary;
font-size: 25px;
border: 0px none;
@include border-radius(0px);
@include box-shadow(-30px 0px 15px -15px $color-gray inset);
}

.form-control {
border: 0px none;
@include border-radius(0px);

&:focus {
@include box-shadow(none !important);
}
}
} }


.alert-no-results { .alert-no-results {
} }


.panel { .panel {
border: solid 1px #e0e0e0;
@include border-radius(8px);
margin-bottom: 30px;


.panel-body { .panel-body {
border: 0px none; border: 0px none;
@include border-radius(8px);


h2 { h2 {
font-family: 'capsuularegular';
font-weight: bold;
font-size: 27px;
text-transform: none;
margin-top: 0px; margin-top: 0px;
margin-bottom: 5px;
margin-bottom: 10px;
padding-bottom: 0px; padding-bottom: 0px;

a.producer-link {
color: $color-secondary;
text-decoration: none;
}

.btn-bookmark {
position: relative;
top: -4px;
font-size: 1rem;
color: gray;
}
} }


p { p {
} }


.producer-type { .producer-type {
font-family: 'worksans_regular';
font-size: 1.05rem;
text-transform: uppercase; text-transform: uppercase;
margin-bottom: 10px; margin-bottom: 10px;
font-size: 14px;
}

.producer-location {

} }
} }


.panel-footer { .panel-footer {
@include border-radius(0px 0px 8px 8px);
border: 0px none; border: 0px none;
padding: 10px 30px;
padding: 0px;

a {
display: block;
width: 100%;
height: 50px;
line-height: 50px;
overflow: hidden;
padding-top: 0px;
padding-bottom: 0px;
margin: 0px;

/*&.btn-secondary {
color: $color-secondary;
background-color: white;
border: solid 1px white;
@include box-shadow(-30px 0px 15px -15px $color-gray inset);

&:hover {
color: white;
background-color: $color-secondary;
border: solid 1px $color-secondary;
@include box-shadow(none);
}
}*/

&.btn-primary {

}
}
} }


.logo { .logo {
width: 110px; width: 110px;
height: 110px; height: 110px;
@include border-radius(110px); @include border-radius(110px);
border: solid 1px #e0e0e0;
border: solid 2px $color-gray;
text-align: right; text-align: right;
overflow: hidden; overflow: hidden;


} }
} }


#producers-map {
height: 750px;
border: solid 1px #e0e0e0;
@include border-radius(8px);
#wrapper-producers-map {
z-index: 10;


&.fixed {
position: fixed !important;
top: 20px;
width: 300px;
//height: 80%;
#producers-map {
height: 750px; height: 750px;
}

a {
text-decoration: none;
}

.popup-producer {
font-size: 14px;
color: #505050;
border: solid 1px #e0e0e0;


.name {
font-family: 'capsuularegular';
font-weight: bold;
font-size: 23px;
color: #323232;
}
.type {
text-transform: uppercase;
font-size: 13px;
margin-bottom: 12px;
&.fixed {
position: fixed !important;
top: 20px;
width: 300px;
//height: 80%;
height: 750px;
} }
.address {
margin-bottom: 12px;

a {
text-decoration: none;
} }
.link {
color: white;

.popup-producer {
font-size: 14px;
color: #505050;

.name {
font-family: 'worksans_bold';
color: $color-secondary;
font-size: 23px;
margin-bottom: 2px;
}

.type {
font-family: 'worksans_regular';
text-transform: uppercase;
font-size: 16px;
margin-bottom: 5px;
}

.address {
font-family: 'worksans_regular';
margin-bottom: 14px;
color: gray;
}

.link {
color: white;
text-align: right;
}
} }
} }
} }

Loading…
Cancel
Save