<commit_before>var EasyAssess = require('../../easyassess.application');

EasyAssess.directives["esIqcSpecimenSelectionSettings"]
	= EasyAssess.app.directive("esIqcSpecimenSelectionSettings", function(ngDialog) {
	return {
		restrict: 'E',
		replace: true,
		transclude: false,
		template:
			'<div>'
		+ 		'<div class="es-dialog-form-line">'
		+ 			'<span>选项值</span><a href="javascript:void(0)" style="padding-left:20px;" ng-click="addOptionValue()">添加</a>'
		+ 		'</div>'
		+ 		'<div class="es-dialog-form-line" style="max-height:200px;overflow:auto;">'
		+ 			'<table class="table table-striped">'
		+ 				'<thead><tr><th>选项</th><th>值</th></tr></thead>'
		+ 				'<tbody>'
		+ 					'<tr ng-repeat="(value,weight) in esSpecimen.enumValues"><td>{{value}}</td><td>{{weight}}</td><td><span class="glyphicon glyphicon-remove es-delete-button" ng-click="removeOptionValue(value)"></span></td></tr>'
		+ 				'</tbody>'
		+ 			'</table>'
		+		'</div>'
		+ 		'<div class="es-dialog-form-line">'
		+ 			'<span>靶值:</span>'
		+			'<select es-id="targetValue" ng-model="esSpecimen.targetValue" convert-to-number class="form-control es-form-group-contorl" style="width: 300px;"><option ng-repeat="(value,weight) in esSpecimen.enumValues" value="{{weight}}">{{value}} ({{weight}})</option></select>'
		+ 		'</div>'
		+ 		'<div class="es-dialog-form-line">'
		+ 			'<span>上下浮动范围(±)<span ng-if="esType==\'T\'">n</span>):</span><input type="number" class="form-control" style="width:300px;" ng-model="esSpecimen.floatValue" placeholder="输入上下浮动值"/></span>'
		+ 		'</div>'
		+	'</div>',
		scope: {
			esSpecimen: "="
		},

		controller: ["$scope", function($scope) {
			$scope.removeOptionValue = function (value) {
				delete $scope.esSpecimen.enumValues[value];
			}

			$scope.addOptionValue = function () {
				ngDialog.open({
					template: '<div class="es-dialog-content"><div class="es-dialog-form-line"><input class="form-control" style="width:300px;" placeholder="输入选项值" es-ids="txtValue"/></div>'
					+ '<div class="es-dialog-form-line"><select class="form-control" style="width:300px;" es-ids="txtWeight"><option ng-repeat="weight in weights" value="{{weight}}">{{weight}}</option></select></div>'
					+ '<div class="es-dialog-form-line" align="right"><button ng-click="submit()" es-ids="btnSubmit" class="btn btn-primary">确定</button></div></div>',
					plain: true,
					controller: ['$scope', function ($digOptionValue) {
						$digOptionValue.weights = [
							-1,0,1,2,3,4,5,6,7,8,9
						];

						$digOptionValue.submit = function () {
							$scope.esSpecimen.enumValues[$('[es-ids=txtValue]').val()] = $('[es-ids=txtWeight]').val();
							$digOptionValue.closeThisDialog();
						}
					}]
				});
			}
		}]
	}
});

EasyAssess.directives["esIqcSpecimenTargetValueSettings"]
	= EasyAssess.app.directive("esIqcSpecimenTargetValueSettings", function(ngDialog) {
	return {
		restrict: 'E',
		replace: true,
		transclude: false,
		template:
		'<div>'
		+ 	'<div class="es-dialog-form-line">'
		+ 		'<span>靶值:</span><input type="number" class="form-control" style="width:300px;" ng-model="esSpecimen.targetValue" placeholder="输入靶值"/>'
		+ 	'</div>'
		+ 	'<div class="es-dialog-form-line">'
		+ 		'<span>上下浮动范围(±<span ng-if="esType==\'P\'">%</span><span ng-if="esType==\'T\'">n</span>):</span><input type="number" class="form-control" style="width:300px;" ng-model="esSpecimen.floatValue" placeholder="输入上下浮动值"/>'
		+ 	'</div>'
		+	'</div>',
		scope: {
			esSpecimen: "=",
			esType: "@"
		}
	}
});

