idleman 6 năm trước cách đây
mục cha
commit
772b04d0d3

+ 1 - 0
plugin/hackpoint/css/main.css

@@ -290,6 +290,7 @@ div.hackpoint-type-image[data-type="dropzone"] > ul > li > i.pointer{
 	color:#fefefe;
 }
 
+
 #sketch-workspace .part .part-image{
 	border:2px dashed #3e4750;
 	height:200px;

+ 13 - 3
plugin/hackpoint/js/main.js

@@ -64,13 +64,13 @@ function hackpoint_part_search(callback){
 //Ajout ou modification d'élément part
 function hackpoint_part_save(element){
 	var li = $(element).closest('li');
-	console.log(li);
+	
 	var data = {
 		action : 'hackpoint_part_save',
 		resource : $('#sketch-editor').attr('data-id'),
 		label : li.find('.label').val(),
-		brand : li.find('.brand').val(),
-		price : li.find('.price').val(),
+		brand : li.find('.brand input').val(),
+		price : li.find('.price input').val(),
 		url : li.find('.url').val(),
 		picture : li.find('.part-image').attr('data-stream')
 	}
@@ -81,6 +81,16 @@ function hackpoint_part_save(element){
 	});
 }
 
+function hackpoint_part_find(element){
+	var li = $(element).closest('li');
+	var label = li.find('.label').val();
+	var brand = li.find('.brand input').val();
+	var url = "https://www.ebay.fr/sch/i.html?_from=R40&_sacat=0&LH_BIN=1&LH_PrefLoc=2&_sop=15";
+	if(null!=brand && brand !='')  label = brand+'+'+label;
+	url += "&_nkw="+label;
+	window.open(url);
+}
+
 function hackpoint_part_add(){
 
 	var tpl = $('#parts li:eq(0)').get(0).outerHTML;

+ 25 - 5
plugin/hackpoint/types/PartType.class.php

@@ -83,11 +83,31 @@ class PartType {
 							  	<input type="text" data-type="part" data-force="false" placeholder="Nom du composant" value="{{label}}" class="form-control label">
 							  	<div class="part-image" data-label="Image" data-stream="{{picture}}"></div>
 							  	<input class="hidden" type="file">
-				                <!--
-				                <span class="price"><input class="form-control col-sm-2 d-inline-block" type="text" value="{{price}}"> €</span>
-				                <span class="brand"><input class="form-control col-sm-2 d-inline-block" type="text" value="{{brand}}"/></span>
-				               -->
-				                <a href="{{link}}" class="link"><i class="fas fa-globe-americas"></i></a>
+				                
+				                <div class="price w-100 mt-2">
+				                	<div class="input-group">
+				                	 <div class="input-group-prepend">
+									    <span class="input-group-text">Prix</span>
+									  </div>
+									  <input class="form-control" type="text" value="{{price}}">
+									  <div class="input-group-append">
+									    <span class="input-group-text">€</span>
+									  </div>
+									</div>
+								</div>
+
+								<div class="price w-100 mt-2 mb-2">
+				                	<div class="input-group">
+				                	 <div class="input-group-prepend">
+									    <span class="input-group-text">Marque</span>
+									  </div>
+									  <input class="form-control" type="text" value="{{brand}}"/>
+									</div>
+								</div>
+				              
+				               
+				              
+				                 <a onclick="hackpoint_part_find(this)"  class="link"><i class="fas fa-globe-americas"></i></a>
 				                 <div class="btn btn-delete" onclick="hackpoint_resource_part_delete(this);"><i class="far fa-trash-alt"></i></div>
 				                 <div class="btn btn-dark w-100 mb-3" onclick="hackpoint_part_save(this)"><i class="far fa-check-circle"></i>Valider</div>
 			                 </div>