Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.x feature->2.x-develop | updated-registration-localization-response #251

Merged
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
90 changes: 90 additions & 0 deletions Database/Seeders/json/language_strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -904,12 +904,42 @@
"name": "Registrations Title",
"content": "Registrations"
},
{
"locale_code_iso_639": "en",
"category": "registration",
"name": "Email Already Exist",
"content": "This email is already exist."
},
{
"locale_code_iso_639": "en",
"category": "registration",
"name": "Username Already Exist",
"content": "This username is already exist."
},
{
"locale_code_iso_639": "en",
"category": "registration",
"name": "Alternate email should be different",
"content": "This alternate email should be different."
},
{
"locale_code_iso_639": "en",
"category": "registration",
"name": "Filter Email Verification Pending",
"content": "Email Verification Pending"
},
{
"locale_code_iso_639": "en",
"category": "registration",
"name": "Filter Users Email Verified",
"content": "All Users Email Verified"
},
{
"locale_code_iso_639": "en",
"category": "registration",
"name": "Filter Users Email Verification Pending",
"content": "All Users Email Verification Pending"
},
{
"locale_code_iso_639": "en",
"category": "registration",
Expand Down Expand Up @@ -4045,12 +4075,42 @@
"name": "Registrations Title",
"content": "Inscripciones"
},
{
"locale_code_iso_639": "es",
"category": "registration",
"name": "Email Already Exist",
"content": "Este correo electrónico ya existe"
},
{
"locale_code_iso_639": "es",
"category": "registration",
"name": "Username Already Exist",
"content": "Este nombre de usuario ya existe."
},
{
"locale_code_iso_639": "es",
"category": "registration",
"name": "Alternate email should be different",
"content": "Cet autre e-mail devrait être différent"
},
{
"locale_code_iso_639": "es",
"category": "registration",
"name": "Filter Email Verification Pending",
"content": "Verificación de correo electrónico pendiente"
},
{
"locale_code_iso_639": "es",
"category": "registration",
"name": "Filter Users Email Verified",
"content": "Todas las usuarias correo electrónico verificado"
},
{
"locale_code_iso_639": "es",
"category": "registration",
"name": "Filter Users Email Verification Pending",
"content": "Verificación de correo electrónico de todas las usuarios pendiente"
},
{
"locale_code_iso_639": "es",
"category": "registration",
Expand Down Expand Up @@ -7187,12 +7247,42 @@
"name": "Registrations Title",
"content": "Inscriptions"
},
{
"locale_code_iso_639": "fr",
"category": "registration",
"name": "Email Already Exist",
"content": "Cet email existe déjà"
},
{
"locale_code_iso_639": "fr",
"category": "registration",
"name": "Username Already Exist",
"content": "Ce nom d\\'utilisateur existe déjà."
},
{
"locale_code_iso_639": "fr",
"category": "registration",
"name": "Filter Email Verification Pending",
"content": "Vérification de l\\'e-mail en attente"
},
{
"locale_code_iso_639": "fr",
"category": "registration",
"name": "Alternate email should be different",
"content": "Cet autre e-mail devrait être différent"
},
{
"locale_code_iso_639": "fr",
"category": "registration",
"name": "Filter Users Email Verified",
"content": "Adresse e-mail de tous les utilisateurs vérifiée"
},
{
"locale_code_iso_639": "fr",
"category": "registration",
"name": "Filter Users Email Verification Pending",
"content": "Vérification de l\\'e-mail de tous les utilisateurs en attente"
},
{
"locale_code_iso_639": "fr",
"category": "registration",
Expand Down
25 changes: 24 additions & 1 deletion Http/Controllers/Backend/RegistrationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ public function getAssets(Request $request): JsonResponse
}
}

//---------------------------------------------------

