diff --git a/app/Console/Commands/CheckGroupLocations.php b/app/Console/Commands/CheckGroupLocations.php index 7e0d23c910..7a44642e22 100644 --- a/app/Console/Commands/CheckGroupLocations.php +++ b/app/Console/Commands/CheckGroupLocations.php @@ -19,7 +19,7 @@ class CheckGroupLocations extends Command * * @var string */ - protected $description = 'Check that all gtroup locations are geocodeable'; + protected $description = 'Check that all group locations are geocodeable'; /** * Create a new command instance. diff --git a/app/Console/Commands/CheckTranslations.php b/app/Console/Commands/CheckTranslations.php index 7137a9913b..41acdfaf51 100644 --- a/app/Console/Commands/CheckTranslations.php +++ b/app/Console/Commands/CheckTranslations.php @@ -49,6 +49,8 @@ public function handle() // This is probably a special case used for form validation. It throws up many errors, and these // are at best not visible and at worst not too bad given that they only occur in error cases. So // ignore it. + } else if ($file == 'countries.php') { + // This is a special case used for country names. } else if ($file == 'pagination.php') { // This is probably a special case used for paging through data. } else if (strpos($file, '-audits')) { diff --git a/app/Console/Commands/FixLatitudeLongitude.php b/app/Console/Commands/FixLatitudeLongitude.php deleted file mode 100644 index cf4a748c88..0000000000 --- a/app/Console/Commands/FixLatitudeLongitude.php +++ /dev/null @@ -1,45 +0,0 @@ - 99 OR longitude > 99) AND deleted_at IS NULL;')); - - foreach ($users as $user) { - $this->info("User {$user->id} {$user->country}:{$user->location}"); - $geocoded = $geocoder->geocode($user->location.','.$user->country); - - if (! empty($geocoded)) { - $this->info("...{$geocoded['latitude']}, {$geocoded['longitude']}"); - DB::update(DB::raw("UPDATE users SET latitude = {$geocoded['latitude']}, longitude={$geocoded['longitude']} WHERE id = {$user->id};")); - } - } - } -} diff --git a/app/Console/Commands/GroupCountryField.php b/app/Console/Commands/GroupCountryField.php new file mode 100644 index 0000000000..fe5f8c8883 --- /dev/null +++ b/app/Console/Commands/GroupCountryField.php @@ -0,0 +1,39 @@ +country = Fixometer::getCountryFromCountryCode($group->country_code); + $group->save(); + } + } +} diff --git a/app/Console/Commands/ImportGroups.php b/app/Console/Commands/ImportGroups.php index 18c8ddada8..bf4aa49532 100644 --- a/app/Console/Commands/ImportGroups.php +++ b/app/Console/Commands/ImportGroups.php @@ -61,7 +61,7 @@ public function handle() return iconv( "iso-8859-15", "UTF-8", $str ); }, $fields); - // Format is 'Name', 'Location', 'Postcode', 'Area', 'Country', 'Latitude', 'Longitude', 'Website', 'Phone', 'Networks', 'Description'. + // Format is 'Name', 'Location', 'Postcode', 'Area', 'CountryCode', 'Latitude', 'Longitude', 'Website', 'Phone', 'Networks', 'Description'. $groupname = $fields[0]; $location = $fields[1]; @@ -122,7 +122,7 @@ public function handle() $group->area = $area; $group->latitude = $lat; $group->longitude = $lng; - $group->country = $country; + $group->country_code = $country; $group->website = $website; $group->phone = $phone; $group->free_text = $description; diff --git a/app/Console/Commands/SyncEvents.php b/app/Console/Commands/SyncEvents.php index 182ea8aff3..9e6d3600a8 100644 --- a/app/Console/Commands/SyncEvents.php +++ b/app/Console/Commands/SyncEvents.php @@ -3,6 +3,7 @@ namespace App\Console\Commands; use App\Group; +use App\Helpers\Fixometer; use App\Party; use DateTime; use Illuminate\Console\Command; @@ -77,7 +78,7 @@ public function handle() $custom_fields = [ ['key' => 'party_grouphash', 'value' => $event->group], - ['key' => 'party_groupcountry', 'value' => $group->country], + ['key' => 'party_groupcountry', 'value' => Fixometer::getCountryFromCountryCode($group->country_code)], ['key' => 'party_groupcity', 'value' => $group->area], ['key' => 'party_venue', 'value' => $event->venue], ['key' => 'party_location', 'value' => $event->location], diff --git a/app/Console/Commands/SyncGroups.php b/app/Console/Commands/SyncGroups.php index 8d00012056..051f7b4f9c 100644 --- a/app/Console/Commands/SyncGroups.php +++ b/app/Console/Commands/SyncGroups.php @@ -3,6 +3,7 @@ namespace App\Console\Commands; use App\Group; +use App\Helpers\Fixometer; use Illuminate\Console\Command; class SyncGroups extends Command @@ -54,7 +55,7 @@ public function handle() try { $custom_fields = [ ['key' => 'group_city', 'value' => $group->area], - ['key' => 'group_country', 'value' => $group->country], + ['key' => 'group_country', 'value' => Fixometer::getCountryFromCountryCode($group->country_code)], ['key' => 'group_website', 'value' => $group->website], ['key' => 'group_hash', 'value' => $group->idgroups], ['key' => 'group_latitude', 'value' => $group->latitude], diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index e887ff8bef..84a4a60068 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -41,6 +41,8 @@ protected function schedule(Schedule $schedule) ->daily() ->sendOutputTo(storage_path().'/logs/discourse_usernames.log') ->emailOutputTo(env('SEND_COMMAND_LOGS_TO'), 'tech@therestartproject.org'); + + $schedule->command('groups:country')->hourly(); } /** diff --git a/app/Group.php b/app/Group.php index 1ecf268740..1cb8c8d8f9 100644 --- a/app/Group.php +++ b/app/Group.php @@ -34,7 +34,7 @@ class Group extends Model implements Auditable 'postcode', 'latitude', 'longitude', - 'country', + 'country_code', 'free_text', 'facebook', 'wordpress_post_id', diff --git a/app/Helpers/Geocoder.php b/app/Helpers/Geocoder.php index eb2178e52b..6dea4b0f96 100644 --- a/app/Helpers/Geocoder.php +++ b/app/Helpers/Geocoder.php @@ -30,14 +30,14 @@ public function geocode($location) foreach ($decoded->{'address_components'} as $component) { if ($component->types && count($component->types) && $component->types[0] === 'country') { - $country = $component->long_name; + $country_code = $component->short_name; } } return [ 'latitude' => $latitude, 'longitude' => $longitude, - 'country' => $country, + 'country_code' => $country_code, ]; } } diff --git a/app/Http/Controllers/API/EventController.php b/app/Http/Controllers/API/EventController.php index cc5077bbc4..12ef1170fc 100644 --- a/app/Http/Controllers/API/EventController.php +++ b/app/Http/Controllers/API/EventController.php @@ -704,7 +704,7 @@ function ($attribute, $value, $fail) use ($request) { $geocoded = $geocoder->geocode($location); if (empty($geocoded)) { - throw ValidationException::withMessages(['location ' => __('groups.geocode_failed')]); + throw ValidationException::withMessages(['location ' => __('events.geocode_failed')]); } $latitude = $geocoded['latitude']; diff --git a/app/Http/Controllers/API/GroupController.php b/app/Http/Controllers/API/GroupController.php index eaddc820d0..f7bc88f70d 100644 --- a/app/Http/Controllers/API/GroupController.php +++ b/app/Http/Controllers/API/GroupController.php @@ -86,8 +86,6 @@ public static function getGroupsByUsersNetworks(Request $request) // New Collection Instance $collection = collect([]); - $countries = array_flip(\App\Helpers\Fixometer::getAllCountries()); - foreach ($groups as $group) { // If we have a bounding box, check that the group is within it. if (! $bbox || ( @@ -102,7 +100,8 @@ public static function getGroupsByUsersNetworks(Request $request) 'timezone' => $group->timezone, 'location' => [ 'value' => $group->location, - 'country' => Fixometer::translateCountry($group->country, $countries), + 'country' => Fixometer::getCountryFromCountryCode($group->country_code), + 'country_code' => $group->country_code, 'latitude' => $group->latitude, 'longitude' => $group->longitude, 'area' => $group->area, @@ -606,7 +605,7 @@ public function createGroupv2(Request $request) { 'postcode' => $postcode, 'latitude' => $latitude, 'longitude' => $longitude, - 'country' => $country, + 'country_code' => $country, 'free_text' => $description, 'shareable_code' => Fixometer::generateUniqueShareableCode(\App\Group::class, 'shareable_code'), 'timezone' => $timezone, @@ -750,7 +749,7 @@ public function updateGroupv2(Request $request, $idGroup) { 'location' => $location, 'latitude' => $latitude, 'longitude' => $longitude, - 'country' => $country, + 'country_code' => $country, 'free_text' => $description, 'timezone' => $timezone, 'phone' => $phone, @@ -875,7 +874,7 @@ private function validateGroupParams(Request $request, $create): array { $latitude = null; $longitude = null; - $country = null; + $country_code = null; if ($timezone && !in_array($timezone, \DateTimeZone::listIdentifiers(\DateTimeZone::ALL_WITH_BC))) { throw ValidationException::withMessages(['location ' => __('partials.validate_timezone')]); @@ -895,7 +894,7 @@ private function validateGroupParams(Request $request, $create): array { // Note that the country returned by the geocoder is already in English, which is what we need for the // value in the database. - $country = $geocoded['country']; + $country_code = $geocoded['country_code']; } return array( @@ -909,7 +908,7 @@ private function validateGroupParams(Request $request, $create): array { $timezone, $latitude, $longitude, - $country, + $country_code, $network_data, ); } diff --git a/app/Http/Controllers/API/UserGroupsController.php b/app/Http/Controllers/API/UserGroupsController.php index a6fb3b12ae..b6194192dd 100644 --- a/app/Http/Controllers/API/UserGroupsController.php +++ b/app/Http/Controllers/API/UserGroupsController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\API; use App\Group; +use App\Helpers\Fixometer; use App\Http\Controllers\Controller; use App\Role; use App\User; @@ -83,7 +84,7 @@ protected static function mapDetailsAndAuditToChange($userGroupAssociation, $aud $group = Group::find($userGroupAssociation->group); $userGroupChange['group_name'] = $group->name; $userGroupChange['group_area'] = $group->area; - $userGroupChange['group_country'] = $group->country; + $userGroupChange['group_country'] = Fixometer::getCountryFromCountryCode($group->country_code); return $userGroupChange; } diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php index 9006b809d0..65bcc2dd30 100644 --- a/app/Http/Controllers/ExportController.php +++ b/app/Http/Controllers/ExportController.php @@ -268,294 +268,4 @@ public function parties(Request $request) 'data' => ['No data to return'], ]); } - - public function getTimeVolunteered(Request $request, $search = null, $export = false) - { - $user = Auth::user(); - - //Get all group tags - $all_group_tags = GroupTags::all(); - - //Get all applicable groups - if (Fixometer::hasRole($user, 'Administrator')) - { - $all_groups = Group::all(); - } else if (Fixometer::hasRole($user, 'NetworkCoordinator')) { - $all_groups = new Collection(); - foreach ($user->networks as $network) { - $all_groups->merge($network->groups); - } - } elseif (Fixometer::hasRole($user, 'Host')) { - $host_groups = UserGroups::where('user', $user->id)->where('role', 3)->pluck('group')->toArray(); - $all_groups = Group::whereIn('groups.idgroups', $host_groups); - } elseif (Fixometer::hasRole($user, 'Restarter')) { - $all_groups = null; - } - - //See whether it is a get search or index page - if (is_null($search)) { - $user_events = EventsUsers::join('users', 'events_users.user', 'users.id') - ->join('events', 'events_users.event', 'events.idevents') - ->join('groups', 'events.group', 'groups.idgroups') - ->whereNotNull('events_users.user'); - - if (Fixometer::hasRole($user, 'Host')) { - $user_events = $user_events->whereIn('groups.idgroups', $host_groups); - } elseif (Fixometer::hasRole($user, 'Restarter')) { - $user_events = $user_events->where('users.id', $user->id); - } - } else { - //Misc - //Anonymous - if ($request->input('misc') !== null && $request->input('misc') == 1) { - $user_events = EventsUsers::leftJoin('users', 'events_users.user', 'users.id') - ->join('events', 'events_users.event', 'events.idevents') - ->join('groups', 'events.group', 'groups.idgroups'); - } else { - $user_events = EventsUsers::join('users', 'events_users.user', 'users.id') - ->join('events', 'events_users.event', 'events.idevents') - ->join('groups', 'events.group', 'groups.idgroups') - ->whereNotNull('events_users.user'); - } - - if (Fixometer::hasRole($user, 'Host')) { - $user_events = $user_events->whereIn('groups.idgroups', $host_groups); - } elseif (Fixometer::hasRole($user, 'Restarter')) { - $user_events = $user_events->where('users.id', $user->id); - } - - //Taxonomy - //Group filter - if ($request->input('groups') !== null) { - $user_events = $user_events->whereIn('groups.idgroups', $request->input('groups')); - } - - //Group tags filter - if ($request->input('tags') !== null) { - $user_events = $user_events->whereIn('groups.idgroups', GrouptagsGroups::whereIn('group_tag', $request->input('tags'))->pluck('group')); - } - - //By users - //Name - if ($request->input('name') !== null) { - $user_events = $user_events->where('users.name', 'like', '%'.$request->input('name').'%'); - } - - //Birth year - if ($request->input('year') !== null) { - $user_events = $user_events->whereBetween('users.age', explode('-', $request->input('year'))); - } - - //Gender - if ($request->input('gender') !== null) { - $user_events = $user_events->where('users.gender', 'like', '%'.$request->input('gender').'%'); - } - - //By date - // This is only used by admins and therefore the dates can be assumed to be in UTC. - if ($request->input('from_date') !== null && $request->input('to_date') == null) { - $user_events = $user_events->whereDate('events.event_start_utc', '>', $request->input('from_date')); - } elseif ($request->input('to_date') !== null && $request->input('from_date') == null) { - $user_events = $user_events->whereDate('events.event_end_utc', '<', $request->input('to_date')); - } elseif ($request->input('to_date') !== null && $request->input('from_date') !== null) { - $user_events = $user_events->whereBetween('events.event_start_utc', [ - $request->input('from_date'), - $request->input('to_date'), - ]); - } - - //By location - //Country - if ($request->input('country') !== null) { - $user_events = $user_events->where('users.country', $request->input('country')); - } - - //Region - //Need to add this in later is disabled at the moment - } - - // Filter out the old 'superhero' Restarter that was automatically added - // in the old system (pre-July 2018) to any event that was created. - $user_events->where('users.id', '<>', 29); - - //total users - $total_users = clone $user_events; - $total_users = $total_users->distinct('users.id')->count('users.id'); - - //anonymous users - $anonymous_users = clone $user_events; - $anonymous_users = $anonymous_users->whereNull('user')->count('*'); - - //group count - $group_count = clone $user_events; - $group_count = $group_count->distinct('group')->count('group'); - - //average age - $average_age = clone $user_events; - $average_age = $average_age->distinct('users.id')->pluck('users.age')->toArray(); - - foreach ($average_age as $key => $value) { - if (! is_int(intval($value)) || intval($value) <= 0) { - unset($average_age[$key]); - } else { - $average_age[$key] = intval($value); - } - } - - if (! empty($average_age)) { - $average_age = array_sum($average_age) / count($average_age); - $average_age = intval(date('Y')) - $average_age; - } else { - $average_age = 0; - } - - //hours completed - $hours_completed = clone $user_events; - $hours_completed = substr($hours_completed->sum(DB::raw('TIMEDIFF(event_start_utc, event_end_utc)')), 0, -4); - - //country hours completed - $country_hours_completed = clone $user_events; - $country_hours_completed = $country_hours_completed->groupBy('users.country')->select('users.country', DB::raw('SUM(TIMEDIFF(event_start_utc, event_end_utc)) as event_hours')); - $all_country_hours_completed = $country_hours_completed->orderBy('event_hours', 'DESC')->get(); - $country_hours_completed = $country_hours_completed->orderBy('event_hours', 'DESC')->take(5)->get(); - - //city hours completed - $city_hours_completed = clone $user_events; - $city_hours_completed = $city_hours_completed->groupBy('users.location')->select('users.location', DB::raw('SUM(TIMEDIFF(event_start_utc, event_end_utc)) as event_hours')); - $all_city_hours_completed = $city_hours_completed->orderBy('event_hours', 'DESC')->get(); - $city_hours_completed = $city_hours_completed->orderBy('event_hours', 'DESC')->take(5)->get(); - - //order by event date. - $user_events = $user_events->orderBy('events.event_start_utc', 'DESC'); - - //Select all necessary information for table - // - // This is only used by Admins, and therefore we can assume that they are in UTC and return times accordingly. - $user_events = $user_events->select( - 'users.id', - 'users.name as username', - 'events.idevents', - \DB::raw('TIME(events.event_start_utc) AS start'), - \DB::raw('TIME(events.event_end_utc) AS end'), - \DB::raw('DATE(events.event_start_utc) AS event_date'), - 'events.location', - 'events.venue', - 'groups.name as groupname' - ); - - if (! $export) { - $user_events = $user_events->paginate(env('PAGINATE')); - } else { - $user_events = $user_events->get(); - } - - if (! $export) { - return view('reporting.time-volunteered', [ - 'user' => $user, - 'user_events' => $user_events, - 'all_groups' => $all_groups, - 'all_group_tags' => $all_group_tags, - 'groups' => $request->input('groups'), - 'selected_tags' => $request->input('tags'), - 'name' => $request->input('name'), - 'age' => $request->input('year'), - 'gender' => $request->input('gender'), - 'from_date' => $request->input('from_date'), - 'to_date' => $request->input('to_date'), - 'country' => $request->input('country'), - 'region' => null, - 'misc' => $request->input('misc'), - 'total_users' => $total_users, - 'anonymous_users' => $anonymous_users, - 'group_count' => $group_count, - 'hours_completed' => $hours_completed, - 'average_age' => number_format($average_age, 1), - 'country_hours_completed' => $country_hours_completed, - 'all_country_hours_completed' => $all_country_hours_completed, - 'city_hours_completed' => $city_hours_completed, - 'all_city_hours_completed' => $all_city_hours_completed, - 'query' => str_replace($request->url(), '',$request->fullUrl()) - ]); - } - - return [ - 'user' => $user, - 'user_events' => $user_events, - 'all_groups' => $all_groups, - 'all_group_tags' => $all_group_tags, - 'total_users' => $total_users, - 'anonymous_users' => $anonymous_users, - 'group_count' => $group_count, - 'hours_completed' => $hours_completed, - 'average_age' => number_format($average_age, 1), - 'country_hours_completed' => $country_hours_completed, - 'city_hours_completed' => $city_hours_completed, - ]; - } - - public function exportTimeVolunteered(Request $request) { - if (!empty($request->all())) { - $data = $this->getTimeVolunteered($request, true, true); - } else { - $data = $this->getTimeVolunteered($request, null, true); - } - - //Creat new file and set headers - $file_name = 'time_reporting.csv'; - $file = fopen($file_name, 'w+'); - $file_headers = [ - "Content-type" => "text/csv", - ]; - - //Put stats in csv - $stats_headers = ['Hours Volunteered', 'Average age', 'Number of groups', 'Total number of users', 'Number of anonymous users']; - fputcsv($file, ['Overall Stats:']); - fputcsv($file, $stats_headers); - fputcsv($file, [number_format($data['hours_completed'], 0, '.', ','), 'N/A', $data['group_count'], $data['total_users'], $data['anonymous_users']]); - fputcsv($file, []); - - //Put breakdown by country in csv - $country_headers = ['Country name', 'Total hours']; - fputcsv($file, ['Breakdown by country:']); - fputcsv($file, $country_headers); - foreach($data['country_hours_completed'] as $country_hours) { - if(!is_null($country_hours->country)) { - $country = $country_hours->country; - } else { - $country = 'N/A'; - } - fputcsv($file, [$country, number_format($country_hours->hours/60/60, 0, '.', ',')]); - } - fputcsv($file, []); - - //Put breakdown by city in csv - $city_headers = ['Town/city name', 'Total hours']; - fputcsv($file, ['Breakdown by city:']); - fputcsv($file, $city_headers); - foreach($data['city_hours_completed'] as $city_hours) { - if(!is_null($city_hours->location)) { - $city = $city_hours->location; - } else { - $city = 'N/A'; - } - fputcsv($file, [$city, number_format($city_hours->hours/60/60, 0, '.', ',')]); - } - fputcsv($file, []); - - //Put users in csv - $users_headers = ['#', 'Hours', 'Event date', 'Restart group', 'Location']; - fputcsv($file, ['Results:']); - fputcsv($file, $users_headers); - foreach($data['user_events'] as $ue) { - fputcsv($file, [$ue->id, date('H:i', strtotime($ue->end) - strtotime($ue->start)), - date('d/m/Y', strtotime($ue->event_date)), $ue->groupname, $ue->location]); - } - fputcsv($file, []); - - //close file - fclose($file); - - return Response::download($file_name, $file_name, $file_headers); - - } } diff --git a/app/Http/Controllers/GroupController.php b/app/Http/Controllers/GroupController.php index 4ea4f8ac75..a6efa117e8 100644 --- a/app/Http/Controllers/GroupController.php +++ b/app/Http/Controllers/GroupController.php @@ -483,8 +483,6 @@ public static function expandGroups($groups, $your_groupids, $nearby_groupids) $user = Auth::user(); if ($groups) { - $countries = array_flip(Fixometer::getAllCountries('en')); - foreach ($groups as $group) { $group_image = $group->groupImage; @@ -513,7 +511,8 @@ public static function expandGroups($groups, $your_groupids, $nearby_groupids) asset('uploads/mid_'.$group_image->image->path) : null, 'location' => [ 'location' => rtrim($group->location), - 'country' => Fixometer::translateCountry($group->country, $countries), + 'country' => Fixometer::getCountryFromCountryCode($group->country_code), + 'country_code' => $group->country_code, 'distance' => $distance, ], 'next_event' => $event ? $event->event_date_local : null, diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 7995c57cd2..11bf84074f 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -157,7 +157,7 @@ public function postProfileInfoEdit(Request $request, App\Helpers\Geocoder $geoc User::find($id)->update([ 'email' => $request->input('email'), 'name' => $request->input('name'), - 'country' => $request->input('country'), + 'country_code' => $request->input('country'), 'location' => $request->input('townCity'), 'age' => $request->input('age'), 'gender' => $request->input('gender'), @@ -171,7 +171,7 @@ public function postProfileInfoEdit(Request $request, App\Helpers\Geocoder $geoc } if (! empty($user->location)) { - $geocoded = $geocoder->geocode("{$user->location}, {$user->country}"); + $geocoded = $geocoder->geocode("{$user->location}, " . Fixometer::getCountryFromCountryCode($user->country_code)); if (! empty($geocoded)) { $user->latitude = $geocoded['latitude']; $user->longitude = $geocoded['longitude']; @@ -373,11 +373,19 @@ public function postAdminEdit(Request $request) $user = User::find($user_id); + $oldRole = $user->role; + // Set role for User $user->update([ - 'role' => $request->input('user_role'), + 'role' => $request->input('user_role'), ]); + // If we are demoting from NetworkCoordinator, remove them from the list of coordinators for + // any networks they are currently coordinating. + if ($oldRole == Role::NETWORK_COORDINATOR && ($user->role == Role::HOST || $user->role == Role::RESTARTER)) { + $user->networks()->detach(); + } + // The user may have previously been removed from the group, which will mean they have an entry in // users_groups with deleted_at set. Zap that if present so that sync() then works. sync() doesn't // handle soft deletes itself. @@ -528,7 +536,7 @@ public function all() $user['permissions'] = $User->getRolePermissions($user->role); $user['groups'] = $user->groups; $user['lastLogin'] = $user->lastLogin(); - $user['country'] = Fixometer::getCountryFromCountryCode($user->country); + $user['country'] = Fixometer::getCountryFromCountryCode($user->country_code); return $user; }); @@ -599,7 +607,7 @@ public function search(Request $request) $user['permissions'] = $User->getRolePermissions($user->role); $user['groups'] = $user->groups; $user['lastLogin'] = $user->lastLogin(); - $user['country'] = Fixometer::getCountryFromCountryCode($user->country); + $user['country'] = Fixometer::getCountryFromCountryCode($user->country_code); return $user; }); @@ -912,7 +920,7 @@ public function postRegister(Request $request, $hash = null) if (Auth::check()) { //Existing users are to update $user = User::find(Auth::user()->id); - $user->country = $request->input('country'); + $user->country_code = $request->input('country'); $user->location = $request->input('city'); $user->gender = $request->input('gender'); $user->age = $request->input('age'); @@ -927,7 +935,7 @@ public function postRegister(Request $request, $hash = null) 'role' => $role, 'recovery' => substr(bin2hex(openssl_random_pseudo_bytes(32)), 0, 24), 'recovery_expires' => strftime('%Y-%m-%d %X', time() + (24 * 60 * 60)), - 'country' => $request->input('country'), + 'country_code' => $request->input('country'), 'location' => $request->input('city'), 'gender' => $request->input('gender'), 'age' => $request->input('age'), @@ -1116,9 +1124,6 @@ public function getUserMenus(Request $request) if ($user->hasRole('Administrator') || $user->hasRole('Host')) { $items = []; - if ($user->hasRole('Administrator')) { - $items[Lang::get('general.time_reporting')] = url('/reporting/time-volunteered?a'); - } $items[Lang::get('general.party_reporting')] = url('/search'); $reportingMenu = [ diff --git a/app/Http/Resources/GroupLocation.php b/app/Http/Resources/GroupLocation.php index 2448761871..ec4f75d22d 100644 --- a/app/Http/Resources/GroupLocation.php +++ b/app/Http/Resources/GroupLocation.php @@ -30,6 +30,12 @@ * example="United Kingdom" * ), * @OA\Property( + * property="country_code", + * description="The two-letter ISO country code.", + * format="string", + * example="GB" + * ), + * @OA\Property( * property="lat", * title="lat", * description="Latitude of the group.", @@ -66,7 +72,8 @@ public function toArray($request) 'location' => $this->location, 'area' => $this->area, 'postcode' => $this->postcode, - 'country' => \App\Helpers\Fixometer::translateCountry($this->country), + 'country' => \App\Helpers\Fixometer::getCountryFromCountryCode($this->country_code), + 'country_code' => $this->country_code, 'lat' => $this->latitude, 'lng' => $this->longitude, ]; diff --git a/app/Listeners/CreateWordpressPostForEvent.php b/app/Listeners/CreateWordpressPostForEvent.php index 877a0a087e..1bf382cceb 100644 --- a/app/Listeners/CreateWordpressPostForEvent.php +++ b/app/Listeners/CreateWordpressPostForEvent.php @@ -80,7 +80,7 @@ public function createEventOnWordpress($theParty): void ['key' => 'party_venue', 'value' => $theParty->venue], ['key' => 'party_location', 'value' => $theParty->location], ['key' => 'party_time', 'value' => $theParty->getEventStartEndLocal()], - ['key' => 'party_groupcountry', 'value' => $group->country], + ['key' => 'party_groupcountry', 'value' => Fixometer::getCountryFromCountryCode($group->country_code)], ['key' => 'party_groupcity', 'value' => $group->area], ['key' => 'party_date', 'value' => $theParty->event_date_local], ['key' => 'party_timestamp', 'value' => $startTimestamp], diff --git a/app/Listeners/CreateWordpressPostForGroup.php b/app/Listeners/CreateWordpressPostForGroup.php index 3ecb87a679..12981061e6 100644 --- a/app/Listeners/CreateWordpressPostForGroup.php +++ b/app/Listeners/CreateWordpressPostForGroup.php @@ -72,7 +72,7 @@ public function createGroupOnWordpress($group): void if (!$group->wordpress_post_id) { $custom_fields = [ ['key' => 'group_city', 'value' => $group->area], - ['key' => 'group_country', 'value' => $group->country], + ['key' => 'group_country', 'value' => Fixometer::getCountryFromCountryCode($group->country_code)], ['key' => 'group_website', 'value' => $group->website], ['key' => 'group_hash', 'value' => $group->idgroups], ['key' => 'group_avatar_url', 'value' => $group->groupImagePath()], diff --git a/app/Listeners/EditWordpressPostForEvent.php b/app/Listeners/EditWordpressPostForEvent.php index 83d51ac11a..b91dc035c4 100644 --- a/app/Listeners/EditWordpressPostForEvent.php +++ b/app/Listeners/EditWordpressPostForEvent.php @@ -53,7 +53,7 @@ public function handle(EditEvent $event) $custom_fields = [ ['key' => 'party_grouphash', 'value' => $data['group']], - ['key' => 'party_groupcountry', 'value' => $group->country], + ['key' => 'party_groupcountry', 'value' => Fixometer::getCountryFromCountryCode($group->country_code)], ['key' => 'party_groupcity', 'value' => $group->area], ['key' => 'party_venue', 'value' => $data['venue']], ['key' => 'party_location', 'value' => $data['location']], diff --git a/app/Listeners/EditWordpressPostForGroup.php b/app/Listeners/EditWordpressPostForGroup.php index 3226b73b9e..2985613ed1 100644 --- a/app/Listeners/EditWordpressPostForGroup.php +++ b/app/Listeners/EditWordpressPostForGroup.php @@ -45,7 +45,7 @@ public function handle(EditGroup $event) if (is_numeric($group->wordpress_post_id)) { $custom_fields = [ ['key' => 'group_city', 'value' => $group->area], - ['key' => 'group_country', 'value' => $group->country], + ['key' => 'group_country', 'value' => Fixometer::getCountryFromCountryCode($group->country_code)], ['key' => 'group_website', 'value' => $data['website']], ['key' => 'group_hash', 'value' => $id], ['key' => 'group_avatar_url', 'value' => $data['group_avatar']], diff --git a/app/Services/CheckAuthService.php b/app/Services/CheckAuthService.php index b428472064..395341ad8b 100644 --- a/app/Services/CheckAuthService.php +++ b/app/Services/CheckAuthService.php @@ -77,10 +77,6 @@ private function handle($email) if ($this->is_host || $this->is_admin) { $this->menu->get('reporting')->put('header', 'Reporting'); - if ($this->is_admin) { - $this->menu->get('reporting')->put(Lang::get('general.time_reporting'), url('reporting/time-volunteered?a')); - } - $this->menu->get('reporting')->put(Lang::get('general.party_reporting'), url('search')); $this->menu->get('reporting')->put('reporting_spacer', 'spacer'); diff --git a/app/User.php b/app/User.php index 8c512a8e89..72651e4026 100644 --- a/app/User.php +++ b/app/User.php @@ -37,7 +37,7 @@ class User extends Authenticatable implements Auditable, HasLocalePreference * @var array */ protected $fillable = [ - 'name', 'email', 'password', 'role', 'recovery', 'recovery_expires', 'language', 'repair_network', 'location', 'age', 'gender', 'country', 'newsletter', 'drip_subscriber_id', 'invites', 'biography', 'consent_future_data', 'consent_past_data', 'consent_gdpr', 'number_of_logins', 'latitude', 'longitude', 'last_login_at', 'api_token', 'access_group_tag_id', 'calendar_hash', 'repairdir_role', 'mediawiki', 'username', + 'name', 'email', 'password', 'role', 'recovery', 'recovery_expires', 'language', 'repair_network', 'location', 'age', 'gender', 'country_code', 'newsletter', 'drip_subscriber_id', 'invites', 'biography', 'consent_future_data', 'consent_past_data', 'consent_gdpr', 'number_of_logins', 'latitude', 'longitude', 'last_login_at', 'api_token', 'access_group_tag_id', 'calendar_hash', 'repairdir_role', 'mediawiki', 'username', ]; /** diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index f413454394..c151ae195e 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -38,7 +38,7 @@ public function definition() 'consent_gdpr' => new \DateTime(), 'number_of_logins' => 1, 'age' => $this->faker->year(), - 'country' => $this->faker->countryCode(), + 'country_code' => $this->faker->countryCode(), 'role' => Role::RESTARTER, 'invites' => 1, 'repairdir_role' => Role::REPAIR_DIRECTORY_NONE, diff --git a/database/migrations/2023_06_12_153317_country_codes.php b/database/migrations/2023_06_12_153317_country_codes.php new file mode 100644 index 0000000000..789b2a855c --- /dev/null +++ b/database/migrations/2023_06_12_153317_country_codes.php @@ -0,0 +1,64 @@ +renameColumn('country', 'country_code'); + }); + + // Add country code to groups table - we leave the country field in place because it's used by + // e.g. ORA exports. There is a scheduled job which updates the country field from the + // code. + Schema::table('groups', function (Blueprint $table) { + $table->string('country_code', 2)->after('area')->nullable(); + }); + + $groups = DB::select(DB::raw('SELECT idgroups, country FROM `groups`')); + + foreach ($groups as $g) { + // Countries are stored in English. + if ($g->country) { + $country = $g->country; + $group = Group::findOrFail($g->idgroups); + $group->country_code = $countries[$country]; + Log::debug('Country: ' . $group->country . ' => ' . $group->country_code); + $group->save(); + } + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('groups', function (Blueprint $table) { + $table->dropColumn('country_code'); + }); + + Schema::table('users', function (Blueprint $table) { + $table->renameColumn('country_code', 'country'); + }); + + DB::update(DB::raw("UPDATE users SET country = 'GBR' WHERE country = 'GB'")); + } +}; diff --git a/lang/de/devices.php b/lang/de/devices.php index 125bb6b1c0..fa71cbc676 100644 --- a/lang/de/devices.php +++ b/lang/de/devices.php @@ -3,7 +3,6 @@ return [ 'devices' => 'Devices', 'export_device_data' => 'Export device data', - 'by_taxonomy' => 'By taxonomy', 'by_date' => 'By date', 'category' => 'Category', 'group' => 'Group', diff --git a/lang/de/events.php b/lang/de/events.php index 62fd01deed..ca2ce0a739 100644 --- a/lang/de/events.php +++ b/lang/de/events.php @@ -65,12 +65,6 @@ 'field_event_venue' => 'Venue address', 'field_event_images' => 'Add event images here', 'field_event_images_2' => 'Choose an image for your event', - 'field_event_street_address' => 'Street address', - 'field_event_route' => 'Route', - 'field_event_city' => 'City', - 'field_event_county' => 'County/State', - 'field_event_zip' => 'Post/Zip code', - 'field_event_country' => 'Country', 'field_add_image' => 'Add images', 'before_submit_text' => 'Once confirmed by our community lead, your event will be made public on The Restart Project homepage.', 'save_event' => 'Save Event', diff --git a/lang/de/general.php b/lang/de/general.php index 6195e435e7..76a4edfa2b 100644 --- a/lang/de/general.php +++ b/lang/de/general.php @@ -11,7 +11,6 @@ 'alert_uptodate_text' => 'You have nothing to action now. When you do, we\'ll let you know.', 'general' => 'General', 'reporting' => 'Reporting', - 'time_reporting' => 'Volunteer hours', 'party_reporting' => 'Event reporting', 'signmeup' => 'Sign me up!', 'introduction_message' => 'We are a global community of people who help others fix their electronics in community events. Join us!', diff --git a/lang/de/groups.php b/lang/de/groups.php index 43124bfcae..c8c3bb6b01 100644 --- a/lang/de/groups.php +++ b/lang/de/groups.php @@ -25,9 +25,6 @@ 'group_admin_only' => 'Admin only', 'group_tags' => 'Group tags', 'approve_group' => 'Approve group', - 'groups_modal-button' => 'Yes, lets get started!', - 'groups_modal_title' => 'Would you like to start a community repair group?', - 'groups_modal_content' => 'We can help you get started, scheduling and announcing events, logging data and getting reports on their impact.', 'email_addresses_field' => 'Email addresses', 'type_email_addresses_message' => 'Type in the email addresses of the people you would like to invite to this group. Press the tab or comma key after each email address.', 'message_header' => 'Invitation message', diff --git a/lang/de/reporting.php b/lang/de/reporting.php index 09c49fbf89..b211130216 100644 --- a/lang/de/reporting.php +++ b/lang/de/reporting.php @@ -16,7 +16,6 @@ 'yes' => 'Yes', 'no' => 'No', 'country' => 'Country', - 'time_volunteered' => 'Time Volunteered', 'average_age' => 'Average age', 'number_of_groups' => 'Number of groups', 'total_number_of_users' => 'Total number of users', @@ -34,5 +33,4 @@ 'event_date' => 'Event date', 'event_name' => 'Event', 'restart_group' => 'Group', - 'export_csv' => 'Export to CSV', ]; diff --git a/lang/en/countries.php b/lang/en/countries.php index 04059479bd..5f1ce2e37e 100644 --- a/lang/en/countries.php +++ b/lang/en/countries.php @@ -119,7 +119,7 @@ 'KE' => 'Kenya', 'KI' => 'Kiribati', 'KP' => "Korea, Democratic People's Republic of", - 'KR' => 'Korea, Republic of', + 'KR' => 'South Korea', 'KW' => 'Kuwait', 'KG' => 'Kyrgyzstan', 'LA' => "Lao People's Democratic Republic", @@ -218,7 +218,7 @@ 'SE' => 'Sweden', 'CH' => 'Switzerland', 'SY' => 'Syrian Arab Republic', - 'TW' => 'Taiwan, Province of China', + 'TW' => 'Taiwan', 'TJ' => 'Tajikistan', 'TZ' => 'Tanzania, United Republic of', 'TH' => 'Thailand', @@ -250,4 +250,4 @@ 'YE' => 'Yemen', 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe', -]; \ No newline at end of file +]; diff --git a/lang/en/devices.php b/lang/en/devices.php index c358aa2afe..811d90c35b 100644 --- a/lang/en/devices.php +++ b/lang/en/devices.php @@ -5,7 +5,6 @@ 'export_device_data' => 'Export all data', 'export_event_data' => 'Export event data', 'export_group_data' => 'Export group data', - 'by_taxonomy' => 'By taxonomy', 'by_date' => 'By date', 'category' => 'Category', 'group' => 'Group', @@ -44,7 +43,8 @@ 'powered_items' => 'powered items', 'unpowered_items' => 'unpowered items', 'weight' => 'Weight', - 'required_impact' => 'kg - required for environmental impact calculation', + 'required_impact' => 'kg - required to calculate environmental impact', + 'optional_impact' => 'kg - used to refine environmental impact calculation (optional)', 'age_approx' => 'years (approximate if unknown)', 'repair_source' => 'Source of repair information', 'tooltip_category' => 'Choose the category that best fits this item. More information about these categories...', diff --git a/lang/en/events.php b/lang/en/events.php index 282cb9b582..d44f7ae5ba 100644 --- a/lang/en/events.php +++ b/lang/en/events.php @@ -71,12 +71,6 @@ 'field_event_date' => 'Date of event', 'field_event_time' => 'Start/end time', 'field_event_venue' => 'Venue address', - 'field_event_street_address' => 'Street address', - 'field_event_route' => 'Route', - 'field_event_city' => 'City', - 'field_event_county' => 'County/State', - 'field_event_zip' => 'Post/Zip code', - 'field_event_country' => 'Country', 'field_add_image' => 'Add images', 'before_submit_text' => 'Once confirmed by a coordinator, your event will be made public.', 'reporting' => 'Event Reporting', diff --git a/lang/en/general.php b/lang/en/general.php index 269b6177b6..ea7a365ebc 100644 --- a/lang/en/general.php +++ b/lang/en/general.php @@ -18,7 +18,6 @@ 'new_group' => 'Create a new group', 'alert_uptodate' => 'Thanks! You are up to date', 'alert_uptodate_text' => 'You have nothing to action now. When you do, we\'ll let you know.', - 'time_reporting' => 'Volunteer hours', 'party_reporting' => 'Event reporting', 'signmeup' => 'Sign me up!', 'introduction_message' => 'We are a global community of people who help others fix their electronics in community events. Join us!', diff --git a/lang/en/groups.php b/lang/en/groups.php index b69b543962..6ea7512550 100644 --- a/lang/en/groups.php +++ b/lang/en/groups.php @@ -29,9 +29,6 @@ 'group_tag2' => 'Group tag', 'group_tags' => 'Group tags', 'approve_group' => 'Approve group', - 'groups_modal-button' => 'Yes, lets get started!', - 'groups_modal_title' => 'Would you like to start a community repair group?', - 'groups_modal_content' => 'We can help you get started, scheduling and announcing events, logging data and getting reports on their impact.', 'invite_group_header_link' => 'Invite volunteers', 'shareable_link' => 'Invite via shareable link', 'email_addresses_field' => 'Email addresses', @@ -164,7 +161,6 @@ 'group_requires_moderation' => 'Group requires moderation', 'field_phone' => 'Phone number', 'phone_small' => '(Optional)', - 'invite_no_emails' => 'You have not entered any emails!', 'invite_invalid_emails' => 'Invalid emails were entered, so no notifications were sent - please send your invitation again. The invalid emails were: :emails', 'invite_success' => 'Invites sent!', 'invite_success_apart_from' => 'Invites sent - apart from these (:emails) who have already joined the group, have already been sent an invite, or have not opted in to receive emails.', diff --git a/lang/en/reporting.php b/lang/en/reporting.php index 10e09b32ce..972d735131 100644 --- a/lang/en/reporting.php +++ b/lang/en/reporting.php @@ -16,7 +16,6 @@ 'yes' => 'Yes', 'no' => 'No', 'country' => 'Country', - 'time_volunteered' => 'Time Volunteered', 'hours_volunteered' => 'Hours volunteered', 'average_age' => 'Average age', 'number_of_groups' => 'Number of groups', @@ -35,5 +34,4 @@ 'event_date' => 'Event date', 'event_name' => 'Event', 'restart_group' => 'Group', - 'export_csv' => 'Export to CSV', ]; diff --git a/lang/fr-BE/countries.php b/lang/fr-BE/countries.php index 137dbb9188..ccc369b13e 100644 --- a/lang/fr-BE/countries.php +++ b/lang/fr-BE/countries.php @@ -218,7 +218,7 @@ 'SE' => 'Sweden', 'CH' => 'Switzerland', 'SY' => 'Syrian Arab Republic', - 'TW' => 'Taiwan, Province of China', + 'TW' => 'Taiwan', 'TJ' => 'Tajikistan', 'TZ' => 'Tanzania, United Republic of', 'TH' => 'Thailand', diff --git a/lang/fr-BE/devices.php b/lang/fr-BE/devices.php index 77962e3747..dc38695bb4 100644 --- a/lang/fr-BE/devices.php +++ b/lang/fr-BE/devices.php @@ -5,7 +5,6 @@ 'export_device_data' => 'Exporter les données des appareils', 'export_event_data' => 'Exporter les données de l\'événement', 'export_group_data' => 'Exporter les données du Repair Café', - 'by_taxonomy' => 'Par taxonomie', 'by_date' => 'Par date', 'category' => 'Catégorie', 'group' => 'Repair Café', @@ -47,7 +46,8 @@ 'powered_items' => 'Appareils électriques', 'repair_outcome' => 'Résultat de la réparation?', 'repair_source' => 'Source d\'information de la réparation', - 'required_impact' => 'kg - requis pour calcul de l\'impact environnemental', + 'required_impact' => 'kg - nécessaire pour calculer l\'impact sur l\'environnement', + 'optional_impact' => 'kg - utilisé pour affiner le calcul de l\'impact environnemental (facultatif)', 'title_assessment' => 'Evaluation', 'title_items' => 'Objet', 'title_items_at_event' => 'Objets à cet événement', diff --git a/lang/fr-BE/events.php b/lang/fr-BE/events.php index 5d39e14b3f..f4552510ff 100644 --- a/lang/fr-BE/events.php +++ b/lang/fr-BE/events.php @@ -65,12 +65,6 @@ 'field_event_venue' => 'Adresse du lieu', 'field_event_images' => 'Ajoutez des images de l\'événement ici', 'field_event_images_2' => 'Choisissez une image pour votre événement', - 'field_event_street_address' => 'Rue', - 'field_event_route' => 'Itinéraire', - 'field_event_city' => 'Ville', - 'field_event_county' => 'Région', - 'field_event_zip' => 'Code postal', - 'field_event_country' => 'Pays', 'field_add_image' => 'Ajoutez une image', 'before_submit_text' => 'Une fois confirmé par le responsable du réseau, votre événement sera rendu public sur la page d\'accueil du Restart Project.', 'save_event' => 'Sauver l\'événement', diff --git a/lang/fr-BE/general.php b/lang/fr-BE/general.php index a841b15b5b..03b00d5e0d 100644 --- a/lang/fr-BE/general.php +++ b/lang/fr-BE/general.php @@ -11,7 +11,6 @@ 'alert_uptodate_text' => 'Vous n\'avez rien à faire. Quand vous devrez, nous vous préviendrons.', 'general' => 'Général', 'reporting' => 'Rapports', - 'time_reporting' => 'Heures de bénévolat', 'party_reporting' => 'Rapports d’événements', 'signmeup' => 'Enregistrez‐moi!', 'introduction_message' => 'Nous sommes une communauté de bénévoles à travers le monde qui aident les gens à réparer leurs appareils électroniques lors d\'événements communautaires. Rejoignez‐nous !', diff --git a/lang/fr-BE/groups.php b/lang/fr-BE/groups.php index 61e527aa16..6120fa2a77 100644 --- a/lang/fr-BE/groups.php +++ b/lang/fr-BE/groups.php @@ -25,9 +25,6 @@ 'group_admin_only' => 'Seulement administrateur', 'group_tags' => 'Etiquettes du Repair Café', 'approve_group' => 'Approuver Repair Café', - 'groups_modal-button' => 'Oui, c\'est parti !', - 'groups_modal_title' => 'Voulez-vous créer un Repair Café?', - 'groups_modal_content' => 'Nous pouvons vous aider à démarrer, à programmer et à annoncer des événements, à enregistrer des données et à obtenir des rapports sur leur impact.', 'email_addresses_field' => 'Adresses e-mail', 'type_email_addresses_message' => 'Entrez les adresses e‐mail des personnes que vous souhaitez inviter à ce Repair Café. Appuyez sur la touche de tabulation (TAB) ou tapez une virgule après chaque adresse e-mail.', 'message_header' => 'Message d\'invitation', @@ -166,7 +163,6 @@ 'group_requires_moderation' => 'Repair Café a besoin de modération', 'field_phone' => 'Numéro de téléphone', 'phone_small' => '(Optionnel)', - 'invite_no_emails' => 'Vous n\'avez pas saisi d\'emails!', 'invite_invalid_emails' => 'Des emails non valides ont été saisis, donc aucune notification n\'a été envoyée - veuillez envoyer votre invitation à nouveau. Les emails invalides étaient: :emails', 'invite_success' => 'Les invitations sont envoyées!', 'invite_success_apart_from' => 'Invitations envoyées - en dehors de ces (:emails) qui ont déjà rejoint le groupe, ont déjà reçu une invitation, ou n\'ont pas choisi de recevoir des emails.', diff --git a/lang/fr-BE/reporting.php b/lang/fr-BE/reporting.php index fe1b46a2ab..0194a086f1 100644 --- a/lang/fr-BE/reporting.php +++ b/lang/fr-BE/reporting.php @@ -16,7 +16,6 @@ 'yes' => 'Oui', 'no' => 'Non', 'country' => 'Pays', - 'time_volunteered' => 'Temps de bénévolat', 'hours_volunteered' => 'Heures de bénévolat', 'average_age' => 'Moyenne d\'âge', 'number_of_groups' => 'Nombre de Repair Cafés', @@ -35,5 +34,4 @@ 'event_date' => 'Date de l\'événement', 'event_name' => 'Evénement', 'restart_group' => 'Repair Café', - 'export_csv' => 'Exporter en CSV', ]; diff --git a/lang/fr/devices.php b/lang/fr/devices.php index 77962e3747..dc38695bb4 100644 --- a/lang/fr/devices.php +++ b/lang/fr/devices.php @@ -5,7 +5,6 @@ 'export_device_data' => 'Exporter les données des appareils', 'export_event_data' => 'Exporter les données de l\'événement', 'export_group_data' => 'Exporter les données du Repair Café', - 'by_taxonomy' => 'Par taxonomie', 'by_date' => 'Par date', 'category' => 'Catégorie', 'group' => 'Repair Café', @@ -47,7 +46,8 @@ 'powered_items' => 'Appareils électriques', 'repair_outcome' => 'Résultat de la réparation?', 'repair_source' => 'Source d\'information de la réparation', - 'required_impact' => 'kg - requis pour calcul de l\'impact environnemental', + 'required_impact' => 'kg - nécessaire pour calculer l\'impact sur l\'environnement', + 'optional_impact' => 'kg - utilisé pour affiner le calcul de l\'impact environnemental (facultatif)', 'title_assessment' => 'Evaluation', 'title_items' => 'Objet', 'title_items_at_event' => 'Objets à cet événement', diff --git a/lang/fr/events.php b/lang/fr/events.php index 5d39e14b3f..f4552510ff 100644 --- a/lang/fr/events.php +++ b/lang/fr/events.php @@ -65,12 +65,6 @@ 'field_event_venue' => 'Adresse du lieu', 'field_event_images' => 'Ajoutez des images de l\'événement ici', 'field_event_images_2' => 'Choisissez une image pour votre événement', - 'field_event_street_address' => 'Rue', - 'field_event_route' => 'Itinéraire', - 'field_event_city' => 'Ville', - 'field_event_county' => 'Région', - 'field_event_zip' => 'Code postal', - 'field_event_country' => 'Pays', 'field_add_image' => 'Ajoutez une image', 'before_submit_text' => 'Une fois confirmé par le responsable du réseau, votre événement sera rendu public sur la page d\'accueil du Restart Project.', 'save_event' => 'Sauver l\'événement', diff --git a/lang/fr/general.php b/lang/fr/general.php index a841b15b5b..03b00d5e0d 100644 --- a/lang/fr/general.php +++ b/lang/fr/general.php @@ -11,7 +11,6 @@ 'alert_uptodate_text' => 'Vous n\'avez rien à faire. Quand vous devrez, nous vous préviendrons.', 'general' => 'Général', 'reporting' => 'Rapports', - 'time_reporting' => 'Heures de bénévolat', 'party_reporting' => 'Rapports d’événements', 'signmeup' => 'Enregistrez‐moi!', 'introduction_message' => 'Nous sommes une communauté de bénévoles à travers le monde qui aident les gens à réparer leurs appareils électroniques lors d\'événements communautaires. Rejoignez‐nous !', diff --git a/lang/fr/groups.php b/lang/fr/groups.php index bea450d788..37c4bbf3e5 100644 --- a/lang/fr/groups.php +++ b/lang/fr/groups.php @@ -25,9 +25,6 @@ 'group_admin_only' => 'Seulement administrateur', 'group_tags' => 'Etiquettes du Repair Café', 'approve_group' => 'Approuver Repair Café', - 'groups_modal-button' => 'Oui, c\'est parti !', - 'groups_modal_title' => 'Voulez-vous créer un Repair Café?', - 'groups_modal_content' => 'Nous pouvons vous aider à démarrer, à programmer et à annoncer des événements, à enregistrer des données et à obtenir des rapports sur leur impact.', 'email_addresses_field' => 'Adresses e-mail', 'type_email_addresses_message' => 'Entrez les adresses e‐mail des personnes que vous souhaitez inviter à ce Repair Café. Appuyez sur la touche de tabulation (TAB) ou tapez une virgule après chaque adresse e-mail.', 'message_header' => 'Message d\'invitation', @@ -166,7 +163,6 @@ 'group_requires_moderation' => 'Repair Café a besoin de modération', 'field_phone' => 'Numéro de téléphone', 'phone_small' => '(Optionnel)', - 'invite_no_emails' => 'Vous n\'avez pas saisi d\'emails!', 'invite_invalid_emails' => 'Des emails non valides ont été saisis, donc aucune notification n\'a été envoyée - veuillez envoyer votre invitation à nouveau. Les emails invalides étaient: :emails', 'invite_success' => 'Les invitations sont envoyées!', 'invite_success_apart_from' => 'Invitations envoyées - en dehors de ces (:emails) qui ont déjà rejoint le groupe, ont déjà reçu une invitation, ou n\'ont pas choisi de recevoir des emails.', diff --git a/lang/fr/reporting.php b/lang/fr/reporting.php index fe1b46a2ab..0194a086f1 100644 --- a/lang/fr/reporting.php +++ b/lang/fr/reporting.php @@ -16,7 +16,6 @@ 'yes' => 'Oui', 'no' => 'Non', 'country' => 'Pays', - 'time_volunteered' => 'Temps de bénévolat', 'hours_volunteered' => 'Heures de bénévolat', 'average_age' => 'Moyenne d\'âge', 'number_of_groups' => 'Nombre de Repair Cafés', @@ -35,5 +34,4 @@ 'event_date' => 'Date de l\'événement', 'event_name' => 'Evénement', 'restart_group' => 'Repair Café', - 'export_csv' => 'Exporter en CSV', ]; diff --git a/lang/it/devices.php b/lang/it/devices.php index df24e52a5e..18a1307047 100644 --- a/lang/it/devices.php +++ b/lang/it/devices.php @@ -3,7 +3,6 @@ return [ 'devices' => 'Dispositivo', 'export_device_data' => 'Esporta dati del dispositivo', - 'by_taxonomy' => 'Classificazione per', 'by_date' => 'Fino a/Scadenza', 'category' => 'Categoria', 'group' => 'Gruppo', diff --git a/lang/it/events.php b/lang/it/events.php index 327caf0d71..058534e157 100644 --- a/lang/it/events.php +++ b/lang/it/events.php @@ -65,12 +65,6 @@ 'field_event_venue' => 'Indirizzo evento', 'field_event_images' => 'Aggiungi immagini/foto evento', 'field_event_images_2' => 'Scegli una immagine/foto per il tuo evento', - 'field_event_street_address' => 'Indirizzo', - 'field_event_route' => 'Itinerario', - 'field_event_city' => 'Citta\'', - 'field_event_county' => 'Regione', - 'field_event_zip' => 'Codice postale', - 'field_event_country' => 'Stato', 'field_add_image' => 'Inserisci immagine', 'before_submit_text' => 'Una volta confermato dal responsabile, il vostro evento sarà reso pubblico sulla homepage del Restart Project.', 'save_event' => 'Memorizza Evento', diff --git a/lang/it/general.php b/lang/it/general.php index 0c9e16538e..f96a616ee4 100644 --- a/lang/it/general.php +++ b/lang/it/general.php @@ -11,7 +11,6 @@ 'alert_uptodate_text' => 'Non hai nessuna azione da fare ora. Quando sara\' necessaria ti faremo sapere.', 'general' => 'Generale', 'reporting' => 'Reporting', - 'time_reporting' => 'Ore di volontariato', 'party_reporting' => 'Segnalazione eventi', 'signmeup' => 'Fammi entrare!', 'introduction_message' => 'Siamo una comunità globale di persone che aiutano gli altri a riparare i propri dispositivi elettronici in eventi comunitari. Unisciti a noi!', diff --git a/lang/it/groups.php b/lang/it/groups.php index f5b32df1ab..c88decedb4 100644 --- a/lang/it/groups.php +++ b/lang/it/groups.php @@ -25,9 +25,6 @@ 'group_admin_only' => 'Solo per Admin', 'group_tags' => 'Etichette del gruppo', 'approve_group' => 'Approva il gruppo', - 'groups_modal-button' => 'Incominciamo, certo!', - 'groups_modal_title' => 'Vorresti creare un gruppo di riparazione comunitaria?', - 'groups_modal_content' => 'Possiamo aiutarvi a iniziare, pianificare e annunciare eventi, registrare dati e ottenere rapporti sul loro impatto.', 'email_addresses_field' => 'Indirizzi email', 'type_email_addresses_message' => 'Digita gli indirizzi email delle persone che desideri invitare a questo gruppo. Premi il tasto tab o virgola dopo ogni indirizzo email.', 'message_header' => 'Messaggio di invito', diff --git a/lang/it/reporting.php b/lang/it/reporting.php index ece5cbd82a..0ccc14fee8 100644 --- a/lang/it/reporting.php +++ b/lang/it/reporting.php @@ -16,7 +16,6 @@ 'yes' => 'Si', 'no' => 'No', 'country' => 'Nazione', - 'time_volunteered' => 'Ore di Volontariato', 'average_age' => 'Età media', 'number_of_groups' => 'Numero di gruppi', 'total_number_of_users' => 'Numero totale di utenti', @@ -34,5 +33,4 @@ 'event_date' => 'Data evento', 'event_name' => 'Evento', 'restart_group' => 'Gruppo', - 'export_csv' => 'Esporta in CSV', ]; diff --git a/lang/ne/devices.php b/lang/ne/devices.php index 0419ae96fb..cfae391b45 100644 --- a/lang/ne/devices.php +++ b/lang/ne/devices.php @@ -4,7 +4,6 @@ 'by_date' => 'Op datum', 'age' => 'Leeftijd', 'brand' => 'Merk', - 'by_taxonomy' => 'Op taxonomie', 'category' => 'Categorie', 'delete_device' => 'Toestel wissen', 'devices' => 'Toestellen', diff --git a/lang/ne/events.php b/lang/ne/events.php index 0cfe199e5d..7ee4bf1056 100644 --- a/lang/ne/events.php +++ b/lang/ne/events.php @@ -26,9 +26,6 @@ 'event_name' => 'Naam van de activiteit', 'event_time' => 'Tijdstip', 'field_add_image' => 'Afbeelding toevoegen', - 'field_event_city' => 'Stad', - 'field_event_country' => 'Land', - 'field_event_county' => 'Provincie', 'field_event_date' => 'Datum van de activiteit', 'field_event_desc' => 'Beschrijving', 'field_event_group' => 'Activiteitengroep', @@ -36,11 +33,8 @@ 'field_event_images_2' => 'Kies een afbeelding voor je evenement', 'field_event_name' => 'Naam van de activiteit', 'field_event_name_helper' => 'Geef een plaatsnaam in - vermijd aub \'Restart Party\' of \'Repair Café\'.', - 'field_event_route' => 'Route', - 'field_event_street_address' => 'Straat en nummer', 'field_event_time' => 'Begin- en einduur', 'field_event_venue' => 'Adres', - 'field_event_zip' => 'Postcode', 'field_venue_helper' => 'bv de plaats waar de activiteit plaatsvindt', 'full_name' => 'Volledige naam', 'full_name_helper' => 'Laat leeg als je anoniem wilt blijven', diff --git a/lang/ne/general.php b/lang/ne/general.php index 81eb676212..23bf9be8c5 100644 --- a/lang/ne/general.php +++ b/lang/ne/general.php @@ -33,7 +33,6 @@ 'save_repair_skills' => 'Competenties bewaren', 'signmeup' => 'Registreer mij!', 'therestartproject' => 'Restart Project', - 'time_reporting' => 'Uren vrijwilligerswerk', 'your_name' => 'Je naam', 'your_name_validation' => 'Typ aub je naam', 'your_repair_skills' => 'Je competenties', diff --git a/lang/ne/groups.php b/lang/ne/groups.php index 179481190c..281219305c 100644 --- a/lang/ne/groups.php +++ b/lang/ne/groups.php @@ -24,9 +24,6 @@ 'groups_group_small' => 'Bijvoorbeeld \'Gents Milieufront\' of \'Maakbaar Leuven\'', 'groups_location' => 'Locatie', 'groups_location_small' => 'Bv de plaats waar er gerepareerd wordt!', - 'groups_modal-button' => 'Komaan, laten we eraan beginnen!', - 'groups_modal_content' => 'Wij kunnen je helpen met activiteiten te plannen en aan te kondigen, met gegevens bij te houden en met verslagen te maken van je impact.', - 'groups_modal_title' => 'Wil je een herstellersgroep starten?', 'groups_name' => 'Naam', 'groups_name_of' => 'Naam van de groep', 'groups_title1' => 'Jouw groepen', diff --git a/lang/ne/reporting.php b/lang/ne/reporting.php index 498d8f1351..d4b92d9912 100644 --- a/lang/ne/reporting.php +++ b/lang/ne/reporting.php @@ -13,7 +13,6 @@ 'country_name' => 'Naam van het land', 'event_date' => 'Datum van de activiteit', 'event_name' => 'Activiteit', - 'export_csv' => 'Exporteer als CSV', 'gender' => 'Gender', 'hours' => 'Uren', 'include_anonymous_users' => 'Anonieme gebruikers insluiten', @@ -30,7 +29,6 @@ 'restart_group' => 'Groep', 'search-all-time-volunteered' => 'Zoek uren vrijwilligerswerk', 'see_all_results' => 'Bekijk alle resultaten', - 'time_volunteered' => 'Uren vrijwilligerswerk', 'total_hours' => 'Totaal aantal uren', 'total_number_of_users' => 'Totaal aantal gebruikers', 'town_city_name' => 'Naam van de stad of gemeente', diff --git a/lang/nl-BE/devices.php b/lang/nl-BE/devices.php index 8d7e28ae40..a877a970cc 100644 --- a/lang/nl-BE/devices.php +++ b/lang/nl-BE/devices.php @@ -4,7 +4,6 @@ 'by_date' => 'Op datum', 'age' => 'Leeftijd', 'brand' => 'Merk', - 'by_taxonomy' => 'Op taxonomie', 'category' => 'Categorie', 'delete_device' => 'Toestel wissen', 'devices' => 'Toestellen', diff --git a/lang/nl-BE/events.php b/lang/nl-BE/events.php index 9db8f99425..f7edada6e7 100644 --- a/lang/nl-BE/events.php +++ b/lang/nl-BE/events.php @@ -26,9 +26,6 @@ 'event_name' => 'Activiteit', 'event_time' => 'Tijdstip', 'field_add_image' => 'Afbeelding toevoegen', - 'field_event_city' => 'Stad', - 'field_event_country' => 'Land', - 'field_event_county' => 'Provincie', 'field_event_date' => 'Datum van de activiteit', 'field_event_desc' => 'Beschrijving', 'field_event_group' => 'Activiteitengroep', @@ -36,11 +33,8 @@ 'field_event_images_2' => 'Kies een afbeelding voor je activiteit', 'field_event_name' => 'Activiteit', 'field_event_name_helper' => 'Geef een plaatsnaam in - vermijd aub \'Restart Party\' of \'Repair Café\'.', - 'field_event_route' => 'Route', - 'field_event_street_address' => 'Straat en nummer', 'field_event_time' => 'Begin- en einduur', 'field_event_venue' => 'Adres', - 'field_event_zip' => 'Postcode', 'field_venue_helper' => 'bv de plaats waar de activiteit plaatsvindt', 'full_name' => 'Volledige naam', 'full_name_helper' => 'Laat leeg als je anoniem wilt blijven', diff --git a/lang/nl-BE/general.php b/lang/nl-BE/general.php index 9ded73bbc1..8ed1da8c61 100644 --- a/lang/nl-BE/general.php +++ b/lang/nl-BE/general.php @@ -33,7 +33,6 @@ 'save_repair_skills' => 'Competenties bewaren', 'signmeup' => 'Registreer mij!', 'therestartproject' => 'Restart Project', - 'time_reporting' => 'Uren vrijwilligerswerk', 'your_name' => 'Je naam', 'your_name_validation' => 'Typ aub je naam', 'your_repair_skills' => 'Je competenties', diff --git a/lang/nl-BE/groups.php b/lang/nl-BE/groups.php index 67118e204c..d6b395b7a9 100644 --- a/lang/nl-BE/groups.php +++ b/lang/nl-BE/groups.php @@ -24,9 +24,6 @@ 'groups_group_small' => 'Bijvoorbeeld \'Gents Milieufront\' of \'Maakbaar Leuven\'', 'groups_location' => 'Locatie', 'groups_location_small' => 'Bv de plaats waar er gerepareerd wordt!', - 'groups_modal-button' => 'Komaan, laten we eraan beginnen!', - 'groups_modal_content' => 'Wij kunnen je helpen met activiteiten te plannen en aan te kondigen, met gegevens bij te houden en met verslagen te maken van je impact.', - 'groups_modal_title' => 'Wil je een herstellersgroep starten?', 'groups_name' => 'Naam', 'groups_name_of' => 'Naam van de groep', 'groups_title1' => 'Jouw groepen', diff --git a/lang/nl-BE/reporting.php b/lang/nl-BE/reporting.php index 498d8f1351..d4b92d9912 100644 --- a/lang/nl-BE/reporting.php +++ b/lang/nl-BE/reporting.php @@ -13,7 +13,6 @@ 'country_name' => 'Naam van het land', 'event_date' => 'Datum van de activiteit', 'event_name' => 'Activiteit', - 'export_csv' => 'Exporteer als CSV', 'gender' => 'Gender', 'hours' => 'Uren', 'include_anonymous_users' => 'Anonieme gebruikers insluiten', @@ -30,7 +29,6 @@ 'restart_group' => 'Groep', 'search-all-time-volunteered' => 'Zoek uren vrijwilligerswerk', 'see_all_results' => 'Bekijk alle resultaten', - 'time_volunteered' => 'Uren vrijwilligerswerk', 'total_hours' => 'Totaal aantal uren', 'total_number_of_users' => 'Totaal aantal gebruikers', 'town_city_name' => 'Naam van de stad of gemeente', diff --git a/lang/no/devices.php b/lang/no/devices.php index 5eb82b650f..7e9faab0e7 100644 --- a/lang/no/devices.php +++ b/lang/no/devices.php @@ -3,7 +3,6 @@ return [ 'devices' => 'Devices', 'export_device_data' => 'Export device data', - 'by_taxonomy' => 'By taxonomy', 'by_date' => 'By date', 'various' => 'Various', 'category' => 'Category', diff --git a/lang/no/events.php b/lang/no/events.php index 0f28da1458..da567088f9 100644 --- a/lang/no/events.php +++ b/lang/no/events.php @@ -65,12 +65,6 @@ 'field_event_venue' => 'Venue address', 'field_event_images' => 'Add event images here', 'field_event_images_2' => 'Choose an image for your event', - 'field_event_street_address' => 'Street address', - 'field_event_route' => 'Route', - 'field_event_city' => 'City', - 'field_event_county' => 'County/State', - 'field_event_zip' => 'Post/Zip code', - 'field_event_country' => 'Country', 'field_add_image' => 'Add images', 'before_submit_text' => 'Once confirmed by our community lead, your event will be made public on The Restart Project homepage.', 'save_event' => 'Save Event', diff --git a/lang/no/general.php b/lang/no/general.php index 38ad01e568..546dc92616 100644 --- a/lang/no/general.php +++ b/lang/no/general.php @@ -11,7 +11,6 @@ 'alert_uptodate_text' => 'You have nothing to action now. When you do, we\'ll let you know.', 'general' => 'General', 'reporting' => 'Reporting', - 'time_reporting' => 'Volunteer hours', 'party_reporting' => 'Event reporting', 'signmeup' => 'Sign me up!', 'introduction_message' => 'We are a global community of people who help others fix their electronics in community events. Join us!', diff --git a/lang/no/groups.php b/lang/no/groups.php index 43124bfcae..c8c3bb6b01 100644 --- a/lang/no/groups.php +++ b/lang/no/groups.php @@ -25,9 +25,6 @@ 'group_admin_only' => 'Admin only', 'group_tags' => 'Group tags', 'approve_group' => 'Approve group', - 'groups_modal-button' => 'Yes, lets get started!', - 'groups_modal_title' => 'Would you like to start a community repair group?', - 'groups_modal_content' => 'We can help you get started, scheduling and announcing events, logging data and getting reports on their impact.', 'email_addresses_field' => 'Email addresses', 'type_email_addresses_message' => 'Type in the email addresses of the people you would like to invite to this group. Press the tab or comma key after each email address.', 'message_header' => 'Invitation message', diff --git a/lang/no/reporting.php b/lang/no/reporting.php index 09c49fbf89..b211130216 100644 --- a/lang/no/reporting.php +++ b/lang/no/reporting.php @@ -16,7 +16,6 @@ 'yes' => 'Yes', 'no' => 'No', 'country' => 'Country', - 'time_volunteered' => 'Time Volunteered', 'average_age' => 'Average age', 'number_of_groups' => 'Number of groups', 'total_number_of_users' => 'Total number of users', @@ -34,5 +33,4 @@ 'event_date' => 'Event date', 'event_name' => 'Event', 'restart_group' => 'Group', - 'export_csv' => 'Export to CSV', ]; diff --git a/resources/js/app.js b/resources/js/app.js index 57aa439df2..548b772219 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -734,6 +734,35 @@ function initAutocomplete() { } }); + function removeUser() { + + var id = jQuery(this).data('remove-volunteer'); + + $.ajax({ + headers: { + 'X-CSRF-TOKEN': $("input[name='_token']").val() + }, + type: 'post', + url: '/party/remove-volunteer', + data: { + id : id, + }, + datatype: 'json', + success: function(json) { + if( json.success ){ + jQuery('.volunteer-' + id).fadeOut(); + } else { + alert('Something has gone wrong'); + } + }, + error: function(error) { + alert('Something has gone wrong'); + } + }); + + } + + jQuery('.js-remove').on('click', removeUser); jQuery(document).on('click', '[data-toggle="lightbox"]', function (event) { event.preventDefault(); jQuery(this).ekkoLightbox(); diff --git a/resources/js/components/DeviceCategorySelect.vue b/resources/js/components/DeviceCategorySelect.vue index a0a563e8cc..51d08e0bc0 100644 --- a/resources/js/components/DeviceCategorySelect.vue +++ b/resources/js/components/DeviceCategorySelect.vue @@ -29,7 +29,7 @@ diff --git a/resources/js/components/EventDevice.vue b/resources/js/components/EventDevice.vue index c95cf6f263..4d82a02ef5 100644 --- a/resources/js/components/EventDevice.vue +++ b/resources/js/components/EventDevice.vue @@ -25,7 +25,7 @@ :suppress-brand-warning="suppressBrandWarning"/> - + @@ -90,7 +90,7 @@ import { END_OF_LIFE, SPARE_PARTS_MANUFACTURER, SPARE_PARTS_THIRD_PARTY, - CATEGORY_MISC, NEXT_STEPS_DIY, NEXT_STEPS_PROFESSIONAL, NEXT_STEPS_MORE_TIME, + CATEGORY_MISC_POWERED, CATEGORY_MISC_UNPOWERED, NEXT_STEPS_DIY, NEXT_STEPS_PROFESSIONAL, NEXT_STEPS_MORE_TIME, PARTS_PROVIDER_MANUFACTURER, PARTS_PROVIDER_THIRD_PARTY, SPARE_PARTS_NOT_NEEDED } from '../constants' @@ -260,8 +260,6 @@ export default { } } - console.log("Returning", ret, this.currentDevice.item_type) - return ret }, suggestedCategoryId() { @@ -281,33 +279,10 @@ export default { return null } }, - aggregate () { - if (!this.currentCategory) { - return false - } - - if (this.powered && this.currentCategory === CATEGORY_MISC) { - return true - } - - let ret = false - - this.clusters.forEach((cluster) => { - let categories = [] - - cluster.categories.forEach((c) => { - if (this.currentCategory === c.idcategories) { - ret = c.aggregate - } - }) - }) - - return ret - }, showWeight () { // Powered devices don't allow editing of the weight except for the "None of the above" category, whereas // unpowered do. - return !this.powered || (this.currentDevice && this.currentDevice.category === CATEGORY_MISC) + return !this.powered || (this.currentDevice && this.currentDevice.category === CATEGORY_MISC_POWERED) }, wiki: { // Need to convert server's number to/from a boolean. @@ -326,6 +301,12 @@ export default { // We don't want to show the warning if we have not changed the brand since it was last saved. return this.currentDevice && this.device && this.device.brand === this.currentDevice.brand }, + weightRequired() { + // Weight is required (if shown) for misc (powered or unpowered). + return this.currentDevice && + (this.powered && this.currentDevice.category === CATEGORY_MISC_POWERED || + !this.powered && this.currentDevice.category === CATEGORY_MISC_UNPOWERED) + } }, created () { // We take a copy of what's passed in so that we can then edit it in here before saving or cancelling. We need @@ -405,6 +386,7 @@ export default { this.$emit('close') } + } catch (e) { console.error('Edit failed', e) this.axiosError = e diff --git a/resources/js/components/GroupsTable.vue b/resources/js/components/GroupsTable.vue index cfdf3159af..5de4605c6b 100644 --- a/resources/js/components/GroupsTable.vue +++ b/resources/js/components/GroupsTable.vue @@ -207,7 +207,9 @@ export default { } if (this.searchLocation) { - match &= g.location.toLowerCase().indexOf(this.searchLocation.toLowerCase()) !== -1 + if (g.location && g.location.location) { + match &= g.location.location.toLowerCase().indexOf(this.searchLocation.toLowerCase()) !== -1 + } } if (this.searchCountry) { diff --git a/resources/js/components/GroupsTableFilters.vue b/resources/js/components/GroupsTableFilters.vue index 203376c5cc..6a3c71dfdf 100644 --- a/resources/js/components/GroupsTableFilters.vue +++ b/resources/js/components/GroupsTableFilters.vue @@ -21,6 +21,7 @@ class="m-0 mb-1 mb-md-0" allow-empty :selectedLabel="__('partials.remove')" + open-direction="bottom" /> diff --git a/resources/js/constants.js b/resources/js/constants.js index e0f102b7e4..a017acad6a 100644 --- a/resources/js/constants.js +++ b/resources/js/constants.js @@ -33,4 +33,5 @@ export const PARTS_PROVIDER_THIRD_PARTY = 2 export const USEFUL_URL_SOURCE_MANUFACTURER = 1 export const USEFUL_URL_SOURCE_THIRD_PARTY = 2 -export const CATEGORY_MISC = 46 \ No newline at end of file +export const CATEGORY_MISC_POWERED = 46 +export const CATEGORY_MISC_UNPOWERED = 50 \ No newline at end of file diff --git a/resources/views/dashboard/blocks/groups-near-you.blade.php b/resources/views/dashboard/blocks/groups-near-you.blade.php index 1c85406446..aa232790ac 100644 --- a/resources/views/dashboard/blocks/groups-near-you.blade.php +++ b/resources/views/dashboard/blocks/groups-near-you.blade.php @@ -37,7 +37,7 @@ @if (is_null(Auth::user()->location)) @lang('dashboard.groups_near_you_set_location', ['profile_url' => '/profile/edit/'.Auth::user()->id]) @else - @lang('dashboard.groups_near_you_your_location_is', ['location' => Auth::user()->location.', '.Auth::user()->country]) + @lang('dashboard.groups_near_you_your_location_is', ['location' => Auth::user()->location.', '.\App\Helpers\Fixometer::getCountryFromCountryCode(Auth::user()->country_code)]) @endif

diff --git a/resources/views/layouts/navbar.blade.php b/resources/views/layouts/navbar.blade.php index d38def1bc2..bf25a160d3 100644 --- a/resources/views/layouts/navbar.blade.php +++ b/resources/views/layouts/navbar.blade.php @@ -17,8 +17,8 @@ @lang('general.reporting')

diff --git a/resources/views/reporting/time-volunteered.blade.php b/resources/views/reporting/time-volunteered.blade.php deleted file mode 100644 index d08201e32c..0000000000 --- a/resources/views/reporting/time-volunteered.blade.php +++ /dev/null @@ -1,297 +0,0 @@ -@extends('layouts.app') -@section('content') -
-
- - @if (\Session::has('success')) -
- {!! \Session::get('success') !!} -
- @endif - @if (\Session::has('warning')) -
- {!! \Session::get('warning') !!} -
- @endif - -
-
-
-

- @lang('reporting.time_volunteered') -

- - @if( FixometerHelper::userCanCreateEvents(Auth::user()) ) - - @lang('reporting.export_csv') - - @endif -
-
-
- -
- @if (FixometerHelper::hasRole($user, 'Administrator') || FixometerHelper::hasRole($user, 'Host')) -
- -
- - -
- -
- -
- @else -
- @endif - -
    -
  • -
    -

    @lang('reporting.hours_volunteered')

    - {{ $hours_completed }} -
    -
  • -
  • -
    -

    @lang('reporting.average_age')

    - {{ $average_age }} -
    -
  • -
  • -
    -

    @lang('reporting.number_of_groups')

    - {{ $group_count }} -
    -
  • -
  • -
    -

    @lang('reporting.total_number_of_users')

    - {{ $total_users }} -
    -
  • -
  • -
    -

    @lang('reporting.number_of_anonymous_users')

    - {{ $anonymous_users }} -
    -
  • -
- -
- -
- -

@lang('reporting.breakdown_by_country') (@lang('reporting.see_all_results'))

- -
- - - - - - - - - @foreach($country_hours_completed as $country_hours) - - @if(!is_null($country_hours->country)) - - @else - - @endif - - - @endforeach - -
@lang('reporting.country_name')@lang('reporting.total_hours')
{{ FixometerHelper::getCountryFromCountryCode($country_hours->country) }}N/A{{ substr($country_hours->event_hours, 0, -4) }}
-
- -
-
- -

@lang('reporting.breakdown_by_city') (@lang('reporting.see_all_results'))

- -
- - - - - - - - - @foreach($city_hours_completed as $city_hours) - - @if(!is_null($city_hours->location)) - - @else - - @endif - - - @endforeach - -
@lang('reporting.town_city_name')@lang('reporting.total_hours')
{{ $city_hours->location }}N/A{{ substr($city_hours->event_hours, 0, -4) }}
-
-
- -
- -
- - - - - - - - - - - - - @foreach($user_events as $ue) - - - @php - $start_time = new DateTime($ue->start); - $diff = $start_time->diff(new DateTime($ue->end)); - @endphp - - - - - - @endforeach - -
@lang('reporting.restarter_name')@lang('reporting.hours')@lang('reporting.event_date')@lang('reporting.event_name')@lang('reporting.restart_group')
{{ $ue->username }}{{ $diff->h.'.'.sprintf("%02d", $diff->i/60 * 100) }}{{ date('d/m/Y', strtotime($ue->event_date)) }}{{ !is_null($ue->venue) ? $ue->venue : $ue->location }}{{ $ue->groupname }}
- - - - -
- -
-
- - - -
-
-
-
- -@include('includes.modals.time-reporting-1', ['all_country_hours_completed' => $all_country_hours_completed]) -@include('includes.modals.time-reporting-2', ['all_city_hours_completed' => $all_city_hours_completed]) - -@endsection diff --git a/resources/views/user/all.blade.php b/resources/views/user/all.blade.php index 52859b72c5..0a1592cdfc 100644 --- a/resources/views/user/all.blade.php +++ b/resources/views/user/all.blade.php @@ -194,7 +194,7 @@ N/A @endif - {{ $u->country }} + {{ \App\Helpers\Fixometer::getCountryFromCountryCode($u->country_code) }} @if (isset($u->groups) && $u->groups->count() > 0) {{ $u->groups->count() }} diff --git a/resources/views/user/profile/profile.blade.php b/resources/views/user/profile/profile.blade.php index e35519cbc8..ba106d3590 100644 --- a/resources/views/user/profile/profile.blade.php +++ b/resources/views/user/profile/profile.blade.php @@ -28,7 +28,7 @@