diff --git a/Admin/Install/db.json b/Admin/Install/db.json index a290f74..fdf5e88 100644 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -77,6 +77,11 @@ "type": "VARCHAR(255)", "null": false }, + "assetmgmt_asset_location": { + "name": "assetmgmt_asset_location", + "type": "VARCHAR(255)", + "null": false + }, "assetmgmt_asset_status": { "name": "assetmgmt_asset_status", "type": "TINYINT", @@ -166,13 +171,13 @@ "null": false }, "assetmgmt_attr_type_required": { - "description": "Every asset must have this attribute type if set to true.", + "comment": "Every asset must have this attribute type if set to true.", "name": "assetmgmt_attr_type_required", "type": "TINYINT(1)", "null": false }, "assetmgmt_attr_type_pattern": { - "description": "This is a regex validation pattern.", + "comment": "This is a regex validation pattern.", "name": "assetmgmt_attr_type_pattern", "type": "VARCHAR(255)", "null": false diff --git a/Admin/Installer.php b/Admin/Installer.php index d4c2675..89cdee1 100644 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -219,6 +219,10 @@ final class Installer extends InstallerAbstract $module = $app->moduleManager->get('AssetManagement', 'ApiAssetAttribute'); foreach ($attributes as $attribute) { + if (!isset($attribute['values'])) { + continue; + } + $itemAttrValue[$attribute['name']] = []; /** @var array $value */ diff --git a/Controller/ApiController.php b/Controller/ApiController.php index faf5dcb..99c66bb 100644 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -83,12 +83,14 @@ final class ApiController extends Controller */ public function createAssetFromRequest(RequestAbstract $request) : Asset { - $asset = new Asset(); - $asset->name = $request->getDataString('name') ?? ''; - $asset->info = $request->getDataString('info') ?? ''; - $asset->type = new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0)); - $asset->status = AssetStatus::tryFromValue($request->getDataInt('status')) ?? AssetStatus::INACTIVE; - $asset->unit = $request->getDataInt('unit') ?? $this->app->unitId; + $asset = new Asset(); + $asset->name = $request->getDataString('name') ?? ''; + $asset->info = $request->getDataString('info') ?? ''; + $asset->code = $request->getDataString('code') ?? ''; + $asset->location = $request->getDataString('location') ?? ''; + $asset->type = new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0)); + $asset->status = AssetStatus::tryFromValue($request->getDataInt('status')) ?? AssetStatus::INACTIVE; + $asset->unit = $request->getDataInt('unit') ?? $this->app->unitId; $asset->equipment = $request->getDataInt('equipment'); return $asset; diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 891c42d..89404cd 100644 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -85,7 +85,7 @@ final class BackendController extends Controller $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/AssetManagement/Theme/Backend/asset-view'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008402001, $request, $response); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006601001, $request, $response); $view->data['asset'] = AssetMapper::get() ->with('attributes') @@ -132,6 +132,11 @@ final class BackendController extends Controller $view->data['units'] = UnitMapper::getAll() ->executeGetArray(); + $view->data['attributeTypes'] = AssetAttributeTypeMapper::getAll() + ->with('l11n') + ->where('l11n/language', $response->header->l11n->language) + ->executeGetArray(); + $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response); $view->data['attributeView']->data['default_localization'] = $this->app->l11nServer; diff --git a/Docs/Dev/en/structure.md b/Docs/Dev/en/structure.md deleted file mode 100644 index 8d70862..0000000 --- a/Docs/Dev/en/structure.md +++ /dev/null @@ -1,5 +0,0 @@ -# Structure - -## ER - -![ER](Modules/AssetManagement/Docs/Dev/img/er.png) \ No newline at end of file diff --git a/Docs/Dev/img/er.png b/Docs/Dev/img/er.png deleted file mode 100644 index 95dff17..0000000 Binary files a/Docs/Dev/img/er.png and /dev/null differ diff --git a/Docs/Help/en/asset.md b/Docs/Help/en/asset.md index 0345d98..4b871a8 100644 --- a/Docs/Help/en/asset.md +++ b/Docs/Help/en/asset.md @@ -1,2 +1,17 @@ # Asset +## Code + +A custom code that can be set for an asset. + +## Location + +Location where the asset is located. + +![Asset](Modules/AssetManagement/Docs/Help/img/asset/asset_general.png) + +## Attributes + +Attributes allow you to add additional information to assets. + +![Attribute](Modules/AssetManagement/Docs/Help/img/asset/asset_attributes.png) \ No newline at end of file diff --git a/Docs/Help/en/introduction.md b/Docs/Help/en/introduction.md index b7fe0ef..a87bbfa 100644 --- a/Docs/Help/en/introduction.md +++ b/Docs/Help/en/introduction.md @@ -1,14 +1,14 @@ # Introduction -The **Tasks** module allows users to create to do's for themselves and for other users. Tasks can be shared and worked on with multiple users. It is also possible to attach files and tags for easier categorization and better search. Tasks can also be forwarded from one user to another. +The **Asset Management** module allows users to create and manage assets for accounting purposes. Assets can have general information stored in the asset master file as well as different depreciation types. -## Garget Group +## Target Group -The target group for this module is everyone who wants to manage their to do in an application either for themselves or in an organization structure. +The target group for this module is the accounting department. # Setup -This module doesn't have any additional setup requirements since it is installed during the application install process. +This module doesn't have any additional setup requirements. # Features @@ -16,17 +16,13 @@ This module doesn't have any additional setup requirements since it is installed Upload or link already uploaded files. -## Tags +## Attributes -Add tags to tasks for categorization and improved search. +Create and add custom attributes -## Forwarding +## Notes -Tasks can be forwarded from one user to another. - -# Dependencies - -* [Finance](Finance) +Create custom notes # Recommendation diff --git a/Docs/Help/img/asset/asset_attributes.png b/Docs/Help/img/asset/asset_attributes.png new file mode 100644 index 0000000..6522fef Binary files /dev/null and b/Docs/Help/img/asset/asset_attributes.png differ diff --git a/Docs/Help/img/asset/asset_files.png b/Docs/Help/img/asset/asset_files.png new file mode 100644 index 0000000..b46b819 Binary files /dev/null and b/Docs/Help/img/asset/asset_files.png differ diff --git a/Docs/Help/img/asset/asset_general.png b/Docs/Help/img/asset/asset_general.png new file mode 100644 index 0000000..fa14133 Binary files /dev/null and b/Docs/Help/img/asset/asset_general.png differ diff --git a/Docs/Help/img/asset/asset_notes.png b/Docs/Help/img/asset/asset_notes.png new file mode 100644 index 0000000..8d03cda Binary files /dev/null and b/Docs/Help/img/asset/asset_notes.png differ diff --git a/Docs/img.json b/Docs/img.json new file mode 100644 index 0000000..5262b92 --- /dev/null +++ b/Docs/img.json @@ -0,0 +1,22 @@ +[ + [ + "/accounting/asset/view?id=1", + "//*[@id=\"content\"]/div/div[2]/div[1]/div/div[1]/section", + "/AssetManagement/Docs/Help/img/asset/asset_general.png" + ], + [ + "/accounting/asset/view?id=1#c-tab-2", + "//*[@id=\"content\"]/div/div[2]/div[2]/div", + "/AssetManagement/Docs/Help/img/asset/asset_attributes.png" + ], + [ + "/accounting/asset/view?id=1#c-tab-3", + "//*[@id=\"content\"]/div/div[2]/div[3]/div", + "/AssetManagement/Docs/Help/img/asset/asset_files.png" + ], + [ + "/accounting/asset/view?id=1#c-tab-4", + "//*[@id=\"content\"]/div/div[2]/div[4]/div", + "/AssetManagement/Docs/Help/img/asset/asset_notes.png" + ] +] \ No newline at end of file diff --git a/Models/Asset.php b/Models/Asset.php index 4b50782..74f54af 100644 --- a/Models/Asset.php +++ b/Models/Asset.php @@ -32,6 +32,10 @@ class Asset implements \JsonSerializable public int $status = AssetStatus::ACTIVE; + public string $code = ''; + + public string $location = ''; + public BaseStringL11nType $type; public string $info = ''; diff --git a/Models/AssetMapper.php b/Models/AssetMapper.php index 6a35b6f..ba47442 100644 --- a/Models/AssetMapper.php +++ b/Models/AssetMapper.php @@ -42,10 +42,11 @@ final class AssetMapper extends DataMapperFactory 'assetmgmt_asset_id' => ['name' => 'assetmgmt_asset_id', 'type' => 'int', 'internal' => 'id'], 'assetmgmt_asset_name' => ['name' => 'assetmgmt_asset_name', 'type' => 'string', 'internal' => 'name'], 'assetmgmt_asset_number' => ['name' => 'assetmgmt_asset_number', 'type' => 'string', 'internal' => 'number'], + 'assetmgmt_asset_location' => ['name' => 'assetmgmt_asset_location', 'type' => 'string', 'internal' => 'location'], 'assetmgmt_asset_status' => ['name' => 'assetmgmt_asset_status', 'type' => 'int', 'internal' => 'status'], 'assetmgmt_asset_info' => ['name' => 'assetmgmt_asset_info', 'type' => 'string', 'internal' => 'info'], 'assetmgmt_asset_unit' => ['name' => 'assetmgmt_asset_unit', 'type' => 'int', 'internal' => 'unit'], - 'assetmgmt_asset_equipment' => ['name' => 'assetmgmt_asset_equipment', 'type' => 'int', 'internal' => 'equipment'], + 'assetmgmt_asset_equipment' => ['name' => 'assetmgmt_asset_equipment', 'type' => 'int', 'internal' => 'equipment'], 'assetmgmt_asset_type' => ['name' => 'assetmgmt_asset_type', 'type' => 'int', 'internal' => 'type'], 'assetmgmt_asset_responsible' => ['name' => 'assetmgmt_asset_responsible', 'type' => 'int', 'internal' => 'responsible'], 'assetmgmt_asset_created_at' => ['name' => 'assetmgmt_asset_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index b34df07..89b74f1 100644 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -13,16 +13,25 @@ declare(strict_types=1); return ['AssetManagement' => [ - 'Assets' => 'Assets', - 'Asset' => 'Asset', - 'Equipment' => 'Equipment', - 'CreateEquipment' => 'Create Equipment', - 'Number' => 'Number', - 'Status' => 'Status', - 'Name' => 'Name', - 'Type' => 'Type', - ':status1' => 'Active', - ':status2' => 'Inactive', - ':status3' => 'Damaged', - ':status4' => 'Out of order', + 'Assets' => 'Assets', + 'Asset' => 'Asset', + 'Equipment' => 'Equipment', + 'CreateEquipment' => 'Create Equipment', + 'Number' => 'Number', + 'Start' => 'Start', + 'End' => 'End', + 'Attributes' => 'Attributes', + 'Files' => 'Files', + 'Notes' => 'Notes', + 'Status' => 'Status', + 'PurchasePrice' => 'Purchase Price', + 'LeasingFee' => 'Leasing Fee', + 'Name' => 'Name', + 'Type' => 'Type', + 'Code' => 'Code', + 'Location' => 'Location', + ':status1' => 'Active', + ':status2' => 'Inactive', + ':status3' => 'Damaged', + ':status4' => 'Out of order', ]]; diff --git a/Theme/Backend/asset-view.tpl.php b/Theme/Backend/asset-view.tpl.php index 5cad854..a9a4491 100644 --- a/Theme/Backend/asset-view.tpl.php +++ b/Theme/Backend/asset-view.tpl.php @@ -33,14 +33,14 @@ $assetTypes = $this->data['types'] ?? []; */ echo $this->data['nav']->render(); ?> -
+
@@ -49,7 +49,7 @@ echo $this->data['nav']->render();
-
getHtml('Profile'); ?>
+
getHtml('Asset'); ?>
@@ -57,13 +57,8 @@ echo $this->data['nav']->render();
- - -
- -
- - + +
@@ -76,22 +71,8 @@ echo $this->data['nav']->render();
- - -
- -
- - -
- -
- - + +
@@ -160,7 +141,7 @@ echo $this->data['nav']->render(); data['asset-notes']->render('asset-notes', '', $asset->notes); ?>
- request->uri->fragment === 'c-tab-8' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
diff --git a/info.json b/info.json index 2a8802e..0c3e0fb 100644 --- a/info.json +++ b/info.json @@ -12,7 +12,7 @@ }, "creator": { "name": "Jingga", - "website": "jingga.app" + "website": "https://jingga.app" }, "directory": "AssetManagement", "dependencies": {