Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function acceptance() {
- let company = $('input').eq(0);
- let prodName = $('input').eq(1);
- let quantity = $('input').eq(2);
- let scrape = $('input').eq(3);
- let allPresent = company.val().trim() && prodName.val().trim() && quantity.val().trim() && scrape.val().trim();
- if(allPresent && typeof +quantity.val() === "number" && typeof +scrape.val() === "number") {
- if(+quantity.val() - +scrape.val() > 0) {
- let ware = $('#warehouse');
- let prodInfo = $('<div>');
- let p = $('<p>').text(`[${company.val()}] ${prodName.val()} - ${+quantity.val() - +scrape.val()} pieces`);
- let button = $('<button>')
- .attr('type', 'button')
- .text('Out of Stock')
- .on('click', function (ev) {
- ev.target.parentNode.remove();
- });
- prodInfo.append(p, button);
- ware.append(prodInfo);
- }
- }
- company.val('');
- prodName.val('');
- quantity.val('');
- scrape.val('');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement