added new custom 300 table
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user