From: Kilian Saffran Date: Fri, 3 Sep 2021 10:28:59 +0000 (+0200) Subject: article video function added X-Git-Url: http://cloud.dks.lu/git/?a=commitdiff_plain;h=7b5af796c3f836c15fbbf6132f67e14fd3706255;p=qube.git article video function added --- diff --git a/api/bin/getapidata.pl b/api/bin/getapidata.pl index 353b36c..139adf5 100644 --- a/api/bin/getapidata.pl +++ b/api/bin/getapidata.pl @@ -535,15 +535,46 @@ if ($onlyget == 0){ if ($cpr != 0){ $api->writelog("cmd failed:".$cmd."!"); } - $agfiche = $db->exec($upselsql); $cmd = 'rsync -av '.$cfg->{datapath}.'/art_bro_pdf/ '.$cfg->{mediapath}.'brochure/'; $cpr = system($cmd); if ($cpr != 0){ $api->writelog("cmd failed:".$cmd."!"); } } - + + $api->writelog("update article_groups brochure..."); + $upselsql = "update wiges_ole_article as woa, article_groups as ag + set ag.brochure = case when woa.nom_fichier is null then null else replace(replace(woa.nom_fichier,'art_brochure','brochure'),'art_bro_pdf','brochure') end + where woa.article = ag.article and woa.code_document in ('art_brochure','art_bro_pdf') ; "; + if ($cfg->{dryrun} == 1){ + print $upselsql."\n"; + } else { + my $agfiche = $db->exec($upselsql); + my $cmd = 'rsync -av '.$cfg->{datapath}.'/art_brochure/ '.$cfg->{mediapath}.'brochure/'; + my $cpr = system($cmd); + if ($cpr != 0){ + $api->writelog("cmd failed:".$cmd."!"); + } + $cmd = 'rsync -av '.$cfg->{datapath}.'/art_bro_pdf/ '.$cfg->{mediapath}.'brochure/'; + $cpr = system($cmd); + if ($cpr != 0){ + $api->writelog("cmd failed:".$cmd."!"); + } + } + + $api->writelog("update article_groups video..."); + $upselsql = "update wiges_ole_article as woa, article_groups as ag + set ag.videolink = case when woa.commentaire is null then null else woa.commentaire end + where woa.article = ag.article and woa.code_document in ('art_video');"; + if ($cfg->{dryrun} == 1){ + print $upselsql."\n"; + } else { + my $agfiche = $db->exec($upselsql); + } + + $api->writelog("End Copy article_groups..."); + } if ($steps =~ /articles,/){ $api->writelog("copy articles..."); @@ -610,6 +641,15 @@ if ($onlyget == 0){ if ($cpr != 0){ $api->writelog("cmd failed:".$cmd."!"); } + $api->writelog("update article_groups video..."); + my $upselsql = "update wiges_ole_article as woa, articles as ag + set ag.videolink = case when woa.commentaire is null then null else woa.commentaire end + where woa.article = ag.article and woa.code_document in ('art_video');"; + if ($cfg->{dryrun} == 1){ + print $upselsql."\n"; + } else { + my $agvid = $db->exec($upselsql); + } #} # foreach my $r (@{$agfiche}){ # if (-e $cfg->{datapath}.'/'.$r->{nom_fichier}){ diff --git a/public_html/qubeshop/lib/lang/fr.php b/public_html/qubeshop/lib/lang/fr.php index 4521cf0..96715d8 100644 --- a/public_html/qubeshop/lib/lang/fr.php +++ b/public_html/qubeshop/lib/lang/fr.php @@ -6,6 +6,7 @@ "cancel" => "Abondonner", "save" => "Sauvegarder", "ok" => "OK", + "close" => "Fermer", "groupname" => "Groupe", "filter" => "filtrer...", "clientaccess" => "Accès Shop", @@ -63,6 +64,7 @@ "msgccc" => "Contrat Cadre qui a été négociée individuellement pour votre entreprise", "lblccc" => "VOIR LES PRODUITS", "msgorders" => "Les commandes que vous avez envoyés via le shop en ligne