$data['language_strings'] = [
"page_title" => trans("vaahcms-registration.registrations_title"),
"filter_email_verification_pending" => trans("vaahcms-registration.filter_email_verification_pending"),
"filter_users_email_verification_pending" => trans("vaahcms-registration.filter_users_email_verification_pending"),
"filter_users_email_verified" =>trans("vaahcms-registration.filter_users_email_verified"),
"filter_email_verified" => trans("vaahcms-registration.filter_email_verified"),
"filter_user_created" => trans("vaahcms-registration.filter_user_created"),
"table_gender_male" => trans("vaahcms-registration.table_gender_male"),
"table_gender_female" => trans("vaahcms-registration.table_gender_female"),
"table_gender_others" => trans("vaahcms-registration.table_gender_others"),
];
$data['language_strings']['registration'] = $this->getGeneralStrings();

//---------------------------------------------------

$data['actions'] = [];

$data['country_calling_code'] = vh_get_country_list();
Expand Down Expand Up @@ -90,6 +107,12 @@ public function getAssets(Request $request): JsonResponse
return response()->json($response);
}
//----------------------------------------------------------
public function getGeneralStrings() :array {
return [

];
}
//----------------------------------------------------------
public function getList(Request $request): JsonResponse
{
$permission_slug = 'has-access-of-registrations-section';
Expand Down Expand Up @@ -360,7 +383,7 @@ public function createUser(Request $request,$id): JsonResponse
$response['errors'][] = $e->getMessage();
$response['hint'][] = $e->getTrace();
} else {
$response['errors'][] = 'Something went wrong.';
$response['errors'][] = trans("vaahcms-general.something_went_wrong");
}
}

Expand Down
12 changes: 6 additions & 6 deletions Models/Registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ public static function createItem($request)

if ($item) {
$response['success'] = false;
$response['errors'][] = "This email is already exist.";
$response['errors'][] = trans("vaahcms-registration.email_already_exist");
return $response;
}
// check if username exist
$item = self::where('username', $inputs['username'])->first();

if ($item) {
$response['success'] = false;
$response['errors'][] = "This username is already exist.";
$response['errors'][] = trans("vaahcms-registration.username_already_exist");
return $response;
}

Expand All @@ -148,7 +148,7 @@ public static function createItem($request)
&& $inputs['email']==$inputs['alternate_email'] )
{
$response['success'] = false;
$response['errors'][] = "The alternate email id should be different";
$response['errors'][] = trans("vaahcms-registration.alternate_email_should_be_different");
return $response;
}
if(!isset($inputs['username']))
Expand Down Expand Up @@ -507,7 +507,7 @@ public static function updateItem($request, $id)
&& $inputs['email']==$inputs['alternate_email'] )
{
$response['success'] = false;
$response['errors'][] = "This alternate email should be different";
$response['errors'][] = trans("vaahcms-registration.alternate_email_should_be_different");
return $response;
}

Expand All @@ -532,14 +532,14 @@ public static function deleteItem($request, $id): array
$item = self::where('id', $id)->withTrashed()->first();
if (!$item) {
$response['success'] = false;
$response['messages'][] = 'Record does not exist.';
$response['messages'][] = trans("vaahcms-general.record_does_not_exist");
return $response;
}
$item->forceDelete();

$response['success'] = true;
$response['data'] = [];
$response['messages'][] = 'Record has been deleted';
$response['messages'][] = trans("vaahcms-general.record_has_been_deleted");

return $response;
}
Expand Down
28 changes: 18 additions & 10 deletions Vue/vaahtwo/pages/registrations/Form.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<script setup>
import {onMounted, ref, watch} from "vue";
import { useRegistrationStore } from '../../stores/store-registrations'
import { useRootStore } from "../../stores/root";

import VhField from './../../vaahvue/vue-three/primeflex/VhField.vue'
import {useRoute} from 'vue-router';
import { vaah } from "../../vaahvue/pinia/vaah"


