| ... | ... |
@@ -132,12 +132,11 @@ $GLOBALS['TL_DCA']['tl_vr_wa_slot'] = array |
| 132 | 132 |
( |
| 133 | 133 |
'exclude' => true, |
| 134 | 134 |
'filter' => true, |
| 135 |
- 'default' => time(), |
|
| 136 | 135 |
'sorting' => true, |
| 137 | 136 |
'flag' => DataContainer::SORT_DAY_ASC, |
| 138 | 137 |
'inputType' => 'text', |
| 139 | 138 |
'eval' => array('rgxp' => 'time', 'mandatory' => true, 'tl_class' => 'w50'),
|
| 140 |
- 'sql' => "int(10) NULL" |
|
| 139 |
+ 'sql' => "int(10) unsigned NULL" |
|
| 141 | 140 |
), |
| 142 | 141 |
'duration' => array |
| 143 | 142 |
( |
| ... | ... |
@@ -38,7 +38,8 @@ $GLOBALS['TL_DCA']['tl_vr_wa_slottypes'] = array |
| 38 | 38 |
'fields' => array('title'),
|
| 39 | 39 |
'headerFields' => array('title'),
|
| 40 | 40 |
'flag' => DataContainer::SORT_ASC, |
| 41 |
- 'panelLayout' => 'limit' |
|
| 41 |
+ 'panelLayout' => 'limit', |
|
| 42 |
+ 'disableGrouping' => true |
|
| 42 | 43 |
), |
| 43 | 44 |
'label' => array( |
| 44 | 45 |
'fields' => array('title'),
|
| ... | ... |
@@ -58,11 +59,11 @@ $GLOBALS['TL_DCA']['tl_vr_wa_slottypes'] = array |
| 58 | 59 |
'edit' => array |
| 59 | 60 |
( |
| 60 | 61 |
'href' => 'act=edit', |
| 61 |
- 'icon' => 'edit.gif', |
|
| 62 |
+ 'icon' => 'edit.svg', |
|
| 62 | 63 |
), |
| 63 | 64 |
'copy' => array |
| 64 | 65 |
( |
| 65 |
- 'href' => 'act=cut&mode=copy', |
|
| 66 |
+ 'href' => 'act=paste&mode=copy', |
|
| 66 | 67 |
'icon' => 'copy.svg' |
| 67 | 68 |
), |
| 68 | 69 |
'cut' => array |
| ... | ... |
@@ -74,11 +75,12 @@ $GLOBALS['TL_DCA']['tl_vr_wa_slottypes'] = array |
| 74 | 75 |
'delete' => array |
| 75 | 76 |
( |
| 76 | 77 |
'href' => 'act=delete', |
| 77 |
- 'icon' => 'delete.gif', |
|
| 78 |
+ 'icon' => 'delete.svg', |
|
| 79 |
+ 'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null) . '\'))return false;Backend.getScrollOffset()"' |
|
| 78 | 80 |
), |
| 79 | 81 |
'show' => array |
| 80 | 82 |
( |
| 81 |
- 'icon' => 'show.gif', |
|
| 83 |
+ 'icon' => 'show.svg', |
|
| 82 | 84 |
), |
| 83 | 85 |
) |
| 84 | 86 |
), |
| ... | ... |
@@ -86,7 +88,7 @@ $GLOBALS['TL_DCA']['tl_vr_wa_slottypes'] = array |
| 86 | 88 |
// Palettes |
| 87 | 89 |
'palettes' => array |
| 88 | 90 |
( |
| 89 |
- 'default' => '{title_legend},title;{config_legend},duration,containers,units'
|
|
| 91 |
+ 'default' => '{title_legend},title;{config_legend},duration,containers,units;{expert_legend},default'
|
|
| 90 | 92 |
), |
| 91 | 93 |
|
| 92 | 94 |
// Subpalettes |
| ... | ... |
@@ -167,6 +169,13 @@ $GLOBALS['TL_DCA']['tl_vr_wa_slottypes'] = array |
| 167 | 169 |
'tl_class' => 'clr' |
| 168 | 170 |
), |
| 169 | 171 |
'sql' => "blob NULL" |
| 170 |
- ) |
|
| 172 |
+ ), |
|
| 173 |
+ 'default' => array |
|
| 174 |
+ ( |
|
| 175 |
+ 'exclude' => true, |
|
| 176 |
+ 'inputType' => 'checkbox', |
|
| 177 |
+ 'eval' => array('doNotCopy'=>true, 'tl_class'=>'w50 clr'),
|
|
| 178 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
| 179 |
+ ), |
|
| 171 | 180 |
) |
| 172 | 181 |
); |
| ... | ... |
@@ -34,6 +34,14 @@ |
| 34 | 34 |
<source>Additional selectable container units for slot booking.</source> |
| 35 | 35 |
<target>Zusätzlich wählbare Behältereinheiten für die Slotbuchung.</target> |
| 36 | 36 |
</trans-unit> |
| 37 |
+ <trans-unit id="tl_vr_wa_slottypes.default.0"> |
|
| 38 |
+ <source>Default</source> |
|
| 39 |
+ <target>Standard</target> |
|
| 40 |
+ </trans-unit> |
|
| 41 |
+ <trans-unit id="tl_vr_wa_slottypes.default.1"> |
|
| 42 |
+ <source>The default slottype is used when adding slots manually.</source> |
|
| 43 |
+ <target>Beim manuellen Hinzufügen von Slots wird der Standard-Slottyp verwendet.</target> |
|
| 44 |
+ </trans-unit> |
|
| 37 | 45 |
<trans-unit id="tl_vr_wa_slottypes.title_legend"> |
| 38 | 46 |
<source>Title settings</source> |
| 39 | 47 |
<target>Titel-Einstellungen</target> |
| ... | ... |
@@ -42,6 +50,15 @@ |
| 42 | 50 |
<source>Slot configuration</source> |
| 43 | 51 |
<target>Slot-Konfiguration</target> |
| 44 | 52 |
</trans-unit> |
| 53 |
+ <trans-unit id="tl_vr_wa_slottypes.expert_legend"> |
|
| 54 |
+ <source>Expert settings</source> |
|
| 55 |
+ <target>Experten-Einstellungen</target> |
|
| 56 |
+ </trans-unit> |
|
| 57 |
+ |
|
| 58 |
+ <trans-unit id="ERR.wa_multiple_default"> |
|
| 59 |
+ <source>You can only define one default slottype per site</source> |
|
| 60 |
+ <target>Sie können nur einen Slot-Typ pro Standort als Standard definieren</target> |
|
| 61 |
+ </trans-unit> |
|
| 45 | 62 |
</body> |
| 46 | 63 |
</file> |
| 47 | 64 |
</xliff> |
| 48 | 65 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1 @@ |
| 1 |
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#259232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check"><polyline points="20 6 9 17 4 12"></polyline></svg> |
|
| 0 | 2 |
\ No newline at end of file |
| ... | ... |
@@ -23,6 +23,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; |
| 23 | 23 |
use vonRotenberg\WeinanlieferungBundle\Model\WeinanlieferungLeseartModel; |
| 24 | 24 |
use vonRotenberg\WeinanlieferungBundle\Model\WeinanlieferungRebsorteModel; |
| 25 | 25 |
use vonRotenberg\WeinanlieferungBundle\Model\WeinanlieferungSlotsModel; |
| 26 |
+use vonRotenberg\WeinanlieferungBundle\Model\WeinanlieferungSlottypesModel; |
|
| 26 | 27 |
use vonRotenberg\WeinanlieferungBundle\SlotChecker; |
| 27 | 28 |
|
| 28 | 29 |
class WeinanlieferungSlotContainerListener |
| ... | ... |
@@ -49,12 +50,12 @@ class WeinanlieferungSlotContainerListener |
| 49 | 50 |
|
| 50 | 51 |
$arrSorten = []; |
| 51 | 52 |
|
| 52 |
- $Sorten = StringUtil::deserialize($Slot->sorten,true); |
|
| 53 |
- foreach($Sorten as $sorte) |
|
| 53 |
+ $Sorten = StringUtil::deserialize($Slot->sorten, true); |
|
| 54 |
+ foreach ($Sorten as $sorte) |
|
| 54 | 55 |
{
|
| 55 | 56 |
$objSorte = WeinanlieferungRebsorteModel::findByPk($sorte['sorte']); |
| 56 | 57 |
$objLeseart = WeinanlieferungLeseartModel::findByPk($sorte['leseart']); |
| 57 |
- $arrSorten[] = ($objSorte !== null ? $objSorte->title : '') . ' ' . ($objLeseart !== null ? $objLeseart->title : ''); |
|
| 58 |
+ $arrSorten[] = ($objSorte !== null ? $objSorte->title : '') . ' ' . ($objLeseart !== null ? $objLeseart->title : ''); |
|
| 58 | 59 |
} |
| 59 | 60 |
|
| 60 | 61 |
return sprintf('<div class="tl_content_left"><div class="row u-items-center">
|
| ... | ... |
@@ -71,7 +72,7 @@ class WeinanlieferungSlotContainerListener |
| 71 | 72 |
<div class="col-3"> |
| 72 | 73 |
<div class="t-label">Dauer</div>%s %s |
| 73 | 74 |
</div> |
| 74 |
- </div></div>',Date::parse(Date::getNumericDateFormat(),$row['date']), Date::parse(Date::getNumericTimeFormat(),$row['time']), Date::parse(Date::getNumericDatimFormat(),$row['buchbar_ab']),Date::parse(Date::getNumericDatimFormat(),$row['buchbar_bis']),$Slot->behaelter,$row['duration'],($row['duration'] == 1 ? $this->translator->trans('MSC.wa_duration_minute', [], 'contao_tl_vr_wa_units') : $this->translator->trans('MSC.wa_duration_minutes', [], 'contao_tl_vr_wa_units')));
|
|
| 75 |
+ </div></div>', Date::parse(Date::getNumericDateFormat(), $row['date']), Date::parse(Date::getNumericTimeFormat(), $row['time']), Date::parse(Date::getNumericDatimFormat(), $row['buchbar_ab']), Date::parse(Date::getNumericDatimFormat(), $row['buchbar_bis']), $Slot->behaelter, $row['duration'], ($row['duration'] == 1 ? $this->translator->trans('MSC.wa_duration_minute', [], 'contao_tl_vr_wa_units') : $this->translator->trans('MSC.wa_duration_minutes', [], 'contao_tl_vr_wa_units')));
|
|
| 75 | 76 |
} |
| 76 | 77 |
|
| 77 | 78 |
/** |
| ... | ... |
@@ -89,13 +90,43 @@ class WeinanlieferungSlotContainerListener |
| 89 | 90 |
} |
| 90 | 91 |
|
| 91 | 92 |
$start = strtotime(date('Y-m-d', $dc->activeRecord->date) . ' ' . date('H:i:s', $varValue));
|
| 92 |
- $duration = \intval(Input::post('duration')) !== null ? intval(Input::post('duration'))*60 : $dc->activeRecord->duration*60;
|
|
| 93 |
+ $duration = \intval(Input::post('duration')) !== null ? intval(Input::post('duration')) * 60 : $dc->activeRecord->duration * 60;
|
|
| 93 | 94 |
|
| 94 |
- if ($slotchecker->checkTimeApplicableForSite($dc->activeRecord->pid,$start,$start+$duration,0,\intval($dc->id))) |
|
| 95 |
+ if ($slotchecker->checkTimeApplicableForSite($dc->activeRecord->pid, $start, $start + $duration, 0, \intval($dc->id))) |
|
| 95 | 96 |
{
|
| 96 | 97 |
throw new \Exception($this->translator->trans('ERR.wa_slot_conflict', [], 'contao_tl_vr_wa_slot'));
|
| 97 | 98 |
} |
| 98 | 99 |
|
| 99 | 100 |
return $start; |
| 100 | 101 |
} |
| 102 |
+ |
|
| 103 |
+ /** |
|
| 104 |
+ * @Callback(table="tl_vr_wa_slot", target="fields.duration.load") |
|
| 105 |
+ */ |
|
| 106 |
+ public function setDurationDefault($varValue, DataContainer $dc) |
|
| 107 |
+ {
|
|
| 108 |
+ $Slottype = WeinanlieferungSlottypesModel::findOneBy(["pid = ?", "`default` = '1'"], [$dc->activeRecord->pid]); |
|
| 109 |
+ |
|
| 110 |
+ if ($Slottype !== null && !$varValue) |
|
| 111 |
+ {
|
|
| 112 |
+ $varValue = $Slottype->duration; |
|
| 113 |
+ } |
|
| 114 |
+ |
|
| 115 |
+ return $varValue; |
|
| 116 |
+ } |
|
| 117 |
+ |
|
| 118 |
+ /** |
|
| 119 |
+ * @Callback(table="tl_vr_wa_slot", target="fields.behaelter.load") |
|
| 120 |
+ */ |
|
| 121 |
+ public function setContainersDefault($varValue, DataContainer $dc) |
|
| 122 |
+ {
|
|
| 123 |
+ $Slottype = WeinanlieferungSlottypesModel::findOneBy(["pid = ?", "`default` = '1'"], [$dc->activeRecord->pid]); |
|
| 124 |
+ |
|
| 125 |
+ if ($Slottype !== null && !$varValue) |
|
| 126 |
+ {
|
|
| 127 |
+ $varValue = $Slottype->containers; |
|
| 128 |
+ } |
|
| 129 |
+ |
|
| 130 |
+ return $varValue; |
|
| 131 |
+ } |
|
| 101 | 132 |
} |
| ... | ... |
@@ -14,6 +14,8 @@ namespace vonRotenberg\WeinanlieferungBundle\EventListener\DataContainer; |
| 14 | 14 |
|
| 15 | 15 |
use Contao\CoreBundle\ServiceAnnotation\Callback; |
| 16 | 16 |
use Contao\DataContainer; |
| 17 |
+use Contao\Image; |
|
| 18 |
+use Contao\StringUtil; |
|
| 17 | 19 |
use Doctrine\DBAL\Connection; |
| 18 | 20 |
use Symfony\Contracts\Translation\TranslatorInterface; |
| 19 | 21 |
|
| ... | ... |
@@ -40,6 +42,11 @@ class WeinanlieferungSlottypesContainerListener |
| 40 | 42 |
$label .= ' <span style="color:#999;padding-left:3px">['.$this->translator->trans('MSC.wa_container', [], 'contao_tl_vr_wa_units').': '.$row['containers'].']</span>';
|
| 41 | 43 |
$label .= ' <span style="color:#999;padding-left:3px">['.$this->translator->trans('MSC.wa_duration', [], 'contao_tl_vr_wa_units').': '.$row['duration'].' '.($row['duration'] == 1 ? $this->translator->trans('MSC.wa_duration_minute', [], 'contao_tl_vr_wa_units') : $this->translator->trans('MSC.wa_duration_minutes', [], 'contao_tl_vr_wa_units')).']</span>';
|
| 42 | 44 |
|
| 45 |
+ if ($row['default']) |
|
| 46 |
+ {
|
|
| 47 |
+ $label = Image::getHtml('bundles/vonrotenbergweinanlieferung/images/icons/check.svg', '', 'title="' . StringUtil::specialchars($this->translator->trans('tl_vr_wa_slottypes.default.0', [], 'contao_tl_vr_wa_slottypes')) . '"') . ' ' . $label;
|
|
| 48 |
+ } |
|
| 49 |
+ |
|
| 43 | 50 |
return sprintf($strRow,$label); |
| 44 | 51 |
} |
| 45 | 52 |
|
| ... | ... |
@@ -63,4 +70,26 @@ class WeinanlieferungSlottypesContainerListener |
| 63 | 70 |
|
| 64 | 71 |
return $arrOptions; |
| 65 | 72 |
} |
| 73 |
+ |
|
| 74 |
+ /** |
|
| 75 |
+ * @Callback(table="tl_vr_wa_slottypes", target="fields.default.save") |
|
| 76 |
+ */ |
|
| 77 |
+ public function checkDefault($varValue, DataContainer $dc) |
|
| 78 |
+ {
|
|
| 79 |
+ if (!$varValue) |
|
| 80 |
+ {
|
|
| 81 |
+ return ''; |
|
| 82 |
+ } |
|
| 83 |
+ |
|
| 84 |
+ $t = $dc->table; |
|
| 85 |
+ $objPage = $this->db->prepare("SELECT id FROM $t WHERE `default` = 1 AND pid = ? AND id != ?")
|
|
| 86 |
+ ->executeQuery([$dc->activeRecord->pid, $dc->activeRecord->id]); |
|
| 87 |
+ |
|
| 88 |
+ if ($objPage->rowCount()) |
|
| 89 |
+ {
|
|
| 90 |
+ throw new \Exception($this->translator->trans('ERR.wa_multiple_default', [], 'contao_tl_vr_wa_slottypes'));
|
|
| 91 |
+ } |
|
| 92 |
+ |
|
| 93 |
+ return $varValue; |
|
| 94 |
+ } |
|
| 66 | 95 |
} |