webroot/js/job_grid.js
This commit is contained in:
parent
593f5ad97e
commit
3fa7e3351d
|
|
@ -56,7 +56,7 @@ class UsersController extends AppController {
|
|||
|
||||
|
||||
function logout() {
|
||||
$this->Cookie->del('Auth.User');
|
||||
$this->Cookie->del('Auth.User');
|
||||
$this->redirect($this->Auth->logout());
|
||||
}
|
||||
|
||||
|
|
@ -80,10 +80,10 @@ class UsersController extends AppController {
|
|||
//$user = $this->User->read(null, $id);
|
||||
|
||||
$userFields = array('User.id', 'User.principle_id','User.customer_id','User.type',
|
||||
'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.notes','User.by_vault','User.blacklisted'
|
||||
);
|
||||
'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.notes','User.by_vault','User.blacklisted'
|
||||
);
|
||||
|
||||
$user = $this->User->find('first', array('conditions'=>array('User.id'=>$id), 'fields'=>$userFields, 'recursive'=>0));
|
||||
|
||||
|
|
@ -113,10 +113,10 @@ class UsersController extends AppController {
|
|||
break;
|
||||
|
||||
case 'user':
|
||||
//$this->set('enquiries', $this->paginate('Enquiry', array('Enquiry.user_id' => $id)));
|
||||
//$this->set('enquiries', $this->paginate('Enquiry', array('Enquiry.user_id' => $id)));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->render('viewUser');
|
||||
|
||||
|
|
@ -187,9 +187,6 @@ class UsersController extends AppController {
|
|||
|
||||
|
||||
}
|
||||
else {
|
||||
$this->redirect('/');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -252,7 +249,7 @@ class UsersController extends AppController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ class User extends AppModel {
|
|||
|
||||
var $validate = array(
|
||||
'first_name' => array('notEmpty'),
|
||||
'last_name' => array('notEmpty'),
|
||||
'email' => array('email')
|
||||
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,227 +1,248 @@
|
|||
<?php
|
||||
|
||||
echo $javascript->link('jquery.jeditable.mini');
|
||||
echo $javascript->link('jobindex_editinplace');
|
||||
echo $javascript->link('addjob');
|
||||
|
||||
//echo $javascript->link('jquery.jeditable.mini');
|
||||
//echo $javascript->link('jobindex_editinplace');
|
||||
//echo $javascript->link('addjob');
|
||||
echo $javascript->link('job_index');
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<h2><?php __('Jobs');?></h2>
|
||||
|
||||
<button id="SwitchToGrid">
|
||||
Edit Jobs
|
||||
</button>
|
||||
|
||||
<button id="SwitchToTable">
|
||||
View Jobs
|
||||
</button>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
echo $paginator->counter(array(
|
||||
'format' => __('Page %page% of %pages%, showing %current% Jobs out of %count% total, starting on record %start%, ending on %end%', true)
|
||||
));
|
||||
?></p>
|
||||
<table cellpadding="0" cellspacing="0" class="mer">
|
||||
<tr>
|
||||
<div class="paging">
|
||||
<?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>
|
||||
<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>
|
||||
<div id="jobsIndex">
|
||||
|
||||
|
||||
<th><?php echo $paginator->sort('date_order_received');?></th>
|
||||
<th><?php echo $paginator->sort('date_order_placed_on_principle');?></th>
|
||||
<th><?php echo $paginator->sort('date_scheduled_ex_works');?></th>
|
||||
<th><?php echo $paginator->sort('date_order_sent_to_customer');?></th>
|
||||
<table cellpadding="0" cellspacing="0" class="mer">
|
||||
<tr>
|
||||
|
||||
<th><?php echo $paginator->sort('domestic_freight_paid_by');?></th>
|
||||
<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><?php echo $paginator->sort('created');?></th>
|
||||
<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 class="actions"><?php __('Actions');?></th>
|
||||
</tr>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($jobs as $job):
|
||||
<th><?php echo $paginator->sort('date_order_received');?></th>
|
||||
<th><?php echo $paginator->sort('date_order_placed_on_principle');?></th>
|
||||
<th><?php echo $paginator->sort('date_scheduled_ex_works');?></th>
|
||||
<th><?php echo $paginator->sort('date_order_sent_to_customer');?></th>
|
||||
|
||||
?>
|
||||
<tr class="jobRow" id="<?=$job['Job']['id'];?>">
|
||||
<th><?php echo $paginator->sort('domestic_freight_paid_by');?></th>
|
||||
<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">
|
||||
<?php
|
||||
/* Change the date from MySQL DATETIME to a D M Y format */
|
||||
echo date('j M Y',$time->toUnix($job['Job']['created'])); ?>
|
||||
</td>
|
||||
<td class="enqdate">
|
||||
<?php
|
||||
/* Change the date from MySQL DATETIME to a D M Y format */
|
||||
echo date('j M Y',$time->toUnix($job['Job']['created'])); ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $html->link(__($job['Job']['title'], true), array('action' => 'view', $job['Job']['id'])); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $html->link($job['Enquiry']['title'], array('controller' => 'enquiries', 'action' => 'view', $job['Enquiry']['id'])); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $html->link($customers[$job['Enquiry']['customer_id']], array('controller'=>'customers',
|
||||
'action'=>'view', $job['Enquiry']['customer_id'])); ?>
|
||||
</td>
|
||||
<td class="customerOrderNo">
|
||||
<?php echo $job['Job']['customer_order_number']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $html->link(__($job['Job']['title'], true), array('action' => 'view', $job['Job']['id'])); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $html->link($job['Enquiry']['title'], array('controller' => 'enquiries', 'action' => 'view', $job['Enquiry']['id'])); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $html->link($customers[$job['Enquiry']['customer_id']], array('controller'=>'customers',
|
||||
'action'=>'view', $job['Enquiry']['customer_id'])); ?>
|
||||
</td>
|
||||
<td class="customerOrderNo">
|
||||
<?php echo $job['Job']['customer_order_number']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['supplier_reference']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<td>
|
||||
<?php echo $job['Job']['supplier_reference']; ?>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<?php echo $job['Job']['date_order_received']; ?>
|
||||
</td>
|
||||
<?php echo $job['Job']['date_order_received']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo isEmptyDate($job['Job']['date_order_placed_on_principle']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo isEmptyDate($job['Job']['date_scheduled_ex_works']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo isEmptyDate($job['Job']['date_order_sent_to_customer']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo isEmptyDate($job['Job']['date_order_placed_on_principle']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo isEmptyDate($job['Job']['date_scheduled_ex_works']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo isEmptyDate($job['Job']['date_order_sent_to_customer']); ?>
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['domestic_freight_paid_by']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['sale_category']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['shipment_category']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['comments']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['domestic_freight_paid_by']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['sale_category']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['shipment_category']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['comments']; ?>
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['company_gross_sales_aud']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['company_gross_sales_aud']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['net_sales_aud']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['net_sales_aud']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_profit_aud']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_profit_aud']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['ato_exchange_rate']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['ato_exchange_rate']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php if($job['Job']['gst'] == 1) {
|
||||
echo "GST Applicable";
|
||||
}
|
||||
else {
|
||||
echo "N/A";
|
||||
}
|
||||
<td>
|
||||
<?php if($job['Job']['gst'] == 1) {
|
||||
echo "GST Applicable";
|
||||
}
|
||||
else {
|
||||
echo "N/A";
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
|
||||
</td>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $currencies[$job['Job']['currency_id']]; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $currencies[$job['Job']['currency_id']]; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['gst_amount']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['gst_amount']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_commisions']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_commisions']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['invoiced_amount_inc_gst']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['invoiced_amount_inc_gst']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['net_export_sales_aud']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['net_export_sales_aud']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_profit_exports_aud']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_profit_exports_aud']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['gp_percent']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['gp_percent']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_australian_sales_foreign_currency']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_australian_sales_foreign_currency']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['net_australian_sales_foreign_currency']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['net_australian_sales_foreign_currency']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_profit_value_australian_sales_foreign_currency']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_profit_value_australian_sales_foreign_currency']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_export_sales_foreign_currency']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_export_sales_foreign_currency']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['net_export_sales_foreign_currency']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['net_export_sales_foreign_currency']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_profit_value_after_discount_exports_foreign_currency']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_profit_value_after_discount_exports_foreign_currency']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_commissions']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['gross_commissions']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $job['Job']['net_commissions']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $job['Job']['net_commissions']; ?>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="actions">
|
||||
<?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'])); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<td class="actions">
|
||||
<?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'])); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="paging">
|
||||
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
|
||||
| <?php echo $paginator->numbers();?>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
echo $javascript->link('slickgrid/plugins/slick.cellrangeselector');
|
||||
echo $javascript->link('slickgrid/plugins/slick.cellrangedecorator');
|
||||
echo $javascript->link('slickgrid/plugins/slick.cellselectionmodel');
|
||||
echo $javascript->link('jobindex');
|
||||
echo $javascript->link('job_grid');
|
||||
echo $scripts_for_layout; ?>
|
||||
<style>
|
||||
.cell-title {
|
||||
|
|
|
|||
|
|
@ -26,4 +26,4 @@
|
|||
));
|
||||
}
|
||||
echo $javascript->object($output);
|
||||
?>
|
||||
?>
|
||||
|
|
@ -1,50 +1,55 @@
|
|||
$(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();
|
||||
|
||||
|
||||
|
||||
|
||||
$('#UserAddUserForm').submit(function(){
|
||||
_loadingDiv.show();
|
||||
$.post('/users/add_user',
|
||||
$(this).serializeArray(),
|
||||
afterValidate,
|
||||
"json"
|
||||
);
|
||||
|
||||
$('#submitUserButton').button('disable');
|
||||
|
||||
$.post("/users/add_user",
|
||||
|
||||
$('#UserAddUserForm').serializeArray(),
|
||||
function(data) {
|
||||
var dataArray = $.parseJSON(data);
|
||||
if (dataArray.errors) {
|
||||
onError(dataArray.errors);
|
||||
} else if (dataArray.success) {
|
||||
onSuccess(dataArray.success);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
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) {
|
||||
flashMessage(data.message);
|
||||
_loadingDiv.hide();
|
||||
$('#submitUserButton').button('disable');
|
||||
|
||||
$(".message").remove();
|
||||
flashMessage(data.message);
|
||||
//_loadingDiv.hide();
|
||||
window.setTimeout(function() {
|
||||
// window.location.href = '/posts';
|
||||
window.location.reload(true);
|
||||
}, 500);
|
||||
window.location.reload(true);
|
||||
}, 2000);
|
||||
|
||||
};
|
||||
|
||||
function onError(data) {
|
||||
$('#submitUserButton').button('enable');
|
||||
flashMessage(data.message);
|
||||
$.each(data.data, function(model, errors) {
|
||||
for (fieldName in this) {
|
||||
|
|
@ -59,7 +64,7 @@ $(function() {
|
|||
function flashMessage(message) {
|
||||
var _insert = $(document.createElement('div')).css('display', 'none');
|
||||
_insert.attr('id', 'flashMessage').addClass('message').text(message);
|
||||
_insert.insertAfter($("#UserAddUserForm")).fadeIn();
|
||||
_insert.insertAfter($('#UserAddUserForm')).fadeIn();
|
||||
}
|
||||
|
||||
function camelize(string) {
|
||||
|
|
@ -70,7 +75,13 @@ $(function() {
|
|||
}
|
||||
s = s.join('');
|
||||
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