excell parse worked

This commit is contained in:
gerchek 2022-05-11 11:54:31 +05:00
parent f92e6e2491
commit ba26cf6e7b
29 changed files with 488 additions and 120 deletions

View File

@ -92,7 +92,7 @@ return [
|
*/
'timezone' => 'UTC',
'timezone' => 'UTC +5',
/*
|--------------------------------------------------------------------------

View File

@ -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:

View File

@ -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();

View File

@ -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)
]);
}
}
}

View File

@ -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

View File

@ -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

View File

@ -1,6 +1,16 @@
<div data-control="toolbar">
<a href="<?= Backend::url('atash/contact/onlinecreditcontroller/create') ?>" class="btn btn-primary oc-icon-plus"><?= e(trans('backend::lang.form.create')) ?></a>
<a href="<?= Backend::url('atash/contact/onlinecreditcontroller/reorder') ?>" class="btn btn-default oc-icon-list"><?= e(trans('backend::lang.reorder.default_title')) ?></a>
<button
class="btn btn-default"
data-request="onGetFilteredRecords">
1) Get All Record
</button>
<a
href="<?= Backend::url('atash/contact/onlinecreditcontroller/export') ?>"
class="btn btn-default oc-icon-download">
2) Export
</a>
<button
class="btn btn-default oc-icon-trash-o"
disabled="disabled"

View File

@ -0,0 +1,25 @@
scopes:
created_at:
label: "Date filter"
type: daterange
conditions: created_at >= ':after' AND created_at <= ':before'
type:
label: "Selected credit"
type: text
conditions: type like concat('%', :value, '%')
region:
label: "Region"
type: text
conditions: region like concat('%', :value, '%')
branch:
label: "Branch"
type: text
conditions: branch like concat('%', :value, '%')
last_name:
label: "Surname"
type: text
conditions: last_name like concat('%', :value, '%')
passport_series:
label: "Passport series"
type: text
conditions: passport_series like concat('%', :value, '%')

View File

@ -0,0 +1,4 @@
export:
title: Export places
modelClass: Atash\Contact\Models\ItemExportCredit
list: $/atash/contact/models/itemexportcredit/columns.yaml

View File

@ -5,6 +5,7 @@ noRecordsMessage: 'backend::lang.list.no_records'
showSetup: true
showCheckboxes: true
recordsPerPage: 20
filter: config_filter.yaml
toolbar:
buttons: list_toolbar
search:

View File

@ -0,0 +1,18 @@
<?= Form::open(['class' => 'layout import-export']) ?>
<div class="layout-row">
<?= $this->exportRender() ?>
</div>
<div class="form-buttons">
<button
type="submit"
data-control="popup"
data-handler="onExportLoadForm"
data-keyboard="false"
class="btn btn-primary">
Export places
</button>
</div>
<?= Form::close() ?>

View File

@ -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');
}
}
}

View File

@ -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();
}

View File

@ -0,0 +1,30 @@
<?php namespace Atash\Contact\Models;
session_start();
use Backend\Models\ExportModel;
use Atash\Contact\Models\CreditClass;
use Atash\Contact\Models\FilterCardData;
class ItemExportCredit extends ExportModel
{
protected $record;
// $public function __construct($records){
// $this->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();
}
}

View File

@ -1,6 +1,7 @@
<?php namespace Atash\Contact\Models;
use Model;
use Atash\Contact\Controllers\OnlineCardController;
/**
* Model
@ -49,41 +50,39 @@ class OnlineCard extends Model
'user_id',
'file',
'date',
'status',
'accepted_date',
];
protected $guarded = ['*'];
public function scopeIsMerchant($query)
{
//WHAT GOES HERE?
dd("salam");
}
public function getHolidayTypesAttribute(){
return [
1 => '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);
//}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -28,4 +28,16 @@ columns:
type: datetime
status:
label: Onlaýn-ýüzlenmäniň ýagdaýy
type: text
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

View File

@ -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:

View File

@ -0,0 +1,29 @@
<?php namespace Atash\Contact\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateAtashContactCredit12 extends Migration
{
public function up()
{
Schema::table('atash_contact_credit', function($table)
{
$table->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');
});
}
}

View File

@ -0,0 +1,23 @@
<?php namespace Atash\Contact\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateAtashContactCredit13 extends Migration
{
public function up()
{
Schema::table('atash_contact_credit', function($table)
{
$table->string('status', 191)->default('ugradyldy')->change();
});
}
public function down()
{
Schema::table('atash_contact_credit', function($table)
{
$table->string('status', 191)->default('1')->change();
});
}
}

View File

@ -0,0 +1,23 @@
<?php namespace Atash\Contact\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateAtashContactFilterCardData2 extends Migration
{
public function up()
{
Schema::table('atash_contact_filter_card_data', function($table)
{
$table->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();
});
}
}

View File

@ -0,0 +1,23 @@
<?php namespace Atash\Contact\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateAtashContactOnlineCard6 extends Migration
{
public function up()
{
Schema::table('atash_contact_online_card', function($table)
{
$table->dateTime('accepted_date')->nullable();
});
}
public function down()
{
Schema::table('atash_contact_online_card', function($table)
{
$table->dropColumn('accepted_date');
});
}
}

View File

@ -0,0 +1,27 @@
<?php namespace Atash\Contact\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateAtashContactOnlineCard7 extends Migration
{
public function up()
{
Schema::table('atash_contact_online_card', function($table)
{
$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_online_card', function($table)
{
$table->dropColumn('considered_date');
$table->dropColumn('card_issued_date');
$table->dropColumn('card_not_issued_date');
});
}
}

View File

@ -0,0 +1,23 @@
<?php namespace Atash\Contact\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateAtashContactOnlineCard8 extends Migration
{
public function up()
{
Schema::table('atash_contact_online_card', function($table)
{
$table->string('status', 191)->default('ugradyldy')->change();
});
}
public function down()
{
Schema::table('atash_contact_online_card', function($table)
{
$table->string('status', 191)->default('1')->change();
});
}
}

View File

@ -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

View File

@ -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(