Random changes. Thinking of ditching Scriptaculous/Prototype for JQuery in future versions. Will try and focus on core functionality first, niceties later

This commit is contained in:
Karl Cordes 2009-09-10 13:23:39 +10:00
parent 1f8ab12454
commit 8a981ea577
34 changed files with 1106 additions and 372 deletions

View file

@ -0,0 +1,19 @@
<?php
/* App Controller */
class AppController extends Controller {
var $components = array('Auth', 'RequestHandler');
var $helpers = array('Javascript', 'Time', 'Html', 'Form', 'Ajax');
function beforeFilter() {
$this->set('currentuser', $this->Auth->user());
if($this->RequestHandler->isAjax()) {
Configure::write('debug', 0);
}
}
}
?>

View file

@ -0,0 +1,242 @@
<?php
/*
File: /app/controllers/components/image.php
*/
class ImageComponent extends Object
{
/* from http://sabbour.wordpress.com/2008/05/13/image-upload-and-resize-component-for-cakephp-12/
* Uploads an image and its thumbnail into $folderName/big and $folderName/small respectivley.
* the generated thumnail could either have the same aspect ratio as the uploaded image, or could
* be a zoomed and cropped version.
* Directions:
* In view where you upload the image, make sure your form creation is similar to the following
* <?= $form->create('FurnitureSet',array('type' => 'file')); ?>
*
* In view where you upload the image, make sure that you have a file input similar to the following
* <?= $form->file('Image/name1'); ?>
*
* In the controller, add the component to your components array
* var $components = array("Image");
*
* In your controller action (the parameters are expained below)
* $image_path = $this->Image->upload_image_and_thumbnail($this->data,"name1",573,80,"sets",true);
* this returns the file name of the result image. You can store this file name in the database
*
* Note that your image will be stored in 2 locations:
* Image: /webroot/img/$folderName/big/$image_path
* Thumbnail: /webroot/img/$folderName/small/$image_path
*
* Finally in the view where you want to see the images
* <?= $html->image('sets/big/'.$furnitureSet['FurnitureSet']['image_path']);
* where "sets" is the folder name we saved our pictures in, and $furnitureSet['FurnitureSet']['image_path'] is the file name we stored in the database
* Parameters:
* $data: CakePHP data array from the form
* $datakey: key in the $data array. If you used <?= $form->file('Image/name1'); ?> in your view, then $datakey = name1
* $imgscale: the maximum width or height that you want your picture to be resized to
* $thumbscale: the maximum width or height that you want your thumbnail to be resized to
* $folderName: the name of the parent folder of the images. The images will be stored to /webroot/img/$folderName/big/ and /webroot/img/$folderName/small/
* $square: a boolean flag indicating whether you want square and zoom cropped thumbnails, or thumbnails with the same aspect ratio of the source image
*/
function upload_image_and_thumbnail($data, $datakey, $imgscale, $thumbscale, $folderName, $square) {
if (strlen($data['Image'][$datakey]['name'])>4){
$error = 0;
$tempuploaddir = "img/temp"; // the /temp/ directory, should delete the image after we upload
$biguploaddir = "img/".$folderName."/big"; // the /big/ directory
$smalluploaddir = "img/".$folderName."/small"; // the /small/ directory for thumbnails
// Make sure the required directories exist, and create them if necessary
if(!is_dir($tempuploaddir)) mkdir($tempuploaddir,true);
if(!is_dir($biguploaddir)) mkdir($biguploaddir,true);
if(!is_dir($smalluploaddir)) mkdir($smalluploaddir,true);
$filetype = $this->getFileExtension($data['Image'][$datakey]['name']);
$filetype = strtolower($filetype);
if (($filetype != "jpeg") && ($filetype != "jpg") && ($filetype != "gif") && ($filetype != "png"))
{
// verify the extension
return;
}
else
{
// Get the image size
$imgsize = GetImageSize($data['Image'][$datakey]['tmp_name']);
}
// Generate a unique name for the image (from the timestamp)
$id_unic = str_replace(".", "", strtotime ("now"));
$filename = $id_unic;
settype($filename,"string");
$filename.= ".";
$filename.=$filetype;
$tempfile = $tempuploaddir . "/$filename";
$resizedfile = $biguploaddir . "/$filename";
$croppedfile = $smalluploaddir . "/$filename";
if (is_uploaded_file($data['Image'][$datakey]['tmp_name']))
{
// Copy the image into the temporary directory
if (!copy($data['Image'][$datakey]['tmp_name'],"$tempfile"))
{
print "Error Uploading File!.";
exit();
}
else {
/*
* Generate the big version of the image with max of $imgscale in either directions
*/
$this->resize_img($tempfile, $imgscale, $resizedfile);
if($square) {
/*
* Generate the small square version of the image with scale of $thumbscale
*/
$this->crop_img($tempfile, $thumbscale, $croppedfile);
}
else {
/*
* Generate the big version of the image with max of $imgscale in either directions
*/
$this->resize_img($tempfile, $thumbscale, $croppedfile);
}
// Delete the temporary image
unlink($tempfile);
}
}
// Image uploaded, return the file name
return $filename;
}
}
/*
* Deletes the image and its associated thumbnail
* Example in controller action: $this->Image->delete_image("1210632285.jpg","sets");
*
* Parameters:
* $filename: The file name of the image
* $folderName: the name of the parent folder of the images. The images will be stored to /webroot/img/$folderName/big/ and /webroot/img/$folderName/small/
*/
function delete_image($filename,$folderName) {
unlink("img/".$folderName."/big/".$filename);
unlink("img/".$folderName."/small/".$filename);
}
function crop_img($imgname, $scale, $filename) {
$filetype = $this->getFileExtension($imgname);
$filetype = strtolower($filetype);
switch($filetype){
case "jpeg":
case "jpg":
$img_src = ImageCreateFromjpeg ($imgname);
break;
case "gif":
$img_src = imagecreatefromgif ($imgname);
break;
case "png":
$img_src = imagecreatefrompng ($imgname);
break;
}
$width = imagesx($img_src);
$height = imagesy($img_src);
$ratiox = $width / $height * $scale;
$ratioy = $height / $width * $scale;
//-- Calculate resampling
$newheight = ($width <= $height) ? $ratioy : $scale;
$newwidth = ($width <= $height) ? $scale : $ratiox;
//-- Calculate cropping (division by zero)
$cropx = ($newwidth - $scale != 0) ? ($newwidth - $scale) / 2 : 0;
$cropy = ($newheight - $scale != 0) ? ($newheight - $scale) / 2 : 0;
//-- Setup Resample & Crop buffers
$resampled = imagecreatetruecolor($newwidth, $newheight);
$cropped = imagecreatetruecolor($scale, $scale);
//-- Resample
imagecopyresampled($resampled, $img_src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
//-- Crop
imagecopy($cropped, $resampled, 0, 0, $cropx, $cropy, $newwidth, $newheight);
// Save the cropped image
switch($filetype)
{
case "jpeg":
case "jpg":
imagejpeg($cropped,$filename,80);
break;
case "gif":
imagegif($cropped,$filename,80);
break;
case "png":
imagepng($cropped,$filename,80);
break;
}
}
function resize_img($imgname, $size, $filename) {
$filetype = $this->getFileExtension($imgname);
$filetype = strtolower($filetype);
switch($filetype) {
case "jpeg":
case "jpg":
$img_src = ImageCreateFromjpeg ($imgname);
break;
case "gif":
$img_src = imagecreatefromgif ($imgname);
break;
case "png":
$img_src = imagecreatefrompng ($imgname);
break;
}
$true_width = imagesx($img_src);
$true_height = imagesy($img_src);
if ($true_width>=$true_height)
{
$width=$size;
$height = ($width/$true_width)*$true_height;
}
else
{
$width=$size;
$height = ($width/$true_width)*$true_height;
}
$img_des = ImageCreateTrueColor($width,$height);
imagecopyresampled ($img_des, $img_src, 0, 0, 0, 0, $width, $height, $true_width, $true_height);
// Save the resized image
switch($filetype)
{
case "jpeg":
case "jpg":
imagejpeg($img_des,$filename,80);
break;
case "gif":
imagegif($img_des,$filename,80);
break;
case "png":
imagepng($img_des,$filename,80);
break;
}
}
function getFileExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
} ?>

View file

@ -2,7 +2,7 @@
class CurrenciesController extends AppController {
var $name = 'Currencies';
var $helpers = array('Html', 'Form'), 'Ajax';
var $helpers = array('Html', 'Form', 'Ajax');
var $components = array('RequestHandler');
function index() {

View file

@ -83,7 +83,6 @@ class CustomersController extends AppController {
$this->Session->setFlash(__('The Customer could not be saved. Please, try again.', true));
$this->set('customer_categories', $this->Customer->CustomerCategory->find('list'));
$this->set('industries', $this->Customer->Industry->find('list', array('fields'=>array('Industry.id', 'Industry.name', 'ParentIndustry.name'),'recursive' => 0,
'order'=>'ParentIndustry.name ASC, Industry.name ASC')));
}

View file

@ -108,7 +108,7 @@ class EnquiriesController extends AppController {
$customer = $this->Enquiry->Customer->findById($this->data['Enquiry']['customer_id']);
$principle = $this->Enquiry->Principle->findById($this->data['Enquiry']['principle_id']);
$this->data['Enquiry']['principle_code'] = $principle['Principle']['code']; //Store which principle code this enquiry belongs to.
Sanitize::clean($this->data);
//Sanitize::clean($this->data);
if(isset($this->data['Contact']['new'])) {
if($this->data['Contact']['new']) {
$this->Enquiry->Contact->save($this->data);
@ -412,5 +412,26 @@ class EnquiriesController extends AppController {
}
function mark_submitted($id = null) {
if($id == null) {
$this->Session->setFlash('Invalid Enquiry ID');
$this->redirect(array('action'=>'index'));
}
else {
$this->Enquiry->id = $id;
$today = date("Y-m-d");
$this->Enquiry->saveField('submitted', $today);
$this->Session->setFlash('The Enquiry has been marked as submitted today ('.date('j M Y').')');
$this->redirect(array('action'=>'index'));
}
}
}
?>

View file

@ -0,0 +1,78 @@
<?php
class ProductOptionsCategoriesController extends AppController {
var $name = 'ProductOptionsCategories';
var $helpers = array('Html', 'Form');
function index() {
$this->ProductOptionsCategory->recursive = 0;
$this->set('productOptionsCategories', $this->paginate());
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid ProductOptionsCategory.', true));
$this->redirect(array('action'=>'index'));
}
$this->set('productOptionsCategory', $this->ProductOptionsCategory->read(null, $id));
}
function add($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid ProductOptionsCategory', true));
$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
$this->ProductOptionsCategory->create();
if ($this->ProductOptionsCategory->save($this->data)) {
$productid = $this->data['ProductOptionsCategory']['product_id'];
$this->Session->setFlash(__('The ProductOptionsCategory has been saved', true));
$this->redirect(array('controller'=>'products', 'action'=>'view', $productid));
} else {
$this->Session->setFlash(__('The ProductOptionsCategory could not be saved. Please, try again.', true));
}
}
$product = $this->ProductOptionsCategory->Product->find('first', array('conditions'=> array('Product.id' => $id), 'recursive' => false));
$this->set(compact('product'));
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid ProductOptionsCategory', true));
$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
if ($this->ProductOptionsCategory->save($this->data)) {
$this->Session->setFlash(__('The ProductOptionsCategory has been saved', true));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The ProductOptionsCategory could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->ProductOptionsCategory->read(null, $id);
}
$products = $this->ProductOptionsCategory->Product->find('list');
$this->set(compact('products'));
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for ProductOptionsCategory', true));
$this->redirect(array('action'=>'index'));
}
if ($this->ProductOptionsCategory->del($id)) {
$this->Session->setFlash(__('ProductOptionsCategory deleted', true));
$this->redirect(array('action'=>'index'));
}
}
}
?>

View file

@ -17,18 +17,25 @@ class ProductOptionsController extends AppController {
$this->set('productOption', $this->ProductOption->read(null, $id));
}
function add($productid = null) {
function add($catid = null) {
if (!$catid && empty($this->data)) {
$this->Session->setFlash(__('Invalid Product Options Category. Options can only be added to an existing Options Category.', true));
$this->redirect(array('action'=>'index'));
}
$optcat = $this->ProductOption->ProductOptionsCategory->read(null, $catid);
if (!empty($this->data)) {
$this->ProductOption->create();
$productid = $this->data['ProductOption']['product_id'];
if ($this->ProductOption->save($this->data)) {
$this->Session->setFlash(__('The Product Option has been saved', true));
$this->redirect(array('action'=>'index'));
$this->redirect(array('controller' => 'products', 'action'=>'view', $productid));
} else {
$this->Session->setFlash(__('The ProductOption could not be saved. Please, try again.', true));
}
}
$products = $this->ProductOption->Product->find('list');
$this->set(compact('products'));
$optcat = $this->ProductOption->ProductOptionsCategory->read(null, $catid);
$this->set('optcat', $optcat);
}
function edit($id = null) {
@ -37,18 +44,20 @@ class ProductOptionsController extends AppController {
$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
$productid = $this->data['ProductOption']['product_id'];
if ($this->ProductOption->save($this->data)) {
$this->Session->setFlash(__('The Product Option has been saved', true));
$this->redirect(array('action'=>'index'));
$this->redirect(array('controller'=> 'products', 'action'=>'view', $productid));
} else {
$this->Session->setFlash(__('The ProductOption could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->ProductOption->read(null, $id);
$product = $this->ProductOption->ProductOptionsCategory->Product->read(null, $this->data['ProductOption']['product_id']);
}
$products = $this->ProductOption->Product->find('list');
$this->set(compact('products'));
$this->set('product', $product);
}
function delete($id = null) {

View file

@ -3,7 +3,7 @@ class ProductsController extends AppController {
var $name = 'Products';
var $components = array('RequestHandler');
var $helpers = array('Html', 'Form', 'Ajax', 'Number', 'Fck');
var $helpers = array('Html', 'Form', 'Ajax', 'Number');
function index() {
$this->Product->recursive = 0;
@ -16,6 +16,11 @@ class ProductsController extends AppController {
$this->redirect(array('action'=>'index'));
}
$this->set('product', $this->Product->read(null, $id));
//$this->set('product', $this->Product->find('first', array('conditions' => array('Product.id'=>$id), 'recursive' => 1)));
$this->set('options', $this->Product->ProductOptionsCategory->find('all', array('conditions' => array('ProductOptionsCategory.product_id'=>$id), 'order'=>'ProductOptionsCategory.location ASC')));
$this->set('files', $this->Product->ProductAttachment->findAllByProductId($id));
$this->set('number_of_files', $this->Product->ProductAttachment->find('count', array('conditions' => array('ProductAttachment.product_id'=>$id))));
}
@ -56,6 +61,7 @@ class ProductsController extends AppController {
}
if (empty($this->data)) {
$this->data = $this->Product->read(null, $id);
$this->set('description', $this->data['Product']['description']);
}
$principles = $this->Product->Principle->find('list');
$this->set(compact('principles'));

View file

@ -0,0 +1,106 @@
<?php
class QuotePagesController extends AppController {
var $name = 'QuotePages';
var $helpers = array('Html', 'Form', 'Ajax', 'Number', 'Fck');
var $components = array('RequestHandler');
function index() {
$this->QuotePage->recursive = 0;
$this->set('quotePages', $this->paginate());
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid QuotePage.', true));
$this->redirect(array('action'=>'index'));
}
$this->set('quotePage', $this->QuotePage->read(null, $id));
}
function add($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid Quote ID', true));
$this->redirect(array('controller' => 'quotes', 'action'=>'index'));
}
if (!empty($this->data)) {
$this->QuotePage->create();
if ($this->QuotePage->save($this->data)) {
$this->Session->setFlash(__('The Quote Page has been saved', true));
$this->redirect(array('controller'=>'quotes', 'action'=>'view/'.$this->data['QuotePage']['quote_id']));
} else {
$this->Session->setFlash(__('The Quote Page could not be saved. Please, try again.', true));
}
}
$quotes = $this->QuotePage->Quote->find('list');
$this->set(compact('quotes'));
$this->set('quoteid', $id);
$number_of_pages = $this->QuotePage->find('count', array('conditions' => array('QuotePage.quote_id'=>$id)));
$number_of_pages++;
$this->set('pagenumber', $number_of_pages);
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid QuotePage', true));
$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
if ($this->QuotePage->save($this->data)) {
$this->Session->setFlash(__('The QuotePage has been saved', true));
$id = $this->data['QuotePage']['quote_id'];
$this->redirect(array('controller' => 'quotes', 'action'=>'view/'.$id));
} else {
$this->Session->setFlash(__('The QuotePage could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->QuotePage->read(null, $id);
$this->set('content', $this->data['QuotePage']['content']);
}
$quotes = $this->QuotePage->Quote->find('list');
$this->set(compact('quotes'));
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for QuotePage', true));
$this->redirect(array('action'=>'index'));
}
$quotepage = $this->QuotePage->findById($id);
$quoteid = $quotepage['QuotePage']['quote_id'];
if ($this->QuotePage->del($id)) {
$this->Session->setFlash(__('Quote Page deleted', true));
$this->redirect(array('controller' => 'quotes' , 'action'=>'view', $quoteid));
}
}
function show($id = null) {
$this->layout = 'ajax';
$this->set('quotePage', $this->QuotePage->read(null, $id));
}
function frame($id = null) {
$this->layout = 'ajax';
$this->set('id', $id);
}
}
?>

View file

@ -17,7 +17,13 @@ class QuoteProductsController extends AppController {
$this->set('quoteProduct', $this->QuoteProduct->read(null, $id));
}
function add() {
function add($quoteid = null) {
if (!$quoteid && empty($this->data)) {
$this->Session->setFlash(__('Invalid Quote ID', true));
$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
$this->QuoteProduct->create();
if ($this->QuoteProduct->save($this->data)) {
@ -27,18 +33,53 @@ class QuoteProductsController extends AppController {
$this->Session->setFlash(__('The QuoteProduct could not be saved. Please, try again.', true));
}
}
$principles = $this->QuoteProduct->Product->Principle->find('list');
$currencies = $this->QuoteProduct->Currency->find('list');
$quotes = $this->QuoteProduct->Quote->find('list');
$products = $this->QuoteProduct->Product->find('list');
$this->set(compact('principles', 'currencies', 'quotes', 'products'));
}
/* Display a list of Products for a given principle. Used for the add() method */
function principle_products() {
if (empty($this->data['QuoteProduct']['principle_id'])) {
}
else {
$this->set('products', $this->QuoteProduct->Product->find('list', array('conditions'=>array('Product.principle_id'=>$this->data['QuoteProduct']['principle_id']))));
}
}
/* Display a list of Options (if any) for a given Product. Used for the add() method */
function product_options() {
if (empty($this->data['QuoteProduct']['product_id'])) {
}
else {
// $this->set('options', $this->QuoteProduct->Product->ProductOptions->find('list', array('conditions'=>array('ProductOption.product_id'=>$this->data['QuoteProduct']['product_id']))));
$this->set('options', $this->QuoteProduct->Product->ProductOptionsCategory->find('all',
array('conditions' => array('ProductOptionsCategory.product_id'=>$this->data['QuoteProduct']['product_id']),
'order'=>'ProductOptionsCategory.location ASC')));
}
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid QuoteProduct', true));
$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
if ($this->QuoteProduct->save($this->data)) {
$this->Session->setFlash(__('The QuoteProduct has been saved', true));

View file

@ -16,7 +16,9 @@ class QuotesController extends AppController {
$this->Session->setFlash(__('Invalid Quote.', true));
$this->redirect(array('action'=>'index'));
}
$this->set('quote', $this->Quote->read(null, $id));
$quote = $this->Quote->read(null, $id);
$this->set('quote', $quote);
$this->set('customer', $this->Quote->Enquiry->Customer->read(null, $quote['Enquiry']['customer_id']));
}
function add() {
@ -79,4 +81,5 @@ class QuotesController extends AppController {
}
?>

View file

@ -4,7 +4,7 @@ class Product extends AppModel {
var $name = 'Product';
var $hasMany = array('ProductOption', 'ProductAttachment');
var $hasMany = array('ProductAttachment', 'ProductOptionsCategory');
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(

View file

@ -4,6 +4,6 @@ class ProductOption extends AppModel {
var $name = 'ProductOption';
var $belongsTo = array('Product');
var $belongsTo = array('ProductOptionsCategory');
}

View file

@ -0,0 +1,40 @@
<?php
class ProductOptionsCategory extends AppModel {
var $name = 'ProductOptionsCategory';
var $validate = array(
'product_id' => array('numeric'),
'name' => array('notempty'),
'location' => array('numeric'),
'exclusive' => array('notempty')
);
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
'Product' => array(
'className' => 'Product',
'foreignKey' => 'product_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
var $hasMany = array(
'ProductOption' => array(
'className' => 'ProductOption',
'foreignKey' => 'product_options_category_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);
}
?>

23
models/quote_page.php Normal file
View file

@ -0,0 +1,23 @@
<?php
class QuotePage extends AppModel {
var $name = 'QuotePage';
var $validate = array(
'page_number' => array('numeric'),
'content' => array('notempty'),
'quote_id' => array('numeric')
);
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
'Quote' => array(
'className' => 'Quote',
'foreignKey' => 'quote_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
}
?>

View file

@ -10,6 +10,7 @@
<tr>
<th><?php echo $paginator->sort('user_id');?></th>
<th><?php echo $paginator->sort('Date', 'created');?></th>
<th><?php echo $paginator->sort('Date Submitted', 'submitted'); ?></th>
<th><?php echo $paginator->sort('principle_id');?></th>
<th><?php echo $paginator->sort('Enquiry Number', 'title');?></th>
<th><?php echo $paginator->sort('customer_id');?></th>
@ -76,11 +77,30 @@ foreach ($enquiries as $enquiry):
$lastname = $enquiry['User']['last_name']; ?>
<?php echo $html->link($firstname[0].$lastname[0], array('controller'=> 'users', 'action'=>'view', $enquiry['User']['id'])); ?>
</td>
<td class="enqdate">
<?php
/* Change the date from MySQL DATETIME to a D M Y format */
echo date('j M Y',$time->toUnix($enquiry['Enquiry']['created'])); ?>
</td>
<td class="enqdate">
<?php
/* Change the date from MySQL DATETIME to a D M Y format */
if($enquiry['Enquiry']['submitted']) {
echo date('j M Y',$time->toUnix($enquiry['Enquiry']['submitted']));
}
else {
/* Maybe should make this so only the assigned user can mark it as submitted. */
echo $html->link('Not Submitted', array('controller'=>'enquiries', 'action'=>'mark_submitted', $enquiry['Enquiry']['id']));
}
?>
</td>
<td class="principlename">
<?php
if($enquiry['Principle']['short_name']) {
@ -106,8 +126,9 @@ foreach ($enquiries as $enquiry):
<?php echo $html->link($enquiry['Contact']['email'], 'mailto:'.$enquiry['Contact']['email'].'?subject='.$enquiry['Enquiry']['title'].'&bcc=carpis@cmctechnologies.com.au'); ?>
</td>
<td class="contactemail">
<?php if($enquiry['Contact']['direct_phone']) { echo $enquiry['Contact']['direct_phone']; }
else if($enquiry['Contact']['mobile']) { echo 'mob:'.$enquiry['Contact']['mobile']; }
<?php
if($enquiry['Contact']['mobile']) { echo 'mob:'.$enquiry['Contact']['mobile']; }
else if($enquiry['Contact']['direct_phone']) { echo $enquiry['Contact']['direct_phone']; }
else {
echo $enquiry['Contact']['phone'];
if($enquiry['Contact']['phone_extension']) {

View file

@ -16,7 +16,19 @@
echo $form->input('gst', array('label' => 'Is GST Applicable', 'options' => array('1' => 'Yes', '0' => 'No')));
echo $form->input('billing_address_id', array('div' => 'addressradio', 'legend' => 'Billing Address', 'options' => $billing_addresses_list, 'type' => 'radio'));
echo $form->input('shipping_address_id', array('div' => 'addressradio','legend' => 'Shipping Address', 'options' => $shipping_addresses_list, 'type' => 'radio'));
/* Need to fix this up Once Quotes are working*/
if($enquiry['Enquiry']['submitted']) {
echo $form->input('status_id');
}
else {
echo "Quote has not been submitted yet";
}
echo $form->input('submitted');
echo $form->input('comments', array('id'=>'comments', 'wrap'=>'hard'));
?>
<input type="BUTTON" onClick="datetime('<?php echo "$initials"; ?>');" value="Edit Comments" class="dateButton" id="datebutton"/>

View file

@ -1,28 +1,6 @@
<?php
/* SVN FILE: $Id: default.ctp 7118 2008-06-04 20:49:29Z gwoo $ */
/**
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
* Copyright 2005-2008, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.view.templates.layouts
* @since CakePHP(tm) v 0.10.0.1076
* @version $Revision: 7118 $
* @modifiedby $LastChangedBy: gwoo $
* @lastmodified $Date: 2008-06-04 13:49:29 -0700 (Wed, 04 Jun 2008) $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
?>
<? /* Quotenik 1.2 - Default Layout. Some Markup from CakePHP Default */?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
@ -36,11 +14,37 @@
echo $html->css('quotenik');
echo $scripts_for_layout;
echo $javascript->link('jquery');
echo $javascript->link('jquery-ui');
echo $javascript->link('prototype');
echo $javascript->link('scriptaculous');
echo $javascript->link('qtip');
echo $javascript->link('wymeditor/jquery.wymeditor.min');
echo $javascript->link('wymeditor/plugins/hovertools/jquery.wymeditor.hovertools.js');
echo $javascript->link('wymeditor/plugins/resizable/jquery.wymeditor.resizable.js');
?>
<script type="text/javascript">
jQuery(function() {
jQuery(".wymeditor").wymeditor({
skin: 'silver',
postInit: function(wym) {
wym.hovertools();
wym.resizable();
}
});
});
</script>
<script type="text/javascript"><!--//--><![CDATA[//><!--
sfHover = function() {

View file

@ -1,15 +1,19 @@
<div class="productOptions form">
<?php echo $form->create('ProductOption');?>
<fieldset>
<legend><?php __('Add ProductOption');?></legend>
<?php $product_link = $html->link(__($optcat['Product']['title'], true), array('controller'=>'products','action'=>'view',$optcat['Product']['id']));
$option = $html->link(__($optcat['ProductOptionsCategory']['name'],true), array('controller'=>'product_options_categories', 'action'=>'view', $optcat['ProductOptionsCategory']['id']));
?>
<legend><?php __('Add New "'.$option.'" Option to: '.$product_link);?></legend>
<?php
echo $form->input('product_id');
echo $form->input('product_id', array('type'=>'hidden', 'value'=>$optcat['Product']['id']));
echo $form->input('product_options_category_id', array('type'=>'hidden', 'value'=>$optcat['ProductOptionsCategory']['id']));
echo $form->input('title');
echo $form->input('description');
echo $form->input('part_number');
echo $form->input('model_number');
echo $form->input('default');
echo $form->input('part_number_location');
echo $form->input('exclusive');
echo $form->input('cost_price');
echo $form->input('exchange_rate');
echo $form->input('our_discount');
@ -31,5 +35,9 @@
<li><?php echo $html->link(__('List ProductOptions', true), array('action' => 'index'));?></li>
<li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product', true), array('controller' => 'products', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Product Options Categories', true), array('controller' => 'product_options_categories', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product Options Category', true), array('controller' => 'product_options_categories', 'action' => 'add')); ?> </li>
</ul>
</div>
<?php debug($optcat); ?>

View file

@ -4,13 +4,12 @@
<legend><?php __('Edit ProductOption');?></legend>
<?php
echo $form->input('id');
echo $form->input('product_id');
echo $form->input('product_id', array('type'=>'hidden'));
echo $form->input('product_options_category_id', array('type'=>'hidden'));
echo $form->input('title');
echo $form->input('model_number');
echo $form->input('description');
echo $form->input('part_number');
echo $form->input('default');
echo $form->input('part_number_location');
echo $form->input('exclusive');
echo $form->input('cost_price');
echo $form->input('exchange_rate');
echo $form->input('our_discount');
@ -33,5 +32,7 @@
<li><?php echo $html->link(__('List ProductOptions', true), array('action' => 'index'));?></li>
<li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product', true), array('controller' => 'products', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Product Options Categories', true), array('controller' => 'product_options_categories', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product Options Category', true), array('controller' => 'product_options_categories', 'action' => 'add')); ?> </li>
</ul>
</div>

View file

@ -10,12 +10,11 @@ echo $paginator->counter(array(
<tr>
<th><?php echo $paginator->sort('id');?></th>
<th><?php echo $paginator->sort('product_id');?></th>
<th><?php echo $paginator->sort('product_options_category_id');?></th>
<th><?php echo $paginator->sort('title');?></th>
<th><?php echo $paginator->sort('description');?></th>
<th><?php echo $paginator->sort('part_number');?></th>
<th><?php echo $paginator->sort('model_number');?></th>
<th><?php echo $paginator->sort('default');?></th>
<th><?php echo $paginator->sort('part_number_location');?></th>
<th><?php echo $paginator->sort('exclusive');?></th>
<th><?php echo $paginator->sort('cost_price');?></th>
<th><?php echo $paginator->sort('exchange_rate');?></th>
<th><?php echo $paginator->sort('our_discount');?></th>
@ -45,6 +44,9 @@ foreach ($productOptions as $productOption):
<td>
<?php echo $html->link($productOption['Product']['title'], array('controller' => 'products', 'action' => 'view', $productOption['Product']['id'])); ?>
</td>
<td>
<?php echo $html->link($productOption['ProductOptionsCategory']['name'], array('controller' => 'product_options_categories', 'action' => 'view', $productOption['ProductOptionsCategory']['id'])); ?>
</td>
<td>
<?php echo $productOption['ProductOption']['title']; ?>
</td>
@ -52,17 +54,11 @@ foreach ($productOptions as $productOption):
<?php echo $productOption['ProductOption']['description']; ?>
</td>
<td>
<?php echo $productOption['ProductOption']['part_number']; ?>
<?php echo $productOption['ProductOption']['model_number']; ?>
</td>
<td>
<?php echo $productOption['ProductOption']['default']; ?>
</td>
<td>
<?php echo $productOption['ProductOption']['part_number_location']; ?>
</td>
<td>
<?php echo $productOption['ProductOption']['exclusive']; ?>
</td>
<td>
<?php echo $productOption['ProductOption']['cost_price']; ?>
</td>
@ -118,5 +114,7 @@ foreach ($productOptions as $productOption):
<li><?php echo $html->link(__('New ProductOption', true), array('action' => 'add')); ?></li>
<li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product', true), array('controller' => 'products', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Product Options Categories', true), array('controller' => 'product_options_categories', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product Options Category', true), array('controller' => 'product_options_categories', 'action' => 'add')); ?> </li>
</ul>
</div>

View file

@ -11,6 +11,11 @@
<?php echo $html->link($productOption['Product']['title'], array('controller' => 'products', 'action' => 'view', $productOption['Product']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Product Options Category'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($productOption['ProductOptionsCategory']['name'], array('controller' => 'product_options_categories', 'action' => 'view', $productOption['ProductOptionsCategory']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Title'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $productOption['ProductOption']['title']; ?>
@ -21,9 +26,9 @@
<?php echo $productOption['ProductOption']['description']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Part Number'); ?></dt>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Model Number'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $productOption['ProductOption']['part_number']; ?>
<?php echo $productOption['ProductOption']['model_number']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Default'); ?></dt>
@ -31,16 +36,6 @@
<?php echo $productOption['ProductOption']['default']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Part Number Location'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $productOption['ProductOption']['part_number_location']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Exclusive'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $productOption['ProductOption']['exclusive']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Cost Price'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $productOption['ProductOption']['cost_price']; ?>
@ -111,5 +106,7 @@
<li><?php echo $html->link(__('New ProductOption', true), array('action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product', true), array('controller' => 'products', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Product Options Categories', true), array('controller' => 'product_options_categories', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product Options Category', true), array('controller' => 'product_options_categories', 'action' => 'add')); ?> </li>
</ul>
</div>

View file

@ -0,0 +1,26 @@
<div class="productOptionsCategories form">
<?php echo $form->create('ProductOptionsCategory');?>
<fieldset>
<?php $link = $html->link(__($product['Product']['title'], true), array('controller' => 'products', 'action' => 'view', $product['Product']['id'])); ?>
<legend><?php __('Add Options Category to Product: '.$link);?></legend>
<?php
echo $form->input('product_id', array('type'=>'hidden', 'value'=> $product['Product']['id']));
echo $form->input('name');
echo $form->input('location');
echo $form->input('exclusive');
?>
</fieldset>
<?php echo $form->end('Submit');?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('List ProductOptionsCategories', true), array('action' => 'index'));?></li>
<li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product', true), array('controller' => 'products', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Product Options', true), array('controller' => 'product_options', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product Option', true), array('controller' => 'product_options', 'action' => 'add')); ?> </li>
</ul>
</div>
<?php debug($product); ?>

View file

@ -0,0 +1,24 @@
<div class="productOptionsCategories form">
<?php echo $form->create('ProductOptionsCategory');?>
<fieldset>
<legend><?php __('Edit ProductOptionsCategory');?></legend>
<?php
echo $form->input('id');
echo $form->input('product_id');
echo $form->input('name');
echo $form->input('location');
echo $form->input('exclusive');
?>
</fieldset>
<?php echo $form->end('Submit');?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Delete', true), array('action' => 'delete', $form->value('ProductOptionsCategory.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('ProductOptionsCategory.id'))); ?></li>
<li><?php echo $html->link(__('List ProductOptionsCategories', true), array('action' => 'index'));?></li>
<li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product', true), array('controller' => 'products', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Product Options', true), array('controller' => 'product_options', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product Option', true), array('controller' => 'product_options', 'action' => 'add')); ?> </li>
</ul>
</div>

View file

@ -0,0 +1,64 @@
<div class="productOptionsCategories index">
<h2><?php __('ProductOptionsCategories');?></h2>
<p>
<?php
echo $paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?></p>
<table cellpadding="0" cellspacing="0">
<tr>
<th><?php echo $paginator->sort('id');?></th>
<th><?php echo $paginator->sort('product_id');?></th>
<th><?php echo $paginator->sort('name');?></th>
<th><?php echo $paginator->sort('location');?></th>
<th><?php echo $paginator->sort('exclusive');?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($productOptionsCategories as $productOptionsCategory):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td>
<?php echo $productOptionsCategory['ProductOptionsCategory']['id']; ?>
</td>
<td>
<?php echo $html->link($productOptionsCategory['Product']['title'], array('controller' => 'products', 'action' => 'view', $productOptionsCategory['Product']['id'])); ?>
</td>
<td>
<?php echo $productOptionsCategory['ProductOptionsCategory']['name']; ?>
</td>
<td>
<?php echo $productOptionsCategory['ProductOptionsCategory']['location']; ?>
</td>
<td>
<?php echo $productOptionsCategory['ProductOptionsCategory']['exclusive']; ?>
</td>
<td class="actions">
<?php echo $html->link(__('View', true), array('action' => 'view', $productOptionsCategory['ProductOptionsCategory']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('action' => 'edit', $productOptionsCategory['ProductOptionsCategory']['id'])); ?>
<?php echo $html->link(__('Delete', true), array('action' => 'delete', $productOptionsCategory['ProductOptionsCategory']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $productOptionsCategory['ProductOptionsCategory']['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();?>
<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('New ProductOptionsCategory', true), array('action' => 'add')); ?></li>
<li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product', true), array('controller' => 'products', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Product Options', true), array('controller' => 'product_options', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product Option', true), array('controller' => 'product_options', 'action' => 'add')); ?> </li>
</ul>
</div>

View file

@ -0,0 +1,113 @@
<div class="productOptionsCategories view">
<h2><?php __('ProductOptionsCategory');?></h2>
<dl><?php $i = 0; $class = ' class="altrow"';?>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $productOptionsCategory['ProductOptionsCategory']['id']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Product'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($productOptionsCategory['Product']['title'], array('controller' => 'products', 'action' => 'view', $productOptionsCategory['Product']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Name'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $productOptionsCategory['ProductOptionsCategory']['name']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Location'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $productOptionsCategory['ProductOptionsCategory']['location']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Exclusive'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $productOptionsCategory['ProductOptionsCategory']['exclusive']; ?>
&nbsp;
</dd>
</dl>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Edit ProductOptionsCategory', true), array('action' => 'edit', $productOptionsCategory['ProductOptionsCategory']['id'])); ?> </li>
<li><?php echo $html->link(__('Delete ProductOptionsCategory', true), array('action' => 'delete', $productOptionsCategory['ProductOptionsCategory']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $productOptionsCategory['ProductOptionsCategory']['id'])); ?> </li>
<li><?php echo $html->link(__('List ProductOptionsCategories', true), array('action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New ProductOptionsCategory', true), array('action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product', true), array('controller' => 'products', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Product Options', true), array('controller' => 'product_options', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Product Option', true), array('controller' => 'product_options', 'action' => 'add')); ?> </li>
</ul>
</div>
<div class="related">
<h3><?php __('Related Product Options');?></h3>
<?php if (!empty($productOptionsCategory['ProductOption'])):?>
<table cellpadding = "0" cellspacing = "0">
<tr>
<th><?php __('Id'); ?></th>
<th><?php __('Product Id'); ?></th>
<th><?php __('Product Options Category Id'); ?></th>
<th><?php __('Title'); ?></th>
<th><?php __('Description'); ?></th>
<th><?php __('Model Number'); ?></th>
<th><?php __('Default'); ?></th>
<th><?php __('Cost Price'); ?></th>
<th><?php __('Exchange Rate'); ?></th>
<th><?php __('Our Discount'); ?></th>
<th><?php __('Packing Each'); ?></th>
<th><?php __('Shipping Weight Each'); ?></th>
<th><?php __('Shipping Cost Each'); ?></th>
<th><?php __('Duty'); ?></th>
<th><?php __('Customs'); ?></th>
<th><?php __('Finance'); ?></th>
<th><?php __('Misc Cost'); ?></th>
<th><?php __('Sell Price'); ?></th>
<th><?php __('Notes'); ?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($productOptionsCategory['ProductOption'] as $productOption):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $productOption['id'];?></td>
<td><?php echo $productOption['product_id'];?></td>
<td><?php echo $productOption['product_options_category_id'];?></td>
<td><?php echo $productOption['title'];?></td>
<td><?php echo $productOption['description'];?></td>
<td><?php echo $productOption['model_number'];?></td>
<td><?php echo $productOption['default'];?></td>
<td><?php echo $productOption['cost_price'];?></td>
<td><?php echo $productOption['exchange_rate'];?></td>
<td><?php echo $productOption['our_discount'];?></td>
<td><?php echo $productOption['packing_each'];?></td>
<td><?php echo $productOption['shipping_weight_each'];?></td>
<td><?php echo $productOption['shipping_cost_each'];?></td>
<td><?php echo $productOption['duty'];?></td>
<td><?php echo $productOption['customs'];?></td>
<td><?php echo $productOption['finance'];?></td>
<td><?php echo $productOption['misc_cost'];?></td>
<td><?php echo $productOption['sell_price'];?></td>
<td><?php echo $productOption['notes'];?></td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller' => 'product_options', 'action' => 'view', $productOption['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller' => 'product_options', 'action' => 'edit', $productOption['id'])); ?>
<?php echo $html->link(__('Delete', true), array('controller' => 'product_options', 'action' => 'delete', $productOption['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $productOption['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
<div class="actions">
<ul>
<li><?php echo $html->link(__('New Product Option', true), array('controller' => 'product_options', 'action' => 'add'));?> </li>
</ul>
</div>
</div>

View file

@ -1,29 +1,23 @@
<?php echo $javascript->link('quotenik/product_buildup.js', false); ?>
<div class="addproduct">
<?php echo $form->create('Product', array('id'=>'productaddform', 'class'=>'addproduct'));?>
<fieldset>
<legend><?php __('Add Product');?></legend>
<?php
echo $form->input('principle_id');
echo $form->input('title');
echo "<div class=\"input text\">";
echo "<label for=\"data[Product][description\">Description</label>";
echo $fck->fckeditor(array('Product', 'description'), '');
echo "</div>";
//echo $form->input('description');
echo $form->input('description', array('class'=>'wymeditor'));
echo $form->input('part_number');
echo $form->input('product_category_id');
echo $ajax->link('Enter Costing Info', array('controller'=> 'products', 'action' => 'add_costing'), array( 'update' => 'costingdetails'));
echo $ajax->link('Show Costing Info', array('controller'=> 'products', 'action' => 'add_costing'), array( 'update' => 'costingdetails'));
echo '<div id="costingdetails">';
echo '</div>';
echo $form->input('notes');
?>
</fieldset>
<?php echo $form->end('Submit');?>
<?php echo $form->end(array('label' => 'Add Product', 'class'=>'wymupdate'));?>
</div>
<div class="actions">
<ul>

View file

@ -11,14 +11,12 @@
echo $form->label('Product.convert_to_aud', 'Convert to A$');
echo $form->text('Product.convert_to_aud', array('readonly'=>'readonly', 'id'=>'convert_to_aud'));
echo '</div>';
echo $form->input('Product.duty', array('label' => 'Duty %', 'id'=>'duty'));
echo $form->input('Product.shipping_weight_each', array('id'=>'shippingweight_each'));
echo $form->input('Product.shipping_cost_each', array('id'=>'shippingcost_each'));
echo $form->input('Product.customs', array('id'=>'customs'));
echo $form->input('Product.misc_cost', array('label' => 'Misc. Costs', 'id'=>'misc_cost'));
echo $form->input('Product.finance', array('label' => 'Finance %', 'id'=>'finance', 'after'=>'<p id="financeamount"> </p>'));
echo '<div class="input text">';
echo $form->label('Product.total_landed_cost', 'Total Landed Cost');
echo $form->text('Product.total_landed_cost', array('readonly'=>'readonly', 'id'=>'total_landed_cost'));

View file

@ -9,13 +9,16 @@
//echo $form->input('description');
echo "<div class=\"input text\">";
/*echo "<div class=\"input text\">";
echo "<label for=\"data[Product][description\">Description</label>";
echo $fck->fckeditor(array('Product', 'description'), $description);
echo "</div>";
*/
echo $form->input('description', array('class'=>'wymeditor'));
echo $form->input('part_number');
echo $form->input('model_number');
echo $form->input('model_number_format');
echo $form->input('cost_price_each');
echo $form->input('our_discount');
echo $form->input('packing_each');
@ -26,7 +29,7 @@
echo $form->input('notes');
?>
</fieldset>
<?php echo $form->end('Submit');?>
<?php echo $form->end(array('label' => 'Edit Product', 'class'=>'wymupdate'));?>
</div>
<div class="actions">
<ul>

View file

@ -12,15 +12,7 @@ echo $paginator->counter(array(
<th><?php echo $paginator->sort('principle_id');?></th>
<th><?php echo $paginator->sort('title');?></th>
<th><?php echo $paginator->sort('description');?></th>
<th><?php echo $paginator->sort('part_number');?></th>
<th><?php echo $paginator->sort('cost_price_each');?></th>
<th><?php echo $paginator->sort('our_discount');?></th>
<th><?php echo $paginator->sort('packing_each');?></th>
<th><?php echo $paginator->sort('shipping_weight_each');?></th>
<th><?php echo $paginator->sort('shipping_cost_each');?></th>
<th><?php echo $paginator->sort('duty');?></th>
<th><?php echo $paginator->sort('sellprice_each');?></th>
<th><?php echo $paginator->sort('notes');?></th>
<th><?php echo $paginator->sort('model_number');?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
@ -45,31 +37,7 @@ foreach ($products as $product):
<?php echo $product['Product']['description']; ?>
</td>
<td>
<?php echo $product['Product']['part_number']; ?>
</td>
<td>
<?php echo $product['Product']['cost_price_each']; ?>
</td>
<td>
<?php echo $product['Product']['our_discount']; ?>
</td>
<td>
<?php echo $product['Product']['packing_each']; ?>
</td>
<td>
<?php echo $product['Product']['shipping_weight_each']; ?>
</td>
<td>
<?php echo $product['Product']['shipping_cost_each']; ?>
</td>
<td>
<?php echo $product['Product']['duty']; ?>
</td>
<td>
<?php echo $product['Product']['sellprice_each']; ?>
</td>
<td>
<?php echo $product['Product']['notes']; ?>
<?php echo $product['Product']['model_number']; ?>
</td>
<td class="actions">
<?php echo $html->link(__('View', true), array('action'=>'view', $product['Product']['id'])); ?>

View file

@ -1,5 +1,6 @@
<div class="products view">
<h2><?php __('Product');?></h2>
<h2><?php __('Product: '.$product['Product']['title']);?></h2>
<dl><?php $i = 0; $class = ' class="altrow"';?>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Principle'); ?></dt>
@ -17,49 +18,16 @@
<?php echo $product['Product']['description']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Part Number'); ?></dt>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Model Number'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $product['Product']['part_number']; ?>
<?php echo $product['Product']['model_number']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Cost Price Each'); ?></dt>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Model Number Format'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $product['Product']['cost_price_each']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Our Discount'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $product['Product']['our_discount']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Packing Each'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $product['Product']['packing_each']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Shipping Weight Each'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $product['Product']['shipping_weight_each']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Shipping Cost Each'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $product['Product']['shipping_cost_each']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Duty'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $product['Product']['duty']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Sellprice Each'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $product['Product']['sellprice_each']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Notes'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $product['Product']['notes']; ?>
<?php echo $product['Product']['model_number_format']; ?>
&nbsp;
</dd>
</dl>
@ -72,65 +40,48 @@
</ul>
</div>
<div class="related">
<h3><?php __('Product Options');?></h3>
<?php if (!empty($product['ProductOption'])):?>
<table cellpadding = "0" cellspacing = "0">
<tr>
<th><?php __('Title'); ?></th>
<th><?php __('Description'); ?></th>
<th><?php __('Cost Price'); ?></th>
<th><?php __('Our Discount'); ?></th>
<th><?php __('Packing Each'); ?></th>
<th><?php __('Shipping Weight Each'); ?></th>
<th><?php __('Shipping Cost Each'); ?></th>
<th><?php __('Duty'); ?></th>
<th><?php __('Sell Price'); ?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($product['ProductOption'] as $productOption):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $productOption['title'];?></td>
<td><?php echo $productOption['description'];?></td>
<td><?php echo $productOption['cost_price'];?></td>
<td><?php echo $productOption['our_discount'];?></td>
<td><?php echo $productOption['packing_each'];?></td>
<td><?php echo $productOption['shipping_weight_each'];?></td>
<td><?php echo $productOption['shipping_cost_each'];?></td>
<td><?php echo $productOption['duty'];?></td>
<td><?php echo $productOption['sell_price'];?></td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller'=> 'product_options', 'action'=>'view', $productOption['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller'=> 'product_options', 'action'=>'edit', $productOption['id'])); ?>
<?php echo $html->link(__('Delete', true), array('controller'=> 'product_options', 'action'=>'delete', $productOption['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $productOption['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
<div class="actions">
<ul>
<li><?php echo $html->link(__('New Product Option', true), array('controller'=> 'product_options', 'action'=>'add'));?> </li>
</ul>
</div>
</div>
<div class="related">
<h3><?php if($number_of_files == 1) {
__($number_of_files.' Attachment in this Product');
<h2>Option Categories for this Product</h2>
<?php echo $html->link(__('Add new Option Category', true), array('controller'=>'ProductOptionsCategories', 'action'=>'add', $product['Product']['id'])); ?>
<?php foreach($options as $opt): ?>
<h3><?php echo $opt['ProductOptionsCategory']['name']; ?></h3>
<table class="productoptions">
<th><?php __('Model Number'); ?></th>
<th><?php __('Name'); ?></th>
<th class="actions">Actions</th>
<?php
if($opt['ProductOption']):
foreach($opt['ProductOption'] as $option): ?>
<?php
if($option['default'] == '1') {
echo '<tr class="defaultoption">';
}
else {
__($number_of_files.' Attachments in this Product');
echo '<tr>';
}
?>
<?php echo $html->image('document.png'); ?></h3>
<?php echo $this->element('product_attachment_table', $files); ?>
</div>
<td><?php echo $option['model_number'];?></td>
<td><?php echo $option['title'];?></td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller' => 'product_options', 'action' => 'view', $option['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller' => 'product_options', 'action' => 'edit', $option['id'])); ?>
</td>
</tr>
<? endforeach;
endif;
?>
</table>
<?php echo $html->link(__('Add new '.$opt['ProductOptionsCategory']['name'].' option', true), array('controller'=>'ProductOptions', 'action'=>'add', $opt['ProductOptionsCategory']['id'])); ?>
<?php endforeach; ?>
<?php debug($product); ?>
<?php debug($options); ?>

View file

@ -1,8 +1,33 @@
<div class="quoteProducts form">
<?php echo $form->create('QuoteProduct');?>
<fieldset>
<legend><?php __('Add QuoteProduct');?></legend>
<legend><?php __('Add Product to this Quote');?></legend>
<?php
echo $form->input('principle_id');
echo $ajax->observeField('QuoteProductPrincipleId', array(
'url' => 'principle_products',
'frequency' => 0.2,
'update' => 'products'
));
echo $form->input('product_id', array('type' => 'select', 'id'=>'products'));
/*echo $ajax->observeField('products', array(
'url' => 'product_options',
'frequency' => 0.2,
'update' => 'productoptions'
));
echo '<div id="productoptions"></div>';
//echo $form->select('QuoteProduct.product_id', null, null, array('id'=>'products'));
*/
/*
echo $form->input('item_number');
echo $form->input('option');
echo $form->input('quantity');
@ -23,6 +48,8 @@
echo $form->input('quote_id');
echo $form->input('product_id');
echo $form->input('discount');
*/
?>
</fieldset>
<?php echo $form->end('Submit');?>

View file

@ -1,80 +1,25 @@
<div class="quotes view">
<h2><?php
$enquirynumber_link = $html->link($quote['Enquiry']['title'],
array('controller'=>'enquiries', 'action'=>'view', $quote['Enquiry']['id']));
if($quote['Quote']['revision'] == 0) {
__('Quote: '.$quote['Enquiry']['title']);
__('Quote: '.$enquirynumber_link);
}
else {
__('Quote: '.$quote['Enquiry']['title'].' Revision '.$quote['Quote']['revision']);
__('Quote: '.$enquirynumber_link.' Revision '.$quote['Quote']['revision']);
}
?></h2>
<dl><?php $i = 0; $class = ' class="altrow"';?>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $time->nice($quote['Quote']['created']); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Modified'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $time->nice($quote['Quote']['modified']); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Enquiry'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($quote['Enquiry']['title'], array('controller'=> 'enquiries', 'action'=>'view', $quote['Enquiry']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Revision'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quote['Quote']['revision']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Delivery Time'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quote['Quote']['delivery_time']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Payment Terms'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quote['Quote']['payment_terms']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Days Valid'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quote['Quote']['days_valid']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Valid Until'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $quote['Quote']['valid_until']; ?>
&nbsp;
</dd>
</dl>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Edit Details', true), array('action'=>'edit', $quote['Quote']['id'])); ?> </li>
</ul>
</div>
<div id="viewpage">
</div>
<div id="LoadingDiv" style="display: none;">
<?php echo $html->image('ajax-loader.gif'); ?>
</div>
<div class="related">
<h3><?php __('Cover Pages'); ?> </h3>
<?php if(!empty($quote['QuotePage'])): ?>
<table cellpadding = "0" cellspacing = "0">
<tr>
<th>Page Number</th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
@ -83,13 +28,15 @@ else {
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $quotePage['page_number']; ?></td>
<td class="actions">
?>
<div class="related">
<h3>Cover Page <?php echo $i; ?> </h3>
<?php echo $ajax->link('View', array('controller'=> 'quote_pages', 'action'=>'show', $quotePage['id']),
array('update'=>'viewpage', 'indicator' => 'LoadingDiv','loading'=>'Effect.appear(\'viewpage\')'));
array('update'=>'viewpage'.$i, 'indicator' => 'LoadingDiv','loading'=>'Effect.appear(\'viewpage\')'));
// echo $ajax->link('View', array('controller'=> 'quote_pages', 'action'=>'show', $quotePage['id']),
@ -98,19 +45,23 @@ else {
<?php // echo $html->link(__('Edit', true), array('controller'=> 'quote_pages', 'action'=>'edit', $quotePage['id']));
echo $ajax->link('Edit', array('controller'=> 'quote_pages', 'action'=>'edit', $quotePage['id']),
array('update'=>'viewpage', 'indicator' => 'LoadingDiv','loading'=>'Effect.appear(\'viewpage\')'));
// echo $ajax->link('Edit', array('controller'=> 'quote_pages', 'action'=>'edit', $quotePage['id']),
// array('update'=>'viewpage'.$i, 'indicator' => 'LoadingDiv','loading'=>'Effect.toggle(\'viewpage\', \'blind\')'));
echo $html->link('Edit', array('controller'=>'quote_pages', 'action'=>'edit', $quotePage['id']));
?>
<?php echo $html->link(__('Delete', true), array('controller'=> 'quote_pages', 'action'=>'delete', $quotePage['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $quotePage['id'])); ?>
</td>
</div>
<div id="viewpage<?php echo $i;?>">
</div>
<?php endforeach; ?>
</table>
<?php endif; ?>
<div class="actions">
<ul>
@ -124,7 +75,7 @@ else {
<div class="related">
<h3><?php __('Related Quote Products');?></h3>
<h3><?php __('Products in this Quote');?></h3>
<?php if (!empty($quote['QuoteProduct'])):?>
<table cellpadding = "0" cellspacing = "0">
<tr>
@ -133,28 +84,9 @@ else {
<th><?php __('Option'); ?></th>
<th><?php __('Principle Id'); ?></th>
<th><?php __('Quantity'); ?></th>
<th><?php __('Costprice'); ?></th>
<th><?php __('Currency Id'); ?></th>
<th><?php __('Ourdiscount'); ?></th>
<th><?php __('Packing'); ?></th>
<th><?php __('Shippingweight'); ?></th>
<th><?php __('Shippingcost'); ?></th>
<th><?php __('Exchangerate'); ?></th>
<th><?php __('Duty'); ?></th>
<th><?php __('Finance'); ?></th>
<th><?php __('Misc'); ?></th>
<th><?php __('Grosssellprice'); ?></th>
<th><?php __('Grossgpdollars'); ?></th>
<th><?php __('Grossgppercentage'); ?></th>
<th><?php __('Netgpdollars'); ?></th>
<th><?php __('Netgppercent'); ?></th>
<th><?php __('Targetgp'); ?></th>
<th><?php __('Title'); ?></th>
<th><?php __('Description'); ?></th>
<th><?php __('Total Landed Cost'); ?></th>
<th><?php __('Fob Countryof Export'); ?></th>
<th><?php __('Quote Id'); ?></th>
<th><?php __('Product Id'); ?></th>
<th><?php __('Discount'); ?></th>
<th><?php __('Discountamount'); ?></th>
<th><?php __('Grosssellpriceeach'); ?></th>
@ -179,28 +111,9 @@ else {
<td><?php echo $quoteProduct['option'];?></td>
<td><?php echo $quoteProduct['principle_id'];?></td>
<td><?php echo $quoteProduct['quantity'];?></td>
<td><?php echo $quoteProduct['costprice'];?></td>
<td><?php echo $quoteProduct['currency_id'];?></td>
<td><?php echo $quoteProduct['ourdiscount'];?></td>
<td><?php echo $quoteProduct['packing'];?></td>
<td><?php echo $quoteProduct['shippingweight'];?></td>
<td><?php echo $quoteProduct['shippingcost'];?></td>
<td><?php echo $quoteProduct['exchangerate'];?></td>
<td><?php echo $quoteProduct['duty'];?></td>
<td><?php echo $quoteProduct['finance'];?></td>
<td><?php echo $quoteProduct['misc'];?></td>
<td><?php echo $quoteProduct['grosssellprice'];?></td>
<td><?php echo $quoteProduct['grossgpdollars'];?></td>
<td><?php echo $quoteProduct['grossgppercentage'];?></td>
<td><?php echo $quoteProduct['netgpdollars'];?></td>
<td><?php echo $quoteProduct['netgppercent'];?></td>
<td><?php echo $quoteProduct['targetgp'];?></td>
<td><?php echo $quoteProduct['title'];?></td>
<td><?php echo $quoteProduct['description'];?></td>
<td><?php echo $quoteProduct['total_landed_cost'];?></td>
<td><?php echo $quoteProduct['fob_countryof_export'];?></td>
<td><?php echo $quoteProduct['quote_id'];?></td>
<td><?php echo $quoteProduct['product_id'];?></td>
<td><?php echo $quoteProduct['discount'];?></td>
<td><?php echo $quoteProduct['discountamount'];?></td>
<td><?php echo $quoteProduct['grosssellpriceeach'];?></td>
@ -221,7 +134,7 @@ else {
<div class="actions">
<ul>
<li><?php echo $html->link(__('New Quote Product', true), array('controller'=> 'quote_products', 'action'=>'add'));?> </li>
<li><?php echo $html->link(__('Add Product to this Quote', true), array('controller'=> 'quote_products', 'action'=>'add', $quote['Quote']['id']));?> </li>
</ul>
</div>

View file

@ -1,5 +1,11 @@
/* SVN FILE: $Id: cake.generic.css 7118 2008-06-04 20:49:29Z gwoo $ */
/*
/**
*
*
*
* Quotenik - Working CSS file based on the CakePHP default CSS.
* Modified by Karl Cordes 2008/2009
*
*
* PHP versions 4 and 5
*
@ -302,6 +308,10 @@ dl#showemail {
border: black 1px solid;
}
div.quotepageview {
overflow: scroll;
border: black 1px solid;
}
.addressradio label {
display: block;
@ -506,6 +516,18 @@ table.emailtable {
font-size: small;
}
/* Product Options Tables */
table.productoptions {
width: 40em;
}
table.productoptions tr.defaultoption {
font-weight: bold;
}
/* Paging */
div.paging {
background:#fff;
@ -575,7 +597,7 @@ form {
clear: left;
margin-right: 20px;
padding: 0;
width: 50%;
width: 60%;
}
@ -721,7 +743,7 @@ div.addproduct {
form.addproduct {
margin-right: 20px;
padding: 0;
width: 50%;
width: 80%;
}
@ -1007,3 +1029,6 @@ div.categorylist h3 a:hover {
text-decoration: underline;
}
div#costingwrapper {
display: none;
}