track which admin created new driver accounts, so we know who hired each driver #4092
This commit is contained in:
parent
7aa1952e30
commit
e60d212e23
4
db/migrate/000264_admin.sql
Normal file
4
db/migrate/000264_admin.sql
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
ALTER TABLE `admin` ADD `id_admin_author` int(11) unsigned DEFAULT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE `admin` ADD KEY `admin_ibfk_1` (`id_admin_author`);
|
||||||
|
ALTER TABLE `admin` ADD CONSTRAINT `admin_ibfk_1` FOREIGN KEY (`id_admin_author`) REFERENCES `admin` (`id_admin`) ON DELETE SET NULL ON UPDATE SET NULL;
|
||||||
@ -32,6 +32,7 @@ class Controller_api_driver_list extends Crunchbutton_Controller_RestAccount {
|
|||||||
|
|
||||||
$list = [];
|
$list = [];
|
||||||
foreach( $drivers as $driver ){
|
foreach( $drivers as $driver ){
|
||||||
|
|
||||||
if( $count >= $start && $count < $end ){
|
if( $count >= $start && $count < $end ){
|
||||||
$data = $driver->exports( [ 'permissions', 'groups' ] );
|
$data = $driver->exports( [ 'permissions', 'groups' ] );
|
||||||
$data[ 'vehicle' ] = $driver->vehicle();
|
$data[ 'vehicle' ] = $driver->vehicle();
|
||||||
|
|||||||
@ -110,6 +110,13 @@ class Cockpit_Admin extends Crunchbutton_Admin {
|
|||||||
$out['referral_admin_credit'] = floatval( $this->referral_admin_credit );
|
$out['referral_admin_credit'] = floatval( $this->referral_admin_credit );
|
||||||
$out['referral_customer_credit'] = floatval( $this->referral_customer_credit );
|
$out['referral_customer_credit'] = floatval( $this->referral_customer_credit );
|
||||||
|
|
||||||
|
$author = $this->author();
|
||||||
|
if( $author->id_admin ){
|
||||||
|
$out['author'] = $author->name;
|
||||||
|
} else {
|
||||||
|
$out['author'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->location()) {
|
if ($this->location()) {
|
||||||
$out['location'] = $this->location()->exports();
|
$out['location'] = $this->location()->exports();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -914,10 +914,21 @@ class Crunchbutton_Admin extends Cana_Table {
|
|||||||
return $driver_info;
|
return $driver_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function author(){
|
||||||
|
if( !$this->_author && $this->id_admin_author ){
|
||||||
|
$this->_author = Admin::o( $this->id_admin_author );
|
||||||
|
}
|
||||||
|
return $this->_author;
|
||||||
|
}
|
||||||
|
|
||||||
public function save() {
|
public function save() {
|
||||||
$this->phone = Phone::clean($this->phone);
|
$this->phone = Phone::clean($this->phone);
|
||||||
$this->txt = Phone::clean($this->txt);
|
$this->txt = Phone::clean($this->txt);
|
||||||
$this->testphone = Phone::clean($this->testphone);
|
$this->testphone = Phone::clean($this->testphone);
|
||||||
|
// if it is a new record saves the author
|
||||||
|
if( !$this->id_admin && c::admin()->id_admin ){
|
||||||
|
$this->id_admin_author = c::admin()->id_admin;
|
||||||
|
}
|
||||||
return parent::save();
|
return parent::save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
<div class="bar-loader bar-loader-search" ng-class="{'bar-loader-loading': loading}"></div>
|
<div class="bar-loader bar-loader-search" ng-class="{'bar-loader-loading': loading}"></div>
|
||||||
|
|
||||||
<h2>
|
<h2>
|
||||||
<a href="/drivers/onboarding/docs">Documents</a> |
|
<a href="/drivers/onboarding/docs">Documents</a> |
|
||||||
<a href="/drivers/onboarding/new">Create a new driver</a>
|
<a href="/drivers/onboarding/new">Create a new driver</a>
|
||||||
</h2>
|
</h2>
|
||||||
<br><br>
|
<br><br>
|
||||||
@ -26,6 +26,7 @@
|
|||||||
<th>Login</th>
|
<th>Login</th>
|
||||||
<th>Vehicle</th>
|
<th>Vehicle</th>
|
||||||
<th>Community</th>
|
<th>Community</th>
|
||||||
|
<th>Created by</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr ng-repeat="driver in drivers" ng-attr-tabindex="{{$index+1}}" tab-select="/drivers/onboarding/{{driver.id_admin}}">
|
<tr ng-repeat="driver in drivers" ng-attr-tabindex="{{$index+1}}" tab-select="/drivers/onboarding/{{driver.id_admin}}">
|
||||||
@ -43,6 +44,9 @@
|
|||||||
{{community}}
|
{{community}}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
{{driver.author}}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span ng-if="driver.sent_all_docs" class="sp-label sp-label-success">
|
<span ng-if="driver.sent_all_docs" class="sp-label sp-label-success">
|
||||||
Docs ok
|
Docs ok
|
||||||
@ -64,7 +68,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user