", - "lblorders" => "VOIR MES COMMANDES" + "lblorders" => "VOIR MES COMMANDES", + "video" => "Video", ); ?> \ No newline at end of file diff --git a/public_html/qubeshop/log/logintest.log b/public_html/qubeshop/log/logintest.log index 83ddf95..2720233 100644 --- a/public_html/qubeshop/log/logintest.log +++ b/public_html/qubeshop/log/logintest.log @@ -68,3 +68,43 @@ USER: select id,usertype from users where lower(useremail)=lower('ksaffran@dks.l [id] => ef3b63ab-24a5-4972-86fb-8c3a4f36e75c [usertype] => admin ) +USER: select id,usertype from users where lower(useremail)=lower('ksaffran@dks.lu') and userpassword = 'a1b496fa520a1c52edd076ca7a59e56667e7ebeb5ba5ba966d2d01628e165359' and userpassword is not null and userpassword != '' and isenabled='1'; - USER: select id,usertype from users where lower(useremail)=lower('ksaffran@dks.lu') and userpassword = '0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec' and userpassword is not null and userpassword != '' and isenabled='1'; - Array +( + [id] => ef3b63ab-24a5-4972-86fb-8c3a4f36e75c + [usertype] => admin +) +USER: select id,usertype from users where lower(useremail)=lower('ksaffran@dks.lu') and userpassword = '0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec' and userpassword is not null and userpassword != '' and isenabled='1'; - Array +( + [id] => ef3b63ab-24a5-4972-86fb-8c3a4f36e75c + [usertype] => admin +) +USER: select id,usertype from users where lower(useremail)=lower('ksaffran@dks.lu') and userpassword = '0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec' and userpassword is not null and userpassword != '' and isenabled='1'; - Array +( + [id] => ef3b63ab-24a5-4972-86fb-8c3a4f36e75c + [usertype] => admin +) +USER: select id,usertype from users where lower(useremail)=lower('ksaffran@dks.lu') and userpassword = '0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec' and userpassword is not null and userpassword != '' and isenabled='1'; - Array +( + [id] => ef3b63ab-24a5-4972-86fb-8c3a4f36e75c + [usertype] => admin +) +USER: select id,usertype from users where lower(useremail)=lower('ksaffran@dks.lu') and userpassword = '0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec' and userpassword is not null and userpassword != '' and isenabled='1'; - Array +( + [id] => ef3b63ab-24a5-4972-86fb-8c3a4f36e75c + [usertype] => admin +) +USER: select id,usertype from users where lower(useremail)=lower('ksaffran@dks.lu') and userpassword = '0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec' and userpassword is not null and userpassword != '' and isenabled='1'; - Array +( + [id] => ef3b63ab-24a5-4972-86fb-8c3a4f36e75c + [usertype] => admin +) +USER: select id,usertype from users where lower(useremail)=lower('ksaffran@dks.lu') and userpassword = '0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec' and userpassword is not null and userpassword != '' and isenabled='1'; - Array +( + [id] => ef3b63ab-24a5-4972-86fb-8c3a4f36e75c + [usertype] => admin +) +USER: select id,usertype from users where lower(useremail)=lower('ksaffran@dks.lu') and userpassword = '0ecf731e2426a8a469f06e9f4a3bcbed6f8071d9d3e3ef7ef5fd9165021e27ec' and userpassword is not null and userpassword != '' and isenabled='1'; - Array +( + [id] => ef3b63ab-24a5-4972-86fb-8c3a4f36e75c + [usertype] => admin +) diff --git a/public_html/qubeshop/tmpl/dialogs/dlgvideo.html b/public_html/qubeshop/tmpl/dialogs/dlgvideo.html new file mode 100644 index 0000000..9b39c7e --- /dev/null +++ b/public_html/qubeshop/tmpl/dialogs/dlgvideo.html @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/public_html/qubeshop/tmpl/index.html b/public_html/qubeshop/tmpl/index.html index c46082d..d5400bb 100644 --- a/public_html/qubeshop/tmpl/index.html +++ b/public_html/qubeshop/tmpl/index.html @@ -56,6 +56,7 @@ + {#
#} @@ -65,12 +66,14 @@
{{ include('dialogs/dlgconfirm.html') }} {{ include('dialogs/dlgmessage.html') }} + {{ include('dialogs/dlgvideo.html') }} + diff --git a/public_html/qubeshop/tmpl/js/myapp.js b/public_html/qubeshop/tmpl/js/myapp.js index e69e02f..28fbebf 100644 --- a/public_html/qubeshop/tmpl/js/myapp.js +++ b/public_html/qubeshop/tmpl/js/myapp.js @@ -56,6 +56,25 @@ let myapp = { document.getElementById('dlgmessage').style.display='block'; return false; }, + dlgvideo: function(url){ + let service = {}; + if (matches = url.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=)([^#\&\?]*).*/)) { + service.provider = "youtube"; + service.id = matches[2]; + } else if (matches = url.match(/https?:\/\/(?:www\.)?vimeo.com\/(?:channels\/|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)/)) { + service.provider = "vimeo"; + service.id = matches[3]; + } + let embedLink=""; + if (service.provider === 'youtube') { + embedLink = 'https://www.youtube.com/embed/' + service.id; + } else if (service.provider === 'vimeo') { + embedLink = 'https://player.vimeo.com/video/' + service.id; + } + document.getElementById('dlgvideo_src').src= embedLink; + document.getElementById('dlgvideo').style.display='block'; + return false; + }, setpref: function(key,value){ db.execAsync("REPLACE INTO defaultdata (id,pref) VALUES ('"+key+"','"+value+"');").then(res => { //myapp.loadpreferences(); diff --git a/public_html/qubeshop/tmpl/js/shop.js b/public_html/qubeshop/tmpl/js/shop.js index 002ae4c..6739207 100644 --- a/public_html/qubeshop/tmpl/js/shop.js +++ b/public_html/qubeshop/tmpl/js/shop.js @@ -25,6 +25,13 @@ let shop= { select: "#askprice_type", showSearch: false }); + shop.selects["ccaddress"] = new SlimSelect({ + select: "#ccaddress", + showSearch: false, + afterClose: function(){ + shop.setAddress(); + } + }); shop.tblgroups = new Tabulator("#tbl_groups", { height: "calc(100vh - 158px)", layout: "fitDataStretch", @@ -123,7 +130,7 @@ let shop= { setArticleGroup: function(gdx,grpdata,articledata,type){ //console.log("artdata",articledata); let grparticle = grpdata['article']; - //console.log("Group Article",grparticle); + let strartgrp = '
'+ '
'+ '
image
'+ @@ -134,8 +141,9 @@ let shop= { ((grpdata.brochure != null)?'':'')+ ((grpdata.fichetechnique != null)?'':'')+ ((grpdata.noticemontage != null)?'':'')+ + ((grpdata.videolink != null)?'':'')+ '
'+ '
'+ ''; - //onsole.log("grp",grparticle); + //console.log("grp",grparticle); //console.log("adata",articledata); //console.log("articledata",articledata[grparticle]); let stf= shop.getCounterfield([grpdata.c01_label,grpdata.c02_label,grpdata.c03_label,grpdata.c04_label,grpdata.c05_label],((articledata[grparticle])?articledata[grparticle][0].unite_quantite:null)); @@ -194,9 +202,11 @@ let shop= { strartgrp += ' '; // strartgrp += ''+ ((articledata[grparticle][adx].prix_net && articledata[grparticle][adx].prix_net != '0.0000')?articledata[grparticle][adx].prix_net.replace(/\./,',')+ ' €':' ')+''; } - strartgrp += '
'+((articledata[grparticle][adx].doc_ft != null)?'':'') - +((articledata[grparticle][adx].doc_mo != null)?'':'') - +((articledata[grparticle][adx].doc_fs != null)?'':'')+'
'+ + strartgrp += '
'+((articledata[grparticle][adx].doc_ft != null)?'':'')+ + ((articledata[grparticle][adx].doc_mo != null)?'':'')+ + ((articledata[grparticle][adx].doc_fs != null)?'':'')+ + ((articledata[grparticle][adx].videolink != null)?'':'')+ + '
'+ ''; } } else { @@ -248,7 +258,6 @@ let shop= { myapp.viewpanel("shop"); }); }).catch(e => { console.log(e)}); - } }, articlequantityplus: function(artid,step){ @@ -269,7 +278,6 @@ let shop= { cval = cval +step; document.getElementById('art_' + artid).value = cval; } - return false; }, articlequantityminus: function(artid,step){ @@ -393,6 +401,33 @@ let shop= { return false; }, + setAddress: function(){ + + }, + loadBasket: function(){ + let pdata; + + //{% if (session.usertype == 'admin') %} + + pdata = {"cl":"ContratCadre","fn":"getClients"}; + + //{% else %} + + pdata = {"cl":"ContratCadre","fn":"getContractsByUser","iduser":"{{session.id_user}}"}; + + //{% endif %} + + postData(pdata).then(data => { + console.log("CC list",data.data); + contratcadre.ccnum = data.data.length; + + dataform.fillselectlist(contratcadre.selects["ccaddress"],data.data,'client','name_display'); + //if (data.data.length == 1 ){ + //contratcadre.idclient = data.data[0].client; + //contratcadre.loadContratCadre(true); + //} + }); + }, setBasket: function(){ let bs = document.getElementById("tblbody_basket"); bs.innerHTML =''; diff --git a/public_html/qubeshop/tmpl/panels/pnl_basket.html b/public_html/qubeshop/tmpl/panels/pnl_basket.html index 5b28013..6a668b2 100644 --- a/public_html/qubeshop/tmpl/panels/pnl_basket.html +++ b/public_html/qubeshop/tmpl/panels/pnl_basket.html @@ -8,10 +8,17 @@
-
- - +
+
+ + +
+
+ + +
+