Переглянути джерело

Intégration Souke

feature/souke
Guillaume Bourgeois 8 місяці тому
джерело
коміт
c3cf69c195
23 змінених файлів з 2331 додано та 2127 видалено
  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 Переглянути файл

@@ -174,7 +174,7 @@ function opendistrib_gridview_pagesize() {
function opendistrib_dropdown_producers() {

$('.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 () {

+ 1063
- 1065
backend/web/js/vuejs/distribution-index.js
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 287
- 288
backend/web/js/vuejs/document-form.js Переглянути файл

@@ -34,327 +34,326 @@
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;
}
} 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: {
idProductOrder: idProductOrder
idDocument: this.getDocumentId(),
classDocument: this.getDocumentClass(),
idProduct: app.productAddId,
quantity: app.productAddQuantity,
price: app.productAddPrice,
}
})
.then(function (response) {
appAlerts.alertResponse(response);
app.productAddId = 0;
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 Переглянути файл

@@ -35,81 +35,82 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
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 Переглянути файл

@@ -1,143 +1,146 @@

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 Переглянути файл

@@ -35,29 +35,30 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
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 Переглянути файл

@@ -35,41 +35,44 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
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 Переглянути файл

@@ -35,15 +35,15 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
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 Переглянути файл

@@ -139,31 +139,41 @@ termes.
font-weight: 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 {
background-color: #ee6f42;
border: solid 1px #ee6f42;
color: white;
}
/* line 9, ../sass/_common.scss */
/* line 19, ../sass/_common.scss */
#main .btn-primary:hover, #main .btn-primary:active, #main .btn-primary:focus {
background-color: #ec5d2b;
border: solid 1px #ee6f42;
color: white;
}
/* line 16, ../sass/_common.scss */
/* line 26, ../sass/_common.scss */
#main .btn-secondary {
color: black;
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 {
background-color: #ece4d8;
border: 0px none;
border: solid 1px #ece4d8;
color: black;
}
/* line 28, ../sass/_common.scss */
/* line 38, ../sass/_common.scss */
#main .alert-information {
padding: 20px;
margin-bottom: 20px;
@@ -175,22 +185,22 @@ termes.
border-radius: 0px !important;
}

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

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

