Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/Console/Commands/excel/Generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public function handle(): void

Excel::import(
new GenericEventsImport(),
'today.xlsx',
'example.xlsx',
'excel'
);
}
}
}
41 changes: 39 additions & 2 deletions app/Imports/GenericEventsImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder;
use PhpOffice\PhpSpreadsheet\Shared\Date;

class GenericEventsImport extends DefaultValueBinder implements ToModel, WithCustomValueBinder, WithHeadingRow
class GenericEventsImport extends BaseEventsImport implements ToModel, WithCustomValueBinder, WithHeadingRow
{
public function parseDate($value)
{
Expand All @@ -29,6 +29,7 @@ public function parseDate($value)
return null;
}
}


public function model(array $row): ?Model
{
Expand Down Expand Up @@ -70,6 +71,7 @@ public function model(array $row): ?Model
'activity_type' => trim($row['activity_type']),
'location' => !empty($row['address']) ? trim($row['address']) : 'online',
'event_url' => !empty($row['organiser_website']) ? trim($row['organiser_website']) : '',
'contact_person' => !empty($row['contact_email']) ? trim($row['contact_email']) : '',
'user_email' => !empty($row['contact_email']) ? trim($row['contact_email']) : '',
'creator_id' => $creatorId,
'country_iso' => strtoupper(trim($row['country'])),
Expand All @@ -85,6 +87,41 @@ public function model(array $row): ?Model
'latitude' => !empty($row['latitude']) ? trim($row['latitude']) : '',
'language' => !empty($row['language']) ? strtolower(explode('_', trim($row['language']))[0]) : 'en',
'mass_added_for' => 'Excel',
'recurring_event' => isset($row['recurring_event'])
? $this->validateSingleChoice($row['recurring_event'], Event::RECURRING_EVENTS)
: null,

'males_count' => isset($row['males_count']) ? (int) $row['males_count'] : null,
'females_count' => isset($row['females_count']) ? (int) $row['females_count'] : null,
'other_count' => isset($row['other_count']) ? (int) $row['other_count'] : null,

'is_extracurricular_event' => isset($row['is_extracurricular_event'])
? $this->parseBool($row['is_extracurricular_event'])
: false,

'is_standard_school_curriculum' => isset($row['is_standard_school_curriculum'])
? $this->parseBool($row['is_standard_school_curriculum'])
: false,

'is_use_resource' => isset($row['is_use_resource'])
? $this->parseBool($row['is_use_resource'])
: false,

'activity_format' => isset($row['activity_format'])
? $this->validateMultiChoice($row['activity_format'], Event::ACTIVITY_FORMATS)
: [],

'ages' => isset($row['ages'])
? $this->validateMultiChoice($row['ages'], Event::AGES)
: [],

'duration' => isset($row['duration'])
? $this->validateSingleChoice($row['duration'], Event::DURATIONS)
: null,

'recurring_type' => isset($row['recurring_type'])
? $this->validateSingleChoice($row['recurring_type'], Event::RECURRING_TYPES)
: null,
]);

$event->save();
Expand Down Expand Up @@ -113,4 +150,4 @@ public function model(array $row): ?Model
return null;
}
}
}
}

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resources/assets/sass/app.scss": {
"file": "assets/app-DsJ8rwW1.css",
"file": "assets/app-Dd9hZXy-.css",
"src": "resources/assets/sass/app.scss",
"isEntry": true
},
Expand Down
7 changes: 3 additions & 4 deletions resources/assets/sass/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
@import "components/pagination";
@import "components/calendar";
@import "components/table";

//Import pages
@import "pages";
@import "pages/homepage";
Expand Down Expand Up @@ -310,7 +309,7 @@ body:not(.new-layout) {
.error-robot {
z-index: 1;
}

.error-box a:hover {
background-color: rgb(251 157 122);
}
Expand Down Expand Up @@ -340,7 +339,7 @@ body:not(.new-layout) {
.error-robot svg {
max-width: 568px;
margin: 0 auto;
}
}
.error-box h1 {
color: var(--Dark-Blue-500, #1C4DA1);
text-align: center;
Expand All @@ -363,7 +362,7 @@ body:not(.new-layout) {
}
}

@media (max-width: 568px) {
@media (max-width: 568px) {
#codeweek-error-page {
justify-content: flex-start;
}
Expand Down