Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gheorghelupu17 committed Oct 19, 2023
1 parent 280d816 commit a6011ac
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/PasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public function update(Request $request): RedirectResponse
'password' => Hash::make($validated['password']),
]);

return back();
return back()->with('success', __('user.messages.password_updated_successfully'));
}
}
2 changes: 2 additions & 0 deletions app/Http/Controllers/Dashboard/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Http\Controllers\Controller;
use App\Http\Resources\Collections\UserCollection;
use App\Models\User;
use App\Notifications\Ngo\UserRemovedFromOrganizationNotification;
use App\Rules\UserDoesntBelongToAnOrganization;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
Expand Down Expand Up @@ -62,6 +63,7 @@ public function destroy(Request $request, User $user): RedirectResponse
$user->organization()
->dissociate()
->save();
$user->notify(new UserRemovedFromOrganizationNotification());

return redirect()->back()
->with('success', __('user.messages.deleted'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function rules(): array
'name' => ['nullable', 'string'],
'description' => ['nullable', 'string'],
'logo' => ['nullable', 'file', 'mimes:jpg,png'],
'statute' => ['nullable', 'file'],
'statute' => ['nullable', 'file', 'mimes:pdf'],
'street_address' => ['nullable', 'string'],
'cif' => ['nullable', 'string', 'unique:organizations,cif', new ValidCIF],
'contact_email' => ['nullable', 'email'],
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Resources/Project/ShowProjectResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ public function toArray(Request $request): array
'accepting_volunteers' => \boolval($this->accepting_volunteers),
'accepting_comments' => \boolval($this->accepting_comments),
'videos' => '',
'embedded_videos'=> $this->embedded_videos,
'embedded_videos' => $this->embedded_videos,
'swipe_gallery' => $this->getMedia('gallery')->map(function ($media) {
return [
'src' => $media->getFullUrl(),
'thumbnail' => $media->getFullUrl('preview'),
'w' => 1200,
'h' => 800,
];
];
})->toArray(),
'is_active' => $this->is_active,
'external_links' => collect($this->external_links)->map(function (array $link) {
Expand Down
18 changes: 17 additions & 1 deletion app/Models/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,23 @@ public function approve(): void
$this->subject->setAttribute($key, $value['new']);
});

$this->subject->save();
if ($this->subject instanceof Organization)
{
$value = data_get($this->properties, $this->changed_field . '.new');
if ($this->description === 'statute') {
$this->subject->getMedia('statute')->map(function(Media $media) use ($value){
if ($media->id != $value)
{
$media->delete();
}
});
$media = Media::find($value);
$this->subject->media->add($media);
}
}
else{
$this->subject->save();
}

$this->update([
'approved_at' => now(),
Expand Down
40 changes: 40 additions & 0 deletions app/Notifications/Ngo/UserRemovedFromOrganizationNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

declare(strict_types=1);

namespace App\Notifications\Ngo;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\URL;

class UserRemovedFromOrganizationNotification extends Notification
{
use Queueable;

/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['mail'];
}

/**
* Get the mail representation of the notification.
*/
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->subject(__('user.mail.remove_from_organization.subject', ['app' => config('app.name')]))
->greeting(__('user.mail.remove_from_organization.greeting', [
'name' => $notifiable->name,
]))
->line(__('user.mail.remove_from_organization.intro', [
'app' => config('app.name'),
]));
}
}
1 change: 1 addition & 0 deletions lang/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"retype_password": "Reintroduceți parola nouă",
"name_last_name": "Nume și prenume",
"email": "Email",
"denied_change_email": "Nu poți schimba adresa de email. Daca vrei sa o schimbi contactează-ne la: [email protected]",
"phone": "Telefon",
"phone_input_info": "*Numarul de telefon nu va fi facut public.",
"unverified_email": "Your email address is unverified.",
Expand Down
1 change: 1 addition & 0 deletions lang/ro/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
'created' => 'Utilizatorul a fost adăugat.',
'deleted' => 'Utilizatorul a fost șters.',
'set_initial_password_success' => 'Parola a fost setată cu succes!',
'password_updated_successfully'=> 'Parola a fost actualizată cu succes!',
],
'filters' => [
'type' => 'Tip',
Expand Down
5 changes: 5 additions & 0 deletions resources/js/Components/form/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
:pattern="pattern"
:min="min"
:max="max"
:disabled="disabled"
:maxlength="maxlength"
/>

Expand Down Expand Up @@ -78,6 +79,10 @@
maxlength: {
type: Number,
default: null
},
disabled: {
type: Boolean,
default: false
}
});
Expand Down
14 changes: 7 additions & 7 deletions resources/js/Pages/Auth/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
:label="$t('log_in')"
/>

<SecondaryButton
class="col-span-2 md:col-span-1 w-full flex items-center justify-center flex-1 gap-x-2 py-2.5"
@click="googleLogin"
>
<SvgLoader name="google" />
{{ $t('google_login') }}
</SecondaryButton>
<!-- <SecondaryButton-->
<!-- class="col-span-2 md:col-span-1 w-full flex items-center justify-center flex-1 gap-x-2 py-2.5"-->
<!-- @click="googleLogin"-->
<!-- >-->
<!-- <SvgLoader name="google" />-->
<!-- {{ $t('google_login') }}-->
<!-- </SecondaryButton>-->
</div>
</form>
</AuthLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
v-model="form.email"
:isRequired="true"
:error="form.errors.email"
/>
disabled
>
<p class="pt-1 text-sm text-gray-500">{{ $t("denied_change_email") }}</p>

</Input>

<!-- Phone -->
<Input
Expand Down

0 comments on commit a6011ac

Please sign in to comment.