/* Navigation utilisateur en haut du site */
/* line 48, ../sass/_common.scss */
/* line 58, ../sass/_common.scss */
.container-nav-user-top {
position: relative;
}
/* line 51, ../sass/_common.scss */
/* line 61, ../sass/_common.scss */
.container-nav-user-top .nav-user-top {
position: absolute;
top: 0px;
@@ -198,7 +208,7 @@ termes.
background-color: white;
z-index: 100;
}
/* line 58, ../sass/_common.scss */
/* line 68, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar {
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
@@ -208,16 +218,16 @@ termes.
margin: 0px;
min-height: 0px;
}
/* line 65, ../sass/_common.scss */
/* line 75, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar ul {
position: relative;
left: -10px;
}
/* line 69, ../sass/_common.scss */
/* line 79, ../sass/_common.scss */
.container-nav-user-top .nav-user-top .navbar ul li {
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 {
padding-left: 10px;
padding-right: 10px;
@@ -227,12 +237,12 @@ termes.
color: black;
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 {
background: none;
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 {
color: #ee6f42;
font-size: 16px;
@@ -240,31 +250,49 @@ termes.
position: relative;
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 {
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 {
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 {
padding: 0px;
}

@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;
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;
}
/* 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;
right: 5%;
left: auto;
@@ -274,32 +302,32 @@ termes.
-webkit-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;
}
}
/* Block de date */
/* line 148, ../sass/_common.scss */
/* line 172, ../sass/_common.scss */
.block-date {
margin: 0px auto;
padding-top: 0px;
text-align: center;
}
/* line 153, ../sass/_common.scss */
/* line 177, ../sass/_common.scss */
.block-date .day {
text-transform: capitalize;
line-height: 15px;
font-size: 13px;
text-transform: uppercase;
}
/* line 160, ../sass/_common.scss */
/* line 184, ../sass/_common.scss */
.block-date .num {
font-size: 30px;
line-height: 35px;
font-weight: bold;
}
/* line 166, ../sass/_common.scss */
/* line 190, ../sass/_common.scss */
.block-date .month {
text-transform: uppercase;
line-height: 15px;
@@ -308,46 +336,46 @@ termes.
}

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

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

+ 8
- 3
common/web/js/common.js Переглянути файл

@@ -4,12 +4,17 @@ $(document).ready(function() {
});

function opendistrib_dropdown_tooltip() {
if($('.dropdown-toggle').length) {
if($('.dropdown-bs-toggle').length) {
//$('.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 Переглянути файл

@@ -1,6 +1,16 @@
@import "compass";

#main {

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

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

.btn-primary {
background-color: $color-primary;
border: solid 1px $color-primary;
@@ -16,11 +26,11 @@
.btn-secondary {
color: black;
background-color: $color-gray-light;
border: 0px none;
border: solid 1px $color-gray-light;

&:hover, &:focus, &.active {
background-color: $color-gray;
border: 0px none;
border: solid 1px $color-gray;
color: black;
}
}
@@ -106,6 +116,7 @@
}

.dropdown-menu {
z-index: 9999;
.divider.dropdown-header {
padding: 0px;
}
@@ -115,28 +126,41 @@
}

@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 Переглянути файл

@@ -55,11 +55,11 @@ class ProducerRepository extends AbstractRepository
->findOne();
}

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

/**
@@ -374,9 +374,9 @@ class ProducerRepository extends AbstractRepository
$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

+ 2
- 2
frontend/controllers/SiteController.php Переглянути файл

@@ -136,7 +136,7 @@ class SiteController extends FrontendController
public function actionIndex()
{
$dataProviderProducers = new ActiveDataProvider([
'query' => $this->getProducerModule()->queryProducersActive()->query(),
'query' => $this->getProducerModule()->queryProducersActive('producer.date_creation', 'DESC')->query(),
'pagination' => [
'pageSize' => 100,
],
@@ -144,7 +144,7 @@ class SiteController extends FrontendController

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


+ 2
- 2
frontend/views/layouts/main.php Переглянути файл

@@ -90,11 +90,11 @@ $adminSettingBag = $settingModule->getAdminSettingBag();
<a id="link-home" class="" href="<?= $this->getUrlManager()->createUrl('site/index'); ?>">
<img src="<?= $this->getUrlManager()->baseUrl ?>/img/souke.png" alt="Souke"/>
</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>
</button>
</div>
<div id="w0-collapse" class="collapse navbar-collapse">
<div id="main-navbar" class="collapse navbar-collapse">
<?php
echo Nav::widget([
'encodeLabels' => false,

+ 71
- 91
frontend/views/site/index.php Переглянути файл

@@ -49,103 +49,83 @@ $this->setMeta('description', 'Passez commande auprès de producteurs locaux') ;
?>

<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>
<?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>
<?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>
<?php endforeach; ?>
<div class="col-md-6 col-sm-12" id="wrapper-producers-map">
<div id="producers-map"></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 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>

+ 55
- 55
frontend/views/site/producer.php Переглянути файл

@@ -65,67 +65,67 @@ $this->setMeta('description', 'Veuillez vous connecter pour réserver les produi
<div class="alert alert-warning">
Veuillez vous identifier pour accéder à l'espace du producteur <strong><?= Html::encode($producer->name); ?></strong>.
</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>
<?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>
<?php ActiveForm::end(); ?>
</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>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>

+ 291
- 215
frontend/web/css/screen.css
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 8
- 2
frontend/web/js/frontend.js Переглянути файл

@@ -136,7 +136,13 @@ var producersModule = {
var app = this;
if($('#producers-map').length > 0) {
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,
attribution: '© OpenStreetMap'
}).addTo(app.map);
@@ -145,7 +151,7 @@ var producersModule = {
for(var i = 0; i < producers.length ; i++) {
if(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);
}
}

BIN
frontend/web/js/leaflet/images/marker-icon-souke.png Переглянути файл

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

BIN
frontend/web/js/leaflet/images/marker-icon.back.png Переглянути файл

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

BIN
frontend/web/js/leaflet/images/marker-icon.png Переглянути файл

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

+ 30
- 9
frontend/web/sass/_responsive.scss Переглянути файл

@@ -88,9 +88,23 @@ termes.

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

#the-header {
width: 100%;
}

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

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

.navbar-collapse {
@@ -99,22 +113,29 @@ termes.

nav {
width: 100%;
height: auto;

ul {
.collapse {
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;
float: none;
margin-top: 0px;
border: 0px none;
padding-bottom: 20px;

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

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

+ 113
- 54
frontend/web/sass/screen.scss Переглянути файл

@@ -440,11 +440,11 @@ section#header-title {

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

&.panel-padding-large {
.panel-heading {
padding: 50px 50px 20px 50px;
padding: 50px 50px 0px 50px;
}
.panel-body {
padding: 50px;
@@ -481,7 +481,7 @@ section#header-title {

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

p {
padding-bottom: 10px;
@@ -493,7 +493,6 @@ section#header-title {
}

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

.panel-heading {
border-bottom: 0px none;
@@ -742,9 +741,28 @@ section#header-title {
.site-producers {

#producers-list {

#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 {
@@ -752,21 +770,27 @@ section#header-title {
}

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

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

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

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

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

p {
@@ -774,20 +798,45 @@ section#header-title {
}

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

.producer-location {

}
}

.panel-footer {
@include border-radius(0px 0px 8px 8px);
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 {
@@ -797,7 +846,7 @@ section#header-title {
width: 110px;
height: 110px;
@include border-radius(110px);
border: solid 1px #e0e0e0;
border: solid 2px $color-gray;
text-align: right;
overflow: hidden;

@@ -813,43 +862,53 @@ section#header-title {
}
}

#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;
}

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;
}
}
}
}

Завантаження…
Відмінити
Зберегти