const root = useRootStore();
const store = useRegistrationStore();
const route = useRoute();
const useVaah = vaah();
Expand Down Expand Up @@ -39,13 +40,15 @@ const toggleFormMenu = (event) => {
icon="pi pi-trash"
v-if="store.item && store.item.deleted_at"
>
<div class="flex align-items-center justify-content-between">
<div class="flex align-items-center justify-content-between" v-if="root.assets
&& root.assets.language_strings
&& root.assets.language_strings.crud_actions">
<div>
Deleted {{store.item.deleted_at}}
{{root.assets.language_strings.crud_actions.form_text_deleted}} {{store.item.deleted_at}}
</div>

<div>
<Button label="Restore"
<Button :label="root.assets.language_strings.crud_actions.restore_button"
class="p-button-sm"
@click="store.itemAction('restore')"
data-testid="register-form_item_action_restore"
Expand All @@ -61,23 +64,28 @@ const toggleFormMenu = (event) => {
<span v-if="store.item && store.item.id">
{{ store.item.name }}
</span>
<span v-else>
Create
<span v-else-if="root.assets
&& root.assets.language_strings
&& root.assets.language_strings.crud_actions"
>
{{root.assets.language_strings.crud_actions.form_text_create}}
</span>
</div>
</div>
</template>

<template #icons>
<div class="p-inputgroup">
<div class="p-inputgroup" v-if="root.assets
&& root.assets.language_strings
&& root.assets.language_strings.crud_actions">
<Button v-if="store.item && store.item.id"
class="p-button-sm"
:label=" '#' + store.item.id "
@click="useVaah.copy(store.item.id)"
data-testid="registration-form_id"
/>

<Button label="Save"
<Button :label="root.assets.language_strings.crud_actions.save_button"
v-if="store.item && store.item.id && store.hasPermission('can-update-registrations')"
@click="store.itemAction('save')"
icon="pi pi-save"
Expand All @@ -86,7 +94,7 @@ const toggleFormMenu = (event) => {
/>

<Button v-else-if="store.hasPermission('can-create-registrations')"
label="Create & New"
:label="root.assets.language_strings.crud_actions.form_create_and_new"
@click="store.itemAction('create-and-new')"
icon="pi pi-save"
data-testid="register-form_item_action_create_and_new"
Expand All @@ -111,7 +119,7 @@ const toggleFormMenu = (event) => {
<Button v-if="(store.item && store.item.id) || store.hasPermission('can-read-registrations')"
class="p-button-sm"
icon="pi pi-eye"
v-tooltip.top="'View'"
v-tooltip.top="root.assets.language_strings.crud_actions.toolkit_text_view"
@click="store.toView(store.item)"
/>

Expand Down
16 changes: 11 additions & 5 deletions Vue/vaahtwo/pages/registrations/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import {onMounted, ref, watch} from "vue";
import {useRoute} from 'vue-router';
import { useRegistrationStore } from '../../stores/store-registrations'
import { useRootStore } from "../../stores/root";
import { vaah } from '../../vaahvue/pinia/vaah'
import VhViewRow from '../../vaahvue/vue-three/primeflex/VhViewRow.vue';

const root = useRootStore();
const store = useRegistrationStore();
const route = useRoute();
const useVaah = vaah();
Expand Down Expand Up @@ -86,12 +88,14 @@ const toggleUserStatusMenu = (event) => {
data-testid="registration-item_id"
/>

<Button label="Edit"
<Button :label="root.assets.language_strings.crud_actions.view_edit"
class="p-button-sm"
@click="store.toEdit(store.item)"
icon="pi pi-pencil"
data-testid="register-view_to_edit"
v-if="store.hasPermission('can-update-registrations')"
v-if="store.hasPermission('can-update-registrations') && root.assets
&& root.assets.language_strings
&& root.assets.language_strings.crud_actions"
/>

<!--item_menu-->
Expand Down Expand Up @@ -124,13 +128,15 @@ const toggleUserStatusMenu = (event) => {
icon="pi pi-trash"
v-if="store.item.deleted_at"
>
<div class="flex align-items-center justify-content-between">
<div class="flex align-items-center justify-content-between" v-if="root.assets
&& root.assets.language_strings
&& root.assets.language_strings.crud_actions">
<div class="">
Deleted {{store.item.deleted_at}}
{{root.assets.language_strings.crud_actions.view_deleted}} {{store.item.deleted_at}}
</div>

<div class="">
<Button label="Restore"
<Button :label="root.assets.language_strings.crud_actions.view_restore"
class="p-button-sm"
@click="store.itemAction('restore')"
data-testid="register-view_item_action_to_restore"
Expand Down
Loading