<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('资产台账详细')" />
</head>
<body>
    <div class="main-content">
        <form class="form-horizontal" th:object="${amsAsset}">
            <h4 class="form-header h4">基本信息</h4>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">资产编码：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{assetCode}"></p>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">资产名称：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{assetName}"></p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">资产类别：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{categoryName}"></p>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">资产状态：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{@dict.getLabel('ams_asset_status', assetStatus)}"></p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">规格型号：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{specModel}"></p>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">品牌：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{brand}"></p>
                        </div>
                    </div>
                </div>
            </div>

            <h4 class="form-header h4">归属信息</h4>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">所属仓库：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{warehouseName}"></p>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">存放位置：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{locationName}"></p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">使用部门：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{useDeptName}"></p>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">使用人：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{useUserName}"></p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">保管人：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{custodianName}"></p>
                        </div>
                    </div>
                </div>
            </div>

            <h4 class="form-header h4">维保信息</h4>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">购置日期：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="${amsAsset.purchaseDate == null ? '' : #dates.format(amsAsset.purchaseDate, 'yyyy-MM-dd')}"></p>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">资产原值：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{originalValue}"></p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">使用寿命（月）：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{useLife}"></p>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">维保周期（月）：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{maintenanceCycle}"></p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">上次维保日期：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="${amsAsset.lastMaintenanceDate == null ? '' : #dates.format(amsAsset.lastMaintenanceDate, 'yyyy-MM-dd')}"></p>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">下次维保日期：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="${amsAsset.nextMaintenanceDate == null ? '' : #dates.format(amsAsset.nextMaintenanceDate, 'yyyy-MM-dd')}"></p>
                        </div>
                    </div>
                </div>
            </div>

            <h4 class="form-header h4">RFID信息</h4>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">当前标签编码：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{tagCode}"></p>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">当前绑定EPC：</label>
                        <div class="col-sm-8">
                            <p class="form-control-plaintext" th:text="*{epcCode}"></p>
                        </div>
                    </div>
                </div>
            </div>

            <h4 class="form-header h4">备注</h4>
            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">备注：</label>
                        <div class="col-sm-10">
                            <p class="form-control-plaintext" th:text="*{remark}"></p>
                        </div>
                    </div>
                </div>
            </div>

            <h4 class="form-header h4">资产履历</h4>
            <div class="row">
                <div class="col-sm-12 table-responsive">
                    <table class="table table-bordered table-striped">
                        <thead>
                            <tr>
                                <th>操作时间</th>
                                <th>业务类型</th>
                                <th>来源单号</th>
                                <th>状态变化</th>
                                <th>仓库变化</th>
                                <th>位置变化</th>
                                <th>使用归属变化</th>
                                <th>变更摘要</th>
                                <th>操作人</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr th:if="${#lists.isEmpty(lifecycleList)}">
                                <td colspan="9" class="text-center">暂无资产履历</td>
                            </tr>
                            <tr th:each="lifecycle : ${lifecycleList}">
                                <td th:text="${#dates.format(lifecycle.operateTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                                <td th:text="${@dict.getLabel('ams_lifecycle_business_type', lifecycle.businessType) ?: lifecycle.businessType}"></td>
                                <td th:text="${lifecycle.sourceOrderNo ?: '-'}"></td>
                                <td th:text="${(lifecycle.beforeStatus == null ? '-' : (@dict.getLabel('ams_asset_status', lifecycle.beforeStatus) ?: lifecycle.beforeStatus)) + ' → ' + (lifecycle.afterStatus == null ? '-' : (@dict.getLabel('ams_asset_status', lifecycle.afterStatus) ?: lifecycle.afterStatus))}"></td>
                                <td th:text="${(lifecycle.beforeWarehouseName ?: '-') + ' → ' + (lifecycle.afterWarehouseName ?: '-')}"></td>
                                <td th:text="${(lifecycle.beforeLocationName ?: '-') + ' → ' + (lifecycle.afterLocationName ?: '-')}"></td>
                                <td th:text="${(lifecycle.beforeDeptName ?: '-') + '/' + (lifecycle.beforeUserName ?: '-') + ' → ' + (lifecycle.afterDeptName ?: '-') + '/' + (lifecycle.afterUserName ?: '-')}"></td>
                                <td th:text="${lifecycle.changeSummary ?: '-'}"></td>
                                <td th:text="${lifecycle.operateUserName ?: '-'}"></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
</body>
</html>
