up styles, handle owner of products on controllers
This commit is contained in:
parent
457cafdaef
commit
e973573fd7
|
@ -15,486 +15,487 @@ var stuff = ['initialstuff'];
|
||||||
|
|
||||||
// TODO split controllers in other files
|
// TODO split controllers in other files
|
||||||
angular
|
angular
|
||||||
.module('caisse', [])
|
.module('caisse', [])
|
||||||
.controller('CaisseCtrl', ['$scope', '$http', '$timeout', '$rootScope', function ($scope, $http, $timeout,$rootScope) {
|
.controller('CaisseCtrl', ['$scope', '$http', '$timeout', '$rootScope', function ($scope, $http, $timeout, $rootScope) {
|
||||||
$scope.productsFromDB = []; // loaded products
|
$scope.productsFromDB = []; // loaded products
|
||||||
$scope.categories = []; // product categories
|
$scope.categories = []; // product categories
|
||||||
$scope.sellingComment = ""; // comment about the client or the current selling
|
$scope.sellingComment = ""; // comment about the client or the current selling
|
||||||
$scope.initLoadDone = false; // becames true after first init of product loading
|
$scope.initLoadDone = false; // becames true after first init of product loading
|
||||||
$scope.recentSellings = [];
|
$scope.recentSellings = [];
|
||||||
$scope.lesParams = {};
|
$scope.lesParams = {};
|
||||||
$scope.countProductsSoldForActiveFestival = {};
|
$scope.countProductsSoldForActiveFestival = {};
|
||||||
$scope.simpleDisplay = false;
|
$scope.simpleDisplay = false;
|
||||||
$scope.paidAmount = 0;
|
$scope.paidAmount = 0;
|
||||||
$scope.pausedSelling = [];
|
$scope.pausedSelling = [];
|
||||||
$scope.show_config = {
|
$scope.show_config = {
|
||||||
expressSelling: true,
|
expressSelling: true,
|
||||||
stock_count: false,
|
stock_count: false,
|
||||||
sold : false,
|
sold: false,
|
||||||
};
|
};
|
||||||
$scope.activeItemsSold = []; // list of products ID to sell
|
$scope.activeItemsSold = []; // list of products ID to sell
|
||||||
$scope.activeSelling = []; // list of products to sell
|
$scope.activeSelling = []; // list of products to sell
|
||||||
$scope.activeSellingFiltered = []; // list of products to sell
|
$scope.activeSellingFiltered = []; // list of products to sell
|
||||||
$scope.activeFestival = { // an event where selling take place
|
$scope.activeFestival = { // an event where selling take place
|
||||||
id : null,
|
id: null,
|
||||||
name : "le festival",
|
name: "le festival",
|
||||||
productComment : "",
|
productComment: "",
|
||||||
dateCreation : new Date(),
|
dateCreation: new Date(),
|
||||||
chiffreAffaire: 0,
|
chiffreAffaire: 0,
|
||||||
clientsCount : 0,
|
clientsCount: 0,
|
||||||
commentaire : ""
|
commentaire: ""
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* change to simple display
|
* change to simple display
|
||||||
*/
|
*/
|
||||||
$scope.toggleSimpleDisplay = function () {
|
$scope.toggleSimpleDisplay = function () {
|
||||||
// debugger;
|
// debugger;
|
||||||
$scope.simpleDisplay = !$scope.simpleDisplay;
|
$scope.simpleDisplay = !$scope.simpleDisplay;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* set the right paid amount
|
* set the right paid amount
|
||||||
*/
|
*/
|
||||||
$scope.setRightAmountPaid = function () {
|
$scope.setRightAmountPaid = function () {
|
||||||
// debugger;
|
// debugger;
|
||||||
$scope.paidAmount += $scope.sumOfList($scope.activeSelling);
|
$scope.paidAmount += $scope.sumOfList($scope.activeSelling);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* deduplicate the active selling items in the view,
|
* deduplicate the active selling items in the view,
|
||||||
* show a count for each of them when there are more than one
|
* show a count for each of them when there are more than one
|
||||||
*/
|
*/
|
||||||
$scope.refreshDeduplicateSellings = () => {
|
$scope.refreshDeduplicateSellings = () => {
|
||||||
let soldObjectsIdsCount = {}
|
let soldObjectsIdsCount = {}
|
||||||
$scope.activeSellingFiltered = {};
|
$scope.activeSellingFiltered = {};
|
||||||
|
|
||||||
$scope.activeSelling.forEach(elem => {
|
$scope.activeSelling.forEach(elem => {
|
||||||
let groupId = elem.id;
|
let groupId = elem.id;
|
||||||
let group = soldObjectsIdsCount[groupId];
|
let group = soldObjectsIdsCount[groupId];
|
||||||
if (group) { // sort elements by the product id corresponding
|
if (group) { // sort elements by the product id corresponding
|
||||||
group.count++;
|
group.count++;
|
||||||
group.totalPrice += (elem.price * 1);
|
group.totalPrice += (elem.price * 1);
|
||||||
group.sellings.push(elem);
|
group.sellings.push(elem);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
soldObjectsIdsCount[groupId] = {
|
soldObjectsIdsCount[groupId] = {
|
||||||
groupId : groupId,
|
groupId: groupId,
|
||||||
count : 1,
|
count: 1,
|
||||||
name : elem.name,
|
name: elem.name,
|
||||||
unitPrice : elem.price * 1,
|
unitPrice: elem.price * 1,
|
||||||
totalPrice: elem.price * 1,
|
totalPrice: elem.price * 1,
|
||||||
sellings : [elem],
|
sellings: [elem],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$scope.activeSellingFiltered = soldObjectsIdsCount;
|
$scope.activeSellingFiltered = soldObjectsIdsCount;
|
||||||
$scope.setRightAmountPaid();
|
$scope.setRightAmountPaid();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the sum of products prices
|
* get the sum of products prices
|
||||||
* @param list
|
* @param list
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
$scope.sumOfList = function (list) {
|
$scope.sumOfList = function (list) {
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
counter += list[i].price * 1;
|
counter += list[i].price * 1;
|
||||||
}
|
}
|
||||||
return counter;
|
return counter;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* sum of current selling list prices
|
* sum of current selling list prices
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
$scope.CurrentSellingTotal = function () {
|
$scope.CurrentSellingTotal = function () {
|
||||||
return $scope.sumOfList($scope.activeSelling);
|
return $scope.sumOfList($scope.activeSelling);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.categoriesVisibleCount = function () {
|
$scope.categoriesVisibleCount = function () {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
$scope.categories.forEach(function (elem) {
|
$scope.categories.forEach(function (elem) {
|
||||||
elem.hidden ? count++ : "";
|
elem.hidden ? count++ : "";
|
||||||
});
|
});
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.regenActiveSellingIds = function () {
|
$scope.regenActiveSellingIds = function () {
|
||||||
$scope.activeItemsSold = [];
|
$scope.activeItemsSold = [];
|
||||||
$scope.paidAmount = 0;
|
$scope.paidAmount = 0;
|
||||||
for (let obj in $scope.activeSelling) {
|
for (let obj in $scope.activeSelling) {
|
||||||
$scope.activeItemsSold.push(obj.id);
|
$scope.activeItemsSold.push(obj.id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$scope.stuff = stuff;
|
$scope.stuff = stuff;
|
||||||
$scope.setActiveSelling = function (selling) {
|
$scope.setActiveSelling = function (selling) {
|
||||||
$scope.activeSelling = selling;
|
$scope.activeSelling = selling;
|
||||||
};
|
};
|
||||||
$scope.pauseSelling = function (selling) {
|
$scope.pauseSelling = function (selling) {
|
||||||
$scope.pausedSelling.push(selling);
|
$scope.pausedSelling.push(selling);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* add to current sell list
|
* add to current sell list
|
||||||
* @param product
|
* @param product
|
||||||
*/
|
*/
|
||||||
$scope.addProduct = function (product) {
|
$scope.addProduct = function (product) {
|
||||||
product.stockCount--;
|
product.stockCount--;
|
||||||
product.enabled = true;
|
product.enabled = true;
|
||||||
$scope.activeSelling.push(product);
|
$scope.activeSelling.push(product);
|
||||||
$scope.activeItemsSold.push(product.id);
|
$scope.activeItemsSold.push(product.id);
|
||||||
$scope.regenActiveSellingIds();
|
$scope.regenActiveSellingIds();
|
||||||
$scope.refreshDeduplicateSellings();
|
$scope.refreshDeduplicateSellings();
|
||||||
$scope.setRightAmountPaid();
|
$scope.setRightAmountPaid();
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* remove from current sell list
|
* remove from current sell list
|
||||||
* @param product
|
* @param product
|
||||||
*/
|
*/
|
||||||
$scope.removeProduct = function (product, index) {
|
$scope.removeProduct = function (product, index) {
|
||||||
product.stockCount++;
|
product.stockCount++;
|
||||||
$scope.activeSelling.splice($index, 1);
|
$scope.activeSelling.splice($index, 1);
|
||||||
$scope.regenActiveSellingIds();
|
$scope.regenActiveSellingIds();
|
||||||
$scope.refreshDeduplicateSellings();
|
$scope.refreshDeduplicateSellings();
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* remove all products of a certain group id in the active Selling
|
* remove all products of a certain group id in the active Selling
|
||||||
* @param productId
|
* @param productId
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
$scope.removeGroupeProducts = function (productId) {
|
$scope.removeGroupeProducts = function (productId) {
|
||||||
console.log("##### removeGroupeProducts", productId);
|
console.log("##### removeGroupeProducts", productId);
|
||||||
console.log("$scope.activeSelling", $scope.activeSelling);
|
console.log("$scope.activeSelling", $scope.activeSelling);
|
||||||
$scope.activeSelling = $scope.activeSelling.filter(elem => elem.id != productId)
|
$scope.activeSelling = $scope.activeSelling.filter(elem => elem.id != productId)
|
||||||
console.log("$scope.activeSelling", $scope.activeSelling);
|
console.log("$scope.activeSelling", $scope.activeSelling);
|
||||||
$scope.regenActiveSellingIds();
|
$scope.regenActiveSellingIds();
|
||||||
$scope.refreshDeduplicateSellings();
|
$scope.refreshDeduplicateSellings();
|
||||||
}
|
}
|
||||||
$scope.removeAll = function () {
|
$scope.removeAll = function () {
|
||||||
console.log('$scope.categories', $scope.categories)
|
console.log('$scope.categories', $scope.categories)
|
||||||
$scope.categories.forEach(category => {
|
$scope.categories.forEach(category => {
|
||||||
if (category.products && category.products.length) {
|
if (category.products && category.products.length) {
|
||||||
|
|
||||||
category.products.forEach(product => {
|
category.products.forEach(product => {
|
||||||
product.enabled = false
|
product.enabled = false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
$scope.activeSelling = [];
|
$scope.activeSelling = [];
|
||||||
$scope.regenActiveSellingIds();
|
$scope.regenActiveSellingIds();
|
||||||
$scope.refreshDeduplicateSellings();
|
$scope.refreshDeduplicateSellings();
|
||||||
};
|
};
|
||||||
$scope.pauseSelling = function () {
|
$scope.pauseSelling = function () {
|
||||||
$scope.pausedSelling.push(angular.copy($scope.activeSelling));
|
$scope.pausedSelling.push(angular.copy($scope.activeSelling));
|
||||||
$scope.activeSelling = [];
|
$scope.activeSelling = [];
|
||||||
};
|
};
|
||||||
$scope.setBackPausedSelling = function (sellingList, index) {
|
$scope.setBackPausedSelling = function (sellingList, index) {
|
||||||
$scope.activeSelling = angular.copy(sellingList);
|
$scope.activeSelling = angular.copy(sellingList);
|
||||||
$scope.pausedSelling.splice(index, 1);
|
$scope.pausedSelling.splice(index, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.clearSellingComment = function () {
|
$scope.clearSellingComment = function () {
|
||||||
console.log(' $scope.sellingComment', $scope.sellingComment);
|
console.log(' $scope.sellingComment', $scope.sellingComment);
|
||||||
$scope.sellingComment = '';
|
$scope.sellingComment = '';
|
||||||
document.querySelector('.client-now input').focus();
|
document.querySelector('.client-now input').focus();
|
||||||
document.querySelector('.client-now input').select();
|
document.querySelector('.client-now input').select();
|
||||||
};
|
};
|
||||||
$scope.clearCurrentSelling = function () {
|
$scope.clearCurrentSelling = function () {
|
||||||
$scope.paidAmount = 0;
|
$scope.paidAmount = 0;
|
||||||
$scope.clearSellingComment();
|
$scope.clearSellingComment();
|
||||||
$scope.activeSelling = [];
|
$scope.activeSelling = [];
|
||||||
$scope.removeAll();
|
$scope.removeAll();
|
||||||
};
|
};
|
||||||
|
|
||||||
// http related calls
|
// http related calls
|
||||||
$scope.fetchProductsFromDB = function () {
|
$scope.fetchProductsFromDB = function () {
|
||||||
console.log('fetch products...');
|
console.log('fetch products...');
|
||||||
$http.get('logged/get-my-products').then((rep) => {
|
$http.get('logged/get-my-products').then((rep) => {
|
||||||
|
|
||||||
console.log('rep.data', rep.data)
|
console.log('rep.data', rep.data)
|
||||||
let customCategories = [];
|
let customCategories = [];
|
||||||
for (let c of rep.data.categories) {
|
for (let c of rep.data.categories) {
|
||||||
c.hidden = false;
|
c.hidden = false;
|
||||||
customCategories = Object.create(rep.data.categories);
|
customCategories = Object.create(rep.data.categories);
|
||||||
}
|
}
|
||||||
console.log('customCategories', customCategories);
|
console.log('customCategories', customCategories);
|
||||||
$scope.categories = customCategories;
|
$scope.categories = customCategories;
|
||||||
$scope.productsFromDB = customCategories;
|
$scope.productsFromDB = customCategories;
|
||||||
$scope.recentSellings = rep.data.history;
|
$scope.recentSellings = rep.data.history;
|
||||||
// festoche
|
// festoche
|
||||||
$scope.activeFestival.id = rep.data.lastFestival.id;
|
$scope.activeFestival.id = rep.data.lastFestival.id;
|
||||||
$scope.activeFestival.name = rep.data.lastFestival.name;
|
$scope.activeFestival.name = rep.data.lastFestival.name;
|
||||||
$scope.activeFestival.dateCreation = rep.data.lastFestival.dateCreation;
|
$scope.activeFestival.dateCreation = rep.data.lastFestival.dateCreation;
|
||||||
$scope.activeFestival.commentaire = rep.data.lastFestival.commentaire;
|
$scope.activeFestival.commentaire = rep.data.lastFestival.commentaire;
|
||||||
$scope.activeFestival.chiffreAffaire = rep.data.lastFestival.chiffreAffaire;
|
$scope.activeFestival.chiffreAffaire = rep.data.lastFestival.chiffreAffaire;
|
||||||
$scope.activeFestival.fondDeCaisseAvant = rep.data.lastFestival.fondDeCaisseAvant;
|
$scope.activeFestival.fondDeCaisseAvant = rep.data.lastFestival.fondDeCaisseAvant;
|
||||||
$scope.activeFestival.fondDeCaisseApres = rep.data.lastFestival.fondDeCaisseApres;
|
$scope.activeFestival.fondDeCaisseApres = rep.data.lastFestival.fondDeCaisseApres;
|
||||||
$scope.activeFestival.clientsCount = rep.data.lastFestival.clientsCount;
|
$scope.activeFestival.clientsCount = rep.data.lastFestival.clientsCount;
|
||||||
// stat count for items
|
// stat count for items
|
||||||
$scope.countProductsSoldForActiveFestival = rep.data.lastFestival.sold;
|
$scope.countProductsSoldForActiveFestival = rep.data.lastFestival.sold;
|
||||||
console.log(' $scope.countProductsSoldForActiveFestival', $scope.countProductsSoldForActiveFestival);
|
console.log(' $scope.countProductsSoldForActiveFestival', $scope.countProductsSoldForActiveFestival);
|
||||||
//done
|
//done
|
||||||
$scope.initLoadDone = true;
|
$scope.initLoadDone = true;
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
$scope.initLoadDone = true;
|
$scope.initLoadDone = true;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sell one product, assuming the client has the right amount of money
|
* sell one product, assuming the client has the right amount of money
|
||||||
* @param product
|
* @param product
|
||||||
*/
|
*/
|
||||||
$scope.expressSell = function (product) {
|
$scope.expressSell = function (product) {
|
||||||
$scope.removeAll();
|
$scope.removeAll();
|
||||||
$scope.addProduct(product);
|
$scope.addProduct(product);
|
||||||
$scope.sendForm();
|
$scope.sendForm();
|
||||||
};
|
};
|
||||||
$scope.recentId = 0;
|
$scope.recentId = 0;
|
||||||
$scope.logger = function (stuff) {
|
$scope.logger = function (stuff) {
|
||||||
console.log('logger #####', stuff);
|
console.log('logger #####', stuff);
|
||||||
};
|
};
|
||||||
$scope.sendForm = function () {
|
$scope.sendForm = function () {
|
||||||
let sellingComment = $scope.sellingComment;
|
let sellingComment = $scope.sellingComment;
|
||||||
$scope.sellingComment = sellingComment;
|
$scope.sellingComment = sellingComment;
|
||||||
console.log('########### SEND FORM');
|
console.log('########### SEND FORM');
|
||||||
console.log('$scope.sellingComment', $scope.sellingComment);
|
console.log('$scope.sellingComment', $scope.sellingComment);
|
||||||
let lesParams = {
|
let lesParams = {
|
||||||
paidByClient : $scope.paidAmount,
|
paidByClient: $scope.paidAmount,
|
||||||
sellingComment: $scope.sellingComment,
|
sellingComment: $scope.sellingComment,
|
||||||
activeSelling : $scope.activeSelling,
|
activeSelling: $scope.activeSelling,
|
||||||
activeFestival: $scope.activeFestival
|
activeFestival: $scope.activeFestival
|
||||||
};
|
};
|
||||||
$scope.recentSellings.push({
|
$scope.recentSellings.push({
|
||||||
id : $scope.recentId++,
|
id: $scope.recentId++,
|
||||||
amount : $scope.CurrentSellingTotal(),
|
amount: $scope.CurrentSellingTotal(),
|
||||||
paidAmount: $scope.paidAmount,
|
paidAmount: $scope.paidAmount,
|
||||||
products :
|
products:
|
||||||
angular
|
angular
|
||||||
.copy($scope.activeSelling)
|
.copy($scope.activeSelling)
|
||||||
});
|
});
|
||||||
$scope.lesParams = lesParams;
|
$scope.lesParams = lesParams;
|
||||||
$http({
|
$http({
|
||||||
method : 'POST',
|
method: 'POST',
|
||||||
url : 'logged/add-selling',
|
url: 'logged/add-selling',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
data : lesParams // pass in data as strings
|
data: lesParams // pass in data as strings
|
||||||
}).then(function (rep) {
|
}).then(function (rep) {
|
||||||
|
|
||||||
console.log('########### OK form',rep);
|
console.log('########### OK form', rep);
|
||||||
// if successful, bind success message to message
|
// if successful, bind success message to message
|
||||||
$scope.successMessage = rep.data.message;
|
$scope.successMessage = rep.data.message;
|
||||||
$scope.activeFestival.chiffreAffaire = rep.data.newChiffreAffaire;
|
$scope.activeFestival.chiffreAffaire = rep.data.newChiffreAffaire;
|
||||||
$scope.activeFestival.clientsCount = rep.data.clientsCount;
|
$scope.activeFestival.clientsCount = rep.data.clientsCount;
|
||||||
$scope.countProductsSoldForActiveFestival = rep.data.activeFestival.sold;
|
$scope.countProductsSoldForActiveFestival = rep.data.activeFestival.sold;
|
||||||
$scope.showTemporaryMessage();
|
$scope.showTemporaryMessage();
|
||||||
$scope.clearCurrentSelling();
|
$scope.clearCurrentSelling();
|
||||||
console.log(rep);
|
console.log(rep);
|
||||||
if (!rep.success) {
|
if (!rep.success) {
|
||||||
// if not successful, bind errors to error variables
|
// if not successful, bind errors to error variables
|
||||||
$scope.errors = rep.errors;
|
$scope.errors = rep.errors;
|
||||||
}
|
}
|
||||||
}, function (rep) {
|
}, function (rep) {
|
||||||
console.log('nope! ', rep.data);
|
console.log('nope! ', rep.data);
|
||||||
$scope.showTemporaryErrorMessage();
|
$scope.showTemporaryErrorMessage();
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.sellingOk = false;
|
$scope.sellingOk = false;
|
||||||
$scope.sellingError = false;
|
$scope.sellingError = false;
|
||||||
$scope.tempMessage = {};
|
$scope.tempMessage = {};
|
||||||
$scope.showTemporaryMessage = function () {
|
$scope.showTemporaryMessage = function () {
|
||||||
console.log('show message');
|
|
||||||
if ($scope.sellingOk) {
|
|
||||||
$scope.sellingOk = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$scope.sellingOk = true;
|
|
||||||
$timeout.cancel($scope.tempMessage);
|
|
||||||
$scope.tempMessage = $timeout(function () {
|
|
||||||
console.log('hide message');
|
|
||||||
$scope.sellingOk = false;
|
|
||||||
}, 2000)
|
|
||||||
};
|
|
||||||
$scope.showTemporaryErrorMessage = function () {
|
|
||||||
console.log('show message');
|
|
||||||
if ($scope.sellingError) {
|
|
||||||
$scope.sellingError = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$scope.sellingError = true;
|
|
||||||
$timeout.cancel($scope.tempMessage);
|
|
||||||
$scope.tempMessage = $timeout(function () {
|
|
||||||
console.log('hide message');
|
|
||||||
$scope.sellingError = false;
|
|
||||||
}, 2000)
|
|
||||||
};
|
|
||||||
$scope.init = (function () {
|
|
||||||
$scope.fetchProductsFromDB();
|
|
||||||
})();
|
|
||||||
}])
|
|
||||||
.controller('previsionnelCtrl', ['$scope', '$http', '$timeout', function ($scope, $http, $timeout) {
|
|
||||||
|
|
||||||
$scope.config = {
|
$scope.sellingOk = true;
|
||||||
initialLoadingDone : false,
|
$timeout.cancel($scope.tempMessage);
|
||||||
loading : false,
|
$scope.tempMessage = $timeout(function () {
|
||||||
lines : 24,
|
console.log('hide message');
|
||||||
debounceTime : 300, // miliseconds to wait before updating model and saving changes
|
$scope.sellingOk = false;
|
||||||
/**
|
}, 2000)
|
||||||
* expenses kind of the user
|
console.log('show message');
|
||||||
*/
|
if ($scope.sellingOk) {
|
||||||
disponibility : 5000,
|
$scope.sellingOk = false;
|
||||||
averageMonthlyEarnings: 600,
|
return;
|
||||||
warningThershold : 2000,
|
}
|
||||||
showDelays : false,
|
};
|
||||||
showRepeats : false,
|
$scope.showTemporaryErrorMessage = function () {
|
||||||
monthsBeforeNoMoney : null,
|
console.log('show message');
|
||||||
};
|
if ($scope.sellingError) {
|
||||||
|
$scope.sellingError = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$scope.sellingError = true;
|
||||||
|
$timeout.cancel($scope.tempMessage);
|
||||||
|
$scope.tempMessage = $timeout(function () {
|
||||||
|
console.log('hide message');
|
||||||
|
$scope.sellingError = false;
|
||||||
|
}, 2000)
|
||||||
|
};
|
||||||
|
$scope.init = (function () {
|
||||||
|
$scope.fetchProductsFromDB();
|
||||||
|
})();
|
||||||
|
}])
|
||||||
|
.controller('previsionnelCtrl', ['$scope', '$http', '$timeout', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
let exampleExpenses = [
|
$scope.config = {
|
||||||
{name: "appart", amount: 800, delay: 0, repeat: $scope.config.lines, enabled: true},
|
initialLoadingDone: false,
|
||||||
{name: "assurance voiture", amount: 50, delay: 0, repeat: $scope.config.lines, enabled: true},
|
loading: false,
|
||||||
{name: "internet", amount: 20, delay: 0, repeat: $scope.config.lines, enabled: true},
|
lines: 24,
|
||||||
{name: "elec", amount: 100, delay: 0, repeat: $scope.config.lines, enabled: true},
|
debounceTime: 300, // miliseconds to wait before updating model and saving changes
|
||||||
{name: "chat", amount: 20, delay: 0, repeat: $scope.config.lines, enabled: true},
|
/**
|
||||||
{name: "transports", amount: 70, delay: 0, repeat: $scope.config.lines, enabled: false},
|
* expenses kind of the user
|
||||||
];
|
*/
|
||||||
|
disponibility: 5000,
|
||||||
|
averageMonthlyEarnings: 600,
|
||||||
|
warningThershold: 2000,
|
||||||
|
showDelays: false,
|
||||||
|
showRepeats: false,
|
||||||
|
monthsBeforeNoMoney: null,
|
||||||
|
};
|
||||||
|
|
||||||
// $scope.expenses=[];
|
let exampleExpenses = [
|
||||||
$scope.expenses = exampleExpenses;
|
{ name: "appart", amount: 800, delay: 0, repeat: $scope.config.lines, enabled: true },
|
||||||
|
{ name: "assurance voiture", amount: 50, delay: 0, repeat: $scope.config.lines, enabled: true },
|
||||||
|
{ name: "internet", amount: 20, delay: 0, repeat: $scope.config.lines, enabled: true },
|
||||||
|
{ name: "elec", amount: 100, delay: 0, repeat: $scope.config.lines, enabled: true },
|
||||||
|
{ name: "chat", amount: 20, delay: 0, repeat: $scope.config.lines, enabled: true },
|
||||||
|
{ name: "transports", amount: 70, delay: 0, repeat: $scope.config.lines, enabled: false },
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
// $scope.expenses=[];
|
||||||
* sum of all monthly expenses, ignoring delay
|
$scope.expenses = exampleExpenses;
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
$scope.sumMonthlyExpenses = () => {
|
|
||||||
let sum = 0;
|
|
||||||
$scope.expenses.forEach((elem) => {
|
|
||||||
if (elem.enabled) {
|
|
||||||
sum += elem.amount;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return sum;
|
|
||||||
};
|
|
||||||
$scope.previsionTable = [];
|
|
||||||
$scope.calculatePrevisionTable = () => {
|
|
||||||
let turns = $scope.config.lines;
|
|
||||||
let monthly = $scope.sumMonthlyExpenses();
|
|
||||||
let available = $scope.config.disponibility;
|
|
||||||
let previsionTable = [];
|
|
||||||
let changedNoMoneyConfig = false;
|
|
||||||
$scope.config.monthsBeforeNoMoney = null;
|
|
||||||
for (let i = 0; i <= turns; i++) {
|
|
||||||
// TODO take in account delays in expenses
|
|
||||||
available = available - monthly + $scope.config.averageMonthlyEarnings;
|
|
||||||
let newLine = {
|
|
||||||
expense : monthly,
|
|
||||||
available: available,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (available <= 0 && !changedNoMoneyConfig) {
|
/**
|
||||||
$scope.config.monthsBeforeNoMoney = i;
|
* sum of all monthly expenses, ignoring delay
|
||||||
changedNoMoneyConfig = true;
|
* @returns {number}
|
||||||
}
|
*/
|
||||||
previsionTable.push(newLine);
|
$scope.sumMonthlyExpenses = () => {
|
||||||
}
|
let sum = 0;
|
||||||
$scope.previsionTable = previsionTable;
|
$scope.expenses.forEach((elem) => {
|
||||||
$scope.makeGraphPointsOfPrevisionTable(previsionTable);
|
if (elem.enabled) {
|
||||||
return previsionTable;
|
sum += elem.amount;
|
||||||
};
|
}
|
||||||
$scope.graphPointsPrevision = [];
|
})
|
||||||
$scope.makeGraphPointsOfPrevisionTable = (previsionTable) => {
|
return sum;
|
||||||
console.log("previsionTable", previsionTable);
|
};
|
||||||
$scope.graphPointsPrevision = [];
|
$scope.previsionTable = [];
|
||||||
for (let i = 0; i < previsionTable.length; i++) {
|
$scope.calculatePrevisionTable = () => {
|
||||||
$scope.graphPointsPrevision.push({
|
let turns = $scope.config.lines;
|
||||||
label: previsionTable[i].available + " euros restants dans " + i + " mois",
|
let monthly = $scope.sumMonthlyExpenses();
|
||||||
y : previsionTable[i].available,
|
let available = $scope.config.disponibility;
|
||||||
x : i,
|
let previsionTable = [];
|
||||||
})
|
let changedNoMoneyConfig = false;
|
||||||
}
|
$scope.config.monthsBeforeNoMoney = null;
|
||||||
|
for (let i = 0; i <= turns; i++) {
|
||||||
|
// TODO take in account delays in expenses
|
||||||
|
available = available - monthly + $scope.config.averageMonthlyEarnings;
|
||||||
|
let newLine = {
|
||||||
|
expense: monthly,
|
||||||
|
available: available,
|
||||||
|
};
|
||||||
|
|
||||||
}
|
if (available <= 0 && !changedNoMoneyConfig) {
|
||||||
|
$scope.config.monthsBeforeNoMoney = i;
|
||||||
|
changedNoMoneyConfig = true;
|
||||||
|
}
|
||||||
|
previsionTable.push(newLine);
|
||||||
|
}
|
||||||
|
$scope.previsionTable = previsionTable;
|
||||||
|
$scope.makeGraphPointsOfPrevisionTable(previsionTable);
|
||||||
|
return previsionTable;
|
||||||
|
};
|
||||||
|
$scope.graphPointsPrevision = [];
|
||||||
|
$scope.makeGraphPointsOfPrevisionTable = (previsionTable) => {
|
||||||
|
console.log("previsionTable", previsionTable);
|
||||||
|
$scope.graphPointsPrevision = [];
|
||||||
|
for (let i = 0; i < previsionTable.length; i++) {
|
||||||
|
$scope.graphPointsPrevision.push({
|
||||||
|
label: previsionTable[i].available + " euros restants dans " + i + " mois",
|
||||||
|
y: previsionTable[i].available,
|
||||||
|
x: i,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
$scope.updateconf = (rep) => {
|
}
|
||||||
// update view calculs
|
|
||||||
$scope.calculatePrevisionTable();
|
|
||||||
$scope.updateCanevas()
|
|
||||||
// flags
|
|
||||||
$scope.config.loading = false;
|
|
||||||
$scope.config.initialLoadingDone = true;
|
|
||||||
$scope.config.disponibility = rep.data.disponibility;
|
|
||||||
$scope.config.averageMonthlyEarnings = rep.data.averageMonthlyEarnings;
|
|
||||||
// default data when user has nothing saved
|
|
||||||
console.log('rep.data.expenses.length', rep.data.expenses.length)
|
|
||||||
if (!rep.data.expenses.length) {
|
|
||||||
$scope.expenses = exampleExpenses;
|
|
||||||
} else {
|
|
||||||
$scope.expenses = rep.data.expenses;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// http related calls
|
|
||||||
$scope.fetchExpenses = () => {
|
|
||||||
console.log('fetch expenses...');
|
|
||||||
$scope.config.loading = true;
|
|
||||||
|
|
||||||
$http.get('logged/get-my-expenses').then((rep) => {
|
$scope.updateconf = (rep) => {
|
||||||
|
// update view calculs
|
||||||
|
$scope.calculatePrevisionTable();
|
||||||
|
$scope.updateCanevas()
|
||||||
|
// flags
|
||||||
|
$scope.config.loading = false;
|
||||||
|
$scope.config.initialLoadingDone = true;
|
||||||
|
$scope.config.disponibility = rep.data.disponibility;
|
||||||
|
$scope.config.averageMonthlyEarnings = rep.data.averageMonthlyEarnings;
|
||||||
|
// default data when user has nothing saved
|
||||||
|
console.log('rep.data.expenses.length', rep.data.expenses.length)
|
||||||
|
if (!rep.data.expenses.length) {
|
||||||
|
$scope.expenses = exampleExpenses;
|
||||||
|
} else {
|
||||||
|
$scope.expenses = rep.data.expenses;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// http related calls
|
||||||
|
$scope.fetchExpenses = () => {
|
||||||
|
console.log('fetch expenses...');
|
||||||
|
$scope.config.loading = true;
|
||||||
|
|
||||||
|
$http.get('logged/get-my-expenses').then((rep) => {
|
||||||
console.log('logged/get-my-expenses', rep.data.expenses);
|
console.log('logged/get-my-expenses', rep.data.expenses);
|
||||||
$scope.updateconf(rep)
|
$scope.updateconf(rep)
|
||||||
},
|
},
|
||||||
$scope.manageError)
|
$scope.manageError)
|
||||||
};
|
};
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
if ($scope.config.loading) {
|
if ($scope.config.loading) {
|
||||||
console.log('already saving');
|
console.log('already saving');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('update expenses...');
|
console.log('update expenses...');
|
||||||
$scope.config.loading = true;
|
$scope.config.loading = true;
|
||||||
$http.post('logged/save-my-expenses', {
|
$http.post('logged/save-my-expenses', {
|
||||||
expenses: $scope.expenses,
|
expenses: $scope.expenses,
|
||||||
config : $scope.config
|
config: $scope.config
|
||||||
})
|
})
|
||||||
.then((rep) => {
|
.then((rep) => {
|
||||||
console.log('logged/save-my-expenses', rep);
|
console.log('logged/save-my-expenses', rep);
|
||||||
$scope.updateconf(rep)
|
$scope.updateconf(rep)
|
||||||
},
|
},
|
||||||
$scope.manageError)
|
$scope.manageError)
|
||||||
};
|
};
|
||||||
$scope.addExpense = function () {
|
$scope.addExpense = function () {
|
||||||
$scope.expenses.push({
|
$scope.expenses.push({
|
||||||
name : "",
|
name: "",
|
||||||
repeat: 0,
|
repeat: 0,
|
||||||
delay : 0,
|
delay: 0,
|
||||||
amount: 0,
|
amount: 0,
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
$scope.init = function () {
|
$scope.init = function () {
|
||||||
$scope.fetchExpenses();
|
$scope.fetchExpenses();
|
||||||
};
|
};
|
||||||
$scope.manageError = (error) => {
|
$scope.manageError = (error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
$scope.config.loading = false;
|
$scope.config.loading = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
$scope.updateCanevas = function () {
|
$scope.updateCanevas = function () {
|
||||||
var dataPoints = $scope.graphPointsPrevision;
|
var dataPoints = $scope.graphPointsPrevision;
|
||||||
var chartContainer = new CanvasJS.Chart("simulationPrevision", {
|
var chartContainer = new CanvasJS.Chart("simulationPrevision", {
|
||||||
title: {
|
title: {
|
||||||
text: "Euros disponibles dans le temps"
|
text: "Euros disponibles dans le temps"
|
||||||
},
|
},
|
||||||
// animationEnabled: true,
|
// animationEnabled: true,
|
||||||
data : [
|
data: [
|
||||||
{
|
{
|
||||||
// Change type to "doughnut", "line", "splineArea", etc.
|
// Change type to "doughnut", "line", "splineArea", etc.
|
||||||
type : "splineArea",
|
type: "splineArea",
|
||||||
dataPoints: dataPoints
|
dataPoints: dataPoints
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
chartContainer.render();
|
chartContainer.render();
|
||||||
};
|
};
|
||||||
$scope.init();
|
$scope.init();
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
@import 'pages/libs';
|
@use 'split/bootstrap.min.css';
|
||||||
@import 'fonts/all';
|
@use 'pages/libs';
|
||||||
@import 'split/override_libs';
|
@use 'fonts/all';
|
||||||
@import 'split/custom_vars';
|
@use 'split/override_libs';
|
||||||
@import 'split/formulaires';
|
@use 'split/custom_vars';
|
||||||
@import 'split/typo';
|
@use 'split/formulaires';
|
||||||
@import 'pages/global';
|
@use 'split/typo';
|
||||||
@import 'pages/nav';
|
@use 'pages/global';
|
||||||
@import 'pages/demo';
|
@use 'pages/nav';
|
||||||
@import 'pages/home';
|
@use 'pages/demo';
|
||||||
@import 'pages/forms';
|
@use 'pages/home';
|
||||||
@import 'pages/history';
|
@use 'pages/forms';
|
||||||
@import 'pages/dashboard';
|
@use 'pages/history';
|
||||||
@import 'pages/special';
|
@use 'pages/dashboard';
|
||||||
// @import 'pages/responsive';
|
@use 'pages/special';
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,10 @@
|
||||||
|
@use "sass:color";
|
||||||
|
@use "../split/custom_vars";
|
||||||
|
|
||||||
#caisse-now {
|
#caisse-now {
|
||||||
min-height: 90vh;
|
min-height: 90vh;
|
||||||
width: 70vw;
|
width: 70vw;
|
||||||
padding-left: 0;
|
padding-left: 1vw;
|
||||||
|
|
||||||
.product-box {
|
.product-box {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@ -29,25 +32,25 @@
|
||||||
-webkit-border-radius: 1rem;
|
-webkit-border-radius: 1rem;
|
||||||
-moz-border-radius: 1rem;
|
-moz-border-radius: 1rem;
|
||||||
border-radius: 1rem;
|
border-radius: 1rem;
|
||||||
border-color: $all-text-color;
|
border-color: custom_vars.$all-text-color;
|
||||||
box-shadow: 5px 3px 10px 2px #ddd;
|
box-shadow: 5px 3px 10px 2px #ddd;
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
|
|
||||||
&.btn-primary {
|
&.btn-primary {
|
||||||
background-color: $deepblue;
|
background-color: custom_vars.$deepblue;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: $lightblue;
|
background: custom_vars.$lightblue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.badge-default {
|
.badge-default {
|
||||||
background: $lightblue;
|
background: custom_vars.$lightblue;
|
||||||
}
|
}
|
||||||
|
|
||||||
.badge-success {
|
.badge-success {
|
||||||
background: mix(green, $lightblue);
|
background: color.mix(green, custom_vars.$lightblue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +90,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-listing {
|
.category-listing {
|
||||||
border: solid 1px $grey;
|
border: solid 1px custom_vars.$grey;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
margin: 0.5rem;
|
margin: 0.5rem;
|
||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
|
@ -132,4 +135,12 @@
|
||||||
|
|
||||||
#main_options {
|
#main_options {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#other_time,
|
||||||
|
#categories_visibility {
|
||||||
|
display: block;
|
||||||
|
padding-top: 1rem;
|
||||||
|
padding-bottom: 5rem;
|
||||||
|
min-height: 500px;
|
||||||
}
|
}
|
|
@ -41,9 +41,13 @@ form {
|
||||||
padding: 1rem 2rem;
|
padding: 1rem 2rem;
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
border: solid 1px #ccc;
|
border: solid 1px #ccc;
|
||||||
background: blue;
|
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button.delete-button {
|
||||||
|
float: right;
|
||||||
|
min-width: 20rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-remove-all {
|
.btn-remove-all {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
@use "../split/custom_vars";
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: #F5F5F5;
|
background: #F5F5F5;
|
||||||
font: 18px/1.5 sans-serif;
|
font: 18px/1.5 sans-serif;
|
||||||
|
@ -23,7 +25,7 @@ p {
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: $primary;
|
color: custom_vars.$primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
|
@ -127,10 +129,10 @@ code {
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-block {
|
.header-block {
|
||||||
background: $darkblue;
|
background: custom_vars.$darkblue;
|
||||||
|
|
||||||
.btn-default {
|
.btn-default {
|
||||||
color: $grey;
|
color: custom_vars.$grey;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
|
@ -144,7 +146,7 @@ code {
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu-dashboard .nav .logo-home.btn-default {
|
#menu-dashboard .nav .logo-home.btn-default {
|
||||||
background: $darkblue;
|
background: custom_vars.$darkblue;
|
||||||
height: 52px;
|
height: 52px;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
@import '../split/custom_vars';
|
@use "sass:color";
|
||||||
|
@use '../split/custom_vars';
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
color: $all-text-color;
|
color: custom_vars.$all-text-color;
|
||||||
font-family: "Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
font-family: "Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
line-height: 2rem;
|
line-height: 2rem;
|
||||||
|
@ -47,10 +48,9 @@ body {
|
||||||
|
|
||||||
#portfolio,
|
#portfolio,
|
||||||
#mainNav,
|
#mainNav,
|
||||||
.masthead,
|
.masthead {
|
||||||
{
|
padding-left: 10vw !important;
|
||||||
padding-left: 300px !important;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg-img {
|
.bg-img {
|
||||||
|
@ -74,23 +74,23 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg-color {
|
.bg-color {
|
||||||
background: $deepblue;
|
background: custom_vars.$deepblue;
|
||||||
color: $light;
|
color: custom_vars.$light;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: $lightblue;
|
color: custom_vars.$lightblue;
|
||||||
}
|
}
|
||||||
|
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo-main {
|
.logo-main {
|
||||||
color: $logo-color;
|
color: custom_vars.$logo-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.big-footer {
|
.big-footer {
|
||||||
background: $dark;
|
background: custom_vars.$dark;
|
||||||
color: $light;
|
color: custom_vars.$light;
|
||||||
height: 10em;
|
height: 10em;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
@ -102,8 +102,8 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
thead {
|
thead {
|
||||||
background: $darkblue;
|
background: custom_vars.$darkblue;
|
||||||
color: $light;
|
color: custom_vars.$light;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
|
@ -191,13 +191,13 @@ input {
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu-dashboard {
|
#menu-dashboard {
|
||||||
background: $dark;
|
background: custom_vars.$dark;
|
||||||
display: flex;
|
display: flex;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
width: 13vw;
|
width: 10vw;
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
|
@ -212,10 +212,10 @@ input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
display: block;
|
display: block;
|
||||||
border-right: solid 2px mix($dark, $grey);
|
border-right: solid 2px color.mix(custom_vars.$dark, custom_vars.$grey);
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
color: $light;
|
color: custom_vars.$light;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo-home {
|
.logo-home {
|
||||||
|
@ -224,11 +224,11 @@ input {
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-default {
|
.btn-default {
|
||||||
color: $light;
|
color: custom_vars.$light;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: mix($deepblue, $light);
|
background: color.mix(custom_vars.$deepblue, custom_vars.$light);
|
||||||
color: $dark;
|
color: custom_vars.$dark;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ input {
|
||||||
i.fa {
|
i.fa {
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
color: $light;
|
color: custom_vars.$light;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,13 +251,13 @@ input {
|
||||||
&:focus {
|
&:focus {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
color: $lightblue;
|
color: custom_vars.$lightblue;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
color: $lightblue;
|
color: custom_vars.$lightblue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ input {
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-success {
|
.btn-success {
|
||||||
background-color: $deepblue;
|
background-color: custom_vars.$deepblue;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,8 +302,8 @@ table td {
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=submit] {
|
input[type=submit] {
|
||||||
background: $primary;
|
background: custom_vars.$primary;
|
||||||
color: $light;
|
color: custom_vars.$light;
|
||||||
display: block;
|
display: block;
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
|
@ -311,7 +311,7 @@ table td {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: $lightblue;
|
background: custom_vars.$lightblue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,6 +324,7 @@ table td {
|
||||||
|
|
||||||
#bodyland {
|
#bodyland {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
padding-bottom: 10rem;
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
min-height: 90vh;
|
min-height: 90vh;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
@use "../split/custom_vars";
|
||||||
|
|
||||||
.main-section {
|
.main-section {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
color: $light;
|
color: custom_vars.$light;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
@ -9,7 +11,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
color: $light !important;
|
color: custom_vars.$light !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
>div {
|
>div {
|
||||||
|
@ -20,7 +22,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-values {
|
.product-values {
|
||||||
color: $light;
|
color: custom_vars.$light;
|
||||||
padding: 4rem;
|
padding: 4rem;
|
||||||
padding-top: 25vh;
|
padding-top: 25vh;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +34,7 @@
|
||||||
h4,
|
h4,
|
||||||
h5,
|
h5,
|
||||||
h6 {
|
h6 {
|
||||||
color: $light;
|
color: custom_vars.$light;
|
||||||
}
|
}
|
||||||
|
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
@import '~font-awesome/css/font-awesome.css';
|
@import '~font-awesome/css/font-awesome.css';
|
||||||
//@import '~bootstrap-sass/assets/stylesheets/bootstrap';
|
|
||||||
@import '~intro.js/minified/introjs.min.css';
|
@import '~intro.js/minified/introjs.min.css';
|
||||||
@import '~intro.js/themes/introjs-dark.css';
|
@import '~intro.js/themes/introjs-dark.css';
|
||||||
@import "~bootstrap/scss/bootstrap";
|
|
|
@ -3,187 +3,4 @@
|
||||||
padding-left: 5em;
|
padding-left: 5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#caisse-now {
|
}
|
||||||
margin-left: -1em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// @media all and(max-width: 1200px) {
|
|
||||||
// #caisse-now{
|
|
||||||
// margin-left: 0;
|
|
||||||
// }
|
|
||||||
// .big-footer{
|
|
||||||
// padding-left: 0;
|
|
||||||
// }
|
|
||||||
// nav {
|
|
||||||
// min-width: auto;
|
|
||||||
// }
|
|
||||||
// html, body {
|
|
||||||
// font-size: 1.2rem;
|
|
||||||
// }
|
|
||||||
// .bg-shader {
|
|
||||||
// height: 100%;
|
|
||||||
// min-height: 100vh;
|
|
||||||
// }
|
|
||||||
// .product-values-block {
|
|
||||||
// padding: 1em;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// #homepage {
|
|
||||||
// .main-section {
|
|
||||||
// padding: 2rem;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .btn {
|
|
||||||
// display: block;
|
|
||||||
// width: 100%;
|
|
||||||
// font-size: 1.25em;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// #caisse-now {
|
|
||||||
// .product-box {
|
|
||||||
// width: 100%;
|
|
||||||
// &.active{
|
|
||||||
// .product-button{
|
|
||||||
// background: greenyellow;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .product-button {
|
|
||||||
// min-width: calc(100% - 56px)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .listing-products {
|
|
||||||
|
|
||||||
// .btn, button {
|
|
||||||
// font-size: 1rem;
|
|
||||||
// padding: 0.2em;
|
|
||||||
// border-radius: 0.3em;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @media all and(max-width: 1200px) {
|
|
||||||
|
|
||||||
// #bodyland {
|
|
||||||
// .container {
|
|
||||||
// min-height: 100vh;
|
|
||||||
// width: 80vw;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// #menu-dashboard {
|
|
||||||
// font-size: 1rem;
|
|
||||||
// width: 19vw;
|
|
||||||
// min-width: 200px;
|
|
||||||
|
|
||||||
// .nav {
|
|
||||||
// min-width: 200px;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// form {
|
|
||||||
// margin-top: 3em;
|
|
||||||
|
|
||||||
// select {
|
|
||||||
// width: 100%;
|
|
||||||
// margin: 1em 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// + ul {
|
|
||||||
// margin-top: 1em;
|
|
||||||
// list-style-type: none;
|
|
||||||
|
|
||||||
// a {
|
|
||||||
// display: block;
|
|
||||||
|
|
||||||
// .fa {
|
|
||||||
// margin-right: 1em;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @media all and(max-width: 600px) {
|
|
||||||
|
|
||||||
// #menu_button{
|
|
||||||
|
|
||||||
// }
|
|
||||||
// html, body {
|
|
||||||
// font-size: 1rem;
|
|
||||||
// }
|
|
||||||
// #menu-dashboard .nav .logo-home.btn-default {
|
|
||||||
// height: auto;
|
|
||||||
// font-size: 2em;
|
|
||||||
// }
|
|
||||||
// #menu-dashboard {
|
|
||||||
// width: 100vw;
|
|
||||||
// visibility: hidden;
|
|
||||||
|
|
||||||
// &.shown {
|
|
||||||
// visibility: visible;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .nav {
|
|
||||||
|
|
||||||
// min-width: 200px;
|
|
||||||
// min-height: 100vh;
|
|
||||||
// overflow: auto;
|
|
||||||
|
|
||||||
// a {
|
|
||||||
// font-size: 2rem;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .main-section > div {
|
|
||||||
// padding-top: 0;
|
|
||||||
// }
|
|
||||||
// .product-values {
|
|
||||||
// padding: 0;
|
|
||||||
// }
|
|
||||||
// .bigger-text, #homepage, .hint, .product-values-block {
|
|
||||||
// font-size: 1.25rem;
|
|
||||||
// line-height: 2rem;
|
|
||||||
// }
|
|
||||||
// .category-listing {
|
|
||||||
// width: calc(100vw - 4rem);
|
|
||||||
// height: 25vh;
|
|
||||||
// min-height: auto;
|
|
||||||
// float: left;
|
|
||||||
// clear: both;
|
|
||||||
// overflow: auto;
|
|
||||||
// }
|
|
||||||
// .sellings {
|
|
||||||
// input {
|
|
||||||
// width: 100%;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// .client-now {
|
|
||||||
// input {
|
|
||||||
// width: 50%;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// .sellings, .client-now {
|
|
||||||
|
|
||||||
// input {
|
|
||||||
// font-size: 1.5rem;
|
|
||||||
// padding: 0.5rem;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// .big-footer {
|
|
||||||
// font-size: 1rem;
|
|
||||||
// }
|
|
||||||
// #caisse-now .product-box {
|
|
||||||
// margin-bottom: 0.25rem;
|
|
||||||
// }
|
|
||||||
// #caisse-now .listing-products button {
|
|
||||||
// padding: 0.5rem 1rem;
|
|
||||||
|
|
||||||
// .express-button {
|
|
||||||
// padding: 0.5rem 1rem;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
File diff suppressed because one or more lines are too long
|
@ -1,11 +1,12 @@
|
||||||
|
@use "sass:color";
|
||||||
$dark: #222;
|
$dark: #222;
|
||||||
$light: #dedede;
|
$light: #dedede;
|
||||||
$deepblue: #1b6d85;
|
$deepblue: #1b6d85;
|
||||||
$darkblue: mix(#000, $deepblue);
|
$darkblue: color.mix(#000, $deepblue);
|
||||||
$lightblue: lightblue;
|
$lightblue: lightblue;
|
||||||
$grey: #e3e3e3;
|
$grey: #e3e3e3;
|
||||||
$logo-color: mix($deepblue, $light);
|
$logo-color: color.mix($deepblue, $light);
|
||||||
$all-text-color: mix($deepblue, $light);
|
$all-text-color: color.mix($deepblue, $light);
|
||||||
|
|
||||||
$primary: $deepblue;
|
$primary: $deepblue;
|
||||||
$btn-primary-bg: $deepblue;
|
$btn-primary-bg: $deepblue;
|
|
@ -1,3 +1,5 @@
|
||||||
|
@use "custom_vars";
|
||||||
|
|
||||||
.current-selling {
|
.current-selling {
|
||||||
ul {
|
ul {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
@ -17,7 +19,7 @@ table {
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
background: $deepblue;
|
background: custom_vars.$deepblue;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-box {
|
.product-box {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
@use "sass:color";
|
||||||
|
@use "custom_vars";
|
||||||
|
|
||||||
h2, h3, h4, h5, h6 {
|
h2, h3, h4, h5, h6 {
|
||||||
color: mix($dark, $all-text-color);
|
color: color.mix(custom_vars.$dark, custom_vars.$all-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
h1, .h1, h2, .h2, h3, .h3 {
|
h1, .h1, h2, .h2, h3, .h3 {
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20250226145218 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('DROP TABLE festvial');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('CREATE TABLE festvial (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, date_creation DATE DEFAULT NULL, chiffre_affaire DOUBLE PRECISION DEFAULT NULL, clients_count INT DEFAULT NULL, commentaire VARCHAR(500) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
|
||||||
|
}
|
||||||
|
}
|
|
@ -121,21 +121,14 @@ final class DefaultController extends AbstractController
|
||||||
// récupérer les produits de l'user connecté
|
// récupérer les produits de l'user connecté
|
||||||
|
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
// $products = $this->getUser()->getProducts();
|
$activeFest = $user->getActiveFestival();
|
||||||
|
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'categories' => $user->getGroupOfProducts(),
|
'categories' => $user->getGroupOfProducts(),
|
||||||
'products' => $user->getProducts(),
|
'products' => $user->getProducts(),
|
||||||
// mock land
|
// mock land
|
||||||
'lastFestival' => ['id' => 1,
|
'lastFestival' => $activeFest,
|
||||||
'name' => 'le festival de mock',
|
'history' => $activeFest->getSellings(),
|
||||||
'dateCreation' => '2025-02-16',
|
|
||||||
'commentaire' => 'MOCK: hop le commentaire de festival',
|
|
||||||
'chiffreAffaire' => '1234',
|
|
||||||
'fondDeCaisseAvant' => '100',
|
|
||||||
'fondDeCaisseAprès' => '150',
|
|
||||||
'sold' => 123
|
|
||||||
],
|
|
||||||
'history' => [],
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,6 +267,10 @@ final class DefaultController extends AbstractController
|
||||||
$productFound->addSelling($newSelling);
|
$productFound->addSelling($newSelling);
|
||||||
$entityManager->persist($productFound);
|
$entityManager->persist($productFound);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return $this->json(['message' => 'Produit '.$product['id'].' non trouvé'], 403);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -285,6 +282,8 @@ final class DefaultController extends AbstractController
|
||||||
->setOwner($loggedUser);
|
->setOwner($loggedUser);
|
||||||
|
|
||||||
|
|
||||||
|
$currentFestival->updateChiffreAffaire();
|
||||||
|
|
||||||
$entityManager->persist($newSelling);
|
$entityManager->persist($newSelling);
|
||||||
$entityManager->persist($currentFestival);
|
$entityManager->persist($currentFestival);
|
||||||
|
|
||||||
|
@ -296,19 +295,8 @@ final class DefaultController extends AbstractController
|
||||||
$response = [
|
$response = [
|
||||||
'message' => 'yes',
|
'message' => 'yes',
|
||||||
'newChiffreAffaire' => $currentFestival->getChiffreAffaire(),
|
'newChiffreAffaire' => $currentFestival->getChiffreAffaire(),
|
||||||
'newChiffreAffaire' => 12,
|
'clientsCount' => count($currentFestival->getSellings()),
|
||||||
'clientsCount' => $currentFestival->getClientsCount(),
|
|
||||||
// 'clientsCount' => 12,
|
|
||||||
'activeFestival' => $currentFestival,
|
'activeFestival' => $currentFestival,
|
||||||
// 'activeFestival' => ['id' => 1,
|
|
||||||
// 'name' => 'le festival de mock',
|
|
||||||
// 'dateCreation' => '2025-02-16',
|
|
||||||
// 'commentaire' => 'MOCK: hop le commentaire de festival',
|
|
||||||
// 'chiffreAffaire' => '1234',
|
|
||||||
// 'fondDeCaisseAvant' => '100',
|
|
||||||
// 'fondDeCaisseAprès' => '150',
|
|
||||||
// 'sold' => 123
|
|
||||||
// ],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// prendre en compte l'ajout de nouveaux produits si on a une valeur dans le POST
|
// prendre en compte l'ajout de nouveaux produits si on a une valeur dans le POST
|
||||||
|
|
|
@ -53,11 +53,17 @@ final class ExpenseController extends AbstractController
|
||||||
#[Route('/{id}/edit', name: 'app_expense_edit', methods: ['GET', 'POST'])]
|
#[Route('/{id}/edit', name: 'app_expense_edit', methods: ['GET', 'POST'])]
|
||||||
public function edit(Request $request, Expense $expense, EntityManagerInterface $entityManager): Response
|
public function edit(Request $request, Expense $expense, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
|
$userFound = $this->getUser();
|
||||||
|
if (!$userFound || $expense->getUser() !== $userFound) {
|
||||||
|
throw $this->createAccessDeniedException('Vous n\'êtes pas autorisé à modifier cette dépense.');
|
||||||
|
}
|
||||||
|
|
||||||
$form = $this->createForm(Expense1Type::class, $expense);
|
$form = $this->createForm(Expense1Type::class, $expense);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
$this->addFlash('success', 'La dépense a été modifiée avec succès.');
|
||||||
|
|
||||||
return $this->redirectToRoute('app_expense_index', [], Response::HTTP_SEE_OTHER);
|
return $this->redirectToRoute('app_expense_index', [], Response::HTTP_SEE_OTHER);
|
||||||
}
|
}
|
||||||
|
@ -71,9 +77,15 @@ final class ExpenseController extends AbstractController
|
||||||
#[Route('/{id}', name: 'app_expense_delete', methods: ['POST'])]
|
#[Route('/{id}', name: 'app_expense_delete', methods: ['POST'])]
|
||||||
public function delete(Request $request, Expense $expense, EntityManagerInterface $entityManager): Response
|
public function delete(Request $request, Expense $expense, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
|
$userFound = $this->getUser();
|
||||||
|
if (!$userFound || $expense->getUser() !== $userFound) {
|
||||||
|
throw $this->createAccessDeniedException('Vous n\'êtes pas autorisé à supprimer cette dépense.');
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->isCsrfTokenValid('delete'.$expense->getId(), $request->getPayload()->getString('_token'))) {
|
if ($this->isCsrfTokenValid('delete'.$expense->getId(), $request->getPayload()->getString('_token'))) {
|
||||||
$entityManager->remove($expense);
|
$entityManager->remove($expense);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
$this->addFlash('success', 'La dépense a été supprimée avec succès.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->redirectToRoute('app_expense_index', [], Response::HTTP_SEE_OTHER);
|
return $this->redirectToRoute('app_expense_index', [], Response::HTTP_SEE_OTHER);
|
||||||
|
|
|
@ -45,6 +45,11 @@ final class FestivalController extends AbstractController
|
||||||
#[Route('/{id}', name: 'app_festival_show', methods: ['GET'])]
|
#[Route('/{id}', name: 'app_festival_show', methods: ['GET'])]
|
||||||
public function show(Festival $festival): Response
|
public function show(Festival $festival): Response
|
||||||
{
|
{
|
||||||
|
$userFound = $this->getUser();
|
||||||
|
if (!$userFound || $festival->getUser() !== $userFound) {
|
||||||
|
throw $this->createAccessDeniedException('Vous n\'êtes pas autorisé à consulter ce festival.');
|
||||||
|
}
|
||||||
|
|
||||||
return $this->render('festival/show.html.twig', [
|
return $this->render('festival/show.html.twig', [
|
||||||
'festival' => $festival,
|
'festival' => $festival,
|
||||||
]);
|
]);
|
||||||
|
@ -53,6 +58,11 @@ final class FestivalController extends AbstractController
|
||||||
#[Route('/{id}/edit', name: 'app_festival_edit', methods: ['GET', 'POST'])]
|
#[Route('/{id}/edit', name: 'app_festival_edit', methods: ['GET', 'POST'])]
|
||||||
public function edit(Request $request, Festival $festival, EntityManagerInterface $entityManager): Response
|
public function edit(Request $request, Festival $festival, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
|
$userFound = $this->getUser();
|
||||||
|
if (!$userFound || $festival->getUser() !== $userFound) {
|
||||||
|
throw $this->createAccessDeniedException('Vous n\'êtes pas autorisé à modifier ce festival.');
|
||||||
|
}
|
||||||
|
|
||||||
$form = $this->createForm(Festival1Type::class, $festival);
|
$form = $this->createForm(Festival1Type::class, $festival);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
@ -71,10 +81,17 @@ final class FestivalController extends AbstractController
|
||||||
#[Route('/{id}', name: 'app_festival_delete', methods: ['POST'])]
|
#[Route('/{id}', name: 'app_festival_delete', methods: ['POST'])]
|
||||||
public function delete(Request $request, Festival $festival, EntityManagerInterface $entityManager): Response
|
public function delete(Request $request, Festival $festival, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
|
$userFound = $this->getUser();
|
||||||
|
if (!$userFound || $festival->getUser() !== $userFound) {
|
||||||
|
throw $this->createAccessDeniedException('Vous n\'êtes pas autorisé à supprimer ce festival.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($this->isCsrfTokenValid('delete'.$festival->getId(), $request->getPayload()->getString('_token'))) {
|
if ($this->isCsrfTokenValid('delete'.$festival->getId(), $request->getPayload()->getString('_token'))) {
|
||||||
$entityManager->remove($festival);
|
$entityManager->remove($festival);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
}
|
}
|
||||||
|
$this->addFlash('success', 'Le festival a été supprimé avec succès.');
|
||||||
|
|
||||||
return $this->redirectToRoute('app_festival_index', [], Response::HTTP_SEE_OTHER);
|
return $this->redirectToRoute('app_festival_index', [], Response::HTTP_SEE_OTHER);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,11 @@ final class ProductController extends AbstractController
|
||||||
#[Route('/{id}', name: 'app_product_show', methods: ['GET'])]
|
#[Route('/{id}', name: 'app_product_show', methods: ['GET'])]
|
||||||
public function show(Product $product): Response
|
public function show(Product $product): Response
|
||||||
{
|
{
|
||||||
|
$userFound = $this->getUser();
|
||||||
|
if (!$userFound || $product->getUser() !== $userFound) {
|
||||||
|
throw $this->createAccessDeniedException('Vous n\'êtes pas autorisé à consulter ce produit.');
|
||||||
|
}
|
||||||
|
|
||||||
return $this->render('product/show.html.twig', [
|
return $this->render('product/show.html.twig', [
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
]);
|
]);
|
||||||
|
@ -60,6 +65,11 @@ final class ProductController extends AbstractController
|
||||||
#[Route('/{id}/edit', name: 'app_product_edit', methods: ['GET', 'POST'])]
|
#[Route('/{id}/edit', name: 'app_product_edit', methods: ['GET', 'POST'])]
|
||||||
public function edit(Request $request, Product $product, EntityManagerInterface $entityManager): Response
|
public function edit(Request $request, Product $product, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
|
$userFound = $this->getUser();
|
||||||
|
if (!$userFound || $product->getUser() !== $userFound) {
|
||||||
|
throw $this->createAccessDeniedException('Vous n\'êtes pas autorisé à modifier ce produit.');
|
||||||
|
}
|
||||||
|
|
||||||
$form = $this->createForm(Product1Type::class, $product);
|
$form = $this->createForm(Product1Type::class, $product);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
@ -71,6 +81,7 @@ final class ProductController extends AbstractController
|
||||||
}
|
}
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
$this->addFlash('success', 'Le produit a été modifié avec succès.');
|
||||||
|
|
||||||
return $this->redirectToRoute('app_product_index', [], Response::HTTP_SEE_OTHER);
|
return $this->redirectToRoute('app_product_index', [], Response::HTTP_SEE_OTHER);
|
||||||
}
|
}
|
||||||
|
@ -84,9 +95,15 @@ final class ProductController extends AbstractController
|
||||||
#[Route('/{id}', name: 'app_product_delete', methods: ['POST'])]
|
#[Route('/{id}', name: 'app_product_delete', methods: ['POST'])]
|
||||||
public function delete(Request $request, Product $product, EntityManagerInterface $entityManager): Response
|
public function delete(Request $request, Product $product, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
|
$userFound = $this->getUser();
|
||||||
|
if (!$userFound || $product->getUser() !== $userFound) {
|
||||||
|
throw $this->createAccessDeniedException('Vous n\'êtes pas autorisé à supprimer ce produit.');
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->isCsrfTokenValid('delete'.$product->getId(), $request->getPayload()->getString('_token'))) {
|
if ($this->isCsrfTokenValid('delete'.$product->getId(), $request->getPayload()->getString('_token'))) {
|
||||||
$entityManager->remove($product);
|
$entityManager->remove($product);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
$this->addFlash('success', 'Le produit a été supprimé avec succès.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->redirectToRoute('app_product_index', [], Response::HTTP_SEE_OTHER);
|
return $this->redirectToRoute('app_product_index', [], Response::HTTP_SEE_OTHER);
|
||||||
|
|
|
@ -14,6 +14,9 @@ class SecurityController extends AbstractController
|
||||||
{
|
{
|
||||||
// get the login error if there is one
|
// get the login error if there is one
|
||||||
$error = $authenticationUtils->getLastAuthenticationError();
|
$error = $authenticationUtils->getLastAuthenticationError();
|
||||||
|
if ($error) {
|
||||||
|
$this->addFlash('error', 'Identifiants invalides.');
|
||||||
|
}
|
||||||
|
|
||||||
// last username entered by the user
|
// last username entered by the user
|
||||||
$lastUsername = $authenticationUtils->getLastUsername();
|
$lastUsername = $authenticationUtils->getLastUsername();
|
||||||
|
|
|
@ -26,6 +26,7 @@ final class SellingController extends AbstractController
|
||||||
#[Route('/new', name: 'app_selling_new', methods: ['GET', 'POST'])]
|
#[Route('/new', name: 'app_selling_new', methods: ['GET', 'POST'])]
|
||||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
|
|
||||||
$selling = new Selling();
|
$selling = new Selling();
|
||||||
$form = $this->createForm(Selling1Type::class, $selling);
|
$form = $this->createForm(Selling1Type::class, $selling);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
@ -46,6 +47,11 @@ final class SellingController extends AbstractController
|
||||||
#[Route('/{id}', name: 'app_selling_show', methods: ['GET'])]
|
#[Route('/{id}', name: 'app_selling_show', methods: ['GET'])]
|
||||||
public function show(Selling $selling): Response
|
public function show(Selling $selling): Response
|
||||||
{
|
{
|
||||||
|
$userFound = $this->getUser();
|
||||||
|
if (!$userFound || $selling->getUser() !== $userFound) {
|
||||||
|
throw $this->createAccessDeniedException('Vous n\'êtes pas autorisé à consulter cette vente.');
|
||||||
|
}
|
||||||
|
|
||||||
return $this->render('selling/show.html.twig', [
|
return $this->render('selling/show.html.twig', [
|
||||||
'selling' => $selling,
|
'selling' => $selling,
|
||||||
]);
|
]);
|
||||||
|
@ -54,6 +60,11 @@ final class SellingController extends AbstractController
|
||||||
#[Route('/{id}/edit', name: 'app_selling_edit', methods: ['GET', 'POST'])]
|
#[Route('/{id}/edit', name: 'app_selling_edit', methods: ['GET', 'POST'])]
|
||||||
public function edit(Request $request, Selling $selling, EntityManagerInterface $entityManager): Response
|
public function edit(Request $request, Selling $selling, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
|
$userFound = $this->getUser();
|
||||||
|
if (!$userFound || $selling->getUser() !== $userFound) {
|
||||||
|
throw $this->createAccessDeniedException('Vous n\'êtes pas autorisé à modifier cette vente.');
|
||||||
|
}
|
||||||
|
|
||||||
$form = $this->createForm(Selling1Type::class, $selling);
|
$form = $this->createForm(Selling1Type::class, $selling);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ final class SerieFestivalController extends AbstractController
|
||||||
#[Route('/{id}', name: 'app_serie_festival_show', methods: ['GET'])]
|
#[Route('/{id}', name: 'app_serie_festival_show', methods: ['GET'])]
|
||||||
public function show(SerieFestival $serieFestival): Response
|
public function show(SerieFestival $serieFestival): Response
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->render('serie_festival/show.html.twig', [
|
return $this->render('serie_festival/show.html.twig', [
|
||||||
'serie_festival' => $serieFestival,
|
'serie_festival' => $serieFestival,
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -269,6 +269,18 @@ class Festival
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateChiffreAffaire(): static
|
||||||
|
{
|
||||||
|
$total = 0;
|
||||||
|
foreach ($this->sellings as $selling) {
|
||||||
|
$total += $selling->getPaidByCustomer();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setChiffreAffaire($total);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function getChiffreAffaire(): ?float
|
public function getChiffreAffaire(): ?float
|
||||||
{
|
{
|
||||||
return $this->chiffreAffaire;
|
return $this->chiffreAffaire;
|
||||||
|
|
|
@ -12,6 +12,7 @@ use \App\Entity\Product;
|
||||||
use \App\Entity\Selling;
|
use \App\Entity\Selling;
|
||||||
use ApiPlatform\Metadata\ApiResource;
|
use ApiPlatform\Metadata\ApiResource;
|
||||||
use Symfony\Component\Serializer\Annotation\Groups;
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
|
use App\Repository\GroupOfProductsRepository;
|
||||||
|
|
||||||
#[ApiResource(paginationEnabled: false)]
|
#[ApiResource(paginationEnabled: false)]
|
||||||
#[ORM\Entity(repositoryClass: GroupOfProductsRepository::class)]
|
#[ORM\Entity(repositoryClass: GroupOfProductsRepository::class)]
|
||||||
|
@ -40,7 +41,7 @@ class GroupOfProducts
|
||||||
private ?Collection $sellings = null;
|
private ?Collection $sellings = null;
|
||||||
|
|
||||||
#[ORM\ManyToOne(inversedBy: 'groupOfProducts')]
|
#[ORM\ManyToOne(inversedBy: 'groupOfProducts')]
|
||||||
private ?User $owner = null;
|
private ?User $user = null;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
@ -132,14 +133,14 @@ class GroupOfProducts
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOwner(): ?User
|
public function getUser(): ?User
|
||||||
{
|
{
|
||||||
return $this->owner;
|
return $this->user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setOwner(?User $owner): static
|
public function setUser(?User $user): static
|
||||||
{
|
{
|
||||||
$this->owner = $owner;
|
$this->user = $user;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ use ApiPlatform\Metadata\Put;
|
||||||
use Symfony\Component\Serializer\Annotation\Groups;
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use App\Repository\SellingRepository;
|
||||||
|
|
||||||
#[ApiResource(
|
#[ApiResource(
|
||||||
operations: [
|
operations: [
|
||||||
|
@ -72,7 +73,8 @@ class Selling
|
||||||
|
|
||||||
#[ORM\ManyToOne(inversedBy: 'sellings')]
|
#[ORM\ManyToOne(inversedBy: 'sellings')]
|
||||||
#[Groups(['selling:read', 'selling:write'])]
|
#[Groups(['selling:read', 'selling:write'])]
|
||||||
private ?User $owner = null;
|
private ?User $user = null;
|
||||||
|
|
||||||
|
|
||||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||||
#[Groups(['selling:read', 'selling:write'])]
|
#[Groups(['selling:read', 'selling:write'])]
|
||||||
|
@ -218,14 +220,18 @@ class Selling
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOwner(): ?User
|
public function getuser(): ?User
|
||||||
|
|
||||||
{
|
{
|
||||||
return $this->owner;
|
return $this->user;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setOwner(?User $owner): static
|
public function setuser(?User $user): static
|
||||||
|
|
||||||
{
|
{
|
||||||
$this->owner = $owner;
|
$this->user = $user;
|
||||||
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,13 +87,13 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
/**
|
/**
|
||||||
* @var Collection<int, GroupOfProducts>
|
* @var Collection<int, GroupOfProducts>
|
||||||
*/
|
*/
|
||||||
#[ORM\OneToMany(targetEntity: GroupOfProducts::class, mappedBy: 'owner')]
|
#[ORM\OneToMany(targetEntity: GroupOfProducts::class, mappedBy: 'user')]
|
||||||
private Collection $groupOfProducts;
|
private Collection $groupOfProducts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Collection<int, Selling>
|
* @var Collection<int, Selling>
|
||||||
*/
|
*/
|
||||||
#[ORM\OneToMany(targetEntity: Selling::class, mappedBy: 'owner')]
|
#[ORM\OneToMany(targetEntity: Selling::class, mappedBy: 'user')]
|
||||||
private Collection $sellings;
|
private Collection $sellings;
|
||||||
|
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
{
|
{
|
||||||
if (!$this->groupOfProducts->contains($groupOfProduct)) {
|
if (!$this->groupOfProducts->contains($groupOfProduct)) {
|
||||||
$this->groupOfProducts->add($groupOfProduct);
|
$this->groupOfProducts->add($groupOfProduct);
|
||||||
$groupOfProduct->setOwner($this);
|
$groupOfProduct->setUser($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -391,8 +391,8 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
{
|
{
|
||||||
if ($this->groupOfProducts->removeElement($groupOfProduct)) {
|
if ($this->groupOfProducts->removeElement($groupOfProduct)) {
|
||||||
// set the owning side to null (unless already changed)
|
// set the owning side to null (unless already changed)
|
||||||
if ($groupOfProduct->getOwner() === $this) {
|
if ($groupOfProduct->getUser() === $this) {
|
||||||
$groupOfProduct->setOwner(null);
|
$groupOfProduct->setUser(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
{
|
{
|
||||||
if (!$this->sellings->contains($selling)) {
|
if (!$this->sellings->contains($selling)) {
|
||||||
$this->sellings->add($selling);
|
$this->sellings->add($selling);
|
||||||
$selling->setOwner($this);
|
$selling->setUser($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -421,8 +421,8 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
{
|
{
|
||||||
if ($this->sellings->removeElement($selling)) {
|
if ($this->sellings->removeElement($selling)) {
|
||||||
// set the owning side to null (unless already changed)
|
// set the owning side to null (unless already changed)
|
||||||
if ($selling->getOwner() === $this) {
|
if ($selling->getUser() === $this) {
|
||||||
$selling->setOwner(null);
|
$selling->setUser(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,9 @@ class Product1Type extends AbstractType
|
||||||
])
|
])
|
||||||
->add('sellings', EntityType::class, [
|
->add('sellings', EntityType::class, [
|
||||||
'class' => Selling::class,
|
'class' => Selling::class,
|
||||||
'choice_label' => 'date',
|
'choice_label' => function(Selling $selling) {
|
||||||
|
return $selling->getDate()->format('Y-m-d');
|
||||||
|
},
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
])
|
])
|
||||||
|
|
|
@ -20,26 +20,7 @@
|
||||||
logged
|
logged
|
||||||
{% endif %}
|
{% endif %}
|
||||||
">
|
">
|
||||||
<!-- Navigation-->
|
|
||||||
{# <nav class="navbar navbar-expand-lg bg-secondary text-uppercase fixed-top" id="mainNav">#}
|
|
||||||
{# <div class="container">#}
|
|
||||||
{# <a class="navbar-brand" href="/#page-top">{% trans %}menu.title{% endtrans %}</a>#}
|
|
||||||
{# <button class="navbar-toggler text-uppercase font-weight-bold bg-primary text-white rounded" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">#}
|
|
||||||
{# Menu#}
|
|
||||||
{# <i class="fas fa-bars"></i>#}
|
|
||||||
{# </button>#}
|
|
||||||
{# <div class="collapse navbar-collapse" id="navbarResponsive">#}
|
|
||||||
{# <ul class="navbar-nav ms-auto">#}
|
|
||||||
|
|
||||||
{# #}
|
|
||||||
{# <li class="nav-item mx-0 mx-lg-1"><a class="nav-link py-3 px-0 px-lg-3 rounded" href="/#about">About</a></li>#}
|
|
||||||
{# <li class="nav-item mx-0 mx-lg-1"><a class="nav-link py-3 px-0 px-lg-3 rounded" href="/#contact">Contact</a></li>#}
|
|
||||||
{# </ul>#}
|
|
||||||
{# </div>#}
|
|
||||||
{# </div>#}
|
|
||||||
|
|
||||||
|
|
||||||
{# </nav>#}
|
|
||||||
{% include 'default/login-choices.html.twig' %}
|
{% include 'default/login-choices.html.twig' %}
|
||||||
<!-- Portfolio Section-->
|
<!-- Portfolio Section-->
|
||||||
<section class="page-section portfolio" id="portfolio">
|
<section class="page-section portfolio" id="portfolio">
|
||||||
|
@ -48,6 +29,16 @@ logged
|
||||||
{% block navigation %}
|
{% block navigation %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<div id="bodyland">
|
<div id="bodyland">
|
||||||
|
|
||||||
|
{% for label, messages in app.flashes %}
|
||||||
|
{% for message in messages %}
|
||||||
|
<div class="alert alert-{{ label }} alert-dismissible fade show" role="alert">
|
||||||
|
{{ message }}
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% block bigMain %}
|
{% block bigMain %}
|
||||||
|
|
||||||
{% include 'default/header.html.twig' %}
|
{% include 'default/header.html.twig' %}
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<form method="post" action="{{ path('app_festival_delete', {'id': festival.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
<form method="post" action="{{ path('app_festival_delete', {'id': festival.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ festival.id) }}">
|
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ festival.id) }}">
|
||||||
<button class="btn">Delete</button>
|
<button class="btn btn-danger delete-button">
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
Delete
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -4,60 +4,55 @@
|
||||||
<form>
|
<form>
|
||||||
|
|
||||||
<div class="new-display">
|
<div class="new-display">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-sm-6">
|
||||||
</div>
|
<button class="btn btn-warning btn-remove-all marged-v" ng-click="removeAll()" ng-disable="!CurrentSellingTotal()">
|
||||||
<div class="row">
|
<i class="fa fa-trash"></i> enlever tout
|
||||||
<div class="col-xs-12 col-sm-6">
|
</button>
|
||||||
<button class="btn btn-warning btn-remove-all marged-v" ng-click="removeAll()" ng-disable="!CurrentSellingTotal()">
|
|
||||||
<i class="fa fa-trash"></i> enlever tout
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div ng-repeat="group in activeSellingFiltered track by $index">
|
||||||
|
<div class="row">
|
||||||
<div ng-repeat="group in activeSellingFiltered track by $index">
|
|
||||||
<div class="row">
|
<div class="col-xs-10">
|
||||||
|
<input class="group-name" type="text" ng-model="group.name">
|
||||||
<div class="col-xs-10">
|
|
||||||
<input class="group-name" type="text" ng-model="group.name">
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-2">
|
|
||||||
<span class="btn btn-warning remove-item"
|
|
||||||
ng-click="removeGroupeProducts(group.groupId)">
|
|
||||||
<i class="fa fa-trash"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="col-xs-2">
|
||||||
<div class="col-xs-7 col-xs-offset-2 ">
|
<span class="btn btn-warning remove-item"
|
||||||
<span ng-if="group.count > 1">
|
ng-click="removeGroupeProducts(group.groupId)">
|
||||||
<strong>
|
<i class="fa fa-trash"></i>
|
||||||
{{group.unitPrice}}
|
</span>
|
||||||
€ </strong>
|
</div>
|
||||||
</span>
|
</div>
|
||||||
<span class="badge badge-default" ng-if="group.count">
|
<div class="row">
|
||||||
<i class="fa fa-times"></i> {{group.count}}
|
<div class="col-xs-7 col-xs-offset-2 ">
|
||||||
</span>
|
<span ng-if="group.count > 1">
|
||||||
</div>
|
|
||||||
<div class="col-xs-3 text-right">
|
|
||||||
<strong>
|
<strong>
|
||||||
{{group.totalPrice}}
|
{{group.unitPrice}}
|
||||||
€ </strong>
|
€ </strong>
|
||||||
</div>
|
</span>
|
||||||
|
<span class="badge badge-default" ng-if="group.count">
|
||||||
|
<i class="fa fa-times"></i> {{group.count}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 text-right">
|
||||||
|
<strong>
|
||||||
|
{{group.totalPrice}}
|
||||||
|
€ </strong>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
{% endverbatim %}
|
{% endverbatim %}
|
||||||
{% include 'logged/angular/totals.html.twig' %}
|
{% include 'logged/angular/totals.html.twig' %}
|
||||||
{% include 'logged/angular/validate-button.html.twig' %}
|
{% include 'logged/angular/validate-button.html.twig' %}
|
||||||
{% include 'logged/angular/pause-selling.html.twig' %}
|
{% include 'logged/angular/pause-selling.html.twig' %}
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<!--ok loading done-->
|
<!--ok loading done-->
|
||||||
<div id="loaded" ng-if="initLoadDone">
|
<div id="loaded" ng-if="initLoadDone">
|
||||||
<!--caisse IHM-->
|
<!--caisse IHM-->
|
||||||
<div id="load_ok" class="row">
|
<div id="load_ok" class="columns">
|
||||||
<div id="listing-products" class="listing-products col-xs-12 col-md-8">
|
<div id="listing-products" class="listing-products">
|
||||||
{% include 'logged/angular/messages.html.twig' %}
|
{% include 'logged/angular/messages.html.twig' %}
|
||||||
{% include 'logged/angular/listing-products.html.twig' %}
|
{% include 'logged/angular/listing-products.html.twig' %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="sellings" class="sellings col-xs-12 col-md-4">
|
<div id="sellings" class="sellings">
|
||||||
|
|
||||||
<div class="list-sell" ng-class="{'bg-success text-success': sellingOk }">
|
<div class="list-sell" ng-class="{'bg-success text-success': sellingOk }">
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
{% block title %}Product index{% endblock %}
|
{% block title %}Product index{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
|
||||||
|
|
||||||
<h1>Product index</h1>
|
<h1>Product index</h1>
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
@ -14,6 +16,7 @@
|
||||||
<th>Stock</th>
|
<th>Stock</th>
|
||||||
<th>Image</th>
|
<th>Image</th>
|
||||||
<th>Comment</th>
|
<th>Comment</th>
|
||||||
|
<th>Utilisateur-ice</th>
|
||||||
<th>actions</th>
|
<th>actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -24,8 +27,13 @@
|
||||||
<td>{{ product.name }}</td>
|
<td>{{ product.name }}</td>
|
||||||
<td>{{ product.price }}</td>
|
<td>{{ product.price }}</td>
|
||||||
<td>{{ product.stock }}</td>
|
<td>{{ product.stock }}</td>
|
||||||
<td>{{ product.image }}</td>
|
<td>
|
||||||
|
<a href="{{ path('app_product_show', {'id': product.id}) }}">
|
||||||
|
<img src="{{ product.image }}" alt="{{ product.name }}" style="width: 100px; height: 100px;">
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td>{{ product.comment }}</td>
|
<td>{{ product.comment }}</td>
|
||||||
|
<td>{{ product.user.name }}, {{ product.user.email }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ path('app_product_show', {'id': product.id}) }}">show</a>
|
<a href="{{ path('app_product_show', {'id': product.id}) }}">show</a>
|
||||||
<a href="{{ path('app_product_edit', {'id': product.id}) }}">edit</a>
|
<a href="{{ path('app_product_edit', {'id': product.id}) }}">edit</a>
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<form method="post" action="{{ path('app_serie_festival_delete', {'id': serie_festival.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
<form method="post" action="{{ path('app_serie_festival_delete', {'id': serie_festival.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ serie_festival.id) }}">
|
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ serie_festival.id) }}">
|
||||||
<button class="btn">Delete</button>
|
<button class="btn btn-danger delete-button">
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
Delete
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in New Issue