added new custom 300 table
This commit is contained in:
@@ -24,7 +24,7 @@ $pagination_entity_name = "Vorbestellungen";
|
||||
}
|
||||
|
||||
.preorder-campaign-header-buttons {
|
||||
max-width: 650px;
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
.tr-highlight {
|
||||
@@ -404,6 +404,17 @@ $pagination_entity_name = "Vorbestellungen";
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($me->isAdmin() || $me->address->id == 209): ?>
|
||||
<div class="col-sm-12 col-md-2">
|
||||
<label class="form-label" for="billed">Verrechnet</label>
|
||||
<select name="filter[billed]" id="filter_billed" class="form-control">
|
||||
<option value=""></option>
|
||||
<option value="1" <?=(isset($filter) && array_key_exists("billed", $filter) && strlen($filter['billed']) && intval($filter['billed']) === 0) ? "selected='selected'" : ""?>>Ja</option>
|
||||
<option value="0" <?=(isset($filter) && array_key_exists("billed", $filter) && intval($filter['billed']) === 1) ? "selected='selected'" : ""?>>Nein</option>
|
||||
</select>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row mt-2">
|
||||
@@ -417,6 +428,9 @@ $pagination_entity_name = "Vorbestellungen";
|
||||
<?php if(!$me->is("Preorderfront")): ?>
|
||||
<button type="submit" formaction="<?=self::getUrl("Preorder", "export")?>" id="export-button" class="btn btn-outline-success"><i class="fas fa-download"></i> CSV-Export</button>
|
||||
<?php endif; ?>
|
||||
<?php if ($me->isAdmin() || $me->address->id == 209): ?>
|
||||
<a href="<?=self::getUrl("Preorder", "custom300")?>" class="btn btn-outline-info"><i class="fas fa-envelope"></i> Custom-300 Benachrichtigungen</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
|
||||
@@ -1638,4 +1638,33 @@ class PreorderController extends mfBaseController {
|
||||
];
|
||||
}
|
||||
|
||||
public function custom300Action() {
|
||||
// Ensure PreorderModel is available or include it if necessary.
|
||||
// For this example, assuming PreorderModel exists and getAll300CustomPreorders is defined.
|
||||
$preorders = PreorderModel::getAll300CustomPreorders();
|
||||
|
||||
// Prepare JS variables to be sent to the frontend.
|
||||
// The data from getAll300CustomPreorders is already in a suitable format (objects with specific properties),
|
||||
// so we can pass it directly.
|
||||
$JSGlobals = [
|
||||
"BASE_URL" => self::getUrl(""),
|
||||
"MFAPPNAME" => MFAPPNAME_SLUG,
|
||||
"PAGE_TITLE" => "Custom Preorders (300)",
|
||||
"PATH" => [
|
||||
["text" => MFAPPNAME_SLUG, "href" => self::getUrl("Dashboard")],
|
||||
["text" => "Custom Preorders (300)", "href" => self::getUrl("Preorder/custom300")] // Adjust URL if module is different
|
||||
],
|
||||
"PREORDERS_DATA" => $preorders, // Directly pass the fetched data
|
||||
"IS_ADMIN" => $this->me->is(["Admin"]), // Pass admin status if needed in frontend
|
||||
];
|
||||
|
||||
// Ensure the additionalJS array includes your custom Vue component file.
|
||||
// This assumes PreorderCustom300.js is located in public/js/pages/Preorder/.
|
||||
$this->layout()->set('additionalJS', array_merge($this->additionalJS ?? [], ['js/pages/Preorder/PreorderCustom300.js']));
|
||||
|
||||
// Set layout for Vue view.
|
||||
$this->layout()->set("vueViewName", "PreorderCustom300"); // Name of the Vue component
|
||||
$this->layout()->set("JSGlobals", $JSGlobals);
|
||||
$this->layout()->setTemplate("VueViews/Vue"); // Assuming a generic Vue template
|
||||
}
|
||||
}
|
||||
|
||||
@@ -948,6 +948,15 @@ class PreorderModel
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists("billed", $filter)) {
|
||||
$billed = $filter['billed'];
|
||||
if ($billed == 0 || $billed === null) {
|
||||
$where .= " AND (tt_preorder.billed IS NULL OR tt_preorder.billed = 0)";
|
||||
} elseif ($billed) {
|
||||
$where .= " AND tt_preorder.billed > 0";
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists("plz", $filter)) {
|
||||
$plz = FronkDB::singleton()->escape($filter['plz']);
|
||||
if ($plz) {
|
||||
@@ -1255,5 +1264,42 @@ class PreorderModel
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function getAll300CustomPreorders() {
|
||||
$sql = "SELECT
|
||||
p.id AS preorder_id,
|
||||
p.ucode,
|
||||
p.email AS preorder_email,
|
||||
p.type AS preorder_type,
|
||||
p.preordercampaign_id,
|
||||
pc.name AS campaign_name,
|
||||
ps_current.code AS current_status_code,
|
||||
ps_current.name AS current_status_name,
|
||||
psnl.email AS notification_logged_email,
|
||||
psnl.email_type AS notification_type_logged,
|
||||
FROM_UNIXTIME(psnl.create) AS notification_log_timestamp
|
||||
FROM
|
||||
PreorderStatusnotificationLog psnl
|
||||
INNER JOIN
|
||||
Preorder p ON psnl.preorder_id = p.id
|
||||
INNER JOIN
|
||||
Preordercampaign pc ON p.preordercampaign_id = pc.id
|
||||
INNER JOIN
|
||||
Preorderstatus ps_current ON p.status_id = ps_current.id
|
||||
WHERE
|
||||
psnl.email_type = '300-custom'
|
||||
ORDER BY
|
||||
psnl.create DESC;";
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
$res = $db->query($sql);
|
||||
$items = [];
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = $data;
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
95
public/js/pages/PreorderCustom300/PreorderCustom300.js
Normal file
95
public/js/pages/PreorderCustom300/PreorderCustom300.js
Normal file
@@ -0,0 +1,95 @@
|
||||
Vue.component('PreorderCustom300', {
|
||||
template: `
|
||||
<tt-card>
|
||||
<tt-table :data="window['TT_CONFIG']['PREORDERS_DATA']" :config="preorderTableConfig" excel-export>
|
||||
|
||||
<template v-slot:preorder_id="{ row }">
|
||||
<strong>{{ row.preorder_id }}</strong>
|
||||
</template>
|
||||
|
||||
<template v-slot:ucode="{ row }">
|
||||
{{ row.ucode }}
|
||||
</template>
|
||||
|
||||
<template v-slot:preorder_email="{ row }">
|
||||
<a :href="'mailto:' + row.preorder_email">{{ row.preorder_email }}</a>
|
||||
</template>
|
||||
|
||||
<template v-slot:campaign_name="{ row }">
|
||||
{{ row.campaign_name }}
|
||||
</template>
|
||||
|
||||
<template v-slot:current_status_name="{ row }">
|
||||
<span :class="getStatusClass(row.current_status_code)">{{ row.current_status_name }}</span>
|
||||
</template>
|
||||
|
||||
<template v-slot:notification_logged_email="{ row }">
|
||||
{{ row.notification_logged_email }}
|
||||
</template>
|
||||
|
||||
<template v-slot:notification_type_logged="{ row }">
|
||||
{{ row.notification_type_logged }}
|
||||
</template>
|
||||
|
||||
<template v-slot:notification_log_timestamp="{ row }">
|
||||
<span>{{ window.moment(row.notification_log_timestamp).format('DD.MM.YYYY HH:mm:ss') }}</span>
|
||||
</template>
|
||||
|
||||
<template v-slot:actions="{ row }">
|
||||
<a :href="'/Preorder?filter[ucode]=' + row.ucode" target="_blank" class="btn btn-primary btn-sm">
|
||||
<i class="fas fa-eye"></i> Details
|
||||
</a>
|
||||
</template>
|
||||
</tt-table>
|
||||
</tt-card>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
window: window,
|
||||
preorderTableConfig: {
|
||||
key: 'PreorderCustom300Table',
|
||||
tableHeader: 'Kundenspezifische Vorbestellungen (Typ 300)',
|
||||
defaultPageSize: 10,
|
||||
headers: [
|
||||
{text: 'Bestellcode', key: 'ucode', sortable: true, class: 'text-nowrap', filter: 'search'},
|
||||
{text: 'Preorder E-Mail', key: 'preorder_email', sortable: true, class: 'text-nowrap', filter: 'search'},
|
||||
{text: 'Kampagnenname', key: 'campaign_name', sortable: true, class: 'text-nowrap', filter: 'search'},
|
||||
{
|
||||
text: 'Aktueller Status',
|
||||
key: 'current_status_name',
|
||||
sortable: true,
|
||||
class: 'text-center',
|
||||
filter: 'select',
|
||||
// Assuming current_status_code values correspond to different statuses
|
||||
filterOptions: [
|
||||
{value: 'Waiting for Service', text: 'Warten auf Service'},
|
||||
{value: 'Ready for Service', text: 'Bereit für Service'},
|
||||
{value: 'Finished', text: 'Abgeschlossen'},
|
||||
]
|
||||
},
|
||||
{text: 'Log E-Mail', key: 'notification_logged_email', sortable: true, class: 'text-nowrap', filter: 'search'},
|
||||
{text: 'Log Typ', key: 'notification_type_logged', sortable: true, class: 'text-nowrap', filter: 'search'},
|
||||
{text: 'Log Zeitstempel', key: 'notification_log_timestamp', sortable: true, class: 'text-center', filter: 'date'},
|
||||
{text: 'Aktionen', key: 'actions', class: 'text-center', sortable: false, filter: false},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// You might need to adjust this based on actual 'current_status_code' values
|
||||
getStatusClass(statusCode) {
|
||||
switch (statusCode) {
|
||||
case 'new':
|
||||
return 'badge badge-primary';
|
||||
case 'pending':
|
||||
return 'badge badge-warning';
|
||||
case 'completed':
|
||||
return 'badge badge-success';
|
||||
case 'cancelled':
|
||||
return 'badge badge-danger';
|
||||
default:
|
||||
return 'badge badge-secondary';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user