improve mocha TMS, should refactor dialog.js into phast
This commit is contained in:
parent
70cd5b2125
commit
6d875abbeb
@ -23,15 +23,17 @@
|
|||||||
$tenantName = $json["tenantName"];
|
$tenantName = $json["tenantName"];
|
||||||
$tenantType = $json["tenantType"];
|
$tenantType = $json["tenantType"];
|
||||||
$tenantCount = $json["tenantCount"];
|
$tenantCount = $json["tenantCount"];
|
||||||
|
$purpose = $json["purpose"];
|
||||||
|
|
||||||
$stmt = $pdo->prepare("INSERT INTO mocha_tenants (tenant_name, global_identifier, effective_date, is_library) VALUES (:tenant_name, mocha_uuid_v4(), NOW(), 0)");
|
$stmt = $pdo->prepare("INSERT INTO mocha_tenants (tenant_name, global_identifier, effective_date, is_library, tenant_purpose) VALUES (:tenant_name, mocha_uuid_v4(), NOW(), 0, :tenant_purpose)");
|
||||||
$stmt2 = $pdo->prepare("INSERT INTO mocha_tenant_references (source_tenant_id, target_tenant_id) VALUES (:source_tenant_id, 1)");
|
$stmt2 = $pdo->prepare("INSERT INTO mocha_tenant_references (source_tenant_id, target_tenant_id) VALUES (:source_tenant_id, 1)");
|
||||||
|
|
||||||
if ($tenantCount == 1)
|
if ($tenantCount == 1)
|
||||||
{
|
{
|
||||||
$result = $stmt->execute(array
|
$result = $stmt->execute(array
|
||||||
(
|
(
|
||||||
"tenant_name" => $tenantName
|
"tenant_name" => $tenantName,
|
||||||
|
"tenant_purpose" => $purpose
|
||||||
));
|
));
|
||||||
|
|
||||||
$lastInsertId = $pdo->lastInsertId();
|
$lastInsertId = $pdo->lastInsertId();
|
||||||
@ -48,7 +50,8 @@
|
|||||||
{
|
{
|
||||||
$result = $stmt->execute(array
|
$result = $stmt->execute(array
|
||||||
(
|
(
|
||||||
"tenant_name" => $tenantName . ($i + 1)
|
"tenant_name" => $tenantName . ($i + 1),
|
||||||
|
"tenant_purpose" => $purpose
|
||||||
));
|
));
|
||||||
|
|
||||||
$lastInsertId = $pdo->lastInsertId();
|
$lastInsertId = $pdo->lastInsertId();
|
||||||
|
|||||||
@ -64,7 +64,8 @@ window.addEventListener("load", function()
|
|||||||
"action": "createTenant",
|
"action": "createTenant",
|
||||||
"tenantName": dlg.getField("tenant_name").getValue(),
|
"tenantName": dlg.getField("tenant_name").getValue(),
|
||||||
"tenantType": dlg.getField("tenant_type").getValue(),
|
"tenantType": dlg.getField("tenant_type").getValue(),
|
||||||
"tenantCount": dlg.getField("tenant_count").getValue()
|
"tenantCount": dlg.getField("tenant_count").getValue(),
|
||||||
|
"purpose": dlg.getField("tenant_purpose").getValue()
|
||||||
}, function()
|
}, function()
|
||||||
{
|
{
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@ -136,6 +137,12 @@ window.addEventListener("load", function()
|
|||||||
"value": 1,
|
"value": 1,
|
||||||
"minimumValue": 1,
|
"minimumValue": 1,
|
||||||
"maximumValue": 9
|
"maximumValue": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "tenant_purpose",
|
||||||
|
"type": "text",
|
||||||
|
"multiline": true,
|
||||||
|
"title": "Purpose"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|||||||
@ -124,27 +124,46 @@ Dialog.ShowDialog = function(title, prompt, buttons, fields, callback)
|
|||||||
}
|
}
|
||||||
else if (fields[i].type == "text" || fields[i].type == "numeric")
|
else if (fields[i].type == "text" || fields[i].type == "numeric")
|
||||||
{
|
{
|
||||||
var input = document.createElement("input");
|
if (typeof(fields[i].multiline) === 'undefined' || fields[i].multiline !== true)
|
||||||
if (fields[i].type == "numeric")
|
|
||||||
{
|
{
|
||||||
input.type = "number";
|
var input = document.createElement("input");
|
||||||
|
if (fields[i].type == "numeric")
|
||||||
|
{
|
||||||
|
input.type = "number";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
input.type = "text";
|
||||||
|
}
|
||||||
|
td.appendChild(input);
|
||||||
|
|
||||||
|
if (typeof(fields[i].value) !== 'undefined')
|
||||||
|
{
|
||||||
|
input.value = fields[i].value;
|
||||||
|
}
|
||||||
|
|
||||||
|
fields[i].element = input;
|
||||||
|
fields[i].getValue = function()
|
||||||
|
{
|
||||||
|
return this.element.value;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
input.type = "text";
|
var input = document.createElement("textarea");
|
||||||
}
|
td.appendChild(input);
|
||||||
td.appendChild(input);
|
|
||||||
|
|
||||||
if (typeof(fields[i].value) == 'number')
|
if (typeof(fields[i].value) !== 'undefined')
|
||||||
{
|
{
|
||||||
input.value = fields[i].value;
|
input.value = fields[i].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
fields[i].element = input;
|
fields[i].element = input;
|
||||||
fields[i].getValue = function()
|
fields[i].getValue = function()
|
||||||
{
|
{
|
||||||
return this.element.value;
|
return this.element.value;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (fields[i].type == "choice")
|
else if (fields[i].type == "choice")
|
||||||
{
|
{
|
||||||
|
|||||||
@ -149,7 +149,7 @@
|
|||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td><?php echo($values["tenant_purpose"]); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user