mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Added fields to edit category, storelocations and manufacturer of a part.
This commit is contained in:
parent
6f435a58c9
commit
86eda36a2e
5 changed files with 64 additions and 55 deletions
|
@ -20,6 +20,7 @@ import 'datatables.net-bs4/css/dataTables.bootstrap4.css'
|
|||
import 'datatables.net-buttons-bs4/css/buttons.bootstrap4.css'
|
||||
import 'datatables.net-fixedheader-bs4/css/fixedHeader.bootstrap4.css'
|
||||
import 'datatables.net-select-bs4/css/select.bootstrap4.css'
|
||||
import 'bootstrap-select/dist/css/bootstrap-select.css'
|
||||
|
||||
//require( 'jszip' );
|
||||
//#require( 'pdfmake' );
|
||||
|
@ -31,6 +32,7 @@ require( 'datatables.net-buttons/js/buttons.print.js' );
|
|||
//require( 'datatables.net-colreorder-bs4' )();
|
||||
require( 'datatables.net-fixedheader-bs4' );
|
||||
require( 'datatables.net-select-bs4' );
|
||||
require('bootstrap-select')
|
||||
|
||||
|
||||
//Define jquery globally
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@ckeditor/ckeditor5-build-classic": "^12.0.0",
|
||||
"bootstrap-select": "1.13.5",
|
||||
"datatables.net-bs4": "^1.10.19",
|
||||
"datatables.net-buttons-bs4": "^1.5.4",
|
||||
"datatables.net-fixedheader-bs4": "^3.1.5",
|
||||
|
|
|
@ -322,24 +322,24 @@ class Part extends AttachmentContainingDBElement
|
|||
|
||||
/**
|
||||
if ($with_devices) {
|
||||
$count_must_order = 0; // for devices with "order_only_missing_parts == false"
|
||||
$count_should_order = 0; // for devices with "order_only_missing_parts == true"
|
||||
$deviceparts = DevicePart::getOrderDeviceParts($this->database, $this->current_user, $this->log, $this->getID());
|
||||
foreach ($deviceparts as $devicepart) {
|
||||
/** @var $devicepart DevicePart */
|
||||
/** @var $device Device */ /**
|
||||
$device = $devicepart->getDevice();
|
||||
if ($device->getOrderOnlyMissingParts()) {
|
||||
$count_should_order += $device->getOrderQuantity() * $devicepart->getMountQuantity();
|
||||
} else {
|
||||
$count_must_order += $device->getOrderQuantity() * $devicepart->getMountQuantity();
|
||||
}
|
||||
}
|
||||
$count_must_order = 0; // for devices with "order_only_missing_parts == false"
|
||||
$count_should_order = 0; // for devices with "order_only_missing_parts == true"
|
||||
$deviceparts = DevicePart::getOrderDeviceParts($this->database, $this->current_user, $this->log, $this->getID());
|
||||
foreach ($deviceparts as $devicepart) {
|
||||
/** @var $devicepart DevicePart */
|
||||
/** @var $device Device */ /**
|
||||
$device = $devicepart->getDevice();
|
||||
if ($device->getOrderOnlyMissingParts()) {
|
||||
$count_should_order += $device->getOrderQuantity() * $devicepart->getMountQuantity();
|
||||
} else {
|
||||
$count_must_order += $device->getOrderQuantity() * $devicepart->getMountQuantity();
|
||||
}
|
||||
}
|
||||
|
||||
return $count_must_order + max(0, $this->getMinInstock() - $this->getInstock() + $count_should_order);
|
||||
} else {
|
||||
return max(0, $this->getMinInstock() - $this->getInstock());
|
||||
} **/
|
||||
return $count_must_order + max(0, $this->getMinInstock() - $this->getInstock() + $count_should_order);
|
||||
} else {
|
||||
return max(0, $this->getMinInstock() - $this->getInstock());
|
||||
} **/
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -993,70 +993,61 @@ class Part extends AttachmentContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the ID of the category
|
||||
* Set the category of this Part
|
||||
*
|
||||
* Every part must have a valid category (in contrast to the
|
||||
* attributes "footprint", "storelocation", ...)!
|
||||
*
|
||||
* @param integer $new_category_id the ID of the category
|
||||
* @param Category $category The new category of this part
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setCategory(Category $category) : self
|
||||
{
|
||||
//TODO
|
||||
$this->category = $category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the footprint ID
|
||||
* Set the new Footprint of this Part.
|
||||
*
|
||||
* @param integer|NULL $new_footprint_id * the ID of the footprint
|
||||
* * NULL means "no footprint"
|
||||
*
|
||||
* @throws Exception if the new footprint ID is not valid
|
||||
* @throws Exception if there was an error
|
||||
* @param Footprint|null $new_footprint The new footprint of this part. Set to null, if this part should not have
|
||||
* a footprint.
|
||||
* @return self
|
||||
*/
|
||||
public function setFootprintID($new_footprint_id) : self
|
||||
public function setFootprint(?Footprint $new_footprint) : self
|
||||
{
|
||||
//TODO
|
||||
throw new \Exception("Not implemented yet!");
|
||||
$this->footprint = $new_footprint;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the new store location of this part.
|
||||
*
|
||||
* @param Storelocation|null $new_storelocation The new Storelocation of this part. Set to null, if this part should
|
||||
* not have a storelocation.
|
||||
* @return Part
|
||||
*/
|
||||
public function setStorelocation(?Storelocation $new_storelocation) : self
|
||||
{
|
||||
$this->storelocation = $new_storelocation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the storelocation ID
|
||||
* Sets the new manufacturer of this part.
|
||||
*
|
||||
* @param integer|NULL $new_storelocation_id * the ID of the storelocation
|
||||
* * NULL means "no storelocation"
|
||||
*
|
||||
* @throws Exception if the new storelocation ID is not valid
|
||||
* @throws Exception if there was an error
|
||||
* @param Manufacturer|null $new_manufacturer The new Manufacturer of this part. Set to null, if this part should
|
||||
* not have a manufacturer.
|
||||
* @return Part
|
||||
*/
|
||||
public function setStorelocationID($new_storelocation_id) : self
|
||||
public function setManufacturer(?Manufacturer $new_manufacturer) : self
|
||||
{
|
||||
//TODO
|
||||
throw new \Exception("Not implemented yet!");
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the manufacturer ID
|
||||
*
|
||||
* @param integer|NULL $new_manufacturer_id * the ID of the manufacturer
|
||||
* * NULL means "no manufacturer"
|
||||
*
|
||||
* @throws Exception if the new manufacturer ID is not valid
|
||||
* @throws Exception if there was an error
|
||||
*/
|
||||
public function setManufacturerID($new_manufacturer_id) : self
|
||||
{
|
||||
//TODO
|
||||
throw new \Exception("Not implemented yet!");
|
||||
$this->manufacturer = $new_manufacturer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -32,8 +32,12 @@
|
|||
namespace App\Form;
|
||||
|
||||
|
||||
use App\Entity\Category;
|
||||
use App\Entity\Manufacturer;
|
||||
use App\Entity\Part;
|
||||
use App\Entity\Storelocation;
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
||||
|
@ -57,6 +61,12 @@ class PartType extends AbstractType
|
|||
['attr' => ['min'=>0, 'placeholder' => 'part.instock.placeholder'], 'label'=> 'instock.label'])
|
||||
->add('mininstock', IntegerType::class,
|
||||
['attr' => ['min'=>0, 'placeholder' => 'part.mininstock.placeholder'], 'label'=> 'mininstock.label'])
|
||||
->add('category', EntityType::class, ['class' => Category::class, 'choice_label' => 'full_path',
|
||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true, 'label'=> 'category.label']])
|
||||
->add('storelocation', EntityType::class, ['class' => Storelocation::class, 'choice_label' => 'full_path',
|
||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true], 'required' => false, 'label'=> 'storelocation.label'])
|
||||
->add('manufacturer', EntityType::class, ['class' => Manufacturer::class, 'choice_label' => 'full_path',
|
||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true], 'required' => false, 'label'=> 'manufacturer.label'])
|
||||
->add('manufacturer_product_url', UrlType::class, ['required'=>false, 'empty_data' => '',
|
||||
'label'=> 'manufacturer_url.label'])
|
||||
->add('comment', CKEditorType::class, ['required'=>false,
|
||||
|
|
|
@ -1186,6 +1186,11 @@ boolbase@^1.0.0, boolbase@~1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
|
||||
integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24=
|
||||
|
||||
bootstrap-select@1.13.5:
|
||||
version "1.13.5"
|
||||
resolved "https://registry.yarnpkg.com/bootstrap-select/-/bootstrap-select-1.13.5.tgz#12f000b25a95ed642fe371ae9e311d3afbb8c53f"
|
||||
integrity sha512-1uYsYLB4FvGdwM6qzIfTxp6sP5gDqjPgWNHJztBfYUTIo1GUYG5zzmMVWiJvdxJlsvBXZ9AObmeZdzi0eg2jaA==
|
||||
|
||||
bootstrap@^4.3.1:
|
||||
version "4.3.1"
|
||||
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.3.1.tgz#280ca8f610504d99d7b6b4bfc4b68cec601704ac"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue