Commercial -> infomercial
This commit is contained in:
parent
999e76744b
commit
ced3b87e1d
@ -73,7 +73,7 @@ mysql -u talpa_user -p talpa_planning -e "SHOW TABLES;"
|
||||
|
||||
Je zou moeten zien:
|
||||
- block_templates
|
||||
- commercials
|
||||
- infomercials
|
||||
- daily_blocks
|
||||
- transmissions
|
||||
|
||||
@ -202,7 +202,7 @@ http://talpa-planning.local/
|
||||
```
|
||||
|
||||
**8.2 Controleer of je het dashboard ziet met:**
|
||||
- Navigatie menu (Dashboard, Kalender, Blokken, Commercials)
|
||||
- Navigatie menu (Dashboard, Kalender, Blokken, Infomercials)
|
||||
- Statistieken cards
|
||||
- Snelle acties
|
||||
|
||||
@ -220,9 +220,9 @@ http://talpa-planning.local/
|
||||
- Net5 Ochtendblok (07:30-11:30)
|
||||
- Net5 Middagblok (13:20-13:50)
|
||||
|
||||
**9.2 Test Commercial Registratie:**
|
||||
- Ga naar **Commercials**
|
||||
- Probeer een test commercial aan te maken:
|
||||
**9.2 Test Infomercial Registratie:**
|
||||
- Ga naar **Infomercials**
|
||||
- Probeer een test infomercial aan te maken:
|
||||
- Titel: "Test Product"
|
||||
- Duur: 00:30:00
|
||||
- Series Code: TEST01
|
||||
@ -231,7 +231,7 @@ http://talpa-planning.local/
|
||||
**9.3 Test Kalender:**
|
||||
- Ga naar **Kalender**
|
||||
- Controleer of de kalender laadt
|
||||
- Probeer een commercial te slepen (als je er een hebt aangemaakt)
|
||||
- Probeer een infomercial te slepen (als je er een hebt aangemaakt)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@ -355,7 +355,7 @@ Bij problemen:
|
||||
- [ ] Webserver geconfigureerd
|
||||
- [ ] Dashboard bereikbaar in browser
|
||||
- [ ] Blok templates zichtbaar
|
||||
- [ ] Test commercial aangemaakt
|
||||
- [ ] Test infomercial aangemaakt
|
||||
- [ ] Kalender laadt correct
|
||||
|
||||
Als alle items zijn afgevinkt, is de installatie succesvol! 🎉
|
||||
|
||||
32
README.md
32
README.md
@ -11,10 +11,10 @@ Een geavanceerd TV-planning systeem voor het beheren en plannen van homeshopping
|
||||
- **Kleurgecodeerde uitzendingen** voor overzichtelijkheid
|
||||
- **Conflict detectie** bij overlappende uitzendingen
|
||||
|
||||
### 📺 Commercial Management
|
||||
- Registratie van commercials via Talpa API
|
||||
### 📺 Infomercial Management
|
||||
- Registratie van infomercials via Talpa API
|
||||
- Automatische media asset aanmaak
|
||||
- Kleurcode toewijzing per commercial
|
||||
- Kleurcode toewijzing per infomercial
|
||||
- Series code voor groepering
|
||||
- Upload status tracking
|
||||
|
||||
@ -102,7 +102,7 @@ chmod 644 api/*.php
|
||||
├── index.php # Dashboard
|
||||
├── calendar.php # Kalender planning view
|
||||
├── blocks.php # Blok template management
|
||||
├── commercials.php # Commercial management
|
||||
├── infomercials.php # Infomercial management
|
||||
├── helpers.php # Helper functies
|
||||
├── TalpaAPI.php # API wrapper
|
||||
├── /api # API endpoints
|
||||
@ -142,9 +142,9 @@ chmod 644 api/*.php
|
||||
- Net5 Ochtend: Ma-Vr, 07:30-11:30
|
||||
- Net5 Middag: Ma-Vr, 13:20-13:50
|
||||
|
||||
### 2. Commercials Registreren
|
||||
### 2. Infomercials Registreren
|
||||
|
||||
1. Ga naar **Commercials** in het menu
|
||||
1. Ga naar **Infomercials** in het menu
|
||||
2. Vul het formulier in:
|
||||
- Product naam
|
||||
- Duur (HH:MM:SS formaat)
|
||||
@ -165,7 +165,7 @@ chmod 644 api/*.php
|
||||
- Wijzig de starttijd
|
||||
- Kies of je alle uitzendingen wilt herberekenen
|
||||
4. **Plan uitzendingen:**
|
||||
- Sleep een commercial uit de sidebar
|
||||
- Sleep een infomercial uit de sidebar
|
||||
- Drop deze op het gewenste tijdslot
|
||||
- Het systeem berekent automatisch de volgende starttijd
|
||||
5. **Bewerk uitzendingen:**
|
||||
@ -184,12 +184,12 @@ chmod 644 api/*.php
|
||||
|
||||
## 🎨 Kleurcode Systeem
|
||||
|
||||
Het systeem wijst automatisch unieke kleuren toe aan commercials voor visuele identificatie:
|
||||
Het systeem wijst automatisch unieke kleuren toe aan infomercials voor visuele identificatie:
|
||||
|
||||
- Kleuren worden automatisch gegenereerd met voldoende contrast
|
||||
- Elke commercial krijgt een unieke kleur
|
||||
- Elke infomercial krijgt een unieke kleur
|
||||
- Series codes kunnen dezelfde kleur delen
|
||||
- Kleuren zijn handmatig aanpasbaar in Commercial Management
|
||||
- Kleuren zijn handmatig aanpasbaar in Infomercial Management
|
||||
|
||||
## 🔧 Geavanceerde Functies
|
||||
|
||||
@ -230,12 +230,12 @@ Wanneer je een blok starttijd aanpast:
|
||||
|
||||
### Drag-and-drop werkt niet
|
||||
|
||||
**Probleem:** Commercials zijn niet sleepbaar
|
||||
**Probleem:** Infomercials zijn niet sleepbaar
|
||||
|
||||
**Oplossing:**
|
||||
1. Controleer of FullCalendar correct is geladen
|
||||
2. Check browser console voor errors
|
||||
3. Zorg dat commercials status "uploaded" hebben
|
||||
3. Zorg dat infomercials status "uploaded" hebben
|
||||
|
||||
### API Sync Errors
|
||||
|
||||
@ -260,7 +260,7 @@ Wanneer je een blok starttijd aanpast:
|
||||
```
|
||||
2. Controleer of alle kolommen bestaan:
|
||||
```sql
|
||||
SHOW COLUMNS FROM commercials LIKE 'color_code';
|
||||
SHOW COLUMNS FROM infomercials LIKE 'color_code';
|
||||
```
|
||||
|
||||
## 📊 Database Schema
|
||||
@ -279,7 +279,7 @@ Wanneer je een blok starttijd aanpast:
|
||||
|
||||
### Uitgebreide Kolommen
|
||||
|
||||
**commercials**
|
||||
**infomercials**
|
||||
- `color_code` (VARCHAR(7)): Hex kleurcode
|
||||
- `series_code` (VARCHAR(20)): Series identifier
|
||||
|
||||
@ -319,7 +319,7 @@ Voor vragen of problemen:
|
||||
### Versie 1.0.0 (2026-01-13)
|
||||
- ✅ Kalender planning met drag-and-drop
|
||||
- ✅ Blok template management
|
||||
- ✅ Commercial management met kleurcodes
|
||||
- ✅ Infomercial management met kleurcodes
|
||||
- ✅ Automatische tijdberekening
|
||||
- ✅ Talpa API integratie
|
||||
- ✅ Conflict detectie
|
||||
@ -328,7 +328,7 @@ Voor vragen of problemen:
|
||||
## 🎯 Roadmap
|
||||
|
||||
Toekomstige features:
|
||||
- [ ] Bulk import van commercials
|
||||
- [ ] Bulk import van infomercials
|
||||
- [ ] Excel export van planning
|
||||
- [ ] Email notificaties bij sync errors
|
||||
- [ ] Gebruikersbeheer en rechten
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* API Endpoint: Assign Color to Commercial
|
||||
* Assigns or updates color code for a commercial
|
||||
* API Endpoint: Assign Color to Infomercial
|
||||
* Assigns or updates color code for a infomercial
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
@ -25,22 +25,22 @@ try {
|
||||
}
|
||||
|
||||
// Validate required fields
|
||||
if (empty($input['commercial_id'])) {
|
||||
if (empty($input['infomercial_id'])) {
|
||||
jsonResponse([
|
||||
'success' => false,
|
||||
'error' => 'Missing commercial_id'
|
||||
'error' => 'Missing infomercial_id'
|
||||
], 400);
|
||||
}
|
||||
|
||||
// Check if commercial exists
|
||||
$stmt = $db->prepare("SELECT id, color_code FROM commercials WHERE id = ?");
|
||||
$stmt->execute([$input['commercial_id']]);
|
||||
$commercial = $stmt->fetch();
|
||||
// Check if infomercial exists
|
||||
$stmt = $db->prepare("SELECT id, color_code FROM infomercials WHERE id = ?");
|
||||
$stmt->execute([$input['infomercial_id']]);
|
||||
$infomercial = $stmt->fetch();
|
||||
|
||||
if (!$commercial) {
|
||||
if (!$infomercial) {
|
||||
jsonResponse([
|
||||
'success' => false,
|
||||
'error' => 'Commercial not found'
|
||||
'error' => 'Infomercial not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
@ -60,33 +60,33 @@ try {
|
||||
}
|
||||
} else {
|
||||
// Auto-generate distinct color
|
||||
$stmt = $db->query("SELECT color_code FROM commercials WHERE color_code IS NOT NULL");
|
||||
$stmt = $db->query("SELECT color_code FROM infomercials WHERE color_code IS NOT NULL");
|
||||
$existingColors = $stmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
|
||||
$colorCode = generateDistinctColor($existingColors);
|
||||
}
|
||||
|
||||
// Update commercial
|
||||
// Update infomercial
|
||||
$stmt = $db->prepare("
|
||||
UPDATE commercials
|
||||
UPDATE infomercials
|
||||
SET color_code = ?, series_code = ?
|
||||
WHERE id = ?
|
||||
");
|
||||
$stmt->execute([
|
||||
$colorCode,
|
||||
$input['series_code'] ?? null,
|
||||
$input['commercial_id']
|
||||
$input['infomercial_id']
|
||||
]);
|
||||
|
||||
// Get updated commercial
|
||||
$stmt = $db->prepare("SELECT * FROM commercials WHERE id = ?");
|
||||
$stmt->execute([$input['commercial_id']]);
|
||||
// Get updated infomercial
|
||||
$stmt = $db->prepare("SELECT * FROM infomercials WHERE id = ?");
|
||||
$stmt->execute([$input['infomercial_id']]);
|
||||
$updated = $stmt->fetch();
|
||||
|
||||
jsonResponse([
|
||||
'success' => true,
|
||||
'message' => 'Color assigned successfully',
|
||||
'commercial' => $updated
|
||||
'infomercial' => $updated
|
||||
]);
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
@ -25,7 +25,7 @@ try {
|
||||
}
|
||||
|
||||
// Validate required fields
|
||||
$required = ['commercial_id', 'channel', 'start_date', 'start_time'];
|
||||
$required = ['infomercial_id', 'channel', 'start_date', 'start_time'];
|
||||
foreach ($required as $field) {
|
||||
if (empty($input[$field])) {
|
||||
jsonResponse([
|
||||
@ -50,15 +50,15 @@ try {
|
||||
], 400);
|
||||
}
|
||||
|
||||
// Get commercial details (duration)
|
||||
$stmt = $db->prepare("SELECT duration, title FROM commercials WHERE id = ?");
|
||||
$stmt->execute([$input['commercial_id']]);
|
||||
$commercial = $stmt->fetch();
|
||||
// Get infomercial details (duration)
|
||||
$stmt = $db->prepare("SELECT duration, title FROM infomercials WHERE id = ?");
|
||||
$stmt->execute([$input['infomercial_id']]);
|
||||
$infomercial = $stmt->fetch();
|
||||
|
||||
if (!$commercial) {
|
||||
if (!$infomercial) {
|
||||
jsonResponse([
|
||||
'success' => false,
|
||||
'error' => 'Commercial not found'
|
||||
'error' => 'Infomercial not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ try {
|
||||
$template = $input['template'] ?? 'HOME030';
|
||||
|
||||
// Calculate end time
|
||||
$endTime = addTimeToTime($input['start_time'], $commercial['duration']);
|
||||
$endTime = addTimeToTime($input['start_time'], $infomercial['duration']);
|
||||
|
||||
// Validate that transmission falls within a block (inline to avoid curl issues)
|
||||
ensureDailyBlocks($db, $input['start_date'], $input['start_date']);
|
||||
@ -126,7 +126,7 @@ try {
|
||||
$stmt = $db->prepare("
|
||||
SELECT t.id, t.start_time, t.duration, c.title
|
||||
FROM transmissions t
|
||||
JOIN commercials c ON t.commercial_id = c.id
|
||||
JOIN infomercials c ON t.infomercial_id = c.id
|
||||
WHERE t.start_date = ?
|
||||
AND t.channel = ?
|
||||
AND t.id != ?
|
||||
@ -152,17 +152,17 @@ try {
|
||||
// Insert transmission
|
||||
$stmt = $db->prepare("
|
||||
INSERT INTO transmissions
|
||||
(commercial_id, channel, template, start_date, start_time, duration, api_status)
|
||||
(infomercial_id, channel, template, start_date, start_time, duration, api_status)
|
||||
VALUES (?, ?, ?, ?, ?, ?, 'pending')
|
||||
");
|
||||
|
||||
$stmt->execute([
|
||||
$input['commercial_id'],
|
||||
$input['infomercial_id'],
|
||||
$input['channel'],
|
||||
$template,
|
||||
$input['start_date'],
|
||||
$input['start_time'],
|
||||
$commercial['duration']
|
||||
$infomercial['duration']
|
||||
]);
|
||||
|
||||
$transmissionId = $db->lastInsertId();
|
||||
@ -175,7 +175,7 @@ try {
|
||||
c.color_code,
|
||||
c.series_code
|
||||
FROM transmissions t
|
||||
JOIN commercials c ON t.commercial_id = c.id
|
||||
JOIN infomercials c ON t.infomercial_id = c.id
|
||||
WHERE t.id = ?
|
||||
");
|
||||
$stmt->execute([$transmissionId]);
|
||||
|
||||
@ -29,7 +29,7 @@ try {
|
||||
$sql = "
|
||||
SELECT
|
||||
t.id,
|
||||
t.commercial_id,
|
||||
t.infomercial_id,
|
||||
t.channel,
|
||||
t.template,
|
||||
t.start_date,
|
||||
@ -40,7 +40,7 @@ try {
|
||||
c.color_code,
|
||||
c.series_code
|
||||
FROM transmissions t
|
||||
JOIN commercials c ON t.commercial_id = c.id
|
||||
JOIN infomercials c ON t.infomercial_id = c.id
|
||||
WHERE t.start_date BETWEEN ? AND ?
|
||||
";
|
||||
|
||||
@ -79,7 +79,7 @@ try {
|
||||
'borderColor' => $tx['color_code'] ?? '#cccccc',
|
||||
'textColor' => '#ffffff',
|
||||
'extendedProps' => [
|
||||
'commercial_id' => $tx['commercial_id'],
|
||||
'infomercial_id' => $tx['infomercial_id'],
|
||||
'template' => $tx['template'],
|
||||
'duration' => $tx['duration'],
|
||||
'api_status' => $tx['api_status'],
|
||||
|
||||
@ -25,7 +25,7 @@ try {
|
||||
}
|
||||
|
||||
// Validate required fields
|
||||
$required = ['commercial_id', 'channel', 'date', 'block_id', 'position'];
|
||||
$required = ['infomercial_id', 'channel', 'date', 'block_id', 'position'];
|
||||
foreach ($required as $field) {
|
||||
if (!isset($input[$field])) {
|
||||
jsonResponse([
|
||||
@ -35,15 +35,15 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
// Get commercial duration
|
||||
$stmt = $db->prepare("SELECT duration FROM commercials WHERE id = ?");
|
||||
$stmt->execute([$input['commercial_id']]);
|
||||
// Get infomercial duration
|
||||
$stmt = $db->prepare("SELECT duration FROM infomercials WHERE id = ?");
|
||||
$stmt->execute([$input['infomercial_id']]);
|
||||
$duration = $stmt->fetchColumn();
|
||||
|
||||
if (!$duration) {
|
||||
jsonResponse([
|
||||
'success' => false,
|
||||
'error' => 'Commercial not found'
|
||||
'error' => 'Infomercial not found'
|
||||
], 404);
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ try {
|
||||
$stmt = $db->prepare("
|
||||
SELECT t.id, t.start_time, c.duration
|
||||
FROM transmissions t
|
||||
JOIN commercials c ON t.commercial_id = c.id
|
||||
JOIN infomercials c ON t.infomercial_id = c.id
|
||||
WHERE t.start_date = ? AND t.channel = ?
|
||||
AND t.start_time >= ? AND t.start_time < ?
|
||||
ORDER BY t.start_time ASC
|
||||
@ -71,7 +71,7 @@ try {
|
||||
|
||||
// Create temporary transmission entry
|
||||
$newTransmission = [
|
||||
'commercial_id' => $input['commercial_id'],
|
||||
'infomercial_id' => $input['infomercial_id'],
|
||||
'duration' => $duration
|
||||
];
|
||||
|
||||
@ -86,11 +86,11 @@ try {
|
||||
// Insert new transmission
|
||||
$stmt = $db->prepare("
|
||||
INSERT INTO transmissions
|
||||
(commercial_id, channel, template, start_date, start_time, duration, api_status)
|
||||
(infomercial_id, channel, template, start_date, start_time, duration, api_status)
|
||||
VALUES (?, ?, 'HOME030', ?, ?, ?, 'pending')
|
||||
");
|
||||
$stmt->execute([
|
||||
$input['commercial_id'],
|
||||
$input['infomercial_id'],
|
||||
$input['channel'],
|
||||
$input['date'],
|
||||
$currentTime,
|
||||
|
||||
@ -47,7 +47,7 @@ try {
|
||||
$stmt = $db->prepare("
|
||||
SELECT t.*, c.content_id, c.title as commercial_title
|
||||
FROM transmissions t
|
||||
JOIN commercials c ON t.commercial_id = c.id
|
||||
JOIN infomercials c ON t.infomercial_id = c.id
|
||||
WHERE t.start_date = ?
|
||||
AND t.channel = ?
|
||||
AND t.api_status != 'synced'
|
||||
|
||||
@ -107,7 +107,7 @@ try {
|
||||
$stmt = $db->prepare("
|
||||
SELECT t.id, t.start_time, c.duration
|
||||
FROM transmissions t
|
||||
JOIN commercials c ON t.commercial_id = c.id
|
||||
JOIN infomercials c ON t.infomercial_id = c.id
|
||||
WHERE t.start_date = ? AND t.channel = ?
|
||||
ORDER BY t.start_time ASC
|
||||
");
|
||||
|
||||
@ -36,7 +36,7 @@ try {
|
||||
$stmt = $db->prepare("
|
||||
SELECT t.*, c.duration
|
||||
FROM transmissions t
|
||||
JOIN commercials c ON t.commercial_id = c.id
|
||||
JOIN infomercials c ON t.infomercial_id = c.id
|
||||
WHERE t.id = ?
|
||||
");
|
||||
$stmt->execute([$input['id']]);
|
||||
@ -136,7 +136,7 @@ try {
|
||||
$stmt = $db->prepare("
|
||||
SELECT t.id, t.start_time, t.duration, c.title
|
||||
FROM transmissions t
|
||||
JOIN commercials c ON t.commercial_id = c.id
|
||||
JOIN infomercials c ON t.infomercial_id = c.id
|
||||
WHERE t.start_date = ?
|
||||
AND t.channel = ?
|
||||
AND t.id != ?
|
||||
@ -175,7 +175,7 @@ try {
|
||||
c.color_code,
|
||||
c.series_code
|
||||
FROM transmissions t
|
||||
JOIN commercials c ON t.commercial_id = c.id
|
||||
JOIN infomercials c ON t.infomercial_id = c.id
|
||||
WHERE t.id = ?
|
||||
");
|
||||
$stmt->execute([$input['id']]);
|
||||
|
||||
@ -238,8 +238,8 @@ body {
|
||||
border-right: 3px solid rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
/* Commercial Sidebar */
|
||||
.commercial-sidebar {
|
||||
/* Infomercial Sidebar */
|
||||
.infomercial-sidebar {
|
||||
max-height: 600px;
|
||||
overflow-y: auto;
|
||||
background: #f8f9fa;
|
||||
@ -247,7 +247,7 @@ body {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.commercial-item {
|
||||
.infomercial-item {
|
||||
background: white;
|
||||
border-radius: 6px;
|
||||
padding: 12px;
|
||||
@ -258,27 +258,27 @@ body {
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.commercial-item:hover {
|
||||
.infomercial-item:hover {
|
||||
transform: translateX(5px);
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
|
||||
}
|
||||
|
||||
.commercial-item.dragging {
|
||||
.infomercial-item.dragging {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.commercial-title {
|
||||
.infomercial-title {
|
||||
font-weight: 600;
|
||||
font-size: 0.95rem;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.commercial-duration {
|
||||
.infomercial-duration {
|
||||
font-size: 0.85rem;
|
||||
color: #6c757d;
|
||||
}
|
||||
|
||||
.commercial-series {
|
||||
.infomercial-series {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
opacity: 0.8;
|
||||
@ -336,7 +336,7 @@ body {
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.commercial-sidebar {
|
||||
.infomercial-sidebar {
|
||||
max-height: 300px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
@ -347,21 +347,21 @@ body {
|
||||
}
|
||||
|
||||
/* Scrollbar Styling */
|
||||
.commercial-sidebar::-webkit-scrollbar {
|
||||
.infomercial-sidebar::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.commercial-sidebar::-webkit-scrollbar-track {
|
||||
.infomercial-sidebar::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.commercial-sidebar::-webkit-scrollbar-thumb {
|
||||
.infomercial-sidebar::-webkit-scrollbar-thumb {
|
||||
background: #888;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.commercial-sidebar::-webkit-scrollbar-thumb:hover {
|
||||
.infomercial-sidebar::-webkit-scrollbar-thumb:hover {
|
||||
background: #555;
|
||||
}
|
||||
|
||||
@ -475,7 +475,7 @@ body {
|
||||
@media print {
|
||||
.navbar,
|
||||
.btn,
|
||||
.commercial-sidebar {
|
||||
.infomercial-sidebar {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
// Event resize (change duration)
|
||||
eventResize: function(info) {
|
||||
showAlert('warning', 'Duur aanpassen is niet toegestaan. Gebruik de commercial instellingen.');
|
||||
showAlert('warning', 'Duur aanpassen is niet toegestaan. Gebruik de infomercial instellingen.');
|
||||
info.revert();
|
||||
},
|
||||
|
||||
@ -185,7 +185,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
// Event receive (when external event is dropped)
|
||||
eventReceive: function(info) {
|
||||
const event = info.event;
|
||||
const commercialId = event.extendedProps.commercial_id || info.draggedEl.dataset.commercialId;
|
||||
const commercialId = event.extendedProps.infomercial_id || info.draggedEl.dataset.commercialId;
|
||||
const resourceId = event.getResources()[0]?.id || 'SBS9';
|
||||
|
||||
// Remove the temporary event
|
||||
@ -214,7 +214,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
commercial_id: commercialId,
|
||||
infomercial_id: commercialId,
|
||||
channel: resourceId,
|
||||
start_date: dropDate,
|
||||
start_time: startTime
|
||||
@ -309,10 +309,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
});
|
||||
|
||||
/**
|
||||
* Initialize draggable commercials from sidebar
|
||||
* Initialize draggable infomercials from sidebar
|
||||
*/
|
||||
function initDraggableCommercials() {
|
||||
const commercialItems = document.querySelectorAll('.commercial-item');
|
||||
const commercialItems = document.querySelectorAll('.infomercial-item');
|
||||
|
||||
commercialItems.forEach(item => {
|
||||
new FullCalendar.Draggable(item, {
|
||||
@ -323,7 +323,7 @@ function initDraggableCommercials() {
|
||||
backgroundColor: eventEl.dataset.color,
|
||||
borderColor: eventEl.dataset.color,
|
||||
extendedProps: {
|
||||
commercial_id: eventEl.dataset.commercialId,
|
||||
infomercial_id: eventEl.dataset.commercialId,
|
||||
series_code: eventEl.dataset.seriesCode
|
||||
}
|
||||
};
|
||||
@ -469,10 +469,10 @@ function showAlert(type, message) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter commercials in sidebar
|
||||
* Filter infomercials in sidebar
|
||||
*/
|
||||
function filterCommercials(searchTerm) {
|
||||
const items = document.querySelectorAll('.commercial-item');
|
||||
const items = document.querySelectorAll('.infomercial-item');
|
||||
const term = searchTerm.toLowerCase();
|
||||
|
||||
items.forEach(item => {
|
||||
|
||||
@ -114,7 +114,7 @@ $dayNames = [
|
||||
<a class="nav-link" href="planner.php">Excel Planner</a>
|
||||
<a class="nav-link" href="calendar.php">Kalender</a>
|
||||
<a class="nav-link active" href="blocks.php">Blokken</a>
|
||||
<a class="nav-link" href="commercials.php">Commercials</a>
|
||||
<a class="nav-link" href="infomercials.php">Infomercials</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
82
calendar.php
82
calendar.php
@ -17,30 +17,30 @@ $dotenv->load();
|
||||
|
||||
$db = getDbConnection();
|
||||
|
||||
// Get all commercials with colors for sidebar
|
||||
$commercials = $db->query("
|
||||
// Get all infomercials with colors for sidebar
|
||||
$infomercials = $db->query("
|
||||
SELECT id, title, duration, color_code, series_code, upload_status
|
||||
FROM commercials
|
||||
FROM infomercials
|
||||
WHERE upload_status = 'uploaded'
|
||||
ORDER BY title ASC
|
||||
")->fetchAll();
|
||||
|
||||
// Auto-assign colors to commercials without colors
|
||||
foreach ($commercials as $commercial) {
|
||||
if (empty($commercial['color_code'])) {
|
||||
$stmt = $db->query("SELECT color_code FROM commercials WHERE color_code IS NOT NULL");
|
||||
// Auto-assign colors to infomercials without colors
|
||||
foreach ($infomercials as $infomercial) {
|
||||
if (empty($infomercial['color_code'])) {
|
||||
$stmt = $db->query("SELECT color_code FROM infomercials WHERE color_code IS NOT NULL");
|
||||
$existingColors = $stmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
$newColor = generateDistinctColor($existingColors);
|
||||
|
||||
$stmt = $db->prepare("UPDATE commercials SET color_code = ? WHERE id = ?");
|
||||
$stmt->execute([$newColor, $commercial['id']]);
|
||||
$stmt = $db->prepare("UPDATE infomercials SET color_code = ? WHERE id = ?");
|
||||
$stmt->execute([$newColor, $infomercial['id']]);
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh commercials after color assignment
|
||||
$commercials = $db->query("
|
||||
// Refresh infomercials after color assignment
|
||||
$infomercials = $db->query("
|
||||
SELECT id, title, duration, color_code, series_code, upload_status
|
||||
FROM commercials
|
||||
FROM infomercials
|
||||
WHERE upload_status = 'uploaded'
|
||||
ORDER BY title ASC
|
||||
")->fetchAll();
|
||||
@ -74,7 +74,7 @@ $commercials = $db->query("
|
||||
<a class="nav-link" href="planner.php">Excel Planner</a>
|
||||
<a class="nav-link active" href="calendar.php">Kalender</a>
|
||||
<a class="nav-link" href="blocks.php">Blokken</a>
|
||||
<a class="nav-link" href="commercials.php">Commercials</a>
|
||||
<a class="nav-link" href="infomercials.php">Infomercials</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@ -128,12 +128,12 @@ $commercials = $db->query("
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Sidebar with draggable commercials -->
|
||||
<!-- Sidebar with draggable infomercials -->
|
||||
<div class="col-md-3">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-primary text-white">
|
||||
<h5 class="mb-0">
|
||||
<i class="bi bi-collection-play"></i> Beschikbare Commercials
|
||||
<i class="bi bi-collection-play"></i> Beschikbare Infomercials
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body p-2">
|
||||
@ -145,40 +145,40 @@ $commercials = $db->query("
|
||||
onkeyup="filterCommercials(this.value)">
|
||||
</div>
|
||||
|
||||
<!-- Commercial List -->
|
||||
<div class="commercial-sidebar">
|
||||
<?php if (empty($commercials)): ?>
|
||||
<!-- Infomercial List -->
|
||||
<div class="infomercial-sidebar">
|
||||
<?php if (empty($infomercials)): ?>
|
||||
<div class="text-center text-muted p-3">
|
||||
<i class="bi bi-inbox" style="font-size: 2rem;"></i>
|
||||
<p class="mt-2 small">Geen commercials beschikbaar</p>
|
||||
<a href="commercials.php" class="btn btn-sm btn-primary">
|
||||
Voeg Commercial Toe
|
||||
<p class="mt-2 small">Geen infomercials beschikbaar</p>
|
||||
<a href="infomercials.php" class="btn btn-sm btn-primary">
|
||||
Voeg Infomercial Toe
|
||||
</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($commercials as $commercial): ?>
|
||||
<div class="commercial-item"
|
||||
style="border-left-color: <?= htmlspecialchars($commercial['color_code']) ?>;"
|
||||
data-commercial-id="<?= $commercial['id'] ?>"
|
||||
data-title="<?= htmlspecialchars($commercial['title']) ?>"
|
||||
data-duration="<?= $commercial['duration'] ?>"
|
||||
data-color="<?= htmlspecialchars($commercial['color_code']) ?>"
|
||||
data-series-code="<?= htmlspecialchars($commercial['series_code'] ?? '') ?>">
|
||||
<?php foreach ($infomercials as $infomercial): ?>
|
||||
<div class="infomercial-item"
|
||||
style="border-left-color: <?= htmlspecialchars($infomercial['color_code']) ?>;"
|
||||
data-infomercial-id="<?= $infomercial['id'] ?>"
|
||||
data-title="<?= htmlspecialchars($infomercial['title']) ?>"
|
||||
data-duration="<?= $infomercial['duration'] ?>"
|
||||
data-color="<?= htmlspecialchars($infomercial['color_code']) ?>"
|
||||
data-series-code="<?= htmlspecialchars($infomercial['series_code'] ?? '') ?>">
|
||||
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="color-preview me-2"
|
||||
style="background-color: <?= htmlspecialchars($commercial['color_code']) ?>; width: 20px; height: 20px; border-radius: 3px;">
|
||||
style="background-color: <?= htmlspecialchars($infomercial['color_code']) ?>; width: 20px; height: 20px; border-radius: 3px;">
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<div class="commercial-title">
|
||||
<?= htmlspecialchars($commercial['title']) ?>
|
||||
<div class="infomercial-title">
|
||||
<?= htmlspecialchars($infomercial['title']) ?>
|
||||
</div>
|
||||
<div class="commercial-duration">
|
||||
<i class="bi bi-clock"></i> <?= $commercial['duration'] ?>
|
||||
<div class="infomercial-duration">
|
||||
<i class="bi bi-clock"></i> <?= $infomercial['duration'] ?>
|
||||
</div>
|
||||
<?php if ($commercial['series_code']): ?>
|
||||
<div class="commercial-series">
|
||||
<i class="bi bi-tag"></i> <?= htmlspecialchars($commercial['series_code']) ?>
|
||||
<?php if ($infomercial['series_code']): ?>
|
||||
<div class="infomercial-series">
|
||||
<i class="bi bi-tag"></i> <?= htmlspecialchars($infomercial['series_code']) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@ -194,7 +194,7 @@ $commercials = $db->query("
|
||||
<div class="mt-3 p-2 bg-light rounded">
|
||||
<small class="text-muted">
|
||||
<i class="bi bi-info-circle"></i>
|
||||
Sleep commercials naar de kalender om te plannen
|
||||
Sleep infomercials naar de kalender om te plannen
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
@ -209,9 +209,9 @@ $commercials = $db->query("
|
||||
<div class="small">
|
||||
<?php
|
||||
$uniqueColors = [];
|
||||
foreach ($commercials as $commercial) {
|
||||
if ($commercial['series_code'] && !isset($uniqueColors[$commercial['series_code']])) {
|
||||
$uniqueColors[$commercial['series_code']] = $commercial['color_code'];
|
||||
foreach ($infomercials as $infomercial) {
|
||||
if ($infomercial['series_code'] && !isset($uniqueColors[$infomercial['series_code']])) {
|
||||
$uniqueColors[$infomercial['series_code']] = $infomercial['color_code'];
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
54
index.php
54
index.php
@ -16,7 +16,7 @@ $db = new PDO("mysql:host={$_ENV['DB_HOST']};dbname={$_ENV['DB_NAME']}", $_ENV['
|
||||
// Array om logs voor console te verzamelen
|
||||
$apiLogs = [];
|
||||
|
||||
// 1. Registratie Commercial (Stap 1, 2, 4)
|
||||
// 1. Registratie Infomercial (Stap 1, 2, 4)
|
||||
if (isset($_POST['add_commercial'])) {
|
||||
$ep = $api->createEpisode($_POST['title'], $_POST['duration'], $_POST['season_id']);
|
||||
$apiLogs[] = ['call' => 'Create Episode', 'response' => $api->lastResponse];
|
||||
@ -30,7 +30,7 @@ if (isset($_POST['add_commercial'])) {
|
||||
$apiLogs[] = ['call' => 'Get Media Asset Details', 'response' => $api->lastResponse];
|
||||
|
||||
$label = $details['mediaAssetLabel'] ?? 'Pending';
|
||||
$stmt = $db->prepare("INSERT INTO commercials (title, duration, season_id, content_id, media_asset_id, media_asset_label, upload_status) VALUES (?, ?, ?, ?, ?, ?, 'pending')");
|
||||
$stmt = $db->prepare("INSERT INTO infomercials (title, duration, season_id, content_id, media_asset_id, media_asset_label, upload_status) VALUES (?, ?, ?, ?, ?, ?, 'pending')");
|
||||
$stmt->execute([$_POST['title'], $_POST['duration'], $_POST['season_id'], $ep['id'], $asset['id'], $label]);
|
||||
}
|
||||
}
|
||||
@ -38,16 +38,16 @@ if (isset($_POST['add_commercial'])) {
|
||||
|
||||
// 2. LOKALE Planning opslaan of bewerken
|
||||
if (isset($_POST['schedule_transmission'])) {
|
||||
$stmt = $db->prepare("SELECT duration FROM commercials WHERE id = ?");
|
||||
$stmt->execute([$_POST['commercial_id']]);
|
||||
$stmt = $db->prepare("SELECT duration FROM infomercials WHERE id = ?");
|
||||
$stmt->execute([$_POST['infomercial_id']]);
|
||||
$commDuration = $stmt->fetchColumn();
|
||||
|
||||
if (!empty($_POST['edit_id'])) {
|
||||
$stmt = $db->prepare("UPDATE transmissions SET commercial_id=?, channel=?, template=?, start_date=?, start_time=?, duration=?, api_status='pending' WHERE id=?");
|
||||
$stmt->execute([$_POST['commercial_id'], $_POST['channel'], $_POST['template'], $_POST['start_date'], $_POST['start_time'], $commDuration, $_POST['edit_id']]);
|
||||
$stmt = $db->prepare("UPDATE transmissions SET infomercial_id=?, channel=?, template=?, start_date=?, start_time=?, duration=?, api_status='pending' WHERE id=?");
|
||||
$stmt->execute([$_POST['infomercial_id'], $_POST['channel'], $_POST['template'], $_POST['start_date'], $_POST['start_time'], $commDuration, $_POST['edit_id']]);
|
||||
} else {
|
||||
$stmt = $db->prepare("INSERT INTO transmissions (commercial_id, channel, template, start_date, start_time, duration, api_status) VALUES (?, ?, ?, ?, ?, ?, 'pending')");
|
||||
$stmt->execute([$_POST['commercial_id'], $_POST['channel'], $_POST['template'], $_POST['start_date'], $_POST['start_time'], $commDuration]);
|
||||
$stmt = $db->prepare("INSERT INTO transmissions (infomercial_id, channel, template, start_date, start_time, duration, api_status) VALUES (?, ?, ?, ?, ?, ?, 'pending')");
|
||||
$stmt->execute([$_POST['infomercial_id'], $_POST['channel'], $_POST['template'], $_POST['start_date'], $_POST['start_time'], $commDuration]);
|
||||
}
|
||||
header("Location: index.php?view_date=" . $_POST['start_date']);
|
||||
exit;
|
||||
@ -55,7 +55,7 @@ if (isset($_POST['schedule_transmission'])) {
|
||||
|
||||
// 3. Handmatige Sync naar Talpa (Stap 3 op verzoek)
|
||||
if (isset($_POST['sync_item'])) {
|
||||
$stmt = $db->prepare("SELECT t.*, c.content_id FROM transmissions t JOIN commercials c ON t.commercial_id = c.id WHERE t.id = ?");
|
||||
$stmt = $db->prepare("SELECT t.*, c.content_id FROM transmissions t JOIN infomercials c ON t.infomercial_id = c.id WHERE t.id = ?");
|
||||
$stmt->execute([$_POST['sync_id']]);
|
||||
$tx = $stmt->fetch();
|
||||
|
||||
@ -76,16 +76,16 @@ if (isset($_POST['sync_item'])) {
|
||||
|
||||
// 4. Media Asset Label en Status bijwerken
|
||||
if (isset($_POST['update_media_asset'])) {
|
||||
$stmt = $db->prepare("UPDATE commercials SET media_asset_label = ?, upload_status = ? WHERE id = ?");
|
||||
$stmt->execute([$_POST['media_asset_label'], $_POST['upload_status'], $_POST['commercial_id']]);
|
||||
$stmt = $db->prepare("UPDATE infomercials SET media_asset_label = ?, upload_status = ? WHERE id = ?");
|
||||
$stmt->execute([$_POST['media_asset_label'], $_POST['upload_status'], $_POST['infomercial_id']]);
|
||||
header("Location: index.php?view_date=" . $selectedDate);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Data ophalen
|
||||
$commercials = $db->query("SELECT * FROM commercials ORDER BY created_at DESC")->fetchAll();
|
||||
$infomercials = $db->query("SELECT * FROM infomercials ORDER BY created_at DESC")->fetchAll();
|
||||
$selectedDate = $_GET['view_date'] ?? date('Y-m-d');
|
||||
$stmt = $db->prepare("SELECT t.*, c.title, c.duration as comm_duration FROM transmissions t JOIN commercials c ON t.commercial_id = c.id WHERE t.start_date = ? ORDER BY t.start_time ASC");
|
||||
$stmt = $db->prepare("SELECT t.*, c.title, c.duration as comm_duration FROM transmissions t JOIN infomercials c ON t.infomercial_id = c.id WHERE t.start_date = ? ORDER BY t.start_time ASC");
|
||||
$stmt->execute([$selectedDate]);
|
||||
$dailySchedule = $stmt->fetchAll();
|
||||
|
||||
@ -118,7 +118,7 @@ if (isset($_GET['edit'])) {
|
||||
<a class="nav-link" href="planner.php">Excel Planner</a>
|
||||
<a class="nav-link" href="calendar.php">Kalender</a>
|
||||
<a class="nav-link" href="blocks.php">Blokken</a>
|
||||
<a class="nav-link" href="commercials.php">Commercials</a>
|
||||
<a class="nav-link" href="infomercials.php">Infomercials</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@ -134,8 +134,8 @@ if (isset($_GET['edit'])) {
|
||||
<!-- Statistics Cards -->
|
||||
<div class="row mb-4">
|
||||
<?php
|
||||
$totalCommercials = $db->query("SELECT COUNT(*) FROM commercials")->fetchColumn();
|
||||
$uploadedCommercials = $db->query("SELECT COUNT(*) FROM commercials WHERE upload_status = 'uploaded'")->fetchColumn();
|
||||
$totalCommercials = $db->query("SELECT COUNT(*) FROM infomercials")->fetchColumn();
|
||||
$uploadedCommercials = $db->query("SELECT COUNT(*) FROM infomercials WHERE upload_status = 'uploaded'")->fetchColumn();
|
||||
$totalTransmissions = $db->query("SELECT COUNT(*) FROM transmissions")->fetchColumn();
|
||||
$pendingSync = $db->query("SELECT COUNT(*) FROM transmissions WHERE api_status = 'pending'")->fetchColumn();
|
||||
$syncedTransmissions = $db->query("SELECT COUNT(*) FROM transmissions WHERE api_status = 'synced'")->fetchColumn();
|
||||
@ -144,7 +144,7 @@ if (isset($_GET['edit'])) {
|
||||
<div class="col-md-3">
|
||||
<div class="stat-card">
|
||||
<div class="stat-number"><?= $totalCommercials ?></div>
|
||||
<div class="stat-label">Totaal Commercials</div>
|
||||
<div class="stat-label">Totaal Infomercials</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -202,10 +202,10 @@ if (isset($_GET['edit'])) {
|
||||
<div class="card shadow-sm h-100">
|
||||
<div class="card-body text-center">
|
||||
<i class="bi bi-collection-play" style="font-size: 3rem; color: #e74c3c;"></i>
|
||||
<h5 class="mt-3">Commercials</h5>
|
||||
<h5 class="mt-3">Infomercials</h5>
|
||||
<p class="text-muted">Registreer en beheer</p>
|
||||
<a href="commercials.php" class="btn btn-danger">
|
||||
<i class="bi bi-arrow-right-circle"></i> Naar Commercials
|
||||
<a href="infomercials.php" class="btn btn-danger">
|
||||
<i class="bi bi-arrow-right-circle"></i> Naar Infomercials
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -230,7 +230,7 @@ if (isset($_GET['edit'])) {
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="card p-3 shadow-sm">
|
||||
<h5>1. Commercial Registreren</h5>
|
||||
<h5>1. Infomercial Registreren</h5>
|
||||
<form method="POST">
|
||||
<input type="text" name="title" class="form-control mb-2" placeholder="Product Naam" required>
|
||||
<input type="text" name="duration" class="form-control mb-2" placeholder="Duur (HH:MM:SS)" required>
|
||||
@ -246,10 +246,10 @@ if (isset($_GET['edit'])) {
|
||||
<form method="POST" class="row g-2" id="planningForm">
|
||||
<input type="hidden" name="edit_id" value="<?= $editItem['id'] ?? '' ?>">
|
||||
<div class="col-md-6">
|
||||
<select name="commercial_id" id="commercial_select" class="form-select" required>
|
||||
<option value="">Selecteer Commercial...</option>
|
||||
<?php foreach($commercials as $c): ?>
|
||||
<option value="<?= $c['id'] ?>" data-duration="<?= $c['duration'] ?>" <?= (isset($editItem) && $editItem['commercial_id'] == $c['id']) ? 'selected' : '' ?>>
|
||||
<select name="infomercial_id" id="commercial_select" class="form-select" required>
|
||||
<option value="">Selecteer Infomercial...</option>
|
||||
<?php foreach($infomercials as $c): ?>
|
||||
<option value="<?= $c['id'] ?>" data-duration="<?= $c['duration'] ?>" <?= (isset($editItem) && $editItem['infomercial_id'] == $c['id']) ? 'selected' : '' ?>>
|
||||
<?= htmlspecialchars($c['title']) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
@ -348,10 +348,10 @@ if (isset($_GET['edit'])) {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($commercials as $c): ?>
|
||||
<?php foreach($infomercials as $c): ?>
|
||||
<tr>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="commercial_id" value="<?= $c['id'] ?>">
|
||||
<input type="hidden" name="infomercial_id" value="<?= $c['id'] ?>">
|
||||
<td><?= htmlspecialchars($c['title']) ?></td>
|
||||
<td><span class="badge bg-info text-dark"><?= $c['duration'] ?></span></td>
|
||||
<td><code><?= htmlspecialchars($c['content_id']) ?></code></td>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Commercial Management
|
||||
* Enhanced version of commercial registration with color management
|
||||
* Infomercial Management
|
||||
* Enhanced version of infomercial registration with color management
|
||||
*/
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
@ -20,7 +20,7 @@ $api = new TalpaApi();
|
||||
$db = getDbConnection();
|
||||
$apiLogs = [];
|
||||
|
||||
// Handle commercial registration
|
||||
// Handle infomercial registration
|
||||
if (isset($_POST['add_commercial'])) {
|
||||
$apiLogs[] = ['step' => 'Start registration', 'input' => $_POST];
|
||||
|
||||
@ -51,13 +51,13 @@ if (isset($_POST['add_commercial'])) {
|
||||
$apiLogs[] = ['step' => 'Media asset label', 'label' => $label];
|
||||
|
||||
// Auto-generate color
|
||||
$stmt = $db->query("SELECT color_code FROM commercials WHERE color_code IS NOT NULL");
|
||||
$stmt = $db->query("SELECT color_code FROM infomercials WHERE color_code IS NOT NULL");
|
||||
$existingColors = $stmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
$colorCode = generateDistinctColor($existingColors);
|
||||
$apiLogs[] = ['step' => 'Color generated', 'color' => $colorCode];
|
||||
|
||||
$stmt = $db->prepare("
|
||||
INSERT INTO commercials
|
||||
INSERT INTO infomercials
|
||||
(title, duration, season_id, content_id, media_asset_id, media_asset_label, upload_status, color_code, series_code)
|
||||
VALUES (?, ?, ?, ?, ?, ?, 'pending', ?, ?)
|
||||
");
|
||||
@ -74,7 +74,7 @@ if (isset($_POST['add_commercial'])) {
|
||||
|
||||
$apiLogs[] = ['step' => 'Database insert', 'success' => true];
|
||||
|
||||
header('Location: commercials.php?success=created');
|
||||
header('Location: infomercials.php?success=created');
|
||||
exit;
|
||||
} else {
|
||||
$apiLogs[] = ['step' => 'Media asset creation failed', 'response' => $asset];
|
||||
@ -87,7 +87,7 @@ if (isset($_POST['add_commercial'])) {
|
||||
// Handle media asset update
|
||||
if (isset($_POST['update_media_asset'])) {
|
||||
$stmt = $db->prepare("
|
||||
UPDATE commercials
|
||||
UPDATE infomercials
|
||||
SET media_asset_label = ?, upload_status = ?, series_code = ?, color_code = ?
|
||||
WHERE id = ?
|
||||
");
|
||||
@ -96,33 +96,33 @@ if (isset($_POST['update_media_asset'])) {
|
||||
$_POST['upload_status'],
|
||||
$_POST['series_code'] ?? null,
|
||||
$_POST['color_code'],
|
||||
$_POST['commercial_id']
|
||||
$_POST['infomercial_id']
|
||||
]);
|
||||
header('Location: commercials.php?success=updated');
|
||||
header('Location: infomercials.php?success=updated');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Handle delete
|
||||
if (isset($_POST['delete_commercial'])) {
|
||||
// Check if commercial is used in transmissions
|
||||
$stmt = $db->prepare("SELECT COUNT(*) FROM transmissions WHERE commercial_id = ?");
|
||||
$stmt->execute([$_POST['commercial_id']]);
|
||||
// Check if infomercial is used in transmissions
|
||||
$stmt = $db->prepare("SELECT COUNT(*) FROM transmissions WHERE infomercial_id = ?");
|
||||
$stmt->execute([$_POST['infomercial_id']]);
|
||||
$count = $stmt->fetchColumn();
|
||||
|
||||
if ($count > 0) {
|
||||
header('Location: commercials.php?error=in_use');
|
||||
header('Location: infomercials.php?error=in_use');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get commercial details before deletion
|
||||
$stmt = $db->prepare("SELECT content_id, media_asset_id FROM commercials WHERE id = ?");
|
||||
$stmt->execute([$_POST['commercial_id']]);
|
||||
$commercial = $stmt->fetch();
|
||||
// Get infomercial details before deletion
|
||||
$stmt = $db->prepare("SELECT content_id, media_asset_id FROM infomercials WHERE id = ?");
|
||||
$stmt->execute([$_POST['infomercial_id']]);
|
||||
$infomercial = $stmt->fetch();
|
||||
|
||||
// Delete from Talpa API if content_id exists
|
||||
if ($commercial && $commercial['content_id']) {
|
||||
if ($infomercial && $infomercial['content_id']) {
|
||||
try {
|
||||
$api->deleteEpisode($commercial['content_id']);
|
||||
$api->deleteEpisode($infomercial['content_id']);
|
||||
$apiLogs[] = ['call' => 'Delete Episode', 'response' => $api->lastResponse];
|
||||
} catch (Exception $e) {
|
||||
// Log error but continue with local deletion
|
||||
@ -131,17 +131,17 @@ if (isset($_POST['delete_commercial'])) {
|
||||
}
|
||||
|
||||
// Delete from local database
|
||||
$stmt = $db->prepare("DELETE FROM commercials WHERE id = ?");
|
||||
$stmt->execute([$_POST['commercial_id']]);
|
||||
header('Location: commercials.php?success=deleted');
|
||||
$stmt = $db->prepare("DELETE FROM infomercials WHERE id = ?");
|
||||
$stmt->execute([$_POST['infomercial_id']]);
|
||||
header('Location: infomercials.php?success=deleted');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get all commercials
|
||||
$commercials = $db->query("
|
||||
// Get all infomercials
|
||||
$infomercials = $db->query("
|
||||
SELECT c.*,
|
||||
(SELECT COUNT(*) FROM transmissions WHERE commercial_id = c.id) as usage_count
|
||||
FROM commercials c
|
||||
(SELECT COUNT(*) FROM transmissions WHERE infomercial_id = c.id) as usage_count
|
||||
FROM infomercials c
|
||||
ORDER BY c.created_at DESC
|
||||
")->fetchAll();
|
||||
?>
|
||||
@ -151,7 +151,7 @@ $commercials = $db->query("
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Commercials - Telvero Talpa</title>
|
||||
<title>Infomercials - Telvero Talpa</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="assets/css/custom.css">
|
||||
@ -167,14 +167,14 @@ $commercials = $db->query("
|
||||
<a class="nav-link" href="planner.php">Excel Planner</a>
|
||||
<a class="nav-link" href="calendar.php">Kalender</a>
|
||||
<a class="nav-link" href="blocks.php">Blokken</a>
|
||||
<a class="nav-link active" href="commercials.php">Commercials</a>
|
||||
<a class="nav-link active" href="infomercials.php">Infomercials</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mt-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1><i class="bi bi-collection-play"></i> Commercial Management</h1>
|
||||
<h1><i class="bi bi-collection-play"></i> Infomercial Management</h1>
|
||||
<a href="calendar.php" class="btn btn-primary">
|
||||
<i class="bi bi-calendar-week"></i> Naar Kalender
|
||||
</a>
|
||||
@ -184,9 +184,9 @@ $commercials = $db->query("
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
<?php
|
||||
$messages = [
|
||||
'created' => 'Commercial succesvol aangemaakt en geregistreerd bij Talpa!',
|
||||
'updated' => 'Commercial succesvol bijgewerkt!',
|
||||
'deleted' => 'Commercial succesvol verwijderd!'
|
||||
'created' => 'Infomercial succesvol aangemaakt en geregistreerd bij Talpa!',
|
||||
'updated' => 'Infomercial succesvol bijgewerkt!',
|
||||
'deleted' => 'Infomercial succesvol verwijderd!'
|
||||
];
|
||||
echo $messages[$_GET['success']] ?? 'Actie succesvol uitgevoerd!';
|
||||
?>
|
||||
@ -198,7 +198,7 @@ $commercials = $db->query("
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<?php
|
||||
$messages = [
|
||||
'in_use' => 'Deze commercial kan niet verwijderd worden omdat deze nog in gebruik is in de planning!'
|
||||
'in_use' => 'Deze infomercial kan niet verwijderd worden omdat deze nog in gebruik is in de planning!'
|
||||
];
|
||||
echo $messages[$_GET['error']] ?? 'Er is een fout opgetreden!';
|
||||
?>
|
||||
@ -212,7 +212,7 @@ $commercials = $db->query("
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-primary text-white">
|
||||
<h5 class="mb-0">
|
||||
<i class="bi bi-plus-circle"></i> Nieuwe Commercial Registreren
|
||||
<i class="bi bi-plus-circle"></i> Nieuwe Infomercial Registreren
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@ -249,24 +249,24 @@ $commercials = $db->query("
|
||||
<div class="mt-3 p-2 bg-light rounded">
|
||||
<small class="text-muted">
|
||||
<i class="bi bi-info-circle"></i>
|
||||
Dit registreert de commercial bij Talpa en maakt automatisch een media asset aan.
|
||||
Dit registreert de infomercial bij Talpa en maakt automatisch een media asset aan.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Commercial List -->
|
||||
<!-- Infomercial List -->
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-secondary text-white">
|
||||
<h5 class="mb-0"><i class="bi bi-list-ul"></i> Geregistreerde Commercials</h5>
|
||||
<h5 class="mb-0"><i class="bi bi-list-ul"></i> Geregistreerde Infomercials</h5>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<?php if (empty($commercials)): ?>
|
||||
<?php if (empty($infomercials)): ?>
|
||||
<div class="p-4 text-center text-muted">
|
||||
<i class="bi bi-inbox" style="font-size: 3rem;"></i>
|
||||
<p class="mt-2">Nog geen commercials geregistreerd</p>
|
||||
<p class="mt-2">Nog geen infomercials geregistreerd</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="table-responsive">
|
||||
@ -284,7 +284,7 @@ $commercials = $db->query("
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($commercials as $c): ?>
|
||||
<?php foreach ($infomercials as $c): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="color-preview"
|
||||
@ -329,8 +329,8 @@ $commercials = $db->query("
|
||||
</button>
|
||||
<?php if ($c['usage_count'] == 0): ?>
|
||||
<form method="POST" style="display:inline;"
|
||||
onsubmit="return confirm('Weet je zeker dat je deze commercial wilt verwijderen?');">
|
||||
<input type="hidden" name="commercial_id" value="<?= $c['id'] ?>">
|
||||
onsubmit="return confirm('Weet je zeker dat je deze infomercial wilt verwijderen?');">
|
||||
<input type="hidden" name="infomercial_id" value="<?= $c['id'] ?>">
|
||||
<button type="submit" name="delete_commercial"
|
||||
class="btn btn-outline-danger" title="Verwijderen">
|
||||
<i class="bi bi-trash"></i>
|
||||
@ -352,12 +352,12 @@ $commercials = $db->query("
|
||||
</div>
|
||||
|
||||
<!-- Edit Modals (outside the table loop) -->
|
||||
<?php foreach ($commercials as $c): ?>
|
||||
<?php foreach ($infomercials as $c): ?>
|
||||
<div class="modal fade" id="editModal<?= $c['id'] ?>" tabindex="-1" aria-labelledby="editModalLabel<?= $c['id'] ?>" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form method="POST">
|
||||
<input type="hidden" name="commercial_id" value="<?= $c['id'] ?>">
|
||||
<input type="hidden" name="infomercial_id" value="<?= $c['id'] ?>">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Bewerk: <?= htmlspecialchars($c['title']) ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
@ -405,7 +405,7 @@ $commercials = $db->query("
|
||||
// API Logs to console with enhanced debugging
|
||||
const apiLogs = <?= json_encode($apiLogs) ?>;
|
||||
if (apiLogs.length > 0) {
|
||||
console.group("🔍 Talpa API Debug Logs - Commercial Registration");
|
||||
console.group("🔍 Talpa API Debug Logs - Infomercial Registration");
|
||||
apiLogs.forEach((log, index) => {
|
||||
if (log.call) {
|
||||
console.group(`${index + 1}. ${log.call}`);
|
||||
@ -429,7 +429,7 @@ $commercials = $db->query("
|
||||
if (hasErrors) {
|
||||
console.warn("⚠️ Er zijn fouten opgetreden tijdens de registratie. Zie bovenstaande logs voor details.");
|
||||
} else {
|
||||
console.log("✅ Commercial registratie succesvol voltooid");
|
||||
console.log("✅ Infomercial registratie succesvol voltooid");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -2,8 +2,8 @@
|
||||
-- Date: 2026-01-13
|
||||
-- Description: Extends existing schema for TV planning system
|
||||
|
||||
-- Add color and series code to commercials table
|
||||
ALTER TABLE commercials
|
||||
-- Add color and series code to infomercials table
|
||||
ALTER TABLE infomercials
|
||||
ADD COLUMN color_code VARCHAR(7) DEFAULT NULL COMMENT 'Hex color code for visual identification',
|
||||
ADD COLUMN series_code VARCHAR(20) DEFAULT NULL COMMENT 'Series identifier (e.g., 006a, 007a)';
|
||||
|
||||
|
||||
84
planner.php
84
planner.php
@ -19,13 +19,13 @@ $db = getDbConnection();
|
||||
|
||||
// Handle adding transmission to block
|
||||
if (isset($_POST['add_to_block'])) {
|
||||
$commercialId = $_POST['commercial_id'];
|
||||
$commercialId = $_POST['infomercial_id'];
|
||||
$channel = $_POST['channel'];
|
||||
$date = $_POST['date'];
|
||||
$blockId = $_POST['block_id'] ?? null;
|
||||
|
||||
// Get commercial duration
|
||||
$stmt = $db->prepare("SELECT duration FROM commercials WHERE id = ?");
|
||||
// Get infomercial duration
|
||||
$stmt = $db->prepare("SELECT duration FROM infomercials WHERE id = ?");
|
||||
$stmt->execute([$commercialId]);
|
||||
$duration = $stmt->fetchColumn();
|
||||
|
||||
@ -35,7 +35,7 @@ if (isset($_POST['add_to_block'])) {
|
||||
// Insert transmission
|
||||
$stmt = $db->prepare("
|
||||
INSERT INTO transmissions
|
||||
(commercial_id, channel, template, start_date, start_time, duration, api_status)
|
||||
(infomercial_id, channel, template, start_date, start_time, duration, api_status)
|
||||
VALUES (?, ?, 'HOME030', ?, ?, ?, 'pending')
|
||||
");
|
||||
$stmt->execute([$commercialId, $channel, $date, $nextStartTime, $duration]);
|
||||
@ -72,7 +72,7 @@ if (isset($_POST['reorder'])) {
|
||||
$stmt = $db->prepare("
|
||||
SELECT t.id, t.start_time, c.duration
|
||||
FROM transmissions t
|
||||
JOIN commercials c ON t.commercial_id = c.id
|
||||
JOIN infomercials c ON t.infomercial_id = c.id
|
||||
WHERE t.start_date = ? AND t.channel = ?
|
||||
AND t.start_time >= ? AND t.start_time < ?
|
||||
ORDER BY t.start_time ASC
|
||||
@ -130,7 +130,7 @@ if (isset($_POST['reorder'])) {
|
||||
$stmt = $db->prepare("
|
||||
SELECT t.id, c.duration
|
||||
FROM transmissions t
|
||||
JOIN commercials c ON t.commercial_id = c.id
|
||||
JOIN infomercials c ON t.infomercial_id = c.id
|
||||
WHERE t.start_date = ? AND t.channel = ? AND t.start_time >= ?
|
||||
ORDER BY t.start_time ASC
|
||||
");
|
||||
@ -172,9 +172,9 @@ foreach ($allBlocks as $block) {
|
||||
$blocksByChannel[$block['channel']][] = $block;
|
||||
}
|
||||
|
||||
// Get all commercials
|
||||
$commercials = $db->query("
|
||||
SELECT * FROM commercials
|
||||
// Get all infomercials
|
||||
$infomercials = $db->query("
|
||||
SELECT * FROM infomercials
|
||||
WHERE upload_status = 'uploaded'
|
||||
ORDER BY title ASC
|
||||
")->fetchAll();
|
||||
@ -272,7 +272,7 @@ function calculateNextStartTimeForBlock($db, $date, $channel, $blockId) {
|
||||
<a class="nav-link active" href="planner.php">Excel Planner</a>
|
||||
<a class="nav-link" href="calendar.php">Kalender</a>
|
||||
<a class="nav-link" href="blocks.php">Blokken</a>
|
||||
<a class="nav-link" href="commercials.php">Commercials</a>
|
||||
<a class="nav-link" href="infomercials.php">Infomercials</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@ -321,12 +321,12 @@ function calculateNextStartTimeForBlock($db, $date, $channel, $blockId) {
|
||||
|
||||
<!-- Both Channels Side by Side -->
|
||||
<div class="row">
|
||||
<!-- Commercial Sidebar -->
|
||||
<!-- Infomercial Sidebar -->
|
||||
<div class="col-md-2">
|
||||
<div class="card shadow-sm sticky-top" style="top: 20px;">
|
||||
<div class="card-header bg-success text-white">
|
||||
<h6 class="mb-0">
|
||||
<i class="bi bi-collection-play"></i> Commercials
|
||||
<i class="bi bi-collection-play"></i> Infomercials
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card-body p-2">
|
||||
@ -339,33 +339,33 @@ function calculateNextStartTimeForBlock($db, $date, $channel, $blockId) {
|
||||
onkeyup="filterPlannerCommercials(this.value)">
|
||||
</div>
|
||||
|
||||
<!-- Commercial List -->
|
||||
<div class="commercial-sidebar" style="max-height: 70vh;">
|
||||
<?php if (empty($commercials)): ?>
|
||||
<!-- Infomercial List -->
|
||||
<div class="infomercial-sidebar" style="max-height: 70vh;">
|
||||
<?php if (empty($infomercials)): ?>
|
||||
<div class="text-center text-muted p-2">
|
||||
<i class="bi bi-inbox"></i>
|
||||
<p class="small mt-2">Geen commercials</p>
|
||||
<p class="small mt-2">Geen infomercials</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($commercials as $commercial): ?>
|
||||
<div class="commercial-item draggable-commercial"
|
||||
style="border-left-color: <?= htmlspecialchars($commercial['color_code']) ?>; padding: 8px; margin-bottom: 8px;"
|
||||
<?php foreach ($infomercials as $infomercial): ?>
|
||||
<div class="infomercial-item draggable-infomercial"
|
||||
style="border-left-color: <?= htmlspecialchars($infomercial['color_code']) ?>; padding: 8px; margin-bottom: 8px;"
|
||||
draggable="true"
|
||||
data-commercial-id="<?= $commercial['id'] ?>"
|
||||
data-title="<?= htmlspecialchars($commercial['title']) ?>"
|
||||
data-duration="<?= $commercial['duration'] ?>"
|
||||
data-color="<?= htmlspecialchars($commercial['color_code']) ?>"
|
||||
data-series-code="<?= htmlspecialchars($commercial['series_code'] ?? '') ?>">
|
||||
data-infomercial-id="<?= $infomercial['id'] ?>"
|
||||
data-title="<?= htmlspecialchars($infomercial['title']) ?>"
|
||||
data-duration="<?= $infomercial['duration'] ?>"
|
||||
data-color="<?= htmlspecialchars($infomercial['color_code']) ?>"
|
||||
data-series-code="<?= htmlspecialchars($infomercial['series_code'] ?? '') ?>">
|
||||
|
||||
<div class="d-flex align-items-center">
|
||||
<div style="background-color: <?= htmlspecialchars($commercial['color_code']) ?>; width: 15px; height: 15px; border-radius: 2px; margin-right: 6px;">
|
||||
<div style="background-color: <?= htmlspecialchars($infomercial['color_code']) ?>; width: 15px; height: 15px; border-radius: 2px; margin-right: 6px;">
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<div style="font-weight: 600; font-size: 0.8em;">
|
||||
<?= htmlspecialchars($commercial['title']) ?>
|
||||
<?= htmlspecialchars($infomercial['title']) ?>
|
||||
</div>
|
||||
<div style="font-size: 0.7em; color: #6c757d;">
|
||||
<?= round(timeToSeconds($commercial['duration']) / 60) ?> min
|
||||
<?= round(timeToSeconds($infomercial['duration']) / 60) ?> min
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@ -408,7 +408,7 @@ function calculateNextStartTimeForBlock($db, $date, $channel, $blockId) {
|
||||
$stmt = $db->prepare("
|
||||
SELECT t.*, c.title, c.color_code, c.series_code
|
||||
FROM transmissions t
|
||||
JOIN commercials c ON t.commercial_id = c.id
|
||||
JOIN infomercials c ON t.infomercial_id = c.id
|
||||
WHERE t.start_date = ? AND t.channel = ?
|
||||
AND t.start_time >= ? AND t.start_time < ?
|
||||
ORDER BY t.start_time ASC
|
||||
@ -538,7 +538,7 @@ function calculateNextStartTimeForBlock($db, $date, $channel, $blockId) {
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Add Commercial Row (also a drop zone) -->
|
||||
<!-- Add Infomercial Row (also a drop zone) -->
|
||||
<tr class="table-success drop-zone-end"
|
||||
data-block-id="<?= $block['id'] ?>"
|
||||
data-channel="<?= $channel ?>"
|
||||
@ -550,9 +550,9 @@ function calculateNextStartTimeForBlock($db, $date, $channel, $blockId) {
|
||||
<input type="hidden" name="block_id" value="<?= $block['id'] ?>">
|
||||
|
||||
<div class="col-md-8">
|
||||
<select name="commercial_id" class="form-select form-select-sm" required>
|
||||
<option value="">+ Voeg commercial toe...</option>
|
||||
<?php foreach ($commercials as $c): ?>
|
||||
<select name="infomercial_id" class="form-select form-select-sm" required>
|
||||
<option value="">+ Voeg infomercial toe...</option>
|
||||
<?php foreach ($infomercials as $c): ?>
|
||||
<option value="<?= $c['id'] ?>">
|
||||
<?= htmlspecialchars($c['series_code'] ?? '') ?> -
|
||||
<?= htmlspecialchars($c['title']) ?>
|
||||
@ -636,9 +636,9 @@ function calculateNextStartTimeForBlock($db, $date, $channel, $blockId) {
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.0/Sortable.min.js"></script>
|
||||
<script>
|
||||
// Filter commercials in sidebar
|
||||
// Filter infomercials in sidebar
|
||||
function filterPlannerCommercials(searchTerm) {
|
||||
const items = document.querySelectorAll('.draggable-commercial');
|
||||
const items = document.querySelectorAll('.draggable-infomercial');
|
||||
const term = searchTerm.toLowerCase();
|
||||
|
||||
items.forEach(item => {
|
||||
@ -653,10 +653,10 @@ function calculateNextStartTimeForBlock($db, $date, $channel, $blockId) {
|
||||
});
|
||||
}
|
||||
|
||||
// Make commercial items draggable
|
||||
document.querySelectorAll('.draggable-commercial').forEach(item => {
|
||||
// Make infomercial items draggable
|
||||
document.querySelectorAll('.draggable-infomercial').forEach(item => {
|
||||
item.addEventListener('dragstart', function(e) {
|
||||
e.dataTransfer.setData('commercial_id', this.dataset.commercialId);
|
||||
e.dataTransfer.setData('infomercial_id', this.dataset.commercialId);
|
||||
e.dataTransfer.setData('title', this.dataset.title);
|
||||
e.dataTransfer.setData('duration', this.dataset.duration);
|
||||
this.style.opacity = '0.5';
|
||||
@ -688,7 +688,7 @@ function calculateNextStartTimeForBlock($db, $date, $channel, $blockId) {
|
||||
e.preventDefault();
|
||||
this.style.borderTop = '';
|
||||
|
||||
const commercialId = e.dataTransfer.getData('commercial_id');
|
||||
const commercialId = e.dataTransfer.getData('infomercial_id');
|
||||
|
||||
// Insert at this position
|
||||
fetch('api/insert_transmission_at_position.php', {
|
||||
@ -697,7 +697,7 @@ function calculateNextStartTimeForBlock($db, $date, $channel, $blockId) {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
commercial_id: commercialId,
|
||||
infomercial_id: commercialId,
|
||||
channel: channel,
|
||||
date: date,
|
||||
block_id: blockId,
|
||||
@ -716,7 +716,7 @@ function calculateNextStartTimeForBlock($db, $date, $channel, $blockId) {
|
||||
});
|
||||
});
|
||||
|
||||
// Make "Add Commercial" rows also drop zones (for adding at end)
|
||||
// Make "Add Infomercial" rows also drop zones (for adding at end)
|
||||
document.querySelectorAll('.drop-zone-end').forEach(row => {
|
||||
const blockId = row.dataset.blockId;
|
||||
const channel = row.dataset.channel;
|
||||
@ -737,14 +737,14 @@ function calculateNextStartTimeForBlock($db, $date, $channel, $blockId) {
|
||||
e.stopPropagation();
|
||||
this.style.backgroundColor = '';
|
||||
|
||||
const commercialId = e.dataTransfer.getData('commercial_id');
|
||||
const commercialId = e.dataTransfer.getData('infomercial_id');
|
||||
|
||||
if (!commercialId) return;
|
||||
|
||||
// Add at end (use existing add_to_block logic)
|
||||
const form = this.querySelector('form');
|
||||
if (form) {
|
||||
const select = form.querySelector('select[name="commercial_id"]');
|
||||
const select = form.querySelector('select[name="infomercial_id"]');
|
||||
if (select) {
|
||||
select.value = commercialId;
|
||||
form.submit();
|
||||
|
||||
2
vendor/phpoption/phpoption/LICENSE
vendored
2
vendor/phpoption/phpoption/LICENSE
vendored
@ -159,7 +159,7 @@
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
other infomercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user