EasyAssess.directives["esIqcPlanDesigner"]
	= EasyAssess.app.directive("esIqcPlanDesigner", function(ngDialog) {
	return {
		restrict: 'E',
		replace: true,
		transclude: false,
		template:  '<div class="es-form-group">'
		+	 '<div class="es-form-header"><es-text-box es-content="{{esTemplate.name}}" es-change-callback="nameChanged(val)" class="es-form-header-text" es-content-align="center" es-placeholder="输入标题..."></es-text-box></div>'
		+	 '<table class="table table-striped">'
		+ 	'<thead><tr><th style="width:15%;">检测项目</th><th style="width:45%;">样本</th></tr></thead>'
		+   '<tbody>'
		+			'<tr ng-repeat="item in esTemplate.items">'
		+				'<td class="es-form-group-cell" style="vertical-align: middle;"><div>{{item.subject}} - {{item.unit}} <span class="glyphicon glyphicon-remove es-delete-button" ng-click="removeItem(item)"></span></div></td>'
		+				'<td>'
		+					'<table>'
		+						'<tr>'
		+							'<td class="es-form-group-cell" ng-repeat="specimen in item.specimens"><table><tr><td><div class="btn btn-primary" ng-click="setSpecimenOptions(specimen)">{{specimen.number}}</div></td><td><span class="glyphicon glyphicon-remove es-delete-button" ng-click="removeSpecimen(item, specimen)"></span></td></tr></table></td>'
		+							'<td><es-add-button ng-click="addSpecimen(item)" style="min-width:50px;" es-text="样本" title="添加样本"></es-add-button></td>'
		+						'</tr>'
		+					'</table>'
		+				'</td>'
		+			'</tr>'
		+			'<tr>'
		+				'<td colspan="3" style="padding:5px 0px 5px 0px;">'
		+					'<es-add-button ng-click="addSubject()" es-ids="addItem" es-text="添加新项目" title="添加新项目"></es-add-button>'
		+				'</td>'
		+			'</tr>'
		+			'<tr>'
		+				'<td colspan="3">'
		+					'<table>'
		+						'<tr style="height: 30px; cursor: pointer;" ng-repeat="def in esTemplate.additionalItems track by $index">'
		+							'<td><div ng-bind="esTemplate.additionalItems[$index].name" ng-dblclick="editAdditionalItem(esTemplate.additionalItems[$index])"></div></td>'
		+							'<td>:</td>'
		+							'<td style="padding:0px 10px 0px 10px;"><span style="width: 200px; height: 20px; display: block;" class="es-form-signature-line"></span></td>'
		+							'<td><span class="glyphicon glyphicon-remove es-delete-button" ng-click="removeAdditionalItem($index)"></span></td>'
		+						'</tr>'
		+					'</table>'
		+				'</td>'
		+			'</tr>'<commit_msg>Auto size for iqc template specimen button<commit_after>var EasyAssess = require('../../easyassess.application');

EasyAssess.directives["esIqcSpecimenSelectionSettings"]
	= EasyAssess.app.directive("esIqcSpecimenSelectionSettings", function(ngDialog) {
	return {
		restrict: 'E',
		replace: true,
		transclude: false,
		template:
			'<div>'
		+ 		'<div class="es-dialog-form-line">'
		+ 			'<span>选项值</span><a href="javascript:void(0)" style="padding-left:20px;" ng-click="addOptionValue()">添加</a>'
		+ 		'</div>'
		+ 		'<div class="es-dialog-form-line" style="max-height:200px;overflow:auto;">'
		+ 			'<table class="table table-striped">'
		+ 				'<thead><tr><th>选项</th><th>值</th></tr></thead>'
		+ 				'<tbody>'
		+ 					'<tr ng-repeat="(value,weight) in esSpecimen.enumValues"><td>{{value}}</td><td>{{weight}}</td><td><span class="glyphicon glyphicon-remove es-delete-button" ng-click="removeOptionValue(value)"></span></td></tr>'
		+ 				'</tbody>'
		+ 			'</table>'
		+		'</div>'
		+ 		'<div class="es-dialog-form-line">'
		+ 			'<span>靶值:</span>'
		+			'<select es-id="targetValue" ng-model="esSpecimen.targetValue" convert-to-number class="form-control es-form-group-contorl" style="width: 300px;"><option ng-repeat="(value,weight) in esSpecimen.enumValues" value="{{weight}}">{{value}} ({{weight}})</option></select>'
		+ 		'</div>'
		+ 		'<div class="es-dialog-form-line">'
		+ 			'<span>上下浮动范围(±)<span ng-if="esType==\'T\'">n</span>):</span><input type="number" class="form-control" style="width:300px;" ng-model="esSpecimen.floatValue" placeholder="输入上下浮动值"/></span>'
		+ 		'</div>'
		+	'</div>',
		scope: {
			esSpecimen: "="
		},

		controller: ["$scope", function($scope) {
			$scope.removeOptionValue = function (value) {
				delete $scope.esSpecimen.enumValues[value];
			}

			$scope.addOptionValue = function () {
				ngDialog.open({
					template: '<div class="es-dialog-content"><div class="es-dialog-form-line"><input class="form-control" style="width:300px;" placeholder="输入选项值" es-ids="txtValue"/></div>'
					+ '<div class="es-dialog-form-line"><select class="form-control" style="width:300px;" es-ids="txtWeight"><option ng-repeat="weight in weights" value="{{weight}}">{{weight}}</option></select></div>'
					+ '<div class="es-dialog-form-line" align="right"><button ng-click="submit()" es-ids="btnSubmit" class="btn btn-primary">确定</button></div></div>',
					plain: true,
					controller: ['$scope', function ($digOptionValue) {
						$digOptionValue.weights = [
							-1,0,1,2,3,4,5,6,7,8,9
						];

						$digOptionValue.submit = function () {
							$scope.esSpecimen.enumValues[$('[es-ids=txtValue]').val()] = $('[es-ids=txtWeight]').val();
							$digOptionValue.closeThisDialog();
						}
					}]
				});
			}
		}]
	}
});

EasyAssess.directives["esIqcSpecimenTargetValueSettings"]
	= EasyAssess.app.directive("esIqcSpecimenTargetValueSettings", function(ngDialog) {
	return {
		restrict: 'E',
		replace: true,
		transclude: false,
		template:
		'<div>'
		+ 	'<div class="es-dialog-form-line">'
		+ 		'<span>靶值:</span><input type="number" class="form-control" style="width:300px;" ng-model="esSpecimen.targetValue" placeholder="输入靶值"/>'
		+ 	'</div>'
		+ 	'<div class="es-dialog-form-line">'
		+ 		'<span>上下浮动范围(±<span ng-if="esType==\'P\'">%</span><span ng-if="esType==\'T\'">n</span>):</span><input type="number" class="form-control" style="width:300px;" ng-model="esSpecimen.floatValue" placeholder="输入上下浮动值"/>'
		+ 	'</div>'
		+	'</div>',
		scope: {
			esSpecimen: "=",
			esType: "@"
		}
	}
});

EasyAssess.directives["esIqcPlanDesigner"]
	= EasyAssess.app.directive("esIqcPlanDesigner", function(ngDialog) {
	return {
		restrict: 'E',
		replace: true,
		transclude: false,
		template:  '<div class="es-form-group">'
		+	 '<div class="es-form-header"><es-text-box es-content="{{esTemplate.name}}" es-change-callback="nameChanged(val)" class="es-form-header-text" es-content-align="center" es-placeholder="输入标题..."></es-text-box></div>'
		+	 '<table class="table table-striped">'
		+ 	'<thead><tr><th style="width:15%;">检测项目</th><th style="width:45%;">样本</th></tr></thead>'
		+   '<tbody>'
		+			'<tr ng-repeat="item in esTemplate.items">'
		+				'<td class="es-form-group-cell" style="vertical-align: middle;"><div>{{item.subject}} - {{item.unit}} <span class="glyphicon glyphicon-remove es-delete-button" ng-click="removeItem(item)"></span></div></td>'
		+				'<td>'
		+					'<table>'
		+						'<tr>'
		+							'<td class="es-form-group-cell" ng-repeat="specimen in item.specimens"><table><tr><td><div class="btn btn-primary" style="width: auto;" ng-click="setSpecimenOptions(specimen)">{{specimen.number}}</div></td><td><span class="glyphicon glyphicon-remove es-delete-button" ng-click="removeSpecimen(item, specimen)"></span></td></tr></table></td>'
		+							'<td><es-add-button ng-click="addSpecimen(item)" style="min-width:50px;" es-text="样本" title="添加样本"></es-add-button></td>'
		+						'</tr>'
		+					'</table>'
		+				'</td>'
		+			'</tr>'
		+			'<tr>'
		+				'<td colspan="3" style="padding:5px 0px 5px 0px;">'
		+					'<es-add-button ng-click="addSubject()" es-ids="addItem" es-text="添加新项目" title="添加新项目"></es-add-button>'
		+				'</td>'
		+			'</tr>'
		+			'<tr>'
		+				'<td colspan="3">'
		+					'<table>'
		+						'<tr style="height: 30px; cursor: pointer;" ng-repeat="def in esTemplate.additionalItems track by $index">'
		+							'<td><div ng-bind="esTemplate.additionalItems[$index].name" ng-dblclick="editAdditionalItem(esTemplate.additionalItems[$index])"></div></td>'
		+							'<td>:</td>'
		+							'<td style="padding:0px 10px 0px 10px;"><span style="width: 200px; height: 20px; display: block;" class="es-form-signature-line"></span></td>'
		+							'<td><span class="glyphicon glyphicon-remove es-delete-button" ng-click="removeAdditionalItem($index)"></span></td>'
		+						'</tr>'
		+					'</table>'
		+				'</td>'
		+			'</tr>'
{'fraction_non_alphanumeric': 0.23885296119809393, 'fraction_numerical': 0.010211027910142955, 'mean_word_length': 4.383875400824554, 'pattern_counts': {'":': 0, '<': 311, '<?xml version=': 0, '>': 311, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6606185', 'n_tokens_mistral': 5152, 'n_tokens_neox': 4507, 'n_words': 557}