From ba26cf6e7bba81060c6d6d0f0afdb26b17f4717e Mon Sep 17 00:00:00 2001 From: gerchek Date: Wed, 11 May 2022 11:54:31 +0500 Subject: [PATCH] excell parse worked --- config/app.php | 2 +- modules/backend/models/ExportModel.php | 4 +- .../controllers/OnlineCardController.php | 27 +++++- .../controllers/OnlineCreditController.php | 36 +++++++- .../onlinecardcontroller/config_filter.yaml | 8 ++ .../config_import_export.yaml | 2 +- .../onlinecreditcontroller/_list_toolbar.htm | 10 +++ .../onlinecreditcontroller/config_filter.yaml | 25 ++++++ .../config_import_export.yaml | 4 + .../onlinecreditcontroller/config_list.yaml | 1 + .../onlinecreditcontroller/export.htm | 18 ++++ plugins/atash/contact/models/CreditClass.php | 29 +++++++ plugins/atash/contact/models/ItemExport.php | 6 +- .../atash/contact/models/ItemExportCredit.php | 30 +++++++ plugins/atash/contact/models/OnlineCard.php | 63 +++++++------- .../contact/models/creditclass/columns.yaml | 16 +++- .../contact/models/creditclass/fields.yaml | 10 +-- .../contact/models/itemexport/columns.yaml | 86 ++++++------------- .../models/itemexportcredit/columns.yaml | 36 ++++++++ .../contact/models/onlinecard/columns.yaml | 14 ++- .../contact/models/onlinecard/fields.yaml | 11 ++- ...r_table_update_atash_contact_credit_12.php | 29 +++++++ ...r_table_update_atash_contact_credit_13.php | 23 +++++ ...pdate_atash_contact_filter_card_data_2.php | 23 +++++ ...ble_update_atash_contact_online_card_6.php | 23 +++++ ...ble_update_atash_contact_online_card_7.php | 27 ++++++ ...ble_update_atash_contact_online_card_8.php | 23 +++++ plugins/atash/contact/updates/version.yaml | 18 ++++ plugins/vdomah/jwtauth/routes.php | 4 +- 29 files changed, 488 insertions(+), 120 deletions(-) create mode 100644 plugins/atash/contact/controllers/onlinecreditcontroller/config_filter.yaml create mode 100644 plugins/atash/contact/controllers/onlinecreditcontroller/config_import_export.yaml create mode 100644 plugins/atash/contact/controllers/onlinecreditcontroller/export.htm create mode 100644 plugins/atash/contact/models/ItemExportCredit.php create mode 100644 plugins/atash/contact/models/itemexportcredit/columns.yaml create mode 100644 plugins/atash/contact/updates/builder_table_update_atash_contact_credit_12.php create mode 100644 plugins/atash/contact/updates/builder_table_update_atash_contact_credit_13.php create mode 100644 plugins/atash/contact/updates/builder_table_update_atash_contact_filter_card_data_2.php create mode 100644 plugins/atash/contact/updates/builder_table_update_atash_contact_online_card_6.php create mode 100644 plugins/atash/contact/updates/builder_table_update_atash_contact_online_card_7.php create mode 100644 plugins/atash/contact/updates/builder_table_update_atash_contact_online_card_8.php diff --git a/config/app.php b/config/app.php index 3ba7623..54fef92 100644 --- a/config/app.php +++ b/config/app.php @@ -92,7 +92,7 @@ return [ | */ - 'timezone' => 'UTC', + 'timezone' => 'UTC +5', /* |-------------------------------------------------------------------------- diff --git a/modules/backend/models/ExportModel.php b/modules/backend/models/ExportModel.php index 8861c4c..f6cf12d 100644 --- a/modules/backend/models/ExportModel.php +++ b/modules/backend/models/ExportModel.php @@ -28,8 +28,8 @@ abstract class ExportModel extends Model * [...] * */ - //abstract public function exportData($columns, $sessionKey = null); - abstract public function exportData($records, $sessionKey = null); + abstract public function exportData($columns, $sessionKey = null); +// abstract public function exportData($records, $sessionKey = null); /** * Export data based on column names and labels. * The $columns array should be in the format of: diff --git a/plugins/atash/contact/controllers/OnlineCardController.php b/plugins/atash/contact/controllers/OnlineCardController.php index ea118d1..ae3e3e2 100644 --- a/plugins/atash/contact/controllers/OnlineCardController.php +++ b/plugins/atash/contact/controllers/OnlineCardController.php @@ -11,6 +11,7 @@ use Redirect; use Atash\Contact\Models\Settings; use Atash\Contact\Models\ItemExport; use Atash\Contact\Models\FilterCardData; +//use Atash\Contact\Models\OnlineCard; class OnlineCardController extends Controller { @@ -59,12 +60,30 @@ class OnlineCardController extends Controller 'data' => implode(",", $array) ]); } - - - - } + + public function AfterUpdate($id,$status) + { + dump($id); + // $model = OnlineCard::where('id',$id) + // dd($model); + //->update([ + // 'accepted_date' => date('Y-m-d H:i:s'), + // 'status' => $status + //]); + $model = OnlineCard::find($id); + $model->status = $status; + $model->save(); + //dd($model); + } + + + + //$result = new OnlineCard(); + + + diff --git a/plugins/atash/contact/controllers/OnlineCreditController.php b/plugins/atash/contact/controllers/OnlineCreditController.php index 4b88a78..d4a4a77 100644 --- a/plugins/atash/contact/controllers/OnlineCreditController.php +++ b/plugins/atash/contact/controllers/OnlineCreditController.php @@ -2,12 +2,14 @@ use Backend\Classes\Controller; use BackendMenu; +use Atash\Contact\Models\FilterCardData; class OnlineCreditController extends Controller { - public $implement = [ 'Backend\Behaviors\ListController', 'Backend\Behaviors\FormController', 'Backend\Behaviors\ReorderController' ]; + public $implement = [ 'Backend\Behaviors\ListController', 'Backend\Behaviors\FormController', 'Backend\Behaviors\ReorderController', 'Backend.Behaviors.ImportExportController', ]; public $listConfig = 'config_list.yaml'; + public $importExportConfig = 'config_import_export.yaml'; public $formConfig = 'config_form.yaml'; public $reorderConfig = 'config_reorder.yaml'; @@ -16,4 +18,36 @@ class OnlineCreditController extends Controller parent::__construct(); BackendMenu::setContext('Atash.Contact', 'main-menu-item', 'side-menu-item'); } + + public function onGetFilteredRecords() + { + $this->makeLists(); + $listWidget = $this->asExtension('ListController')->listGetWidget(); + + $query = $listWidget->prepareQuery(); + $records = $query->get(); + $array = []; + $array_length = 0; + foreach ($records as $key => $value) { + //dump($value->id); + $array[$array_length]=$value->id; + $array_length++; + } + //dump($array); + $data = FilterCardData::where('name','credit_data')->first(); + if (!$data) { + FilterCardData::create([ + 'name' => 'credit_data', + 'data' => implode(",", $array), + ]); + } + else + { + FilterCardData::where('name','credit_data') + ->update([ + 'data' => implode(",", $array) + ]); + } + + } } diff --git a/plugins/atash/contact/controllers/onlinecardcontroller/config_filter.yaml b/plugins/atash/contact/controllers/onlinecardcontroller/config_filter.yaml index 33ab69b..8db999c 100644 --- a/plugins/atash/contact/controllers/onlinecardcontroller/config_filter.yaml +++ b/plugins/atash/contact/controllers/onlinecardcontroller/config_filter.yaml @@ -15,6 +15,14 @@ scopes: label: "Branch" type: text conditions: branch like concat('%', :value, '%') + surname: + label: "Surname" + type: text + conditions: surname like concat('%', :value, '%') + passport_series: + label: "Passport series" + type: text + conditions: passport_series like concat('%', :value, '%') #selected_card: # label: Holiday Type # type: group diff --git a/plugins/atash/contact/controllers/onlinecardcontroller/config_import_export.yaml b/plugins/atash/contact/controllers/onlinecardcontroller/config_import_export.yaml index cd3344a..d41e660 100644 --- a/plugins/atash/contact/controllers/onlinecardcontroller/config_import_export.yaml +++ b/plugins/atash/contact/controllers/onlinecardcontroller/config_import_export.yaml @@ -6,7 +6,7 @@ import: export: title: Export places modelClass: Atash\Contact\Models\ItemExport - list: $/atash/contact/models/onlinecard/columns.yaml + list: $/atash/contact/models/itemexport/columns.yaml #export: #useList: orders #fileName: data.xlsx \ No newline at end of file diff --git a/plugins/atash/contact/controllers/onlinecreditcontroller/_list_toolbar.htm b/plugins/atash/contact/controllers/onlinecreditcontroller/_list_toolbar.htm index 7275d37..35a4763 100644 --- a/plugins/atash/contact/controllers/onlinecreditcontroller/_list_toolbar.htm +++ b/plugins/atash/contact/controllers/onlinecreditcontroller/_list_toolbar.htm @@ -1,6 +1,16 @@
+ + + 2) Export + +
+ + \ No newline at end of file diff --git a/plugins/atash/contact/models/CreditClass.php b/plugins/atash/contact/models/CreditClass.php index 7c0dfb2..488f04f 100644 --- a/plugins/atash/contact/models/CreditClass.php +++ b/plugins/atash/contact/models/CreditClass.php @@ -40,4 +40,33 @@ public $attachMany = [ // return $value; //return $this->getStatusOptions()[$value]; //} +public function beforeSave() { + + if($this->status=="kabul_edildi") + { + + $this->accepted_date = date('Y-m-d h:i:s'); + + } + if($this->status=="seredilyar") + { + + $this->considered_date = date('Y-m-d h:i:s'); + + } + if($this->status=="kart_chykaryldy") + { + + $this->card_issued_date = date('Y-m-d h:i:s'); + + } + if($this->status=="kart_chykarylmady") + { + + $this->card_not_issued_date = date('Y-m-d h:i:s'); + + } + + } + } diff --git a/plugins/atash/contact/models/ItemExport.php b/plugins/atash/contact/models/ItemExport.php index 4620d29..9488383 100644 --- a/plugins/atash/contact/models/ItemExport.php +++ b/plugins/atash/contact/models/ItemExport.php @@ -13,13 +13,17 @@ class ItemExport extends ExportModel // $this->records = $records; //} - public function exportData($records, $sessionKey = null) + public function exportData($columns, $sessionKey = null) { $data = FilterCardData::where('name','data')->first(); $res = $data->data; $pieces = explode(",", $res); $data = OnlineCard::whereIn('id', $pieces)->get(); + $data->each(function($data) use ($columns) { + // Берем все столбцы которые видны в columns.yaml + $data->addVisible($columns); + }); return $data->toArray(); } diff --git a/plugins/atash/contact/models/ItemExportCredit.php b/plugins/atash/contact/models/ItemExportCredit.php new file mode 100644 index 0000000..78d7745 --- /dev/null +++ b/plugins/atash/contact/models/ItemExportCredit.php @@ -0,0 +1,30 @@ +records = $records; + //} + + public function exportData($columns, $sessionKey = null) + { + + $data = FilterCardData::where('name','credit_data')->first(); + $res = $data->data; + $pieces = explode(",", $res); + $data = CreditClass::whereIn('id', $pieces)->get(); + $data->each(function($data) use ($columns) { + // Берем все столбцы которые видны в columns.yaml + $data->addVisible($columns); + }); + return $data->toArray(); + } + +} \ No newline at end of file diff --git a/plugins/atash/contact/models/OnlineCard.php b/plugins/atash/contact/models/OnlineCard.php index b009c84..06ff2cf 100644 --- a/plugins/atash/contact/models/OnlineCard.php +++ b/plugins/atash/contact/models/OnlineCard.php @@ -1,6 +1,7 @@ 'default', - 2 => 'new' - ]; -} - #public function getHolidayTypesAttribute(){ - #return [ - # "Aýlyk karty" => 'Aýlyk karty' - # ]; -#} - + public function beforeSave() { + + if($this->status=="kabul_edildi") + { + + $this->accepted_date = date('Y-m-d h:i:s'); + + } + if($this->status=="seredilyar") + { + + $this->considered_date = date('Y-m-d h:i:s'); + + } + if($this->status=="kart_chykaryldy") + { + + $this->card_issued_date = date('Y-m-d h:i:s'); + + } + if($this->status=="kart_chykarylmady") + { + + $this->card_not_issued_date = date('Y-m-d h:i:s'); + + } + + } - - // public function scopeFieldFilter($query, $val) -//{ - // $id = FieldModel::where('selected_card','LIKE','%'.$val.'%')->lists('id'); - // return $query->whereIn('id', $id); -//} - - // public function scopePayed($query) -// { - // $query = OnlineCard::select("*") - // ->where("payed", true) - // ->get(); - // return $query->where("payed", true); - //} } diff --git a/plugins/atash/contact/models/creditclass/columns.yaml b/plugins/atash/contact/models/creditclass/columns.yaml index 5d499a8..74efbfe 100644 --- a/plugins/atash/contact/models/creditclass/columns.yaml +++ b/plugins/atash/contact/models/creditclass/columns.yaml @@ -8,13 +8,13 @@ columns: branch: label: Şahamça type: text - surname: + last_name: label: Familiýa type: text name: label: Ady type: text - middlename: + middle_name: label: Atasynyň ady type: text passport_series: @@ -29,3 +29,15 @@ columns: status: label: Onlaýn-ýüzlenmäniň ýagdaýy type: text + accepted_date: + label: Kabul edilen wagty + type: text + considered_date: + label: Seredilen wagty + type: text + card_issued_date: + label: Kart çykarylan wagty + type: text + card_not_issued_date: + label: Kart çykarylmadyk wagty + type: text diff --git a/plugins/atash/contact/models/creditclass/fields.yaml b/plugins/atash/contact/models/creditclass/fields.yaml index cc53aff..3033a13 100644 --- a/plugins/atash/contact/models/creditclass/fields.yaml +++ b/plugins/atash/contact/models/creditclass/fields.yaml @@ -88,10 +88,10 @@ fields: status: label: Status options: - 1: Ugradyldy - 2: 'Kabul edildi' - 3: Seredilýär - 4: Tassyklanan - 5: 'Kabul edilmedi' + ugradyldy: Ugradyldy + kabul_edildi: 'Kabul edildi' + seredilyar: Seredilýär + kart_chykaryldy: 'Kart çykaryldy' + kart_chykarylmady: 'Kart çykarylmady' span: auto type: balloon-selector diff --git a/plugins/atash/contact/models/itemexport/columns.yaml b/plugins/atash/contact/models/itemexport/columns.yaml index 0fc2305..b69c8b0 100644 --- a/plugins/atash/contact/models/itemexport/columns.yaml +++ b/plugins/atash/contact/models/itemexport/columns.yaml @@ -2,72 +2,34 @@ columns: id: label: id type: number - selected_card: - label: selected_card - type: text - name: - label: name - type: text - surname: - label: surname - type: text - middlename: - label: middlename - type: text - birthdate: - label: birthdate - type: text - phone_number: - label: phone_number - type: text - home_phone_number: - label: home_phone_number - type: text - email: - label: email - type: text - passport_series: - label: passport_series - type: text - date_of_passport: - label: date_of_passport - type: text - passport_by: - label: passport_by - type: text - order_id: - label: order_id - type: text - payed: - label: payed - type: text - created_at: - label: created_at - type: datetime - updated_at: - label: updated_at - type: datetime - sms_notification: - label: sms_notification - type: text - place_of_residence: - label: place_of_residence - type: text region: - label: region + label: Welaýat type: text branch: - label: branch + label: Şahamça type: text - date_arrival_bank: - label: date_arrival_bank + surname: + label: Familiýa type: text - selected_time: - label: selected_time + name: + label: Ady type: text - the_codeword: - label: the_codeword + middlename: + label: Atasynyň ady type: text - user_id: - label: user_id - type: number + passport_series: + label: Pasportyň seriýasy + type: text + selected_card: + label: Kartyň görnüşi + type: text + created_at: + label: Onlaýn-ýüzlenmäniň berlen senesi + type: datetime + status: + label: Onlaýn-ýüzlenmäniň ýagdaýy + type: text + accepted_date: + label: Kabul edilen wagty + type: text + diff --git a/plugins/atash/contact/models/itemexportcredit/columns.yaml b/plugins/atash/contact/models/itemexportcredit/columns.yaml new file mode 100644 index 0000000..e3a2530 --- /dev/null +++ b/plugins/atash/contact/models/itemexportcredit/columns.yaml @@ -0,0 +1,36 @@ +columns: + id: + label: id + type: number + region: + label: Welaýat + type: text + branch: + label: Şahamça + type: text + last_name: + label: Familiýa + type: text + name: + label: Ady + type: text + middlename: + label: Atasynyň ady + type: text + passport_series: + label: Pasportyň seriýasy + type: text + type: + label: Karzyň görnüşi + type: text + created_at: + label: Onlaýn-ýüzlenmäniň berlen senesi + type: datetime + status: + label: Onlaýn-ýüzlenmäniň ýagdaýy + type: text + accepted_date: + label: Kabul edilen wagty + type: text + + diff --git a/plugins/atash/contact/models/onlinecard/columns.yaml b/plugins/atash/contact/models/onlinecard/columns.yaml index a7db31d..6e85772 100644 --- a/plugins/atash/contact/models/onlinecard/columns.yaml +++ b/plugins/atash/contact/models/onlinecard/columns.yaml @@ -28,4 +28,16 @@ columns: type: datetime status: label: Onlaýn-ýüzlenmäniň ýagdaýy - type: text \ No newline at end of file + type: text + accepted_date: + label: Kabul edilen wagty + type: text + considered_date: + label: Seredilen wagty + type: text + card_issued_date: + label: Kart çykarylan wagty + type: text + card_not_issued_date: + label: Kart çykarylmadyk wagty + type: text diff --git a/plugins/atash/contact/models/onlinecard/fields.yaml b/plugins/atash/contact/models/onlinecard/fields.yaml index 7de1d1d..367f90f 100644 --- a/plugins/atash/contact/models/onlinecard/fields.yaml +++ b/plugins/atash/contact/models/onlinecard/fields.yaml @@ -3,7 +3,6 @@ fields: label: 'Saýlanan kart' span: auto type: text - # scope: fieldFilter name: label: 'First name' span: auto @@ -90,11 +89,11 @@ fields: status: label: Статус options: - 1: Ugradyldy - 2: 'Kabul edildi' - 3: Seredilýär - 4: 'Kart çykaryldy' - 5: 'Kart çykarylmady' + ugradyldy: Ugradyldy + kabul_edildi: 'Kabul edildi' + seredilyar: Seredilýär + kart_chykaryldy: 'Kart çykaryldy' + kart_chykarylmady: 'Kart çykarylmady' span: left type: balloon-selector action: diff --git a/plugins/atash/contact/updates/builder_table_update_atash_contact_credit_12.php b/plugins/atash/contact/updates/builder_table_update_atash_contact_credit_12.php new file mode 100644 index 0000000..2d01653 --- /dev/null +++ b/plugins/atash/contact/updates/builder_table_update_atash_contact_credit_12.php @@ -0,0 +1,29 @@ +dateTime('accepted_date')->nullable(); + $table->dateTime('considered_date')->nullable(); + $table->dateTime('card_issued_date')->nullable(); + $table->dateTime('card_not_issued_date')->nullable(); + }); + } + + public function down() + { + Schema::table('atash_contact_credit', function($table) + { + $table->dropColumn('accepted_date'); + $table->dropColumn('considered_date'); + $table->dropColumn('card_issued_date'); + $table->dropColumn('card_not_issued_date'); + }); + } +} diff --git a/plugins/atash/contact/updates/builder_table_update_atash_contact_credit_13.php b/plugins/atash/contact/updates/builder_table_update_atash_contact_credit_13.php new file mode 100644 index 0000000..cdb1baf --- /dev/null +++ b/plugins/atash/contact/updates/builder_table_update_atash_contact_credit_13.php @@ -0,0 +1,23 @@ +string('status', 191)->default('ugradyldy')->change(); + }); + } + + public function down() + { + Schema::table('atash_contact_credit', function($table) + { + $table->string('status', 191)->default('1')->change(); + }); + } +} diff --git a/plugins/atash/contact/updates/builder_table_update_atash_contact_filter_card_data_2.php b/plugins/atash/contact/updates/builder_table_update_atash_contact_filter_card_data_2.php new file mode 100644 index 0000000..1cba75b --- /dev/null +++ b/plugins/atash/contact/updates/builder_table_update_atash_contact_filter_card_data_2.php @@ -0,0 +1,23 @@ +text('data')->nullable(false)->unsigned(false)->default(null)->change(); + }); + } + + public function down() + { + Schema::table('atash_contact_filter_card_data', function($table) + { + $table->string('data', 191)->nullable(false)->unsigned(false)->default(null)->change(); + }); + } +} diff --git a/plugins/atash/contact/updates/builder_table_update_atash_contact_online_card_6.php b/plugins/atash/contact/updates/builder_table_update_atash_contact_online_card_6.php new file mode 100644 index 0000000..f63b60b --- /dev/null +++ b/plugins/atash/contact/updates/builder_table_update_atash_contact_online_card_6.php @@ -0,0 +1,23 @@ +dateTime('accepted_date')->nullable(); + }); + } + + public function down() + { + Schema::table('atash_contact_online_card', function($table) + { + $table->dropColumn('accepted_date'); + }); + } +} diff --git a/plugins/atash/contact/updates/builder_table_update_atash_contact_online_card_7.php b/plugins/atash/contact/updates/builder_table_update_atash_contact_online_card_7.php new file mode 100644 index 0000000..cc129a6 --- /dev/null +++ b/plugins/atash/contact/updates/builder_table_update_atash_contact_online_card_7.php @@ -0,0 +1,27 @@ +dateTime('considered_date')->nullable(); + $table->dateTime('card_issued_date')->nullable(); + $table->dateTime('card_not_issued_date')->nullable(); + }); + } + + public function down() + { + Schema::table('atash_contact_online_card', function($table) + { + $table->dropColumn('considered_date'); + $table->dropColumn('card_issued_date'); + $table->dropColumn('card_not_issued_date'); + }); + } +} diff --git a/plugins/atash/contact/updates/builder_table_update_atash_contact_online_card_8.php b/plugins/atash/contact/updates/builder_table_update_atash_contact_online_card_8.php new file mode 100644 index 0000000..18acece --- /dev/null +++ b/plugins/atash/contact/updates/builder_table_update_atash_contact_online_card_8.php @@ -0,0 +1,23 @@ +string('status', 191)->default('ugradyldy')->change(); + }); + } + + public function down() + { + Schema::table('atash_contact_online_card', function($table) + { + $table->string('status', 191)->default('1')->change(); + }); + } +} diff --git a/plugins/atash/contact/updates/version.yaml b/plugins/atash/contact/updates/version.yaml index 77e0dcc..83a870a 100644 --- a/plugins/atash/contact/updates/version.yaml +++ b/plugins/atash/contact/updates/version.yaml @@ -102,3 +102,21 @@ 1.0.35: - 'Updated table atash_contact_credit' - builder_table_update_atash_contact_credit_11.php +1.0.36: + - 'Updated table atash_contact_online_card' + - builder_table_update_atash_contact_online_card_6.php +1.0.37: + - 'Updated table atash_contact_online_card' + - builder_table_update_atash_contact_online_card_7.php +1.0.38: + - 'Updated table atash_contact_online_card' + - builder_table_update_atash_contact_online_card_8.php +1.0.39: + - 'Updated table atash_contact_credit' + - builder_table_update_atash_contact_credit_12.php +1.0.40: + - 'Updated table atash_contact_credit' + - builder_table_update_atash_contact_credit_13.php +1.0.41: + - 'Updated table atash_contact_filter_card_data' + - builder_table_update_atash_contact_filter_card_data_2.php diff --git a/plugins/vdomah/jwtauth/routes.php b/plugins/vdomah/jwtauth/routes.php index f3fc75e..507ea78 100644 --- a/plugins/vdomah/jwtauth/routes.php +++ b/plugins/vdomah/jwtauth/routes.php @@ -465,7 +465,7 @@ Route::post('restore', function (Request $request) { Mail::send('vdomah.jwtauth::mail.credit', $vars, function($message) { - $message->to('digital.tps2018@gmail.com', 'Admin Person'); + $message->to('karzonline@halkbank.gov.tm', 'Admin Person'); // $message->subject('This is a reminder'); // $message->attach( // $file->getRealPath(),array( @@ -509,7 +509,7 @@ Route::post('restore', function (Request $request) { try{ Mail::send('vdomah.jwtauth::mail.card', $payment->toArray(), function($message) { - $message->to('digital.tps2018@gmail.com', 'Admin Person'); + $message->to('bank_kart@halkbank.gov.tm', 'Admin Person'); // $message->subject('This is a reminder'); //$message->attach( // $file->getRealPath(),array(