From 0bb9522a64dbb137cbc57cda0b2e5bf8e92d178e Mon Sep 17 00:00:00 2001 From: ilmedova Date: Tue, 8 Nov 2022 19:07:12 +0500 Subject: [PATCH] lang files finally finished --- .../Controllers/API/ContractController.php | 2 +- .../Admin/ContractCrudController.php | 116 +++++++++++++----- .../Admin/CountryCrudController.php | 42 +++++-- .../Admin/DocumentCrudController.php | 70 ++++------- lang/en/app.php | 33 ++++- .../base/inc/sidebar_content.blade.php | 8 -- 6 files changed, 173 insertions(+), 98 deletions(-) diff --git a/app/Http/Controllers/API/ContractController.php b/app/Http/Controllers/API/ContractController.php index acb8321a..9de247aa 100644 --- a/app/Http/Controllers/API/ContractController.php +++ b/app/Http/Controllers/API/ContractController.php @@ -32,7 +32,7 @@ public function import(Request $request){ $contract['Note'] = $item['Note']; $contract['Remark'] = $item['Remark']; - $record = Contract::where('InputNumber', $contract['InputNumber'])->first(); + $record = Contract::where('foreign_ID', $contract['foreign_ID'])->first(); if($record != null){ $record->fill($contract); $record->save(); diff --git a/app/Http/Controllers/Admin/ContractCrudController.php b/app/Http/Controllers/Admin/ContractCrudController.php index e7d707c9..9b76b689 100644 --- a/app/Http/Controllers/Admin/ContractCrudController.php +++ b/app/Http/Controllers/Admin/ContractCrudController.php @@ -29,7 +29,7 @@ public function setup() { CRUD::setModel(\App\Models\Contract::class); CRUD::setRoute(config('backpack.base.route_prefix') . '/contract'); - CRUD::setEntityNameStrings('contract', 'contracts'); + CRUD::setEntityNameStrings(trans('app.contract.title'), trans('app.contract.list_title')); } /** @@ -40,29 +40,49 @@ public function setup() */ protected function setupListOperation() { - CRUD::column('id'); - CRUD::column('foreign_ID'); - CRUD::column('InputNumber'); - CRUD::column('InputDate'); - CRUD::column('RegDate'); - CRUD::addColumn([ - 'name' => 'MarkerSpec', - 'label' => 'MarkerSpec', - 'type' => 'closure', - 'function' => function($entry) { - return Lang::get('imported.markerspec.' . $entry->MarkerSpec); - } + CRUD::addColumns([ + [ + 'name' => 'InputNumber', + 'label' => trans('app.contract.input_number'), + 'type' => 'text' + ], + [ + 'name' => 'InputDate', + 'label' => trans('app.contract.input_date'), + 'type' => 'text' + ], + [ + 'name' => 'RegDate', + 'label' => trans('app.contract.reg_date'), + 'type' => 'text' + ], + [ + 'name' => 'MarkerSpec', + 'label' => trans('app.contract.status_marker'), + 'type' => 'closure', + 'function' => function($entry) { + return Lang::get('imported.markerspec.' . $entry->MarkerSpec); + } + ], + [ + 'name' => 'Workflow_ID', + 'label' => trans('app.contract.workflow'), + 'type' => 'closure', + 'function' => function($entry) { + return Lang::get('imported.workflow.' . $entry->Workflow_ID); + } + ], + [ + 'name' => 'Note', + 'label' => trans('app.contract.note'), + 'type' => 'text' + ], + [ + 'name' => 'Remark', + 'label' => trans('app.contract.remark'), + 'type' => 'text' + ], ]); - CRUD::addColumn([ - 'name' => 'Workflow_ID', - 'label' => 'Workflow', - 'type' => 'closure', - 'function' => function($entry) { - return Lang::get('imported.workflow.' . $entry->Workflow_ID); - } - ]); - CRUD::column('Note'); - CRUD::column('Remark'); /** * Columns can be defined using the fluent syntax or array syntax: * - CRUD::column('price')->type('number'); @@ -80,13 +100,49 @@ protected function setupCreateOperation() { CRUD::setValidation(ContractRequest::class); - CRUD::field('InputNumber'); - CRUD::field('InputDate'); - CRUD::field('RegDate'); - CRUD::field('MarkerSpec'); - CRUD::field('Workflow_ID'); - CRUD::field('Note'); - CRUD::field('Remark'); + CRUD::addFields([ + [ + 'name' => 'InputNumber', + 'label' => trans('app.contract.input_number'), + 'type' => 'text' + ], + [ + 'name' => 'InputDate', + 'label' => trans('app.contract.input_date'), + 'type' => 'text' + ], + [ + 'name' => 'RegDate', + 'label' => trans('app.contract.reg_date'), + 'type' => 'text' + ], + [ + 'name' => 'MarkerSpec', + 'label' => trans('app.contract.status_marker'), + 'type' => 'closure', + 'function' => function($entry) { + return Lang::get('imported.markerspec.' . $entry->MarkerSpec); + } + ], + [ + 'name' => 'Workflow_ID', + 'label' => trans('app.contract.workflow'), + 'type' => 'closure', + 'function' => function($entry) { + return Lang::get('imported.workflow.' . $entry->Workflow_ID); + } + ], + [ + 'name' => 'Note', + 'label' => trans('app.contract.note'), + 'type' => 'text' + ], + [ + 'name' => 'Remark', + 'label' => trans('app.contract.remark'), + 'type' => 'text' + ], + ]); /** * Fields can be defined using the fluent syntax or array syntax: diff --git a/app/Http/Controllers/Admin/CountryCrudController.php b/app/Http/Controllers/Admin/CountryCrudController.php index c278dddc..778a6e12 100755 --- a/app/Http/Controllers/Admin/CountryCrudController.php +++ b/app/Http/Controllers/Admin/CountryCrudController.php @@ -21,37 +21,47 @@ class CountryCrudController extends CrudController /** * Configure the CrudPanel object. Apply settings to all operations. - * + * * @return void */ public function setup() { CRUD::setModel(\App\Models\Country::class); CRUD::setRoute(config('backpack.base.route_prefix') . '/country'); - CRUD::setEntityNameStrings('country', 'countries'); + CRUD::setEntityNameStrings(trans('app.resource.country'), trans('app.resource.countries')); } /** * Define what happens when the List operation is loaded. - * + * * @see https://backpackforlaravel.com/docs/crud-operation-list-entries * @return void */ protected function setupListOperation() { - CRUD::column('name'); - CRUD::column('code'); + CRUD::addColumns([ + [ + 'name' => 'name', + 'label' => trans('app.resource.name'), + 'type' => 'text' + ], + [ + 'name' => 'code', + 'label' => trans('app.resource.code'), + 'type' => 'text' + ] + ]); /** * Columns can be defined using the fluent syntax or array syntax: * - CRUD::column('price')->type('number'); - * - CRUD::addColumn(['name' => 'price', 'type' => 'number']); + * - CRUD::addColumn(['name' => 'price', 'type' => 'number']); */ } /** * Define what happens when the Create operation is loaded. - * + * * @see https://backpackforlaravel.com/docs/crud-operation-create * @return void */ @@ -59,19 +69,29 @@ protected function setupCreateOperation() { CRUD::setValidation(CountryRequest::class); - CRUD::field('name'); - CRUD::field('code'); + CRUD::addFields([ + [ + 'name' => 'name', + 'label' => trans('app.resource.name'), + 'type' => 'text' + ], + [ + 'name' => 'code', + 'label' => trans('app.resource.code'), + 'type' => 'text' + ] + ]); /** * Fields can be defined using the fluent syntax or array syntax: * - CRUD::field('price')->type('number'); - * - CRUD::addField(['name' => 'price', 'type' => 'number'])); + * - CRUD::addField(['name' => 'price', 'type' => 'number'])); */ } /** * Define what happens when the Update operation is loaded. - * + * * @see https://backpackforlaravel.com/docs/crud-operation-update * @return void */ diff --git a/app/Http/Controllers/Admin/DocumentCrudController.php b/app/Http/Controllers/Admin/DocumentCrudController.php index 999c893a..31d18e2a 100755 --- a/app/Http/Controllers/Admin/DocumentCrudController.php +++ b/app/Http/Controllers/Admin/DocumentCrudController.php @@ -28,15 +28,15 @@ public function setup() { CRUD::setModel(\App\Models\Document::class); CRUD::setRoute(config('backpack.base.route_prefix') . '/document'); - CRUD::setEntityNameStrings('document', 'documents'); + CRUD::setEntityNameStrings(trans('app.resource.document'), trans('app.resource.documents')); $this->crud->addFilter([ 'name' => 'business', 'type' => 'dropdown', - 'label' => 'Business' + 'label' => trans('app.resource.business') ], [ - 1 => 'yes', - 0 => 'no' + 1 => trans('app.resource.yes'), + 0 => trans('app.resource.no') ], function ($value) { // if the filter is active $this->crud->addClause('where', 'business', $value); }); @@ -44,10 +44,10 @@ public function setup() $this->crud->addFilter([ 'name' => 'company', 'type' => 'dropdown', - 'label' => 'Company' + 'label' => trans('app.resource.company') ], [ - 1 => 'yes', - 0 => 'no' + 1 => trans('app.resource.yes'), + 0 => trans('app.resource.no') ], function ($value) { // if the filter is active $this->crud->addClause('where', 'company', $value); }); @@ -55,10 +55,10 @@ public function setup() $this->crud->addFilter([ 'name' => 'all_country', 'type' => 'dropdown', - 'label' => 'All country' + 'label' => trans('app.rescource.all_countries') ], [ - 1 => 'yes', - 0 => 'no' + 1 => trans('app.resource.yes'), + 0 => trans('app.resource.no') ], function ($value) { $this->crud->addClause('where', 'all_country', $value); }); @@ -67,7 +67,7 @@ public function setup() $this->crud->addFilter([ 'name' => 'countries', 'type' => 'select2_multiple', - 'label' => 'Countries' + 'label' => trans('app.resource.countries') ], function() { return Country::all()->pluck('name', 'id')->toArray(); }, function($values) { @@ -91,49 +91,49 @@ protected function setupListOperation() [ 'name' => 'name', 'type' => 'text', - 'label' => 'Name' + 'label' => trans('app.resource.name') ], [ 'name' => 'max_size', 'type' => 'number', - 'label' => 'Max size (KBytes)', + 'label' => trans('app.resource.max_size'), 'default' => 0 ], [ 'name' => 'order', 'type' => 'number', - 'label' => 'Position', + 'label' => trans('app.resource.position'), 'default' => 0 ], [ 'name' => 'business', 'type' => 'radio', - 'label' => 'Enterpreneurs', + 'label' => trans('app.resource.enterpreneurs'), 'options' => [ - 1 => 'Yes', - 0 => 'No' + 1 => trans('app.resource.yes'), + 0 => trans('app.resource.no') ] ], [ 'name' => 'company', 'type' => 'radio', - 'label' => 'Companies', + 'label' => trans('app.resource.companies'), 'options' => [ - 1 => 'Yes', - 0 => 'No' + 1 => trans('app.resource.yes'), + 0 => trans('app.resource.no') ] ], [ 'name' => 'all_country', 'type' => 'radio', - 'label' => 'All countries', + 'label' => trans('app.resource.all_countries'), 'options' => [ - 1 => 'Yes', - 0 => 'No' + 1 => trans('app.resource.yes'), + 0 => trans('app.resource.no') ] ], [ - 'label' => "Document Countries", + 'label' => trans('app.resource.doc_countries'), 'type' => 'select_multiple', 'name' => 'countries', @@ -181,37 +181,21 @@ protected function setupCreateOperation() 'label' => 'Position', 'default' => 0 ], - [ // Checkbox + [ 'name' => 'business', 'label' => 'Enterpreneurs', 'type' => 'checkbox' ], - [ // Checkbox + [ 'name' => 'company', 'label' => 'Companies', 'type' => 'checkbox' ], - [ // Checkbox + [ 'name' => 'all_country', 'label' => 'All countries', 'type' => 'checkbox' ], - // [ // SelectMultiple = n-n relationship (with pivot table) - // 'label' => "Document Groups", - // 'type' => 'select_multiple', - // 'name' => 'groups', // the method that defines the relationship in your Model - - // // optional - // 'entity' => 'groups', // the method that defines the relationship in your Model - // 'model' => "App\Models\Documentgroup", // foreign key model - // 'attribute' => 'name', // foreign key attribute that is shown to user - // 'pivot' => true, // on create&update, do you need to add/delete pivot table entries? - - // // also optional - // 'options' => (function ($query) { - // return $query->orderBy('name', 'ASC')->get(); - // }), // force the related options to be a custom query, instead of all(); you can use this to filter the results show in the select - // ], [ 'label' => "Document Countries", 'type' => 'select2_multiple', diff --git a/lang/en/app.php b/lang/en/app.php index db69e094..55229ef6 100755 --- a/lang/en/app.php +++ b/lang/en/app.php @@ -112,7 +112,7 @@ 'citizenship' => "Citizenship", ], - 'ticket' =>[ + 'ticket' => [ 'title' => 'Ticket', 'list_title' => 'tickets', 'statuses' => 'statuses', @@ -127,12 +127,35 @@ 'last_sender' => 'Last sender', ], 'contract' => [ - 'list_title' => 'contracts' + 'title' => 'Contract', + 'list_title' => 'contracts', + 'reg_date' => 'Registration date', + 'input_number' => 'Input number', + 'input_date' => 'Input date', + 'status_marker' => 'Status marker', + 'workflow' => 'Workflow', + 'note' => 'Note', + 'remark' => 'Remark', ], 'resource' => [ - 'resources' => 'resources', - 'countries' => 'countries', - 'documents' => 'documents', + 'resources' => 'resources', + 'country' => 'country', + 'countries' => 'countries', + 'documents' => 'documents', + 'name' => 'name', + 'code' => 'code', + 'yes' => 'yes', + 'no' => 'no', + 'document' => 'document', + 'documents' => 'documents', + 'business' => 'Business', + 'company' => 'Company', + 'all_countries' => 'All countries', + 'max_size' => 'Max size (KBytes)', + 'position' => 'Position', + 'enterpreneurs' => 'Enterpreneurs', + 'companies' => 'Companies', + 'doc_countries' => 'Document Countries' ], 'user' => [ 'admins' => 'admins', diff --git a/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php b/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php index afbf9099..a2bb37d3 100755 --- a/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php +++ b/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php @@ -47,14 +47,6 @@ -