idleman 6 жил өмнө
parent
commit
21841cb24b

+ 2 - 1
plugin/hackpoint/action.php

@@ -271,6 +271,7 @@ switch($_['action']){
 				$row = $part->toArray();
 				$row['picture'] = $part->picture(true);
 				$row['id'] = $resourcepart->id;
+				$row['part'] = $part->id;
 				$response['rows'][] = $row;
 			}
 		});
@@ -285,7 +286,7 @@ switch($_['action']){
 			require_once(__DIR__.SLASH.'ResourcePart.class.php');
 			
 
-			$part = Part::provide();
+			$part = Part::provide('part');
 			$part->label = $_['label'];
 			if(isset($_['price'])) $part->price = $_['price'];
 			if(isset($_['link'])) $part->link = $_['link'];

+ 1 - 1
plugin/hackpoint/hackpoint.plugin.php

@@ -94,7 +94,7 @@ Plugin::addCss("/css/component.css?v=1",true);
 
 Plugin::addJs("/js/main.js?v=1"); 
 Plugin::addJs("/js/codemirror.js?v=1"); 
-Plugin::addJs("/js/component.js?v=1",true); 
+Plugin::addJs("/js/component.js?v=2",true); 
 
 foreach(glob(__DIR__.SLASH.'js'.SLASH.'codemirror-mode'.SLASH.'*.js') as $file){
 	Plugin::addJs("/js/codemirror-mode/".basename($file)); 

+ 2 - 0
plugin/hackpoint/js/main.js

@@ -68,6 +68,8 @@ function hackpoint_part_save(element){
 	var data = {
 		action : 'hackpoint_part_save',
 		resource : $('#sketch-editor').attr('data-id'),
+		part : li.attr('data-part'),
+		id : li.attr('data-id'),
 		label : li.find('.label').val(),
 		brand : li.find('.brand input').val(),
 		price : li.find('.price input').val(),

+ 2 - 2
plugin/hackpoint/types/PartType.class.php

@@ -78,7 +78,7 @@ class PartType {
 					
 
 					<ul  id="parts" data-entity-search="hackpoint_part_search">
-						<li data-id="{{id}}" class="hidden">
+						<li data-id="{{id}}" data-part="{{part}}" class="hidden">
 							<div class="part">
 							  	<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>
@@ -96,7 +96,7 @@ class PartType {
 									</div>
 								</div>
 
-								<div class="price w-100 mt-2 mb-2">
+								<div class="brand w-100 mt-2 mb-2">
 				                	<div class="input-group">
 				                	 <div class="input-group-prepend">
 									    <span class="input-group-text">Marque</span>