webroot/js/job_grid.js
This commit is contained in:
parent
593f5ad97e
commit
3fa7e3351d
|
|
@ -56,7 +56,7 @@ class UsersController extends AppController {
|
||||||
|
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
$this->Cookie->del('Auth.User');
|
$this->Cookie->del('Auth.User');
|
||||||
$this->redirect($this->Auth->logout());
|
$this->redirect($this->Auth->logout());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,10 +80,10 @@ class UsersController extends AppController {
|
||||||
//$user = $this->User->read(null, $id);
|
//$user = $this->User->read(null, $id);
|
||||||
|
|
||||||
$userFields = array('User.id', 'User.principle_id','User.customer_id','User.type',
|
$userFields = array('User.id', 'User.principle_id','User.customer_id','User.type',
|
||||||
'User.access_level','User.username','User.first_name','User.last_name',
|
'User.access_level','User.username','User.first_name','User.last_name',
|
||||||
'User.email','User.job_title','User.phone','User.mobile','User.fax','User.phone_extension','User.direct_phone',
|
'User.email','User.job_title','User.phone','User.mobile','User.fax','User.phone_extension','User.direct_phone',
|
||||||
'User.notes','User.by_vault','User.blacklisted'
|
'User.notes','User.by_vault','User.blacklisted'
|
||||||
);
|
);
|
||||||
|
|
||||||
$user = $this->User->find('first', array('conditions'=>array('User.id'=>$id), 'fields'=>$userFields, 'recursive'=>0));
|
$user = $this->User->find('first', array('conditions'=>array('User.id'=>$id), 'fields'=>$userFields, 'recursive'=>0));
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ class UsersController extends AppController {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'user':
|
case 'user':
|
||||||
//$this->set('enquiries', $this->paginate('Enquiry', array('Enquiry.user_id' => $id)));
|
//$this->set('enquiries', $this->paginate('Enquiry', array('Enquiry.user_id' => $id)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -187,9 +187,6 @@ class UsersController extends AppController {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$this->redirect('/');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ class User extends AppModel {
|
||||||
|
|
||||||
var $validate = array(
|
var $validate = array(
|
||||||
'first_name' => array('notEmpty'),
|
'first_name' => array('notEmpty'),
|
||||||
'last_name' => array('notEmpty'),
|
|
||||||
'email' => array('email')
|
'email' => array('email')
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,227 +1,248 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo $javascript->link('jquery.jeditable.mini');
|
//echo $javascript->link('jquery.jeditable.mini');
|
||||||
echo $javascript->link('jobindex_editinplace');
|
//echo $javascript->link('jobindex_editinplace');
|
||||||
echo $javascript->link('addjob');
|
//echo $javascript->link('addjob');
|
||||||
|
echo $javascript->link('job_index');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<h2><?php __('Jobs');?></h2>
|
<h2><?php __('Jobs');?></h2>
|
||||||
|
|
||||||
|
<button id="SwitchToGrid">
|
||||||
|
Edit Jobs
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button id="SwitchToTable">
|
||||||
|
View Jobs
|
||||||
|
</button>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
echo $paginator->counter(array(
|
echo $paginator->counter(array(
|
||||||
'format' => __('Page %page% of %pages%, showing %current% Jobs out of %count% total, starting on record %start%, ending on %end%', true)
|
'format' => __('Page %page% of %pages%, showing %current% Jobs out of %count% total, starting on record %start%, ending on %end%', true)
|
||||||
));
|
));
|
||||||
?></p>
|
?></p>
|
||||||
<table cellpadding="0" cellspacing="0" class="mer">
|
<div class="paging">
|
||||||
<tr>
|
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
|
||||||
|
| <?php echo $paginator->numbers();?>
|
||||||
|
<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<th><?php echo $paginator->sort('created');?></th>
|
<div id="jobsIndex">
|
||||||
<th><?php echo $paginator->sort('Job Number');?></th>
|
|
||||||
<th><?php echo $paginator->sort('enquiry_id');?></th>
|
|
||||||
<th><?php echo $paginator->sort('Customer');?></th>
|
|
||||||
<th><?php echo $paginator->sort('customer_order_number');?></th>
|
|
||||||
<th><?php echo $paginator->sort('supplier_reference');?></th>
|
|
||||||
|
|
||||||
|
|
||||||
<th><?php echo $paginator->sort('date_order_received');?></th>
|
<table cellpadding="0" cellspacing="0" class="mer">
|
||||||
<th><?php echo $paginator->sort('date_order_placed_on_principle');?></th>
|
<tr>
|
||||||
<th><?php echo $paginator->sort('date_scheduled_ex_works');?></th>
|
|
||||||
<th><?php echo $paginator->sort('date_order_sent_to_customer');?></th>
|
|
||||||
|
|
||||||
<th><?php echo $paginator->sort('domestic_freight_paid_by');?></th>
|
<th><?php echo $paginator->sort('created');?></th>
|
||||||
<th><?php echo $paginator->sort('sale_category');?></th>
|
<th><?php echo $paginator->sort('Job Number');?></th>
|
||||||
<th><?php echo $paginator->sort('shipment_category');?></th>
|
<th><?php echo $paginator->sort('enquiry_id');?></th>
|
||||||
<th><?php echo $paginator->sort('comments');?></th>
|
<th><?php echo $paginator->sort('Customer');?></th>
|
||||||
|
<th><?php echo $paginator->sort('customer_order_number');?></th>
|
||||||
<th><?php echo $paginator->sort('company_gross_sales_aud');?></th>
|
<th><?php echo $paginator->sort('supplier_reference');?></th>
|
||||||
<th><?php echo $paginator->sort('net_sales_aud');?></th>
|
|
||||||
<th><?php echo $paginator->sort('gross_profit_aud');?></th>
|
|
||||||
<th><?php echo $paginator->sort('ato_exchange_rate');?></th>
|
|
||||||
<th><?php echo $paginator->sort('gst');?></th>
|
|
||||||
<th><?php echo $paginator->sort('currency_id');?></th>
|
|
||||||
<th><?php echo $paginator->sort('gst_amount');?></th>
|
|
||||||
<th><?php echo $paginator->sort('gross_commisions');?></th>
|
|
||||||
<th><?php echo $paginator->sort('invoiced_amount_inc_gst');?></th>
|
|
||||||
<th><?php echo $paginator->sort('net_export_sales_aud');?></th>
|
|
||||||
<th><?php echo $paginator->sort('gross_profit_exports_aud');?></th>
|
|
||||||
<th><?php echo $paginator->sort('gp_percent');?></th>
|
|
||||||
<th><?php echo $paginator->sort('gross_australian_sales_foreign_currency');?></th>
|
|
||||||
<th><?php echo $paginator->sort('net_australian_sales_foreign_currency');?></th>
|
|
||||||
<th><?php echo $paginator->sort('gross_profit_value_australian_sales_foreign_currency');?></th>
|
|
||||||
<th><?php echo $paginator->sort('gross_export_sales_foreign_currency');?></th>
|
|
||||||
<th><?php echo $paginator->sort('net_export_sales_foreign_currency');?></th>
|
|
||||||
<th><?php echo $paginator->sort('gross_profit_value_after_discount_exports_foreign_currency');?></th>
|
|
||||||
<th><?php echo $paginator->sort('gross_commissions');?></th>
|
|
||||||
<th><?php echo $paginator->sort('net_commissions');?></th>
|
|
||||||
|
|
||||||
|
|
||||||
<th class="actions"><?php __('Actions');?></th>
|
<th><?php echo $paginator->sort('date_order_received');?></th>
|
||||||
</tr>
|
<th><?php echo $paginator->sort('date_order_placed_on_principle');?></th>
|
||||||
<?php
|
<th><?php echo $paginator->sort('date_scheduled_ex_works');?></th>
|
||||||
$i = 0;
|
<th><?php echo $paginator->sort('date_order_sent_to_customer');?></th>
|
||||||
foreach ($jobs as $job):
|
|
||||||
|
|
||||||
?>
|
<th><?php echo $paginator->sort('domestic_freight_paid_by');?></th>
|
||||||
<tr class="jobRow" id="<?=$job['Job']['id'];?>">
|
<th><?php echo $paginator->sort('sale_category');?></th>
|
||||||
|
<th><?php echo $paginator->sort('shipment_category');?></th>
|
||||||
|
<th><?php echo $paginator->sort('comments');?></th>
|
||||||
|
|
||||||
|
<th><?php echo $paginator->sort('company_gross_sales_aud');?></th>
|
||||||
|
<th><?php echo $paginator->sort('net_sales_aud');?></th>
|
||||||
|
<th><?php echo $paginator->sort('gross_profit_aud');?></th>
|
||||||
|
<th><?php echo $paginator->sort('ato_exchange_rate');?></th>
|
||||||
|
<th><?php echo $paginator->sort('gst');?></th>
|
||||||
|
<th><?php echo $paginator->sort('currency_id');?></th>
|
||||||
|
<th><?php echo $paginator->sort('gst_amount');?></th>
|
||||||
|
<th><?php echo $paginator->sort('gross_commisions');?></th>
|
||||||
|
<th><?php echo $paginator->sort('invoiced_amount_inc_gst');?></th>
|
||||||
|
<th><?php echo $paginator->sort('net_export_sales_aud');?></th>
|
||||||
|
<th><?php echo $paginator->sort('gross_profit_exports_aud');?></th>
|
||||||
|
<th><?php echo $paginator->sort('gp_percent');?></th>
|
||||||
|
<th><?php echo $paginator->sort('gross_australian_sales_foreign_currency');?></th>
|
||||||
|
<th><?php echo $paginator->sort('net_australian_sales_foreign_currency');?></th>
|
||||||
|
<th><?php echo $paginator->sort('gross_profit_value_australian_sales_foreign_currency');?></th>
|
||||||
|
<th><?php echo $paginator->sort('gross_export_sales_foreign_currency');?></th>
|
||||||
|
<th><?php echo $paginator->sort('net_export_sales_foreign_currency');?></th>
|
||||||
|
<th><?php echo $paginator->sort('gross_profit_value_after_discount_exports_foreign_currency');?></th>
|
||||||
|
<th><?php echo $paginator->sort('gross_commissions');?></th>
|
||||||
|
<th><?php echo $paginator->sort('net_commissions');?></th>
|
||||||
|
|
||||||
|
|
||||||
|
<th class="actions"><?php __('Actions');?></th>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
$i = 0;
|
||||||
|
foreach ($jobs as $job):
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr class="jobRow" id="<?=$job['Job']['id'];?>">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<td class="enqdate">
|
<td class="enqdate">
|
||||||
<?php
|
<?php
|
||||||
/* Change the date from MySQL DATETIME to a D M Y format */
|
/* Change the date from MySQL DATETIME to a D M Y format */
|
||||||
echo date('j M Y',$time->toUnix($job['Job']['created'])); ?>
|
echo date('j M Y',$time->toUnix($job['Job']['created'])); ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $html->link(__($job['Job']['title'], true), array('action' => 'view', $job['Job']['id'])); ?>
|
<?php echo $html->link(__($job['Job']['title'], true), array('action' => 'view', $job['Job']['id'])); ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php echo $html->link($job['Enquiry']['title'], array('controller' => 'enquiries', 'action' => 'view', $job['Enquiry']['id'])); ?>
|
<?php echo $html->link($job['Enquiry']['title'], array('controller' => 'enquiries', 'action' => 'view', $job['Enquiry']['id'])); ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php echo $html->link($customers[$job['Enquiry']['customer_id']], array('controller'=>'customers',
|
<?php echo $html->link($customers[$job['Enquiry']['customer_id']], array('controller'=>'customers',
|
||||||
'action'=>'view', $job['Enquiry']['customer_id'])); ?>
|
'action'=>'view', $job['Enquiry']['customer_id'])); ?>
|
||||||
</td>
|
</td>
|
||||||
<td class="customerOrderNo">
|
<td class="customerOrderNo">
|
||||||
<?php echo $job['Job']['customer_order_number']; ?>
|
<?php echo $job['Job']['customer_order_number']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['supplier_reference']; ?>
|
<?php echo $job['Job']['supplier_reference']; ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
<?php echo $job['Job']['date_order_received']; ?>
|
<?php echo $job['Job']['date_order_received']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo isEmptyDate($job['Job']['date_order_placed_on_principle']); ?>
|
<?php echo isEmptyDate($job['Job']['date_order_placed_on_principle']); ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php echo isEmptyDate($job['Job']['date_scheduled_ex_works']); ?>
|
<?php echo isEmptyDate($job['Job']['date_scheduled_ex_works']); ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php echo isEmptyDate($job['Job']['date_order_sent_to_customer']); ?>
|
<?php echo isEmptyDate($job['Job']['date_order_sent_to_customer']); ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['domestic_freight_paid_by']; ?>
|
<?php echo $job['Job']['domestic_freight_paid_by']; ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['sale_category']; ?>
|
<?php echo $job['Job']['sale_category']; ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['shipment_category']; ?>
|
<?php echo $job['Job']['shipment_category']; ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['comments']; ?>
|
<?php echo $job['Job']['comments']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['company_gross_sales_aud']; ?>
|
<?php echo $job['Job']['company_gross_sales_aud']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['net_sales_aud']; ?>
|
<?php echo $job['Job']['net_sales_aud']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['gross_profit_aud']; ?>
|
<?php echo $job['Job']['gross_profit_aud']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['ato_exchange_rate']; ?>
|
<?php echo $job['Job']['ato_exchange_rate']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php if($job['Job']['gst'] == 1) {
|
<?php if($job['Job']['gst'] == 1) {
|
||||||
echo "GST Applicable";
|
echo "GST Applicable";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "N/A";
|
echo "N/A";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $currencies[$job['Job']['currency_id']]; ?>
|
<?php echo $currencies[$job['Job']['currency_id']]; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['gst_amount']; ?>
|
<?php echo $job['Job']['gst_amount']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['gross_commisions']; ?>
|
<?php echo $job['Job']['gross_commisions']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['invoiced_amount_inc_gst']; ?>
|
<?php echo $job['Job']['invoiced_amount_inc_gst']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['net_export_sales_aud']; ?>
|
<?php echo $job['Job']['net_export_sales_aud']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['gross_profit_exports_aud']; ?>
|
<?php echo $job['Job']['gross_profit_exports_aud']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['gp_percent']; ?>
|
<?php echo $job['Job']['gp_percent']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['gross_australian_sales_foreign_currency']; ?>
|
<?php echo $job['Job']['gross_australian_sales_foreign_currency']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['net_australian_sales_foreign_currency']; ?>
|
<?php echo $job['Job']['net_australian_sales_foreign_currency']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['gross_profit_value_australian_sales_foreign_currency']; ?>
|
<?php echo $job['Job']['gross_profit_value_australian_sales_foreign_currency']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['gross_export_sales_foreign_currency']; ?>
|
<?php echo $job['Job']['gross_export_sales_foreign_currency']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['net_export_sales_foreign_currency']; ?>
|
<?php echo $job['Job']['net_export_sales_foreign_currency']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['gross_profit_value_after_discount_exports_foreign_currency']; ?>
|
<?php echo $job['Job']['gross_profit_value_after_discount_exports_foreign_currency']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['gross_commissions']; ?>
|
<?php echo $job['Job']['gross_commissions']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $job['Job']['net_commissions']; ?>
|
<?php echo $job['Job']['net_commissions']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<?php //echo $html->link(__('View', true), array('action' => 'view', $job['Job']['id'])); ?>
|
<?php //echo $html->link(__('View', true), array('action' => 'view', $job['Job']['id'])); ?>
|
||||||
<?php echo $html->link(__('Edit', true), array('action' => 'edit', $job['Job']['id']), array('class'=>'editWindow', 'name'=>$job['Job']['id'])); ?>
|
<?php echo $html->link(__('Edit', true), array('action' => 'edit', $job['Job']['id']), array('class'=>'editWindow', 'name'=>$job['Job']['id'])); ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="paging">
|
<div class="paging">
|
||||||
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
|
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
|
||||||
| <?php echo $paginator->numbers();?>
|
| <?php echo $paginator->numbers();?>
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
echo $javascript->link('slickgrid/plugins/slick.cellrangeselector');
|
echo $javascript->link('slickgrid/plugins/slick.cellrangeselector');
|
||||||
echo $javascript->link('slickgrid/plugins/slick.cellrangedecorator');
|
echo $javascript->link('slickgrid/plugins/slick.cellrangedecorator');
|
||||||
echo $javascript->link('slickgrid/plugins/slick.cellselectionmodel');
|
echo $javascript->link('slickgrid/plugins/slick.cellselectionmodel');
|
||||||
echo $javascript->link('jobindex');
|
echo $javascript->link('job_grid');
|
||||||
echo $scripts_for_layout; ?>
|
echo $scripts_for_layout; ?>
|
||||||
<style>
|
<style>
|
||||||
.cell-title {
|
.cell-title {
|
||||||
|
|
|
||||||
|
|
@ -1,50 +1,55 @@
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Javascript to do the actual validation for Adding/Editing users in the modal window.
|
* Javascript to do the actual validation for Adding/Editing users in the modal window.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//var _loadingDiv = $("#ajaxLoading");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var _loadingDiv = $("#ajaxLoading");
|
|
||||||
|
|
||||||
$('#submitUserButton').button();
|
$('#submitUserButton').button();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#UserAddUserForm').submit(function(){
|
$('#UserAddUserForm').submit(function(){
|
||||||
_loadingDiv.show();
|
|
||||||
$.post('/users/add_user',
|
$('#submitUserButton').button('disable');
|
||||||
$(this).serializeArray(),
|
|
||||||
afterValidate,
|
$.post("/users/add_user",
|
||||||
"json"
|
|
||||||
);
|
$('#UserAddUserForm').serializeArray(),
|
||||||
|
function(data) {
|
||||||
|
var dataArray = $.parseJSON(data);
|
||||||
|
if (dataArray.errors) {
|
||||||
|
onError(dataArray.errors);
|
||||||
|
} else if (dataArray.success) {
|
||||||
|
onSuccess(dataArray.success);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Post-submit callback
|
|
||||||
function afterValidate(data, status) {
|
|
||||||
$(".message").remove();
|
|
||||||
$(".error-message").remove();
|
|
||||||
|
|
||||||
if (data.errors) {
|
|
||||||
onError(data.errors);
|
|
||||||
} else if (data.success) {
|
|
||||||
onSuccess(data.success);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSuccess(data) {
|
function onSuccess(data) {
|
||||||
flashMessage(data.message);
|
|
||||||
_loadingDiv.hide();
|
|
||||||
$('#submitUserButton').button('disable');
|
|
||||||
|
|
||||||
|
$(".message").remove();
|
||||||
|
flashMessage(data.message);
|
||||||
|
//_loadingDiv.hide();
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
// window.location.href = '/posts';
|
window.location.reload(true);
|
||||||
window.location.reload(true);
|
}, 2000);
|
||||||
}, 500);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function onError(data) {
|
function onError(data) {
|
||||||
|
$('#submitUserButton').button('enable');
|
||||||
flashMessage(data.message);
|
flashMessage(data.message);
|
||||||
$.each(data.data, function(model, errors) {
|
$.each(data.data, function(model, errors) {
|
||||||
for (fieldName in this) {
|
for (fieldName in this) {
|
||||||
|
|
@ -59,7 +64,7 @@ $(function() {
|
||||||
function flashMessage(message) {
|
function flashMessage(message) {
|
||||||
var _insert = $(document.createElement('div')).css('display', 'none');
|
var _insert = $(document.createElement('div')).css('display', 'none');
|
||||||
_insert.attr('id', 'flashMessage').addClass('message').text(message);
|
_insert.attr('id', 'flashMessage').addClass('message').text(message);
|
||||||
_insert.insertAfter($("#UserAddUserForm")).fadeIn();
|
_insert.insertAfter($('#UserAddUserForm')).fadeIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
function camelize(string) {
|
function camelize(string) {
|
||||||
|
|
@ -70,7 +75,13 @@ $(function() {
|
||||||
}
|
}
|
||||||
s = s.join('');
|
s = s.join('');
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -1,322 +0,0 @@
|
||||||
function requiredFieldValidator(value) {
|
|
||||||
if (value == null || value == undefined || !value.length)
|
|
||||||
return {
|
|
||||||
valid:false,
|
|
||||||
msg:"This is a required field"
|
|
||||||
};
|
|
||||||
else
|
|
||||||
return {
|
|
||||||
valid:true,
|
|
||||||
msg:null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var grid;
|
|
||||||
var data = [];
|
|
||||||
|
|
||||||
var columns = [
|
|
||||||
{
|
|
||||||
id:"id",
|
|
||||||
name:"ID",
|
|
||||||
field:"id",
|
|
||||||
width:50,
|
|
||||||
cssClass:""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:"created",
|
|
||||||
name:"Date Created",
|
|
||||||
field:"created",
|
|
||||||
width: 100
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"title",
|
|
||||||
name:"Job",
|
|
||||||
field:"title",
|
|
||||||
width:120
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:"customer",
|
|
||||||
name:"Customer",
|
|
||||||
field:"customer"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:"customer_order_number",
|
|
||||||
name:"Customer Ref",
|
|
||||||
field:"customer_order_number",
|
|
||||||
width:120,
|
|
||||||
resizable:true,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:"supplier_reference",
|
|
||||||
name:"Supplier Ref",
|
|
||||||
field:"supplier_reference",
|
|
||||||
width:120,
|
|
||||||
resizable:true,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:"date_order_received",
|
|
||||||
name:"Order Received",
|
|
||||||
field:"date_order_received",
|
|
||||||
minWidth:60,
|
|
||||||
editor:DateCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"date_order_placed_on_principle",
|
|
||||||
name:"Date Order Placed on Principle",
|
|
||||||
field:"date_order_placed_on_principle",
|
|
||||||
minWidth:60,
|
|
||||||
editor:DateCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"date_scheduled_ex_works",
|
|
||||||
name:"Scheduled Ex Works",
|
|
||||||
field:"date_scheduled_ex_works",
|
|
||||||
minWidth:60,
|
|
||||||
editor:DateCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"date_order_sent_to_customer",
|
|
||||||
name:"Date Sent to Customer",
|
|
||||||
field:"date_order_sent_to_customer",
|
|
||||||
minWidth:60,
|
|
||||||
editor:DateCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"domestic_freight_paid_by",
|
|
||||||
name:"Dom Freight Paid By",
|
|
||||||
field:"domestic_freight_paid_by",
|
|
||||||
minWidth:60
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"sale_category",
|
|
||||||
name:"Sale Category",
|
|
||||||
field:"sale_category",
|
|
||||||
minWidth:60
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"shipment_category",
|
|
||||||
name:"Shipment Category",
|
|
||||||
field:"shipment_category",
|
|
||||||
minWidth:60
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"domestic_freight_paid_by",
|
|
||||||
name:"Dom Freight Paid By",
|
|
||||||
field:"domestic_freight_paid_by",
|
|
||||||
minWidth:60
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"comments",
|
|
||||||
name:"Comments",
|
|
||||||
field:"comments",
|
|
||||||
minWidth:60,
|
|
||||||
editor:LongTextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"company_gross_sales_aud",
|
|
||||||
name:"Gross Sales AUD",
|
|
||||||
field:"company_gross_sales_aud",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"net_sales_aud",
|
|
||||||
name:"Net Sales AUD",
|
|
||||||
field:"net_sales_aud",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"gross_profit_aud",
|
|
||||||
name:"Gross Profit AUD",
|
|
||||||
field:"gross_profit_aud",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"ato_exchange_rate",
|
|
||||||
name:"ATO Exchange Rate",
|
|
||||||
field:"ato_exchange_rate",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"gst",
|
|
||||||
name:"GST",
|
|
||||||
field:"gst",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"currency_id",
|
|
||||||
name:"Currency",
|
|
||||||
field:"currency_id",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"gst_amount",
|
|
||||||
name:"GST Amount",
|
|
||||||
field:"gst_amount",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"gross_commisions",
|
|
||||||
name:"Gross Commisions",
|
|
||||||
field:"gross_commisions",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"invoiced_amount_inc_gst",
|
|
||||||
name:"invoiced amount inc gst",
|
|
||||||
field:"invoiced_amount_inc_gst",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"net_export_sales_aud",
|
|
||||||
name:"Net Export Sales AUD",
|
|
||||||
field:"net_export_sales_aud",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"gross_profit_exports_aud",
|
|
||||||
name:"Gross Profit Exports AUD",
|
|
||||||
field:"gross_profit_exports_aud",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id:"gp_percent",
|
|
||||||
name:"GP %",
|
|
||||||
field:"gp_percent",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"gross_australian_sales_foreign_currency",
|
|
||||||
name:"Gross Australian Sales Foreign Currency",
|
|
||||||
field:"gross_australian_sales_foreign_currency",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"net_australian_sales_foreign_currency",
|
|
||||||
name:"Net Australian Sales Foreign Currency",
|
|
||||||
field:"net_australian_sales_foreign_currency",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"gross_profit_value_australian_sales_foreign_currency",
|
|
||||||
name:"Gross Profit Value Aust Sales Foreign Currency",
|
|
||||||
field:"gross_profit_value_australian_sales_foreign_currency",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"gross_export_sales_foreign_currency",
|
|
||||||
name:"Gross Export Sales Foreign Currency",
|
|
||||||
field:"gross_export_sales_foreign_currency",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"net_export_sales_foreign_currency",
|
|
||||||
name:"Net Export Sales Foreign Currency",
|
|
||||||
field:"net_export_sales_foreign_currency",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"gross_profit_value_after_discount_exports_foreign_currency",
|
|
||||||
name:"GP Amount After Discount Exports Foreign Currency",
|
|
||||||
field:"gross_profit_value_after_discount_exports_foreign_currency",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"gross_commissions",
|
|
||||||
name:"Gross Commissions",
|
|
||||||
field:"gross_commissions",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
id:"net_commissions",
|
|
||||||
name:"Net Commissions",
|
|
||||||
field:"net_commissions",
|
|
||||||
minWidth:60,
|
|
||||||
editor:TextCellEditor
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
];
|
|
||||||
var options = {
|
|
||||||
editable: true,
|
|
||||||
enableAddRow: false,
|
|
||||||
enableCellNavigation: true,
|
|
||||||
asyncEditorLoading: false,
|
|
||||||
autoEdit: false
|
|
||||||
};
|
|
||||||
|
|
||||||
$(function()
|
|
||||||
{
|
|
||||||
|
|
||||||
data = $.parseJSON($("#jsonObj").html());
|
|
||||||
|
|
||||||
grid = new Slick.Grid("#myGrid", data, columns, options);
|
|
||||||
|
|
||||||
//grid.registerPlugin(new Slick.CellRangeSelector());
|
|
||||||
|
|
||||||
grid.setSelectionModel(new Slick.CellSelectionModel());
|
|
||||||
|
|
||||||
grid.onAddNewRow.subscribe(function(e, args) {
|
|
||||||
var item = args.item;
|
|
||||||
var column = args.column;
|
|
||||||
grid.invalidateRow(data.length);
|
|
||||||
data.push(item);
|
|
||||||
grid.updateRowCount();
|
|
||||||
grid.render();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Loading…
Reference in a new issue