|
|
@@ -1,5 +1,9 @@ |
|
|
// ── Shared util ─────────────────────────────────────────────────────────────── |
|
|
// ── Shared util ─────────────────────────────────────────────────────────────── |
|
|
|
|
|
|
|
|
|
|
|
const PAGE_SIZES = [10, 25, 50, 100]; |
|
|
|
|
|
const PAGE_SIZES_SM = [5, 10, 25, 50]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _postDelete(action) { |
|
|
function _postDelete(action) { |
|
|
const form = document.createElement('form'); |
|
|
const form = document.createElement('form'); |
|
|
form.method = 'POST'; |
|
|
form.method = 'POST'; |
|
|
@@ -50,10 +54,23 @@ window.campaignTypeTable = function () { |
|
|
pagination: true, |
|
|
pagination: true, |
|
|
paginationMode: 'local', |
|
|
paginationMode: 'local', |
|
|
paginationSize: 10, |
|
|
paginationSize: 10, |
|
|
|
|
|
paginationSizeSelector: PAGE_SIZES, |
|
|
movableColumns: true, |
|
|
movableColumns: true, |
|
|
placeholder: 'No campaign types found.', |
|
|
placeholder: 'No campaign types found.', |
|
|
initialSort: [{ column: 'name', dir: 'asc' }], |
|
|
initialSort: [{ column: 'name', dir: 'asc' }], |
|
|
columns: [ |
|
|
columns: [ |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'id', |
|
|
|
|
|
width: 160, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
const id = cell.getValue(); |
|
|
|
|
|
return '<a href="/campaign-types/' + id + '/edit" class="button button-secondary button-sm">Edit</a> ' + |
|
|
|
|
|
'<button onclick="window.deleteCampaignType(' + id + ')" class="button button-danger button-sm">Delete</button>'; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
{ title: 'Name', field: 'name', minWidth: 200 }, |
|
|
{ title: 'Name', field: 'name', minWidth: 200 }, |
|
|
{ |
|
|
{ |
|
|
title: 'Attributes', |
|
|
title: 'Attributes', |
|
|
@@ -67,18 +84,6 @@ window.campaignTypeTable = function () { |
|
|
}, |
|
|
}, |
|
|
{ title: 'Count', field: 'attribute_count', hozAlign: 'center', width: 80 }, |
|
|
{ title: 'Count', field: 'attribute_count', hozAlign: 'center', width: 80 }, |
|
|
{ title: 'Created', field: 'created_at', minWidth: 160 }, |
|
|
{ title: 'Created', field: 'created_at', minWidth: 160 }, |
|
|
{ |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'id', |
|
|
|
|
|
width: 160, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
const id = cell.getValue(); |
|
|
|
|
|
return '<a href="/campaign-types/' + id + '/edit" class="button button-secondary button-sm">Edit</a> ' + |
|
|
|
|
|
'<button onclick="window.deleteCampaignType(' + id + ')" class="button button-danger button-sm">Delete</button>'; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
], |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
@@ -200,6 +205,7 @@ window.campaignTable = function () { |
|
|
pagination: true, |
|
|
pagination: true, |
|
|
paginationMode: 'local', |
|
|
paginationMode: 'local', |
|
|
paginationSize: 10, |
|
|
paginationSize: 10, |
|
|
|
|
|
paginationSizeSelector: PAGE_SIZES, |
|
|
movableColumns: true, |
|
|
movableColumns: true, |
|
|
placeholder: 'No campaigns found.', |
|
|
placeholder: 'No campaigns found.', |
|
|
initialSort: [{ column: 'campaign_type_name', dir: 'asc' }], |
|
|
initialSort: [{ column: 'campaign_type_name', dir: 'asc' }], |
|
|
@@ -275,6 +281,19 @@ window.campaignTable = function () { |
|
|
|
|
|
|
|
|
columnsForAttributes(attributes) { |
|
|
columnsForAttributes(attributes) { |
|
|
const columns = [ |
|
|
const columns = [ |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'id', |
|
|
|
|
|
width: 230, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
const id = cell.getValue(); |
|
|
|
|
|
return '<a href="/campaigns/' + id + '/jobs" class="button button-primary button-sm">Jobs</a> ' + |
|
|
|
|
|
'<a href="/campaigns/' + id + '/edit" class="button button-secondary button-sm">Edit</a> ' + |
|
|
|
|
|
'<button onclick="window.deleteCampaign(' + id + ')" class="button button-danger button-sm">Delete</button>'; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: 'Campaign Type', |
|
|
title: 'Campaign Type', |
|
|
field: 'campaign_type_name', |
|
|
field: 'campaign_type_name', |
|
|
@@ -297,20 +316,7 @@ window.campaignTable = function () { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
columns.push( |
|
|
columns.push( |
|
|
{ title: 'Created', field: 'created_at', minWidth: 160, headerFilter: 'input' }, |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'id', |
|
|
|
|
|
width: 230, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
const id = cell.getValue(); |
|
|
|
|
|
return '<a href="/campaigns/' + id + '/jobs" class="button button-primary button-sm">Jobs</a> ' + |
|
|
|
|
|
'<a href="/campaigns/' + id + '/edit" class="button button-secondary button-sm">Edit</a> ' + |
|
|
|
|
|
'<button onclick="window.deleteCampaign(' + id + ')" class="button button-danger button-sm">Delete</button>'; |
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
{ title: 'Created', field: 'created_at', minWidth: 160, headerFilter: 'input' } |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
return columns; |
|
|
return columns; |
|
|
@@ -387,6 +393,7 @@ window.campaignTable = function () { |
|
|
pagination: true, |
|
|
pagination: true, |
|
|
paginationMode: 'local', |
|
|
paginationMode: 'local', |
|
|
paginationSize: 10, |
|
|
paginationSize: 10, |
|
|
|
|
|
paginationSizeSelector: PAGE_SIZES, |
|
|
movableColumns: true, |
|
|
movableColumns: true, |
|
|
placeholder: 'No jobs found for this campaign.', |
|
|
placeholder: 'No jobs found for this campaign.', |
|
|
initialSort: [{ column: 'job_type_name', dir: 'asc' }], |
|
|
initialSort: [{ column: 'job_type_name', dir: 'asc' }], |
|
|
@@ -446,6 +453,16 @@ window.campaignTable = function () { |
|
|
|
|
|
|
|
|
jobColumnsForAttributes(attributes) { |
|
|
jobColumnsForAttributes(attributes) { |
|
|
const columns = [ |
|
|
const columns = [ |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'edit_url', |
|
|
|
|
|
width: 90, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
return '<a href="' + _escapeHtml(cell.getValue()) + '" class="button button-secondary button-sm">Edit</a>'; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
{ title: 'Job ID', field: 'id', width: 90, hozAlign: 'center', headerFilter: 'input' }, |
|
|
{ title: 'Job ID', field: 'id', width: 90, hozAlign: 'center', headerFilter: 'input' }, |
|
|
{ title: 'Campaign ID', field: 'campaign_id', width: 120, hozAlign: 'center', headerFilter: 'input' }, |
|
|
{ title: 'Campaign ID', field: 'campaign_id', width: 120, hozAlign: 'center', headerFilter: 'input' }, |
|
|
{ title: 'Job Type ID', field: 'job_type_id', width: 120, hozAlign: 'center', headerFilter: 'input' }, |
|
|
{ title: 'Job Type ID', field: 'job_type_id', width: 120, hozAlign: 'center', headerFilter: 'input' }, |
|
|
@@ -467,17 +484,7 @@ window.campaignTable = function () { |
|
|
|
|
|
|
|
|
columns.push( |
|
|
columns.push( |
|
|
{ title: 'Created', field: 'created_at', minWidth: 160, headerFilter: 'input' }, |
|
|
{ title: 'Created', field: 'created_at', minWidth: 160, headerFilter: 'input' }, |
|
|
{ title: 'Updated', field: 'updated_at', minWidth: 160, headerFilter: 'input' }, |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'edit_url', |
|
|
|
|
|
width: 90, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
return '<a href="' + _escapeHtml(cell.getValue()) + '" class="button button-secondary button-sm">Edit</a>'; |
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
{ title: 'Updated', field: 'updated_at', minWidth: 160, headerFilter: 'input' } |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
return columns; |
|
|
return columns; |
|
|
@@ -565,6 +572,7 @@ window.campaignJobsPageTable = function (campaignId, jobTypes) { |
|
|
pagination: true, |
|
|
pagination: true, |
|
|
paginationMode: 'local', |
|
|
paginationMode: 'local', |
|
|
paginationSize: 10, |
|
|
paginationSize: 10, |
|
|
|
|
|
paginationSizeSelector: PAGE_SIZES, |
|
|
movableColumns: true, |
|
|
movableColumns: true, |
|
|
placeholder: 'No jobs found for this campaign.', |
|
|
placeholder: 'No jobs found for this campaign.', |
|
|
initialSort: [{ column: 'job_type_name', dir: 'asc' }], |
|
|
initialSort: [{ column: 'job_type_name', dir: 'asc' }], |
|
|
@@ -644,6 +652,16 @@ window.campaignJobsPageTable = function (campaignId, jobTypes) { |
|
|
|
|
|
|
|
|
columnsForAttributes(attributes) { |
|
|
columnsForAttributes(attributes) { |
|
|
const columns = [ |
|
|
const columns = [ |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'edit_url', |
|
|
|
|
|
width: 90, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
return '<a href="' + _escapeHtml(cell.getValue()) + '" class="button button-secondary button-sm">Edit</a>'; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
{ title: 'Job ID', field: 'id', width: 90, hozAlign: 'center', headerFilter: 'input' }, |
|
|
{ title: 'Job ID', field: 'id', width: 90, hozAlign: 'center', headerFilter: 'input' }, |
|
|
{ title: 'Campaign ID', field: 'campaign_id', width: 120, hozAlign: 'center', headerFilter: 'input' }, |
|
|
{ title: 'Campaign ID', field: 'campaign_id', width: 120, hozAlign: 'center', headerFilter: 'input' }, |
|
|
{ title: 'Campaign Type', field: 'campaign_type_name', minWidth: 160, headerFilter: 'input' }, |
|
|
{ title: 'Campaign Type', field: 'campaign_type_name', minWidth: 160, headerFilter: 'input' }, |
|
|
@@ -666,17 +684,7 @@ window.campaignJobsPageTable = function (campaignId, jobTypes) { |
|
|
|
|
|
|
|
|
columns.push( |
|
|
columns.push( |
|
|
{ title: 'Created', field: 'created_at', minWidth: 160, headerFilter: 'input' }, |
|
|
{ title: 'Created', field: 'created_at', minWidth: 160, headerFilter: 'input' }, |
|
|
{ title: 'Updated', field: 'updated_at', minWidth: 160, headerFilter: 'input' }, |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'edit_url', |
|
|
|
|
|
width: 90, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
return '<a href="' + _escapeHtml(cell.getValue()) + '" class="button button-secondary button-sm">Edit</a>'; |
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
{ title: 'Updated', field: 'updated_at', minWidth: 160, headerFilter: 'input' } |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
return columns; |
|
|
return columns; |
|
|
@@ -1020,6 +1028,7 @@ window.campaignJobsTable = function (campaignId) { |
|
|
pagination: true, |
|
|
pagination: true, |
|
|
paginationMode: 'local', |
|
|
paginationMode: 'local', |
|
|
paginationSize: 5, |
|
|
paginationSize: 5, |
|
|
|
|
|
paginationSizeSelector: PAGE_SIZES_SM, |
|
|
movableColumns: true, |
|
|
movableColumns: true, |
|
|
placeholder: 'No jobs found for this job type.', |
|
|
placeholder: 'No jobs found for this job type.', |
|
|
initialSort: [{ column: 'created_at', dir: 'desc' }], |
|
|
initialSort: [{ column: 'created_at', dir: 'desc' }], |
|
|
@@ -1029,7 +1038,18 @@ window.campaignJobsTable = function (campaignId) { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
columnsForGroup(group) { |
|
|
columnsForGroup(group) { |
|
|
const columns = group.attributes.map((attr, index) => ({ |
|
|
|
|
|
|
|
|
const actions = { |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'edit_url', |
|
|
|
|
|
width: 90, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
return '<a href="' + _escapeHtml(cell.getValue()) + '" class="button button-secondary button-sm">Edit</a>'; |
|
|
|
|
|
}, |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const attrColumns = group.attributes.map((attr, index) => ({ |
|
|
title: attr.name, |
|
|
title: attr.name, |
|
|
field: 'attr_' + index, |
|
|
field: 'attr_' + index, |
|
|
minWidth: 150, |
|
|
minWidth: 150, |
|
|
@@ -1039,25 +1059,11 @@ window.campaignJobsTable = function (campaignId) { |
|
|
}, |
|
|
}, |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
if (columns.length === 0) { |
|
|
|
|
|
columns.push({ title: 'Job ID', field: 'id', width: 90, hozAlign: 'center' }); |
|
|
|
|
|
|
|
|
if (attrColumns.length === 0) { |
|
|
|
|
|
attrColumns.push({ title: 'Job ID', field: 'id', width: 90, hozAlign: 'center' }); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
columns.push( |
|
|
|
|
|
{ title: 'Created', field: 'created_at', minWidth: 160 }, |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'edit_url', |
|
|
|
|
|
width: 90, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
return '<a href="' + _escapeHtml(cell.getValue()) + '" class="button button-secondary button-sm">Edit</a>'; |
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return columns; |
|
|
|
|
|
|
|
|
return [actions, ...attrColumns, { title: 'Created', field: 'created_at', minWidth: 160 }]; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
destroyTables() { |
|
|
destroyTables() { |
|
|
@@ -1094,10 +1100,23 @@ window.jobTypeTable = function () { |
|
|
pagination: true, |
|
|
pagination: true, |
|
|
paginationMode: 'local', |
|
|
paginationMode: 'local', |
|
|
paginationSize: 10, |
|
|
paginationSize: 10, |
|
|
|
|
|
paginationSizeSelector: PAGE_SIZES, |
|
|
movableColumns: true, |
|
|
movableColumns: true, |
|
|
placeholder: 'No job types found.', |
|
|
placeholder: 'No job types found.', |
|
|
initialSort: [{ column: 'name', dir: 'asc' }], |
|
|
initialSort: [{ column: 'name', dir: 'asc' }], |
|
|
columns: [ |
|
|
columns: [ |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'id', |
|
|
|
|
|
width: 160, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
const id = cell.getValue(); |
|
|
|
|
|
return '<a href="/job-types/' + id + '/edit" class="button button-secondary button-sm">Edit</a> ' + |
|
|
|
|
|
'<button onclick="window.deleteJobType(' + id + ')" class="button button-danger button-sm">Delete</button>'; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
{ title: 'Name', field: 'name', minWidth: 200 }, |
|
|
{ title: 'Name', field: 'name', minWidth: 200 }, |
|
|
{ |
|
|
{ |
|
|
title: 'Attributes', |
|
|
title: 'Attributes', |
|
|
@@ -1111,18 +1130,6 @@ window.jobTypeTable = function () { |
|
|
}, |
|
|
}, |
|
|
{ title: 'Count', field: 'attribute_count', hozAlign: 'center', width: 80 }, |
|
|
{ title: 'Count', field: 'attribute_count', hozAlign: 'center', width: 80 }, |
|
|
{ title: 'Created', field: 'created_at', minWidth: 160 }, |
|
|
{ title: 'Created', field: 'created_at', minWidth: 160 }, |
|
|
{ |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'id', |
|
|
|
|
|
width: 160, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
const id = cell.getValue(); |
|
|
|
|
|
return '<a href="/job-types/' + id + '/edit" class="button button-secondary button-sm">Edit</a> ' + |
|
|
|
|
|
'<button onclick="window.deleteJobType(' + id + ')" class="button button-danger button-sm">Delete</button>'; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
], |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
@@ -1218,10 +1225,23 @@ window.jobTable = function () { |
|
|
pagination: true, |
|
|
pagination: true, |
|
|
paginationMode: 'local', |
|
|
paginationMode: 'local', |
|
|
paginationSize: 10, |
|
|
paginationSize: 10, |
|
|
|
|
|
paginationSizeSelector: PAGE_SIZES, |
|
|
movableColumns: true, |
|
|
movableColumns: true, |
|
|
placeholder: 'No jobs found.', |
|
|
placeholder: 'No jobs found.', |
|
|
initialSort: [{ column: 'job_type_name', dir: 'asc' }], |
|
|
initialSort: [{ column: 'job_type_name', dir: 'asc' }], |
|
|
columns: [ |
|
|
columns: [ |
|
|
|
|
|
{ |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'id', |
|
|
|
|
|
width: 160, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
const id = cell.getValue(); |
|
|
|
|
|
return '<a href="/jobs/' + id + '/edit" class="button button-secondary button-sm">Edit</a> ' + |
|
|
|
|
|
'<button onclick="window.deleteJob(' + id + ')" class="button button-danger button-sm">Delete</button>'; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
{ title: 'Campaign', field: 'campaign_type_name', minWidth: 160 }, |
|
|
{ title: 'Campaign', field: 'campaign_type_name', minWidth: 160 }, |
|
|
{ title: 'Job Type', field: 'job_type_name', minWidth: 160 }, |
|
|
{ title: 'Job Type', field: 'job_type_name', minWidth: 160 }, |
|
|
{ |
|
|
{ |
|
|
@@ -1235,18 +1255,6 @@ window.jobTable = function () { |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
{ title: 'Created', field: 'created_at', minWidth: 160 }, |
|
|
{ title: 'Created', field: 'created_at', minWidth: 160 }, |
|
|
{ |
|
|
|
|
|
title: 'Actions', |
|
|
|
|
|
field: 'id', |
|
|
|
|
|
width: 160, |
|
|
|
|
|
hozAlign: 'center', |
|
|
|
|
|
headerSort: false, |
|
|
|
|
|
formatter: function (cell) { |
|
|
|
|
|
const id = cell.getValue(); |
|
|
|
|
|
return '<a href="/jobs/' + id + '/edit" class="button button-secondary button-sm">Edit</a> ' + |
|
|
|
|
|
'<button onclick="window.deleteJob(' + id + ')" class="button button-danger button-sm">Delete</button>'; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
], |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|