initial commit

This commit is contained in:
helmi committed 2022-04-02 15:44:07 +02:00
1 parent 5b0c8ce994
commit 583001efd8
93 files changed
+66076

No files matched your search

File diff suppressed because it is too large. Load diff
+112
View File
@@ -0,0 +1,112 @@
Object.size = function(obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
};
function addtocart(quant, produktid, korbid) {
$.post(
"/cart/add",
{'quant': quant, 'produktid': produktid, 'korbid': korbid},
function (data) {
console.log("add: ", data);
if (data) {
//do something
}
}
);
}
function getcart(korbid) {
$.post("/cart/getcart",
{'korbid': korbid},
function(data){
var size = Object.size(data);
for(var i = 0; i < size; i++) {
if (data[i][0]>0){
getprodukt(data[i][1], data[i][0]);
}
}
});
setTimeout(function(){
$.getScript("https://test.alc.gmbh/static/js/warenkorb.js", function() {
console.log("warenkorb.js loaded");
});
}, 1500);
}
function removefromcart(produktid, korbid) {
$.post(
"/cart/remove",
{'korbid': korbid, 'produktid': produktid},
function (data) {
console.log("remove: ", data);
if (data) {
//do something
}
}
);
}
function changequant(quant, produktid, korbid) {
$.post(
"/cart/changequant",
{'quant': quant, 'produktid': produktid, 'korbid': korbid},
function (data) {
console.log("changequant: ", data);
if (data) {
//do something
}
}
);
}
function getprodukt(produktid, quant) {
$.post(
"/cart/getprodukt",
{'produktid': produktid},
function (data) {
fullprice = parseFloat(quant) * parseFloat(data.preis);
$("#cart").prepend('<article class="product"><header><a class="remove" data-aaa="'+ data.id +'"> \
<img src="'+ data.bildlink +'" alt=""> \
<h3>Produkt entfernen</h3> \
</a>\
</header>\
<div class="content">\
<h1>'+ data.titel +'</h1>\
'+ data.kurzbeschreibung +'\
</div>\
<footer class="content" data-aaa="'+ data.id +'">\
<span class="qt-minus">-</span>\
<span class="qt">'+ quant +'</span>\
<span class="qt-plus">+</span>\
<h2 class="full-price">\
'+ fullprice +'€\
</h2>\
<h2 class="price">\
'+ data.preis +'€\
</h2>\
</footer>\
</article>');
return data;
}
);
}
$(document).ready(function(){
$(".cart-btn").click(function(){
var el = $(this);
cartid = document.getElementById("gcartid").innerHTML;
//console.log(cartid);
//console.log( $(this).data('produkt'));
addtocart("1", $(this).data('produkt'), cartid)
$("#modal1").modal();
console.log("modal open");
});
});
+125
View File
@@ -0,0 +1,125 @@
function load(){
getcartcheckout(1);
getadress(1);
}
Object.size = function(obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
};
function getcartcheckout(korbid) {
$.post("/cart/getcart",
{'korbid': korbid},
function(data){
var size = Object.size(data);
for(var i = 0; i < size; i++) {
if (data[i][0]>0){
getproduktcheckout(data[i][1], data[i][0]);
}
}
});
}
function getproduktcheckout(produktid, quant) {
$.post(
"/cart/getprodukt",
{'produktid': produktid},
function (data) {
fullprice = parseFloat(quant) * parseFloat(data.preis);
$("#cartshort").prepend('<div class="row">\
<div class="col-md-4">\
<img src="https://test.alc.gmbh/'+ data.bildlink +'"class="rounded-3" style="width: 100px;" alt="'+ data.id +'" />\
</div>\
<div class="col-md-6 ms-3"><span class="mb-0 text-price">'+ fullprice +'€</span>\
<p class="mb-0 text-descriptions">'+ data.titel +'</p>\
<span class="text-descriptions fw-bold">'+ data.kurzbeschreibung +'</span>\
<span class="text-descriptions fw-bold">per Stück '+ data.preis +'€</span>\
<p class="text-descriptions mt-0">Anzahl: \
<span class="text-descriptions fw-bold">'+ quant +'</span>\
</p>\
</div> </div>');
return data;
}
);
}
function addadress() {
name = document.getElementById("name").value;
firma = document.getElementById("firma").value;
uid = document.getElementById("uid").value;
straße = document.getElementById("straße").value;
plz = document.getElementById("plz").value;
land = document.getElementById("land").value;
user_id = "1";
console.log(name)
$.post(
"/checkout/addaddress",
{'name': name, 'firma': firma, 'uid': uid, 'straße': straße, 'plz': plz, 'land': land, 'user_id': user_id},
function (data) {
if (data) {
}
}
);
}
function getadress(userid, ) {
$.post(
"/checkout/getadress",
{'userid': userid},
function (data) {
var size = Object.size(data);
for(var i = 0; i < size; i++) {
$("#Lieferadressecheckbox").prepend('<div class="address">\
<p>'+ data[i][0] +'<br>\
'+ data[i][1] +'<br>\
'+ data[i][2] +'<br>\
'+ data[i][3] +'</p>\
</div>');
console.log(data[i][0]);
console.log(data[i][1]);
console.log(data[i][2]);
console.log(data[i][3]);
console.log(data[i][4]);
if (data[i][3]==""){
$("#Rechnugsaddressecheckbox").prepend('<div class="address">\
<p>'+ data[i][0] +'<br>\
'+ data[i][1] +'<br>\
'+ data[i][2] +'</p>\
</div>');
}else{
$("#Rechnugsaddressecheckbox").prepend('<div class="address">\
<p>'+ data[i][1] +'<br>\
'+ data[i][4] +'<br>\
'+ data[i][2] +'<br>\
'+ data[i][3] +'</p>\
</div>');
}
}
return data;
}
);
}
$("#ready-btn").click(function(){
$("#orderform").submit();
//$(".remove").click();
});
+178
View File
@@ -0,0 +1,178 @@
jQuery( document ).ready(function( $ ) {
"use strict";
$(function() {
$( "#tabs" ).tabs();
});
// Page loading animation
$("#preloader").animate({
'opacity': '0'
}, 600, function(){
setTimeout(function(){
$("#preloader").css("visibility", "hidden").fadeOut();
}, 300);
});
$(window).scroll(function() {
var scroll = $(window).scrollTop();
var box = $('.header-text').height();
var header = $('header').height();
if (scroll >= box - header) {
$("header").addClass("background-header");
} else {
$("header").removeClass("background-header");
}
});
if ($('.owl-clients').length) {
$('.owl-clients').owlCarousel({
loop: true,
nav: false,
dots: true,
items: 1,
margin: 30,
autoplay: false,
smartSpeed: 700,
autoplayTimeout: 6000,
responsive: {
0: {
items: 1,
margin: 0
},
460: {
items: 1,
margin: 0
},
576: {
items: 3,
margin: 20
},
992: {
items: 5,
margin: 30
}
}
});
}
if ($('.owl-testimonials').length) {
$('.owl-testimonials').owlCarousel({
loop: true,
nav: false,
dots: true,
items: 1,
margin: 30,
autoplay: false,
smartSpeed: 700,
autoplayTimeout: 6000,
responsive: {
0: {
items: 1,
margin: 0
},
460: {
items: 1,
margin: 0
},
576: {
items: 2,
margin: 20
},
992: {
items: 2,
margin: 30
}
}
});
}
if ($('.owl-banner').length) {
$('.owl-banner').owlCarousel({
loop: true,
nav: false,
dots: true,
items: 1,
margin: 0,
autoplay: false,
smartSpeed: 700,
autoplayTimeout: 6000,
responsive: {
0: {
items: 1,
margin: 0
},
460: {
items: 1,
margin: 0
},
576: {
items: 1,
margin: 20
},
992: {
items: 1,
margin: 30
}
}
});
}
$(".Modern-Slider").slick({
autoplay:true,
autoplaySpeed:10000,
speed:600,
slidesToShow:1,
slidesToScroll:1,
pauseOnHover:false,
dots:true,
pauseOnDotsHover:true,
cssEase:'linear',
// fade:true,
draggable:false,
prevArrow:'<button class="PrevArrow"></button>',
nextArrow:'<button class="NextArrow"></button>',
});
$('.filters ul li').click(function(){
$('.filters ul li').removeClass('active');
$(this).addClass('active');
var data = $(this).attr('data-filter');
$grid.isotope({
filter: data
})
});
var $grid = $(".grid").isotope({
itemSelector: ".all",
percentPosition: true,
masonry: {
columnWidth: ".all"
}
})
$('.accordion > li:eq(0) a').addClass('active').next().slideDown();
$('.accordion a').click(function(j) {
var dropDown = $(this).closest('li').find('.content');
$(this).closest('.accordion').find('.content').not(dropDown).slideUp();
if ($(this).hasClass('active')) {
$(this).removeClass('active');
} else {
$(this).closest('.accordion').find('a.active').removeClass('active');
$(this).addClass('active');
}
dropDown.stop(false, true).slideToggle();
j.preventDefault();
});
});
+12
View File
@@ -0,0 +1,12 @@
/*!
* Isotope PACKAGED v3.0.4
*
* Licensed GPLv3 for open source use
* or Isotope Commercial License for commercial use
*
* http://isotope.metafizzy.co
* Copyright 2017 Metafizzy
*/
!function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,s,a){function u(t,e,o){var n,s="$()."+i+'("'+e+'")';return t.each(function(t,u){var h=a.data(u,i);if(!h)return void r(i+" not initialized. Cannot call methods, i.e. "+s);var d=h[e];if(!d||"_"==e.charAt(0))return void r(s+" is not a valid method");var l=d.apply(h,o);n=void 0===n?l:n}),void 0!==n?n:t}function h(t,e){t.each(function(t,o){var n=a.data(o,i);n?(n.option(e),n._init()):(n=new s(o,e),a.data(o,i,n))})}a=a||e||t.jQuery,a&&(s.prototype.option||(s.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=n.call(arguments,1);return u(this,t,e)}return h(this,t),this},o(a))}function o(t){!t||t&&t.bridget||(t.bridget=i)}var n=Array.prototype.slice,s=t.console,r="undefined"==typeof s?function(){}:function(t){s.error(t)};return o(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},o=i[t]=i[t]||[];return o.indexOf(e)==-1&&o.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},o=i[t]=i[t]||{};return o[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var o=i.indexOf(e);return o!=-1&&i.splice(o,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var o=0,n=i[o];e=e||[];for(var s=this._onceEvents&&this._onceEvents[t];n;){var r=s&&s[n];r&&(this.off(t,n),delete s[n]),n.apply(this,e),o+=r?0:1,n=i[o]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=t.indexOf("%")==-1&&!isNaN(e);return i&&e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e<h;e++){var i=u[e];t[i]=0}return t}function o(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}function n(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var n=o(e);s.isBoxSizeOuter=r=200==t(n.width),i.removeChild(e)}}function s(e){if(n(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var s=o(e);if("none"==s.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==s.boxSizing,l=0;l<h;l++){var f=u[l],c=s[f],m=parseFloat(c);a[f]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,y=a.paddingTop+a.paddingBottom,g=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,I=a.borderTopWidth+a.borderBottomWidth,z=d&&r,x=t(s.width);x!==!1&&(a.width=x+(z?0:p+_));var S=t(s.height);return S!==!1&&(a.height=S+(z?0:y+I)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(y+I),a.outerWidth=a.width+g,a.outerHeight=a.height+v,a}}var r,a="undefined"==typeof console?e:function(t){console.error(t)},u=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],h=u.length,d=!1;return s}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i<e.length;i++){var o=e[i],n=o+"MatchesSelector";if(t[n])return n}}();return function(e,i){return e[t](i)}}),function(t,e){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["desandro-matches-selector/matches-selector"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("desandro-matches-selector")):t.fizzyUIUtils=e(t,t.matchesSelector)}(window,function(t,e){var i={};i.extend=function(t,e){for(var i in e)t[i]=e[i];return t},i.modulo=function(t,e){return(t%e+e)%e},i.makeArray=function(t){var e=[];if(Array.isArray(t))e=t;else if(t&&"object"==typeof t&&"number"=Line truncated
var e;t?(t=n.makeArray(t),e=this.getItems(t)):e=this.items,this._getSorters(),this._updateItemsSortData(e)},l._getSorters=function(){var t=this.options.getSortData;for(var e in t){var i=t[e];this._sorters[e]=f(i)}},l._updateItemsSortData=function(t){for(var e=t&&t.length,i=0;e&&i<e;i++){var o=t[i];o.updateSortData()}};var f=function(){function t(t){if("string"!=typeof t)return t;var i=h(t).split(" "),o=i[0],n=o.match(/^\[(.+)\]$/),s=n&&n[1],r=e(s,o),a=d.sortDataParsers[i[1]];return t=a?function(t){return t&&a(r(t))}:function(t){return t&&r(t)}}function e(t,e){return t?function(e){return e.getAttribute(t)}:function(t){var i=t.querySelector(e);return i&&i.textContent}}return t}();d.sortDataParsers={parseInt:function(t){return parseInt(t,10)},parseFloat:function(t){return parseFloat(t)}},l._sort=function(){if(this.options.sortBy){var t=n.makeArray(this.options.sortBy);this._getIsSameSortBy(t)||(this.sortHistory=t.concat(this.sortHistory));var e=a(this.sortHistory,this.options.sortAscending);this.filteredItems.sort(e)}},l._getIsSameSortBy=function(t){for(var e=0;e<t.length;e++)if(t[e]!=this.sortHistory[e])return!1;return!0},l._mode=function(){var t=this.options.layoutMode,e=this.modes[t];if(!e)throw new Error("No layout mode: "+t);return e.options=this.options[t],e},l._resetLayout=function(){e.prototype._resetLayout.call(this),this._mode()._resetLayout()},l._getItemLayoutPosition=function(t){return this._mode()._getItemLayoutPosition(t)},l._manageStamp=function(t){this._mode()._manageStamp(t)},l._getContainerSize=function(){return this._mode()._getContainerSize()},l.needsResizeLayout=function(){return this._mode().needsResizeLayout()},l.appended=function(t){var e=this.addItems(t);if(e.length){var i=this._filterRevealAdded(e);this.filteredItems=this.filteredItems.concat(i)}},l.prepended=function(t){var e=this._itemize(t);if(e.length){this._resetLayout(),this._manageStamps();var i=this._filterRevealAdded(e);this.layoutItems(this.filteredItems),this.filteredItems=i.concat(this.filteredItems),this.items=e.concat(this.items)}},l._filterRevealAdded=function(t){var e=this._filter(t);return this.hide(e.needHide),this.reveal(e.matches),this.layoutItems(e.matches,!0),e.matches},l.insert=function(t){var e=this.addItems(t);if(e.length){var i,o,n=e.length;for(i=0;i<n;i++)o=e[i],this.element.appendChild(o.element);var s=this._filter(e).matches;for(i=0;i<n;i++)e[i].isLayoutInstant=!0;for(this.arrange(),i=0;i<n;i++)delete e[i].isLayoutInstant;this.reveal(s)}};var c=l.remove;return l.remove=function(t){t=n.makeArray(t);var e=this.getItems(t);c.call(this,t);for(var i=e&&e.length,o=0;i&&o<i;o++){var s=e[o];n.removeFrom(this.filteredItems,s)}},l.shuffle=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];e.sortData.random=Math.random()}this.options.sortBy="random",this._sort(),this._layout()},l._noTransition=function(t,e){var i=this.options.transitionDuration;this.options.transitionDuration=0;var o=t.apply(this,e);return this.options.transitionDuration=i,o},l.getFilteredItemElements=function(){return this.filteredItems.map(function(t){return t.element})},d});
+57
View File
@@ -0,0 +1,57 @@
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
let expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getcartid(){
cartid = getCookie('cartid');
//console.log(cartid);
if (cartid == null || cartid == ""){
//console.log("not there");
$.post(
"/cart/create",
{'check': "167209"},
function (data) {
if (data) {
setCookie("cartid",data, 180);
document.getElementById("gcartid").innerHTML = data;
cartid = data;
}
}
);
}else{
document.getElementById("gcartid").innerHTML = cartid;
//console.log("there");
}
return cartid
}
window.onload = function WindowLoad(event) {
cartid = getcartid();
console.log(cartid)
if (typeof getcart === "function"){
//console.log("isfunction")
getcart(cartid);
}
if (typeof getcartcheckout === "function"){
//console.log("isfunction2")
getcartcheckout(cartid);
}
}
+3448
View File
File diff suppressed because it is too large. Load diff
+2892
View File
File diff suppressed because it is too large. Load diff
+110
View File
@@ -0,0 +1,110 @@
function changeVal(el) {
var qt = parseFloat(el.parent().children(".qt").html());
var price = parseFloat(el.parent().children(".price").html());
var eq = Math.round(price * qt * 100) / 100;
el.parent().children(".full-price").html( eq + "€" );
changeTotal();
}
function changeTotal() {
var price = 0;
$(".full-price").each(function(index){
price += parseFloat($(".full-price").eq(index).html());
});
price = Math.round(price * 100) / 100;
var tax = Math.round(price * 0.2 * 100) / 100
var shipping = parseFloat($(".shipping span").html());
var fullPrice = Math.round((price + tax + shipping) *100) / 100;
if(price == 0) {
fullPrice = 0;
}
$(".subtotal span").html(price);
$(".tax span").html(tax);
$(".total span").html(fullPrice);
}
$(document).ready(function(){
$(".remove").click(function(){
var el = $(this);
cartid = document.getElementById("gcartid").innerHTML;
removefromcart($(this).data('aaa'), cartid);
el.parent().parent().addClass("removed");
window.setTimeout(
function(){
el.parent().parent().slideUp('fast', function() {
el.parent().parent().remove();
if($(".product").length == 0) {
$("#cart").html("<h1>No products!</h1>");
}
changeTotal();
});
}, 200);
});
$(".qt-plus").click(function(){
$(this).parent().children(".qt").html(parseInt($(this).parent().children(".qt").html()) + 1);
cartid = document.getElementById("gcartid").innerHTML;
changequant(parseInt($(this).parent().children(".qt").html()), $(this).parent().data('aaa'), cartid);
$(this).parent().children(".full-price").addClass("added");
var el = $(this);
window.setTimeout(function(){el.parent().children(".full-price").removeClass("added"); changeVal(el);}, 150);
});
$(".qt-minus").click(function(){
child = $(this).parent().children(".qt");
if(parseInt(child.html()) > 1) {
child.html(parseInt(child.html()) - 1);
}
cartid = document.getElementById("gcartid").innerHTML;
changequant(parseInt($(this).parent().children(".qt").html()), $(this).parent().data('aaa'), cartid);
$(this).parent().children(".full-price").addClass("minused");
var el = $(this);
window.setTimeout(function(){el.parent().children(".full-price").removeClass("minused"); changeVal(el);}, 150);
});
window.setTimeout(function(){$(".is-open").removeClass("is-open")}, 1200);
$(".btn").click(function(){
var price = 0;
$(".full-price").each(function(index){
price += parseFloat($(".full-price").eq(index).html());
});
price = Math.round(price * 100) / 100;
var tax = Math.round(price * 0.05 * 100) / 100
var shipping = parseFloat($(".shipping span").html());
var fullPrice = Math.round((price + tax + shipping) *100) / 100;
if(price == 0) {
fullPrice = 0;
}
$("#netto").val(price);
$("#mwst").val(tax);
$("#brutto").val(fullPrice);
$("#checkoutform").submit();
//$(".remove").click();
});
});