diff --git a/resources/views/segments/index/TimerEvent/TimerEvent.blade.php b/resources/views/segments/index/TimerEvent/TimerEvent.blade.php new file mode 100644 index 0000000..1ab2e70 --- /dev/null +++ b/resources/views/segments/index/TimerEvent/TimerEvent.blade.php @@ -0,0 +1,32 @@ +
+
+ +
+

+ {{getSetting($data->area_name.'_'.$data->part.'_title')}} +

+
+
+ next marasem +
+
+
+
0
+
0
+
0
+
0
+
+
+ {!! getSetting($data->area_name.'_'.$data->part.'_last') !!} + + Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cupiditate dignissimos dolores + doloribus eaque expedita facilis ipsa itaque maiores minus nam neque, porro ratione sapiente + sint unde ut vero voluptatibus voluptatum. +
+
+
+
+ +
+
diff --git a/resources/views/segments/index/TimerEvent/TimerEvent.js b/resources/views/segments/index/TimerEvent/TimerEvent.js new file mode 100644 index 0000000..fc47ed5 --- /dev/null +++ b/resources/views/segments/index/TimerEvent/TimerEvent.js @@ -0,0 +1,38 @@ +function startCountdown(unixTimestamp) { + + function updateCountdown() { + const now = Math.floor(Date.now() / 1000); // Current time in seconds + const remainingTime = unixTimestamp - now; + + if (remainingTime <= 0) { + countdownElement.innerHTML = "Time's up!"; + clearInterval(interval); + } else { + const seconds = remainingTime % 60; + const minutes = Math.floor((remainingTime / 60) % 60); + const hours = Math.floor((remainingTime / 3600) % 24); + const days = Math.floor(remainingTime / 86400); + + document.querySelector('#dcd').innerText = numFixer(days); + document.querySelector('#hcd').innerText = numFixer(hours); + document.querySelector('#mcd').innerText = numFixer(minutes); + document.querySelector('#scd').innerText = numFixer(seconds); + } + } + + updateCountdown(); // Initial call to display immediately + const interval = setInterval(updateCountdown, 1000); +} + +function numFixer(x) { + if (x < 10) { + return '0' + x; + } + return x.toString(); +} + +window.addEventListener('load', function () { + if (document.querySelector('#count-down-time-timestamp') != null){ + startCountdown(parseInt(document.querySelector('#count-down-time-timestamp').value)); + } +}); diff --git a/resources/views/segments/index/TimerEvent/TimerEvent.json b/resources/views/segments/index/TimerEvent/TimerEvent.json new file mode 100644 index 0000000..cb92029 --- /dev/null +++ b/resources/views/segments/index/TimerEvent/TimerEvent.json @@ -0,0 +1,10 @@ +{ + "name": "TimerEvent", + "version": "1.0", + "author": "xStack", + "email": "xshop@xstack.ir", + "license": "GPL-3.0-or-later", + "url": "https:\/\/xstack.ir", + "author_url": "https:\/\/4xmen.ir", + "packages": [] +} \ No newline at end of file diff --git a/resources/views/segments/index/TimerEvent/TimerEvent.php b/resources/views/segments/index/TimerEvent/TimerEvent.php new file mode 100644 index 0000000..f2af1fc --- /dev/null +++ b/resources/views/segments/index/TimerEvent/TimerEvent.php @@ -0,0 +1,64 @@ +section = 'theme'; + $setting->key = $part->area_name . '_' . $part->part.'_title'; + $setting->value = 'Next event title'; + $setting->type = 'TEXT'; + $setting->size = 6; + $setting->title = $part->area_name . ' ' . $part->part .' modern categories title'; + $setting->save(); + + $setting = new Setting(); + $setting->section = 'theme'; + $setting->key = $part->area_name . '_' . $part->part.'_jpg'; + $setting->value = null; + $setting->type = 'FILE'; + $setting->size = 6; + $setting->title = $part->area_name . ' ' . $part->part.' next image'; + $setting->save(); + + $setting = new Setting(); + $setting->section = 'theme'; + $setting->key = $part->area_name . '_' . $part->part.'_date'; + $setting->value = strtotime('next friday'); + $setting->type = 'DATETIME'; + $setting->size = 12; + $setting->title = $part->area_name . ' ' . $part->part.' next date time'; + $setting->save(); + + \File::copy(__DIR__.'/../../default-assets/bg.jpg',public_path('upload/images/').$part->area_name . '.' . $part->part.'.jpg'); + + $setting = new Setting(); + $setting->section = 'theme'; + $setting->key = $part->area_name . '_' . $part->part.'_last'; + $setting->value = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Cupiditate dignissimos dolores + doloribus eaque expedita facilis ipsa itaque maiores minus nam neque, porro ratione sapiente + sint unde ut vero voluptatibus voluptatum.'; + $setting->size = 12; + $setting->title = $part->area_name . ' ' . $part->part. ' last content'; + $setting->type = 'EDITOR'; + $setting->save(); + } + public static function onRemove(Part $part = null) + { + Setting::where('key',$part->area_name . '_' . $part->part.'_jpg')->first()?->delete(); + Setting::where('key',$part->area_name . '_' . $part->part.'_last')->first()?->delete(); + Setting::where('key',$part->area_name . '_' . $part->part.'_title')->first()?->delete(); + Setting::where('key',$part->area_name . '_' . $part->part.'_date')->first()?->delete(); + } + public static function onMount(Part $part = null) + { + return $part; + } +} diff --git a/resources/views/segments/index/TimerEvent/TimerEvent.scss b/resources/views/segments/index/TimerEvent/TimerEvent.scss new file mode 100644 index 0000000..e746e9e --- /dev/null +++ b/resources/views/segments/index/TimerEvent/TimerEvent.scss @@ -0,0 +1,42 @@ +.TimerEvent { + // scss + [class^='col']{ + position: relative; + } + + #countdown{ + position: absolute; + inset-inline-end: 1rem; + font-size: 25px; + width: 50px; + text-align: center; + top: 1rem; + } + + #dcd,#hcd,#mcd,#scd{ + position: relative; + margin-bottom: 2rem; + &:after{ + font-size: 12px; + position: absolute; + top: 100%; + right: 0; + left: 0; + } + } + #dcd:after{ + content: attr(data-text); + } + #hcd:after{ + content: attr(data-text); + + } + #mcd:after{ + content: attr(data-text); + + } + #scd:after{ + content: attr(data-text); + + } +} diff --git a/resources/views/segments/index/TimerEvent/screenshot.png b/resources/views/segments/index/TimerEvent/screenshot.png new file mode 100644 index 0000000..4b78abd Binary files /dev/null and b/resources/views/segments/index/TimerEvent/screenshot.png differ