|
@@ -28,9 +28,9 @@ $fields = [
|
|
|
];
|
|
|
|
|
|
$customFields = $pro->canvasCustomItems('sochx');
|
|
|
-$customFields = array_map(function($_item) {
|
|
|
+/*$customFields = array_map(function($_item) {
|
|
|
return $_item['label'];
|
|
|
-}, $customFields->toArray());
|
|
|
+}, $customFields->toArray());*/
|
|
|
|
|
|
if(!$customFields) $customFields = [];
|
|
|
|
|
@@ -54,9 +54,7 @@ for ($i = 0; $i < count($fields); $i++) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
?>
|
|
|
-
|
|
|
<hr class="hide-outside-popup mt-3 mb-0">
|
|
|
<div class="p-3 mcp-theme-1">
|
|
|
<div {{!!$segment ? 'visit-moe' : 'moe'}} close-on-save close-on-cancel class="d-block">
|
|
@@ -157,21 +155,36 @@ for ($i = 0; $i < count($fields); $i++) {
|
|
|
model.customFields = [];
|
|
|
}
|
|
|
for (let i = 0; i < myCustomFields.length; i++) {
|
|
|
- let found = model.customFields.filter(function(_item) {
|
|
|
- return _item.label === myCustomFields[i];
|
|
|
- }).length;
|
|
|
- if(!found) {
|
|
|
+ let foundAt = -1;
|
|
|
+ for (let j = 0; j < model.customFields.length; j++) {
|
|
|
+ if(model.customFields[j].label === myCustomFields[i].label) {
|
|
|
+ foundAt = j;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(foundAt === -1) {
|
|
|
model.customFields.push({
|
|
|
- label: myCustomFields[i],
|
|
|
+ label: myCustomFields[i].label,
|
|
|
value: '',
|
|
|
comments: '',
|
|
|
+ uid: myCustomFields[i].uid
|
|
|
})
|
|
|
}
|
|
|
+ else {
|
|
|
+ model.customFields[foundAt].uid = myCustomFields[i].uid;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// if not own AND not active - remove from model.customFields
|
|
|
for (let i = model.customFields.length - 1; i >= 0 ; i--) {
|
|
|
- if(myCustomFields.indexOf(model.customFields[i].label) === -1) {
|
|
|
+ let foundAt = -1;
|
|
|
+ for (let j = 0; j < myCustomFields.length; j++) {
|
|
|
+ if(model.customFields[i].label === myCustomFields[j].label) {
|
|
|
+ foundAt = j;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(foundAt === -1) {
|
|
|
if(!!model.customFields[i].value) {
|
|
|
model.customFields[i].other = true;
|
|
|
}
|